// 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(){
		
	if (document.debtPost.fname.value =="") {
	alert("You Must Enter Your First Name.\n");
	document.debtPost.fname.focus();
	return false;
		}
    if (document.debtPost.lname.value =="") {
	alert("You Must Enter Your Last Name.\n");
	document.debtPost.lname.focus();
	return false;
		}
    if (document.debtPost.address.value =="") {
	alert("You Must Enter Your Street Address.\n");
	document.debtPost.address.focus();
	return false;
		}
	
    if ((document.debtPost.zip.value =="") || (document.debtPost.zip.value.length < 5) || isNaN(document.debtPost.zip.value)) {
	alert("You Must Enter Your 5 Digit ZIP Code.\n");
	document.debtPost.zip.focus();
	return false;
		}	

    if ((document.debtPost.home_ph_1.value =="") || (document.debtPost.home_ph_1.value.length < 3) || isNaN(document.debtPost.home_ph_1.value)) {
	alert("You Must Enter Your 3 Digit Area Code Numbers Only Without Dashes, Periods or Spaces.\n");
	document.debtPost.home_ph_1.focus();
	return false;
		}
    if ((document.debtPost.home_ph_2.value =="") || (document.debtPost.home_ph_2.value.length < 3) || isNaN(document.debtPost.home_ph_2.value)){
	alert("You Must Enter Your First 3 Digits of Your Phone Number without dashes, periods or spaces.\n");
	document.debtPost.home_ph_2.focus();
	return false;
		}
    if ((document.debtPost.home_ph_3.value =="") || (document.debtPost.home_ph_3.value.length < 4) || isNaN(document.debtPost.home_ph_3.value)) {
	alert("You Must Enter Your Last 4 Digits of Your Phone Number without dashes, periods or spaces.\n");
	document.debtPost.home_ph_3.focus();
	return false;
		}   	
		if (!isValidEmail(document.debtPost.email)) {
	alert("You Must Enter Your Email Valid Address.\n");
	document.debtPost.email.focus();
	return false;
		}
		if (document.debtPost.cc.selectedIndex == ""){
	alert("You Must Select Your Total Debt Amount.\n");
	document.debtPost.cc.focus();
	return false;
		}
	if ((document.debtPost.cc_debt_sett.checked == false) && (document.debtPost.cc_non_prof_cons.checked == false) && (document.debtPost.cc_bankruptcy.checked == false)){
	alert("You Must Select Which Solution Your Interested In.\n");
	document.debtPost.cc_debt_sett.focus();
	return false;
		}	

		return true;
	}
