﻿
//用户电话格式焦点设置
function telfocus(value, var1) {
    if (value.length == 3) {

        if (var1 == 1) {
            $("usphone2").focus();

        }
        if (var1 == 2) {
            $("usphone3").focus();

        }
    }
}
/**************************************
*
*用户操作
*
**************************************/



//用户注册操作


function register() {
    var name;
    var email;
    var reemail;
    var pass;
    var repass;
    var msn;
    var phone1;
    var phone2;
    var phone3;
    var phone;
    var usphone;
    var nousphone;
    var mobile;
    var workphone;
    var vmsn;

    name = $F("nametb").strip();
    email = $F("emailtb").strip();
    //reemail = $F("reemailtb").strip();
    pass = $F("passtb").strip();
    repass = $F("repasstb").strip();
    msn = $F("msntb").strip();
    phone1 = $F("usphone1").strip();
    phone2 = $F("usphone2").strip();
    phone3 = $F("usphone3").strip();
    usphone = phone1 + "-" + phone2 + "-" + phone3;
    nousphone = $F("nousphonetb").strip();
    mobile = $F("mobiletb").strip();
    workphone = $F("workphonetb").strip();


    if (name == "" || email == "" || pass == "" || repass == "")//|| reemail == ""
    {
        alert("Please Fill all *!");
        return;
    }

    if (usphone.length == 2 && nousphone == "") {
        alert("Please Fill all *!");
        return;
    }

    if (usphone.length == 12) {
        phone = usphone;
    }

    if (usphone.length > 2 && usphone.length < 12) {
        alert("Please check usphone!");
        return;
    }

    if (usphone.length == 2 && nousphone != "") {
        phone = nousphone;
    }


    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test(email)) {
        alert("Please check email");
        return;
    }

    if (pass != repass) {
        alert("Please check password");
        return;
    }

    $("imgbnt_subReg").style.display = "none";
    $("Img1").style.display = "";

    var xmlStr = "<loginfo>";
    xmlStr += "<name>" + escape(name) + "</name>";
    xmlStr += "<email>" + escape(email) + "</email>";
    xmlStr += "<pass>" + escape(pass) + "</pass>";
    xmlStr += "<msn>" + escape(msn) + "</msn>";
    xmlStr += "<phone>" + escape(phone) + "</phone>";
    xmlStr += "<mobile>" + escape(mobile) + "</mobile>";
    xmlStr += "<workphone>" + escape(workphone) + "</workphone>";
    xmlStr += "</loginfo>";



    var url = "/ashx/customerReg.ashx";

    var myAjax = new Ajax.Request
                (
                    url,
                    {
                        method: "post",
                        postBody: xmlStr,
                        onComplete: registerDo
                    }
                );

}

function registerDo(xmlhttp) {
    var result = xmlhttp.responseText;

    if (result == "success") {
        $("regBox").style.display = "none";
        $("success").style.display = "";

    }
    else {
        alert(result);
        $("imgbnt_subReg").style.display = "";
        $("Img1").style.display = "none";
    }

}

//查找密码

function findpass() {
    var email = $F("femailtb").strip();

    if (email == "") {
        alert("Please fill Email!");
        return;
    }
    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test(email)) {
        alert("Please check email");
        return;
    }

    var xmlStr = "<loginfo>";
    xmlStr += "<email>" + escape(email) + "</email>";
    xmlStr += "</loginfo>";

    var url = "/ashx/password.ashx";

    var myAjax = new Ajax.Request
                (
                    url,
                    {
                        method: "post",
                        postBody: xmlStr,
                        onComplete: findpassDo
                    }
                );
}

function findpassDo(xmlhttp) {
    var result = xmlhttp.responseText;

    if (result == "0") {
        $("div1").style.display = "";
        $("div2").style.display = "";
        $("div3").style.display = "none";
    }

    if (result == "yes") {
        $("div1").style.display = "none";
        $("div2").style.display = "none";
        $("div3").style.display = "";
    }

    if (result == "no") {
        $("div1").style.display = "";
        $("div2").style.display = "none";
        $("div3").style.display = "none";

        alert("Send Eamil failed,please try again!");
    }
}

