function SubmitData1(field, event)
{
  var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  if (keyCode == 13)
  {
   validate();
   return false;
  }
  else
  {
	return true;
  }
}
function validate()
{
//alert ("test");
if (document.form1.make.value == "")
	{
	alert ("Please Select Make");
	document.form1.make.focus();
	return (false);
	}
if (document.form1.model.value == "")
	{
	alert ("Please Select Model");
	document.form1.model.focus();
	return (false);
	}	
if (document.form1.strZIP.value == "")
	{
	alert ("Please Enter ZIP");
	document.form1.strZIP.focus();
	return (false);
	}		
if (document.form1.strZIP.value != "")
	{
		//alert ("not null");
xmlhttp = createRequest();
if(xmlhttp != null)
{
//alert ("final");
var mid = document.form1.strZIP.value;
//alert (mid);
// call open with GET or POST, the URL, and true for asynchronous
xmlhttp.open("GET","ZIP_Details.php?zid="+mid+"&rand="+Math.random(1,10), true);
xmlhttp.onreadystatechange = callzip;
xmlhttp.send(null);
	}		
	}	
}


function createRequest()
{
	var reqObj = null;
	try {
	   reqObj = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (err)	{
	   try {
		reqObj = new ActiveXObject("Microsoft.XMLHTTP");
	   }
	   catch (err2) {
		try {
		   reqObj = new XMLHttpRequest();
		}
		catch (err3) {
		   reqObj = null;
		}
	   }
	}
	return reqObj;
}

function callback() 
{
//alert ("hello");
	if (xmlhttp.readyState == 4) {
	//alert(xmlhttp.readyState);
		//alert(xmlhttp.status);
	  if (xmlhttp.status == 200) {
	  var name = xmlhttp.responseText;
	  //alert (name);
	   var results = xmlhttp.responseText.split(",");
	//alert(results[0]);
	objLinkList 	= eval("document.form1.model");
	//objLinkList 	= eval("form1.model");
	objLinkList.length=1;
	//alert (objLinkList[0]);	
	//alert (results.length);
	//document.getElementById('Layer1').innerHTML = "<ul>";
	for(i=1;i<=results[0];i++)
	{
		objLinkList.length++;
		objLinkList[i].text =results[i];
		objLinkList[i].value = results[i];
		// Chenges for right side for Particular Make - Apr - 06//
//<a class=newstxt href='+escape(document.form1.make.value)+'_'+escape(results[i])+'_det.html>'+results[i]+'</a>
	//document.getElementById('Layer1').innerHTML +=  '<img src=images/ic.jpeg border=0/><a href="Variant_Details.php?mkCode='+document.form1.make.value+'&mdlName='+results[i]+'" class=newstxt>'+results[i]+'</a><br>';
	}
	
	////document.getElementById('carModelContainer').style.visibility = 'visible';
	//document.getElementById('Layer1').style.visibility = 'visible';
	//document.getElementById('Layer1').innerHTML += '</ul>';
	//alert(results);
	   }
      else {
         // an error occurred, handle it appropriately
      }
	}
}


function callzip() 
{
//alert ("hello");
	if (xmlhttp.readyState == 4)
	 {
	//alert(xmlhttp.readyState);
		//alert(xmlhttp.status);
	  if (xmlhttp.status == 200)
	   {
	  var name = xmlhttp.responseText;
	  if(name == "")
	  {
	  document.form1.action = "QuoteForm.php";
	  document.form1.method = "post";
	  document.form1.submit();
	  }
	  else
	  {
	  alert (name);
	  }
	   }
      else
	  {
	  //alert ("test");
      }
	}

}

function callchange()
{
	//alert ("test");
xmlhttp = createRequest();
if(xmlhttp != null)
{
//alert ("final");
var mid = document.form1.make.value;
//alert (mid);
// call open with GET or POST, the URL, and true for asynchronous
xmlhttp.open("GET","Model_Details.php?mid="+mid+"&rand="+Math.random(1,10), true);
xmlhttp.onreadystatechange = callback;
xmlhttp.send(null);
}

function focus1()
{
alert ("Focus");
}
}
<!-- Newsletter part -->
function submitFinal()
{
	if (document.subform2.fname.value == "")
	{
		alert ("First Name is Empty");
		document.subform2.fname.focus();
		return (false);
	}
	/*
	if (document.subform2.lname.value == "")
	{
		alert ("Last Name is Empty");
		document.subform2.lname.focus();
		return (false);
	}
	*/
	if (document.subform2.zip.value == "")
	{
		alert ("Zip Code is Empty");
		document.subform2.zip.focus();
		return (false);
	}
	//------------------
	if (document.subform2.emailid.value == "")
	{
		alert ("Email is Empty");
		document.subform2.emailid.focus();
		return (false);
	}
	if (document.subform2.emailid.value != "")
{
	var iChars = "!@#$%^&*()+=[]\\\;,/{}|\":<>?0123456789";
   	if (iChars.indexOf(document.subform2.emailid.value.charAt(1)) != -1)
    {
		alert ("Email Id should not start with an Numeric or special characters. \nThese are not allowed.\n Please remove them and try again.");
		document.subform2.emailid.focus();
		return false;
  	}
    if (document.subform2.emailid.value != "")
	{
		var at="@"
		var dot="."
		var str=document.subform2.emailid.value;
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1 || str.indexOf(dot)==-1)
		{
			   alert("Email-Id should have atleast one '@' and '.'")
			   document.subform2.emailid.focus();
			   return false
		}
		if (str.indexOf(at)==0 || str.indexOf(at)==lstr-1)
		{
			   alert("@ should be placed in correct postion")
			   document.subform2.emailid.focus();
			   return false
		}
		if (str.indexOf(dot)==0 || str.indexOf(dot)==lstr-1)
		{
 				alert("Please enter a valid emailid")
 				document.subform2.emailid.focus();
 				return false
		}
		if (str.indexOf(at,(lat+1))!=-1)
		{
 				alert("continous @ symbol is not allowed")
 				document.subform2.emailid.focus();
 				return false
		}
 		var varNextDot = ldot+1;
 		for(i=0; i<10; i++)
 		{
	 		if (str.indexOf(dot,(varNextDot))==varNextDot)
	 		{
		 	   alert("continuous . symbol is not allowed")
		 	   varNextDot=varNextDot+1;
		 	   document.subform2.emailid.focus();
		 	   return false
	 		 }
	 	 }

	 	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
 		 {
	 	    	alert("Please enter a valid emailid")
	 			document.subform2.emailid.focus();
	 			return false
		 }
	 	 if (str.indexOf(dot,(lat+2))==-1)
 		 {
	 			alert("Please enter a valid emailid")
	 			document.subform2.emailid.focus();
	 			return false
 		 }
		 else		 
		 {			
			//var chk = "<?= $checking ?>";
			//alert(chk);
			//return true;
			
		 }
	}

}
	if ((document.subform2.zip.value != "") && (document.subform2.emailid.value != ""))
	{
		alert ("not null");
		xmlhttp = createRequest();
			if(xmlhttp != null)
			{
				alert ("final");
				var mid = document.subform2.zip.value;
				var curemailid = document.subform2.emailid.value;
				alert (mid);
				alert (curemailid);
				// call open with GET or POST, the URL, and true for asynchronous
				xmlhttp.open("GET","email_zip_validation.php?zid="+mid+"&emailid="+curemailid+"&rand="+Math.random(1,10), true);
				xmlhttp.onreadystatechange = checkZipCode;
				xmlhttp.send(null);					
			}					
	}
	else
	{
					  alert ("arun");
	}
}			
//------------------

	function createRequest()
	{
		var reqObj = null;
		try {
		   reqObj = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (err)	{
		   try {
			reqObj = new ActiveXObject("Microsoft.XMLHTTP");
		   }
		   catch (err2) {
			try {
			   reqObj = new XMLHttpRequest();
			}
			catch (err3) {
			   reqObj = null;
			}
		   }
		}
		return reqObj;
	}

	function checkZipCode() 
	{
		//alert(xmlhttp.readyState);
		if (xmlhttp.readyState == 4)
		 {
			// alert ("check");
			   if (xmlhttp.status == 200)
			   {
			// alert(xmlhttp.status);				   
				  var name = xmlhttp.responseText;
				  var result = xmlhttp.responseText.split(",");						
							
				//alert("result 0 " + result[0]);
				//alert("result 1 " + result[1]);
				
					if((result[0] == "1") && (result[1] == "1"))
					{
						alert("Invalid Zip Code");
						alert("Email Already exist");
					}
					else if((result[0] == "0") && (result[1] == "1"))
					{
						alert("Email Already exist");
					}				
					else if((result[0] == "1") && (result[1] == "0"))
					{
						alert("Invalid Zip Code");				
					}					  
				}
			   else
			   {
				  //alert ("xmlhttptest");
			   }
		 }	
	}
<!-- end of newsletter part -->		

function ShowNewsSubFrm(value)
{

	if (document.getElementById('newstable').style.visibility=="" || document.getElementById('newstable').style.visibility=="hidden")
	{

			document.getElementById('newstable').style.visibility = 'visible'; 
			document.getElementById('newstable').style.position='static';
			document.getElementById('newstable1').style.visibility = 'visible'; 
			document.getElementById('newstable1').style.position='static';
	}
	else
	{
			document.getElementById('newstable').style.visibility = 'hidden';
			document.getElementById('newstable').style.position='absolute';
			document.getElementById('newstable1').style.visibility = 'hidden';
			document.getElementById('newstable1').style.position='absolute';
	}
}


