// JavaScript Documentfunction trimAll(sString)

var d = new Date();
var curr_year = d.getFullYear();
function trimAll(sString)
{
	 while (sString.substring(0,1) == ' ')
	 {
	  sString = sString.substring(1, sString.length);
	 }
	 while (sString.substring(sString.length-1, sString.length) == ' ')
	 {
	  sString = sString.substring(0,sString.length-1);
	 }
	return sString;
}
function validateDealer()
{
	for (var i=0;i<document.dealerRegistration.elements.length;i++) 
	{
    	document.dealerRegistration.elements[i].style.backgroundColor="#FFFFFF";
    	
	}
 var missinginfo = "";
 if (trimAll(document.dealerRegistration.company_name.value) == "" || trimAll(document.dealerRegistration.company_name.value).length>150)
 {
 	 missinginfo += "\n Company Name ,";
  	document.dealerRegistration.company_name.style.backgroundColor="#ffe061"; 
 }
 
  if (document.dealerRegistration.street.value.length<3 || document.dealerRegistration.street.value.length>150)
  {
  	missinginfo += "\n Street Name where the Location of Vehicles is ,";
	document.dealerRegistration.street.style.backgroundColor="#ffe061"; 
  }
  else if(!(isNaN(document.dealerRegistration.street.value)))
  {
  	missinginfo += "\n Street must not Contain only Numbers ,";
	document.dealerRegistration.street.style.backgroundColor="#ffe061"; 
  }
  
  if(document.dealerRegistration.zip_code.value.length>0)
  {
		if ((document.dealerRegistration.zip_code.value.length<3)||(document.dealerRegistration.zip_code.value.length>8))
		{
		missinginfo += "\n Zip Code could not be smaller than 3 or greater then 8 ,";
		document.dealerRegistration.zip_code.style.backgroundColor="#ffe061"; 
		}
	  else  if(!(/^[a-zA-Z]*[0-9]{3,8}[a-zA-Z]*$/.test(document.dealerRegistration.zip_code.value)))
	  {
		missinginfo += "\n Zip Code is not correct ,"; 
		document.dealerRegistration.zip_code.style.backgroundColor="#ffe061"; 
	  }
  }
   if(document.dealerRegistration.po_box.value.length>0)
  {
	  if ((document.dealerRegistration.po_box.value.length<3)||(document.dealerRegistration.po_box.value.length>8))
	  {
	  missinginfo += "\n PO Box could not be smaller than 3 or greater than 8 ,";
	  document.dealerRegistration.po_box.style.backgroundColor="#ffe061"; 
	  }
	   else  if(!(/^[a-zA-Z]*[0-9]{3,8}[a-zA-Z]*$/.test(document.dealerRegistration.po_box.value)))
	  {
		missinginfo += "\n P.O Box is not correct ,"; 
		document.dealerRegistration.po_box.style.backgroundColor="#ffe061"; 
	  }
  }
 
  if (trimAll(document.dealerRegistration.city.value) == "" || (trimAll(document.dealerRegistration.city.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.dealerRegistration.city.value))))
  {
  missinginfo += "\n City ,";
  document.dealerRegistration.city.style.backgroundColor="#ffe061"; 
 
  }
 
  if (trimAll(document.dealerRegistration.country.value) == "" ) 
  {
  missinginfo += "\n Country ,";
  document.dealerRegistration.country.style.backgroundColor="#ffe061"; 
 	//$(document.getElementById("country")).css("backgroundColor","#ffe061");
  }
   if (trimAll(document.dealerRegistration.cc_phone.value) == "" )
  {
  missinginfo += "\n Country code for Phone ,";
  document.dealerRegistration.cc_phone.style.backgroundColor="#ffe061"; 
  }
  if (trimAll(document.dealerRegistration.phone_prefix.value) == "")
  {
  missinginfo += "\n Prefix for Phone ,";
  document.dealerRegistration.phone_prefix.style.backgroundColor="#ffe061"; 
  }
  else if(isNaN(document.dealerRegistration.phone_prefix.value) || (document.dealerRegistration.phone_prefix.value.length>8)||(document.dealerRegistration.phone_prefix.value.length<2))
  {
	  missinginfo += "\n Invalid Prefix for Phone ,";
  	document.dealerRegistration.phone_prefix.style.backgroundColor="#ffe061"; 
  }
  if (trimAll(document.dealerRegistration.phone_cq.value) == "")
  {
  missinginfo += "\n Phone for Customer Enquiry ,";
  document.dealerRegistration.phone_cq.style.backgroundColor="#ffe061"; 
  }
  else
  if(isNaN(document.dealerRegistration.phone_cq.value) || (document.dealerRegistration.phone_cq.value.length>10)||(document.dealerRegistration.phone_cq.value.length<4))
  {
  missinginfo += "\n Invalid Phone for Customer Enquiry ,";
  document.dealerRegistration.phone_cq.style.backgroundColor="#ffe061"; 
  }
  
  
  
  
  
 
  if (!(trimAll(document.dealerRegistration.prefix_add_phone.value) == ""))
  {
	  if(isNaN(document.dealerRegistration.prefix_add_phone.value) || (document.dealerRegistration.prefix_add_phone.value.length>8)||(document.dealerRegistration.prefix_add_phone.value.length<2))
	  {
		  missinginfo += "\n Invalid Prefix for Addtional Phone ,";
		document.dealerRegistration.prefix_add_phone.style.backgroundColor="#ffe061"; 
	  }
  }

  if (!(trimAll(document.dealerRegistration.add_phone_cq.value) == ""))
  {
  if(isNaN(document.dealerRegistration.add_phone_cq.value) || (document.dealerRegistration.add_phone_cq.value.length>10)||(document.dealerRegistration.add_phone_cq.value.length<4))
  	{
	  missinginfo += "\n Invalid Additioanl Phone No. ,";
  	document.dealerRegistration.add_phone_cq.style.backgroundColor="#ffe061"; 
  	}
  }
 
  
  
  
  
  
  
  
  
  
  if (trimAll(document.dealerRegistration.cc_fax.value) == "" )
  {
  missinginfo += "\n Country code for Fax ,";
  document.dealerRegistration.cc_fax.style.backgroundColor="#ffe061"; 
  }
  if (trimAll(document.dealerRegistration.prefix_fax.value) == "")
  {
  missinginfo += "\n Prefix for Fax ,";
  document.dealerRegistration.prefix_fax.style.backgroundColor="#ffe061"; 
  }
  else if(isNaN(document.dealerRegistration.prefix_fax.value) || (document.dealerRegistration.prefix_fax.value.length>8)||(document.dealerRegistration.prefix_fax.value.length<2))
  {
	 missinginfo += "\n Prefix for Fax is Invalid ,";
  document.dealerRegistration.prefix_fax.style.backgroundColor="#ffe061"; 
  }
  if (trimAll(document.dealerRegistration.fax_cq.value) == "")
  {
  missinginfo += "\n Fax for Customer Enquiry ,";
  document.dealerRegistration.fax_cq.style.backgroundColor="#ffe061"; 
  }
  else
 if(isNaN(document.dealerRegistration.fax_cq.value) || (document.dealerRegistration.fax_cq.value.length>10)||(document.dealerRegistration.fax_cq.value.length<4))
  {
  missinginfo += "\n Invalid Fax for Customer Enquiry ,";
  document.dealerRegistration.fax_cq.style.backgroundColor="#ffe061"; 
  }
  
   if (!(trimAll(document.dealerRegistration.prefix_mobile.value) == ""))
  {
	  if(isNaN(document.dealerRegistration.prefix_mobile.value) || (document.dealerRegistration.prefix_mobile.value.length>8)||(document.dealerRegistration.prefix_mobile.value.length<2))
	  {
		  missinginfo += "\n Invalid Prefix for Mobile Phone ,";
		document.dealerRegistration.prefix_mobile.style.backgroundColor="#ffe061"; 
	  }
  }

  if (!(trimAll(document.dealerRegistration.mobile_cq.value) == ""))
  {
  if(isNaN(document.dealerRegistration.mobile_cq.value) || (document.dealerRegistration.mobile_cq.value.length>10)||(document.dealerRegistration.mobile_cq.value.length<4))
  	{
	  missinginfo += "\n Invalid Mobie No. ,";
  	document.dealerRegistration.mobile_cq.style.backgroundColor="#ffe061"; 
  	}
  }
  
  
  
  
  
  
  
  if (trimAll(document.dealerRegistration.email_id.value) != "")
  {
 	if ((document.dealerRegistration.email_id.value.indexOf("@") < 1) || (document.dealerRegistration.email_id.value.indexOf(".") < 1))
	{
  	missinginfo += "\n Invalid Email Address ,";
	document.dealerRegistration.email_id.style.backgroundColor="#ffe061"; 
	}
  }
  if (trimAll(document.dealerRegistration.company_legal_form.value) == "")
  {
  missinginfo += "\n Company Name and Legal form ,";
  document.dealerRegistration.company_legal_form.style.backgroundColor="#ffe061"; 
  }
 	 
  	 if (trimAll(document.dealerRegistration.first_name.value) == "" || (trimAll(document.dealerRegistration.first_name.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.dealerRegistration.first_name.value))))
	 {
  	missinginfo += "\n First Name of Support Contact ,";
	document.dealerRegistration.first_name.style.backgroundColor="#ffe061"; 
	}
  	 if (trimAll(document.dealerRegistration.last_name.value) == "" || (trimAll(document.dealerRegistration.last_name.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.dealerRegistration.last_name.value))))
	{
  	missinginfo += "\n Last Name of Support Contact must Contain only alphabets ,";
	document.dealerRegistration.last_name.style.backgroundColor="#ffe061"; 
	}
	if (trimAll(document.dealerRegistration.email_4_admin.value) == "")
  	{
		missinginfo += "\n Email for Admin purpose,";
		document.dealerRegistration.email_4_admin.style.backgroundColor="#ffe061"; 
	}
  	else if ((document.dealerRegistration.email_4_admin.value.indexOf("@") < 1) || (document.dealerRegistration.email_4_admin.value.indexOf(".") < 1))
	{
  	missinginfo += "\n Invalid Email Address for Admin ,";
	document.dealerRegistration.email_4_admin.style.backgroundColor="#ffe061"; 
	}
	if (trimAll(document.dealerRegistration.business_currency.value) == "")
  	{
	missinginfo += "\n Please Select your Business Currency ,";
	document.dealerRegistration.business_currency.style.backgroundColor="#ffe061"; 
	}
	
  	if (trimAll(document.dealerRegistration.sole_owner.value) == "")
	{
  	missinginfo += "\n Sole Owner or appointed Manager ,";
  	document.dealerRegistration.sole_owner.style.backgroundColor="#ffe061"; 
	}
	if (trimAll(document.dealerRegistration.trade_register_location.value) == "")
	{
  	missinginfo += "\n Trade Register Location ,";
  	document.dealerRegistration.trade_register_location.style.backgroundColor="#ffe061"; 
	}
	else  if (trimAll(document.dealerRegistration.trade_register_location.value) == "" || (trimAll(document.dealerRegistration.trade_register_location.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.dealerRegistration.trade_register_location.value))))
	{
  	missinginfo += "\n Invalid TradeRegister Location ,";
	document.dealerRegistration.trade_register_location.style.backgroundColor="#ffe061"; 
	}
	if(document.dealerRegistration.trade_register_number.value=="")
	{
  	missinginfo += "\n Trade Register Number as shown on Documents ,";
	document.dealerRegistration.trade_register_number.style.backgroundColor="#ffe061"; 
	}
	else if ((document.dealerRegistration.trade_register_number.value.length<4) || (document.dealerRegistration.trade_register_number.value.length>15))
	{
  	missinginfo += "\n Invalid Trade Register Number ,";
  	document.dealerRegistration.trade_register_number.style.backgroundColor="#ffe061"; 
	}
	else if(!(/^[a-zA-Z]*[0-9]*[a-zA-Z]*[0-9]*$/.test(document.dealerRegistration.trade_register_number.value)))
	{
		missinginfo += "\n Invalid Trade Register Number ,";
  	document.dealerRegistration.trade_register_number.style.backgroundColor="#ffe061"; 
	}
	
  if(document.getElementById("yes").checked==true)
  {
	  if (trimAll(document.dealerRegistration.diff_street.value) == "")
	  {
  		missinginfo += "\n Street or P.O. Box For Different Address  ,";
	  	document.dealerRegistration.diff_street.style.backgroundColor="#ffe061"; 
	  }
		   if (trimAll(document.dealerRegistration.diff_city.value) == "" || (trimAll(document.dealerRegistration.diff_city.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.dealerRegistration.diff_city.value))))
  {
  missinginfo += "\n City For Different Address,";
  document.dealerRegistration.diff_city.style.backgroundColor="#ffe061"; 
  }
		if (trimAll(document.dealerRegistration.diff_country.value) == ""  )
  		{
			missinginfo += "\n Country For Different Address ,";
			document.dealerRegistration.diff_country.style.backgroundColor="#ffe061"; 
	  }
		if (trimAll(document.dealerRegistration.diff_cc_phone.value) == "" )
		{
  		missinginfo += "\n Country Code Phone For Different Address ,";
		document.dealerRegistration.diff_cc_phone.style.backgroundColor="#ffe061"; 
	  }
		if (trimAll(document.dealerRegistration.diff_prefix_phone.value) == "")
		{
  		missinginfo += "\n Prefix Phone For Different Address ,";
		document.dealerRegistration.diff_prefix_phone.style.backgroundColor="#ffe061"; 
	  }
	  else if(isNaN(document.dealerRegistration.diff_prefix_phone.value) || (document.dealerRegistration.diff_prefix_phone.value.length>8)||(document.dealerRegistration.diff_prefix_phone.value.length<2))
  		{
	 	missinginfo += "\n Prefix for Different Phone number is Invalid ,";
  		document.dealerRegistration.diff_prefix_phone.style.backgroundColor="#ffe061"; 
  		}
		if (trimAll(document.dealerRegistration.diff_phone.value) == "")
		{
  		missinginfo += "\n Phone Number For Different Address ,";
		 document.dealerRegistration.diff_phone.style.backgroundColor="#ffe061"; 
		}
		 else if(isNaN(document.dealerRegistration.diff_phone.value) || (document.dealerRegistration.diff_phone.value.length>10)||(document.dealerRegistration.diff_phone.value.length<4))
  		{
	  missinginfo += "\n Invalid Phone for different Address ,";
	  document.dealerRegistration.diff_phone.style.backgroundColor="#ffe061"; 
	  }
		if (trimAll(document.dealerRegistration.diff_cc_fax.value) == "")
  		{
		missinginfo += "\n Country code Fax For Different Address  ,";
		document.dealerRegistration.diff_cc_fax.style.backgroundColor="#ffe061"; 
		}
		if (trimAll(document.dealerRegistration.diff_prefix_fax.value) == "")
		{
  		missinginfo += "\n Prefix Fax For Different Address ,";
		document.dealerRegistration.diff_prefix_fax.style.backgroundColor="#ffe061"; 
		}
		else if(isNaN(document.dealerRegistration.diff_prefix_fax.value) || (document.dealerRegistration.diff_prefix_fax.value.length>8)||(document.dealerRegistration.diff_prefix_fax.value.length<2))
  		{
	 	missinginfo += "\n Prefix for Different Fax number is Invalid ,";
  		document.dealerRegistration.diff_prefix_fax.style.backgroundColor="#ffe061"; 
  		}
		if (trimAll(document.dealerRegistration.diff_fax.value) == "")
		{
  		missinginfo += "\n Fax Number For Different Address  ,";
		document.dealerRegistration.diff_fax.style.backgroundColor="#ffe061"; 
		}
		 else if(isNaN(document.dealerRegistration.diff_fax.value) || (document.dealerRegistration.diff_fax.value.length>10)||(document.dealerRegistration.diff_fax.value.length<4))
  		{
	  missinginfo += "\n Invalid Fax for Different Address ,";
	  document.dealerRegistration.diff_fax.style.backgroundColor="#ffe061"; 
	  }
  }
  if(document.dealerRegistration.agree.checked==0)
	missinginfo += "\n You must agree with Terms and Conditions ,";
  
