function validateSearch() {
	var msgText = "";
		
	
		if (document.search.vehicle_id){
			if (document.search.vehicle_type.value == "" && document.search.fyear.value == "" 
				&& document.search.tyear.value == "" && document.search.make.value == "" 
				&& document.search.price.value == "" && document.search.state.value == ""
				&& document.search.vehicle_length.value == "" && document.search.vehicle_id.value == "") 
				msgText += "Please select at least one search criteria.";
		
			}
		else
		{
			if (document.search.vehicle_type.value == "" && document.search.fyear.value == "" 
				&& document.search.tyear.value == "" && document.search.make.value == "" 
				&& document.search.price.value == "" && document.search.state.value == ""
				&& document.search.vehicle_length.value == "") 
				msgText += "Please select at least one search criteria.";
		
			}
		
	
	if (document.search.fyear.value && document.search.tyear.value){
		var min_year = document.search.fyear.value;
		var max_year = document.search.tyear.value;
		if (min_year > max_year) 
			{
				msgText += "\n - The minimum year must be less than the maximum year.";
			}
		}
	
	if (document.search.vehicle_id){
		if (isNaN(document.search.vehicle_id.value)) 
			{
				msgText += "\n - Vehicle ID must be numeric.";
			}
	}
	
	
	if (msgText != "")
		{
			alert(msgText);
			return false;
		} 
		else
		{
			if (document.search.keyword){
				var keyword = document.search.keyword.value;
								
				if (keyword != ""){
					document.search.keyword.value = keyword.replace("/", "_slash_");				
				}
			}
			return true;
		}
	}
	
function trim(strText) { 
   // this will get rid of leading spaces 
  		 while (strText.substring(0,1) == ' ') 
  	      strText = strText.substring(1, strText.length);	
  	 // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
   	    strText = strText.substring(0, strText.length-1);
   return strText;
  }

 
