﻿//Generic Error Handler
function HandleError() {
	return true;
}
//window.onerror = HandleError;

//check the browser
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

//This function will help to navigate if user click on menu links top part.
function gotoFirstLink(linkurl){
    location.href = linkurl
}

// Download Window
function popDownload()
{
    PopWindow = window.open("banner.html", "mywindow","location=0,status=0,scrollbars=0,width=297,height=96");
    if(screen.width == 800){
        PopWindow.moveTo(250,250);
    }else {
        PopWindow.moveTo(350,350);
    }
	
}
//"Click ok to download our free Casino while browsing the site"
function submitFunction(i) 
{
   if (i==1){
    downloadClient('Casino');
    hideLayer("DownloadPopup");
   }
   if (i==2) 
   {
    downloadClient('Poker');
    hideLayer("DownloadPopup");
   }
}

//used by submitFunction()
function hideLayer(whichLayer) {
    if (document.getElementById) {
    // this is the way the standards work
    document.getElementById(whichLayer).style.visibility = "hidden";
    }
    else if (document.all) {
    // this is the way old msie versions work
    document.all[whichlayer].style.visibility = "hidden";
    }
    else if (document.layers) {
    // this is the way nn4 works
    document.layers[whichLayer].visibility = "hidden";
    }
}

//On UnLoad of the site will ask you this question
function askDownload(){
    /*alert("querystring " + window.top.location.host);
    if(window.top.location.host != "localhost"){
        userAnswer = confirm("Do you want to download latest maharajah club casino?");
        if (userAnswer)
        {
            downloadClient('Casino');
        }
    }*/
}

function downloadClient(clientType){
    if(clientType == "Poker"){
        document.downloadFormPoker.submit();
    }else if(clientType == "Casino"){
        document.downloadFormCasino.submit();
    }
}

function BannerActionsInside(){
    DownloadWin = window.open("downloadCasino.htm", "Download","location=0,status=0,scrollbars=0,width=30,height=30");
    DownloadWin.moveTo(0,0);
    location.href = "http://travis.bosscasinos.com/re.asp?name=PWD&camp=REF10972_0&go=http://www.maharajahclub.com/Casino/EN/Promotions.aspx";
}

function ChangeTabImg(img_name, img_src)
{
    document[img_name].src = img_src;
}

function OpenWindows(Url)
{
	window.open(Url,"photos","toolbar=0, scrollbars=0, status=no, left=0, top=0, width=382, height=264" )
}





//New Design Functions
//Created by Adonis Nikolaus

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


if (screen.width == 1024)
{
    document.write("<link rel='stylesheet' type='text/css' href='Css/1024Style.css' />")
}else if(screen.width == 1152){
    document.write("<link rel='stylesheet' type='text/css' href='Css/1152Style.css' />")
}else if(screen.width == 800){
    document.write("<link rel='stylesheet' type='text/css' href='Css/800Style.css' />")
}
	    
function OpenOrderYourCD()
{
    PopWindow = window.open("OrderYourCD.aspx", "OrderYourCD","location=0,status=0,scrollbars=0,width=600,height=600");
    if(screen.width == 800){
	    PopWindow.moveTo(10,10);
    }else {
	    PopWindow.moveTo(20,20);
    }
}
	    
function Open18Terms(){
    Terms18 = window.open("Terms18.aspx", "Terms18","location=0,status=0,scrollbars=0,width=308,height=300,screenX=5,screenY=115");
    Terms18.focus();
    Terms18.moveTo(5,115);
}

function OpenPSPPromo(){
    WinPromoPSP = window.open("WinPromoPSP.aspx", "PSPPromo","location=0,status=0,scrollbars=0,width=308,height=300,screenX=5,screenY=115");
    WinPromoPSP.focus();
    WinPromoPSP.moveTo(5,115);
}
