

  	IE=(document.all);
  	
	function layer_hide(id){
		if (IE)
			document.all[id].style.visibility="hidden";
		else
			document.getElementById(id).style.visibility="hidden";
	}  


	function layer_show(id){		
		if (IE)
			document.all[id].style.visibility="visible";
		else
			document.getElementById(id).style.visibility="visible";
			
		layer_adjust(id); 
	}    


	function layer_adjust(id) 
	{
		if (IE)
		{
			now_layerX = document.body.scrollLeft + layerX;
			now_layerY = document.body.scrollTop + layerY;					

			if (document.body.offsetWidth-20 <= layerwidth) now_layerX = document.body.scrollLeft;
			if (document.body.offsetHeight-20 <= layerheight) now_layerY = document.body.scrollTop;		
	
			document.all[id].style.posLeft = now_layerX;
			document.all[id].style.posTop = now_layerY;		
		} 
		else 
		{
			now_layerX = window.pageXOffset + layerX;
			now_layerY = window.pageYOffset + layerY;

			if (window.innerWidth-20 <= layerwidth) now_layerX = window.pageXOffset;
			if (window.innerHeight-20 <= layerheight) now_layerY = window.pageYOffset;		

			document.getElementById(id).style.left=now_layerX;
			document.getElementById(id).style.top=now_layerY;		
		}	
	}


	function layer_define()
	{
		if (IE) 
		{
			layerX = Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)
			layerY = Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)
		}
		else	
		{ 
			layerX = Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)
			layerY = Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2)
		}
	}


