function trim(strValue){
        // trim leading blank spaces
        var i;
        if (strValue == null) return null;
        if (strValue.length == 0) return strValue;
        for (i=0; i<strValue.length; i++) {
                if (strValue.charAt(i) != ' ')
                        return strValue.substr(i);
        }
        return "";
}


function validateInquiry(objForm){

	//if ( (objForm.ignore.checked == false) && trim(objForm.fileno.value) == ""){

	if(objForm.name == "inquiry"){
		if(objForm.from.value != objForm.from_confirm.value){
			alert('Email address do not match. Please confirm.');
			objForm.from_confirm.focus();
			objForm.from_confirm.select();
			return false;
		}
	}
	
	if ( trim(objForm.fileno.value) == ""){
		alert("Please enter your file number");
		objForm.fileno.focus();
		objForm.fileno.select();
		return false;
	}
	if ( trim(objForm.yourname.value) == ""){
		alert("Please enter your name");
		objForm.yourname.focus();
		objForm.yourname.select();
		return false;
	}
	// need to validate the format xxxx@xxxxx.xxx
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(objForm.from.value))){
		alert("Missing or incorrectly formatted email address");
		objForm.from.focus();
		objForm.from.select();
		return false;
	}
	if ( trim(objForm.phone.value) == ""){
		alert("Please enter a daytime phone number");
		objForm.phone.focus();
		objForm.phone.select();
		return false;
	}
	if ( trim(objForm.comments.value) == ""){
		alert("Please state your inquiry");
		objForm.comments.focus();
		objForm.comments.select();
		return false;
	}
	//pass all checks
	return true;
}

