function check_form() {
	for (var i = 0; i < document.forms['rmaInfo'].elements.length; i++) {
		var FormElement = document.forms['rmaInfo'].elements[i].name
		 
	
		if (FormElement == "Company") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your company name!")
					return false
				}
			}

		if (FormElement == "first_name") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your first name!")
					return false
				}
			}
		if (FormElement == "last_name") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your last name!")
					return false
				}
			}
		if (FormElement == "address_1") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your address!")
					return false
				}
			}
		if (FormElement == "city") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your city!")
					return false
				}
			}
		

		if (FormElement == "state") {
				if (document.forms['rmaInfo'].elements[i].selectedIndex == 0)
				{
					alert("You must select a state!");
					return false
				}
			}
		

		if (FormElement == "zip") {
				if (document.forms['rmaInfo'].elements[i].value.length < 5)
				{
					alert("You must provide your 5-digit zip code!")
					return false
				}
			}	
		if (FormElement == "main_phone_") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your main phone number!")
					return false
				}
			}		

		if (FormElement == "model_numbers") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide the hatch model number!")
					return false
				}
			}		

		if (FormElement == "quantity_of_units_in_question") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide the quantity of units in question!")
					return false
				}
			}	
		
		if (FormElement == "ballast_date_codes") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0 && document.forms['rmaInfo'].date_of_installation.value.length == 0)
				{
					alert("You must provide the Date Code or Install Date!")
					return false
				}
			}
			
			if (FormElement == "date_of_installation") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0 && document.forms['rmaInfo'].ballast_date_codes.value.length == 0)
				{
					alert("You must provide the Date Code or Install Date!")
					return false
				}
			}
			
		if (FormElement == "failure_mode") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide the failure mode: cycling/flickering, wrong item received, will not start lamp, or other(specify)!")
					return false
				}
			}
			
		if (FormElement == "OB_Number") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your OB/CNM phone number!")
					return false
				}
			}					
	
			
		if (FormElement == "day_Area") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your daytime area code!")
					return false
				}
			}		
			
			
		if (FormElement == "day_Number") {
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must provide your daytime phone number!")
					return false
				}
			}		
			
		if (FormElement == "company_type") {
    
    	radio_button_checked = false;
	    for(j=0;j<4;j++) {
		     radio_set = document.forms['rmaInfo'].company_type[j];
		     if (radio_set.checked) radio_button_checked = true;
		    }
		    if(!radio_button_checked) {
		     alert('Please select your company type.')
		     return false;
		    } 
	   }
	   
	   if (FormElement == "partnershipAgreement") {
    		
	         if (!document.forms['rmaInfo'].partnershipAgreement.checked) {
      	      alert('Please check that you have read the Partnership Agreement');
		      return false;
    		}
		}	

			
		if (FormElement =="email") {
				var vlength
    			  	vlength=document.forms['rmaInfo'].elements[i].value.length-1
				if (document.forms['rmaInfo'].elements[i].value.length == 0)
				{
					alert("You must enter a valid email address.  Example:  Name@hatchtransformers.com")
					return false
				}

  				// Check for a valid email address (Does it contain a "@" and ".")
  				if(document.forms['rmaInfo'].elements[i].value.indexOf('@', 0) == -1 || document.forms['rmaInfo'].elements[i].value.indexOf('.',0)==-1)
				{
					alert("You must enter a valid email address.  Example:  Name@hatchtransformers.com")
					return false
				}
 				// Check for a valid email address ("@" or "." cannot be first character)
				if(document.forms['rmaInfo'].elements[i].value.charAt(0)=='@' || document.forms['rmaInfo'].elements[i].value.charAt(0)=='.')
				{
					alert("You must enter a valid email address.  Example:  Name@hatchtransformers.com")
					return false
				}
				// Check for a valid email address ("@" or "." cannot be last character)
				if(document.forms['rmaInfo'].elements[i].value.charAt(vlength)=='@' || document.forms['rmaInfo'].elements[i].value.charAt(vlength)=='.')
				{
					alert("You must enter a valid email address.  Example:  Name@hatchtransformers.com")
					return false
				}
  				// Check for a valid email address (Cannot have "@." or ".@")
				if(document.forms['rmaInfo'].elements[i].value.indexOf('@.')!=-1 || document.forms['rmaInfo'].elements[i].value.indexOf('.@')!=-1)
				{
					alert("You must enter a valid email address.  Example:  Name@hatchtransformers.com")
					return false
				}
			
			}
			
	
	}
	return true	

}
