function isNumber(inputStr, inputfld){
 var temp =true;
	for (var i = 0; i < inputStr.length; i++){
		var oneChar = inputStr.substring(i,i + 1);
		// alert(oneChar); 
		if (oneChar < "." || oneChar > "9") {
			alert("Please make sure Number of Years in Practice are number(s) only.");
                inputfld.focus()
                inputfld.select()
	   	temp = false;
	     	return temp;
			}
	    }
     return temp;

}

//check if email is valid

function ValidEmail(){
  var frmForm = document.forms[0]
  
  if(frmForm.txtEMail.value!=""){
     
   
      if (!(validEmail1(frmForm.txtEMail.value))) { 
      alert("Invalid email address")
      frmForm.txtEMail.focus()
      frmForm.txtEMail.select()
	}
  }
}


function validEmail1(email) {

			invalidChars = " /:,;"
	
			if (email == "") {
				return false
			}
			for (i=0; i<invalidChars.length; i++) {
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)
			if (atPos == -1) {
				return false
			}
			if (email.indexOf("@",atPos+1) > -1) {
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {
				return false
			}
			if (periodPos+3 > email.length)	{
				return false
			}
			return true
		}



function checkZip(zipfld){

var zipval = zipfld.value
reZIPCODE = /^\d{5}(\-\d{4})?$/

 if (zipval!=""){
    if (!(reZIPCODE.test(zipval)))  {
       
          alert('Zip Code is in wrong format.');
          zipfld.focus()
          zipfld.select()
    }

  }
 
}


function validatenumber(numfld){

var numval = numfld.value
reNum = /^[0-9]+(([\.\,][0-9]+)+)?$/

    if (!(reNum.test(numval)))  {
         // alert('Please check your entry');
          //numfld.focus()
          //numfld.select()
   }

}



function ValidPhone(phonefld){
var phoneval = phonefld.value
rePhone = /^\d{3}\-\d{3}\-\d{4}$/

 if (phoneval!=""){
    if (!(rePhone.test(phoneval)))  {
       
          alert('Phone is in wrong format. Format is xxx-xxx-xxxx');
          phonefld.focus()
          phonefld.select()
    }

  }
 
}



function verify_form(myform){

reMail = /^[A-Za-z0-9_']+([\.-]?[A-Za-z0-9_']+)*@[A-Za-z0-9_']+([\.-]?[A-Za-z0-9_']+)*(\.\w{2,4})+$/

rePhone = /^\d{3}\-\d{3}\-\d{4}$/
reZIP = /^\d{5}(\-\d{4})?$/

reNum = /^[0-9]+(([\.\,][0-9]+)+)?$/


 var strErrMsg = "";

if (myform.txtFName.value == ""){
	
           strErrMsg+="\n    * First Name must be provided .\n";
}

if (myform.txtLName.value == ""){
	   
	   strErrMsg+="\n    * Last Name must be provided .\n";
}

if (myform.txtAddress1.value == ""){
	  
	   strErrMsg+="\n    * Address must be provided .\n";
}

if (myform.txtCity.value == ""){
	strErrMsg+="\n    * City must be provided .\n";
}

if (myform.cboState.options[myform.cboState.selectedIndex ].text == ""){
        strErrMsg+="\n    * State must be provided .\n";

}

if((myform.txtZIP.value == "" )||(!(reZIP.test(myform.txtZIP.value)))){
       
        strErrMsg+="\n    * Please check Zip Code field .\n";
}

if((myform.txtEMail.value == "" )||(!(reMail.test(myform.txtEMail.value)))){
        strErrMsg+="\n    * Please check Email field .\n";
   
}

if((myform.txtPhone1.value == "")||(!(rePhone.test(myform.txtPhone1.value)))){
           strErrMsg+="\n    * Please check Phone1 field .\n";
}

if (myform.cboLicenseLevel.options[myform.cboLicenseLevel.selectedIndex ].text == ""){
    
	strErrMsg+="\n    * License Level must be provided .\n";
}

if (myform.cboLicenseLevel.options[myform.cboLicenseLevel.selectedIndex ].text == "Other" && myform.txtOther.value == ""){
        strErrMsg+="\n    * Other License Level must be provided .\n";
}

if ((myform.txtOccur.value == "")||(!(reNum.test(myform.txtOccur.value)))){
	strErrMsg+="\n    * Please check Insurance Limits per Occurrence  .\n";
}

if ((myform.txtAggregate.value == "")||(!(reNum.test(myform.txtAggregate.value)))){
	strErrMsg+="\n    * Please check Insurance Limits Aggregate  .\n";
}

     if(strErrMsg != ""){
	alert("The following need(s) to be corrected:\n" + strErrMsg);
 

     }

		
      else
		{
			myform.txtSelect.value = "OK" 
                       	myform.submit()	
		}		

}