function detect_browsers() {

	isDOM = (document.getElementById) ? 1:0; //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
	Explorer4 = (document.all && document.all.item) ? 1:0; //Microsoft Internet Explorer 4+
	Netscape = (document.layers) ? 1:0; //Netscape 4.*
	Opera = (window.opera) ? 1:0; //Opera
	Opera5 = (Opera && isDOM) ? 1:0; //Opera 5+
	Explorer5 = (isDOM && Explorer4) ? 1:0; //MSIE 5+
	Konqueror = (isDOM && navigator.appName == 'Konqueror'); // Konqueror
	Mozilla = (isDOM && !Explorer4 && !Opera) ? 1:0; //Mozilla & Netscape 6.*
}


function windowPos() {

	if (window.innerHeight)	{
		Yp = window.pageYOffset;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		Yp = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		Yp = document.body.scrollTop;
	}

	if (Yp != Yb) {
		smooth = (Yp - Yb) / 10;

		if (smooth > 0) {
			smooth = Math.ceil(smooth);
		} else {
			smooth = Math.floor(smooth);
		}

		if (Explorer5) {
			document.all.sliding.style.pixelTop += smooth;
		} else if (Netscape) {
			document.sliding.top += smooth;
		} else if (Opera5) {
			document.getElementById("sliding").style.top = document.getElementById("sliding").style.top + smooth;
		} else if (Opera || Mozilla || Konqueror) {
			document.getElementById("sliding").style.top = parseInt(document.getElementById("sliding").style.top) + smooth + "px";
		}

		Yb += smooth;
	}

	if (Explorer5) {
		winWidth = document.body.clientWidth;
	} else if (Netscape || Mozilla || Opera5 || Opera || Konqueror) {
		winWidth = window.innerWidth;
	}

	if (winWidth < 770) {
		winWidth = 770;
	}

	if (Explorer5) {
		document.all.sliding.style.pixelLeft = (winWidth/2) + fromCenter;

	} else if (Netscape) {
		document.sliding.left = (winWidth / 2) + fromCenter - 6;

	} else if (Opera5 || Konqueror) {
		document.getElementById("sliding").pixelLeft = (winWidth / 2) + fromCenter;

	} else if (Opera || Mozilla) {
		document.getElementById("sliding").style.left = ((winWidth / 2) + fromCenter - 8)+"px";
	}
}

function sliding_start() {
	self.onError = null; // ignore errors (FIXME)

	detect_browsers();

	Yb = 0;
	if (Explorer5) {
		winWidth = document.body.clientWidth;
	}

	if (Netscape || Mozilla || Opera5 || Opera || Konqueror) {
		winWidth = window.innerWidth;
	}

	if (winWidth < 770) {
		winWidth = 770;
	}

	// Default object location for different browsers
	if (Netscape) {
		locationX = (winWidth / 2) + fromCenter - 6;

	} else if (Opera5 || Konqueror) {
		locationX = Math.floor((winWidth / 2) + fromCenter);

	} else if (Opera || Mozilla) {
		locationX = Math.floor((winWidth / 2) + fromCenter) - 8;
	}
	else {
		locationX = Math.floor((winWidth / 2) + fromCenter);
	}

	locationY = 260; // from page top
	locationY2 = 10; // from page top

	// choose right element type for object
	//if (Explorer5 || Mozilla || Opera5 || Opera || Konqueror) {
		htmltag = '<div ID="not_sliding" style="left: ' + locationX + 'px; top: ' + locationY2 + 'px; width: ' + sbwidth + 'px; height: ' + sbheight + 'px; position: absolute;">' + sbanner2 + '</div><div ID="sliding" style="left: ' + locationX + 'px; top: ' + locationY + 'px; width: ' + sbwidth + 'px; height: ' + sbheight + 'px; position: absolute;">' + sbanner + '</div>';

	/*} else if (Netscape) {
		htmltag = '<layer name="sliding" left="' + locationX + '" top= "' + locationY +'" width="' + sbwidth + '" height ="' + sbheight + '" >' + sbanner + '</layer>';
	}*/

	document.write (htmltag);

	window.setInterval("windowPos()", 10);

}

var sbanner, sbwidth, sbheight; // 's' is for Sliding
// start loop if screen width is bigger then 800 and banner is defined
if (screen.width>800 && sbanner && sbwidth && sbheight) {

	var fromCenter = 385; // Change this to move object left or right
	var winWidth;
	sliding_start();
}