﻿//global var
var timearr;
var moneyarr;
var levelarr;
var gameid;

var gamename;
var itemame;
var itemprice;
var itemtime;
var coupon;
var moneytype;

var oldprice;

var checkorder = 1;

var ppemail;
var ppimg;
var ipn;
var reg = /\'/g;

var payment;



var powtable;
powtable = "";
var powertable2;
powertable2 = "";

function getpp() {
    var url = "ashx/getppinfo.ashx";

    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getppdo
                                    }
                                );
}

function getppdo(xmlhttp) {
    var result = xmlhttp.responseText;

    var arr = result.split("|");

    if (arr.length == 3) {
        ppemail = arr[0];
        ipn = arr[1];
        ppimg = arr[2];
    }
}
//moneytype
function showmoneytype() {
    $("moneytypesp").innerHTML = getMoneyType();
    $("moneytypesp1").innerHTML = getMoneyType();
}
//delete 
function deleteitem() {
    if (confirm("Are you sure delete it?")) {
        $("div1").style.display = "";
        $("div2").style.display = "none";
        window.localtion.href = "#a1";
    }

}
//get level price list  change game
function getgamelevelmoney() {
    closeshow();
    gameid = $F("gametype");

    var rowcount2 = $("tbdpackage").rows.length;
    for (var h = 0; h < rowcount2; h++) {
        $("tbdpackage").removeChild($("tbdpackage").rows.item(0));
    }

    if (gameid == 0) {
        $("table1").style.display = "none";
        $("table2").style.display = "none";
        $("table3").style.display = "none";

        return;
    }
    getpackagename();

    $("table1").style.display = "";
    $("table2").style.display = "";
    $("table3").style.display = "none";
    //clear all
    $("minleveltb").value = "";
    $("maxleveltb").value = "";
    $("pricetb").value = "";
    $("timetb").value = "";

    //show table1
    gamename = $("gametype").options.item($("gametype").selectedIndex).text;
    gamename = gamename.toLowerCase();

    if (true) {
        $("table1").style.display = "";
    }
    else {
        $("table1").style.display = "none";
    }

    //getlevellist
    var url = "ashx/getgamelevellist.ashx?gameid=" + gameid;

    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getlevellistdo
                                    }
                                );
}

function getlevellistdo(xmlhttp) {
    var xml = xmlhttp.responseXML;

    timearr = new Array();
    moneyarr = new Array();
    levelarr = new Array();

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = xml.getElementsByTagName("Table");

        for (var i = 0; i < pricelist.length; i++) {
            levelarr[i] = Number(pricelist[i].getElementsByTagName("gradeLevel")[0].childNodes[0].nodeValue);
            timearr[i] = Number(pricelist[i].getElementsByTagName("gTime")[0].childNodes[0].nodeValue);
            moneyarr[i] = Number(pricelist[i].getElementsByTagName("gPrice")[0].childNodes[0].nodeValue);
        }

    }
}

//minleveltb change
function changeminleveltb() {
    var minlevel = Number($F("minleveltb").strip());
    var maxlevel = Number($F("maxleveltb").strip());


    var res = /^\d*$/;
    var re = new RegExp(res);
    if (!re.test(minlevel)) {
        alert("Please fill number!");
        $("minleveltb").value = "";

        $("pricetb").value = "";
        $("timetb").value = "";
        return;
    }
    else {
        if (Number(minlevel) >= levelarr[levelarr.length - 1] || minlevel == "0") {
            $("minleveltb").value = 1;
        }
    }


    if (minlevel != "" && maxlevel != "") {
        if (Number(minlevel) >= Number(maxlevel)) {
            $("pricetb").value = "";
            $("timetb").value = "";

            $("minleveltb").value = "";
            $("maxleveltb").value = "";

            return;
        }
        var price = 0;
        var time = 0;
        for (var i = minlevel; i < maxlevel; i++) {
            price += moneyarr[i];
            time += timearr[i];
        }
        oldprice = ws2(price);
        price = ws2(changeRate(price));
        time = ws2(time);


        $("pricetb").value = price;
        $("timetb").value = time;
    }
    else {
        $("pricetb").value = "";
        $("timetb").value = "";
    }
}

//maxleveltb change
function changemaxleveltb() {
    var minlevel = Number($F("minleveltb").strip());
    var maxlevel = Number($F("maxleveltb").strip());

    var res = /^\d*$/;
    var re = new RegExp(res);
    if (!re.test(maxlevel)) {
        alert("Please fill number!");
        $("maxleveltb").value = "";

        $("pricetb").value = "";
        $("timetb").value = "";
        return;
    }
    else {
        if (Number(maxlevel) > levelarr[levelarr.length - 1] || maxlevel == "0") {
            $("maxleveltb").value = levelarr[levelarr.length - 1];
        }
    }


    if (minlevel != "" && maxlevel != "") {
        if (Number(minlevel) >= Number(maxlevel)) {
            $("pricetb").value = "";
            $("timetb").value = "";

            $("minleveltb").value = "";
            $("maxleveltb").value = "";

            return;
        }

        var price = 0;
        var time = 0;
        for (var i = minlevel; i < maxlevel; i++) {
            price += moneyarr[i];
            time += timearr[i];
        }
        //alert(oldprice);
        oldprice = ws2(price);
        price = ws2(changeRate(price));
        time = ws2(time);


        $("pricetb").value = price;

        $("timetb").value = Math.round(Number(time) * 100) / 100;
    }
    else {
        $("pricetb").value = "";
        $("timetb").value = "";
    }
}

