// *********************************************

<!--
   // Is Gecko Based (Netscape, Opera, Mozilla) but not rv:0.9.2
var is_navgood = ((is_gecko && (rv > .0902)) || (is_webkit && (wk > 500)));
var is_iegood = (is_ie && is_ie6up);
var is_good = (((is_win && is_navgood) || (is_win && is_iegood) || (is_linux && is_navgood) || (is_mac && is_navgood)) && !is_aol);
var is_800_600_res = ((screen.width == 800) && (screen.height == 600));
var is_1024_768_res = ((screen.width >= 1024) && (screen.height >= 768));
var windowHandle = null;

//-->

// *********************************************

// *********************************************

function openWindow(testing) {

	// SETUP OPTIONS
	var options = "";
	options += "width=" + 3 + ",height=" + 3;
	options += ",top=" + 0 + ",left=" + 0;
        
	windowHandle = window.open('testpopup.html','betWindow',options);

	if (testing) 
	{
		if ((windowHandle != null) && !windowHandle.closed) 
		{
			is_popups = true;
			windowHandle.close()
	          return true;
		} 
		else 
		{
			is_popups = false;
			return false;
		}
	}
}

// *******************************************************

function delay(gap) { /* gap is in millisecs */
	var then,now;
	then=new Date().getTime();
	now=then;
	while((now-then)<gap) {
		now=new Date().getTime();
	}
}

// *******************************************************

function setIgnore(service) {
	writeCookie("detection","IGNORE",30);
	navToVersion(determine_server_version(true), service);
}

// *******************************************************

function determine_server_version(bPopups) 
{		
	if (is_800_600_res == true && bPopups == true)
	{
		return nVerPOPUPS;
	}
	
	return nVerNOPOPUPS;		
}

// *******************************************************

function go(service) 
{
	var txtOut;
	if (((getCookie("detection") == "GOOD") || (getCookie("detection") == "IGNORE")) && !debug) 
	{	
		var version = determine_server_version(true);
		if (version >= 0)
		{
			navToVersion(version, service)
		}
	}
	else
	{
		is_cookies = testCookie();
		is_popups = openWindow(1);
	}
	
	if (print == true) 
	{
		document.write("<H1 class=info>Detecting compatability...</H1>");
		printBasic();
		printOS();
		printBrowser();
		printCookies();
		printPopups();
		printScreen();
		printViewable();
		document.write("<HR>");
	}
	
	var version = determine_server_version(is_popups);

	// JJN 09/27/2011 - Add loadBalanced Cookie to expire in one day.
	//                  This + .htaccess prevents bookmarks to svc-logon3-00.html pages.
	writeCookie("loadBalanced","YES",1);

	if (is_good == true && is_cookies == true && ((is_800_600_res == true && is_popups == true) || (is_1024_768_res == true)))
	{
		document.write("<H2 class=good>Your browser is known to work with racingchannel.com</H2>");
		writeCookie("detection","GOOD",14);
		if (!debug) 
		{
			if (version >= 0)
			{			
				navToVersion(version, service)
			}
		} 
		else 
		{
			document.write("<CENTER><FORM class=phonebet><INPUT type=button value='Click Here to navigate to the Betting Application'");
			
			if (!version)
			{
				txtOut = " onClick=\"javascript:navToVersion(nVerPOPUPS,'" + service + "');\"></FORM>";
				//txtOut = " onClick=\"navToVersion(0,'" + service + "');\"></FORM></CENTER>";
				document.write(txtOut);
			}
			else
			{
				txtOut = " onClick=\"javascript:navToVersion(nVerNOPOPUPS,'" + service + "');\"></FORM>";
				//txtOut = " onClick=\"navToVersion(1,'" + service + "');\"></FORM>";
				document.write(txtOut);
			}
		}
	} 
	else 
	{
		document.write("<H2 class=bad>Your browser is not known to work with our web client.</H2>");
		document.write("&nbsp;We have found the following compatability issues.<BR>");
		document.write("<UL>");

		if (!is_win && !is_mac && !is_linux) { document.write("<LI><B>Operating System:</B> Our site is not supported by your operating system.</LI>"); }

		if (!is_good)
		{
			if (is_ie && !is_iegood) 
			{
				document.write("<LI><B>Interner Explorer:</B> v6.0 or greater is required. ");
				document.write("&nbsp;<a href=\"http://www.microsoft.com/ie/\">Update Internet Explorer</a></LI>");
			}
			else if (is_nav && !is_navgood) 
			{
				document.write("<LI><B>Netscape Navigator:</B> v6.2 or greater is required. ");
				document.write("&nbsp;<a href=\"http://www.netscape.com/download/\">Update Netscape Navigator</a></LI>");
			}
			else if (is_aol) 
			{
				document.write("<LI><B>AOL Browser:</B> You are using AOL's internal browser.  You will need to minimize AOL and use ");
				document.write("&nbsp;<a href=\"http://www.microsoft.com/ie/\">Internet Explorer v6.0 or greater</a> or");
				document.write("&nbsp;<a href=\"http://www.netscape.com/download/\">Netscape Navigator v6.2 or greater</a></LI>");
			}
			else if (!is_ie && !is_nav && !is_aol)
			{
				document.write("<LI><B>Unknown Browser:</B> You are using a unknown browser.  Our site works with ");
				document.write("&nbsp;<a href=\"http://www.microsoft.com/ie/\">Internet Explorer v6.0 or greater</a> or");
				document.write("&nbsp;<a href=\"http://www.netscape.com/download/\">Netscape Navigator v6.2 or greater</a></LI>");
			}
		}
	
		if (!is_cookies)
		{
			document.write("<LI><B>Cookies:</B> Cookies must be enabled before using our site.</LI>");
		}
			
		if (is_800_600_res == true && !is_popups)
		{
			document.write("<LI><B>Popups:</B> Popups must be allowed to use our site.  Please disable all Popup Stoppers or");
			document.write(" allow <span class=website>racingchannel.com</span> to display popups.</LI>");
		}
		
		if (!is_1024_768_res) 
		{
			document.write("<LI><B>Screen Size:</B> The optimal screen size for viewing out site is 1024x768.  Please increase our your ");
			document.write("screen resolution.</LI>");
		}
	
		document.write("</UL>");
		document.write("<CENTER><FORM class=ignore><INPUT type=button value='Click Here to Ignore Errors and Proceed to Online Betting'");
		document.write(" onClick=\"javascript:setIgnore(\'"+service+"\');\"></FORM>");
		document.write("<span class=disclaimer>If you choose to ignore these errors and continue, in 30 days we will check<BR>");
		document.write("again for compatability.  It is important you keep your browser up to date for other reasons as well.</span></CENTER>");
	
		var serviceURL = getSupportURL(service);
		txtOut = "<BR><center><h3 class=support><a href=\"" + serviceURL + "/\">";
		document.write(txtOut);
				
		//document.write("<BR><center><h3 class=support><a href=\"http://support.njphonebet.com/\">");
		document.write("Contact Support regarding the compatability issues found.</a></h3></center>");
	}	
}

// *******************************************************

