// JavaScript Document

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 chkentries() {
   f=document.quotefrm;
   var badCount = 0;
   var goodchars = 0;
   var msg = "";

// First Name
 	if (f.first_name.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter your First Name.";
	}
	// Last Name
 	if (f.last_name.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter your Last Name.";
	}
	
// Company Name
	if (f.company.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter the name of your Company.";
	}
		
// Phone
	if (f.phone.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter the Phone number where you can be reached during the day.";
	} else {
		tmp = f.phone.value;
		if (!IsNumeric(stripAlphaChars(tmp))) {
			msg = msg + "\nEnter a valid Phone Number.";
		}
	}
	
//E-mail
    if (f.email.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter your E-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.";
		}
	}
	
// City
	if (f.city.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter the City where your company is located.";
	}

// State
	if ((f.state.value == "None Selected") || (f.state.value == "")){
		badCount = badCount + 1;
	    msg = msg + "\nEnter the State where your company is located.";
	}
	
// Material
	if (f.material.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter the Material.";
	}
	
// Job Description
	if (f.job.value == "") {
		badCount = badCount + 1;
		msg = msg + "\nEnter the Job Description and Requirements.";
	}
	
	if (badCount == 0) {
    	return true;
    } else {
    	alert (msg);
      	return false;
    }

} 
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&quotefrm