//用户登录
function cuslogin(name, pass) {
    if (document.activeElement.id != "logemailtb"
             && document.activeElement.id != "logpasstb"
             && document.activeElement.id != "login11_lbtn_login1") {
        return;
    }
    //alert(document.activeElement.id);

    var email = $F(name).strip();
    var pass = $F(pass);

    if (email == "" || pass == "") {
        alert("You should fill in a username and a password.");
        return;
    }

    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test(email)) {
        alert("Please check email");
        return;
    }

    var xmlStr = "<loginfo>";
    xmlStr += "<email>" + escape(email) + "</email>";
    xmlStr += "<pass>" + escape(pass) + "</pass>";
    xmlStr += "</loginfo>";

    var url = "/ashx/login.ashx";

    var myAjax = new Ajax.Request
                                (
                                    url,
                                    {
                                        method: "post",
                                        postBody: xmlStr,
                                        onComplete: cusLoginDo
                                    }
                                );
}
function cusLoginDo(xmlhttp) {
    var result = xmlhttp.responseText;

    if (result == "") {
        alert("Email or password is not true,please check!");
        return;
    }

    // setCookie("customerinfo", result, 1);
    window.location.reload();
    readcustomercookielog();
}

//验证用户输入
function validata() {
    if ((getCookie("shopinfo") == null || getCookie("shopinfo") == '') && (getCookie("shopinfo2Id") == null || getCookie("shopinfo2Id") == "")) {
        alert('shop is null!');
        window.location = '/';
        return;
    }
    if ($F('txt_email').strip() == '') {
        alert('Emai is null!');
        $('txt_email').focus();
        return;
    }
    if ($F('txt_full').strip() == '') {
        alert('Full Name is null!');
        $('txt_full').focus();
        return;
    }
    if ($F('txt_num').strip() == '') {
        alert('Phone Number is null!');
        $('txt_num').focus();
        return;
    }
    if ($F('txt_cn').strip() == '') {
        alert('Character Name is null!');
        $('txt_cn').focus();
        return;
    }
    try {
        if ($('drpServer').options[0].selected == true) {
            alert('plz select your GameServer!');
            $('drpServer').focus();
            return;
        }
    } catch (e)
    { }
    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test($F('txt_email'))) {
        alert("Please check email");
        $('txt_email').focus();
        return;
    }

    if ($('lbl_Account').style.display == '') {
        if ($F('txt_Account').strip() == '') {
            alert('Account is null!');
            $('txt_Account').focus();
            return;
        }
    }

    if ($('lbl_PassWord').style.display == '') {
        if ($F('PassWord').strip() == '') {
            alert('PassWord is null!');
            $('PassWord').focus();
            return;
        }
    }

    if ($('lbl_sp1').style.display == '') {
        if (!$('CheckBox1').checked) {
            alert('You must agree to the agreement!');
            // $('checkbox_li').focus();
            return;
        }
    }

    //yun 2011-01-14 url="ashx/diymaterialbuyinput.ashx";
    var pageURL = document.referrer;
    pageURL = document.URL;

    if (pageURL.toLowerCase().indexOf("diymaterial") > -1 || pageURL.toLowerCase().indexOf("checkbuy2") != -1 || pageURL.toLowerCase().indexOf("checkbuy-diy") != -1) {
        diymaterialbuyinput();
    }
    else {
        newPowertopaypal();
    }

}
//只允许输入数字
function onlyNumber(e) {
    var isIE = false;
    var isFF = false;
    var isSa = false;

    if ((navigator.userAgent.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) isIE = true;
    if (navigator.userAgent.indexOf("Firefox") > 0) isFF = true;
    if (navigator.userAgent.indexOf("Safari") > 0) isSa = true;

    var iKeyCode;
    iKeyCode = window.event ? e.keyCode : e.which;
    if (!(((iKeyCode >= 48) && (iKeyCode <= 57)) || (iKeyCode == 13) || (iKeyCode == 46) || (iKeyCode == 45) || (iKeyCode == 37) || (iKeyCode == 39) || (iKeyCode == 8))) {
        if (isIE) {
            e.returnValue = false;
        }
        else {
            e.preventDefault();
        }
    }

}



//read customerinfo cookie
function readcustomercookielog() {
    var result = getCookie("customerinfo");
    var arr;
    if (result != null && result != "") {
        arr = result.split("|||");

        if (arr.length == 11) {
            $("spname").innerHTML = arr[2];
            //$("spjifen").innerHTML = arr[6];
            $("spvip").innerHTML = arr[7];
            upoints();
            if ($("logtb1") != null && $("logtb2") != null) {
                $("logtb1").style.display = "none";
                $("logtb2").style.display = "";
            }
            if ($("login11_logtb1") != null && $("login11_logtb2") != null) {
                $("login11_logtb1").style.display = "none";
                $("login11_logtb2").style.display = "";
            }
        }
    }
    if (getCookie('shopinfo') == '')
        setCookie('shopinfo', '<NewDataSet />', 1);
    if (getCookie('game') == '')
        setCookie('game', 'World Of Warcraft US', 1);
}

function setUserInfo() {
    var result = getCookie("customerinfo");
    var arr;
    if (result != null && result != "") {
        arr = result.split("|||");

        if (arr.length == 11) {
            $("fullname").value = arr[2];
            $("youremail").value = arr[1];
            $("nonus").value = arr[5];

            var phone = arr[3].split("-");
            $("usphone1").value = phone[0];
            $("usphone2").value = phone[1];
            $("usphone3").value = phone[2];
        }
    }
}

//用户登出
function cuslogout() {

    setCookie("customerinfo", "", -1);

    /*
    *以下更新于2011-07-11 陈云    
    */
    if ($("logtb1") != null && $("logtb2") != null) {
        $("logtb1").style.display = "";
        $("logtb2").style.display = "none";
    }
    if ($("login11_logtb1") != null && $("login11_logtb2") != null) {
        $("login11_logtb1").style.display = "";
        $("login11_logtb2").style.display = "none";
    }

    if ($("logemailtb") != null) {
        $("logemailtb").value = "";
    }
    if ($("logpasstb") != null) {
        $("logpasstb").value = "";
    }

    if ($("login11_logemailtb") != null) {
        $("login11_logemailtb").value = "";
    }
    if ($("login11_logpasstb") != null) {
        $("login11_logpasstb").value = "";
    }
    document.location = "/";

}
function cs2() {
    form1.reset();
}

// 预载入用户信息

function userinfoload() {
    var result = getCookie("customerinfo");
    var arr;


    if (result != null && result != "") {
        arr = result.split("|||");
        // alert (arr);

        if (arr.length == 11) {
            $("mfullname").value = arr[2];
            $("memail").innerHTML = arr[1];
            $("mmsn").value = arr[9];

            var arr2 = arr[3].split("-");
            if (arr2.length == 3) {
                $("usphone1").value = arr2[0];
                $("usphone2").value = arr2[1];
                $("usphone3").value = arr2[2];
            }
            $("nousphonetb").value = arr[4];
            $("mmobile").value = arr[4];
            $("mworkphone").value = arr[5];
        }
        $("div1").style.display = "none";
        $("div2").style.display = "";
    }
    else {
        $("div1").style.display = "";
        $("div2").style.display = "none";
    }
}

//预载页面信息 Gold
function goldoad() {
    var result = getCookie("customerinfo");
    var arr;

    if (result != null && result != "") {
        arr = result.split("|||");

        if (arr.length == 11) {
            $("fullname").value = arr[2];
            $("youremail").value = arr[1];

            var arr2 = arr[3].split("-");
            if (arr2.length == 3) {
                $("usphone1").value = arr2[0];
                $("usphone2").value = arr2[1];
                $("usphone3").value = arr2[2];
            }

            $("nonus").value = arr[4];

        }
    }
}
//预载页面信息 POWER
function powerload() {
    var result = getCookie("customerinfo");
    var arr;

    if (result != null && result != "") {
        arr = result.split("|||");

        if (arr.length == 11) {
            $("fullnametb").value = arr[2];
            $("emailtb").value = arr[1];

            var arr2 = arr[3].split("-");
            if (arr2.length == 3) {
                $("usphone1").value = arr2[0];
                $("usphone2").value = arr2[1];
                $("usphone3").value = arr2[2];
            }

            $("nonus").value = arr[4];

        }
    }
}
// 修改用户信息

function usermodify() {
    var result = getCookie("customerinfo");
    var arr, useremail;
    arr = result.split("|||");
    useremail = arr[1];
    if ($F("mfullname") == "") {
        alert("Please input name!");
        return;
    }

    if ($F("usphone1") + $F("usphone2") + $F("usphone3") == "" && $F("nousphonetb") == "") {
        alert("Please fill telephone!");
        return;
    }

    var res = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
    var re = new RegExp(res);
    if (!re.test($F("mmsn"))) {
        alert("Please check MSN!");
        return;
    }
    vusphone = $F("usphone1") + "-" + $F("usphone2") + "-" + $F("usphone3");
    if (vusphone == "--") {
        vusphone = "";
    }
    var xmlStr = "<loginfo>";
    xmlStr += "<useremail>" + escape(useremail) + "</useremail>";
    xmlStr += "<fullname>" + escape($F("mfullname")) + "</fullname>";
    xmlStr += "<usphone>" + escape(vusphone) + "</usphone>";
    xmlStr += "<nousphone>" + escape($F("nousphonetb")) + "</nousphone>";
    xmlStr += "<msn>" + escape($F("mmsn")) + "</msn>";
    xmlStr += "<workphone>" + escape($F("mworkphone")) + "</workphone>";
    xmlStr += "</loginfo>";

    var url = "/ashx/modifyuserinfo.ashx";

    var myAjax = new Ajax.Request
                                (
                                    url,
                                    {
                                        method: "post",
                                        postBody: xmlStr,
                                        onComplete: modifyuserinfoDo
                                    }

                                 );
}

function modifyuserinfoDo(xmlhttp) {
    var result = xmlhttp.responseText;

    if (result == "" || result == "errpass" || result == "no") {
        alert("Email or password is not true,please check!");
        return;
    }
    else {
        alert("Modify Password OK");
        cuslogout()
        return;
    }
}

// 修改用户密码预载入

function modifypasswordload() {
    var result = getCookie("customerinfo");
    var arr;
    if (result != null && result != "") {
        $("div1").style.display = "none";
        $("div2").style.display = "";
    }
    else {
        $("div1").style.display = "";
        $("div2").style.display = "none";
    }
}

// 修改用户密码

function modifypassword() {

    var result = getCookie("customerinfo");
    var arr, useremail;
    if (result != null && result != "") {
        arr = result.split("|||");
        useremail = arr[1];
        // alert (useremail);

        if ($F("newpass") == "" || $F("rnewpass") == "" || $F("oldpass") == "") {
            alert("Please input Password!");
        }
        else {
            if ($F("newpass") != $F("rnewpass")) {
                alert("New Password and Repeat New Password must be the same!");
            }
            else {
                var xmlStr = "<loginfo>";
                xmlStr += "<useremail>" + escape(useremail) + "</useremail>";
                xmlStr += "<oldpass>" + escape($F("oldpass")) + "</oldpass>";
                xmlStr += "<newpass>" + escape($F("newpass")) + "</newpass>";
                xmlStr += "</loginfo>";

                var url = "/ashx/modifypassword.ashx";

                var myAjax = new Ajax.Request
                                (
                                    url,
                                    {
                                        method: "post",
                                        postBody: xmlStr,
                                        onComplete: modifypasswordDo
                                    }
                                );
                // alert("Modify Password OK");
            }
        }

    }
    else {
        $("div1").style.display = "";
        $("div2").style.display = "none";
    }
}

function modifypasswordDo(xmlhttp) {
    var result = xmlhttp.responseText;

    //alert (result);

    if (result == "" || result == "errpass" || result == "no") {
        alert("Email or password is not true,please check!");
        return;
    }
    else {
        alert("Modify Password OK");
        return;
    }
}



/********************************************
*
*my sugestion
*
********************************************/
function loadSuggstion() {
    var result = getCookie("customerinfo");
    var arr, useremail;
    arr = result.split("|||");
    useremail = arr[1];
    if (useremail == undefined || useremail == "") {
        alert("please login in");
        return;
    }

    var url = "/ashx/setmesscount.ashx?uid=" + escape(arr[0]) + "&Page=compl";

    var myAjax = new Ajax.Request
                               (
                                    url,
                                    {
                                        method: "get",
                                        onComplete: dd
                                    }
                                );


    url = "/ashx/MessageOfRep.ashx?uid=" + escape(useremail) + "&type=1";

    myAjax = new Ajax.Request
                               (
                                    url,
                                    {
                                        method: "get",
                                        onComplete: bindSuggstion
                                    }
                                );



}

function dd() { }

function bindSuggstion(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = xml.getElementsByTagName("Table");


        for (var i = 0; i < pricelist.length; i++) {

            var isSuggestion = pricelist[i].getElementsByTagName("content")[0];
            var isReply = pricelist[i].getElementsByTagName("Reply")[0];
            var isReplyTime = pricelist[i].getElementsByTagName("ReplyTime")[0];
            var issTime = pricelist[i].getElementsByTagName("stime")[0];
            if (isSuggestion != null && isReply != null && isReplyTime != null && issTime != null) {
                var Suggestionis = pricelist[i].getElementsByTagName("content")[0].childNodes[0];
                var Replyis = pricelist[i].getElementsByTagName("Reply")[0].childNodes[0];
                var ReplyTimeis = pricelist[i].getElementsByTagName("ReplyTime")[0].childNodes[0];
                var sTimeis = pricelist[i].getElementsByTagName("stime")[0].childNodes[0];
                if (Suggestionis != null && Replyis != null && ReplyTimeis != null && sTimeis != null) {
                    var Suggestion = pricelist[i].getElementsByTagName("content")[0].childNodes[0].nodeValue;
                    var Reply = pricelist[i].getElementsByTagName("Reply")[0].childNodes[0].nodeValue;
                    var ReplyTime = pricelist[i].getElementsByTagName("ReplyTime")[0].childNodes[0].nodeValue;
                    var sTime = pricelist[i].getElementsByTagName("stime")[0].childNodes[0].nodeValue;

                    if (i % 2 == 0) {
                        var row = document.createElement("tr");
                        var cell = document.createElement("td");
                        cell.setAttribute("width", "40");
                        cell.valign = "top";
                        cell.setAttribute("className", "pt7 pl18");
                        cell.setAttribute("class", "pt7 pl5");
                        cell.innerHTML = "<div class='fl suborder'><img src='images/smile1.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);

                        var sugg = Suggestion.split("---");

                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.innerHTML = "<div class='fwb newp1 fwb'>" + sugg[0] + "</div><div class='lh18 c_w'>" + sugg[1] + "</div> <div class='suc_d lh18'>" + sTime + "</div>";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);

                        row = document.createElement("tr");
                        cell = document.createElement("td");
                        cell.setAttribute("width", "40");
                        cell.setAttribute("className", "pt7 pl18 pb15");
                        cell.setAttribute("class", "pt7 pl5 pb15");
                        cell.innerHTML = "<div class='fl suborder'><img src='images/smile2.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);

                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.setAttribute("className", "newp1 pb15");
                        cell.setAttribute("class", "newp1 pb15");
                        cell.innerHTML = "<div class='lh18 c_w fwb'>" + Reply + "</div> <div class='suc_d lh18'>" + ReplyTime + "</div>";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);
                    } else {

                        var row = document.createElement("tr");
                        var cell = document.createElement("td");

                        cell.colSpan = 2;
                        cell.innerHTML = "<img src='images/A11_03.jpg' width='366' height='1' />";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);


                        row = document.createElement("tr");
                        cell = document.createElement("td");
                        cell.setAttribute("width", "40");
                        cell.valign = "top";
                        cell.setAttribute("className", "pt7 pl18 suc_bg");
                        cell.setAttribute("class", "pt7 pl5 suc_bg");
                        cell.innerHTML = "<div class='fl suborder'><img src='images/smile1.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);
                        var sugg = Suggestion.split("---");
                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.setAttribute("className", "  suc_bg");
                        cell.setAttribute("class", "  suc_bg");
                        cell.innerHTML = "<div class='fwb newp1 fwb'>" + sugg[0] + "</div><div class='lh18 c_w'>" + sugg[1] + "</div> <div class='suc_d lh18'>" + sTime + "</div>";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);

                        row = document.createElement("tr");
                        cell = document.createElement("td");
                        cell.setAttribute("height", "40");
                        cell.setAttribute("className", "pt7 pl18 suc_bg pb15");
                        cell.setAttribute("class", "pt7 pl5 suc_bg pb15");
                        cell.innerHTML = "<div class='fl suborder'><img src='images/smile2.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);

                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.setAttribute("className", "newp1 suc_bg pb15 pt10");
                        cell.setAttribute("class", "newp1 suc_bg pb15 pt10");
                        cell.innerHTML = "<div class='lh18 c_w fwb'>" + Reply + "</div> <div class='suc_d lh18'>" + ReplyTime + "</div>";
                        row.appendChild(cell);

                        $("messgaeofrep").appendChild(row);

                        row = document.createElement("tr");
                        cell = document.createElement("td");

                        cell.colSpan = 2;
                        cell.innerHTML = "<img src='images/A11_03.jpg' width='366' height='1' />";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);

                    }
                }
            }
        }
    }
}

