/*
	This script  was taken from (c) 2000 Ivanopulo http://damn.to
	The best web site ever.  I  castrated it a bit to fit the needs of this site.
	I also improved browser detection script, so Opera can't hide anymore.
	Although simple to understand, this script does what no other ones
	I've seen do -- Smoothly floating menu. Go to http://damn.to and educate yourself. Do it now.
*/
//alert(navigator.appName + ","+ navigator.appCodeName+","+navigator.userAgent);

OnLoad();

var bNetscape4=false;
var bNetscape6=false;
var bExplorer4plus=false;
var bOpera5=false;

if(navigator.userAgent.indexOf("Opera")>-1){
	bOpera5=true;
}else if(navigator.userAgent.indexOf("MSIE")>-1){
	bExplorer4plus=true;
}else if(navigator.userAgent.indexOf("Netscape")>-1){
	if(navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4"){
		bNetscape4=true;
	}
	if(navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "5"){
		bNetscape6=true;
	}
}else{// don't give a fuck about all others. Sue me.
	bExplorer4plus=true;
}
var nn6DivMenu;
/*
var bNetscape4 = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) == "4");
var bNetscape6 = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "5");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
var bOpera5 = (navigator.userAgent.indexOf("Opera")>-1);
var nn6DivMenu, nn6DivButton; // specially for NN6 to speed up things at least a little

*/
function CheckUIElements()
{

	var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
	if (bNetscape4) {
		yMenuFrom = document["movingMenu"].top;
		//yMenuTo = top.pageYOffset + 150;
		yMenuTo = pageYOffset + 150;
	}
	else if ( bExplorer4plus ) {
		yMenuFrom = parseInt (movingMenu.style.top, 10);
		//window.status=yMenuFrom;
		yMenuTo = document.body.scrollTop+150;
	}
	else if (bNetscape6) {
		yMenuFrom = nn6DivMenu.style.top.replace(/px/,"");
		//yMenuTo = top.pageYOffset + 150;
		yMenuTo = pageYOffset + 150;
	}
	else if (bOpera5) {
		yMenuFrom = nn6DivMenu.style.top;
		//yMenuTo = top.pageYOffset + 150;
		yMenuTo = pageYOffset + 150;
	}

	timeoutNextCheck = 500;

	if (Math.abs (yMenuTo + 152) < 6 && yMenuTo < yMenuFrom ) {
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return;
	}

if ( yMenuFrom != yMenuTo ) {
		if ( bNetscape6 ){
			yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 10 );
		}
		else{
			yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 30 );
		}
		if ( yMenuTo < yMenuFrom ){
			yOffset = -yOffset;
		}
		timeoutNextCheck = 10;

		if ( bNetscape4 ){
			document["movingMenu"].top += yOffset;
		}
		else if (bExplorer4plus){
			movingMenu.style.top = parseInt (movingMenu.style.top, 10) + yOffset;
			//alert("111");
		}
		else if (bOpera5){
			nn6DivMenu.style.top += yOffset;
		}
		else if (bNetscape6) {
			nn6DivMenu.style.top = eval(nn6DivMenu.style.top.replace(/px/,"")) + yOffset;
//			document.getElementById('divMenu').style.top = eval(document.getElementById('divMenu').style.top.replace(/px/,"")) + yOffset;
			timeoutNextCheck = 50;
		}

		timeoutNextCheck = 10;
	}

	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad(galInd)
{
	var y;
    var elm;

     elm=document.getElementById('movingMenu');
        if (elm==null)
        {
         	//alert(111);
            return;
        }
	// setting initial UI elements positions
	if (bNetscape4) {

        document["movingMenu"].top = top.pageYOffset;
		document["movingMenu"].visibility = "visible";
    }
	else if ( bExplorer4plus )
    {
        	if(galInd==null){
				movingMenu.style.top = document.body.scrollTop-400;
			}
			movingMenu.style.visibility = "visible";
	}
	else if ( bNetscape6 || bOpera5 )
    {
		nn6DivMenu = document.getElementById('movingMenu');
		if(galInd == null){
				nn6DivMenu.style.top = top.pageYOffset + 50;
		}
		nn6DivMenu.style.visibility = "visible";
		//alert(111);
	}

	// initializing UI update timer
	CheckUIElements();
        //alert(111);
	return true;
}