//validate input on Information Request Form
function validate_rfq_input(form)
{
	if ( trim(form.name.value).length < 1 ) 
  	{
    	alert( "Please enter your name." );
	    form.name.focus();
		return false;
  	}
	
  	if ( trim(form.company.value).length < 1 ) 
  	{
    	alert( "Please enter the name of your company." );
    	form.company.focus();
		return false;
  	}
	
	if ( trim(form.phone.value).length < 1 && trim(form.email.value).length < 1 ) 
  	{
    	alert( "Please enter either your e-mail address or your phone number so that we can contact you with answers to your questions." );
    	form.phone.focus();
		return false;
  	}
	
  	if ( trim(form.message.value).length < 1 ) 
  	{
    	alert( "Please enter your question or message." );
		form.message.focus();
    	return false;
  	}

  	return true;
}

//removes leading and trailing spaces in the string passed in.
function trim( string_to_trim )
{ 
  while (string_to_trim.charAt(0) == " ")
  { 
    // remove leading spaces 
    string_to_trim = string_to_trim.substring(1); 
  } 
  
  while (string_to_trim.charAt(string_to_trim.length - 1) == " ")
  { 
    // remove trailing spaces 
    string_to_trim = string_to_trim.substring(0,string_to_trim.length - 1); 
  } 
  
  return string_to_trim; 
} 