/*
Informofnewactivities 

**/

function loadInformofnewactivities() {
    var result = getCookie("customerinfo");
    var arr, useremail;
    arr = result.split("|||");
    useremail = arr[1];
    if (useremail == undefined || useremail == "") {
        alert("please login in");
        return;
    }
    var url = "/ashx/setmesscount.ashx?uid=" + escape(arr[0]) + "&Page=cusaward";

    var myAjax = new Ajax.Request
                               (
                                    url,
                                    {
                                        method: "get",
                                        onComplete: dd
                                    }
                                );
}


/********************************************
*
*Messages_of_Customer_Rep 
*
********************************************/
function loadOASuggstion() {
    var result = getCookie("customerinfo");
    var arr, useremail;
    arr = result.split("|||");
    useremail = arr[1];
    if (useremail == undefined || useremail == "") {
        alert("please login in");
        return;
    }
    var url = "/ashx/setmesscount.ashx?uid=" + escape(arr[0]) + "&Page=sugg";

    var myAjax = new Ajax.Request
                               (
                                    url,
                                    {
                                        method: "get",
                                        onComplete: dd
                                    }
                                );


    url = "/ashx/MessageOfRep.ashx?uid=" + escape(useremail);

    myAjax = new Ajax.Request
                               (
                                    url,
                                    {
                                        method: "get",
                                        onComplete: bindOASuggstion
                                    }
                                );

}

