function init()
{
	init_tooltip();
		if(document.getElementById('top_anchor')){
			jumpToAnchor('top_anchor');
		}else if(document.getElementById('pageerror')){
			jumpToAnchor('pageerror');
		}else if(document.getElementById('pagemenu')){
		jumpToAnchor('pagemenu');
	}
}
function jumpToAnchor(anchor_id) {
	var the_url = window.location.href;
	var sharp_index = the_url.indexOf('#');
	if (sharp_index > 0){
		the_url = the_url.substr(0, sharp_index);
	}
	if (!the_url.match('#'+anchor_id)){
   	window.location = the_url + "#" + anchor_id;
  }
}

function init_tooltip(){
	var ttips = new Tips('.tooltip', {showDelay: '0'});
	$$('.tooltip').each(function(tip) {
		tip.store('tip:title', '<img src="'+tooltip_top.src+'" alt="" />');
		tip.store('tip:bottomText', '<img src="'+tooltip_bottom.src+'" alt="" />');
	});
	ttips.addEvent('show', function(tip) {
		tip.setStyle('z-index', 100);
	});
}

function showContent(){
	clearTimeout(t);
	//Display the content
	if (document.getElementById("contentDiv")!=null){
		document.getElementById("contentDiv").style.visibility="visible";
		//call in ac=loginpage
		if ( document.loginForm!=null && document.loginForm.user!=null){
			document.loginForm.user.focus();
		}
		//call in ac=getpass
		if (document.getpassForm!=null && document.getpassForm.email!=null){
			document.getpassForm.email.focus();
		}
	}
	//Display the background
	if (document.getElementById("bigTable")){
		document.getElementById("bigTable").style.visibility="visible";
	}

	//Enabled the slotmachine bet inupt field, disabled the hold button
	if (document.betForm!=null){
		document.betForm.bet.value = '';
		document.betForm.bet.disabled = '';
		document.betForm.bet.focus();
		document.getElementById('digit1').style.backgroundImage = 'url(' + smallNoImage[0].src + ')';
		document.getElementById('canHold').value='0';
		document.getElementById('btn1Hold').value='0';
		document.getElementById('btn2Hold').value='0';
		document.getElementById('btn3Hold').value='0';
		document.getElementById('btn4Hold').value='0';
	}
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
	return "";
  else
	return results[1];
}

setBackground();
//Preload Mouseover image
menuOverImage = new Image();
menuOverImage.src = "images/effect_menu.png";
subMenuOverImage = new Image();
subMenuOverImage.src = "images/effect_submenu.png";

//Preload Number jpg in sphere
var numberImage=new Array();
for (var i = 0; i <= 9; i++){
numberImage[i] = new Image();
numberImage[i].src = "images/counter/Counter_"+i+".png";
}
//The Dots
numberImage[10] = new Image();
numberImage[10].src = "images/counter/points.png";

tooltip_top = new Image();
tooltip_bottom = new Image();
tooltip_top.src = 'images/tooltip/Top.png';
tooltip_bottom.src = 'images/tooltip/Bottom.png';

if (window.attachEvent) {
  window.attachEvent("onload", init);
} else {
  window.addEventListener("DOMContentLoaded", init, false);
}