PictWidth=452;//ширина здания
BusWidth=137;//ширина автобуса
BusOffset=25;//смещение автобуса от центра clientWidth
BuildingOffset=85;//смещение здания от центра clientWidth
speed=2; //скорость
timeout=20; //таймаут. меняя величину timeout и speed можно управлять скоростью и плавностью движения
remont=0;
function init(){//инициализируем положение слоев
	document.getElementById("building").style.left=((document.body.clientWidth-BusWidth)/2-BuildingOffset)+"px";
	document.getElementById("brokenBus").style.left=(-BusWidth)+"px";
	document.getElementById("repairedBus").style.left=((document.body.clientWidth-BusWidth)/2-BusOffset)+"px";
	document.getElementById("repairedBus").style.width=BusWidth+"px";
	remont=0;
}

function move(){
	if(document.getElementById("brokenBus").offsetLeft<(document.body.clientWidth-BusWidth)/2-BusOffset){
		//двигаем сломаный автобус
		document.getElementById("brokenBus").style.left=(document.getElementById("brokenBus").offsetLeft+speed)+"px";
	}else if(document.getElementById("repairedBus").offsetLeft<(document.body.clientWidth)){
		//двигаем починенный автобус и уменьшаем слой к концу экрана
		if(remont==0) {
			setTimeout('move()',2000);
			remont=1;
			return;
		}
		crop=document.body.clientWidth-document.getElementById("repairedBus").offsetLeft-BusWidth-speed;
		if(crop<0) {
			BusWidth+crop<0 ? document.getElementById("repairedBus").style.width="0px" : document.getElementById("repairedBus").style.width=(BusWidth+crop)+"px";
		}
		document.getElementById("repairedBus").style.left=(document.getElementById("repairedBus").offsetLeft+speed)+"px";
	}else {
		init();//расставляем всё по своим местам
	}
	setTimeout('move()',timeout);//рекурсивно вызываем через таймаут
}

arrFons=new Array('url(images/menu2.gif)','url(images/menu2a.gif)');
function setFon(fon,what){
	what.style.backgroundImage=arrFons[fon];
}

function checker()
{
	if(document.search.what.value==""||document.search.what.value==" Поиск запчастей"){
	        alert("Введите запрос для поиска");
		document.search.what.focus();
	        return false;       
        } else {
        	return true;
        }
}


function Form_Validator(myform)
{
if(document.myform.name.value=="")
{alert("Пожалуйста заполните поле \"Заказчик\".");
myform.name.focus();
return(false);}
if(document.myform.mail.value=="")
{alert("Пожалуйста заполните поле \"Ваш e-mail\".");
myform.mail.focus();
return(false);}
if(document.myform.work.value=="")
{alert("Пожалуйста заполните поле \"Адрес\".");
myform.work.focus();
return(false);}
}

busImg01= new Image(); busImg01.src='images/menu2a.gif';
busImg02= new Image(); busImg02.src='images/menu2.gif';