
function ontop() {

	if (window.pageYOffset) {
		offsetx = window.pageXOffset;
		offsety = window.pageYOffset;
	} else if (document.body.scrollTop) {
		offsetx = document.body.scrollLeft;
		offsety = document.body.scrollTop;	
	} else {
	
		if (document.layers) document.layers["ontop"].visibility = "hide"
		else if (document.all) document.all["ontop"].style.visibility = "hidden"
		else if (document.getElementById) document.getElementById("ontop").style.visibility = "hidden";		
		
		offsetx = 0;
		offsety = 0;		
				
	}

	
	if (window.innerHeight) {
	    windowHeight = window.innerHeight;
	} else if (document.body.clientHeight) {
	    windowHeight = document.body.clientHeight;
	} else {
		return false;
	}

	if ((offsety > 0) && ((offsety + windowHeight - 20) > 500)) {

		if (document.layers) document.layers["ontop"].visibility = "show"
		else if (document.all) document.all["ontop"].style.visibility = "visible"
		else if (document.getElementById) document.getElementById("ontop").style.visibility = "visible";	
	
	    if (document.layers) {
	        document.layers['ontop'].pageX = offsetx + 5;
        	document.layers['ontop'].pageY = offsety + windowHeight - 20;
			//alert(offsety + windowHeight - 20);
	    }
	    else if (document.all) {
 	       document.all['ontop'].style.position = 'absolute';
  	       document.all['ontop'].style.posLeft = offsetx + 5;
		   document.all['ontop'].style.posTop = offsety + windowHeight - 20;
   	 	}
		
	} else {
	
		if (document.layers) document.layers["ontop"].visibility = "hide"
		else if (document.all) document.all["ontop"].style.visibility = "hidden"
		else if (document.getElementById) document.getElementById("ontop").style.visibility = "hidden";
		
	}
	
    setTimeout('ontop()',100);
	
}
         
