var slidespeed=3;
var actualwidth;
var offersRow1;
var offersRow2;
var actualHeight;
var offersColumn1;
var offersColumn2;

function fillHorizontal(){
offersRow1 = document.getElementById("offersRow1");
offersRow2= document.getElementById("offersRow2");
if(offersRow1==null || offersRow2==null || document.getElementById("offersAutosHorizontal").offsetWidth < 1 ) {
	setTimeout("fillHorizontal()",300);
	return;
}

offersRow1.innerHTML=offersRow2.innerHTML=document.getElementById("offersAutosHorizontal").innerHTML
actualwidth= document.getElementById("offersAutosHorizontal").offsetWidth
offersRow2.style.left=actualwidth+"px"
offersRow2.style.width=actualwidth+"px"
offersRow1.style.width=actualwidth+"px"
var tempDiv = document.getElementById("offersAutosHorizontal");
var divParentNode = tempDiv.parentNode;
divParentNode.removeChild(tempDiv);
}

function fillVertical(){
offersColumn1 = document.getElementById("offersColumn1");
offersColumn2= document.getElementById("offersColumn2");
if(offersColumn1==null || offersColumn2==null || document.getElementById("offersAutosVertical").offsetWidth < 1 ) {
	setTimeout("fillVertical()",300);
	return;
}
offersColumn1.innerHTML=offersColumn2.innerHTML=document.getElementById("offersAutosVertical").innerHTML
actualHeight=document.getElementById("offersAutosVertical").offsetHeight+10
offersColumn2.style.top=actualHeight+"px"
offersColumn2.style.height=actualHeight+"px"
offersColumn1.style.height=actualHeight+"px"

var tempDiv = document.getElementById("offersAutosVertical");
var divParentNode = tempDiv.parentNode;
divParentNode.removeChild(tempDiv);
}


function slideOfferLeft(timeOut){
	if(offersRow1==null || offersRow2==null ) return;
	if (parseInt(offersRow1.style.left)>(actualwidth*(-1)+8))
		offersRow1.style.left=parseInt(offersRow1.style.left)-slidespeed+"px";
	else
		offersRow1.style.left=parseInt(offersRow2.style.left)+actualwidth-5+"px";

	if (parseInt(offersRow2.style.left)>(actualwidth*(-1)+8))
		offersRow2.style.left=parseInt(offersRow2.style.left)-slidespeed+"px";
	else
		offersRow2.style.left=parseInt(offersRow1.style.left)+actualwidth-5+"px";

	if(timeOut==null || timeOut==0)
		t = setTimeout("slideOfferLeft()",30);
	else
		t = setTimeout("slideOfferLeft("+timeOut+")",timeOut);
}

function slideOfferRight(timeOut){
	if(offersRow1==null || offersRow2==null ) return;
	if (parseInt(offersRow1.style.left)<(actualwidth-8))
		offersRow1.style.left=parseInt(offersRow1.style.left)+slidespeed+"px";
	else
		offersRow1.style.left=parseInt(offersRow2.style.left)-actualwidth+5+"px";

	if (parseInt(offersRow2.style.left)<(actualwidth-8))
		offersRow2.style.left=parseInt(offersRow2.style.left)+slidespeed+"px";
	else
		offersRow2.style.left=parseInt(offersRow1.style.left)-actualwidth+5+"px";
	
	if(timeOut==null || timeOut==0)
		t = setTimeout("slideOfferRight()",30);
	else
		t = setTimeout("slideOfferRight("+timeOut+")",timeOut);
}

function slideOfferUp(timeOut){
	if(offersColumn1==null || offersColumn2==null ) return;
	if (parseInt(offersColumn1.style.top)>(actualHeight*(-1)+8))
		offersColumn1.style.top=parseInt(offersColumn1.style.top)-slidespeed+"px";
	else
		offersColumn1.style.top=parseInt(offersColumn2.style.top)+actualHeight-5+"px";

	if (parseInt(offersColumn2.style.top)>(actualHeight*(-1)+8))
		offersColumn2.style.top=parseInt(offersColumn2.style.top)-slidespeed+"px";
	else
		offersColumn2.style.top=parseInt(offersColumn1.style.top)+actualHeight-5+"px";

	if(timeOut==null || timeOut==0)
		t = setTimeout("slideOfferUp()",30);
	else
		t = setTimeout("slideOfferUp("+timeOut+")",timeOut);
}

function slideOfferDown(timeOut){
	if(offersColumn1==null || offersColumn2==null ) return;
	if (parseInt(offersColumn1.style.top)<(actualHeight-8))
		offersColumn1.style.top=parseInt(offersColumn1.style.top)+slidespeed+"px";
	else
		offersColumn1.style.top=parseInt(offersColumn2.style.top)-actualHeight+5+"px";

	if (parseInt(offersColumn2.style.top)<(actualHeight-8))
		offersColumn2.style.top=parseInt(offersColumn2.style.top)+slidespeed+"px";
	else
		offersColumn2.style.top=parseInt(offersColumn1.style.top)-actualHeight+5+"px";
	
	if(timeOut==null || timeOut==0)
		t = setTimeout("slideOfferDown()",30);
	else
		t = setTimeout("slideOfferDown("+timeOut+")",timeOut);
}

function stopHorScroll()
{
	if(offersRow1==null || offersRow2==null || t==null) return;
	clearTimeout(t)
}

function stopVerScroll()
{
	if(offersColumn1==null || offersColumn2==null ||t==null ) return;
	clearTimeout(t)
}
