
window.onerror=fnErrorTrap;
function fnErrorTrap(sMsg,sUrl,sLine)
{
   ErrorLog.innerHTML="<b>An error was thrown and caught.</b><br/>";
   ErrorLog.innerHTML+="Error: " + sMsg + "<br/>";
   ErrorLog.innerHTML+="Line: " + sLine + "<br/>";
   ErrorLog.innerHTML+="URL: " + sUrl + "<br/>";
   return false;
}

var Global = new Object();

// Grab browser version
Global.BrowserIE = (navigator.appVersion.match(/\bMSIE\b/)) ? true : false;
Global.BrowserNS = (navigator.appName.match(/Netscape/)) ? true : false;
Global.BrowserFirefox = (navigator.userAgent.match(/Firefox/)) ? true : false;
Global.OSMac = (navigator.userAgent.match(/Macintosh/)) ? true : false;
Global.poker_odds_help = false;

document.write("<script src='/addon/js/prototype.js' type='text/javascript'></script>");
document.write("<script src='/addon/js/effects.js' type='text/javascript'></script>");
//document.write("<script src='/addon/js/Not_Uesd/dragdrop.js' type='text/javascript'></script>");
document.write("<script src='/addon/js/texas_holdem.js' type='text/javascript'></script>");

function WriteSoundDiv()
{
	if ( Global.BrowserIE )
		document.write('<bgsound id="CardSound" src="" loop="0" volume="0" balance="0"/>');
	else if ( Global.BrowserFirefox )
		document.write('<bgsound id="CardSound" src="" loop="0" volume="0" balance="0"/>');
	else if ( Global.BrowserNS ) 
		document.write('<embed id="CardSound" src="" autostart="false" hidden="true" loop="false" ></embed>');
	else 
		document.write('<bgsound id="CardSound" src="" loop="0">' );
}

function OnLoad()
{
    $('loading-indicator').show();
    DrawFormHiddenElements();
    DrawCards();
    DrawCardContainers();
    IncreaseLoadedImages();
}

function Sleep(msecs)
{
    var endTime = (new Date().getTime()) + msecs;
    while((new Date().getTime()) < endTime );
} 

