function download_app(){

	var link = 'http://www.blackjack.com/blackjack.exe';

	if (navigator.appVersion.indexOf('MSIE') != -1) {
		win_sx = window.open(link, 'download_window', 'toolbar=0,location=no,directories=0,status=0,scrollbars=0,resizeable=0,width=1,height=1,top=0,left=0');
		win_sx.focus();

		win_sx.opener.location='DownloadGameWinOS';
	}
	else{
		window.location='DownloadGameWinOS';
	}
}



function navBlankWindow(location){

    window.open(location);
}




function gameLauncher(){
	var wwidth = 810;
	var hheight = 620;
	var nocache = new Date().getTime();
	var ttop = (screen.height-hheight)/2;
	if (ttop < 0) ttop = 0;
	var lleft = (screen.width-wwidth)/2;
	if (lleft < 0) lleft = 0;
	
	window.open('PlayNow?nocache='+nocache,'ActiveGameWindow','resizeable=1,width='+wwidth+',height='+hheight+',top='+ttop+',left='+lleft+'');
}



function openPage(page){
	window.location=page;
}


function openWin(url) { //v2.0
  /*if (url.indexOf("stream_launcher.page") !=-1)
  {
	alert("Service not available");
  	return;
  }
  */
  window.open(url,'','width=800,height=600');

}

function play(){
openWin('stream_launcher.page?base=bingo&game=bingo',"bingo");
}

function launch_slots()
{
	openWin('game_launcher.page?base=slots&game=bingo',"bingo");
}

function launch_videopoker()
{
	openWin('game_launcher.page?base=videoPoker&game=bingo',"bingo");
}

function openWinSpec(url,w,h) { //v2.0
  openWinSpec(url,'',w,h,'');
}

function openWinSpec(url,name,w,h,features) { //v2.0
	var ttop = (screen.height-h)/2;
	if (ttop < 0) ttop = 10;
	var lleft = (screen.width-w)/2;
	if (lleft < 0) lleft = 10;

    window.open(url,''+name,'width='+w+',height='+h+',top='+ttop+',left='+lleft+','+features);
}

function switchPicture(objectid, pic1, pic2) {
	img = document.getElementById(objectid);
	current = img.src;
	if(current.indexOf(pic1)>0) img.src=pic2; else img.src=pic1;
}

function register()
{
	openPage('Register');
}

function cashier()
  {
  	if(window.opener !=null){
  		window.opener.location='deposit.page';
		this.close();
	}
	else
	{
		window.location='deposit.page';
	}
}

function my_account()
  {
  	if(window.opener !=null){
  		window.opener.location='account.page';
	}
	else
	{
		window.location='account.page';
	}
}

function registerAccount()
  {
  	if(window.opener !=null){
  		window.opener.location='Register';
		this.close();
	}
	else
	{
		window.location='Register';
	}
}

function forgotPassword()
  {
  	if(window.opener !=null){
  		window.opener.location='ForgotPass';
		this.close();
	}
	else
	{
		window.location='ForgotPass';
	}
}


function showErrorValidation(msg){
	alert(msg);
}







var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();



