// JavaScript Document

//submitform
function submitform(id){
document.getElementById(id).submit();	
}

//disable elememt
function disableElement(id){
document.getElementById(id).setAttribute('disabled', 'disabled');
}
//enable elememt
function enableElement(id){
document.getElementById(id).removeAttribute('disabled');
}

//writeflash
function writeflash(element, vars){
var text='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n'+
   ' codebase="http://macromedia.com/cabs/swflash.cab#version=9,0,28,0"\n'+
   ' WIDTH="560" HEIGHT="440" id="gallery">\n'+
   ' <PARAM NAME=movie VALUE="gallery.swf">\n'+
   ' <PARAM NAME=FlashVars VALUE="'+vars+'">\n'+
   ' <PARAM NAME=quality VALUE=high>\n'+
   ' <PARAM NAME=bgcolor VALUE=#FFFFFF>\n'+
   ' <PARAM NAME=wmode VALUE=transparent>\n'+
   ' <EMBED src="gallery.swf"\n'+
   '  FlashVars="'+vars+'"\n'+ 
   '  quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH="560" HEIGHT="440" NAME="gallery"\n'+
   '  TYPE="application/x-shockwave-flash"\n'+
   '  PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>\n'+
   '</OBJECT>';
document.getElementById(element).innerHTML=text;
}

//preload all images
var myimages = new Array();

function preloading(){
for (x=0; x<preloading.arguments.length; x++){
myimages[x] = new Image();
myimages[x].src = "images/"+preloading.arguments[x];
}
}

preloading("header_bg.gif", "logo.gif", "enquire_out.gif", "enquire_over.gif", "home_out.gif", "about_out.gif", "games_out.gif", "events_out.gif", "gallery_out.gif", "faq_out.gif", "link_out.gif", "contact_out.gif", "home_over.gif", "about_over.gif", "games_over.gif", "events_over.gif", "gallery_over.gif", "faq_over.gif", "link_over.gif", "contact_over.gif", "home_on.gif", "about_on.gif", "games_on.gif", "events_on.gif", "gallery_on.gif", "faq_on.gif", "link_on.gif", "contact_on.gif", "panel_top.gif", "panel_bg.gif", "panel_end.gif", "footer_bg.gif", "contact_button.gif", "PP_link_out.gif", "CMG_link_out.gif", "IP_link_out.gif", "PP_link_over.gif", "CMG_link_over.gif", "IP_link_over.gif", "line.gif", "poker_out.jpg", "poker_over.jpg", "roulette_out.jpg", "roulette_over.jpg", "blackjack_out.jpg", "blackjack_over.jpg", "craps_out.jpg", "craps_over.jpg", "wheel_out.jpg", "wheel_over.jpg");


//change text of element by id - pairs must be separated by "," - name/values separated by "+"
function changeHtml(string){
var idAndSrc=string.split(",");
var x;
for(x=0; x<=idAndSrc.length-1; x++){
var pair=idAndSrc[x].split("+");
document.getElementById(pair[0]).innerHTML=pair[1];
}
}

//hide elements by id - string values must be separated by ","
function hide(string){
var ids = string.split(",");
var x;
for(x=0; x<=ids.length-1; x++){
document.getElementById(ids[x]).style.display="none";
}
}
//show elements by id - string values must be separated by ","
function show(string){
var ids = string.split(",");
var x;
for(x=0; x<=ids.length-1; x++){
document.getElementById(ids[x]).style.display="";
}
}



//rollover and out - name/value pair separated by "+", pairs separated by ","
function nav(string){
var idAndSrc=string.split(",");
var x;
for(x=0; x<=idAndSrc.length-1; x++){
var pair=idAndSrc[x].split("+");
document.getElementById(pair[0]).src="images/"+pair[1];
}
}


//popup
function popup(page, width, height){
	window.open(page, '_blank', 'width='+width+', height='+height+', left=300, top=50, location=no, scrollbars=yes, titlebar=no, menubar=no, resizable=no, status=no, toolbar=no'); 
}

function tooltip(dist, src){
document.getElementById('tooltip').style.display="block";
document.getElementById('tooltip').style.left=dist+"px";
document.getElementById('tooltip').innerHTML="<span style=\"background-color:#333333\"><a href=\"javascript:;\" onclick=\"hide('tooltip')\">&nbsp;&nbsp;X&nbsp;&nbsp;</a></span><br /><div style=\"margin-left:20px; width:480px\">"+src+"</div>";
}


