

// Removed from login.js



    var LoginListeners={};var LogoutListeners={};var UpdateBalanceListeners={};function isLoggedIn(){return(userInfo!=null);}function registerUpdateBalanceHandler(handler){UpdateBalanceListeners[handler]=handler;}function registerLoginHandler(handler){LoginListeners[handler]=handler;}function registerLogoutHandler(handler){LogoutListeners[handler]=handler;
}function unregisterLoginHandler(handler){LoginListeners[handler]=null;}function unregisterLogoutHandler(handler){LogoutListeners[handler]=null;}function fireListeners(listeners,arg){for(var listener in listeners){if(listeners[listener]!=null){listeners[listener](arg);}}}function waitingStart(formId,cssClass){if(($(formId)!=null)&&($(formId).startWaiting)){$(formId).startWaiting(cssClass);
}}function waitingStop(formId){if(($(formId)!=null)&&($(formId).stopWaiting)){$(formId).stopWaiting();}}var loginFormId="login_form";var loginBlock={casUrl:null,init:function(casUrl){this.casUrl=casUrl;if(arguments[1]!=undefined){this.autoLoginUrl=arguments[1];}},customLogin:function(username,userpassword){if(username==undefined||username==""||userpassword==""||userpassword==undefined){alert(specifyUsernameErrorText);
return ;}var params="username="+username+"&password="+userpassword+"&successHandler=loginBlock.onSuccess&errorHandler=loginBlock.onError";var script=document.createElement("script");script.type="text/javascript";script.src=loginBlock.casUrl+"?"+params+"&uselessparam="+(new Date()).getTime();document.body.appendChild(script);
},login:function(){closeError();waitingStart(loginFormId,"loginWaiting");var username=document.getElementById("user").value;var userpassword=document.getElementById("password").value;if(username==undefined||username==""||userpassword==""||userpassword==undefined){waitingStop(loginFormId);showError(specifyUsernameErrorText);
return ;}var params="username="+username+"&password="+userpassword+"&successHandler=loginBlock.onSuccess&errorHandler=loginBlock.onError";var script=document.createElement("script");script.type="text/javascript";script.src=loginBlock.casUrl+"?"+params+"&uselessparam="+(new Date()).getTime();document.body.appendChild(script);
},onError:function(result){waitingStop(loginFormId);showError(result);userInfo=null;},onSuccess:function(result){waitingStop(loginFormId);userInfo=result;PlayTechId=result.MansionUser.playtechid;fireListeners(LoginListeners,result);}};var logoutBlock={casUrl:null,init:function(casUrl){this.casUrl=casUrl;
},onError:function(result){waitingStop(loginFormId);showError(result);},onSuccess:function(result){waitingStop(loginFormId);userInfo=null;fireListeners(LogoutListeners);},logout:function(){waitingStart(loginFormId,"loginWaiting");var script=document.createElement("script");script.type="text/javascript";
script.src=logoutBlock.casUrl+"?"+"&uselessparam="+(new Date()).getTime();document.body.appendChild(script);}};var updateBalanceBlock={updateBalanceId:null,casUrl:null,timeout:60000,init:function(casUrl){this.casUrl=casUrl;registerLogoutHandler(this.destroy);registerLoginHandler(this.start);if(userInfo!=null){this.start();
}},start:function(){if((updateBalanceBlock.updateBalanceId==null)||(updateBalanceBlock.updateBalanceId==undefined)){updateBalanceBlock.updateBalanceId=setInterval("updateBalanceBlock.updateBalance()",updateBalanceBlock.timeout);}},destroy:function(){clearInterval(updateBalanceBlock.updateBalanceId);},onComplete:function(result){fireListeners(UpdateBalanceListeners,result);
setBalanceData(result.MansionUser.balance,result.MansionUser.accountCurrency,result.MansionUser.nickname);},updateBalance:function(){try{var params="action=updateBalance&completeHandler=updateBalanceBlock.onComplete";var script=document.createElement("script");script.type="text/javascript";script.src=updateBalanceBlock.casUrl+"?"+params+"&uselessparam="+(new Date()).getTime();
document.body.appendChild(script);}catch(e){}}};function setBalanceData(balance,currency,user){var usernameEl=document.getElementById("username");if(usernameEl!=undefined){usernameEl.innerHTML=user;}}function showBalance(){document.getElementById("logged_in").style.display="none";document.getElementById("login_btns_panel").style.display="none";
document.getElementById("login_btns_panel_out").style.display="block";document.getElementById("logged_out").style.display="block";}function showError(message){document.getElementById("spanMsg").innerHTML=message;var leftPos=780/2-($("wrong_popup").getWidth())/2;document.getElementById("wrong_popup").style.left=leftPos+"px";
document.getElementById("wrong_popup").style.display="block";}function closeError(){document.getElementById("wrong_popup").style.display="none";}function resetFields(){if($("user")){$("user").value="Sign In";}if($("password")){$("password").value="password";}}function setDefaultValues(){if($("user").value==""){$("user").value="Sign In";
}else{return ;}if($("password").value==""){$("password").value="password";}}function sendOnReturn(ev){var e=ev||window.event;if(e.keyCode==13){loginBlock.login();}}Event.observe(window,"load",function(){if($("user")!=null){$("user").onkeypress=sendOnReturn;$("password").onkeypress=sendOnReturn;}});

