// JavaScript Document - Home Page Request an Estimate
//
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
function stripAlphaChars(pstrSource) 
{ 
var m_strOut = new String(pstrSource); 
    m_strOut = m_strOut.replace(/[^0-9]/g, ''); 
			// alert(m_strOut);
    return m_strOut; 
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
function IsNumeric(sText)
// from http://www.tedspence.com/index.php?entry=entry080626-093659
{
	var ValidChars = "0123456789";
				// alert(sText);
	for (i = 0; i < sText.length; i++) {
		if (ValidChars.indexOf(sText.charAt(i)) == -1) {
			return false;
		}
	}
	return true;
	}
	
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
function chkform() {
	
	msg = "";
	badCount = 0;
	goodchars = 0;
	f=document.estimatefrm;
	    
	msg = msg + "\nAll Fields Required. Please enter: ";
		
		if (f.name.value== "") {
			badCount = badCount + 1;
			msg = msg + "\nYour Full Name";
		}
// Phone
		if (f.phone.value == "") {
			badCount = badCount + 1;
			msg = msg + "\nPhone number";
		} else {
			tmp = f.phone.value;
			if (!IsNumeric(stripAlphaChars(tmp))) {
				msg = msg + "\nPhone Number";
			}
		}
// E-mail
    	if (f.email.value == "") {
			badCount = badCount + 1;
			msg = msg + "\nE-mail address";
		}
		if (f.email.value != "") {
	   		inputVal = f.email.value;
	   		inputStr = inputVal.toString()
    
   			for (var i = 0; i < inputStr.length; i++) { 
	    		var oneChar = inputStr.charAt(i) 
	      		if (oneChar == "." || oneChar == "@") { 
	         		goodchars = goodchars + 1;
	      		}  
	   		}
			if (goodchars <2) {
	   			badCount = badCount + 1;
				msg = msg + "\nEnter a valid E-mail address";
			}
		}		

// Target Move Date
    	if (f.date.value == "") {
			badCount = badCount + 1;
			msg = msg + "\nTarget Move Date";
		}
// 	Description

    	if (f.description.value == "") {
			badCount = badCount + 1;
			msg = msg + "\nDescription of Moving Needs";
		}
				
		if (f.currentstreet.value== "") {
			badCount = badCount + 1;
			msg = msg + "\nCurrent Street Address";
		}
		if (f.currentcsz.value== "") {
			badCount = badCount + 1;
			msg = msg + "\nCurrent City, State, Zip";
		}

		if (f.newstreet.value== "") {
			badCount = badCount + 1;
			msg = msg + "\nNew Street Address";
		}
		if (f.newcsz.value== "") {
			badCount = badCount + 1;
			msg = msg + "\nNew City, State, Zip";
		}

	if (badCount == 0) {
	   	return true;
	} else {
	   	alert (msg);
	   	return false;
	}
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
