var bNetscape4plus = (navigator.appName.substring(0,8) == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
var SOpen=false;
var F;

function CheckUIElements()
{
	var yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
	
	if ( bNetscape4plus ) {
		yButtonFrom = document["divUp"].top;
		yButtonTo   = parent.MSH.pageYOffset + parent.MSH.innerHeight - 55;
		
	}
	else if ( bExplorer4plus ) {
		yButtonFrom = parseInt (divUp.style.top, 10);
		yButtonTo   = document.body.scrollTop + document.body.clientHeight - 55;
		
	}
	
	
	
	
	if ( yButtonFrom != yButtonTo ) {
		
		
		yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
		if ( yButtonTo < yButtonFrom )
			yOffset = -yOffset;
		
		if ( bNetscape4plus ) {
			document["divUp"].top += yOffset;
			
		   }	
		else if ( bExplorer4plus ) {
			divUp.style.top = parseInt (divUp.style.top, 10) + yOffset;
		
		   }
		timeoutNextCheck = 10;
	}
	
		
	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
	var y;
	
	
	if ( bNetscape4plus ) {
		document["divUp"].top = top.pageYOffset + top.innerHeight - 55;
		document["divUp"].visibility = "visible";
		
	}
	else if ( bExplorer4plus ) {
		divUp.style.top = document.body.scrollTop + document.body.clientHeight - 55;
		divUp.style.visibility = "visible";
		
		
	}
	
	// initializing UI update timer
	CheckUIElements();
	return true;
}

function funcSwapImage(imageName, bHilite) {
// DUMB Netscape doesn't see img names if they're inside a <div which has an id
// if they're just in <div></div> - it's okay, but that's not the case :\
// Workaround (using layers) was provided by Kostya. Tnx man :)
	if ( bExplorer4plus ) {
		document.images[imageName].src = "images/" + imageName + (bHilite == 1 ? "_hi.gif" : "_lo.gif");
	}
	else if ( bNetscape4plus ) {
		document.layers["divMenu"].document.images[imageName].src = "images/" + imageName + (bHilite == 1 ? "_hi.gif" : "_lo.gif");
	}
	return false;
}

function ShowInWindow(htmlFile, name) 
{

	F = open(htmlFile,name,"dependent=yes, width=560, height=400,locationbar=no, menubar=no, resizable=no, scrollbars=yes");
	F.focus();
	
	
}
	