//levelbuy to 2
function levelbuy() {
    closeshow();
    var minlevel = $F("minleveltb").strip();
    var maxlevel = $F("maxleveltb").strip();

    var price = $F("pricetb").strip();
    var time = $F("timetb").strip();

    if (minlevel == "" || maxlevel == "" || price == "" || time == "") {
        alert("Please fill all!");
        return;
    }
    if (price == "0" || price == null || price == "" || price == "NaN") {
        alert("Invalid price!");
        return;
    }
    serverlist();
    characterlist();
    //
    for (var i = 0; i < 999999; i++) {
        i++;
    }
    itemame = "Level " + minlevel + "-" + maxlevel;
    itemtime = time + " hours";
    moneytype = getMoneyType();
    itemprice = price;
    $("div1").style.display = "none";
    $("div2").style.display = "";
    $("div3").style.displasy = "none";

    //bind price
    $("row10").innerHTML = itemame;
    $("row11").innerHTML = moneytype + price;
    $("row13").innerHTML = moneytype + price;

    $("coupontr").style.display = "none";

    $("row31").innerHTML = moneytype + price;
    $("row32").innerHTML = 1;
    $("row33").innerHTML = moneytype + price;

    $("pinfo1").innerHTML = itemame;
    $("pinfo2").innerHTML = itemame;

    window.location.href = "#a1";
}


//levelbuy 
function levelbuy2() {
    closeshow();

    var minlevel = $F("minleveltb").strip();
    var maxlevel = $F("maxleveltb").strip();

    var price = $F("pricetb").strip();
    var time = $F("timetb").strip()
    if (minlevel == "" || maxlevel == "" || price == "" || time == "") {
        packagebuy2(iindex, pme);
    } else {
        itemame = "Level " + minlevel + "-" + maxlevel;
        itemtime = time + " hours";
        moneytype = getMoneyType();
        itemprice = price;
        $("div1").style.display = "none";
        $("div2").style.display = "";
        $("div3").style.displasy = "none";

        //bind price
        $("row10").innerHTML = itemame;
        $("row11").innerHTML = moneytype + price;
        $("row13").innerHTML = moneytype + price;

        $("coupontr").style.display = "none";

        $("row31").innerHTML = moneytype + price;
        $("row32").innerHTML = 1;
        $("row33").innerHTML = moneytype + price;

        $("pinfo1").innerHTML = itemame;
        $("pinfo2").innerHTML = itemame;
    }



}


// get game server list.
function serverlist() {
    var url = "ashx/getgamelist.ashx?gameid=" + gameid;



    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: serverlistadd
                                    }
                                );

}

function serverlistadd(xmlhttp) {
    var result = xmlhttp.responseXML;

    var getserverdll = $("DropDownList1");
    getserverdll.innerHTML = "";

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = result.getElementsByTagName("Table");
        for (var i = 0; i < pricelist.length; i++) {
            var op = document.createElement("option");

            var optext = pricelist[i].getElementsByTagName("serverName")[0].childNodes[0].nodeValue;
            op.appendChild(document.createTextNode(optext));

            getserverdll.appendChild(op);
        }
    }
}

//get charaters
function characterlist() {
    var url = "ashx/getgamecharacter.ashx?gameid=" + gameid;



    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: characterlistdo
                                    }
                                );
}

function characterlistdo(xmlhttp) {
    var result = xmlhttp.responseXML;
    var ddl = $("DropDownList2");

    if (xmlhttp.responseText != "<NewDataSet />") {
        ddl.innerHTML = "";

        var pricelist = result.getElementsByTagName("Table");
        for (var i = 0; i < pricelist.length; i++) {
            var op = document.createElement("option");

            var optext = pricelist[i].getElementsByTagName("gamejob")[0].childNodes[0].nodeValue;
            op.appendChild(document.createTextNode(optext));

            ddl.appendChild(op);
        }
    }
    else {
        $("trCharacter").style.display = "none";
    }
}

//kefulist 
function kefulist() {
    var url = "ashx/kefulist.ashx";



    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: kefulistdo
                                    }
                                );
}

function kefulistdo(xmlhttp) {
    var ddl = $("repddl");
    ddl.innerHTML = "";

    var result = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = result.getElementsByTagName("Table");
        for (var i = 0; i < pricelist.length; i++) {
            var op = document.createElement("option");

            var optext = pricelist[i].getElementsByTagName("enName")[0].childNodes[0].nodeValue;
            op.appendChild(document.createTextNode(optext));

            ddl.appendChild(op);
        }
    }
}

//client info
var account, reaccount, pass, repass, servername, charname, charclass, fullname, email, usphone, us1, us2, us3, nousphone, coupon, kefu, sn, needgold;

var smremark = "";

