var intervalSlideHots=0;
var animatedHot=null;
var animatedHotPrev=null;
var animatedHotIndexes={};
var animDir=1;
function slideHots(id,dir){
	if(intervalSlideHots)return;
	var d=document;
	timeStep=0;
	totalTimeSteps=7;
	var hot0=d.getElementById(id+"Hot0");
	if(animatedHotIndexes[id]==null)animatedHotIndexes[id]=0;
	animatedHotIndex=animatedHotIndexes[id];
	animatedHotPrev=d.getElementById(id+"Hot"+animatedHotIndex);
	if(dir<0){
		if(animatedHotIndex==0)animatedHotIndex=eval(id+"HotCount");
		else animatedHotIndex--;
		animatedHot=d.getElementById(id+"Hot"+animatedHotIndex);
	}
	else {
		animatedHot=d.getElementById(id+"Hot"+(animatedHotIndex+1));
		if(animatedHot==null){
			animatedHotIndex=0;
			animatedHot=hot0;
		}
		else animatedHotIndex++;
	}
	///alert(id+"Hot"+animatedHotIndex+":"+animatedHot);
	animDir=dir;
	animatedHot.style.visibility="visible";
	animatedHot.style.left=hot0.offsetWidth*dir;
	animatedHot.style.width=hot0.offsetWidth;
	animatedHot.style.top=0;
	intervalSlideHots=setInterval("animSlideHots()",50);
	animatedHotIndexes[id]=animatedHotIndex;
}
function animSlideHots(){
	timeStep++;
	var x=(Math.round(Math.sin((timeStep/totalTimeSteps)*(Math.PI/2))*100)/100)*animDir;
	if(timeStep>=totalTimeSteps){
		clearInterval(intervalSlideHots);
		intervalSlideHots=0;
		x=0;
		animatedHot.style.left="0px";
		animatedHotPrev.style.left=(-animatedHotPrev.offsetWidth)+"px";
		animatedHotPrev.style.visibility="hidden";
	}
	else {
		animatedHot.style.left=(animDir*animatedHot.offsetWidth-x*animatedHot.offsetWidth)+"px";
		animatedHotPrev.style.left=(-animatedHotPrev.offsetWidth*x)+"px";
	}
}
function homePageOnWResize(){
	var d=document;

	var f=d.getElementById("carsHotFrame");
	var hot=d.getElementById("carsHot0");
	var i=0;
	while(hot!=null&&i<100){
		hot.style.width=f.offsetWidth;
		hot=d.getElementById("carsHot"+i);
		i++;
	}
	
	f=d.getElementById("serviceHotFrame");
	hot=d.getElementById("serviceHot0");
	i=0;
	while(hot!=null&&i<100){
		hot.style.width=f.offsetWidth;
		hot=d.getElementById("serviceHot"+i);
		i++;
	}
}
function initHomePage(){
	onEvent(window,"resize",homePageOnWResize);
}
onReadys.push(initHomePage);
