menuActive = -1;
menuTimeOut = 0;

function menuOn(num) {
	if (menuTimeOut) clearTimeout(menuTimeOut);
	if (menuActive >= 0) {
		if (document.getElementById) {
			document.getElementById('menu_'+menuActive+'a').style.backgroundColor = "#2F62B5";
			document.getElementById('menu_'+menuActive+'b').style.backgroundColor = "#4874B0";
			document.getElementById('menu_'+menuActive+'b').style.backgroundImage = "url(/images/menu/nav_back.gif)";
			if (menuActive == 0) {
				document.getElementById('menu_'+menuActive+'c').style.backgroundColor = "#4874B0";
				document.getElementById('menu_'+menuActive+'c').style.backgroundImage = "url(/images/menu/nav_back.gif)";
			}
		}
	}
	if (num >= 0) {
		if (document.getElementById) {
			document.getElementById('menu_'+num+'a').style.backgroundColor="#063B9B";
			document.getElementById('menu_'+num+'b').style.backgroundColor="#386BBE";
			document.getElementById('menu_'+num+'b').style.backgroundImage="none";
			if (num == 0) {
				document.getElementById('menu_'+num+'c').style.backgroundColor="#386BBE";
				document.getElementById('menu_'+num+'c').style.backgroundImage="none";
			}
		}
		menuActive = num;
	}
}

function menuOff() {
	menuTimeOut = setTimeout('menuOn(-1)',100);
}

var xpos=0;
var ypos=0;

var bubblexdistance=10;
var bubbleydistance=12;

function myPos(event) {
  if (document.all) {
    xpos= (document.body.scrollLeft +window.event.clientX) + bubblexdistance;
    ypos= (document.body.scrollTop + window.event.clientY) + bubbleydistance;
  } else {
    xpos= event.pageX + bubblexdistance;
    ypos= event.pageY + bubbleydistance;
  }
}

var menuId = null;

function selectCoin(id) {
	if (document.forms[id + '_form'].doubleUp) {
		document.forms[id + '_form'].doubleUp.checked = (document.forms.gameForm.doubleUp.value == "true" ? true:false);
	}
	if(document.all || document.getElementById) {
		if (document.all) {
			document.getElementById(id + '_casino').style.pixelLeft = xpos - bubblexdistance-15;
			document.getElementById(id + '_casino').style.pixelTop = ypos - bubbleydistance-65;
		} else {
			document.getElementById(id + '_casino').style.left = xpos - bubblexdistance-15;
			document.getElementById(id + '_casino').style.top = ypos - bubbleydistance-65;
		}
    document.getElementById(id + '_casino').style.visibility="visible";
	} else {
    document.layers[id + '_casino'].left = xpos - bubblexdistance-15;
    document.layers[id + '_casino'].top = ypos - bubbleydistance-65;
    document.layers[id + '_casino'].visibility="show";
  }
	menuId = id;
}

function selectFullscreen(id) {
	if(document.all || document.getElementById) {
		if (document.all) {
			document.getElementById(id + '_casino').style.pixelLeft = xpos - bubblexdistance-30;
			document.getElementById(id + '_casino').style.pixelTop = ypos - bubbleydistance-28;
		} else {
			document.getElementById(id + '_casino').style.left = xpos - bubblexdistance-15;
			document.getElementById(id + '_casino').style.top = ypos - bubbleydistance-65;
		}
    document.getElementById(id + '_casino').style.visibility="visible";
	} else {
    document.layers[id + '_casino'].left = xpos - bubblexdistance-15;
    document.layers[id + '_casino'].top = ypos - bubbleydistance-65;
    document.layers[id + '_casino'].visibility="show";
  }
	menuId = id;
}

function menuHide() {
	if (menuId) {
		if(document.all || document.getElementById) {
  	  document.getElementById(menuId + '_casino').style.visibility="hidden";
		} else {
  	  document.layers[menuId + '_casino'].visibility="hide";
		}
  }
}

function play(game,coin) {
	document.forms.gameForm.game.value = game;
	document.forms.gameForm.coinValue.value = coin;
	document.forms.gameForm.submit();
}

function setDoubleUp(checkbox) {
	document.forms.gameForm.doubleUp.value = checkbox.checked ? "true":"false";
}

function fullScreenFlash(game) {
	menuHide();
	newFeatures="toolbar=0,scrollbars=0,menubar=0,location=0,resizable=0,directories=0,status=0,fullscreen=yes,width=" + (screen.width) + ",height=" + (screen.height) + ",left=0,top=0";
  var remote = open("/it/flash/fullflash.jsp?game="+game, "FullScreenFlash", newFeatures);
}

  if(document.all || document.getElementById)
  {
    document.onmousemove=myPos;
  } else {
    window.captureEvents(Event.MOUSEMOVE | Event.CLICK);
    window.onMouseMove=myPos;
		window.onClick = menuHide;
  }