
function Home(){
    window.location = "";
}

function Search(){
    window.location = "index.php";
}

function Resume(){
    window.location = "JSResume.php";
}

function Application(){
    window.location = "AppliedJobList.php";
}

function RecruiterJobLink(){
    window.location = "RecruiterJobList.php";
}

function Logout(){
    window.location = "Logout.php";
}

function Register(){
    window.location = "Registration.php";
}

function ResetPassword(){
    window.location = "ResetPassword.php";
}

function Account(){
    window.location = "Account.php";
}

function Contact(){
    window.open("http://www.80twenty.com.sg/contactus.html","contact");
}

function Feedback(){
    window.open("http://www.80twenty.com.sg/feedback.html","feedback");
}

function Employers(){
    window.location="Employers.php";
}

function JobSeekers(){
    window.location="JobSeekers.php";
}

function Affiliates(){
    window.location="AffiliatePage.php";
}

function Candidate(){
    window.location="CandidatePage.php";
}

function Orders(){
    window.location="ManageOrders.php";
}

function PriceBooks(){
    window.location="ManagePriceBook.php";
}

function Commission(){
    window.location="ManageCommission.php";
}

function Members(){
    window.location="ManageMember.php";
}

function Jobs(){
    window.location="RecruiterJobList.php";
}

function Transaction(){
    window.location = "CompanyTransaction.php";
}

function AffiliateTransaction(){
    window.location = "AffiliateTransaction.php";
}

function AffiliatePaymentStatement(){
    window.location = "AffiliatePaymentStatement.php";
}

function ProcessRegisterMembership(){
    window.location = "ProcessRegisterMembershipPayment.php";
}

function iras(){
    window.open("http://www.iras.gov.sg","iras");
}

function MembershipOrderForm(){
    window.location = "MembershipOrderForm.php";
}

function MembershipOrderFormPopup(){
    window.open("MembershipOrderForm.php","membershipOrderForm","width=900,height=700,location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0,scrollbars=1");
}
//##############################################################################
function GetXmlHttpObject()
{
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject)
    {
        // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    return null;
}

var xmlhttp;
//##############################################################################
function Login()
{
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Browser does not support HTTP Request");
        return;
    }
    var url="processLogin.php";
    url =url+"?username="+getIDValue('username');
    url =url+"&password="+getIDValue('password');
    if(getIDValue("proceedLogin") > 0){
        url = url+"&proceedLogin=true";
    }
    try{
        xmlhttp.onreadystatechange=LoginStateChanged;
        xmlhttp.open("get",url,true);
        xmlhttp.send(null);
    } catch (e) {
        alert(xmlhttpRequestStatus(xmlhttp.status));
    }
}
function LoginStateChanged()
{
    if (xmlhttp.readyState==4)
    {
        if (xmlhttp.status==200){
            if(xmlhttp){
                xmlDoc = xmlhttp.responseXML;
                if(xmlDoc){
                    var loginSessionExist = GetXMLNode(xmlDoc, "loginSessionExist", 0, 0);
                    if(loginSessionExist > 0){
                        if(confirm(loginSessionExistMsg)){
                            document.getElementById("proceedLogin").value = 1;
                            Login();
                        }
                    }else{
                        var url = GetXMLNode(xmlDoc, "url", 0, 0);
                        if(url != null && url != ""){
//                            if(navigator.appName != "Microsoft Internet Explorer")
//                                alert(browserDetectionMessage);
                            window.location = url;
                        }else{
                            var fail = GetXMLNode(xmlDoc, "fail", 0, 0);
                            if(fail != null && fail != ""){
                                alert(xmlDoc.getElementsByTagName("fail")[0].childNodes[0].nodeValue);
                            }
                        }
                    }
                }
            }
        }else{
            alert(xmlhttpRequestStatus(xmlhttp.status));
        }
    }
}

function validateLogin(){
    if(validate('username', "", "Please enter Username.")){
        if(ValidateUsenameSpecialChar("username", "Please use only alpha-numeric @ _ - and . characters for username.")){
            if(validate('password', "", "Please enter Password.")){
                if(ValidatePasswordSpecialChar("password", "Please use only alpha-numeric for password.")){
                    return true;
                }
            }
        }
    }
    return false;
}

function logon(){
    if(validateLogin()){
        Login();
    }
}

function downloadRankDoc(){
    window.open("http://www.submitcv.com/download/Rank%20Candidate%20to%20Optimize%20Selection.pdf", "download");
}
