function openFlashPoker(btag) {
    var poker_link = 'https://mppv2flash3.valueactive.eu/pokertime/poker.aspx?ln=EN&btag='+btag;

    openFlashPokerPopup('poker_lobby', poker_link, 790, 571);
}
function openFlashPokerPopup(name, url, width, height) {
    var new_win = window.open(url, name, 'width=' + width + ',height=' + height + ',directories=no,toolbar=no,resizable=no,location=no,menubar=no,status=no,scrollbars=no');
}

function bonuspopup() {
    window.open("/bonuspop", "Bonus", "width=550,height=550,resizable=no");
}

function popchat() {
    window.open("http://chat.casinodesk.com/instanton/servicesuite/livehelp/chatframe.on?clientid=2&deptid=6");
}
function openSupportPopup(mailtype) {
    window.open("/ContactForm/?MailType=" + mailtype, "Email_RoyalVegasPoker", "width=300,height=400,directories=no,toolbar=no,resizable=yes,location=no,menubar=no,status=no,scrollbars=no");
    return false;
}

function Table() {
    var h = screen.height;
    var n = (h - 600);
    window.open("/7Ktable", "table", "width=800,height=530,left=300,top=" + n + ", scrollbars=yes");
}

function rakedHands() {
    window.open("RakedHands.asp?BTag=" + btag + "&alias=" + alias + "&account=" + account + "", "rakedHands", "width=350,height=300, scrollbars=no, resizable=no");
}

function selfassess() {
    window.open("/selfassessment", "SelfAssess", "width=500,height=550, scrollbars=yes, resizable=no");
}

//LeaderBoard Script

var strMessage2 = "PLEASE CORRECT YOUR:";
function checkformLeader() {
    //Check for Poker Alias
    if (eval(document.frmlogin.elements[0].value == "")) {
        strMessage2 = strMessage2 + "\nPoker Alias. (Empty)";
    }

    //Check for Account Number
    if (eval(document.frmlogin.elements[1].value == "")) {
        strMessage2 = strMessage2 + "\nPoker Account Number. (Empty)";
    }
    else {
        Accountlen = document.frmlogin.elements[1].value;
        if (Accountlen.length < 11) {
            strMessage2 = strMessage2 + "\nPoker Account Number. (Invalid)";
        }
        else {
            var accountnumber;
            accountnumber = Accountlen.substring(0, 3);
            if ((accountnumber != "rvr") && (accountnumber != "prv") && (accountnumber != "frv") && (accountnumber != "pnr")) {
                strMessage2 = strMessage2 + "\nIncorrect account number";
            }
        }
    }

    if (eval(strMessage2 == "PLEASE CORRECT YOUR:")) {
        document.frmlogin.submit();
        return _hbDownload("LeaderBoard+Submit"); // HBX
    }
    else {
        alert(strMessage2);
        strMessage2 = "PLEASE CORRECT YOUR:"
    }
}

function checkformLeader2() {
    //Check for Poker Alias
    if (eval(document.frmleftlogin.elements[0].value == "")) {
        strMessage2 = strMessage2 + "\nPoker Alias. (Empty)";
    }
    //Check for Account Number
    if (eval(document.frmleftlogin.elements[1].value == "")) {
        strMessage2 = strMessage2 + "\nPoker Account Number. (Empty)";
    }
    else {
        Accountlen = document.frmleftlogin.elements[1].value;
        if (Accountlen.length < 11) {
            strMessage2 = strMessage2 + "\nPoker Account Number. (Invalid)";
        }
        else {
            var accountnumber;
            accountnumber = Accountlen.substring(0, 3);
            if ((accountnumber != "rvr") && (accountnumber != "prv") && (accountnumber != "frv") && (accountnumber != "pnr")) {
                strMessage2 = strMessage2 + "\nIncorrect account number";
            }
        }
    }

    if (eval(strMessage2 == "PLEASE CORRECT YOUR:")) {
        document.frmleftlogin.submit();
        return _hbDownload("LeaderBoard+Submit"); // HBX
    }
    else {
        alert(strMessage2);
        strMessage2 = "PLEASE CORRECT YOUR:"
    }
}