function couponpdo2(xmlhttp) {
    var result = xmlhttp.responseText;

    if (result == "-1") {
        alert("Coupon is not useful,please check it!");
        coupon = "";
        $("coupontb").value = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }
    if (result == "-2") {
        alert("This coupon code has expired, plz contact with your customer rep!");
        coupon = "";
        checkorder = 0;
        $("coupontb").value = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        return;
    }

    var arc = result.split(",");
    var carr = arc[0].split("|");

    if (carr[0] != "0") {
        $("coupontb").value = "";
        alert("Coupon is only use for Gold!");
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }
    if (parseFloat(oldprice) < parseFloat(carr[1])) {
        alert("The price is lower!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }

    if (carr.length != 6) {
        alert("Coupon is error!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }

    if (carr[2] == "3" || carr[2] == "4") {
        alert("Coupon is only use for Gold!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }

        $("couponrow2").style.display = "none";
        return;
    }

    if (carr[2] == "1") {

        $("row21").innerHTML = moneytype + " -" + changeRate2(parseFloat(carr[3]));
        $("row23").innerHTML = moneytype + " -" + changeRate2(parseFloat(carr[3]));
        itemprice = ws2(changeRate(parseFloat(oldprice)) - changeRate2(parseFloat(carr[3])));
        $("row31").innerHTML = moneytype + itemprice;
        $("row33").innerHTML = moneytype + itemprice;
        $("row32").innerHTML = 2;
    }

    if (carr[2] == "2") {

        $("row21").innerHTML = moneytype + " -" + changeRate(parseFloat(oldprice) * parseFloat(carr[3]) / 100.0);
        $("row23").innerHTML = moneytype + " -" + changeRate(parseFloat(oldprice) * parseFloat(carr[3]) / 100.0);
        itemprice = ws2(changeRate(parseFloat(oldprice) - parseFloat(oldprice) * parseFloat(carr[3]) / 100.0));
        $("row31").innerHTML = moneytype + itemprice;
        $("row33").innerHTML = moneytype + itemprice;
        $("row32").innerHTML = 2;
    }


    $("coupontr").style.display = "";

    $("couponrow2").style.display = "";


    if ($("DropDownList1").selectedIndex == 0) {
        alert("Please select servername!");
        return;
    }

    if ($("DropDownList2").selectedIndex == 0) {
        alert("Please select game character!");
        return;
    }

    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test($F("emailtb").strip())) {
        alert("Please check Email");
        return;
    }

    account = $F("accounttb").strip();
    pass = $F("passtb").strip();
    repass = $F("repasstb").strip();
    servername = $F("DropDownList1");
    charname = $F("charnametb").strip();
    charclass = $F("DropDownList2");
    fullname = $F("fullnametb").strip();
    email = $F("emailtb").strip();

    us1 = $F("usphone1").strip();
    us2 = $F("usphone2").strip();
    us3 = $F("usphone3").strip();

    nousphone = $F("nonus").strip();

    coupon = $F("coupontb").strip();

    if ($("rad1").checked == true) {
        kefu = " ";
    }

    if ($("rad2").checked == true) {
        if ($("rad2").selectedIndex == 0) {
            alert("Please select customer rep!");
            return;
        }
        else {
            kefu = $F("repddl");
        }
    }

    kefu += $F("reptb").strip();
    if (kefu.length == 0) {
        kefu = "&nbsp;";
    }

    if (account == "" || pass == "" || repass == "" || charname == "" || fullname == "" || email == "") {
        alert("Please fill all need!");
        return;
    }

    if (pass != repass) {
        alert("Please check password!");
        return;
    }
    if (us1 + us2 + us3 == "" && nousphone == "") {
        alert("Please fill telephone!");
        return;
    }

    var us = us1 + us2 + us3;

    if (us.length > 0 && us.length < 10) {
        alert("Please check usphone!");
        return;
    }


    usphone = us1 + "-" + us2 + "-" + us3;


    $("powertd2").innerHTML = $("powertd1").innerHTML;
    getpp();

    $("c1").innerHTML = fullname;
    $("c2").innerHTML = email;
    if (us == "") {
        $("c3").innerHTML = nousphone;
    }
    else {
        $("c3").innerHTML = usphone;
    }

    if ($("pay_type_1").checked) {
        payment = "paypal";
    }
    else if ($("pay_type_2").checked) {
        payment = "card";
    }
    else if ($("pay_type_3").checked) {
        payment = "moneybookers";
    }
    else if ($("pay_type_4").checked) {
        payment = "westernunion";
    }
    else if ($("pay_type_5").checked) {
        payment = "paypaldg";
    }
    $("pay").innerHTML = payment;


    $("c4").innerHTML = kefu;

    $("div1").style.display = "none";
    $("div2").style.display = "none";
    $("div3").style.display = "";

    $("ginfo").innerHTML = $("gametype").options.item($("gametype").selectedIndex).text + " " + servername;
    var dn_gamestor = $("gametype").options.item($("gametype").selectedIndex).text;
    dnshow(dn_gamestor);
    swtorshow(dn_gamestor);
    window.location.href = "#a1";
}




function fillbuy() {
    coupon = $F("coupontb").strip().toUpperCase();

    if (coupon.length > 0) {
        levelbuy2();
        if (coupon.length > 12 || coupon.length < 3) {
            if (powtable != "") {
                $("powertd1").innerHTML = powtable;
                $("powertd2").innerHTML = powtable;
            }
            alert("Coupon is not useful!Please check coupon!");
            $("coupontb").value = "";
            return;
        }

        if (powtable == "") {
            powtable = $("powertd1").innerHTML;
        }

        //gamename = $("gametype").options.item($("gametype").selectedIndex).text;
        var _game = $F("gametype");
        var url = "ashx/coupon.ashx?igncoupon=" + coupon + "&game=" + _game + "&gametype=DL&email=X#X@s";

        var myAjax = new Ajax.Request(
                                            url,
                                            {
                                                method: "get",
                                                onComplete: couponpdo2
                                            }
                                        );
    }
    else {
        //    checkcouponp();
        //    

        if ($("DropDownList1").selectedIndex == 0) {
            alert("Please select servername!");
            return;
        }

        if ($("DropDownList2").selectedIndex == 0) {
            alert("Please select game character!");
            return;
        }

        var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
        var re = new RegExp(res);
        if (!re.test($F("emailtb").strip())) {
            alert("Please check Email");
            return;
        }

        account = $F("accounttb").strip();
        pass = $F("passtb").strip();
        repass = $F("repasstb").strip();
        servername = $F("DropDownList1");
        charname = $F("charnametb").strip();
        charclass = $F("DropDownList2");
        fullname = $F("fullnametb").strip();
        email = $F("emailtb").strip();

        us1 = $F("usphone1").strip();
        us2 = $F("usphone2").strip();
        us3 = $F("usphone3").strip();

        nousphone = $F("nonus").strip();

        coupon = $F("coupontb").strip();

        if ($("rad1").checked == true) {
            kefu = " ";
        }

        if ($("rad2").checked == true) {
            if ($("rad2").selectedIndex == 0) {
                alert("Please select customer rep!");
                return;
            }
            else {
                kefu = $F("repddl");
            }
        }

        kefu += $F("reptb").strip();
        if (kefu.length == 0) {
            kefu = "&nbsp;";
        }

        if (account == "" || pass == "" || repass == "" || charname == "" || fullname == "" || email == "") {
            alert("Please fill all need!");
            return;
        }

        if (pass != repass) {
            alert("Please check password!");
            return;
        }
        if (us1 + us2 + us3 == "" && nousphone == "") {
            alert("Please fill telephone!");
            return;
        }

        var us = us1 + us2 + us3;

        if (us.length > 0 && us.length < 10) {
            alert("Please check usphone!");
            return;
        }


        usphone = us1 + "-" + us2 + "-" + us3;


        $("powertd2").innerHTML = $("powertd1").innerHTML;
        getpp();

        $("c1").innerHTML = fullname;
        $("c2").innerHTML = email;
        if (us == "") {
            $("c3").innerHTML = nousphone;
        }
        else {
            $("c3").innerHTML = usphone;
        }

        if ($("pay_type_1").checked) {
            payment = "paypal";
        }
        else if ($("pay_type_2").checked) {
            payment = "card";
        }
        else if ($("pay_type_3").checked) {
            payment = "moneybookers";
        }
        else if ($("pay_type_4").checked) {
            payment = "westernunion";
        }
        else if ($("pay_type_5").checked) {
            payment = "paypaldg";
        }
        $("pay").innerHTML = payment;


        $("c4").innerHTML = kefu;

        $("div1").style.display = "none";
        $("div2").style.display = "none";
        $("div3").style.display = "";

        $("ginfo").innerHTML = $("gametype").options.item($("gametype").selectedIndex).text + " " + servername;
        var dn_gamestor = $("gametype").options.item($("gametype").selectedIndex).text;
        dnshow(dn_gamestor);
        swtorshow(dn_gamestor);
        window.location.href = "#a1";
    }
}



//package buy
function getpackagename() {
    gameid = $F("gametype");

    //clear rows

    var rowcount2 = $("tbdskill").rows.length;
    for (var h = 0; h < rowcount2; h++) {
        $("tbdskill").removeChild($("tbdskill").rows.item(0));
    }

    var url = "ashx/skillname.ashx?gameid=" + gameid;

    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getskillnamedo
                                    }
                                );
}

function getskillnamedo(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = xml.getElementsByTagName("Table");

        var rowcount = Math.ceil(pricelist.length / 3.0);

        var cellindex;

        packageList(pricelist[0].getElementsByTagName("id")[0].childNodes[0].nodeValue);
        witerSkillRemark(pricelist[0].getElementsByTagName("id")[0].childNodes[0].nodeValue);

        for (var j = 0; j < rowcount; j++) {
            var row = document.createElement("tr");

            for (var i = 0; i < 3; i++) {
                cellindex = 3 * j + i;
                var cell = document.createElement("td");
                cell.setAttribute("height", "30");
                cell.align = "center";
                cell.setAttribute("className", "pl_bx pl_by ");
                cell.setAttribute("class", "pl_bx pl_by");

                if (cellindex < pricelist.length) {
                    var skillid = pricelist[cellindex].getElementsByTagName("id")[0].childNodes[0].nodeValue;
                    var skillname = pricelist[cellindex].getElementsByTagName("spname")[0].childNodes[0].nodeValue;
                    cell.innerHTML = "<a class='tdnone fwb hand' onclick='skillnameclick(" + skillid + ",\"" + skillname + "\");skddlrownoshow(1)'>" + skillname + "</a>";

                }
                else {
                    cell.innerHTML = "&nbsp;";
                }
                row.appendChild(cell);
            }

            $("tbdskill").appendChild(row);
        }
    }

}
var skiid = 0;
//skillname click
function skillnameclick(skillid, skillname) {
    witerSkillRemark(skillid);
    packageList(skillid);
    closeshow();

    if (skillname.toLowerCase() == "custom") {
        $("table2").style.display = "";
        $("table3").style.display = "none";
    }
    else {
        $("table2").style.display = "none";

        gameid = $F("gametype");

        $("sktd1").innerHTML = skillname;
        skiid = skillid;
        var url = "ashx/skillname.ashx?skgameid=" + gameid + "&skillname=" + skillname;

        var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: getskillnameddl1do
                                        }
                                    );
    }

    //清空所有显示
}


