/*This script is (c) 2000 Ivanopulo http://www.damn.to
Please leave this message intact if you use the script.
Thanks alot to Marek for making this script NN6 compatible
( Warning: NN6 is *very* slow when it comes to timers, and that's an understatement! )
Modified by (c) MJ Demarco 2001*/

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.appName == "Opera" && navigator.appVersion.substring(0,1) >= "5" );
var nn6wombatCreekMenu, nn6DivButton; // specially for NN6 to speed up things at least a little

function CheckUIElements() {
var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
	
	if (bNetscape4 ) {
	yButtonFrom = document["wombatCreekLogo"].top;
	yButtonTo   = top.pageYOffset + top.innerHeight - 55;
	yMenuFrom   = document["wombatCreekMenu"].top;
	yMenuTo     = top.pageYOffset + 10;
	}	
else
	if ( bExplorer4plus ) {
	yButtonFrom = parseInt (wombatCreekLogo.style.top, 10);
	yButtonTo   = document.body.scrollTop + document.body.clientHeight - 55;
	yMenuFrom   = parseInt (wombatCreekMenu.style.top, 10);
	yMenuTo     = document.body.scrollTop + 10;
	}

else
	if ( bNetscape6 ) {
	yButtonFrom = nn6DivButton.style.top.replace(/px/,"");
	yButtonTo   = top.pageYOffset + top.innerHeight - 55;
	yMenuFrom   = nn6wombatCreekMenu.style.top.replace(/px/,"");
	yMenuTo     = top.pageYOffset + 10;
	}

else
	if ( bOpera5 ) {
	//nn6wombatCreekMenu = document.getElementById('wombatCreekMenu');
	yButtonFrom = nn6DivButton.style.top;
	//alert (yButtonFrom);
	yButtonTo   = top.pageYOffset + top.innerHeight - 55;
	yMenuFrom   = nn6wombatCreekMenu.style.top;
	yMenuTo     = top.pageYOffset + 10;
	}

timeoutNextCheck = 500;
	
	if ( Math.abs(yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
	setTimeout ("CheckUIElements()", timeoutNextCheck);
	return;
	}

	if ( yButtonFrom != yButtonTo ) {
	if ( bNetscape6 )
	yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );

else
	yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 20 );
	
	if ( yButtonTo < yButtonFrom )
	yOffset = -yOffset;
	timeoutNextCheck = 10;
	
	if ( bNetscape4 )
	document["wombatCreekLogo"].top += yOffset;
else
	if ( bExplorer4plus )
	wombatCreekLogo.style.top = parseInt (wombatCreekLogo.style.top, 10) + yOffset;
else
	if ( bOpera5 )
	nn6DivButton.style.top += yOffset;
else
	if ( bNetscape6 ) {
	nn6DivButton.style.top = eval(nn6DivButton.style.top.replace(/px/,"")) + yOffset;
	//document.getElementById('wombatCreekLogo').style.top 	=eval(document.getElementById('wombatCreekLogo').style.top.replace(/px/,"")) + yOffset;

	timeoutNextCheck = 50;
	}
	}

	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["wombatCreekMenu"].top += yOffset;

else

	if ( bExplorer4plus )
	wombatCreekMenu.style.top = parseInt (wombatCreekMenu.style.top, 10) + yOffset;

else

	if ( bOpera5 )
	nn6wombatCreekMenu.style.top += yOffset;

else

	if ( bNetscape6 ) {
	nn6wombatCreekMenu.style.top = eval(nn6wombatCreekMenu.style.top.replace(/px/,"")) + yOffset;
	//document.getElementById('wombatCreekMenu').style.top = eval(document.getElementById('wombatCreekMenu').style.top.replace(/px/,"")) + yOffset;
	timeoutNextCheck = 50;
	}
	timeoutNextCheck = 10;
	}
	setTimeout ("CheckUIElements()", timeoutNextCheck);
	}

function OnLoad() {
	var y;
	// setting initial UI elements positions
	if ( bNetscape4 ) {
	document["wombatCreekMenu"].top = top.pageYOffset + 50;
	document["wombatCreekMenu"].visibility = "visible";
	document["wombatCreekLogo"].top = top.pageYOffset + top.innerHeight - 55;
	document["wombatCreekLogo"].visibility = "visible";
	}

else
	if ( bExplorer4plus ) {
	wombatCreekMenu.style.top = document.body.scrollTop + 50;
	wombatCreekMenu.style.visibility = "visible";
	wombatCreekLogo.style.top = document.body.scrollTop + document.body.clientHeight - 55;
	wombatCreekLogo.style.visibility = "visible";

	// and fixing incorrect css property handling in msie
	wombatcreekIE.style.right = -150;
	}

else
	if ( bNetscape6 || bOpera5 ) {
	nn6wombatCreekMenu = document.getElementById('wombatCreekMenu');
	nn6wombatCreekMenu.style.top = top.pageYOffset + 50;
	nn6wombatCreekMenu.style.visibility = "visible";
	nn6DivButton = document.getElementById('wombatCreekLogo');
	nn6DivButton.style.top = top.pageYOffset + top.innerHeight - 55;
	nn6DivButton.style.visibility = "visible";
	//document.getElementById('wombatCreekMenu').style.top = top.pageYOffset + 50;
	//document.getElementById('wombatCreekMenu').style.visibility = "visible";
	//document.getElementById('wombatCreekLogo').style.top = top.pageYOffset + top.innerHeight - 55;
	//document.getElementById('wombatCreekLogo').style.visibility = "visible";
	}

	// initializing UI update timer
	CheckUIElements();
	return true;
	}