
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 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 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 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="+document.getElementById('username').value;
    url =url+"&password="+document.getElementById('password').value;
    try{
        xmlhttp.onreadystatechange=LoginStateChanged;
        xmlhttp.open("GET",url,true);
        xmlhttp.send(null);
    } catch (e) {
        alert("Sorry for the inconvenience caused. The server is down. Please try again later.");
    }
}
function LoginStateChanged()
{
    if (xmlhttp.readyState==4)
    {
        if (xmlhttp.status==200){
            if(xmlhttp){
                xmlDoc = xmlhttp.responseXML;
                if(xmlDoc){
                    if(xmlDoc.getElementsByTagName("url")[0]!= null){
                        if(xmlDoc.getElementsByTagName("url")[0].childNodes[0] != null){
                            if(xmlDoc.getElementsByTagName("url")[0].childNodes[0].nodeValue!=" "){
                                window.location = xmlDoc.getElementsByTagName("url")[0].childNodes[0].nodeValue;
                            }
                        }
                    }
                    if(xmlDoc.getElementsByTagName("fail")[0]!= null){
                        if(xmlDoc.getElementsByTagName("fail")[0].childNodes[0] != null){
                            if(xmlDoc.getElementsByTagName("fail")[0].childNodes[0].nodeValue != " "){
                                alert(xmlDoc.getElementsByTagName("fail")[0].childNodes[0].nodeValue);
                            }
                        }
                    }
                }
            }else{
                alert("Sorry for the inconvenience caused. The server is down. Please try again later.");
            }
        }else{
            alert("Sorry for the inconvenience caused. The server is down. Please try again later.");
        }
    }
}

function validateLogin(){
    if(document.getElementById("username").value == ""){
        alert("Please enter Username.");
        document.getElementById("username").focus();
        return false;
    }else if(document.getElementById("password").value == ""){
        alert("Please enter Password.");
        document.getElementById("password").focus();
        return false;
    }
    return true;
}

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

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