// if (trimAll(document.dealerRegistration.email.value) == "")
 // missinginfo += "\n   Email Address";
//  else
 //if ((document.dealerRegistration.email.value.indexOf("@") < 1) || (document.dealerRegistration.email.value.indexOf(".") < 1))
 //  missinginfo += "\n   Invalid Email Address";
// if (trimAll(document.dealerRegistration.message.value) == "")
 // missinginfo += "\n   Message";


 if (missinginfo != "")
 {
	   alert("Please fill your data Correctly");
		arr=missinginfo.split(",");
		document.getElementById("errors").innerHTML="";
		document.getElementById("errors").style.border='2px solid';
		document.getElementById("errors_header").style.display = 'block'; 
		var i;
		
			for(i=0;i<(arr.length-1);i++)
		{
			document.getElementById("errors").innerHTML+=(i+1)+') '+arr[i]+"<br>";
		}
	  return false;
 }
 else
 {	
 	
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = (d.getMonth())+1;
	var curr_year = d.getFullYear();
	var completeDate=curr_year + "-" + curr_month + "-" + curr_date;
	
	document.getElementById("mydate").value = completeDate;
 	document.dealerRegistration.submit();
  	return true;
  }
}
//



function validateDealerLogin()
{
	
	if (trimAll(document.dealer_login.login_id.value) == "")
	{
  		alert (" You must enter your User Name ");
		return false;
	}
	if (trimAll(document.dealer_login.password.value) == "")
	{
  		alert (" You must enter your password ");
		return false;
	}
 	document.dealer_login.submit();
  	return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function forget_pwd()
{

	if (trimAll(document.forget_pw.email.value) == "" )
	{
  		alert (" You must enter your Email Address ");
		return false;
	}
	else if((document.forget_pw.email.value.indexOf("@") < 1) || (document.forget_pw.email.value.indexOf(".") < 1))
	{
		alert (" Invalid Email Address ");
		return false;
	}
	
	if (trimAll(document.forget_pw.cust_no.value) == "")
	{
  		alert (" You must enter your Customer Number ");
		return false;
	}
 	document.forget_pw.submit();
  	return true;
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////

function validateEditDealer()
{
	
	var missinginfo='';
	for (var i=0;i<document.editDealer.elements.length;i++) 
	{

document.editDealer.elements[i].style.backgroundColor="#FFFFFF";

		
		var e=document.editDealer.elements[i];
		//if(e=='sole_owner')
		var name=e.getAttribute('name');
		if(name=='sole_owner')
		if (trimAll(document.editDealer.sole_owner.value) == "")
		{
		missinginfo += "\n Sole Owner or appointed Manager ,";
		document.editDealer.sole_owner.style.backgroundColor="#ffe061"; 
		}
		if(name=='trade_register_location')
		{
			if (trimAll(document.editDealer.trade_register_location.value) == "")
			{
			missinginfo += "\n Trade Register Location ,";
			document.editDealer.trade_register_location.style.backgroundColor="#ffe061"; 
			}
			else  if (trimAll(document.editDealer.trade_register_location.value) == "" || (trimAll(document.editDealer.trade_register_location.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.editDealer.trade_register_location.value))))
			{
			missinginfo += "\n Invalid TradeRegister Location ,";
			document.editDealer.trade_register_location.style.backgroundColor="#ffe061"; 
			}
		}
		if(name=='trade_register_number')
		{
			if(document.editDealer.trade_register_number.value=="")
			{
			missinginfo += "\n Trade Register Number as shown on Documents ,";
			document.editDealer.trade_register_number.style.backgroundColor="#ffe061"; 
			}
			else if ((document.editDealer.trade_register_number.value.length<4) || (document.editDealer.trade_register_number.value.length>15))
			{
			missinginfo += "\n Invalid Trade Register Number ,";
			document.editDealer.trade_register_number.style.backgroundColor="#ffe061"; 
			}
			else if(!(/^[a-zA-Z]*[0-9]*[a-zA-Z]*[0-9]*$/.test(document.editDealer.trade_register_number.value)))
			{
				missinginfo += "\n Invalid Trade Register Number ,";
			document.editDealer.trade_register_number.style.backgroundColor="#ffe061"; 
			}
		}
			if(name=='company_name')
			{
				 if (trimAll(document.editDealer.company_name.value) == "")
				 {
					 missinginfo += "\n Name ,";
					document.editDealer.company_name.style.backgroundColor="#ffe061"; 
				 }
			}
			if(name=='first_name')
			{
			 if (trimAll(document.editDealer.first_name.value) == "" || (trimAll(document.editDealer.first_name.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.editDealer.first_name.value))))
				 {
				missinginfo += "\n First Name of Support Contact ,";
				document.editDealer.first_name.style.backgroundColor="#ffe061"; 
				}
			}
			if(name=='last_name')
			{
				 if (trimAll(document.editDealer.last_name.value) == "" || (trimAll(document.editDealer.last_name.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.editDealer.last_name.value))))
				{
				missinginfo += "\n Last Name of Support Contact must Contain only alphabets ,";
				document.editDealer.last_name.style.backgroundColor="#ffe061"; 
				}
			}
			
			if(name=='email_4_admin')
			{
				if (trimAll(document.editDealer.email_4_admin.value) == "")
				{
					missinginfo += "\n Email for Admin purpose,";
					document.editDealer.email_4_admin.style.backgroundColor="#ffe061"; 
				}
				else if ((document.editDealer.email_4_admin.value.indexOf("@") < 1) || (document.editDealer.email_4_admin.value.indexOf(".") < 1))
				{
				missinginfo += "\n Invalid Email Address for Admin ,";
				document.editDealer.email_4_admin.style.backgroundColor="#ffe061"; 
				}
			}
			if(name=='company_legal_form')
			{
			if (trimAll(document.editDealer.company_legal_form.value) == "")
			  {
			  missinginfo += "\n Company Name and Legal form ,";
			  document.editDealer.company_legal_form.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='street')
			{
				 if (document.editDealer.street.value.length<3)
				  {
					missinginfo += "\n Street Name where the Location of Vehicles is ,";
					document.editDealer.street.style.backgroundColor="#ffe061"; 
				  }
				  else if(!(isNaN(document.editDealer.street.value)))
				  {
					missinginfo += "\n Street must not Contain only Numbers ,";
					document.editDealer.street.style.backgroundColor="#ffe061"; 
				  }
			}
			if(name=='city')
			{
				if (trimAll(document.editDealer.city.value) == "" || (trimAll(document.editDealer.city.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.editDealer.city.value))))
			  {
				  
			  missinginfo += "\n City ,";
			  document.editDealer.city.style.backgroundColor="#ffe061"; 
			 
			  }
			}
			if(name=='country')
			{
				if (trimAll(document.editDealer.country.value) == "" ) 
				  {
				  missinginfo += "\n Country ,";
				  document.editDealer.country1.style.backgroundColor="#ffe061"; 
					//$(document.getElementById("country")).css("backgroundColor","#ffe061");
				  }
			}
			if(name=='cc_enquiry_phone')
			{
				if (trimAll(document.editDealer.cc_enquiry_phone.value) == "")
				  {
				  missinginfo += "\n Country code for Phone ,";
				  document.editDealer.cc_enquiry_phone.style.backgroundColor="#ffe061"; 
				  }
			}
			if(name=='prefixenquiry_phone')
			{
				if (trimAll(document.editDealer.prefixenquiry_phone.value) == "")
			  {
			  missinginfo += "\n Prefix for Phone ,";
			  document.editDealer.prefixenquiry_phone.style.backgroundColor="#ffe061"; 
			  }
			   else if(isNaN(document.editDealer.prefixenquiry_phone.value) || (document.editDealer.prefixenquiry_phone.value.length>8)||(document.editDealer.prefixenquiry_phone.value.length<2))
			  {
				  missinginfo += "\n Invalid Prefix for Phone ,";
				document.editDealer.prefixenquiry_phone.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='enquiry_phone')
			{
				 if (trimAll(document.editDealer.enquiry_phone.value) == "")
				  {
				  missinginfo += "\n Phone for Customer Enquiry ,";
				  document.editDealer.enquiry_phone.style.backgroundColor="#ffe061"; 
				  }
			  else
			  if(isNaN(document.editDealer.enquiry_phone.value) || (document.editDealer.enquiry_phone.value.length>10)||(document.editDealer.enquiry_phone.value.length<4))
			  {
			  missinginfo += "\n Invalid Phone for Customer Enquiry ,";
			  document.editDealer.enquiry_phone.style.backgroundColor="#ffe061"; 
			  }
			}
			
			
			
			if(name=='cc_enquiry_fax')

			{
				if (trimAll(document.editDealer.cc_enquiry_fax.value) == "" )
				  {
				  missinginfo += "\n Country code for fax ,";
				  document.editDealer.cc_enquiry_fax.style.backgroundColor="#ffe061"; 
				  }
			}
			if(name=='prefixenquiry_fax')
			{
				if (trimAll(document.editDealer.prefixenquiry_fax.value) == "")
			  {
			  missinginfo += "\n Prefix for fax ,";
			  document.editDealer.prefixenquiry_fax.style.backgroundColor="#ffe061"; 
			  }
			   else if(isNaN(document.editDealer.prefixenquiry_fax.value) || (document.editDealer.prefixenquiry_fax.value.length>8)||(document.editDealer.prefixenquiry_fax.value.length<2))
			  {
				  missinginfo += "\n Invalid Prefix for fax ,";
				document.editDealer.prefixenquiry_fax.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='enquiry_fax')
			{
				 if (trimAll(document.editDealer.enquiry_fax.value) == "")
				  {
				  missinginfo += "\n fax for Customer Enquiry ,";
				  document.editDealer.enquiry_fax.style.backgroundColor="#ffe061"; 
				  }
			  else
			  if(isNaN(document.editDealer.enquiry_fax.value) || (document.editDealer.enquiry_fax.value.length>10)||(document.editDealer.enquiry_fax.value.length<4))
			  {
			  missinginfo += "\n Invalid fax for Customer Enquiry ,";
			  document.editDealer.enquiry_fax.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='diff_street')
			{
				if (trimAll(document.editDealer.diff_street.value) == "")
				  {
					missinginfo += "\n Street or P.O. Box For Different Address  ,";
					document.editDealer.diff_street.style.backgroundColor="#ffe061"; 
				  }
		  
		
			}
			if(name=='diff_city')
			{
				 if (trimAll(document.editDealer.diff_city.value) == "" || (trimAll(document.editDealer.diff_city.value)).length<2 ||  !(/^[a-zA-Z]{2,40}\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*\s*(_|-|,)*[a-zA-Z]*$/.test(trimAll(document.editDealer.diff_city.value))))
				  {
				  missinginfo += "\n City For Different Address,";
				  document.editDealer.diff_city.style.backgroundColor="#ffe061"; 
				  }
			}
			
			if(name=='diff_country')
			{
				if (trimAll(document.editDealer.diff_country.value) == "" )
					{
						missinginfo += "\n Country For Different Address ,";
						document.editDealer.diff_country1.style.backgroundColor="#ffe061"; 
				  }
			}
			
			
			
			if(name=='diff_cc_diff_phone')
			{
				if (trimAll(document.editDealer.diff_cc_diff_phone.value) == "")
				  missinginfo += "\n Country code for Phone ,";
				  document.editDealer.diff_cc_diff_phone.style.backgroundColor="#ffe061"; 
				  }
			}
			if(name=='diff_prefix_diff_phone')
			{
				if (trimAll(document.editDealer.diff_prefix_diff_phone.value) == "")
			  {
			  missinginfo += "\n Prefix for Different Phone ,";
			  document.editDealer.diff_prefix_diff_phone.style.backgroundColor="#ffe061"; 
			  }
			   else if(isNaN(document.editDealer.diff_prefix_diff_phone.value) || (document.editDealer.diff_prefix_diff_phone.value.length>8)||(document.editDealer.diff_prefix_diff_phone.value.length<2))
			  {
				  missinginfo += "\n Invalid Prefix for Different Phone ,";
				document.editDealer.diff_prefix_diff_phone.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='diff_phone1')
			{
				
				 if (trimAll(document.editDealer.diff_phone1.value) == "")
				  {
				  missinginfo += "\n Phone for Customer Enquiry ,";
				  document.editDealer.diff_phone1.style.backgroundColor="#ffe061"; 
				  }
			  else if(isNaN(document.editDealer.diff_phone1.value) || (document.editDealer.diff_phone1.value.length>10)||(document.editDealer.diff_phone1.value.length<4))
			  {
			  missinginfo += "\n Invalid Phone for Customer Enquiry ,";
			  document.editDealer.diff_phone1.style.backgroundColor="#ffe061"; 
			  }
			}
			
			
			
			if(name=='diff_cc_diff_fax')
			{
				if (trimAll(document.editDealer.diff_cc_diff_fax.value) == "" )
				  {
				  missinginfo += "\n Country code for Phone ,";
				  document.editDealer.diff_cc_diff_fax.style.backgroundColor="#ffe061"; 
				  }
			}
			if(name=='diff_prefix_diff_fax')
			{
				if (trimAll(document.editDealer.diff_prefix_diff_fax.value) == "")
			  {
			  missinginfo += "\n Prefix for Different fax ,";
			  document.editDealer.diff_prefix_diff_fax.style.backgroundColor="#ffe061"; 
			  }
			   else if(isNaN(document.editDealer.diff_prefix_diff_fax.value) || (document.editDealer.diff_prefix_diff_fax.value.length>8)||(document.editDealer.diff_prefix_diff_fax.value.length<2))
			  {
				  missinginfo += "\n Invalid Prefix for Different fax ,";
				document.editDealer.diff_prefix_diff_fax.style.backgroundColor="#ffe061"; 
			  }
			}
			if(name=='diff_fax1')
			{
				 if (trimAll(document.editDealer.diff_fax1.value) == "")
				  {
				  missinginfo += "\n Different fax Number  ,";
				  document.editDealer.diff_fax1.style.backgroundColor="#ffe061"; 
				  }
			  else
			  if(isNaN(document.editDealer.diff_fax1.value) || (document.editDealer.diff_fax1.value.length>10)||(document.editDealer.diff_fax1.value.length<4))
			  {
			  missinginfo += "\n Invalid Different fax Number ,";
			  document.editDealer.diff_fax1.style.backgroundColor="#ffe061"; 
			  }
			}
			
		
	//}
	//alert (missinginfo);
	
	
	
		
	var m_names = new Array("January", "February", "March", 
	"April", "May", "June", "July", "August", "September", 
	"October", "November", "December");
	
	var d = new Date();
	var curr_date = d.getDate();
	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();
	var monthf=m_names[curr_month];
	//var completeDate=curr_date + "-" + m_names[curr_month] + "-" + curr_year;
	var curr_hour = d.getHours();
	var AorP=" ";
	
	if (curr_hour>=12)
	AorP="P.M.";
	else
	AorP="A.M.";
	
	if (curr_hour>=13)
	curr_hour-=12;
	
	if (curr_hour==0)
	curr_hour=12;
	
	
	var curr_min = d.getMinutes();
	if (curr_min<10)
	curr_min="0"+curr_min;
	var date_time= curr_hour +":"+ curr_min+ "  "+AorP+" "+curr_date+" " + m_names[curr_month] +" " +curr_year;
	document.editDealer.edit_date.value=date_time;
	//alert(document.editDealer.edit_date.value);
	if(missinginfo=='')
	{
		
		document.editDealer.submit();
		return true;
	}
	else 
	return false;
	
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function submit_offer_car1()
{
	
	for (var i=0;i<document.offer_car_1.elements.length;i++) 
	{
    	document.offer_car_1.elements[i].style.backgroundColor="#FFFFFF";
    	
	}
	var error=0;
	if( (trimAll(document.offer_car_1.month.value) == ''))
	{
		document.offer_car_1.month.style.backgroundColor="#ffe061";
		error=1;
	}
	
	if( (trimAll(document.offer_car_1.make.value) == ''))
	{
		document.offer_car_1.make.style.backgroundColor="#ffe061";
		error=1;
	}
	
	 if( !((trimAll(document.offer_car_1.year.value) >= 1900) && (trimAll(document.offer_car_1.year.value) <= curr_year)) )
	{
		document.offer_car_1.year.style.backgroundColor="#ffe061";
		error=1;
	}
	if(error==1)
	
	{
		alert("Please Enter Correct Information ");
		return false;
	}
	else
	document.offer_car_1.submit();
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function submit_offer_bike1()
{
	
	for (var i=0;i<document.offer_mc1.elements.length;i++) 
	{
    	document.offer_mc1.elements[i].style.backgroundColor="#FFFFFF";
    	
	}
	var error=0;
	if( (trimAll(document.offer_mc1.month.value) == ''))
	{
		document.offer_mc1.month.style.backgroundColor="#ffe061";
		error=1;
	}
	if ((trimAll(document.offer_mc1.varient.value)).length < 2 || (trimAll(document.offer_mc1.varient.value)).length>55)
 {
 	error=1;
  	document.offer_mc1.varient.style.backgroundColor="#ffe061"; 
 }
	if( (trimAll(document.offer_mc1.make.value) == ''))
	{
		document.offer_mc1.make.style.backgroundColor="#ffe061";
		error=1;
	}
	
	 if( !((trimAll(document.offer_mc1.year.value) >= 1900) && (trimAll(document.offer_mc1.year.value) <= curr_year)) )
	{
		document.offer_mc1.year.style.backgroundColor="#ffe061";
		error=1;
	}
	if(error==1)
	
	{
		alert("Please Enter Correct Information ");
		return false;
	}
	else
	document.offer_mc1.submit();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


