// JavaScript Validation for new small Foreclosure Form, D.W. 07/09

	
	function isBlank(o) {
	if (o.value.length == 0) return true;
	for(var i = 0; i < o.value.length; i++) {
	var c = o.value.charAt(i);
	if (c != ' ' && c != '\n' && c != '\t') return false;
		}
	return true;
    }
	
	function isValidEmail(o) {
	if (isBlank(o)) return false;
	if (o.value.match(/^[a-z0-9_\-]+(\.[a-z0-9_\-]+)*@[a-z0-9_\-]+(\.[a-z0-9_\-]+)*(\.[a-z]{2,3})$/i) == null)
	return false;
	return true;
    }
	
	function validate(){
	var smallForm = document.sec_card;

	if (document.sec_card.fname.value =="") {
	alert("You Must Enter Your First Name.\n");
	document.sec_card.fname.focus();
	return false;
		}
    if (document.sec_card.lname.value =="") {
	alert("You Must Enter Your Last Name.\n");
	document.sec_card.lname.focus();
	return false;
		}
    if (document.sec_card.add1.value =="") {
	alert("You Must Enter Your Address(No P.O. Boxes).\n");
	document.sec_card.add1.focus();
	return false;
		}
	if ((document.sec_card.zip.value =="") || (document.sec_card.zip.value.length < 5) 
	|| (isNaN(document.sec_card.zip.value))){
	alert("You Must Enter 5 Digit ZIP Code.\n");
	document.sec_card.zip.focus();
	return false;
	}
	if (!isValidEmail(document.sec_card.email)) {
	alert("You Must Enter Your Valid Email Address.\n");
	document.sec_card.email.focus();
	return false;
		}
		
	/*if (!isValidEmail(document.sec_card.email2)) {
	alert("You Must Retype to Confirm Your Valid Email Address.\n");
	document.sec_card.email2.focus();
	return false;
		}
	if (document.sec_card.email.value !== document.sec_card.email2.value) {
	alert("Your email address must be the same in both fields.\nYou Must Retype to Confirm Your Valid Email Address.\n");
	document.sec_card.email2.focus();
	return false;
		}*/

    if ((document.sec_card.d_area.value =="") || (document.sec_card.d_area.value.length < 3)) {
	alert("You Must Enter Your 3 Digit Area Code.\n");
	document.sec_card.d_area.focus();
	return false;
		}
    if ((document.sec_card.d_pre.value =="") || (document.sec_card.d_pre.value.length < 3)){
	alert("You Must Enter The First 3 Digits of your Phone Number without dashes, periods or spaces.\n");
	document.sec_card.d_pre.focus();
	return false;
	}
	if ((document.sec_card.d_phone.value =="") || (document.sec_card.d_phone.value.length < 4)){
	alert("You Must Enter The last 4 Digits of your Phone Number without dashes, periods or spaces.\n");
	document.sec_card.d_phone.focus();
	return false;
			}

		if (document.sec_card.prof_help.selectedIndex =="") {
	alert("Please Make a Selection For Help with Credit Report Errors. If you do not want help please select no, thank you.\n");
	document.sec_card.prof_help.focus();
	return false;
		}
		
		if (document.sec_card.debt.selectedIndex =="") {
	alert("Please Make a Selection For Help with Debt. If you do not want help please select no, thank you.\n");
	document.sec_card.debt.focus();
	return false;
		}
		

}