//代练说明
function witerSkillRemark(id) {
    var url = "ashx/SkillRemark.ashx?id=" + id;
    var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: skillRemarkdo
                                        }
                                    );
}
//绑定说明
function skillRemarkdo(xmlhttp) {
    var result = xmlhttp.responseText;
    if (result.length >= 1) {
        $("tbRemark").innerHTML = result;
    }
}

function getskillnameddl1do(xmlhttp) {

    var result = xmlhttp.responseText;

    if (result != "0") {
        var url = "ashx/skillname.ashx?skid=" + result;

        var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: getskillnameddl2do
                                        }
                                    );
    }
    else {
        $("table3").style.display = "none";
    }
}

function getskillnameddl2do(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        $("table3").style.display = "";

        skillddlbind(1, xml);
    }
    else {
        $("table3").style.display = "none";
    }
}

//bind skillddl 1 2 3 4 5
function skillddlbind(ski, xml) {

    var ddl = $("skddl" + ski);
    ddl.innerHTML = "";
    var pricelist = xml.getElementsByTagName("Table");
    for (var i = 0; i < pricelist.length; i++) {
        var op = document.createElement("option");

        var id = pricelist[i].getElementsByTagName("id")[0].childNodes[0].nodeValue;
        var nodename = pricelist[i].getElementsByTagName("nodename")[0].childNodes[0].nodeValue;
        op.value = id;
        op.text = nodename;

        try {
            ddl.add(op, null);
        }
        catch (ex) {
            ddl.add(op); // IE only
        }
    }
}