function bindOASuggstion(xmlhttp) {
    var xml = xmlhttp.responseXML;

    if (xmlhttp.responseText != "<NewDataSet />") {
        var pricelist = xml.getElementsByTagName("Table");


        for (var i = 0; i < pricelist.length; i++) {
            if (pricelist[i].getElementsByTagName("Suggestion")[0] != null && pricelist[i].getElementsByTagName("sTime")[0] != null) {
                if (pricelist[i].getElementsByTagName("Suggestion")[0].childNodes[0] != null && pricelist[i].getElementsByTagName("sTime")[0].childNodes[0] != null) {



                    var OASuggestion = pricelist[i].getElementsByTagName("Suggestion")[0].childNodes[0].nodeValue;
                    var ReplyTime = pricelist[i].getElementsByTagName("sTime")[0].childNodes[0].nodeValue;
                    ReplyTime = ReplyTime.substring(0, ReplyTime.indexOf('T')).replace("-", "/").replace("-", "/");

                    if (i % 2 == 1) {
                        var row = document.createElement("tr");
                        var cell = document.createElement("td");
                        cell.setAttribute("width", "40");
                        cell.valign = "top";
                        cell.setAttribute("className", "pt7 pl18");
                        cell.setAttribute("class", "pt7 pl5");
                        cell.innerHTML = "<div class='fl suborder'><img src='/images/xiao.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);



                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.innerHTML = "<div class='lh18 c_w'>" + OASuggestion + "</div> <div class='suc_d lh18'>" + ReplyTime + "</div>";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);

                    } else {

                        var row = document.createElement("tr");
                        var cell = document.createElement("td");

                        cell.colSpan = 2;
                        cell.innerHTML = "<img src='images/A11_03.jpg' width='366' height='1' />";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);


                        row = document.createElement("tr");
                        cell = document.createElement("td");
                        cell.setAttribute("width", "40");
                        cell.valign = "top";
                        cell.setAttribute("className", "pt7 pl18 suc_bg");
                        cell.setAttribute("class", "pt7 pl5 suc_bg");
                        cell.innerHTML = "<div class='fl suborder'><img src='images/xiao.jpg' width='29' height='32' /></div>";
                        row.appendChild(cell);

                        cell = document.createElement("td");
                        cell.setAttribute("width", "354");
                        cell.setAttribute("className", "  suc_bg");
                        cell.setAttribute("class", "  suc_bg");
                        cell.innerHTML = "<div class='lh18 c_w'>" + OASuggestion + "</div> <div class='suc_d lh18'>" + ReplyTime + "</div>";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);

                        row = document.createElement("tr");
                        cell = document.createElement("td");

                        cell.colSpan = 2;
                        cell.innerHTML = "<img src='images/A11_03.jpg' width='366' height='1' />";
                        row.appendChild(cell);
                        $("messgaeofrep").appendChild(row);
                    }
                }
            }
        }
    }
}
