function ValidateForm(theForm)
{
 var error="";
 var FoundError = false;
 
 for (i = 0;  i < theForm.length;  i++){
 
 	if(theForm[i].value=="" && theForm[i].name.indexOf('RQ,') >= 0 ){
		
	var errorDisplay = theForm[i].name.replace('RQ,', '');
	errorDisplay = errorDisplay.replace('_', ' ');
 	error+="Please enter a value for the \"" + errorDisplay + "\" field.\n";
	
 
 	if(FoundError==false)
 	theForm[i].focus();
	
 	FoundError=true;
 	}
 else if(theForm[i].name.toLowerCase()=="rq,email" && ( theForm[i].value.indexOf('@') < 0 || theForm[i].value.indexOf('.') < 0 )){
	error+="Please enter a valid Email Address for the \"" +theForm[i].name.replace('RQ,', '') + "\" field.\n";
 	
	theForm[i].focus();
	FoundError=true;
	}
	
 
}


if(FoundError==false){
 for (i = 0;  i < theForm.length;  i++){
    if( theForm[i].name.indexOf('RQ,') >= 0 )
        theForm[i].name =  theForm[i].name.replace('RQ,', '');
	   }
  }
  
  
  if(FoundError == true){
      alert(error);
  
  return false;
  }
  
 
  //theForm.submit();
  return true;
}


function ValidateType(){
	
   var error="";
   var chkName="", typeName="", yearName;
   var oneSelected=false;
  // for (i = 1;  i < 20;  i++){
   for (i = 1;  i <= 2;  i++){

   chkName = 'document.frm.chkbox'+i+'.checked';
   typeName = 'document.frm.tax_id'+i+'.value';
   yearName = 'document.frm.tax_year'+i+'.value';
  
   if(eval(chkName)){
	   
	   if(eval(typeName)=='') error+=" Please select a type in row "+i+"\n";
	   if(eval(yearName)=='') error+=" Please select a year in row "+i+"\n";
	 
	 oneSelected = true;
   }
   
   }
   
   if(!oneSelected)
     error+=" Please select at least one plan \n";
	 
   //alert('err:'+error);
   if(error!=''){
	   alert(error);
	   document.frm.chkbox1.focus();
	   return false;
   }
 
  return true;
	
  }
  