
		  function check_form(form)
		  {
			  if(!check_rent_type(form.vehicle) || !check_name(form.fname) || !check_name(form.lname) || !check_email(form.email) || !check_phone_2part(form.pin) || !check_phone_2part(form.area) || !check_phone_number(form.number) || !check_dates(form.date1,form.date2))
			  {
				  return false;
			  }
			  else
			  {
				  form.submit();
			  }
		  }
		  function check_rent_type(field)
		  {
			  checked_box=-1;
			  for(var i=0;i<field.length;i++)
			  {
				if(field[i].checked)
				{
					checked_box=i;
					break;
				}	
			  }
			  if(checked_box==-1)
			  {
				  alert('Plesae select a vehicle type');
				  return false;
			  }
			  else if(field[checked_box].value=='marketing')
			  {
				  return true;
			  }
			  else if(field[checked_box].value=='retail')
			  {
				  alert(' Sorry! \n Currenty we are only doing marketing vehicle. Please check back in the future');
				  return false;
			  }

			/*
			if(!field.checked)
			  {
				  alert('Plesae select a vehicle type');
			  }
			  else if(field.value=='marketing')
			  {
				  return true;
			  }
			  else if(field.value=='retail')
			  {
				  alert(' Sorry! \n Currenty we are only doing marketing vehicle. Please check back in the future');
				  return false;
			  }*/
		  }
		  function check_empty(field)
		  {
			  if(field.value.length == 0)
			  {
				  alert("Can not be empty");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  else
			  {
				  field.style.background = 'White';
				  return true;
			  }
		  }
		  
		  function check_name(field)
		  {
			  var cha = /[a-z,A-Z]/.test(field.value);
			  if(field.value.length == 0)
			  {
				  alert("Can not be empty");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  if(cha==false)
			  {
				  alert("Can only contain letters");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  else
			  {
				  field.style.background = 'White';
				  return true;
			  }
		  }
		  
		  function check_phone_2part(field)
		  {
			  var num = /[0-9]/.test(field.value)
			  if(field.value.length == 0)
			  {
				  alert("Can not be empty ");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  if(num==false)
			  {
				  alert("Can only contain letters");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  else
			  {
				  field.style.background = 'White';
				  return true;
			  }
		  }
		  
		  function check_phone_number(field)
		  {
			  var num = /[0-9]/.test(field.value);
			  if(field.value.length == 0)
			  {
				  alert("Can not be empty ");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  if(num==false)
			  {
				  alert("Can only contain numbers");
				  field.style.background = 'Yellow';
				  return false;
			  }
			  else
			  {
				  field.style.background = 'White';
				  return true;
			  }
		  }
		  
		  function check_email(field)
		  {
			  with (field)
				{
					apos=value.indexOf("@");
					dotpos=value.lastIndexOf(".");
					if (apos<1||dotpos-apos<2)
					{
						alert("Invalide Email");
						field.style.background = 'Yellow';
						return false;	
					}
					else 
					{
						field.style.background = 'White';
						return true;
					}
				}
		  }
		  

	      function check_dates(field1,field2)
			{
				var a = field1.value;
				var b = field2.value;
				var x=a.replace(/-/g,'');
				var y=b.replace(/-/g,'');
				
				var d = new Date();
				var curr_date = d.getDate();
				var curr_month = d.getMonth()+1;
				if(curr_month.length = 1)
				{
					curr_month = '0'+curr_month.toString();
				}
				
				
				var curr_year = d.getFullYear();
				var full_curr_date =  curr_year.toString()+curr_month.toString()+curr_date.toString();

				a = x*1;
				b = y*1;
				c = full_curr_date*1;
				
				if(a<c || a>b)
				{
					alert("Incoreect date selection");
					field1.style.background = 'Yellow';
					field2.style.background = 'Yellow';
					return false;
				}
				field1.style.background = 'White';
				field2.style.background = 'White';
				return true;
			}