jQuery(document).ready(
	function()
	{
		var tdCars = jQuery("table.buttoncontainer td a");
		for (var i=0;i!=tdCars.length;i++)
		{
		    tdCars[i].onmouseover = function(e)
		    {
		         var td = e!=null ? e.target : event.srcElement;
		         td = td.parentNode;
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=td.offsetParent.rows[0].cells.length-1)
		         {
		              td.style.backgroundImage = "url(/images/avtomir/car_menu_hover_left.gif)";
		              td.style.backgroundPosition = "top left";
		         }
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "none";
		         }
		         
		         if (td.cellIndex==1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "url(/images/avtomir/car_menu_hover_left_first.gif)";
		         }
		         
		         if (td.cellIndex==td.offsetParent.rows[0].cells.length-2)
		         {
		              var nextTD = td.offsetParent.rows[0].cells[td.cellIndex+1];
		              nextTD.style.backgroundImage = "url(/images/avtomir/car_menu_hover_right_last.gif)";
		         }
		    };
		
		    tdCars[i].onmouseout = function(e)
		    {
		         var td = e!=null ? e.target : event.srcElement;
		         td = td.parentNode;
		
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=td.offsetParent.rows[0].cells.length-1)
		         {
		              td.style.backgroundImage = "";
		              td.style.backgroundPosition = "right 7px";
		         }
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "";
		         }
		
		         if (td.cellIndex==1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "";
		         }
		         
		         if (td.cellIndex==td.offsetParent.rows[0].cells.length-2)
		         {
		              var nextTD = td.offsetParent.rows[0].cells[td.cellIndex+1];
		              nextTD.style.backgroundImage = "";
		         }
		    };
		    
			tdCars[i].onmousedown = function(e)
		    {
		         var td = e!=null ? e.target : event.srcElement;
		         td = td.parentNode;
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=td.offsetParent.rows[0].cells.length-1)
		         {
		//         td.style.backgroundImage = "none";
		                  td.style.backgroundImage = "url(/images/avtomir/car_menu_mousedown_left.gif)";
		     //             td.style.backgroundPosition = "top left";
		         }
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "none";
		         }
		         
		         if (td.cellIndex==1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "url(/images/avtomir/car_menu_mousedown_left_first.gif)";
		         }
		         
		         if (td.cellIndex==td.offsetParent.rows[0].cells.length-2)
		         {
		              var nextTD = td.offsetParent.rows[0].cells[td.cellIndex+1];
		              nextTD.style.backgroundImage = "url(/images/avtomir/car_menu_mousedown_right_last.gif)";
		         }
		    };
		    
			tdCars[i].onmouseup = function(e)
		    {
		         var td = e!=null ? e.target : event.srcElement;
		         td = td.parentNode;
		
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=td.offsetParent.rows[0].cells.length-1)
		         {
		              td.style.backgroundImage = "";
		              td.style.backgroundPosition = "right 7px";
		         }
		         
		         if (td.cellIndex!=0)
		         if (td.cellIndex!=1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "";
		         }
		
		         if (td.cellIndex==1)
		         {
		              var prevTD = td.offsetParent.rows[0].cells[td.cellIndex-1];
		              prevTD.style.backgroundImage = "";
		         }
		         
		         if (td.cellIndex==td.offsetParent.rows[0].cells.length-2)
		         {
		              var nextTD = td.offsetParent.rows[0].cells[td.cellIndex+1];
		              nextTD.style.backgroundImage = "";
		         }
		    };
		}
	}
);