
   function addLoadEvent(func) 
{ 
    var oldonload = window.onload; 
     if (typeof (window.onload) != 'function') 
    { 
        window.onload = func; 
    } 
    else 
    { 
        window.onload = function() 
       { 
    	oldonload(); 
    	      func(); 
        } 
    } 
} 


/*Send Unica wrapper function */

function SendUnicaCode(msg)
{
    try 
    {
        ntptEventTag("ev=" + msg);
    } catch (err) { }
}

/* Add new sCut parameter */

function AddsCutParam(paramName, value)
{
   sCut= sCut+ paramName + "=" + value + "&";
}

/* Check that browser is IE */
function IsIEBrowser() 
{
    if (navigator.appVersion.indexOf("IE") > 0) 
    {
        return true;
    }
    return false;
}
function IsIE8Browser() 
{
    if (navigator.appVersion.indexOf("IE 8") > 0) 
    {
        return true;
    }
    return false;
}
function IsFFBrowser() 
{
     if (navigator.indexOf("Firefox") > 0)
    {
        return true;
    }
    return false;
}

/*Set background image in specified control*/
function setBGImage(control, bgImagePath) {
    if (control != null) {
        control.style.backgroundImage = "url('" + bgImagePath + "')";
    }
}

function toggleElement(id) {
        elem = document.getElementById(id);
        elem.style.display= (elem.style.display=="none") ? "block":"none";
}

   function initializeEyeView()
{
    if(ev_site_id != '')
    {
        window["EngagerTag"] = {};
        EngagerTag.start = function() { }
        EngagerTag.end = function() { }
        document.write(unescape("%3Csc" + "ript src='" + location.protocol + "//serve.eyeviewdigital.com/engager.php?sid=" + ev_site_id + "' type='text/javascript'%3E%3C/sc" + "ript%3E"));
        ev_site_id = '';
	}
}

   var MM_contentVersion = 6;
var MM_FlashCanPlay;

