
function dealerindividual()
{
var status=0;
	var msg="Following field(s) need to be filled:\n\n";

    

	
	
	if(document.dealerfrm.companyaddress.value=="")
	{
		document.getElementById("companyaddresserror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.companyaddress.value!="")
	{
		document.getElementById("companyaddresserror").style.display = 'none';
		
	}
	
	if(document.dealerfrm.showromaddress.value=="")
	{
		document.getElementById("showromaddresserror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.showromaddress.value!="")
	{
		document.getElementById("showromaddresserror").style.display = 'none';
		
	}
	if(document.dealerfrm.companystate.value=="")
	{
		document.getElementById("companystateerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.companystate.value!="")
	{
		document.getElementById("companystateerror").style.display = 'none';
		
	}
	if(document.dealerfrm.companycity.value=="")
	{
		document.getElementById("companycityerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.companycity.value!="")
	{
		document.getElementById("companycityerror").style.display = 'none';
		
	}
	
	if(document.dealerfrm.comstdcode1.value=="")
	{
		document.getElementById("comstdcode1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comstdcode1.value!="")
	{
		document.getElementById("comstdcode1error").style.display = 'none';
		
	}
	
	
	if(document.dealerfrm.comstdcode1.value=="")
	{
		document.getElementById("comstdcode1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comstdcode1.value!="")
	{
		document.getElementById("comstdcode1error").style.display = 'none';
		
	}
	
	if(document.dealerfrm.comlandline1.value=="")
	{
		document.getElementById("comlandline1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comlandline1.value!="")
	{
		document.getElementById("comlandline1error").style.display = 'none';
		
	}
	
	if(document.dealerfrm.comstdcode4.value=="")
	{
		document.getElementById("comstdcode4error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comstdcode4.value!="")
	{
		document.getElementById("comstdcode4error").style.display = 'none';
		
	}
	if(document.dealerfrm.comfaxno.value=="")
	{
		document.getElementById("comfaxnoerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comfaxno.value!="")
	{
		document.getElementById("comfaxnoerror").style.display = 'none';
	
	}
	
	if(document.dealerfrm.comemailid1.value=="")
	{
		document.getElementById("comemailid1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.comemailid1.value!="")
	{
		document.getElementById("comemailid1error").style.display = 'none';
		
	}
	
	
		
	if(document.dealerfrm.contact1firstname.value=="")
	{
		document.getElementById("contact1firstnameerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1firstname.value!="")
	{
		document.getElementById("contact1firstnameerror").style.display = 'none';
		
	}
	if(document.dealerfrm.contact1lname.value=="")
	{
		document.getElementById("contact1lnameerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1lname.value!="")
	{
		document.getElementById("contact1lnameerror").style.display = 'none';
		
	}
	if(document.dealerfrm.contactperson1designation.value=="")
	{
		document.getElementById("contactperson1designationerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contactperson1designation.value!="")
	{
		document.getElementById("contactperson1designationerror").style.display = 'none';
		
	}
	
	if(document.dealerfrm.contact1mobileno1.value=="")
	{
		document.getElementById("contact1mobileno1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1mobileno1.value!="")
	{
		document.getElementById("contact1mobileno1error").style.display = 'none';
		
	}
	if(document.dealerfrm.contact1stdcode1.value=="")
	{
		document.getElementById("contact1stdcode1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1stdcode1.value!="")
	{
		document.getElementById("contact1stdcode1error").style.display = 'none';
		
	}
	
	if(document.dealerfrm.contact1landline1.value=="")
	{
		document.getElementById("contact1landline1error").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1landline1.value!="")
	{
		document.getElementById("contact1landline1error").style.display = 'none';
		
	}
	
	if(document.dealerfrm.contact1address.value=="")
	{
		document.getElementById("contact1addresserror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1address.value!="")
	{
		document.getElementById("contact1addresserror").style.display = 'none';
		
	}
	
	
	
	if(document.dealerfrm.contact1state.value=="")
	{
		document.getElementById("contact1stateerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1state.value!="")
	{
		document.getElementById("contact1stateerror").style.display = 'none';
		
	}
	
	
	if(document.dealerfrm.contact1city.value=="")
	{
		document.getElementById("contact1cityerror").style.display = 'block';
		status=1;
	}
	if(document.dealerfrm.contact1city.value!="")
	{
		document.getElementById("contact1cityerror").style.display = 'none';
		
	}

	
	
	//------------------------------------contact2 validation--------------------------------------------------
	
	
	
		
			
		
		
		if((document.getElementById("oldpassword").value!="")||(document.getElementById("newpassword3").value!="")||(document.getElementById("renewpassword").value!=""))
	{
		
		if(document.getElementById("oldpassword").value=="")
		 {
			 document.getElementById("oldpassworderrorreq").style.display='block';
			 status=1; 
		 }
		 
		 
		 if(document.getElementById("oldpassword").value!="")
		 {
			 document.getElementById("oldpassworderrorreq").style.display='none';
			 
		 }
		 
		 if(document.getElementById("newpassword3").value=="")
		 {
			 document.getElementById("newpassworderrorreq").style.display='block';
			 status=1; 
		 }
		 
		 if(document.getElementById("newpassword3").value!="")
		 {
			 document.getElementById("newpassworderrorreq").style.display='none';
			 
		 }
		 if(document.getElementById("renewpassword").value=="")
		 {
			 document.getElementById("renewpassworderrorreq").style.display='block';
			 status=1; 
		 }
		 if(document.getElementById("renewpassword").value!="")
		 {
			 document.getElementById("renewpassworderrorreq").style.display='none';
			  
		 }
	}
						
	
	

	
	if(status==1)
	{
	return false;
	}


}

function removedealervalidation(fname,errorname)
{
	var fieldname=fname;
	var errorname1=errorname;
	if(document.getElementById(fieldname).value!='')
	{
		
	document.getElementById(errorname1).style.display='none';
	}
	if((document.getElementById(fieldname).value!='')&&(fieldname=='comemailid1'))
	{
	var errorname1=errorname+"1";
	document.getElementById(errorname1).style.display='none';
	}
	
	
}




function ajaxFunctiondealer(statename,cityname)
{
	var cityname1=cityname;
	var statename1=statename;
	var ajaxRequest;  
	// The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
		  var restest=ajaxRequest.responseText;
		  var s=restest.split("--");
		 //alert(restest);
		  var len=s.length;
		  var i=0;
		  removeAllOptions(document.getElementById(cityname1));
		  addOption(document.getElementById(cityname1), "", "Select City", "");
			  while(i<len-1)
			  {
			  var pid=s[i++];
			  addOption(document.getElementById(cityname1), pid, pid);
			  }
	   }
	   document.getElementById(cityname1).focus();
	}
    //document.frm.locality.focus();
	
    var state = document.getElementById(statename1).value;

	var queryString = "?state=" + state;
	//alert(queryString);
	ajaxRequest.open("GET", "dealertime.php" + queryString, true);
	ajaxRequest.send(null); 
}



function checkdealermailid()
{
  //var field = form.email; // email field
  var str = document.dealerfrm.comemailid1.value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  if(document.dealerfrm.comemailid1.value!="")
  {
	  if (!reg1.test(str) && reg2.test(str)) 
	  { 
	  	   document.getElementById("comemailid1error").style.display = 'none';
		   document.getElementById("comemailid1error1").style.display = 'none';
		   
	  }
	  else
	  {
			document.getElementById("comemailid1error").style.display = 'none';
			document.getElementById("comemailid1error1").style.display = 'block';
			document.dealerfrm.comemailid1.value="";
			return false;
	  }
  }
}



function ajaxcheckdealeremailid(emailid1,emailiderror,emailiderror1,texthintid,sText)
{

	var ajaxRequest;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	  if(ajaxRequest.readyState == 4)
	  {
		if(ajaxRequest.responseText!='')
		{
			var texthintidval=texthintid;
		document.getElementById(texthintidval).innerHTML=ajaxRequest.responseText;
		
		document.getElementById(emailid).value="";
		document.getElementById(emailid).focus();
		}
		
	  }
	}
	
	var emailid=emailid1;
	var emailiderrornew=emailiderror
	var emailiderror1new=emailiderror1
   if(document.getElementById(emailid).value=="")
	{
		document.getElementById(emailiderrornew).style.display = 'block';
		return false;
	}
	else
	{
	 var str = document.getElementById(emailid).value; // email string
  var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  if(document.getElementById(emailid).value!="")
  {
	  if (!reg1.test(str) && reg2.test(str)) 
	  { 
	  	   document.getElementById(emailiderrornew).style.display = 'none';
		   document.getElementById(emailiderror1new).style.display = 'none';
		   
	  }
	  else
	  {
			document.getElementById(emailiderrornew).style.display = 'none';
			document.getElementById(emailiderror1new).style.display = 'block';
			document.getElementById(emailid).value="";
			return false;
	  }
  }
}
    
    //var emailid = document.dealerfrm.comemailid1.value;

	var queryString = "?emailid=" + emailid;
	//alert(queryString);
	ajaxRequest.open("GET", "checkdealeremailid.php" + queryString, true);
	ajaxRequest.send(null); 
}

function checkdealernumeric(inputname,errorval,errorval2)
{
var inputname1=inputname;
var inputval=document.getElementById(inputname1).value;
var errorvalue=errorval;
var errorval21=errorval2;

	if (isNaN(inputval))
	{ 
	    document.getElementById(errorvalue).style.display = 'none';
		document.getElementById(errorval21).style.display = 'block';
		document.getElementById(inputname1).value="";
		return false;
	}
	else
	{
		if((inputname1=='regionalmanagermobileno')&&(inputval.length!=10)||(inputname1=='contact1mobileno1')&&(inputval.length!=10)||(inputname1=='contact2mobileno1')&&(inputval.length!=10))
		{
		document.getElementById(errorval21).style.display = 'block';
		document.getElementById(errorvalue).style.display = 'none';
		document.getElementById(inputname1).value="";
		return false;	
		}
		else
		{
		
	document.getElementById(errorvalue).style.display = 'none';
	document.getElementById(errorval2).style.display = 'none';
		}
	}
}

function checkdealer2numeric(inputname,errorval)
{
var inputname1=inputname;
var inputval=document.getElementById(inputname1).value;
var errorvalue=errorval;

	if (isNaN(inputval))
	{ 
	   
		document.getElementById(errorvalue).style.display = 'block';
		document.getElementById(inputname1).value="";
		return false;
	}
	else
	{
		if((inputname1=='mobileno')&&(inputval.length!=10)||(inputname1=='contact1mobileno2')&&(inputval.length!=10)||(inputname1=='contact2mobileno2')&&(inputval.length!=10))
		{
		document.getElementById(errorvalue).style.display = 'block';
		document.getElementById(inputname1).value="";
		return false;	
		}
		else
		{
		
	document.getElementById(errorvalue).style.display = 'none';
	
		}
	}
}

function enableField()
{
	if(document.dealerfrm.accept.checked == false)
	{
	document.getElementById('Submitdealer').disabled = true;
	}
	if(document.dealerfrm.accept.checked == true)
	{
	document.getElementById('Submitdealer').disabled = false;
	}
}



function ajaxchecksms()
{

	var ajaxRequest;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	  if(ajaxRequest.readyState == 4)
	  {
	  
	  var restext=ajaxRequest.responseText;
	   var s=restext.split("_");
	   var respontext=s[0];
	   var randomno=s[1];
	 //  alert(randomno);
		document.getElementById("msgtext").style.display='none';
		document.getElementById("smsid").innerHTML=respontext;
		document.dealerfrm.newpassword.value=randomno;
		
	  }
	}
   var str = document.dealerfrm.contact1mobileno1.value;
	var element=document.getElementById('contact1mobileno1');
	var Expression = /^[0-9]+$/;
	var moblen=document.dealerfrm.contact1mobileno1.value.length;

	if(document.dealerfrm.contact1mobileno1.value!="")
  	{
	  if((str.match(Expression))&&(moblen==10)) 
	  { 
	  	   document.getElementById("contact1mobileno1error").style.display = 'none';
		   document.getElementById("contact1mobileno1error1").style.display = 'none';
		   
	  }
	  else
	  {		
	  		document.getElementById("contact1mobileno1error").style.display = 'none';
			document.getElementById("contact1mobileno1error1").style.display = 'block';
			document.dealerfrm.contact1mobileno1.value="";
			return false;
	  }
 	}
    var mobileno1 = document.dealerfrm.contact1mobileno1.value;

	var queryString = "?mobileno1=" + mobileno1;
	//alert(queryString);
	ajaxRequest.open("GET", "sendsms.php" + queryString, true);
	ajaxRequest.send(null); 
}
function checkgetpassword()
{
if((document.getElementById("password").value) != (document.getElementById("newpassword").value))
	{
	
		document.getElementById("getpasserror").style.display = 'block';
		document.dealerfrm.password.value="";
		
	}
	else
	{
	document.getElementById("getpasserror").style.display = 'none';
	}
}

function checkconfermpassword()
{
if((document.getElementById("password").value) != (document.getElementById("cpassword").value))
	{

		document.getElementById("cpasserror1").style.display = 'block';
		document.dealerfrm.cpassword.value="";
		
	}
	else
	{
	document.getElementById("cpasserror1").style.display = 'none';
	}
}

function setshowroomtext()
{
	if(document.getElementById("dealercategory").value=='New Car Workshop')
	{
		
	document.getElementById("showrommtext").innerHTML="Workshop Address";
	document.getElementById("eadofficetab").style.display='block';
	document.getElementById("sellcarcitystate").style.display='none';
	document.getElementById("usecarsregistertype").style.display='none';
	document.getElementById("usecarlocationtype").style.display='none';
	document.getElementById("usecarmakes").style.display='none';
	
	
	/*document.getElementById("multicitystatetext").innerHTML="Please mark cities where you can and are prepared to pick-up cars for Servicing";
	  
	document.getElementById("salesdealer").style.display='block';
	document.getElementById("salesdelval").style.display='block';
	
	document.getElementById("regionalma").style.display='block';
	
	document.getElementById("regionalmaval").style.display='block';
	
	document.getElementById("mobreginalval").style.display='block';
	document.getElementById("mobreginal").style.display='block';	
	document.getElementById("sellcarcitystate").style.display='block';
	
	document.getElementById("usedcarregistrationstate").disabled=true;
		document.getElementById("usedcarregistrationcity").disabled=true;
		document.getElementById("pregcar").disabled=true;
		document.getElementById("commregcar").disabled=true;
		document.getElementById("privatetwowheeler").disabled=true;
		document.getElementById("commercialtwowheeler").disabled=true;
		document.getElementById("usecarsregistertype").style.display='none';*/
	}
	if(document.getElementById("dealercategory").value=='New Car Showroom')
	{
		
		document.getElementById("multicitystatetext").innerHTML="Cities where you are permitted to Sell & Deliver new Cars";
		
		
	document.getElementById("showrommtext").innerHTML="Showroom Address";	
	
	document.getElementById("eadofficetab").style.display='block';
	document.getElementById("sellcarcitystate").style.display='block';
	document.getElementById("usecarsregistertype").style.display='block';
	document.getElementById("usecarlocationtype").style.display='block';
	document.getElementById("usecarmakes").style.display='block';
	
		
	}
	
	
	if(document.getElementById("dealercategory").value=='Independent Workshop')
	{
	
	document.getElementById("showrommtext").innerHTML="Shop Address";
	
		
	document.getElementById("eadofficetab").style.display='none';
	document.getElementById("sellcarcitystate").style.display='none';
	document.getElementById("usecarsregistertype").style.display='none';
	document.getElementById("usecarlocationtype").style.display='none';
	document.getElementById("usecarmakes").style.display='none';
	
		
		
		
	}
	if(document.getElementById("dealercategory").value=='Car Accessories Dealer')
	{
	document.getElementById("showrommtext").innerHTML="Shop Address";
	
	document.getElementById("eadofficetab").style.display='none';
	document.getElementById("sellcarcitystate").style.display='none';
	document.getElementById("usecarsregistertype").style.display='none';
	document.getElementById("usecarlocationtype").style.display='none';
	document.getElementById("usecarmakes").style.display='none';
	
		}
	if(document.getElementById("dealercategory").value=='RTO Agent')
	{
		
	document.getElementById("showrommtext").innerHTML="Shop Address";
	document.getElementById("multicitystatetext").innerHTML="States And Cities";
	
	
	document.getElementById("eadofficetab").style.display='none';
	document.getElementById("sellcarcitystate").style.display='block';
	document.getElementById("usecarsregistertype").style.display='none';
	document.getElementById("usecarlocationtype").style.display='none';
	document.getElementById("usecarmakes").style.display='none';

	
	}
	if(document.getElementById("dealercategory").value=='Affiliate')
	{
	document.getElementById("showrommtext").innerHTML="Shop Address";
	document.getElementById("eadofficetab").style.display='none';
	document.getElementById("sellcarcitystate").style.display='none';
	document.getElementById("usecarsregistertype").style.display='none';
	document.getElementById("usecarlocationtype").style.display='none';
	document.getElementById("usecarmakes").style.display='none';

	}
	
	
	
	
	if((document.getElementById("dealercategory").value=='Affiliate')||(document.getElementById("dealercategory").value=='Car Accessories Dealer'))
	{
		
		document.getElementById("sellcarcitystate").style.display='none';
	}
	
	
	if(document.getElementById("dealercategory").value=='Used Car Dealer')
	{
		
		
		document.getElementById("showrommtext").innerHTML="Showroom Address";
		
		document.getElementById("showrommtext").innerHTML="Showroom Address";
		
		
		document.getElementById("eadofficetab").style.display='none';
		document.getElementById("sellcarcitystate").style.display='none';
	document.getElementById("usecarsregistertype").style.display='block';
	document.getElementById("usecarlocationtype").style.display='block';
	document.getElementById("usecarmakes").style.display='block';
	
	}
	
	
}
 function chkcheckbox()
 {
	if((document.dealerfrm.accept.checked==true)&&(document.dealerfrm.accept2.checked==true))
	{
		document.getElementById("chkerror").style.display='none';
	}
	if((document.dealerfrm.accept.checked==false)||(document.dealerfrm.accept2.checked==false))
	{
	document.getElementById("chkerror").style.display='block';
	return false;
	}
 }
 
 
 
 
 function ajaxcheckorganization()
{

	var ajaxRequest;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	  if(ajaxRequest.readyState == 4)
	  {
	  
	  var restext=ajaxRequest.responseText;
	  if(restext!='')
	  {
		  
		 
		  document.getElementById("organizationcheckerror").innerHTML=restext;
	      document.getElementById("organization").value='';
	  }
		
	  }
	}
   
	
	if(document.dealerfrm.organization.value=="")
  	{
	document.getElementById("organizationerror").style.display = 'block';  
	return false;
 	}
	if(document.dealerfrm.organization.value!="")
  	{
	document.getElementById("organizationerror").style.display = 'none';  
	
 	}
    var organization = document.dealerfrm.organization.value;

	var queryString = "?organization=" + organization;
	//alert(queryString);
	ajaxRequest.open("GET", "checkorganization.php" + queryString, true);
	ajaxRequest.send(null); 
}



function checkoldpassword()
{

	var ajaxRequest;  // The variable that makes Ajax possible!
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e){
				// Something went wrong
				alert("Your browser browser is not compitable for the page on which you are working!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
	  if(ajaxRequest.readyState == 4)
	  {
	  
	  var restext=ajaxRequest.responseText;
	 
	  if(restext!='')
	   {
	   document.getElementById("oldpassworderror").innerHTML=restext;
	   document.dealerfrm.oldpassword.value='';
	   
	   }
	   else
	   {
	   document.getElementById("oldpassworderror").innerHTML="";
	   }
		
	  }
	}
 
	
    var oldpassword = document.dealerfrm.oldpassword.value;

	var queryString = "?oldpassword=" + oldpassword;
	
	ajaxRequest.open("GET", "checkoldpassword.php" + queryString, true);
	ajaxRequest.send(null); 
}


function checknewpassword()
{
	var newpassword1=document.dealerfrm.newpassword3.value;
	var renewpassword=document.dealerfrm.renewpassword.value;
	
	if(newpassword1!=renewpassword)
	{
		document.getElementById("renewpassworderror").style.display='block';
		document.dealerfrm.renewpassword.value='';
	}
	
	if(newpassword1==renewpassword)
	{
		document.getElementById("renewpassworderror").style.display='none';
		
	}
	
	
	
}
 
 
 function checkpasswordvalidate()
 {
	 var status=0;
	
	 if((document.getElementById("oldpassword").value!="")||(document.getElementById("newpassword3").value!="")||(document.getElementById("renewpassword").value!=""))
	{
		
		if(document.getElementById("oldpassword").value=="")
		 {
			 document.getElementById("oldpassworderrorreq").style.display='block';
			 status=1; 
		 }
		 if(document.getElementById("newpassword3").value=="")
		 {
			 document.getElementById("newpassworderrorreq").style.display='block';
			 status=1; 
		 }
		 if(document.getElementById("renewpassword").value=="")
		 {
			 document.getElementById("renewpassworderrorreq").style.display='block';
			 status=1; 
		 }
	}
	
	if(status==1)
	{
	return false;
	}

 }