// ddl rows no show
function skddlrownoshow(ski) {

    for (var i = ski + 1; i < 6; i++) {
        $("sktd" + i).innerHTML = " &nbsp;";
        $("skddl" + i).style.display = "none";
    }

    if (ski < 3) {
        $("row1").style.display = "none";
        $("row2").style.display = "none";
    }

    if (ski > 2 && ski < 5) {
        $("row2").style.display = "none";
    }
}
//ddl rows show
function skddlrowshow(ski) {
    if (ski > 5) {
        return;
    }

    if (ski == 1) {
        $("row1").style.display = "none";
        $("row2").style.dispaly = "none";
    }

    if (ski == 2 || ski == 3) {
        $("row1").style.display = "";
        $("row2").style.dispaly = "none";
    }

    if (ski == 4 || ski == 5) {
        $("row1").style.display = "";
        $("row2").style.display = "";
    }



    $("sktd" + (ski + 1)).innerHTML = $("skddl" + ski).options.item($("skddl" + ski).selectedIndex).text;


}
//ddl change
var gski;
function skchange(ski) {
    $("row3").style.display = "none";
    $("pricetb1").value = "";
    $("timetb1").value = "";
    $("goldtb").value = "0";
    $("powerinfo").style.display = "none";
    var ddl = $("skddl" + ski);


    skddlrownoshow(ski);

    if (ddl.selectedIndex == 0) {
        return;
    }

    if (ski < 6) {
        var skid = $F("skddl" + ski);

        gski = ski + 1;

        var url = "ashx/skillname.ashx?skid=" + skid;

        var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: getskillnameddl22do
                                        }
                                    );
    }
}

function getskillnameddl22do(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {

        $("skddl" + gski).style.display = "";
        skillddlbind(gski, xml);
        skddlrowshow(gski - 1);
    }
    else {

        //绑定价格
        var id1 = 0;
        var id2 = 0;
        var id3 = 0;
        var id4 = 0;
        var id5 = 0;
        itemame = "";
        for (var i = 1; i < gski; i++) {
            if (i == 1) {
                id1 = $F("skddl" + i);
            }
            if (i == 2) {
                id2 = $F("skddl" + i);
            }
            if (i == 3) {
                id3 = $F("skddl" + i);
            }
            if (i == 4) {
                id4 = $F("skddl" + i);
            }
            if (i == 5) {
                id5 = $F("skddl" + i);
            }

            itemame += $("skddl" + i).options.item($("skddl" + i).selectedIndex).text + " ";
        }
        var url = "ashx/skillname.ashx?id1=" + id1 + "&id2=" + id2 + "&id3=" + id3 + "&id4=" + id4 + "&id5=" + id5;

        var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: skillpricedo
                                        }
                                    );
    }
}

function skillpricedo(xmlhttp) {
    var result = xmlhttp.responseText;

    var arr = result.split("|");

    if (arr.length != 4) {
        return;
    }

    $("pricetb1").value = changeRate(arr[0]);
    $("timetb1").value = arr[1];
    $("goldtb").value = arr[2];
    $("powerinfo").innerHTML = arr[3];

    oldprice = arr[0];
    itemprice = changeRate(arr[0]);
    itemtime = arr[1] + " hours";
    if (arr[2] != "0") {
        $("row3").style.display = "";
    }
    else {
        $("row3").style.display = "none";
    }
    if (arr[3] != "") {
        $("powerinfo").style.display = "";
    }
    else {
        $("powerinfo").style.display = "none";
    }
}

//skill to fill
function skilltobuyfill() {
    closeshow();
    if ($F("pricetb1") == "" || $F("timetb1") == "") {
        alert("Please select skill!");
        return;
    }

    serverlist();
    characterlist();

    moneytype = $("moneytypesp1").innerHTML;
    $("div1").style.display = "none";
    $("div2").style.display = "";
    $("div3").style.displasy = "none";

    //bind price
    $("row10").innerHTML = itemame;
    $("row11").innerHTML = moneytype + $F("pricetb1");
    $("row13").innerHTML = moneytype + $F("pricetb1");

    $("coupontr").style.display = "none";

    $("row31").innerHTML = moneytype + $F("pricetb1");
    $("row32").innerHTML = 1;
    $("row33").innerHTML = moneytype + $F("pricetb1");

    $("pinfo1").innerHTML = itemame;
    $("pinfo2").innerHTML = itemame;

    window.location.href = "#a1";
}
//bind package price list
function packageList(id) {
    //clear rows

    var rowcount2 = $("tbdpackage").rows.length;
    for (var h = 0; h < rowcount2; h++) {
        $("tbdpackage").removeChild($("tbdpackage").rows.item(0));
    }

    var url = "ashx/skillname.ashx?spid=" + id;

    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getpackagelistdo
                                    }
                                );
}