var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function showFlash(flashPath,flashWidth, flashHeight)
{
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + flashWidth + '" height="' + flashHeight + '" id="flash_id" align="middle" VIEWASTEXT>');
        document.write('<param name="movie" value="' + flashPath + '" />');
        document.write('<param name="quality" value="high" />');
        document.write('<param name="bgcolor" value="#000000" />');
        document.write('<param name="wmode" VALUE="transparent" />');
        document.write('<param name="allowScriptAccess" value="always" />');
        document.write('<embed src="'+ flashPath + '"  wmode="transparent" quality="high" bgcolor="#000000" width="' + flashWidth + '" height="' + flashHeight + '" name="flash_id" allowScriptAccess="always" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
        document.write('</object>');
}

   function OpenLiveCasino()
{
        var w = 801;
        var h = 571;
        var l = (window.screen.width-w)/2;
        var t = (window.screen.height-h)/2;

        var filename =  "http://ndl.888.com/casino/application/ViewActual.html?mode=3&LangID=en&" + sCut + "&dl=4679" + "&skin=5" + "&brand=0";
       
        var opened = window.open(filename ,"Offline","resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);

        if (undefined == opened){
                        getBanner(bannerID).openWindow(filename ,"Offline","resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);
        }   
}

function NoDownloadPoker(location, bannerID) {
    var w = 820;
    var h = 565;
    var l = (window.screen.width-w)/2;
    var t = (window.screen.height-h)/2; 
    
    //if NOT from landing page (out of the frame)
    if (window.name != "") {setDownloadStatus();}
    
    var filename = "http://ndl.888.com/poker/flashpoker_real/application/RLFlashPoker.html?" + sCut + "&dl=" + location + "&skin=4&brand=1" + "&langid=en";
    
    var opened = window.open(filename ,null, "height=" + h + ",width=" + w + ",status=no,toolbar=no,menubar=no,location=no,resize=no,left="+l+",top="+t);
    
    if (undefined == opened){
                        getBanner(bannerID).openWindow(filename ,null, "height=" + h + ",width=" + w + ",status=no,toolbar=no,menubar=no,location=no,resize=no,left="+l+",top="+t);
    }     
}

function NoDownloadCasino(location, bannerID)
{
        var w = 801;
        var h = 571;
        var l = (window.screen.width-w)/2;
        var t = (window.screen.height-h)/2;

        var filename =  "http://ndl.888.com/casino/application/ViewActual.html?mode=3&LangID=en&" + sCut + "&dl=" + location + "&skin=4";
       
        var opened = window.open(filename ,"Offline","resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);

        if (undefined == opened){
                        getBanner(bannerID).openWindow(filename ,"Offline","resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);
        }   
}


function OpenAndDownload(location, brand)
{
    //unica
    try {
        ntptAddPair("dl",location);
        ntptEventTag("ev=download_" + brand);
     }catch(err){}

    //this to avoid javascript errors in SWOT pages
     try {
         setDownloadStatus();
    }catch(err){} 

    // if download process already started -> doesn't show exit popup in future
    try {
        showExitPopup=false;
    }catch(err){}
    
    try
    {
      var dlp = encodeURIComponent(document.location.href);
      dlp = dlp.replace(/\./gi, "%2E");    
      var sURLreg = "/downloadclient.htm?"+ "&dl=" + location + "&DownloadBrand=" + brand + "&dlp=" + dlp;
      window.open(sURLreg,"popDown","width=620,height=150,top=0,left=0");
    }
    catch(err) // if 'dlp' parameter initializtion was failed for some reason, download without this param (as previously)
    {
      var sURLreg = "/downloadclient.htm?"+ "&dl=" + location + "&DownloadBrand=" + brand;
      window.open(sURLreg,"popDown","width=620,height=150,top=0,left=0");
    }
}


function setDownloadStatus()
{
    setCookie("downloaded","1","/");
}

function setCookie(name,value)
{
    var argv = setCookie.arguments;
    var argc = setCookie.arguments.length;
    var path = (argc > 2) ? argv[2] : null;
    var expires = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;

    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain))
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) 
			return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
    
}

function openDL()
{
  OpenAndDownload('', '888casino')
}



   /* Methods of Entry Popup window */

function SetupEntryPopupPosition(entryPopupObject) {
    try
    {
        entryPopupObject.style.top = (document.body.clientHeight - 200) / 2;
    }
    catch (e)
    {/* do nothing */}
}

// Closes entry popup (hide it and background (WhiteSpace))
// Parameters:
//  popupID - identifier of the popup window.
function ClosePopup(popupID) {
    try
    {
        var entryPopupDiv= document.getElementById(popupID);
        if(entryPopupDiv != null) {
            entryPopupDiv.style.visibility = "hidden";
        }
        var entryPopupWS= document.getElementById(popupID + "WhiteSpace");
        if(entryPopupWS != null) {
            entryPopupWS.style.visibility = "hidden";
        }
    }
    catch(e)
    {/* do nothing */}
}

   var showExitPopup = true;

var ExitPopup_Message = "";
var ExitPopup_OkUnica = "";
var ExitPopup_CancelUnica = "";
var ExitPopup_OkURL = "";
var ExitPopup_OkParameters = "";

function InitExitPopup(exitPopup_Message, exitPopup_OkUnica, exitPopup_CancelUnica, exitPopup_OkURL, exitPopup_OkParameters ){
	ExitPopup_Message = exitPopup_Message;
	ExitPopup_OkUnica = exitPopup_OkUnica;
	ExitPopup_CancelUnica = exitPopup_CancelUnica;
	ExitPopup_OkURL = exitPopup_OkURL;
	ExitPopup_OkParameters = exitPopup_OkParameters;
	RegisterExitPopup();
}

function RegisterExitPopup() {
    try {
        if (!IsIEBrowser()) {
            var bodyTag = document.getElementsByTagName("BODY")[0];
            if (bodyTag != null) {
                bodyTag.setAttribute("onbeforeunload", "ConfirmExit(event);");
                bodyTag.setAttribute("onmousedown", "SetExitFlag(event);");
            }
        }
        else {
            attachEvent("onunload", ConfirmExit);
            document.attachEvent("onmousedown", SetExitFlag);
        }
    }
    catch (e) {
        /*alert(e.description);*/
    }
}

function SetExitFlag(event) {
    var ref = "";
    var srcEl = event.srcElement || event.target;
    // do nothing if event source is undefined (clicking on scrollbars, etc.)
    if (srcEl == null) {
        return;
    }

    if (srcEl.id == "languageSelect") {
        showExitPopup = false;
        return;
    }
    // do not display exit popup when clicking language menu
    var currentNode = srcEl;
    while (currentNode.tagName != "BODY") {
        var currentParentNode = currentNode.parentNode;
        if (currentParentNode == null) {
            break;
        }
        else {
            currentNode = currentParentNode;
        }
    }

    //check if the element that was pressed was an anchor
    while ((srcEl != null) && (srcEl.tagName != "A") && (srcEl.tagName != "AREA") && (srcEl.tagName != "BODY"))
        srcEl = srcEl.parentElement || srcEl.parentNode;

    // do not display exit popup when clicking links
    if ((srcEl != null) && (srcEl.tagName == "A")) {
        showExitPopup = false;
    }
}

function ConfirmExit(event) {
    if (showExitPopup)
     {
            if (window.confirm(ExitPopup_Message)) {
            try {
                SendUnicaCode(ExitPopup_OkUnica);
            } catch (err) { /* do nothing if error */ }
            window.open(ExitPopup_OkURL, '', ExitPopup_OkParameters);
        } else {
            try {
                SendUnicaCode(ExitPopup_CancelUnica);
            } catch (err) { /* do nothing if error */ }
        }
    }
}


   /* Methods represent ExpandableDiv logic */

// Expands expandable div
// Parameters:
//  expTitleDiv - title div element
//  expTextDiv - rich text div element
function expandExpDiv(expTitleDiv, expTextDiv) {
    expTextDiv.style.display = 'block';
    var spans = expTitleDiv.getElementsByTagName('div');
    for (var i = 0; i < spans.length; i++) {
        if (spans[i].className == 'plus') {
            spans[i].style.display = 'none';
        }
        else if (spans[i].className == 'minus') {
            spans[i].style.display = 'inline';
        }
    }
}

// Collapses expandable div
// Parameters:
//  expTitleDiv - title div element
//  expTextDiv - rich text div element
function collapseExpDiv(expTitleDiv, expTextDiv) {
    expTextDiv.style.display = 'none';
    var spans = expTitleDiv.getElementsByTagName('div');
    for (var i = 0; i < spans.length; i++) {
        if (spans[i].className == 'plus') {
            spans[i].style.display = 'inline';
        }
        else if (spans[i].className == 'minus') {
            spans[i].style.display = 'none';
        }
    }
}

// Expands or collapses expandable div
// Parematers:
//  expDiv - div element, must contains title and rich text divs
function toggleExpDiv(expDiv) {
    if (expDiv) {
        var title = null;
        var text = null;
        var innerDivs = expDiv.getElementsByTagName('div');

        // get title and rich text divs
        for (var i = 0; i < innerDivs.length; i++) {
            if (innerDivs[i].className == 'expandableTitle') {
                title = innerDivs[i];
            }
            else if (innerDivs[i].className == 'expandableRichText Closed') {
                text = innerDivs[i];
            }
        }

        if (title && text) {
            if (text.style.display == 'none' || text.style.display == '') {
                expandExpDiv(title, text);
            }
            else {
                collapseExpDiv(title, text);
            }
        }
    }
}

   function OpenAndSetLocationDlg(divToOpenID,srcElm, align )
{    
    CloseAllMenus();    
   var dlgDiv = document.getElementById(divToOpenID);
	
    if (dlgDiv != null)
    {
    dlgDiv.style.display = "block";

    //the addition of Number + "px" is for FF
    var left ;
    if (align == 'left')
        left = Number(GetPosX(srcElm));
    else if (align == 'right')
        left = Number((GetPosX(srcElm) - (dlgDiv.offsetWidth - srcElm.offsetWidth )));

    if (IsIE8Browser())
    {
         left = left - 1;
    }	
    dlgDiv.style.left = left + "px";
	
    var top = Number(GetPosY(srcElm) + srcElm.offsetHeight );    
    if (IsIEBrowser())
    {
        top = top -1;
    }
    dlgDiv.style.top = top + "px";
    
    OpenDlg(dlgDiv,srcElm.id);    
    }
}
function OpenDlg(dlgDiv, srcElmID)
{    
    dlgDiv.style.display = "block"; 
    var srcElm = document.getElementById(srcElmID);
    if(srcElm != null)
    {
        var color;
	    try 
	    {    
		    color = dlgDiv.currentStyle.backgroundColor;
	    } 
	    catch(err) 
	    {    
		    color = document.defaultView.getComputedStyle(dlgDiv, '').getPropertyValue("background-color");
	    }	
	    srcElm.style.backgroundColor = color;
    }
}

function CloseDlg(dlgDiv,srcElmID) 
{   
	//alert('divToCloseID=' + divToCloseID);
	//if(event.srcElement.tagName == "DIV" && event.srcElement.id == divToCloseID)
	{
        //var dlgDiv= document.getElementById(divToCloseID);
		//dlgDiv.style.visibility = "hidden"; 
                       if (dlgDiv != null)
                             {
		dlgDiv.style.display = "none"; 
                             }
    } 
    /*else 
	{
        var txt = document.getElementById("debug");
		txt.innerText = txt.innerText+event.srcElement.tagName + ' ' + event.srcElement.id + ' ' ;
    }*/    
    
    var srcElm = document.getElementById(srcElmID);
    srcElm.style.backgroundColor = ''; 
    //alert('CloseDlg');
}

function CloseAllMenus()
{
    var divList,i;
    // loop through all images of the document
     divList=document.getElementsByTagName("div");
     for(i=0;i<divList.length;i++)
     {
        if (divList[i].className == "FloatDiv")
            divList[i].style.display = "none";
     }     
}

function GetPosX(obj)
{
	var curleft = 0;
	while (obj.offsetParent)
	{
	  curleft += obj.offsetLeft;
	  obj = obj.offsetParent;
	}
	return curleft;

}
function GetPosY(obj)
{
	var curtop = 0;
	while (obj.offsetParent)
	{
	  curtop += obj.offsetTop;
	  obj = obj.offsetParent;
	}
	return curtop;
}

//window.onload = function() {
//            var spRemoveEvent = document.getElementById('LinkDlgOpener');
//            spRemoveEvent.onmouseover = null;
//            spRemoveEvent.onmouseout = null;            
//        }


   addLoadEvent(function()
{     	  
     var a = document.getElementById('MenuSeparator')
     if (a != null)
     {      	  
        //debugger
		if (IsIEBrowser())
		{
			try
			{    	        
				var padding = parseInt(a.parentNode.currentStyle.paddingLeft) + parseInt(a.parentNode.currentStyle.paddingRight);
				a.style.width = a.parentNode.offsetWidth - padding;
			}
			catch(e)
			{   
    	        //a.style.width = a.parentNode.offsetWidth; 	    
			}
		}
		else
		{
			a.style.width="100%";
		}
    }
}); 

   /**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


function getBanner(bannerID){
	return document.getElementById(bannerID);
}
		
function listening(bannerID){
          var flashInitFunc = bannerID + 'Init()';
          eval(flashInitFunc);
}
			
function ready(bannerID){
var version = '1.0';
try
{
version = eval(bannerID + 'FlashBannerVersion');
}
catch(err) {}
if ( version =='1.1'){
          var flashEl = document.getElementById(bannerID);
	bannerID = bannerID.replace("ID","");
         var el = document.getElementById(bannerID);
	nextObject(el).style.display='none';
   	el.style.width =flashEl.width;
	el.style.height =flashEl.height;
}
else{
          bannerID = bannerID.replace("ID","");
          var el = document.getElementById(bannerID);
          el.style.backgroundImage = "none";
}
}
		
function error(bannerID, id, value)
{
var version = '1.0';
try
{
version = eval(bannerID + 'FlashBannerVersion');
}
catch(err) {}
if (version=='1.1') {
         // show loader image in any error case - return it back to the front
        // In case of error id = 6 remain presenting the flash
        if(id != 6)
        {
	var el = document.getElementById(bannerID);
	el.style.display='none';
	nextObject(el).style.display='block';
        }
}
else {
         // show loader image in any error case - return it back to the front
        //alert("error (" + id + ")" + value);
        // In case of error id = 6 remain presenting the flash
        if(id != 6)
        {
                var bgIMGID = bannerID + "BG";
                var el = document.getElementById(bannerID);
                el.style.backgroundImage="url"+"('"+document.getElementById(bgIMGID).value+"')";
        }
}
}

function ExtendedJSLinkWithRegLink(link, unicaEvent, jsLink, sCut)
{
  var sURL = link;

  if (sCut != "")
  { 
    var pos = sURL.indexOf("?");
    if (pos < 0) // if link url doesn't contains '?' already
    {
      sURL += "?" + sCut;
    }
    else
    {
      sURL += "&" + sCut;
    } 
   }

	if (unicaEvent != null && unicaEvent != "")
	{
    try 
    {
      ntptEventTag("ev=" + unicaEvent);
    } catch (err) { }
	}	
	
	if (jsLink != null && jsLink != "")
	{
	  eval(jsLink);
	}	
		
	document.location.href = sURL;
}



function ExtendedJSLink(unicaEvent, jsLink)
{

	if (unicaEvent != null && unicaEvent != "")
	{
    try 
    {
      ntptEventTag("ev=" + unicaEvent);
    } catch (err) { }
	}	
	
	if (jsLink != null && jsLink != "")
	{
	   eval(jsLink);
	}	

}


function ExtendedRegularLink(link, unicaEvent, sCut)
{

  var sURL = link;

  if (sCut != "")
  { 
    var pos = sURL.indexOf("?");
    if (pos < 0) // if link url doesn't contains '?' already
    {
      sURL += "?" + sCut;
    }
    else
    {
      sURL += "&" + sCut;
    } 
   }
	
	if (unicaEvent != null && unicaEvent != "")
	{
    try 
    {
      ntptEventTag("ev=" + unicaEvent);
    } catch (err) { }
	}	
  
	
   document.location.href = sURL;
}


function ExtendedRegularLinkNewWindow(link, unicaEvent, sCut)
{
	var sURL = link;
	
  if (sCut != "")
  { 
    var pos = sURL.indexOf("?");
    if (pos < 0) // if link url doesn't contains '?' already
    {
      sURL += "?" + sCut;
    }
    else
    {
      sURL += "&" + sCut;
    } 
   }
	
	if (unicaEvent != null && unicaEvent != "")
	{
    try 
    {
      ntptEventTag("ev=" + unicaEvent);
    } catch (err) { }
	}	
	
	window.open(sURL);
}

function nextObject (obj) { 
var n = obj; 
do n = n.nextSibling; 
while (n && n.nodeType != 1); 
return n; 
} 

   function OpenChat(){	startChatWithEscalation('8o8QZZ1050123', 'chat.cassava.net', 'CUSTOMER', null, null, null);}

/////////////////////////////////////////////////
//                                             //
//  KANA Response Live Functions               //
//  Version $Revision: 1.1 $                  //
//                                             //
//  Copyright (c) 2004 - KANA Inc.    		   //
//  All Rights Reserved.  Patent Pending.      //
//                                             //
/////////////////////////////////////////////////

//===================================================================
// Default IChannel And Server locations
// 1. Set the gIChannelID value to be the value of your default iChannel.
// 2. If you have an on-premise solution, set the gServer value to be
// the fully qualified domain name of the web server running KANA Response Live.
//===================================================================
var gIChannelID = "Default";
var gServer = "router.conavigator.com";

//===================================================================
// startMeetMe launches the basic Conav application w/o DSP
//
// IChannelID: IChannelID for interaction
// AttachedData: Company-specific data to attach to customer's acocunt
// CustomerName: the name of the customer requesting live help
// ConenctToName: the id of the rep to whom the customer is connecting
//===================================================================
function startMeetMe(iChannelID, attachedData, customerName, connectToName, server) {
	window.startVarApp = startConavVarApp;
	window.getWinProperties = getConavWinProperties;
	setServerDomain(server);
	setCustomerName(customerName);
	setConnectToName(connectToName);
	launchRegularStartPage(iChannelID, attachedData);
}


//===================================================================
// startDSPMeetMe launches the Conav application using Dynamic Start Page
//
// IChannelID: IChannelID for interaction
// AttachedData: Company-specific data to attach to customer's acocunt
// CustomerName: the name of the customer requesting live help
// ConenctToName: the id of the rep to whom the customer is connecting
//===================================================================
function startDSPMeetMe(iChannelID, attachedData, customerName, connectToName, server) {
	window.startVarApp = startConavVarApp;
	window.getWinProperties = getConavWinProperties;
	setServerDomain(server);
	setCustomerName(customerName);
	setConnectToName(connectToName);
	launchDynamicStartPage(iChannelID, attachedData);
}



//===================================================================
// startDirectCall launches the Direct Call application
//
// IChannelID: IChannelID for interaction
// AttachedData: Company-specific data to attach to customer's acocunt
//===================================================================
function startDirectCall(iChannelID, attachedData, server) {
	window.startVarApp = startDirectCallVarApp;
	window.getWinProperties = getCallbackWinProperties;
	setServerDomain(server);
	launchDynamicStartPage(iChannelID, attachedData); 	
}


//===================================================================
// startCallback launches the Basic Callback application
//
// IChannelID: IChannelID for interaction
// AttachedData: Company-specific data to attach to customer's acocunt
//===================================================================
function startCallback(iChannelID, attachedData, server) {
	window.startVarApp = startCallbackVarApp;
	window.getWinProperties = getCallbackWinProperties;
	setServerDomain(server);
	launchDynamicStartPage(iChannelID, attachedData);
}


//===================================================================
// startCallbackExtended launches the Callback application for a given
// customer telephone number.
//
// IChannelID: IChannelID for interaction
// AttachedData: Company-specific data to attach to customer's acocunt
// customerName: name of the customer
// telephoneNumber: Telephone number
// countryCode:  Telephone Country Code
//
//===================================================================
function startCallbackExtended(iChannelID, attachedData, customerName, telephoneNumber, countryCode, server) {
	window.gTelephoneNumber = telephoneNumber;
	window.gCountryCode = countryCode;
	window.gCustomerName = customerName;
	window.startVarApp = startCustomCallbackVarApp;
	window.getWinProperties = getCallbackWinProperties;
	setServerDomain(server);
	launchDynamicStartPage(iChannelID, attachedData);
}


//====================================================================================
//====================================================================================
//====================================================================================
// Private Functions and variables for KANA Use Only
// Do not modify or call these functions.
//====================================================================================
//====================================================================================
//====================================================================================

var gHelpWindow = "help";
var gLaunchUrl;
var gAttachedData;
var gConnectToName = "";
var gCustomerName = "";
var gAppType = "";
var gConavHtdocsPath = "/CONAV/HTD/";
var gHTTP = "http://";
var gHTTPS = "https://";

function setIChannelID(iChannelID) {
	if(typeof(iChannelID) == "undefined" || iChannelID == null)
		return;

	window.gIChannelID = iChannelID;
}

function getIChannelID() {
	return window.gIChannelID;
}

function setServerDomain(server) {
	if(typeof(server) == "undefined" || server == null )
		return;

	window.gServer = server;
}

function getServerDomain() {
	return window.gServer;
}

function setLaunchUrl(url) {
	window.gLaunchUrl = url;
}

function getLaunchUrl() {
	return window.gLaunchUrl;
}

function getHelpWindowName() {
	return window.gHelpWindow;
}

function setConnectToName(connectToName) {
	if(typeof(connectToName) == "undefined" || connectToName == null)
		return;

	window.gConnectToName = connectToName;
}

function getConnectToName() {
	return window.gConnectToName;
}

function setCustomerName(customerName) {
	if(typeof(customerName) == "undefined" || customerName == null)
		return;

	window.gCustomerName = customerName;
}

function getCustomerName() {
	return window.gCustomerName;
}

function setAttachedData(attachedData) {
	window.gAttachedData = attachedData;
}

function getAttachedData() {
	return window.gAttachedData;
}

function getConavHtdocsPath() {
	return window.gConavHtdocsPath;
}

function launchRegularStartPage(iChannelID, attachedData) {
	launchStartPage(iChannelID, attachedData, "invokeRegularStartPage()");
}

function launchDynamicStartPage(iChannelID, attachedData) {
	launchStartPage(iChannelID, attachedData, "invokeDynamicStartPage()");
}

function launchStartPage(iChannelID, attachedData, launchFunctionStr) {
	setIChannelID(iChannelID);
	setAttachedData(attachedData);

	//the ssl check cannot be made with opera 5.
	if( window.location.protocol == "http:" && !isOpera() ) {
		checkSSLEnabled(launchFunctionStr);
	}
	else {
		eval(launchFunctionStr);
	}
}

function checkSSLEnabled(launchFunctionStr) {
	var testImg = new Image(1,1);
	testImg.onerror = new Function("handleNoSSL()");
	testImg.onload = new Function(launchFunctionStr);
	testImg.src = gHTTPS + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/shared/images/blank.gif?time=" + (new Date()).getTime();
}

function invokeDynamicStartPage() {
	if(typeof(isHipboneSharedWindow) != "undefined") {
		launchRecursiveErrorMessage();
		return;
	}

	if(isMacButNotNetscape()) {
		startVarApp();
		return;
	}

	var link = "responseLiveLauncher.html?ichannel=" + escape(getIChannelID()) + "&host=" + escape(getServerDomain()) + "&apptype=" + gAppType + getAttachedDataQueryParam();
	launchWindow(link);
}

function invokeRegularStartPage() {
	if(typeof(isHipboneSharedWindow) != "undefined") {
		launchRecursiveErrorMessage();
		return;
	}

	startVarApp();
}

function startConavVarApp() {
	var link = gHTTPS + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/StartConavPage?time=" + (new Date()).getTime() + "&NAME=" + escape(getCustomerName()) + "&CONNECT_TO=" + escape(getConnectToName()) + getAccountSpecificQueryParam();
	launchWindow(link);
}

function startDirectCallVarApp() {
	var link = gHTTPS + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/login/oem/callback/n_to_p.thtml?METHOD=phoneCallBack.thtml";
	launchWindow(link);
}

function startCallbackVarApp() {
	var link = gHTTPS + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/login/oem/callback/n_to_p.thtml";
	launchWindow(link);
}

function startCustomCallbackVarApp() {
	var link = gHTTPS + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/login/oem/callback/n_to_p.thtml?"
   	+ "PHONE_NUMBER=" + escape(gTelephoneNumber)
   	+ "&COUNTRY_CODE=" + escape(gCountryCode)
   	+ "&CUSTOMER_NAME=" + escape(gCustomerName)
   	+ "&TIME=" + (new Date()).getTime();
	launchWindow(link);
}

function launchRecursiveErrorMessage() {
	var link = gHTTP + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/login/recursiveConav.thtml";
	launchWindow(link);
}

function handleNoSSL() {
	var link = gHTTP + getServerDomain() + getConavHtdocsPath() + getIChannelID() + "/login/sslDisabled.thtml";
	launchWindow(link);
}

function getConavWinProperties() {
	return 'scrollbars=yes,resizable=' + (isNetscape()?'no':'yes') + ',width=270,height=400,screenX=10,screenY=10,top=10,left=10';
}

function getCallbackWinProperties() {
	return 'scrollbars=yes,resizable=' + (isNetscape()?'no':'yes') + ',width=300,height=430,screenX=10,screenY=10,top=10,left=10';
}

function getAttachedDataQueryParam() {
	var attachedDataQStr = "";
	if(getAttachedData()) {
		attachedDataQStr = "&ATTACHED_DATA=" + escape(getAttachedData());
	}

	return attachedDataQStr;
}

function getAccountSpecificQueryParam() {
	var attachedDataQStr = "";
	if(getAttachedData()) {
		attachedDataQStr = "&ACCTSPECIFIC=" + escape(getAttachedData());
	}

	return attachedDataQStr;
}

//===================================================================
// AOL-safe window.open()
//===================================================================

function launchWindow(launchUrl) {
	setLaunchUrl(launchUrl);
	if(isAOL()) {
		var scriptletHTML = "<object data='responseLiveScriptletLauncher.html' type='text/x-scriptlet' width=0 height=0></object>";
		document.body.insertAdjacentHTML('BeforeEnd', scriptletHTML);
		return;
	}

	window.open(getLaunchUrl(), getHelpWindowName(), getWinProperties());
}

function isNetscape() {
	return (navigator.appName.indexOf("Netscape")!=-1);
}

function isAOL() {
	return (navigator.appVersion.indexOf("AOL")!=-1);
}

function isOpera() {
	return (navigator.userAgent.indexOf("Opera")>-1);
}

function isMac() {
	return (navigator.userAgent.indexOf("Mac")>-1);
}

function isMacButNotNetscape() {
	return (isMac() && !isNetscape());
}

/////////////////////////////////////////////////
//                                             //
//  KANA Response Live Chat Functions          //
//  Version $Revision: 1.1 $                  //
//                                             //
//  Copyright (c) 2004 - KANA Inc.    		   //
//  All Rights Reserved.  Patent Pending.      //
//                                             //
/////////////////////////////////////////////////


//======================================================================
// Uncomment and set gAfterLaunchURL to the url of the page you want
// to display after launching live help chat
//======================================================================
//var gAfterLaunchURL="http://www.kana.com";

var gChatWindowWidth = 300;
var gChatWindowHeight = 500;
var gChatWindowProperties = "width=" + gChatWindowWidth + ",height=" + gChatWindowHeight + ",menubar=no,location=no,directories=no,status=no,toolbar=no,scrollbars=auto,resizable=yes,screenX=10,screenY=10,left=10,top=10";
var gDSPLauncherPageName = "responseLiveLauncher.html";
var gHTTP = "http://";
var gHTTPS = "https://";

function startChat(iChannel, server_name, attached_data, custom_values, agent_only_values, go_immediately_into_queue)
{
	var chatLaunchMode = "CHAT_ONLY";
	launchChat(iChannel, server_name, attached_data, custom_values, agent_only_values, go_immediately_into_queue, chatLaunchMode);
}

function startChatAndCobrowse(iChannel, server_name, attached_data, custom_values,agent_only_values, go_immediately_into_queue)
{
	var chatLaunchMode = "COBROWSE";
	launchChat(iChannel, server_name, attached_data, custom_values, agent_only_values, go_immediately_into_queue, chatLaunchMode);
}

function startChatWithEscalation(iChannel, server_name, attached_data, custom_values,agent_only_values, go_immediately_into_queue)
{
	var chatLaunchMode = "COBROWSE_ESCALATION";
	launchChat(iChannel, server_name, attached_data, custom_values, agent_only_values, go_immediately_into_queue, chatLaunchMode);
}

function launchChat(iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode)
{
	if (isAOL())
	{
		saveChatParamaters(window, iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode);
		var scriptletHTML = "<object data='responseLiveLauncher.html' type='text/x-scriptlet' width=0 height=0></object>";
		document.body.insertAdjacentHTML('BeforeEnd', scriptletHTML);
		return;
	}

	openInitialWindow();
	finishLaunchingChat(iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode)
}

function finishLaunchingChat(iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode)
{
	var chatWin = getChatWindow();
	saveChatParamaters(chatWin, iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode);

	if (alreadyConavigating())
	{
		handleRecursiveLaunch(iChannel, serverName, chatWin);
		return;
	}

	if (browserDoesNotSupportDOM2() || isIEonMac())
	{
		handleUnsupportedBrowser(iChannel, serverName, chatWin);
		return;
	}

	if (!areCookiesEnabled())
	{
		handleDisabledCookies(iChannel, serverName, chatWin);
		return;
	}

	if(window.location.protocol == "https:")
		createAndSubmitForm();
	else
		checkSSLEnabledAndSubmit(iChannel, serverName);
}

function createAndSubmitForm()
{
	var chatWin = getChatWindow();
	var launchChatForm = createForm(chatWin.serverName, chatWin);

	// add this parameter to use dsp
	addFormField(launchChatForm, chatWin, "DSP_LAUNCHER_PAGE_NAME", gDSPLauncherPageName);
	addFormField(launchChatForm, chatWin, "CHAT_WINDOW_WIDTH", gChatWindowWidth);
	addFormField(launchChatForm, chatWin, "CHAT_WINDOW_PROPERTIES", gChatWindowProperties);
	addFormField(launchChatForm, chatWin, "ICHANNEL_ID", chatWin.iChannel);
	addFormField(launchChatForm, chatWin, "ATTACHED_DATA", chatWin.attachedData);
	addFormField(launchChatForm, chatWin, "ENTER_ON_QUEUE_PAGE", chatWin.enterOnQueuePage);
	addFormField(launchChatForm, chatWin, "CHAT_LAUNCH_MODE", chatWin.chatLaunchMode);
	addFormField(launchChatForm, chatWin, "AGENT_VISIBLE_DATA", createAgentVisibleDataString(chatWin.agentOnlyValues));

	var prefillValues = chatWin.prefillValues;
	for (prefillItem in prefillValues)
	{
		addFormField(launchChatForm, chatWin, prefillItem, prefillValues[prefillItem]);
	}

	launchChatForm.submit();
}

function openInitialWindow()
{
	var newWin = window.open("", getChatWindowName(), getWinProperties());
	newWin.document.write("<html><head><title>Live Chat</title></head><body></body></html>");
	newWin.document.close();
	setChatWindow(newWin);
}

function createForm(serverName, win)
{
	var launchChatForm = win.document.createElement("form");
	launchChatForm.method = "post";
	launchChatForm.target = "_self";
	launchChatForm.action = gHTTPS + serverName + "/CONAV/CHAT/ChatPreLaunch";
	win.document.body.appendChild(launchChatForm);
	return launchChatForm;
}

var DATA_SEPARATOR = "_HB_";
function createAgentVisibleDataString(agentOnlyValues)
{
	var agentVisibleData = "";
	for (agentItem in agentOnlyValues)
	{
		if(isNonEmptyString(agentVisibleData))
			agentVisibleData += DATA_SEPARATOR;

		agentVisibleData += agentItem + DATA_SEPARATOR + agentOnlyValues[agentItem];
	}
	return agentVisibleData;
}

function addFormField(launchChatForm, win, name, value)
{
	if(!isNonEmptyString(name) || !isNonEmptyString(value))
		return;
	var elementObj = win.document.createElement("input");
	elementObj.type = "hidden";
	elementObj.name = name;
	elementObj.value = value;
	launchChatForm.appendChild(elementObj);
}

function alreadyConavigating()
{
	return (typeof(isHipboneSharedWindow) != "undefined");
}

function handleRecursiveLaunch(iChannel, serverName, win)
{
	win.location.href = gHTTPS + serverName + "/CONAV/chat/errorpages/recursiveConav.jsp?ICHANNEL_ID=" + iChannel;
}

function browserDoesNotSupportDOM2()
{
	return (null == document.getElementById);
}

function handleUnsupportedBrowser(iChannel, serverName, win)
{
	win.location.href = gHTTPS + serverName + "/CONAV/CHAT/ChatPreLaunch?ICHANNEL_ID=" + iChannel;
}

function areCookiesEnabled()
{
	var time = (new Date()).getTime();
	setTestCookie(time);
	if (theCookieIsSet(time))
	{
		removeTestCookie(time);
		return true;
	}
	return false;
}

function setTestCookie(value)
{
	document.cookie = "hbcookietest=" + value;
}

function theCookieIsSet(value)
{
	var theCookieString = document.cookie;
	return (isNonEmptyString(theCookieString) && theCookieString.indexOf(value) > -1);
}

function removeTestCookie(value)
{
	document.cookie = "hbcookietest=" + value + "; expires=Fri, 02-Jan-1970 00:00:00 GMT";
}

function handleDisabledCookies(iChannel, serverName, win)
{
	win.location.href = gHTTP + serverName + "/CONAV/chat/errorpages/cookiesDisabled.jsp?ICHANNEL_ID=" + iChannel;
}

function checkSSLEnabledAndSubmit(iChannel, serverName)
{
	createAndSubmitForm();
	var testImg = new Image(1,1);
	testImg.onerror = function() { handleChatNoSSL(iChannel, serverName); }
	testImg.src = gHTTPS + serverName + "/CONAV/HTD/Default/shared/images/blank.gif?time=" + (new Date()).getTime();
}

function handleChatNoSSL(iChannel, serverName)
{
	var link = gHTTP + serverName + "/CONAV/chat/errorpages/sslDisabled.jsp?ICHANNEL_ID=" + iChannel;
	window.open(link, getChatWindowName(), getWinProperties());
	getChatWindow().close();
}

function saveChatParamaters(chatWin, iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode)
{
	chatWin.iChannel = iChannel;
	chatWin.serverName = serverName;
	chatWin.attachedData = attachedData;
	chatWin.prefillValues = prefillValues;
	chatWin.agentOnlyValues = agentOnlyValues;
	chatWin.enterOnQueuePage = enterOnQueuePage;
	chatWin.chatLaunchMode = chatLaunchMode;
}

function setAOLChatWindow(chatWin)
{
	setChatWindow(chatWin);
	with (window)
	{
		finishLaunchingChat(iChannel, serverName, attachedData, prefillValues, agentOnlyValues, enterOnQueuePage, chatLaunchMode);
	}
}

var gChatLaunchWindow = null;
function setChatWindow(chatWin)
{
	window.gChatLaunchWindow = chatWin;
}

function getChatWindow()
{
	return window.gChatLaunchWindow;
}

function getChatWindowName()
{
	return "_blank";
}

function getWinProperties()
{
	return gChatWindowProperties;
}

function isAOL()
{
	return (navigator.appVersion.toLowerCase().indexOf("aol")!=-1);
}

function isIE()
{
    return (navigator.userAgent.toLowerCase().indexOf("msie")!=-1);
}

function isMac()
{
	return (navigator.userAgent.toLowerCase().indexOf("mac")!=-1);
}

function isIEonMac()
{
    return (isIE() && isMac())
}

function isNonEmptyString(str)
{
	if(null == str || str == "")
		return false;
	return true;
}

function goToAfterLaunchUrl() 
{
    if(typeof(window.gAfterLaunchURL) == "undefined")
		return;

	window.location.href = window.gAfterLaunchURL;
}


   function OpenRightNow(url)
{
      var w = 580;
      var h = 700;
      var l = (window.screen.width-w)/2;
      var t = (window.screen.height-h)/2;
      window.open(url,"faq","resizable=no,status=no,scrollbars=yes,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);
}
function OpenRightNow888(){OpenRightNow("http://888-external-en.custhelp.com/app/answers/list/");}
function OpenRightNowPoker(){OpenRightNow("http://888-external-en.custhelp.com/app/answers/list/p/4/");}
function OpenRightNowCasino(){OpenRightNow("http://888-external-en.custhelp.com/app/answers/list/p/1/");}
function OpenRightNowBingo(){OpenRightNow("http://888-external-en.custhelp.com/app/answers/list/p/234/");}

   function OpenNRS() {
    if (arguments.length >= 7 && sTestDataXML.length > 0 && sNRSDomain.length > 0) {
        // appending mandatory parameters
        var targetURL = sNRSDomain + "?" + "rl=" + arguments[0] +
                                "&brand=" + arguments[1] + "&version=" + arguments[2] + "&orientation=" + arguments[3] +
                                "&subbrand=" + arguments[4] + "&mode=" + arguments[5] + "&platform=" + arguments[6];
        // appending non-mandatory parameters
        if (nSerial.length > 0) {
            // appending the language from session
            targetURL += "&sr=" + nSerial;
        }

        // appending non-mandatory parameters
        if (arguments[7] != null) {
            // appending the language from input parameters
            targetURL += "&lang=" + arguments[7];
        }
        else if (sLanguage.length > 0) {
            // appending the language from session
            targetURL += "&lang=" + sLanguage;
        }
        if (arguments[8] != null) {
            // appending the skin parameter
            targetURL += "&skin=" + arguments[8];
        }
        // appending the test data xml
        targetURL += "&testdata=" + sTestDataXML;
        // opening the NRS page in separate window
        window.open(targetURL.toLowerCase(), "NRSPage", "status=1, location=1, resizable=1", false);
    }
    return false;
}

   function ConvertOpenAndDownload(location, brand, mkw, google_trackcode) {
  var opt_regex = /\d{9,}/;  
  if (google_trackcode.match(opt_regex) && typeof gwoTracker != 'undefined' && typeof gwoTracker._trackPageview == 'function') {
    try {
      gwoTracker._trackPageview('/' + google_trackcode + '/goal');
    } catch(err) {}
  }
  
  try {
    showExitPopup = false;
    setDownloadStatus();
  } catch(err) {}
  
  var mkw_regex = /&mkw=[^\&]+&/i;
  var mkw_code = (sCut.match(mkw_regex) ? '1' : '0') + mkw;
  
  var sURLreg = '/downloadclient.htm?dl=' + location + '&DownloadBrand=' + brand + '&mkw=' + mkw_code;
  window.open(sURLreg, "popDown", "width=620,height=150,top=0,left=0");  
}

function showFlashWithParameters(flashPath, flashWidth, flashHeight, parameters) {
  parameters = typeof parameters != 'undefined' ? parameters : {};
  param_str = '';
  
  for (var key in parameters) {
    param_str += key + '=' + parameters[key] + '&';
  }
  
  var output = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + flashWidth + '" height="' + flashHeight + '" id="flash_id" align="middle" VIEWASTEXT>' + "\n" +
    '<param name="movie" value="' + flashPath + '" />' + "\n" + 
    '<param name="quality" value="high" />' + "\n" + 
    '<param name="bgcolor" value="#000000" />' + "\n" + 
    '<param name="wmode" VALUE="transparent" />' + "\n" + 
    '<param name="allowScriptAccess" value="always" />' + "\n" + 
    (param_str != '' ? ('<param name="flashVars" value="' + param_str + '"'): '') +
    '<embed src="'+ flashPath + '"  wmode="transparent" quality="high" bgcolor="#000000" width="' + flashWidth + '" height="' + flashHeight + '" name="flash_id" allowScriptAccess="always" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' + 
    (param_str != '' ? ('flashVars="' + param_str + '"'): '') +
    '/>' + "\n" +
  '</object>';
    
  document.write(output);
}

