// ---------------------------------------------
// See Style Sheet .TableHovers - Table Effects
// ---------------------------------------------
function ChangeTheCellBack(Cell_ID, TheMouseAction){

  if (TheMouseAction == 'over')
   {
    document.getElementById(Cell_ID).style.background='#8080FF'; //#CAD6F7'; //Over BLUE
   } 
  else 
  {
    //Reset
    document.getElementById(Cell_ID).style.background='#D0D0DF'; //Off Return to normal
  }
   
}
//----------------------------
// A1: Mouse Action on MenuBar    
//----------------------------
function ColorChange(ThisItemID,TheElemType,TheMouseAction){

   switch (TheElemType) 
	{ 
	   case "cellback" : 
	         if (TheMouseAction == "over") 
	           {
	            document.getElementById(ThisItemID).bgColor='#5580FF';
	            //document.getElementById(TheLinkID).style.color='white';
   	          } 
   	         else 
   	           {
   	           document.getElementById(ThisItemID).bgColor='#A83737';
   	           //document.getElementById(ThisItemID).bgColor='#C43100';
   	           //document.getElementById(TheLinkID).style.color='white';
   	           }
  	         break;   	
      default:
   	         break;   	
      }
 }
//----------------------------------------
// A:2 MenuBar Redirect User to the page 
//----------------------------------------
function jsRedirect(TheURL){
   location.href=TheURL
}
//-------------------------------
// POPUP Center Window with Parms 
//-------------------------------
function openCenteredWindow(url, xHeight, xWidth)
{
   //var ah = screen.availHeight - 30;
   //var aw = screen.availWidth - 10;

   //var xc = (aw - xWidth) / 2;
   //var yc = (ah - xHeight) / 2;

   var myWindow;
   var height = xHeight;
   var width = xWidth;
   var left = parseInt((screen.availWidth/2) - (width/2));
   var top = parseInt(((screen.availHeight-230)/2) - (height/2));
   var windowFeatures = 'width=' + width + ',height=' + height + ',dependent,titlebar=no,scrollbars=no,menubar=no,status=no,left=' + left + ',top=' + top + 'screenX=' + left + ',screenY=' + top;
   //var windowFeatures = 'width=' + xWidth+ ',height=' + xHeight+ ',dependent,titlebar=no,scrollbars=yes,menubar=no,status=no,left=' + xc + ',top=' + yc + 'screenX=' + xc + ',screenY=' + yc;
   
   myWindow = window.open(url, '', windowFeatures);
}
//------------------------------------------------
// !! On Load Function
//------------------------------------------------
// Call the setTabImage function on load
//onload = function TurnLinkOnAuto(){ 
function TurnLinkOnAuto(){ 
var doctitle = document.title;

  // Each Case here is the <Title> tag of each page
 	switch (doctitle.toLowerCase()) 
	{ 
	  case "chess" : 
              ChessInit();
		   break; 
	   case "minesweeper" : 
	      MineSweeperinit();   
	  	   break; 
	   default:       
              break;   
    }
	  
}
// This is only for the Chess Game
function ChessInit(){
b=[];for(i=0;i<8;++i)Z(Z(b,i,6,65),i,1,129);d(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(Z(b,0,0,132),1,0,130),2,0,131),3,0,133),4,0,134),5,0,131),6,0,130),7,0,132),0,7,68),1,7,66),2,7,67),3,7,69),4,7,70),5,7,67),6,7,66),7,7,68));c=64;
}
// This is only for the MineSweeper
function MineSweeperinit() {

	marker = eval("document.images.markerImg");
	if (isIE) {
		myParent = marker.offsetParent;
		while (myParent) {
			pLeft += myParent.offsetLeft - 1; //myParent.offsetLeft;
			pTop += myParent.offsetTop - 1; //myParent.offsetTop;
			myParent = myParent.offsetParent;
		}
	}
	navX = (isNav) ? marker.x : pLeft
	navY = (isNav) ? marker.y : pTop
	window.focus()
	Navs()
	if (isNav) { NSMenus() } else { IEMenus() }
	//if (isIE) { IEMenus() } else { NSMenus() }
}