 var xmlHttp;
    var responsetxt;
    function login() {

        var gogoid = $('#gogoid').val();
        var pass = $('#password').val();
        var verify = $('#verify').val();
        var act = "logingogosms"
        xmlHttp = GetXmlHttpObject()

        if (xmlHttp == null) {
            alert("Browser does not support HTTP Request")
            return;
        }
        var param = "act="+act+"&gogoid=" + gogoid + "&pass=" + pass + "&verify=" + verify

        var url = "xmlhttp/login.aspx"
        xmlHttp.onreadystatechange = stateChanged
        xmlHttp.open("POST", url, true)
        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.setRequestHeader("Content-length", param.length);
        xmlHttp.setRequestHeader("Connection", "close");
        xmlHttp.send(param)
    }
    function activate() {
        var name = $('#name').val();
        var bankname = $('#bankname').val();
        var acctno = $('#acctno').val();
        var telco = $('#telco').val();
        var hpno = $('#hpno').val();
        var superpassword = $('#superpassword').val();

        if (name != "" && bankname != "" && acctno != "" && telco != "" && hpno != "" && superpassword != "") {

            $.ajax({
                type: "POST",
                url: "xmlhttp/activate.aspx",
                data: "act=activategogosms&name=" + name + "&bankname=" + bankname + "&acctno=" + acctno + "&telco=" + telco + "&hpno=" + hpno + "&superpassword=" + superpassword,
                async: false,
                success: function(msg) {
                    alert(msg);
                    if (msg == "SMS Activation Code will send to you phone soon.") {
                        $('#step1').hide();
                        $('#step2').show();
                    }
                }
            });
        }
        else {
            alert("资料不齐全，请填写正确！！\n All field cannot be blank")
        }
    }
    function activatecode() {
        var code = $('#code').val();

        $.ajax({
            type: "POST",
            url: "xmlhttp/activate.aspx",
            data: "act=activatecodegogosms&code=" + code,
            async: false,
            success: function(msg) {
                alert(msg);
                if (msg == "Activation is successful.") {
                    $('body').load('successful.aspx')
                }
            }
        });
    }
    function stateChanged() {
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
            var response = xmlHttp.responseText;

            response = response.substring(0, response.indexOf("<!DOCTYPE") - 4);
            if (response == "Empty") {
                alert("No Record Found !!!");
            }
            else if (response == 'Error') {
                alert("An Error occured in accessing the DataBase !!!");
            }
            else {
                var arr = response.split("&");
                if (arr == "success") {
                    $('#loginDIV').hide();
                    $('body').load('activation.aspx')
                }
                else {
                    alert(response);
                }
                
            }
        }
    }

    function GetXmlHttpObject() {
        var objXMLHttp = null
        if (window.XMLHttpRequest) {
            objXMLHttp = new XMLHttpRequest()
        }
        else if (window.ActiveXObject) {
            objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
        }
        return objXMLHttp
    }