function ValidateCode() {
    var sc1 = document.getElementById("hdnCode").value
    var sc2 = document.getElementById("confirm_code").value
    var blnReturn = false
    
    if (sc2 == "") {
        alert("Please enter the confirmation code")
        document.getElementById("confirm_code").focus()
    } else {
        if (sc1 == sc2) {
            blnReturn = true
        } else {
            alert("Sorry, the confirmation code you entered is incorrect")
            document.getElementById("confirm_code").select()
        }
    }
    
    return blnReturn
}

function validateApplication() {
	var blnReturn = false
	
	if(document.getElementById("txtPosition").value == "") {
		alert("Please enter the position you want to apply for");
		document.getElementById("txtPosition").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtLastName").value == "") {
		alert("Please enter your last name");
		document.getElementById("txtLastName").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtFirstName").value == "") {
		alert("Please enter your first name");
		document.getElementById("txtFirstName").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtAddress").value == "") {
		alert("Please enter your address");
		document.getElementById("txtAddress").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtEmail").value == "") {
		alert("Please enter your email address");
		document.getElementById("txtEmail").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtBirth").value == "") {
		alert("Please enter your date of birth");
		document.getElementById("txtBirth").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtName_notify").value == "") {
		alert("Please enter the name of the person we should contact in case of emergency");
		document.getElementById("txtName_notify").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtRelationship_notify").value == "") {
		alert("Please enter your relationship with the person you specified above");
		document.getElementById("txtRelationship_notify").focus();
		blnReturn = false;
	} else {
		blnReturn = true;
	}
	
	if (blnReturn) {
	    if(ValidateCode()) {
		    frm.submit();
		}
	}
}

function validateForm(frm) {
	var blnReturn = false;
	
	if (document.getElementById("txtShipperContact").value == "") {
		alert("Please enter shipper's contact");
		document.getElementById("txtShipperContact").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtShipperPhone").value == "") {
		alert("Please enter shipper's phone");
		document.getElementById("txtShipperPhone").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtShipperFax").value == "") {
		alert("Please enter shipper's fax");
		document.getElementById("txtShipperFax").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtShipperEmail").value == "") {
		alert("Please enter shipper's email");
		document.getElementById("txtShipperEmail").focus();
		blnReturn = false;
	} else 	if ((!document.getElementsByName("chkConfirmation")[0].checked)&&(!document.getElementsByName("chkConfirmation")[1].checked)) {
		alert("Please select where to send the confirmation");
		document.getElementsByName("chkConfirmation")[0].focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtConsigneeName").value == "") {
		alert("Please enter consignee's name");
		document.getElementById("txtConsigneeName").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtConsigneeAddress").value == "") {
		alert("Please enter consignee's address");
		document.getElementById("txtConsigneeAddress").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtConsigneePhone").value == "") {
		alert("Please enter consignee's phone");
		document.getElementById("txtConsigneePhone").focus();
		blnReturn = false;
	} else 	if (document.getElementById("txtConsigneePhone").value == "") {
		alert("Please enter consignee's phone");
		document.getElementById("txtConsigneePhone").focus();
		blnReturn = false;
	} else 	if ((!document.getElementsByName("chkHazardous")[0].checked)&&(!document.getElementsByName("chkHazardous")[1].checked)) {
		alert("Please select an answer if your packages are hazardous");
		document.getElementsByName("chkHazardous")[0].focus();
		blnReturn = false;
	} else 	if ((!document.getElementsByName("chkEdn")[0].checked)&&(!document.getElementsByName("chkEdn")[1].checked)) {
		alert("Please select an answer if you want us to provide EDN");
		document.getElementsByName("chkEdn")[0].focus();
		blnReturn = false;
	} else 	if ((!document.getElementsByName("chkCartage")[0].checked)&&(!document.getElementsByName("chkCartage")[1].checked)) {
		alert("Please select an answer if you want us to provide Cartage");
		document.getElementsByName("chkCartage")[0].focus();
		blnReturn = false;
	} else {
		blnReturn = true;
	}
	
	if(blnReturn) {
	    if(ValidateCode()) {
		    frm.submit();
		}
	}
}

function validateRequestForm(frm) {
	var blnReturn = false
	
	if(document.getElementById("txtCompany").value == "") {
		alert("Please enter your company name");
		document.getElementById("txtCompany").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtContact").value == "") {
		alert("Please enter your name");
		document.getElementById("txtContact").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtPhone").value == "") {
		alert("Please enter your phone number");
		document.getElementById("txtPhone").focus();
		blnReturn = false;
	} else 	if(document.getElementById("txtEmail").value == "") {
		alert("Please enter your email address");
		document.getElementById("txtEmail").focus();
		blnReturn = false;
	} else if ((!document.getElementsByName("chkNotify")[0].checked)&&
	            (!document.getElementsByName("chkNotify")[1].checked)&&
	            (!document.getElementsByName("chkNotify")[2].checked)) {
		alert("Please select where to notify");
		document.getElementsByName("chkNotify")[0].focus();
		blnReturn = false;
	} else {
		blnReturn = true;
	}
	
	if (blnReturn) {
	    if(ValidateCode()) {
		    frm.submit();
		}
	}
}