
   function OpenLiveCasino(i_dl) {
  var dl = parseInt(i_dl);
  dl = (isNaN(dl) ? '4679' : dl);

  try {
    ntptAddPair("dl", dl);
    ntptEventTag("ev=nodownload_livecasino");
  } catch(err){}
  
  var w = 801;
  var h = 571;
  var l = (window.screen.width-w)/2;
  var t = (window.screen.height-h)/2;

  var filename =  "$$LiveCasinoURL$$?mode=3&LangID=en&dl=" + dl + "&skin=5" + "&brand=0&" + sCut;
 
  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) {
  try {
    ntptAddPair("dl", location);
    ntptEventTag("ev=nodownload_888poker");
  } catch(err){}

  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://safe-iplay.com/poker/application/RLFlashPoker.html?brand=20&skin=4&langid=EN&" + "dl=" + location + "&langid=en&" + sCut;
  
  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) {
  try {
    ntptAddPair("dl", location);
    ntptEventTag("ev=nodownload_888casino");
  } catch(err){}

  var w = 801;
  var h = 571;
  var l = (window.screen.width-w)/2;
  var t = (window.screen.height-h)/2;

  var skin = (typeof rlCountry == 'string' && rlCountry == 'gbr') ? '3' : '4';
  var filename =  "$$NDLCasinoURL$$?mode=2&LangID=en&" + sCut + "&dl=" + location + "&skin=" + skin;

  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, serial) {
  //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){}
  
  var dlp = '';
  try {
    var dlp = encodeURIComponent(document.location.href);
    dlp = dlp.replace(/\./gi, "%2E");
  }
  catch(err) { // if 'dlp' parameter initializtion was failed for some reason, download without this param (as previously)
  }
  
  var params = "&dl=" + location + "&DownloadBrand=" + brand + ( (typeof(serial) != "undefined")? "&sr="+serial : "") + "&dlp=" + dlp;
  var sURLreg = "/downloadclient.htm?"+params;
  
  var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
  if (is_chrome) {
    window.location.href = sURLreg;
  }
  else {
    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 togglePlusMinusDiv(div_id,sign_id, height) {
    togglePlusMinusDiv.ypos += togglePlusMinusDiv.coeff*height;
    positionBackground(document.getElementById(sign_id), 0, togglePlusMinusDiv.ypos);
    toggleElement(div_id);
    togglePlusMinusDiv.coeff *= -1;
}

togglePlusMinusDiv.ypos = 0;
togglePlusMinusDiv.coeff = -1;

function toggleExp(obj) {
   togglePlusMinusDiv(obj.id+'_exp',obj.id, 14);
}

function toggle_exp(id) {
    var obj = document.getElementById(id);
    if (obj.style.backgroundPosition == "0px 0px" || obj.style.backgroundPosition == "") {
        positionBackground(obj,0,-14);
    }
    else { obj.style.backgroundPosition = "0px 0px"; }
    toggleElement(id+"_exp");
}
   /**
 * 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; 
} 
   /* 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() {
  if (rlFlag.charAt(3) != '1') //If the 4th char in rlFlag is not 1, load function
  {
    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 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 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 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);
//      window.open(url, 'faq');

windowFeatures = "scrollbars=1,top=0,left=0,resizable=yes,width="+(screen.width)+",height="+(screen.height); 
newWindow=window.open(url,'faq',windowFeatures)
newWindow.focus(); 
}


function OpenRightNow888(){OpenRightNow("$$OpenRightNow888URL$$");}
function OpenRightNowPoker(){OpenRightNow("$$OpenRightNowPokerURL$$");}
function OpenRightNowCasino(){OpenRightNow("$$OpenRightNowCasinoURL$$");}
function OpenRightNowBingo(){OpenRightNow("$$OpenRightNowBingoURL$$");}
function OpenRightNowSport(){OpenRightNow("$$OpenRightNowSportURL$$");}
function OpenRightNowGames(){OpenRightNow("$$OpenRightNowGamesURL$$");}

   function OpenChat(){	startChatWithEscalation('', '', '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 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%";
		}
    }
}); 
   function addLoadEvent(i_func) {
  if (typeof i_func == 'function') {
    if (document.addEventListener) {
      document.addEventListener('DOMContentLoaded', i_func, false);
    }
    else if (window.attachEvent) {
      window.attachEvent('onload', i_func);
    }
    else if (typeof window.onload == 'function') {
      var old_func = window.onload;
      window.onload = function () {
        old_func(); i_func();
      }
    }
    else {
      window.onload = i_func;
    }
  }
}

function addEvent(obj, event, func, useCapture) {
  if (obj.addEventListener) {
    obj.addEventListener(event, func, typeof useCapture == 'undefined' ? false : useCapture);
  }
  else if (obj.attachEvent) {
    obj.attachEvent('on' + event, func);
  }
  else {
    obj['on' + event] = func;
    }
}

function setAttribute(obj, key, value) {
	if (obj.setAttribute) {
		obj.setAttribute(key, value);
	}
	else {
		obj[key] = value;
	}
}

function getAttribute(obj, key) {
	var res = '';
	if (obj.getAttribute) {
		res = obj.getAttribute(key);
	}
	else {
		res = obj[key];
	}	
	
	return res;
}

function SendAnalyticsEvent(i_category, i_action, i_label, i_value) {
  var category = typeof i_category == 'string' ? i_category : '';
  var action = typeof i_action== 'string' ? i_action: '';
  var label = typeof i_label== 'string' ? i_label: '';
  try {
    value = parseInt(i_value);
    value = isNaN(value) ? 0 : value;
  }
  catch(err) {
    value = 0;
  }

  pageTracker._trackEvent(category, action, label, value);
}

/*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 + "')";
    }
}

/* Toggles element display */
function toggleElement(id) {
        elem = document.getElementById(id);
        elem.style.display= (elem.style.display=="none") ? "block":"none";
}

/* Position xpos, ypos of background image */
function positionBackground(control,xpos,ypos) {
       control.style.backgroundPosition=xpos+"px "+ypos+"px";
}

/* Fetches query string value */
function fetchParameterValue(param) {
    query_str = window.location.search.substring(1);
    pairs = query_str.split("&");
    for (i=0; i<pairs.length; i++) {
        kv = pairs[i].split("=");
        if (kv[0] == param) { 
            return kv[1];
        }
    }
    return "Undefined";
}

function isEmpty(obj) {
  for (var prop in obj) {
    if (obj.hasOwnProperty(prop)) {
      return false;
    }
  }

  return true;
}
   sfHover = function TopNavMenuPatch (){	    
    var ulTags = document.getElementsByTagName("UL");
    for (var j=0; j<ulTags.length; j++) {
        var currDDmenu = ulTags[j];
        if (currDDmenu.id.substring(0,7) == "DDMenu_")
        {
	        var sfEls = currDDmenu.getElementsByTagName("LI");
	        for (var i=0; i<sfEls.length; i++) {
		        sfEls[i].onmouseover=function() {
			        this.className+=" sfhover";
		        }
		        sfEls[i].onmouseout=function() {
			        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		        }
	        }
	    }
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
         function addEvent(obj ,evt, fnc)
      {
        if (obj.addEventListener)
          obj.addEventListener(evt,fnc,false);
        else if (obj.attachEvent)
          obj.attachEvent('on'+evt,fnc);
        else
          return false;
        return true;
      }
      
      function removeEvent(obj ,evt, fnc)
      {
        if (obj.removeEventListener)
          obj.removeEventListener(evt,fnc,false);
        else if (obj.detachEvent)
          obj.detachEvent('on'+evt,fnc);
        else
          return false;
        return true;
      }
      
      //----------
      
      function appendElement(node,tag,id,htm)
      {
        var ne = document.createElement(tag);
        if(id) ne.id = id;
        if(htm) ne.innerHTML = htm;
        node.appendChild(ne);
      }
      
      //----------

      function showRedirectionPopup(p)
      {
        greyout(true);
        document.getElementById(p).style.display = 'block';
      }

      function hidePopup(p)
      {
        greyout(false);
        document.getElementById(p).style.display = 'none';
      }

      //----------

      function greyout(d,z)
      {
        var obj = document.getElementById('greyout');

        if(!obj)
        {
          appendElement(document.body,'div','greyout');
          obj = document.getElementById('greyout');
          obj.style.position = 'absolute';
          obj.style.top = '0px';
          obj.style.left = '0px';
          obj.style.background = '#111';
          obj.style.opacity = '.5';
          obj.style.filter = 'alpha(opacity=70)';
        }
        if(d)
        {
          var ch = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
          var cw = document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
          var sh = document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight;
          if(document.body.scrollHeight) sh = Math.max(sh,document.body.scrollHeight)
          var sw = document.documentElement.scrollWidth ? document.documentElement.scrollWidth : document.body.scrollWidth;
          if(document.body.scrollWidth) sw = Math.max(sw,document.body.scrollWidth)
          var wh = window.innerHeight ? window.innerHeight : document.body.offsetHeight;
          var ww = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
          if(!z){ z = 50 }
          obj.style.zIndex = z;
          obj.style.height = Math.max(wh, Math.max(sh,ch))+'px';
          obj.style.width  = Math.max(ww, Math.max(sw,cw))+'px';
          obj.style.display = 'block';
          if (window.addEventListener)
          {
              // adding handler for FF and other non-IE browsers
              window.addEventListener("resize", greyoutResize, false);
          }
          else
          {
              // adding handler for IE browsers
              document.body.onresize = greyoutResize;
          }
        }
        else
        {
          obj.style.display = 'none';   
          if (window.removeEventListener)
          {
              // removing handler for FF and other non-IE browsers
              window.removeEventListener("resize", greyoutResize, false);
          }
          else
          {
              // removing handler for IE browsers
              document.body.onresize = null;
          }
        }
      }

      function greyoutResize()
      {
        var ch = document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
        var cw = document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
        var sh = document.documentElement.scrollHeight ? document.documentElement.scrollHeight : document.body.scrollHeight;
        if(document.body.scrollHeight) sh = Math.max(sh,document.body.scrollHeight)
        var sw = document.documentElement.scrollWidth ? document.documentElement.scrollWidth : document.body.scrollWidth;
        if(document.body.scrollWidth) sw = Math.max(sh,document.body.scrollWidth)
        var wh = window.innerHeight ? window.innerHeight : document.body.offsetHeight;
        var ww = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
        var obj = document.getElementById('greyout');
        obj.style.height = ch+'px';
        obj.style.width  = cw+'px';
        obj.style.height = Math.max(wh,Math.max(sh,ch))+'px';
        obj.style.width  = Math.max(ww, Math.max(sw,cw))+'px';
      }




function counterdirect()
{ 
    if (currentsecond!=1)
        { 
        currentsecond-=1 
       
           document.getElementById('NumberOfSeconds').innerHTML=currentsecond 
        } 
        else
        { 
        window.location=RedirectURL        
        return 
        } 
    setTimeout("counterdirect()",1000)    
} 


function InstantRedirect()
{
    window.location=RedirectURL;
}

function RedirectOrEntry(container,isRedirectPopUp, divToShow)
{
    if(null != container && container.length > 0)
    {
        var containerElement = document.getElementById(container);
        if(null != containerElement)
        {
            containerElement.style.display = "block";
        }
    }

    if (isRedirectPopUp =='true') // show redirect popup
    { 
        // prevent entry popup from upload when redirect popup is shown
        var entryPopup = document.getElementById('EntryPopup');
        if  (entryPopup != null)   
        {
             entryPopup.style.visibility = "hidden";
        }
        showExitPopup = false;   // disable exit popup
        ShowPopup=false;
        showRedirectionPopup(divToShow);
        counterdirect();
    }   
}

function handleKeyDown(event)
{
    var e=(event)?event:window.event;
    // [esc = 27], don't allow esc key
    if(e.keyCode == 27)
    {
        if (window.event) {
            e.cancelBubble=true;
        } else {
            e.stopPropagation();
        }
        return false;
    }
    return true;
}
   function launchchat(url) {
var firstCharacter="";

if(url.indexOf('?') == -1) {
firstCharacter = '?';
}
else {
firstCharacter = '&';
}

try
{
window.open(url.concat(firstCharacter,'vip=',vip,'&ftd=',ftd,'&version=',version,'&CID=',CID,'&real=',real,'&currency=',currency,'&username=',username,'&brand=',brand,'&lang=',lang) , 'chatWindow', 'status=0,toolbar=0,menubar=0,location=0,resizable=1,height=600px,width=505px,left=0,top=0');
}
catch(err) // in case it's not been called from client web page
{
  window.open(url , 'chatWindow', 'status=0,toolbar=0,menubar=0,location=0,resizable=1,height=600px,width=505px,left=0,top=0');
}

}
   var http_request = null;

  function sendInternalMail(mail, subject, body, url, responseFunc) {
      http_request = null;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }  

      var parameters = "mail=" + mail + "&subject=" +  subject + "&body=" + body;
                    
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.onreadystatechange = responseFunc;
      http_request.send(parameters);
   }

   function getCode() {
   return document.getElementById("code").value;
}

function resetForm() {
   document.forms[0].reset();
}

function Code2Serial(code) {
        var serials = ['111111','222222','333333'];
        switch (code) {
        case 'a1b1c1':
              return serials[0];
              break;
        case 'a2b2c2':
              return serials[1];
              break;
        case 'a3b3c3':
              return serials[2];
              break;
        }
}
   function NoDownloadPoker(i_location) {
 var location = typeof i_location == 'undefined' ? 0 : parseInt(i_location);
  location = (isNaN(location) || location <= 0 ? '0000' : location.toString());  
  var skin = (typeof rlCountry == 'string' && rlCountry == 'gbr') ? '3' : '4';
  var filename =  "http://safe-iplay.com/poker/application/RLFlashPoker.html?brand=20&skin=4&langid=EN?dl=" + location + '&sr='+rlSerial;
  
  var w = 801;
  var h = 571;
  var l = (window.screen.width-w)/2;
  var t = (window.screen.height-h)/2;
  
  var opened = window.open(filename, "Offline", "resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h +",alwaysRaised=yes");

  //setTimeout(function(){opened.focus();},1000);


  if (!opened && banner != null) {
    banner.openWindow(filename ,"Offline","resizable=no,status=no,scrollbars=no,toolbar=no,menubar=no,left=" + l + ",top=" + t + ",width=" + w + ",height=" + h);
  }   
}

   function ActionExecuter()
{ }

ActionExecuter.prototype =
{
    executeActionAsync: function(handlerName, onsucceeded, onfailed, params) {
        if (handlerName == undefined || handlerName == null) {
            return false;
        }
        if (params == undefined) {
            params = null;
        }

        $.ajax({
            type: "POST",
            url: handlerName,
            data: params,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(res) {
        
                if (onsucceeded != undefined && onsucceeded != null) {
                    onsucceeded(res);
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
             
                if (onfailed != undefined && onfailed != null) {
                    onfailed(XMLHttpRequest, textStatus, errorThrown);
                }
            }
        });
        return true;
    }
}
   var capcheck;
if (typeof jQuery != 'undefined') {

//activate enter for google reacptcha
$(document).ready(function() {
$('#recaptcha_response_field').keypress(function(event) {
    var keycode = (event.keyCode ? event.keyCode : event.which);
    if (keycode == 13) {
        CheckReCaptcha();
    }
})});

function CheckReCaptcha() {
    //Recive Recaptcha Values 
    var challenge = RecaptchaState.challenge;
    var textInserted = Recaptcha.get_response();

    var jsonObj ="{\"Challenge\":\"" + challenge + 
            "\",\"TextInserted\":\"" + textInserted +"\"}";

    

    // call Recaptcha RecaptchExternalAppServiceHandler with json request
    new ActionExecuter().executeActionAsync(
        "/Services/RecaptchExternalAppServiceHandler.ashx",
        prbActionExecuteSucceded,
        prbActionExecuteFailed,
        jsonObj);
}

function prbActionExecuteSucceded(Result) {
    if (Result.ErrorCode == 0) {
        Recaptcha.reload();
        //alert('success');
capcheck = true;
    }
    else if (Result.ErrorCode == 1) {
        Recaptcha.reload();
      //alert('Incorrect');
capcheck = false;
    }
    else {
        Recaptcha.reload();
        //alert('Exception /Comunication Error ');
capcheck = false;
    }
}

function prbActionExecuteFailed(Result) {
    Recaptcha.reload();
    //alert('communication Errors /Failure to reech service');
capcheck = false;
}

}


   function NDL_v2(location, theserial) {
	// B2B NDL v2
	
	try {
		ntptAddPair("dl", location);
		ntptEventTag("ev=nodownload_888poker");
	} catch(err){}
	
	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();
	}

	thesr = (typeof theserial != 'undefined' ) ? "&sr=" + theserial : "";
	var filename = "http://safe-iplay.com/poker/application/RLFlashPoker.html?brand=20&skin=4&langid=EN" + "&dl=" + location + thesr;

	var opened = window.open(filename, null, "height=" + h + ",width=" + w + ",status=no,toolbar=no,menubar=no,location=no,resize=no,left="+l+",top="+t);
   
}

   /* Bonus Page JS */


DLBonus = (typeof DLNumber != 'undefined') ? DLNumber : 7100;

var DLBrand = 'WSOP';
// check for windows os
var isWIN = navigator.userAgent.indexOf("Windows");

if (typeof jQuery != 'undefined') {
	$(document).ready(function() {
	    // submit form
		$('#couponForm').submit(function() {
	        var cval = $('#coupon').val().toLowerCase();			
	        $.ajax({
	            // grab xml file
	            url: 'bonus.xml',
	            dataType: 'text',
	            beforeSend: function() {				
					cval = $.trim(cval); // remove spaces from string
					$('#coupon').val(cval); // set the value to input
	                // we do some validation
	                if (cval == "" || /*spaces */ cval.length >= 50 /*50 chars max*/ || !cval.match(/^[a-zA-Z0-9]+$/)) {
	                    $('#errorBonus').addClass('showerror').animate({marginTop: "-22px"}, 500, function(){$(this).addClass('zin')});						
	                    return false;
	                }
	            },
	            success: function(xml) {
	                // convert XML to JSON (IE!!1)
	                var json = $.xml2json(xml);
	                // j starts from 0 so we subtract 1.
	                for (j = 0, jsc = json.serial.length - 1; j < jsc; j++) {
	                    var cpn = json.serial[j].coupon.toLowerCase();
	                    if (cval == cpn) {
							sernum = json.serial[j].number;
							// check for match value,  Windows OS or not..							
							(isWIN != -1) ? downClient(DLBonus, DLBrand, sernum) : NDl(20, sernum);	
							return false;
	                        // at the end grab default value
	                    } else if ((j + 1) == jsc) {
							sernumdef = json.serial[jsc].defaultSerial;								
							(isWIN != -1) ? downClient(DLBonus, DLBrand, sernumdef) : NDl(20, sernumdef);							
							return false;
	                    }
	                }
	            }
	        });
	        // stop submit
	        return false;
	    });

	    // click fadeout error
	    $('#errorBonusClose').click(function() {
			$('#errorBonus').removeClass('zin');
	        $('#errorBonus').animate({marginTop: 0}, 300, function(){
				$('#errorBonus').removeClass('showerror')
			})
	    });

	    //rollover images
	    $('#playnow').hover(function() {
	        $(this).attr('class', 'playnowbtnhover');
	    }, function() {
	        $(this).attr('class', 'playnowbtn');
	    });
		
		function NDl(br, ser) {
			return location.href = 'http://safe-iplay.com/poker/application/RLFlashPoker.html?brand='+br+'&skin=4&langid=EN&dl='+br+'&sr='+ser;
		}
		
		function downClient(bn,br,ser) {
			var isIE = navigator.userAgent.toLowerCase().indexOf("msie");			
			window.location = "/downloadclient.htm?&dl="+bn+"&DownloadBrand="+br+"&sr="+ser+"&dlp="+location.href;
		}		

	    /*
	    ### jQuery XML to JSON Plugin v1.0 - 2008-07-01 ###
	    * http://www.fyneworks.com/ - diego@fyneworks.com
	    * Dual licensed under the MIT and GPL licenses:
	    *   http://www.opensource.org/licenses/mit-license.php
	    *   http://www.gnu.org/licenses/gpl.html
	    ###
	    Website: http://www.fyneworks.com/jquery/xml-to-json/
	    */
	    eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } (';5(10.M)(w($){$.N({11:w(j,k){5(!j)t{};w B(d,e){5(!d)t y;6 f=\'\',2=y,E=y;6 g=d.x,12=l(d.O||d.P);6 h=d.v||d.F||\'\';5(d.G){5(d.G.7>0){$.Q(d.G,w(n,a){6 b=a.x,u=l(a.O||a.P);6 c=a.v||a.F||\'\';5(b==8){t}z 5(b==3||b==4||!u){5(c.13(/^\\s+$/)){t};f+=c.H(/^\\s+/,\'\').H(/\\s+$/,\'\')}z{2=2||{};5(2[u]){5(!2[u].7)2[u]=p(2[u]);2[u][2[u].7]=B(a,R);2[u].7=2[u].7}z{2[u]=B(a)}}})}};5(d.I){5(d.I.7>0){E={};2=2||{};$.Q(d.I,w(a,b){6 c=l(b.14),C=b.15;E[c]=C;5(2[c]){5(!2[c].7)2[c]=p(2[c]);2[c][2[c].7]=C;2[c].7=2[c].7}z{2[c]=C}})}};5(2){2=$.N((f!=\'\'?A J(f):{}),2||{});f=(2.v)?(D(2.v)==\'16\'?2.v:[2.v||\'\']).17([f]):f;5(f)2.v=f;f=\'\'};6 i=2||f;5(k){5(f)i={};f=i.v||f||\'\';5(f)i.v=f;5(!e)i=p(i)};t i};6 l=w(s){t J(s||\'\').H(/-/g,"18")};6 m=w(s){t(D s=="19")||J((s&&D s=="K")?s:\'\').1a(/^((-)?([0-9]*)((\\.{0,1})([0-9]+))?$)/)};6 p=w(o){5(!o.7)o=[o];o.7=o.7;t o};5(D j==\'K\')j=$.S(j);5(!j.x)t;5(j.x==3||j.x==4)t j.F;6 q=(j.x==9)?j.1b:j;6 r=B(q,R);j=y;q=y;t r},S:w(a){6 b;T{6 c=($.U.V)?A 1c("1d.1e"):A 1f();c.1g=W}X(e){Y A L("Z 1h 1i 1j 1k 1l")};T{5($.U.V)b=(c.1m(a))?c:W;z b=c.1n(a,"v/1o")}X(e){Y A L("L 1p Z K")};t b}})})(M);', 62, 88, '||obj|||if|var|length||||||||||||||||||||||return|cnn|text|function|nodeType|null|else|new|parseXML|atv|typeof|att|nodeValue|childNodes|replace|attributes|String|string|Error|jQuery|extend|localName|nodeName|each|true|text2xml|try|browser|msie|false|catch|throw|XML|window|xml2json|nn|match|name|value|object|concat|_|number|test|documentElement|ActiveXObject|Microsoft|XMLDOM|DOMParser|async|Parser|could|not|be|instantiated|loadXML|parseFromString|xml|parsing'.split('|'), 0, {}))

	});
}
   function ChangeBGImage(button,imageSource)
{    
    if (button.attributes["readonly"] != null && 
        button.attributes["readonly"].value == "readonly" &&
        (imageSource == "image" || imageSource == "overImage" ))
    {
        return;
    }
    else
    {
        button.style.backgroundImage = button.attributes[imageSource].value;
    }
}
function SetEnabled(buttonJqueryID)
{
    $(buttonJqueryID).removeAttr('disabled');
    $(buttonJqueryID).removeAttr('readonly');
    var button = $(buttonJqueryID)[0];     
    button.style.backgroundImage = button.attributes["image"].value;
}
   //New section

function UnsubscribeUserEmailByCID(button, disableImageSource, overImageSource, regularImage) {

    showDisableButton(button, disableImageSource);
    var otherUnsubscriptionReasonRadioButtonText = null;
    var otherUnsubscriptionReasonRadioButtonID = null;
    //var otherUnsubscriptionReasonRadioButtonID = $("input[name='ctl00$content$ctl00$UserCustomiseUnsubscribeReasons']:checked").val();
    var otherUnsubscriptionReasonRadioButtonID = $("input[name$='UserCustomiseUnsubscribeReasons']:checked").val();
    if (otherUnsubscriptionReasonRadioButtonID != null) {
        if (strStartsWith(otherUnsubscriptionReasonRadioButtonID, "Other_rbID")) {
            //otherUnsubscriptionReasonRadioButtonText = $("#ctl00_content_ctl00_tbOtherText").val();
            otherUnsubscriptionReasonRadioButtonText = $('[id$="tbOtherText"]').val();
        }
        else {
            //otherUnsubscriptionReasonRadioButtonText = $("label[for='ctl00_content_ctl00_" + otherUnsubscriptionReasonRadioButtonID + "'" + "]").text();
            otherUnsubscriptionReasonRadioButtonText = $("label[for$='" + otherUnsubscriptionReasonRadioButtonID + "'" + "]").text();
        }
    }
    new SubscriptionEmailProvider().Unsubscribe($("input[@name='UnsubscribeGroup']:checked").val(), otherUnsubscriptionReasonRadioButtonID, otherUnsubscriptionReasonRadioButtonText, UnsubscribeSucceeded, UnsubscribeFailed, button, overImageSource, regularImage);
}
//Start with
function strStartsWith(str, prefix) { return str.indexOf(prefix) === 0; }

function showDisableButton(button, imageSource) {

    if (button.attributes[imageSource] != undefined) {
        button.style.backgroundImage = button.attributes[imageSource].value;
        button.onmouseover = null;
        button.onmouseout = null;
    }
}


function UnsubscribeSucceeded(res, button, overImageSource, regularImage) {
    switch (res) {
        case "Error":
            UnsubscribeFailed(button, overImageSource, regularImage);
            break;
        default:
            window.location = res;
    }
}

function UnsubscribeFailed(button, overImageSource, regularImage) {
    $('#divErrorMessage').show();
    $('#divErrorMessage').css('visibility', "visible");
    button.onmouseover = function() { ChangeBGImage(button, overImageSource); };
    button.onmouseout = function() { ChangeBGImage(button, regularImage); };
    button.style.backgroundImage = button.attributes[regularImage].value;
}

function ShowUnsubscribeReasonsIfNeeded(IsTellUsWhyBoxNeeded) {
    if (IsTellUsWhyBoxNeeded == "YES") {
        $('#divTellUsWhy').show();
        $('#divTellUsWhy').css('visibility', "visible");
    }
    else {
        $('#divTellUsWhy').hide();
        $('#divTellUsWhy').css('visibility', "hidden");
    }

}


// MembershipProvider class
function SubscriptionEmailProvider()
{ }


SubscriptionEmailProvider.prototype =
{
    Unsubscribe: function(CheckedUnsubscribeGroup, otherUnsubscriptionReasonRadioButtonID, otherUnsubscriptionReasonRadioButtonText, onsucceeded, onfailed, button, overImageSource, regularImage) {
        $.ajax({
            type: "POST",
            url: this._getRequestedPageName(),
            data: this._createUnsubscribePostData(CheckedUnsubscribeGroup, otherUnsubscriptionReasonRadioButtonID, otherUnsubscriptionReasonRadioButtonText),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(res) {
                if (onsucceeded !== undefined && onsucceeded != null) {
                    //button.style.backgroundImage = button.attributes[disableButton].value;
                    onsucceeded(res, button, overImageSource, regularImage);
                }
            },
            error: function(xhr, ajaxOptions, thrownError) {
                if (onfailed !== undefined && onfailed != null) {
                    onfailed(button, overImageSource, regularImage);
                }
            }
        });
    },
    _getRequestedPageName: function() {
        var res = null;
        try {
            res = window.location.pathname.slice(window.location.pathname.lastIndexOf("/") + 1);		
        }
        catch (e) {
            res = "";
            // TODO: Write log (Error: error occured during getting requested page name.)
        }
        return res;
    },
    _createUnsubscribePostData: function(CheckedUnsubscribeGroup, otherUnsubscriptionReasonRadioButtonID, otherUnsubscriptionReasonRadioButtonText) {
        return "{\"CheckedUnsubscribeGroup\": \"" + CheckedUnsubscribeGroup + "\" ,\"otherUnsubscribeGroupID\": \"" + otherUnsubscriptionReasonRadioButtonID + "\" ,\"otherUnsubscribeGroupText\": \"" + otherUnsubscriptionReasonRadioButtonText + "\" }";
        // return "{\"CheckedUnsubscribeGroup\": \"" + CheckedUnsubscribeGroup + "\" }";
    }

}


//enable - disable other text box 
function onRadioChange() {
    if ($('[OtherRadioButton="OtherRadioButton"]').is(":checked"))
    //Enable TextBox
        $('[id$="tbOtherText"]').removeAttr("disabled");
    else
    //Desable TextBox
        $('[id$="tbOtherText"]').attr("disabled", "disabled");
}
   /* Bind NDL  Fn to non-Windows users */
var isWin = navigator.userAgent.toLowerCase().indexOf("windows");
if (typeof jQuery != 'undefined' && isWin == -1) {
	var $j = jQuery;
	$j(document).ready(function(){
		onc = $j('a[onclick], area[onclick], a[href*="javascript"]');
		on=[];
		for (o=0, oc=onc.size(); o<oc; o++) {
			ovof = (typeof onc[o].onclick != 'undefined') ? onc[o].onclick.toString().indexOf('OpenAndDownload') : onc[o].href.indexOf('OpenAndDownload');
			if (ovof != -1) {
				on[o] = (typeof onc[o].onclick != 'undefined') ? onc[o].onclick.toString().replace(/\D/g,'') : onc[o].href.replace(/\D/g,'');
				onc[o].onclick = (function (x) {
					return function() {
						NoDownloadPoker(on[x]);						
						return false;
					};
				})(o);
			}
		}
		try {
			hpf = $j('.HomePageFlash');
			hpfp = hpf.offset();
			$j('#Container').append('<div id="hpfn"></div>');		
			$j('#hpfn').css({'width': hpf.width(), 'height': hpf.height(), 'position': 'absolute', 'top': hpfp.top, 'top': hpfp.left, 'cursor': 'pointer'})
				.click(function(){		
					NoDownloadPoker(6804);
					return false;
			});
		} catch(err){}
	});
}
   // poker tips toggle plus-minus
try {
	$(document).ready(function(){
		$('.pp_click_answer').find('a').click(function(){
			pm = $(this).find('.plusmin');
			pmnext = $(this).parent().next();
			if(pmnext.is(':visible')) { pmnext.hide() } else { pmnext.show() }
			phtml = (pm.html() == '+') ? '-' : '+';
			pm.html(phtml);
		});
	});
} catch(e){}