var strMessage2 = "PLEASE CORRECT YOUR:";
function checkformThanks() {
    //Check for Poker Alias
    if (eval(document.frmThanks.txtalias.value == "")) {
        strMessage2 = strMessage2 + "\nPoker Alias. (Empty)";
    }

    //Check for Account Number
    if (eval(document.frmThanks.txtaccount.value == "")) {
        strMessage2 = strMessage2 + "\nPoker Account Number. (Empty)";
    }
    else {
        Accountlen = document.frmThanks.txtaccount.value;
        if (Accountlen.length < 11) {
            strMessage2 = strMessage2 + "\nPoker Account Number. (Invalid)";
        }
    }

    if (eval(strMessage2 == "PLEASE CORRECT YOUR:")) {
        document.frmThanks.submit();
        return _hbDownload("Thanksgiving+Registration+Submit"); // HBX
    }
    else {
        alert(strMessage2);
        strMessage2 = "PLEASE CORRECT YOUR:"
    }
}

//CD Request Form
var strMessage = "Please Correct your:";
var HaveSetFocus = 0;
//Function to validate email
//**************************
function ValidateEmail(emailad) {
    var exclude = /[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
    var check = /@[\w\-]+\./;
    var checkend = /\.[a-zA-Z]{2,8}$/;

    if (((emailad.search(exclude) != -1) || (emailad.search(check)) == -1) || (emailad.search(checkend) == -1)) {
        strMessage = strMessage + "\nEmail address (Invalid Format)";
    }
}

//Function to validate email for the test
//***************************************
function Validate() {
    //alert("asdasd");
    HaveSetFocus = 0;
    //FIRSTNAME
    if (eval(document.forms("cdrequest").item("firstname").value == "")) {
        strMessage = strMessage + "\nFirstName (Empty)";
        if (HaveSetFocus == 0) {
            document.cdrequest.firstname.focus();
            HaveSetFocus = 1;
        }
    }

    //SURNAME
    //*******
    if (eval(document.forms("cdrequest").item("lastname").value == "")) {
        strMessage = strMessage + "\nLastname (Empty)";
        if (HaveSetFocus == 0) {
            document.cdrequest.lastname.focus();
            HaveSetFocus = 1;
        }
    }


    //TOWN/CITY
    //*******
    if (eval(document.forms("cdrequest").item("towncity").value == "")) {
        strMessage = strMessage + "\nTown/City (Empty)";
        if (HaveSetFocus == 0) {
            document.cdrequest.towncity.focus();
            HaveSetFocus = 1;
        }
    }


    //adress
    //*******
    if (eval(document.forms("cdrequest").item("address1").value == "")) {
        strMessage = strMessage + "\nAddress (Empty)";
        if (HaveSetFocus == 0) {
            document.cdrequest.address1.focus();
            HaveSetFocus = 1;
        }
    }

    //ZIP
    //*******
    if (eval(document.forms("cdrequest").item("postzip").value == "")) {
        strMessage = strMessage + "\nPOST / ZIP Code (Empty)";
        if (HaveSetFocus == 0) {
            document.cdrequest.postzip.focus();
            HaveSetFocus = 1;
        }
    }


    //EMAIL ADRRESS
    //*************


    if (eval(document.forms("cdrequest").item("email").value == "")) {
        strMessage = strMessage + "\nEmail address (Empty)";
    }
    else {
        var Emailadd = document.forms("cdrequest").item("email").value;
        ValidateEmail(Emailadd);
    }



    //SUBMIT IF ALL FIELDS ARE CORRECT
    //********************************
    if (eval(strMessage == "Please Correct your:")) {
        cdrequest.submit();
        return _hbDownload("CD+Request+Submit"); //HBX
    }
    else {
        alert(strMessage);

        strMessage = "Please Correct your:"
    }



}


//Subscribe Form

var strMessage = "PLEASE CORRECT YOUR:";

function validateem(emailad) {

    var exclude = /[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
    var check = /@[\w\-]+\./;
    var checkend = /\.[a-zA-Z]{2,8}$/;

    if (((emailad.search(exclude) != -1) || (emailad.search(check)) == -1) || (emailad.search(checkend) == -1)) {
        strMessage = strMessage + "\nEmail (Invalid Format)";
        //alert (strMessage);
    }
    else {
        return true;
    }

}

function checkform3() {

    //Email
    if (eval(document.forms[0].elements[3].value == "")) {
        strMessage = strMessage + "\nEmail (Empty)";
    }
    else {
        //Check if email is valid
        var Emailad = document.forms[0].elements[3].value;
        validateem(Emailad);
    }

    //Check for recieve
    if (eval(document.forms[0].elements[0].checked == "")) {
        if (eval(document.forms[0].elements[1].checked == "")) {
            if (eval(document.forms[0].elements[2].checked == "")) {
                strMessage = strMessage + "\nPlease select an Email option";
            }
        }
    }

    //Display the message if there are any errors
    if (eval(strMessage == "PLEASE CORRECT YOUR:")) {
        document.forms[0].submit();
        return _hbDownload("Subscribe+Submit"); //HBX
    }
    else {
        alert(strMessage);

        strMessage = "PLEASE CORRECT YOUR:"
    }

}

function checkform2() {

    //Email
    if (eval(document.forms[1].elements[3].value == "")) {
        strMessage = strMessage + "\nEmail (Empty)";
    }
    else {
        //Check if email is valid
        var Emailad = document.forms[1].elements[3].value;
        validateem(Emailad);
    }

    //Check for recieve
    if (eval(document.forms[1].elements[0].checked == "")) {
        if (eval(document.forms[1].elements[1].checked == "")) {
            if (eval(document.forms[1].elements[2].checked == "")) {
                strMessage = strMessage + "\nPlease select an Email option";
            }
        }
    }

    //Display the message if there are any errors
    if (eval(strMessage == "PLEASE CORRECT YOUR:")) {
        document.forms[1].submit();
        return _hbDownload("Subscribe+Submit"); //HBX
    }
    else {
        alert(strMessage);

        strMessage = "PLEASE CORRECT YOUR:"
    }

}

//Unsubscribe Form
var strMessage = "Please Correct your:";

function newValidateEmail(emailad) {
    var exclude = /[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
    var check = /@[\w\-]+\./;
    var checkend = /\.[a-zA-Z]{2,8}$/;

    if (((emailad.search(exclude) != -1) || (emailad.search(check)) == -1) || (emailad.search(checkend) == -1)) {
        strMessage = strMessage + "\nEmail address (Invalid Format)";
    }
}


function newValidate() {
    //EMAIL ADRRESS
    if (eval(document.forms("unsubscribe").item("usemail").value == "")) {
        strMessage = strMessage + "\nEmail address (Empty)";
    }
    else {
        var Emailadd = document.forms("unsubscribe").item("usemail").value;
        newValidateEmail(Emailadd);
    }

    //SUBMIT IF ALL FIELDS ARE CORRECT
    if (eval(strMessage == "Please Correct your:")) {
        document.forms("unsubscribe").submit();
        return _hbDownload("Unsubscribe+Submit"); //HBX
    }
    else {
        alert(strMessage);
        strMessage = "Please Correct your:"
    }
}

//******************** for byb_refer.asp ***************************
function frmbybchk() {

    if (checkFields()) {
        if (checkFormat(document.frmbyb.txtemail.value) && checkFormat(document.frmbyb.txtfemail1.value) && checkFormat(document.frmbyb.txtfemail2.value) && checkFormat(document.frmbyb.txtfemail3.value)) {
            if (compare(document.frmbyb.txtemail.value, document.frmbyb.txtfemail1.value, document.frmbyb.txtfemail2.value, document.frmbyb.txtfemail3.value)) {
                return true;
            }
            else {
                alert("Email addresses not unique");
            }
        }
        else {
            alert("Email - Incorrect Format");
        }
    }
    else {
        alert("Please complete required fields");
    }
    return false;



}

function checkFields() {
    if ((document.frmbyb.txtfname.value == "") || (document.frmbyb.txtemail.value == "") || (document.frmbyb.txtffname1.value == "") || (document.frmbyb.txtfemail1.value == "") || (document.frmbyb.txtffname2.value == "") || (document.frmbyb.txtfemail2.value == "") || (document.frmbyb.txtffname3.value == "") || (document.frmbyb.txtfemail3.value == "")) {
        return false;
    }
    else {
        return true;
    }
}


var exclude = /[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
var check = /@[\w\-]+\./;
var checkend = /\.[a-zA-Z]{2,3}$/;

function checkFormat(emailad1) {
    if (((emailad1.search(exclude) != -1) || (emailad1.search(check)) == -1) || (emailad1.search(checkend) == -1)) {
        return false;
    }
    else {
        return true;
    }

}



function compare(txt1, txt2, txt3, txt4) {
    if ((txt1 == txt2) || (txt1 == txt3) || (txt1 == txt4) || (txt2 == txt3) || (txt2 == txt4) || (txt3 == txt4)) {
        return false;
    }
    else {
        return true;
    }
}



//******************************************************************
function bookmarkSite() {
    if (document.all) {
        window.external.AddFavorite("http://www.fortunelounge.eu/" + favname + "?btag=" + BTag, "Royal Vegas Poker: Win a share in a horse");
    }
}

function home() {
    window.location = "default.asp?lid=Header+Nav+Home&BTag=" + BTag + "";
}
function tournaments() {
    window.location = "poker-tournaments.asp?lid=Header+Nav+Tournaments&BTag=" + BTag + "";
}
function promotions() {
    window.location = "Promotions.asp?lid=Header+Nav+Promotions&BTag=" + BTag + "";
}
function strategy() {
    window.location = "poker-articles.asp?lid=Header+Nav+Poker+Articles&BTag=" + BTag + "";
}
function games() {
    window.location = "poker-game-information.asp?lid=Header+Nav+Games&BTag=" + BTag + "";
}
function cashier() {
    window.location = "cashier.asp?lid=Header+Nav+Cashier&BTag=" + BTag + "";
}
function help() {
    window.location = "support.asp?lid=Header+Nav+Help&BTag=" + BTag + "";
}
function aboutus() {
    window.location = "about-us.asp?lid=Header+Nav+About&BTag=" + BTag + "";
}
function download_Royal() {
    window.open("Download.asp?BTag=" + BTag + "", "Download", "width=460,height=450, scrollbars=yes");
}
function pop() {
    window.open("http://www.fortunelounge.eu/cashin1.asp?BTag=" + BTag + "", "cashin", "width=650,height=200,resizable=no,scrollbars=yes");
}
function cashin() {
    window.open("http://www.fortunelounge.eu/cashin1.asp?BTag=" + BTag + "", "cashin", "width=650,height=200,resizable=no");
}
function Guidelines() {
    window.open("deposit-options-guidelines.asp?BTag=" + BTag + "", "Guidelines", "width=600,height=500, scrollbars=yes");
}
function Register() {
    window.open("Banking_Deposits_Register.asp?BTag=" + BTag + "", "Register", "width=600,height=500, scrollbars=yes");
}
function refer() {
    window.open("promotionsPopup_refer.asp?BTag=" + BTag + "", "Refer", "width=548,height=641, scrollbars=no");
}
function wpt() {
    window.open("promotionsPopupwptbay.asp?BTag=" + BTag + "", "WPT", "width=500,height=641, scrollbars=yes");
}
function ept() {
    window.open("promotionsPopupeptfrench.asp?BTag=" + BTag + "", "EPT", "width=548,height=641, scrollbars=yes");
}
function byb() {
    window.open("byb.asp?BTag=" + BTag + "", "BeatUpYourBuddy", "width=548,height=641, scrollbars=yes");
}
function faqdown() {
    window.location = "faq-downloading.asp?BTag=" + BTag + "#dload";
}
function pop15kFR() {
    window.open("PromotionsPopup15KFR.asp", "15KFreeroll", "width=580,height=530,left=300, scrollbars=yes");
}
function welcomefreeroll() {
    window.open("welcomefreeroll.asp?BTag=" + BTag + "", "Welcome", "width=580,height=530, scrollbars=yes, resizable=no");
}
function fivek() {
    window.open("fivek.asp?BTag=" + BTag + "", "fivek", "width=580,height=530, scrollbars=yes, resizable=no");
}
function seventeenk() {
    window.open("seventeenk.asp?BTag=" + BTag + "", "seventeenk", "width=580,height=530, scrollbars=yes, resizable=no");
}
function highrollpop() {
    window.open("promotionspopuphighroller.asp?BTag=" + BTag + "", "HighRoller", "width=580,height=530, scrollbars=yes, resizable=no");
}
function ecograpop() {
    window.open("/ecogra", "eCogra", "width=507,height=523, scrollbars=no");
}

	function GetBannerTag()
	{
		var strBTag = "UNDEFINED";
		
		if (window.external != null )
		{
			strBTag = window.external.QueryClientValue("%affiliateid%");
		}
		
		return strBTag;
	}


function GetPlayerAlias()
{
	if ( window.external )
	{
		var alias = window.external.QueryClientValue("%alias%");
		document.write(unescape(alias));
	}
}
function GetPlayerBalance()
{
	if ( window.external )
	{
		var PlayerBalance = parseFloat(window.external.QueryClientValue("%realcredits%"));
		PlayerBalance  = PlayerBalance/100;
		document.write(parseInt(PlayerBalance));
	}
}
function GetLPBalance()
{
	if ( window.external )
	{
		var LPBalance =  parseFloat(window.external.QueryClientValue("%LPBalance%"));
		LPBalance  = LPBalance/100;
		document.write(parseInt(LPBalance));
	}
}