function getpackagelistdo(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = xml.getElementsByTagName("Table");

        for (var i = 0; i < pricelist.length; i++) {

            var row = document.createElement("tr");

            var cell = document.createElement("td");
            var id = pricelist[i].getElementsByTagName("id")[0].childNodes[0].nodeValue;
            cell.setAttribute("height", "30");
            cell.align = "left";
            cell.setAttribute("className", "pl_bx pl_by hand lh18");
            cell.setAttribute("class", "pl_bx pl_by hand lh18");
            cell.setAttribute("id", "pitem" + i);
            cell.innerHTML = "<div onclick='ss(" + id + ")' id='sp" + id + "' >" + pricelist[i].getElementsByTagName("plevels")[0].childNodes[0].nodeValue + "</div><div class='c_y hand  lh18 fwm' onclick='ss(" + id + ")'>More Info>></div>";
            row.appendChild(cell);

            cell = document.createElement("td");
            cell.setAttribute("height", "30");
            cell.align = "center";
            cell.setAttribute("className", "pl_bx pl_by");
            cell.setAttribute("class", "pl_bx pl_by");
            cell.setAttribute("id", "ptime" + i);
            cell.innerHTML = pricelist[i].getElementsByTagName("ptime")[0].childNodes[0].nodeValue;
            row.appendChild(cell);

            cell = document.createElement("td");
            cell.setAttribute("height", "30");
            cell.align = "center";
            cell.setAttribute("className", "pl_bx pl_by");
            cell.setAttribute("class", "pl_bx pl_by");
            cell.setAttribute("id", "moneyinfo" + i);
            var ppprice = Number(pricelist[i].getElementsByTagName("pprice")[0].childNodes[0].nodeValue);
            cell.innerHTML = $("moneytypesp").innerHTML + " " + changeRate(ppprice);
            row.appendChild(cell);

            cell = document.createElement("td");
            cell.setAttribute("height", "30");
            cell.align = "center";
            cell.setAttribute("className", "pl_bx pl_by");
            cell.setAttribute("class", "pl_bx pl_by");
            cell.innerHTML = "<img src=\"images/buy.gif\" width=\"49\" height=\"14\" onclick='packagebuy(" + id + "," + i + ",\"" + pricelist[i].getElementsByTagName("plevels")[0].childNodes[0].nodeValue.replace(reg, " ") + "\")' />";

            var poldprice = document.createElement("input");
            poldprice.setAttribute("id", "poldprice" + i);
            poldprice.setAttribute("type", "hidden");
            poldprice.value = ppprice;
            cell.appendChild(poldprice);
            row.appendChild(cell);

            $("tbdpackage").appendChild(row);
        }

    }
}
var iindex, pme;

//packagelist to fill info
function packagebuy2(i, pname) {

    closeshow();
    iindex = i;
    pme = pname;
    if (i == null || pname == null) {
        return;
    }
    var packageprice = $("moneyinfo" + i).innerHTML;

    var parr = packageprice.split(" ");

    if (parr.length != 2) {
        alert("price error");
        return;
    }


    itemame = pname;
    itemtime = $("ptime" + i).innerHTML + "days";
    moneytype = parr[0];
    var price = parr[1];
    itemprice = price;
    oldprice = $F("poldprice" + i);

    $("div1").style.display = "none";
    $("div2").style.display = "";
    $("div3").style.displasy = "none";

    //bind price
    $("row10").innerHTML = itemame;
    $("row11").innerHTML = moneytype + price;
    $("row13").innerHTML = moneytype + price;

    $("coupontr").style.display = "none";

    $("row31").innerHTML = moneytype + price;
    $("row32").innerHTML = 1;
    $("row33").innerHTML = moneytype + price;

    $("pinfo1").innerHTML = itemame;
    $("pinfo2").innerHTML = itemame;

    $("ginfo").innerHTML = gamename + " " + servername;

    window.location.href = "#a1";
}


//packagelist to fill info
function packagebuy(id, i, pname) {
    closeshow();
    iindex = i;
    pme = pname;
    var packageprice = $("moneyinfo" + i).innerHTML;

    var parr = packageprice.split(" ");

    if (parr.length != 2) {
        alert("price error");
        return;
    }

    serverlist();
    characterlist();

    itemame = pname;
    itemtime = $("ptime" + i).innerHTML + "days";
    moneytype = parr[0];
    var price = parr[1];
    itemprice = price;
    oldprice = $F("poldprice" + i);

    $("div1").style.display = "none";
    $("div2").style.display = "";
    $("div3").style.displasy = "none";

    //bind price
    $("row10").innerHTML = itemame;

    $("row11").innerHTML = moneytype + price;
    $("row13").innerHTML = moneytype + price;

    $("coupontr").style.display = "none";

    $("row31").innerHTML = moneytype + price;
    $("row32").innerHTML = 1;
    $("row33").innerHTML = moneytype + price;

    $("pinfo1").innerHTML = itemame;
    $("pinfo2").innerHTML = itemame;

    $("ginfo").innerHTML = gamename + " " + servername;

    if (smremark == "" || smremark == null) {
        var url = "ashx/skillname.ashx?packageid=" + id;
        var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getpackageinfodo2
                                    }
                                );
    }
    else {
        window.location.href = "#a1";
    }
}

function getpackageinfodo2(xmlhttp) {
    document.getElementById("remarkinfo").innerHTML = xmlhttp.responseText;
    smremark = document.getElementById("remarkinfo").innerHTML;
    window.location.href = "#a1";
}


function getNewSubmitForm(sid) {
    var submitForm = document.createElement("form");

    document.body.appendChild(submitForm);

    submitForm.id = sid;

    submitForm.method = "POST";

    submitForm.target = "_self";

    return submitForm;

}

function createNewFormElement(inputForm, elementName, elementValue) {

    var newElement = document.createElement("input");
    newElement.setAttribute("name", elementName);
    newElement.setAttribute("type", "hidden");
    newElement.value = elementValue;

    inputForm.appendChild(newElement);

    return newElement;
}


function createFormAndSubmit(item_name, amount, currency_code) {
    var submitForm = getNewSubmitForm("Paypalform");
    createNewFormElement(submitForm, "cmd", "_ext-enter");
    createNewFormElement(submitForm, "redirect_cmd", "_xclick");
    createNewFormElement(submitForm, "business", ppemail);
    createNewFormElement(submitForm, "item_name", item_name);
    createNewFormElement(submitForm, "amount", amount);
    createNewFormElement(submitForm, "notify_url", ipn);
    createNewFormElement(submitForm, "image_url", ppimg);
    createNewFormElement(submitForm, "currency_code", currency_code);
    submitForm.action = "paymoney.aspx";
    submitForm.submit();


}




