function form_validate_survey(theform)
{
//Name
	if(trim(document.getElementById("surveyName").value) == "Your First and Last Name" || trim(document.getElementById("surveyName").value)=="")
		{
			var formname = document.getElementById("survey");
			formname.surveyName.value = "";
			alert("Please enter Name");
			formname.surveyName.focus();
			return false;
		}
//Phone

	if(trim(document.getElementById("surveyPhone").value) == "")
		{ 
			var formname = document.getElementById("survey");
			formname.surveyPhone.value = "";
			alert("Please enter Phone");
			formname.surveyPhone.focus();
			return false;
			
		}
		if(trim(document.getElementById("surveyPhone").value) != "")
		{
			var formname = document.getElementById("survey");
			var phone = formname.surveyPhone.value;
			var stripped = phone.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) {
			    alert("Invalid Phone Number");
				formname.surveyPhone.focus();
				return false;
			}
    	}
//Email
	if(trim(document.getElementById("surveyEmail").value) == "Your Email Address" || trim(document.getElementById("surveyEmail").value)=="")
		{
			var formname = document.getElementById("survey");
			formname.surveyEmail.value = "";
			alert("Please enter Email");
			formname.surveyEmail.focus();
			return false;
		} 
		
	
		 if(trim(document.getElementById("surveyEmail").value) != "") 
		{
	     	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
 	 		//var address = document.forms[form_id].elements[email].value;
			var formname = document.getElementById("survey");
			var address = formname.surveyEmail.value;
   			if(reg.test(address) == false) 
			{
      			alert('Invalid Email Address');
				formname.surveyEmail.focus();
      			return false;
			}  
   		}
//Radio Button = radio1
	if (!checkRadio("survey","radio1"))
	{
    alert("Was your reservationist professional and courteous?");
	return false;
	}
//Radio Button = radio2
	if (!checkRadio("survey","radio2"))
	{
    alert("Was your reservationist knowledgable?");
	return false;
	}

//Radio Button = radio3
	if (!checkRadio("survey","radio3"))
	{
    alert("Was the vehicle clean (exterior and interior)?");
	return false;
	}
//Radio Button = radio4
	if (!checkRadio("survey","radio4"))
	{
    alert("Was the driver prepared?");
	return false;
	}

//Radio Button = radio5
	if (!checkRadio("survey","radio5"))
	{
    alert("Was the driver courteous and  professional?");
	return false;
	}
//Radio Button = radio6
	if (!checkRadio("survey","radio6"))
	{
    alert("Was the driver dressed professionally?");
	return false;
	}
//Radio Button = radio7
	if (!checkRadio("survey","radio7"))
	{
    alert("Was the ride smooth and relaxing?");
	return false;
	}
//Radio Button = radio8
	if (!checkRadio("survey","radio8"))
	{
    alert("Were receipts were delivered to you timely and accurately?");
	return false;
	}
//Radio Button = radio11
	if (!checkRadio("survey","radio11"))
	{
    alert("Would you use our service again?");
	return false;
	}
//Radio Button = radio12
	if (!checkRadio("survey","radio12"))
	{
    alert("Would you refer anyone to MTI?");
	return false;
	}
}


function trim(str) 
{
	return str.replace(/^\s+|\s+$/g,"");
}

function checkRadio (frmName, rbGroupName) {
 var radios = document[frmName].elements[rbGroupName];
 for (var i=0; i <radios.length; i++) {
  if (radios[i].checked) {
   return true;
  }
 }
 return false;
}