
var speed=1;
var currentposIE=0,currentposNS=0;
var alt=1,curpos1=0,curpos2IE=0,curpos2NS=0,i;
var intrevalId;
var winName;
var leftStart=false;
var rightStart=false;

function startLeft()
{
        leftStart=true;
	curpos2IE=0;
	curpos2NS=0;
	startit();
}

function stopLeft()
{
        leftStart=false;
	curpos2IE=1;
	curpos2NS=1;
	clearInterval(intrevalId);
	speed=1;
}

function startRight()
{
        rightStart=true;
	curpos2IE=1;
	curpos2NS=1;
	startit();
}

function stopRight()
{
        rightStart=false;
	curpos2IE=0;
	curpos2NS=0;
	clearInterval(intrevalId);
	speed=1;
}


function initialize(win)
{
	winName = win;
}


function scrollwindow()
{

speed=speed*1.005;

if (winName.document)
{
	if (typeof document.getElementByID)
	{

		if ((currentposIE<winName.document.body.scrollWidth) && curpos2IE==0 && leftStart==true)
		{
			currentposIE += speed;
			curpos1=currentposIE;
			curpos2IE = 0;
			winName.scroll(currentposIE,0);
		}
		else
		{
			if (curpos1 > 0  && rightStart==true)
			{
				curpos2IE=1;
				curpos1-=speed;
				currentposIE = curpos1;
				winName.scroll(curpos1,0);
			}
			else
			{
				leftStart=false;
				rightstart=false;
			}
		}
	}
	
	else if (document.layers)
	{
		if (curpos1<winName.document.layers[0].clip.right - window.innerWidth && leftStart==true && curpos2NS==0)
		{
			currentposNS=speed;
			curpos2NS=0;
			winName.document.layers[0].left -= currentposNS;
			curpos1+=speed;
		}
		else if(curpos1>winName.document.layers[0].clip.left && rightStart==true)
		{
			currentposNS=speed;
			curpos1-=speed;
			curpos2NS=speed;
			winName.document.layers[0].left += currentposNS;
		}
		else
		{
			leftStart=false;
			rightStart=false;
		}
	}
}

}


function startit()
{
	intrevalId = setInterval("scrollwindow()",10);
}