//to PayPal
function powertopaypal() {
    var moneytype2 = getmoneytype2();
    needgold = $F("goldtb");

    if ($('dn_check').checked == false && $('dn_tr').style.display == '') {
        if ($F("userinputtb") == "") {
            alert("Tick if you don't have 2nd password,otherwise fill in the blank !");
            return;
        }
    }

    if ($('swtor_tr').style.display == '') {
        if ($F("userinputtb") == "") {
            alert("Please fill in the code protection information !");
            return;
        }
    }



    if (parseInt(needgold) == null) {
        needgold = 0;
    }
    if (needgold == "") {
        needgold = 0;
    }
    sn = getserial() + "-PL";
    if (usphone == "--") {
        usphone = "";
    }
    var _game = $F("gametype");
    var xmlStr = "<userinputs>";

    xmlStr += "<gamename>" + escape(_game) + "</gamename>";
    xmlStr += "<servername>" + escape(servername) + "</servername>";
    xmlStr += "<charactername>" + charname + "</charactername>";
    xmlStr += "<fullname>" + fullname + "</fullname>";
    xmlStr += "<usphone>" + escape(usphone) + "</usphone>";
    xmlStr += "<mobile>" + escape(nousphone) + "</mobile>";
    xmlStr += "<money>" + escape(itemprice) + "</money>";
    xmlStr += "<moneytype>" + escape(moneytype2) + "</moneytype>";
    xmlStr += "<oldmoney>" + escape(oldprice) + "</oldmoney>";
    xmlStr += "<coupon>" + escape(coupon) + "</coupon>";
    xmlStr += "<email>" + escape(email) + "</email>";
    xmlStr += "<staffname>" + escape(kefu) + "</staffname>";
    xmlStr += "<uid>" + escape(getuid()) + "</uid>";
    xmlStr += "<password>" + escape(pass) + "</password>";
    xmlStr += "<account>" + escape(account) + "</account>";
    xmlStr += "<sn>" + escape(sn) + "</sn>";
    xmlStr += "<itemame>" + escape(itemame + "#" + smremark) + "</itemame>";
    xmlStr += "<input>" + escape($F("userinputtb")) + "</input>";
    xmlStr += "<needgold>" + escape(needgold) + "</needgold>";
    xmlStr += "<charclass>" + escape(charclass) + "</charclass>";
    xmlStr += "<usetime>" + escape(itemtime) + "</usetime>";
    xmlStr += "<payment>" + escape(payment) + "</payment>";
    xmlStr += "</userinputs>";
    var url = "ashx/powerbuyinput.ashx";

    try {
        var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "post",
                                            postBody: xmlStr,
                                            onComplete: powertopaypaldo
                                        }
                                       );
    }
    catch (err) {
        alert(err.description);
    }
}

function powertopaypaldo(xmlhttp) {

    var result = xmlhttp.responseText;
     var _arr = result.split("|");


     if (_arr.length == 2 && _arr[0] == "ok") {
         if (_arr[0] == "ok") {
             if (payment == "westernunion") {
                 submitwest();
                 return;
             }

             if (payment == "moneybookers") {

                 submitmoneybooker();
                 return;
             }
             if (payment == "paypaldg") {

                 digitalgoodsFormAndSubmit(_arr[1], itemprice);
                 return;
             }
             createFormAndSubmit(sn, itemprice, getmoneytype2());
         }

         else {
             if (_arr[0] == "no") {
                 if (payment == "westernunion") {
                     submitwest();
                     return;
                 }

                 if (payment == "moneybookers") {

                     submitmoneybooker();
                     return;
                 }
                 if (payment == "paypaldg") {

                     digitalgoodsFormAndSubmit(_arr[1], itemprice);
                     return;
                 }
                 createFormAndSubmit(sn, itemprice, getmoneytype2());
             }
         }
     }
     else {
         if (_arr[0] == "no") {
             if (payment == "westernunion") {
                 submitwest();
                 return;
             }

             if (payment == "moneybookers") {

                 submitmoneybooker();
                 return;
             }
             if (payment == "paypaldg") {

                 digitalgoodsFormAndSubmit(_arr[1], itemprice);
                 return;
             }
             createFormAndSubmit(sn, itemprice, getmoneytype2());
         }
     }
}

var ppinfo;
function getpackageinfo(i) {
    var url = "ashx/skillname.ashx?packageid=" + i;

    var myAjax = new Ajax.Request(
                                    url,
                                    {
                                        method: "get",
                                        onComplete: getpackageinfodo
                                    }
                                );
}

function getpackageinfodo(xmlhttp) {
    document.getElementById("remarkinfo").innerHTML = xmlhttp.responseText;
    smremark = document.getElementById("remarkinfo").innerHTML;
}
function closeshow() {
    $("sm").style.display = "none";
}

//获取控件的位置
function CPos(x, y) {
    this.x = x;
    this.y = y;
}

//获取控件的位置  传值 控件
function GetObjPos(ATarget) {
    var target = ATarget;
    var pos = new CPos(target.offsetLeft, target.offsetTop);

    var target = target.offsetParent;
    while (target) {
        pos.x += target.offsetLeft;
        pos.y += target.offsetTop;

        target = target.offsetParent
    }
    return pos;
}

function ss(i) {
    getpackageinfo(i);
    document.getElementById("sm").style.position = "absolute";
    var poins = GetObjPos(document.getElementById("sp" + i));
    document.getElementById("sm").style.left = (poins.x + 100) + "px";
    document.getElementById("sm").style.top = (poins.y - 50) + "px"
    document.getElementById("sm").style.display = "";
    document.getElementById("sm").style.width = "200px";
}

function show(i) {

    document.getElementById("sm").style.position = "absolute";
    var poins = GetObjPos(document.getElementById("sm"));

}

var indexcount = 0;