// end Removed from login.js

//to correct PNG files in IE
function fixPNG(element, method)
{
    if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
    {
        var src;
        if (element.tagName.toUpperCase() == 'IMG')
        {
            if (/\.png$/.test(element.src))
            {
                var oldH = element.height;
                var oldW = element.width;
                src = element.src;
                element.src = "/images/pixel.gif";
                element.height = oldH;
                element.width = oldW;
            }
            element.runtimeStyle.cssText = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod=" + method + ")";
        }
        else
        {
            src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
            if (src)
            {
                src = src[1];
                element.runtimeStyle.background = "none";
            }
            if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod=" + method + ")";
        }
    }
}
// to correct left menu in IE
navHover = function() {
    var menu = null;
    try {
        menu = document.getElementById("navmenu-v");
    } catch (e) {
    }
    if (menu == null) {
        return;
    }
    var lis = menu.getElementsByTagName("LI");
    for (var i = 0; i < lis.length; i++) {
        lis[i].onmouseover = function() {
            this.className += " iehover";
        }
        lis[i].onmouseout = function() {
            this.className = this.className.replace(new RegExp(" iehover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navHover);

// Popup windows for homepages.
function popup(url) {
    newwindow = window.open(url, '', 'menubar=yes, toolbar=yes, location=yes, scrollbars=yes, resizable=yes, status=yes');
    if (window.focus) {
        newwindow.focus()
    }
    return false;
}
// to hide error in login block
function hideError(elementId) {
    $(elementId).style.display = "none";
}
//functions to correct horizontal menus in IE
navmansionHover = function() {
    var mansion_menu = document.getElementById("mansionmenu-v");
    if (mansion_menu != null) {
        var lis = document.getElementById("mansionmenu-v").getElementsByTagName("LI");
        if (lis != null) {
            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navmansionHover);
navmansionbottomHover = function() {
    var mansion_menu = document.getElementById("mansionmenu-bottom-v");
    if (mansion_menu != null) {
        var lis = document.getElementById("mansionmenu-bottom-v").getElementsByTagName("LI");
        if (lis != null) {
            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navmansionbottomHover);
navpokerHover = function() {
    var poker_menu = document.getElementById("pokermenu-v");
    if (poker_menu != null) {
        var lis = poker_menu.getElementsByTagName("LI");
        if (lis != null) {

            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }

            }
            if (lis[0].className != 'first-activ' && lis[0].className != 'last-activ' && lis[0].className != 'activ') {
                lis[0].onmouseover = function() {
                    this.className = "firstIehover";
                }
                lis[0].onmouseout = function() {
                    this.className = this.className.replace(new RegExp("Iehover\\b"), "");
                }
            }
            if (lis[lis.length - 1].className != 'first-activ' && lis[lis.length - 1].className != 'last-activ' && lis[lis.length - 1].className != 'activ') {
                lis[lis.length - 1].onmouseover = function() {
                    this.className = "lastIehover";
                }
                lis[lis.length - 1].onmouseout = function() {
                    this.className = this.className.replace(new RegExp("Iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navpokerHover);

navpokerbottomHover = function() {
    var poker_menu = document.getElementById("pokermenu-bottom-v");
    if (poker_menu != null) {
        var lis = document.getElementById("pokermenu-bottom-v").getElementsByTagName("LI");
        if (lis != null) {
            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navpokerbottomHover);
navcasinoHover = function() {
    var casino_menu = document.getElementById("casinomenu-v");
    if (casino_menu != null) {
        var lis = casino_menu.getElementsByTagName("LI");
        if (lis != null) {
            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }
            }
            if (lis[0].className != 'first-activ' && lis[0].className != 'last-activ' && lis[0].className != 'activ') {
                lis[0].onmouseover = function() {
                    this.className = "firstIehover";
                }
                lis[0].onmouseout = function() {
                    this.className = this.className.replace(new RegExp("Iehover\\b"), "");
                }
            }
            if (lis[lis.length - 1].className != 'first-activ' && lis[lis.length - 1].className != 'last-activ' && lis[lis.length - 1].className != 'activ') {
                lis[lis.length - 1].onmouseover = function() {
                    this.className = "lastIehover";
                }
                lis[lis.length - 1].onmouseout = function() {
                    this.className = this.className.replace(new RegExp("Iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navcasinoHover);
navcasinobottomHover = function() {
    var casino_menu = document.getElementById("casinomenu-bottom-v");
    if (casino_menu != null) {
        var lis = casino_menu.getElementsByTagName("LI");
        if (lis != null) {
            for (var i = 0; i < lis.length; i++) {
                if (lis[i].className == "first-activ" || lis[i].className == "last-activ" || lis[i].className == "activ") {
                    continue;
                }
                lis[i].onmouseover = function() {
                    this.className += " iehover";
                }
                lis[i].onmouseout = function() {
                    this.className = this.className.replace(new RegExp(" iehover\\b"), "");
                }
            }
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", navcasinobottomHover);
//end
// functions for casino instance page.
function preLoad() {
    if (document.images) {
        var argLen = arguments.length;
        for (var i = 0; i < argLen; i++) {
            var arg = arguments[i];
            self[arg] = new Image();
            self[arg].src = arg;
        }
    }
}

function ch_img(obj, img) {
    if (self[img]) {
        obj.src = self[img].src;
    }
}
function openPrintablePage(url) {
    newWindow = window.open(url, '_blank', 'resizable=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,fullscreen=no,dependent=no,width=629,height=390,status');
    newWindow.focus();
    return false;
}
//To fix left flash banner in IE.
Event.observe(window, 'load', function() {
    if ($('left_flash_banner') != null) {
        $('left_flash_banner').outerHTML = $('left_flash_banner').outerHTML;
    }
});
//Removed from page_head.jsp
function fixIE()
{
    var els = document.body.all;
    if (!els) {
        return;
    }
    for (i = 0; i < els.length; i++)
    {
        if (els[i].className != null)
        {
            if (els[i].className.indexOf("iePNGScale") >= 0)
            {
                fixPNG(els[i], 'scale');
            }
            if (els[i].className.indexOf("iePNG") >= 0)
            {
                fixPNG(els[i], 'crop');
            }
        }
    }
}
function getCurrentStyle(elem, prop)
{
    if (elem.currentStyle)
    {
        var ar = prop.match(/\w[^-]*/g);
        var s = ar[0];
        for (var i = 1; i < ar.length; ++i)
        {
            s += ar[i].replace(/\w/, ar[i].charAt(0).toUpperCase());
        }

        return elem.currentStyle[s]
    }
    else if (document.defaultView.getComputedStyle)
    {
        return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);
    }
}
function isPositionedRelatively(obj) {
    return getCurrentStyle(obj, "position") == "relative";
}

function addLeadingZero(value) {
    if (value < 10) {
        return '0' + value;
    } else {
        return value;
    }
}
function getAMPM(value) {
    return (value > 12) ? "PM" : "AM";
}
function cutHoursToAMPM(value) {
    return value % 12;
}

function updateDateSpan() {
    var dateSpan = $('date_container_span');
    if (dateSpan) {
        var date = new Date();

        dateSpan.innerHTML = Days[date.getUTCDay()] + ", " +
                             Months[date.getUTCMonth()] + " " +
                             addLeadingZero(date.getUTCDate()) + ", " +
                             addLeadingZero(date.getUTCFullYear()) + " - " +
                             cutHoursToAMPM(date.getUTCHours()) + ":" +
                             addLeadingZero(date.getUTCMinutes()) + " " + getAMPM(date.getUTCHours()) + " GMT";
    }
    setTimeout("updateDateSpan();", 1000);
}

function setOverflow(mode) {
    var menudivs = document.getElementsByClassName('horizontal_menu_bg');
    for (var i = 0; i < menudivs.length; i++) {
        menudivs[i].setAttribute('style', 'overflow:' + mode);
    }
}

//end Removed from page_head.jsp
// Removed from popup.js
var isIE = document.all;
var isNN = !document.all && document.getElementById;
var isN4 = document.layers;
var isHot = false;
var ddEnabled = false;
var nowX = 0;
var nowY = 0;

function showExitPage(msg, url)
{
    if (confirm(msg)) {
        popup(url);
    }
}
function popup(url) {
    newwindow = window.open(url, '', 'menubar=yes, toolbar=yes, location=yes, scrollbars=yes, resizable=yes, status=yes');
    return false;
}
function ddInit(e) {
    topDog = isIE ? "BODY" : "HTML";
    whichDog = document.getElementById("theLayer");
    hotDog = isIE ? event.srcElement : e.target;

    if (hotDog) {
        while (hotDog && hotDog.id != "titleBar" && hotDog.tagName != topDog) {
            hotDog = hotDog.parentNode;
        }
        if (hotDog == null) {
            return;
        }
        if (hotDog.id == "titleBar") {
            offsetx = isIE ? event.clientX : e.clientX;
            offsety = isIE ? event.clientY : e.clientY;
            nowX = parseInt(whichDog.style.left);
            nowY = parseInt(whichDog.style.top);
            ddEnabled = true;
            document.onmousemove = dd;
        }
    }
}

function dd(e){
    if (!ddEnabled) {
        return;
    }

    var left = (isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx);
    var top = (isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety);

    if (left > (document.body.clientWidth  - 315)) {
        left = document.body.clientWidth  - 315;
    }

    if (top > (document.body.clientHeight - 120)) {
        top = document.body.clientHeight - 120;
    }

    whichDog.style.left = left + "px";
    whichDog.style.top = top + "px";

    return false;
}
function ddN4(whatDog) {
    if (!isN4) return;
    N4 = eval(whatDog);
    N4.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
    N4.onmousedown = function(e) {
        N4.captureEvents(Event.MOUSEMOVE);
        N4x = e.x;
        N4y = e.y;
    }
    N4.onmousemove = function(e) {
        if (isHot) {
            N4.moveBy(e.x - N4x, e.y - N4y);
            return false;
        }
    }
    N4.onmouseup = function() {
        N4.releaseEvents(Event.MOUSEMOVE);
    }
}

function hideMe() {
    if (isIE || isNN) whichDog.style.visibility = "hidden";
    else if (isN4) document.theLayer.visibility = "hide";
}

function showMe() {
    if (isIE || isNN) whichDog.style.visibility = "visible";
    else if (isN4) document.theLayer.visibility = "show";
}

document.onmousedown = ddInit;
document.onmouseup = Function("ddEnabled=false");

function showPopupDelayed()
{
    var b = document.getElementById("theLayer");
    var left = (document.body.clientWidth - 315) / 2;
    var top = (document.body.clientHeight - 120) / 2;
    b.style.left = left;
    b.style.top = top;
    b.style.visibility = "visible";
}
// end Removed from popup js
// removed from protoload.js
Protoload = {
	timeUntilShow: 250,
	opacity: 0.8,
	startWaiting: function(element, className, timeUntilShow) {
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (className == undefined)
			className = 'waiting';
		if (timeUntilShow == undefined)
			timeUntilShow = Protoload.timeUntilShow;
		element._waiting = true;
		if (!element._loading) {
			var e = document.createElement('div');
			(element.offsetParent || document.body).appendChild(element._loading = e);
			e.style.position = 'absolute';
			try {e.style.opacity = Protoload.opacity;} catch(e) {}
			try {e.style.MozOpacity = Protoload.opacity;} catch(e) {}
			try {e.style.filter = 'alpha(opacity='+Math.round(Protoload.opacity * 100)+')';} catch(e) {}
			try {e.style.KhtmlOpacity = Protoload.opacity;} catch(e) {}
		}
		element._loading.className = className;
		window.setTimeout((function() {
			if (this._waiting) {
				var left = this.offsetLeft,
					top = this.offsetTop,
					width = this.offsetWidth,
					height = this.offsetHeight,
					l = this._loading;
				l.style.left = left+'px';
				l.style.top = top+'px';
				l.style.width = width+'px';
				l.style.height = height+'px';
				l.style.display = 'inline';
			}
		}).bind(element), timeUntilShow);
	},
	stopWaiting: function(element) {
		if (element._waiting) {
			element._waiting = false;
			element._loading.parentNode.removeChild(element._loading);
			element._loading = null;
		}
	}
};

if (Prototype) {
	Element.addMethods(Protoload);
	Object.extend(Element, Protoload);
}
// end removed from protoload.js
// Removed from section jsp templates
function launchPopup(url)
{
    var popupWin = window.open(url, 'popup', 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=614,height=500,top=30,left=50');
    popupWin.focus(true);
}
function launchChat(url)
{
    var chatWin = window.open(url, 'chatWindow', 'width=400,height=404,resizable=0,scrollbars=no,menubar=no,status=no');
    chatWin.focus(true);
}
var blockedDivLogoutHandler = function() {
    var blockedDiv = $('us_member_container');
    if (blockedDiv != null) {
        blockedDiv.style.display = "none";
    }
}
registerLogoutHandler(blockedDivLogoutHandler);
var blockedDivLoginHandler = function() {
    var blockedDiv = $('us_member_container');

    if (blockedDiv != null && userInfo != null && userInfo.MansionUser.isBlocked) {
        blockedDiv.style.display = "block";
    }
}
registerLoginHandler(blockedDivLoginHandler);
// end Removed from section jsp templates

// Removed from popup templates
function startPokerDownload()
{
    // redirect to the download page (changed on 1/4/08 by Shay Sharon)
    pokerDownloadpage(); 
    return;
    
    location.href = "http://www.pokernetwork.co.uk/games/267/T7PW/NetInstallMansionPoker.exe";
    if (document.readyState && document.readyState == 'loading')
    {
        setTimeout('pokerDownloadpage()', 200);
        return false;
    }
}



function pokerDownloadpage()
{
    var url = "http://www.mansionpoker.com/download/?q=skip";
    if (document.readyState == 'loading')
    {
        setTimeout('pokerDownloadpage()', 200);
    }
    else
    {
        if (url != undefined)
            location.href = url;
    }
}

function casinoDownloadpage()
{
    var url = "http://www.mansioncasino.com/download/?q=skip";
    if (document.readyState == 'loading')
    {
        setTimeout('casinoDownloadpage()', 200);
    }
    else
    {
        if (url != undefined)
            location.href = url;
    }
}

function startCasinoDownload()
{
    // redirect to the download page (changed on 1/4/08 by Shay Sharon)
    casinoDownloadpage();
    return;
    
    location.href = "http://banner.mansion.com/cgi-bin/SetupCasino.exe";
    if (document.readyState && document.readyState == 'loading')
    {
        setTimeout('casinoDownloadpage()', 200);
        return false;
    }
}

function close() {
}
// end Removed from popup templates