

//////////////////////////////////////////////////////////
// begin casino launch functions

function CasinoGameOpen(gameId)
{
   var LaunchForm = document.forms["LaunchForm"];
   if (LaunchForm == null){alert("Launch Form not found"); return;}

   LaunchForm.CasinoGameId.value = gameId;

   var wWindow = popupGame('CasinoSol');
   if (wWindow == null)
   {
      alert("Unable to open game window. You may have a pop-up blocker enabled.");
      return;
   }
   try 
   {
      wWindow.moveTo(0,0);
   } 
   catch(e){}
   try 
   {
      wWindow.resizeTo(screen.width,screen.height);
      wWindow.focus();
   } 
   catch(e){}
   LaunchForm.submit();
}

function popupGame(windowname)
{
   try
   {
      if (windowname == null) windowname = "casinosol";
      var settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+screen.width+",height="+screen.height;
      return window.open("",windowname,settings);
   }
   catch(e)
   {
      alert(e.message + "\n" + windowname + "\n" + settings);
      return null;
   }
}

// end casino launch functions
//////////////////////////////////////////////////////////


function switchTabs(tabParent,tabChild,object)
{
	if ( tabChild == "all" )
	{
		viewChilds ( document.getElementById(tabParent), true ); 
	} else {
		viewChilds( document.getElementById(tabParent), false );
		document.getElementById(tabChild).style.display = "block";
	}

	childsArray = object.parentNode.childNodes;
	for ( x = 0; x < childsArray.length; x++ )
		if ( childsArray[x].nodeName == "A")
			childsArray[x].className = "tab";
	object.className = "selected";
}

function viewChilds(object,visibility)
{
	value = visibility?"block":"none";
	childsArray = object.childNodes;
	for ( x = 0; x < childsArray.length; x++ )
		if ( childsArray[x].nodeName == "DIV")
			childsArray[x].style.display = value;
}
function setStatus(newStatus)
{
	window.status = newStatus;
	if (newStatus == '') newStatus = '&nbsp;';
        status_array = document.getElementsByName('status');
        for ( x = 0; x < status_array.length; x++)
                status_array[x].innerHTML = newStatus;
}

function form_submit(object)
{
	while ( object != null )
		if ( object.nodeName == "FORM" ) {
			object.submit();
			break;
		} else {
			object = object.parentNode;
		}
}

function this_form(object)
{
	while ( object != null ){ 
		if ( object.nodeName == "FORM" ) {
			return object;
		}
		object = object.parentNode;
	}
}

function refreshButton()
{
	if(document.forms['GameSelectionFormRefresh']) {
		document.forms['GameSelectionFormRefresh'].submit(); 
	} else {
		window.location.reload();
	}
}

function getCookieVal (offset) {  
    var endstr = document.cookie.indexOf (";", offset);  
    if (endstr == -1)    
        endstr = document.cookie.length;  
    return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {  
    var arg = name + "=";  
    var alen = arg.length;  
    var clen = document.cookie.length;  
    var i = 0;  
    while (i < clen) {    
        var j = i + alen;    
        if (document.cookie.substring(i, j) == arg)      
            return getCookieVal (j);    
        i = document.cookie.indexOf(" ", i) + 1;    
        if (i == 0) break;   
    }  
    return null;
}
function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = (argc > 2) ? argv[2] : null;  
    var path = (argc > 3) ? argv[3] : null;  
    var domain = (argc > 4) ? argv[4] : null;  
    var secure = (argc > 5) ? argv[5] : false;  
    document.cookie = name + "=" + escape (value) + 
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
    ((path == null) ? "" : ("; path=" + path)) +  
    ((domain == null) ? "" : ("; domain=" + domain)) +    
    ((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
    var exp = new Date();  
    exp.setTime (exp.getTime() - 1);  
    var cval = GetCookie (name);  
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function openFullScreen()			
{
	w=1000;
	h=768;
	if (window.screen) {
		w = window.screen.availWidth;
		h = window.screen.availHeight;
	} 		
	window.open(CurrentPageName()+"?FullScreen=True", "", "menubar=1,location=1,resizable=1,scrollbars=1,width="+w+",height="+h+",left=0,top=0,screenX=0,screenY=0");
}

function CurrentPageName() {
	
	if (window !=null){
	var sPath = window.location.pathname;	
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	return sPage;
	}
	else
	{
	  return document.location.href.substring(
		document.location.href.length
		, document.location.href.lastIndexOf('/') + 1 );
	}	
}

function OpenWindowNoProperties(URL,width,height){
	window.open(URL,'',
		'toolbar=no,resizable=yes,status=no,scrollbars=yes,width=' + width + ',height=' + height + ',left=25,top=25');
}
