/*
 *  V-STALKER
 *  by visionthinx, Jens Fisch (jf@visionthinx.com), Oct. 1999
 *  
 *  Smart-positioning Menu  
 *  requires JS1.2 capable Browsers  
 *  
 *  This script is free as long as you keep this notice. If you improve it,
 *  please mail a copy to me. If you sell it, you may send me Lucky Strike Filters 
 *  and Frueh Kölsch. That's what it took to make it.
 *  
 *  And don't visit my website at http://visionthinx.com. 
 *  I don't have time to put real content there.
 */

function truebody(){
	return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function setVariables() {
	MenuY = 140;
	if (document.layers) {
		NS = 1;
		IE = 0; 
		OffsetY  = "window.pageYOffset";
	}
	else if (document.all) {
		IE = 1; 
		NS = 0;
		OffsetY  = "truebody().scrollTop";
	}
}

function checkLocation() {
	ScrollY = eval(OffsetY);
	if (NS) { LayerY = document.menulayer.top; }
	if (IE) { LayerY = menulayer.style.pixelTop; }
	TargetY    = ScrollY + MenuY;
	DiffY = TargetY - LayerY ;
	if      (DiffY >  0) MoveY = Math.ceil (DiffY/5);
	else if (DiffY <= 1) MoveY = Math.floor(DiffY/3);
	if (NS) { document.menulayer.top   += MoveY; }
	if (IE) { menulayer.style.pixelTop += MoveY; }
	setTimeout("checkLocation()",10);
}

function PositionLayer() {
	if(navigator.appVersion.substring(0,1) >= 4 ) {
		setVariables();
		checkLocation();
	}
}
