//functions checkfax() and verify() are used to verify data from users for the Letter of Invitation form

function checkfax()
	{
	if (document.invite.fax.value == "") {
		if (document.invite.sendfax.checked == false) {
			return true;
		}
		else {
			alert ("Fax number must be provided if you want \nto receive your invitation via fax.");
			document.invite.fax.focus();
			return false;
			}
		}
	}


function verify() {
  
     
	/* var obj = document.invite.sendby
	 var result = 0
     for(var i=0; i<obj.length; i++){
      if(obj[i].checked==true && obj[i].value=='fax') 
       {
       
      var first_char= document.invite.area.value
      var the_char = first_char.charAt(0);
       
         if(document.invite.area.value=="")
	      {
	       alert("Area Code must be specified.")
	       return false;
	     }
       
         if (the_char ==0)
          {
           alert('The area code cannot start with '+the_char+'.');
           return false;
          }
       
        if(!ValidateNo(document.invite.area.value,"1234567890")) 
         { 
          alert("Please enter numeric only for the Area Code"); 
           document.invite.area.focus(); 
           return false; 
          } 
        
         if(document.invite.area.value.length < 3) {
         alert('Area code must be at least 3 characters long.');
         return false;
         }  

        if(document.invite.fax.value=="")
	      {
	       alert("Fax# must be specified.")
	       return false;
	      }
	      
	   if(!ValidateNo(document.invite.fax.value,"1234567890")) 
         { 
         alert("Please enter numeric only for the Phone Number"); 
         document.invite.fax.focus(); 
         return false; 
        }  
          
	  if(document.invite.fax.value.length < 7) {
       alert('Number must be at least 7 characters long.');
        return false;
         }  
	    
	      
	     
}
  }*/


	if(document.invite.first_nm.value=="")
	 {
	  alert("First Name must be specified.")
	  return false;
	 }
	 
	 if(document.invite.last_nm.value=="")
	 {
	  alert("Last Name must be specified.")
	  return false;
	 }
	 
	 if(document.invite.address1.value=="")
	 {
	  alert("Address must be specified.")
	  return false;
	 }
	 if(document.invite.city.value=="")
	 {
	  alert("City must be specified.")
	  return false;
	 }
	 
	 if(document.invite.country.value=="")
	 {
	  alert("Country must be specified.")
	  return false;
	 }
	 
	
	 
	
	return true;
	
	}



function ValidateNo(NumStr, String) 
{ 
    for(var Idx=0; Idx<NumStr.length; Idx++) 
    { 
        var Char = NumStr.charAt(Idx); 
        var Match = false; 

        for(var Idx1=0; Idx1<String.length; Idx1++) 
        { 
            if(Char == String.charAt (Idx1)) 
                Match = true; 
        } 

        if (!Match) 
            return false; 
    } 
    return true; 
} 
 



function verifyRN()
{

 var objRN = document.rnform.sendby
	 var result = 0
     for(var i=0; i<objRN.length; i++){
     
     if((objRN[0].checked==false)&& (objRN[1].checked==false)&&(objRN[2].checked==false))
      { 
       alert("Please specifiy send by")
       return false;
      }
     
      if(objRN[i].checked==true && objRN[i].value=='fax') 
       {
        if(document.rnform.faxnum.value =="Not Available")
        {
        alert("The fax# is not available for this member");
        return false;
        }
       }
      if(objRN[i].checked==true && objRN[i].value=='email') 
       {
        if(document.rnform.email.value =="Not Available")
        {
        alert("The email address is not available for this member");
        return false;
        }  
       }  
    }

}



	
	
//prospectusverify() function is used to verify data from users for the Prospectus Request form
	
	function prospectusverify() {
	var themessage = "You are required to complete the following fields: ";	
	    
		if (document.prospectus.name.value=="") {
			themessage = themessage + " \n - Name";
		}
		if (document.prospectus.company.value=="") {
			themessage = themessage + " \n - Company";
		}
		if (document.prospectus.address.value=="") {
			themessage = themessage + " \n - Address";
		}
		if (document.prospectus.city.value=="") {
			themessage = themessage + " \n - City";
		}
		if (document.prospectus.state.value=="") {
			themessage = themessage + " \n - State";
		}
		if (document.prospectus.zip.value=="") {
			themessage = themessage + " \n - Zip";
		}
		if (document.prospectus.country.value=="") {
			themessage = themessage + " \n - Country";
		}
		if (document.prospectus.phone.value=="") {
			themessage = themessage + " \n - Phone";
		}
		//if (document.prospectus.fax.value=="") {
			//themessage = themessage + " \n - Fax";
		//}
		if (document.prospectus.email.value=="") {
			themessage = themessage + " \n - Email";
		}
		//if (document.prospectus.website.value=="") {
			//themessage = themessage + " \n - Web site";
		//}
		//if (document.prospectus.interest.value=="") {
			//themessage = themessage + " \n - Company's urologic product and/or interest";
		//}	
		
//		if((!document.prospectus.pastexhibitor.checked) && (!document.prospectus.directmail.checked)
//	         && (!document.prospectus.emailad.checked) && (!document.prospectus.wordofmouth.checked)
//	         && (!document.prospectus.other.checked)) 
//		{
//		    themessage = themessage + "\n - How did you hear about AUA?";
//		}	 
		 
//		if (document.prospectus.ifother.value=="") {
//		    if(document.prospectus.other.checked == false) {
//			return true;
//			}
//			else {
//			    alert ("Please provide other media from which you heard about AUA.");
//			document.prospectus.ifother.focus();
//			return false;
//			}
//		}
		
//		if((!document.prospectus.contactme.checked)) {
//		  themessage = themessage + "\n - Please check if you'd like us to contact you about exhibit and sponsorship opportunities.";
//		 }
				
						
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ") {
			document.prospectus.submit();
		   }
		else {
			alert(themessage);
		    return false;
	        }
    	}