
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 (Explorer5) {
		Yp = document.body.scrollTop;
	} else if (Netscape || Mozilla || Opera5 || Opera || Konqueror) {
		Yp = self.pageYOffset;
	}
	/*var pos = sky_getXYcoord('120frame');*/
	if ( Yp - locationY + 10 >= 0 )
		Yp += 10;
	if ( Yp - locationY <= 0 ) {
		Yp = locationY;
		//alert(Yp);
	}

		/*if(Yp<locationY) {

			if (Explorer5) {
				//alert(locationY);
				document.all.sliding.style.pixelTop = locationY;
			} else if (Netscape) {
				document.sliding.top = locationY;
			} else if (Opera5) {
				document.getElementById("sliding").style.top = document.getElementById("sliding").style.top ;
			} else if (Opera || Mozilla || Konqueror) {
				document.getElementById("sliding").style.top = parseInt(document.getElementById("sliding").style.top);
			}
		}*/
		
			//Yp=Yp-locationY;
			//if(Yp<0) Yp=0;
			if (Yp != Yb /*&& (Yp>locationY)*/) {
				smooth = (Yp - Yb) / 10;
				//locationY=locationY-locationY;
				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;
				//alert(Yb);
			}
		
	if (Explorer5) {
		winWidth = document.body.clientWidth;
	} else if (Netscape || Mozilla || Opera5 || Opera || Konqueror) {
		winWidth = window.innerWidth;
	}

	if (winWidth < 760) {
		winWidth = 760;
	}

	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;

	}
}

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 < 760) {
		winWidth = 760;
	}

	// Default object location for different browsers
	if (Explorer5) {
		locationX = Math.floor((winWidth / 2) + fromCenter) - 2;

	} else 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;
	}

	locationY = 110; // from page top

	// choose right element type for object
	if (Explorer5 || Mozilla || Opera5 || Opera || Konqueror) {
		htmltag = '<div ID="sliding" style="left: ' + locationX + 'px; top: 0px; 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 = 380; // Change this to move object left or right
	var winWidth;
	sliding_start();
}

