var e;
var mousex;
var mousey;

var TimerID=-1;

document.onmousemove = getMouseXY;

function showWIP() 
{
	var div=document.getElementById("popupdiv");
	
	
	div.className='in';
	
	div.innerHTML="<table class=tableWIP width=140 height=80 border=0><tr align=center><td>對 不 起 ,<br>正 在 準 備 中 !</td></tr></table>";
	
	setPopupPos();
	
	if(TimerID!=-1)
		clearTimeout(TimerID);
		
	TimerID=setTimeout("hideLayer();", 3000);
	
	return false;
}

function showWIP_EN() 
{
	var div=document.getElementById("popupdiv");
	
	
	div.className='in';
	
	div.innerHTML="<table class=tableWIP width=140 height=80 border=0><tr align=center><td>So Sorry,<br>Work in Progress!</td></tr></table>";
	
	setPopupPos();
	
	if(TimerID!=-1)
		clearTimeout(TimerID);
		
	TimerID=setTimeout("hideLayer();", 3000);
	
	return false;
}

function getMouseXY(e) // works on IE6,FF,Moz,Opera7
{ 
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)
 
  if (e)
  { 
	if (e.pageX || e.pageY)
	{ // this doesn't work on IE6!! (works on FF,Moz,Opera7)
	  mousex = e.pageX;
	  mousey = e.pageY;
	  algor = '[e.pageX]';
	  if (e.clientX || e.clientY) algor += ' [e.clientX] '
	}
	else if (e.clientX || e.clientY)
	{ 
	  mousex = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
	  mousey = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	  algor = '[e.clientX]';
	  if (e.pageX || e.pageY) algor += ' [e.pageX] '
	}
  }
}

function setPopupPos(e)
{
	var IE = document.all?true:false
	var div=document.getElementById("popupdiv");
	var xOffset = -20;
	var yOffset = -90;
	
	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE);

	// Temporary variables to hold mouse x-y pos.s
	var tempX = 0;
	var tempY = 0;

	tempX=mousex;
	tempY=mousey;
	
	// catch possible negative values in NS4
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}

	if(tempX > 100)tempX-=100;
	// show the position values in the form named Show
	// in the text fields named MouseX and MouseY

	div.style.left = tempX + xOffset;
	div.style.top = tempY + yOffset;
	return true;
}

function hideLayer()
{
	div = document.getElementById('popupdiv');
	div.innerHTML="";
	div.className='out';
}