//check coupon
function checkcouponp() {

    levelbuy2();
    // if(indexcount==0)
    // {
    coupon = $F("coupontb").strip().toUpperCase();

    if (coupon.length == 0) {
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        checkorder = 0;
        return;
    }
    if (coupon.length > 12 || coupon.length < 3) {
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        alert("Coupon is not useful!Please check coupon!");
        $("coupontb").value = "";
        checkorder = 0;
        return;
    }
    gamename = $("gametype").options.item($("gametype").selectedIndex).text;
    //        if(gamename.toUpperCase() == "AION OF US" || gamename.toUpperCase() == "AION OF EU" )
    //        {
    //            alert("coupons can not be used for this game!");
    //            return;
    //         }
    if (powtable == "") {
        powtable = $("powertd1").innerHTML;
    }


    var _game = $F("gametype");
    var url = "ashx/coupon.ashx?igncoupon=" + coupon + "&game=" + _game + "&gametype=DL&email=X#X@s";

    var myAjax = new Ajax.Request(
                                        url,
                                        {
                                            method: "get",
                                            onComplete: couponpdo
                                        }
                                    );
    //  }
}

function couponpdo(xmlhttp) {
    //if(indexcount==0)
    //  {
    var result = xmlhttp.responseText;

    if (result == "-1") {
        checkorder = 0;
        alert("Coupon is not useful,please check it!");
        coupon = "";
        $("coupontb").value = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        return;
    }

    if (result == "-2") {
        alert("This coupon code has expired, plz contact with your customer rep!");
        coupon = "";
        checkorder = 0;
        $("coupontb").value = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        return;
    }

    var arc = result.split(",");
    var carr = arc[0].split("|");

    if (carr[0] != "0") {
        checkorder = 0;
        $("coupontb").value = "";
        alert("Coupon is only use for Gold!");
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }
    if (parseFloat(oldprice) < parseFloat(carr[1])) {
        checkorder = 0;
        alert("The price is lower!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }

    if (carr.length != 6) {
        checkorder = 0;
        alert("Coupon is error!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }
        $("couponrow2").style.display = "none";
        return;
    }

    if (carr[2] == "3" || carr[2] == "4") {
        checkorder = 0;
        alert("Coupon is only use for Gold!");
        $("coupontb").value = "";
        coupon = "";
        if (powtable != "") {
            $("powertd1").innerHTML = powtable;
            $("powertd2").innerHTML = powtable;
        }

        $("couponrow2").style.display = "none";
        return;
    }

    if (carr[2] == "1") {

        $("row21").innerHTML = moneytype + " -" + changeRate2(parseFloat(carr[3]));
        $("row23").innerHTML = moneytype + " -" + changeRate2(parseFloat(carr[3]));
        itemprice = ws2(changeRate(parseFloat(oldprice)) - changeRate2(parseFloat(carr[3])));
        $("row31").innerHTML = moneytype + itemprice;
        $("row33").innerHTML = moneytype + itemprice;
        $("row32").innerHTML = 2;

        indexcount = 1;
        checkorder = 1;
    }

    if (carr[2] == "2") {

        $("row21").innerHTML = moneytype + " -" + changeRate(parseFloat(oldprice) * parseFloat(carr[3]) / 100.0);
        $("row23").innerHTML = moneytype + " -" + changeRate(parseFloat(oldprice) * parseFloat(carr[3]) / 100.0);
        itemprice = ws2(changeRate(parseFloat(oldprice) - parseFloat(oldprice) * parseFloat(carr[3]) / 100.0));
        $("row31").innerHTML = moneytype + itemprice;
        $("row33").innerHTML = moneytype + itemprice;
        $("row32").innerHTML = 2;

        indexcount = 1;
        checkorder = 1;
    }
    alert("coupon is ok!");
    $("coupontr").style.display = "";

    //  $("couponrow1").style.display = "none";
    $("couponrow2").style.display = "";

    //$("coupontb").readOnly='true';
    return true;
    //  }
}

//show change gold
function showgoldrow() {
    if (getCookie("") != null) {
        $("goldrow").style.display = "";
    }
}
//Exchange Gold
function exchangegold() {

}

function submitwest() {
    var submitForm = getNewSubmitForm("WestenUnion");
    createNewFormElement(submitForm, "ordercode", sn);
    createNewFormElement(submitForm, "gamename", gamename);
    createNewFormElement(submitForm, "servername", servername);
    createNewFormElement(submitForm, "ccharactername", charname);
    createNewFormElement(submitForm, "goldnum", itemame);
    createNewFormElement(submitForm, "price", itemprice);
    createNewFormElement(submitForm, "moneytype", getmoneytype2());
    submitForm.action = "paymoney3.aspx";
    submitForm.submit();
}

//moneybookers
function submitmoneybooker() {
    var submitForm = getNewSubmitForm("MoneyBookers");
    createNewFormElement(submitForm, "pay_to_email", ppemail);
    createNewFormElement(submitForm, "amount", itemprice);
    createNewFormElement(submitForm, "currency", getmoneytype2());
    createNewFormElement(submitForm, "detail1_description", sn);
    createNewFormElement(submitForm, "detail1_text", "POWER");
    submitForm.action = "paymoney2.aspx";
    submitForm.submit();
}

//Digital goods
function digitalgoodsFormAndSubmit(sn, amount) {

    var submitForm = getNewSubmitForm("PaypalDigitalgoods");
    createNewFormElement(submitForm, "ordercode", sn);
    createNewFormElement(submitForm, "amount", amount);
    submitForm.action = "checkout.aspx";
    submitForm.submit();

}



//是否显示DN2级密码显示
function dnshow(dn_name) {
    dn_name = dn_name.toLowerCase();
    if (dn_name.match('dragon')) {
        $('dn_tr').style.display = "";
    }
    else {
        $('dn_tr').style.display = "none";
    }
}



//是否显示swtor密保信息
function swtorshow(dn_name) {
    dn_name = dn_name.toLowerCase();
    if (dn_name.match('swtor')) {
        $('swtor_tr').style.display = "";
    }
    else {
        $('swtor_tr').style.display = "";
    }
}
