﻿var scrollspeed = 2;
var cache = 2;
var initialdelay = 1;
var x;
var y;

if (self.innerWidth) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}

function initializeScroller() {
	dataobj = document.all ? document.all.Scrolling : document.getElementById('Scrolling');
	//dataobj.style.top = y + 'px';
	dataobj.style.left = x + 'px';
	dataobj.style.display = 'block';
	//setTimeout('getdataheight()', initialdelay);
	setTimeout('getdatawidth()', initialdelay);
}

function getdataheight() {
	thelength = dataobj.offsetHeight;
	if (thelength == 0) {
		setTimeout('getdataheight()',10);
	} 
	else {
		scrollDiv();
	}
}

function getdatawidth() {
	thelength = dataobj.offsetWidth;
	if (thelength == 0) {
		setTimeout('getdatawidth()',10);
	} 
	else {
		scrollDiv();
	}
}

function scrollDiv() {
	//dataobj.style.top = parseInt(dataobj.style.top) - scrollspeed + 'px';
	dataobj.style.left = parseInt(dataobj.style.left) - scrollspeed + 'px';
	//if (parseInt(dataobj.style.top) < thelength * (-1)) {
	if (parseInt(dataobj.style.left) < thelength * (-1)) {
		//dataobj.style.top = y + 'px';
		dataobj.style.left = x + 'px';
	}
	setTimeout('scrollDiv()',40);
}

if (window.addEventListener) {
	window.addEventListener('load', initializeScroller, false);
} 
else if (window.attachEvent) {
	window.attachEvent('onload', initializeScroller);
} 
else {
	window.onload = initializeScroller;
}
