// JavaScript Document

function validateForm(form)
{
  if ( trim(form.fullname.value).length < 1 ) 
  {
    alert( "Please enter your name." );
	form.fullname.focus();
    return false;
  }
  
  if ( trim(form.phone.value).length < 1 && trim(form.cell.value).length < 1 ) 
  {
    alert( "Please enter either your home phone number or your cell phone number \nso that we can get back to you." );
	form.phone.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; 
} 

//Opens a pdf selected from a drop-down list
function openDir( form ) { 

	var newIndex = form.fieldname.selectedIndex; 

	if ( newIndex == 0 ) { 

		alert( "Please select a month!" ); 

	} else { 

		cururl = form.fieldname.options[ newIndex ].value; 

		window.top.location.assign( cururl ); 

	} 

} 