if (navigator.appName=="Netscape")
{
	isNav=true;
}

var other;

<!-- used make model -->
function usedFillMake(cboMake, cboModel, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	cboMake.options.length=0;
	for(i=0; i < usedMakeArray.split("|").length; i++)
	{
		sMake = usedMakeArray.split("|")[i];
		if (sDefaultMake == sMake) 
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		//if(flag)
		//{
			cboMake.selectedIndex = foundIndex;
			flag = false;
		//}		
	}
}

///////////////////////////////////// added by 23-11-06/////////////////////////////////////////

function submitForm(formElement){
 formElement.submit();
}


function usedFillModel(cboMake, cboModel, sDefaultModel)
{
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;

	for(i=0;i<usedModelArray[cboMake.selectedIndex].split("|").length;i++){
		
		sModel = usedModelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel)
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else
		{
			sDefault=false;
		}
		if(sDefault)
		{
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else
		{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag) {
		cboModel.options[foundIndex].selected = true;
		}
}


<!-- make model -->
function fillMake(cboMake, cboModel, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	cboMake.options.length=0;

	for(i=0; i < makeArray.split("|").length; i++)
	{
		sMake = makeArray.split("|")[i];
		if (sDefaultMake == sMake) 
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
			cboMake.options[i]=new Option(sMake, sMake);
		if(flag)
		{
			cboMake.selectedIndex = i;
			flag = false;
		}
			
	}
}

function fillModel(cboMake, cboModel, sDefaultModel)
{
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	cboModel.options.length=0;
	for(i=0;i<modelArray[cboMake.selectedIndex].split("|").length;i++){
		sModel = modelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel)
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else
		{
			sDefault=false;
		}
		if(sDefault)
		{
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else
		{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag) {
		cboModel.options[foundIndex].selected = true;
		}
}


<!-- make model trim -->
function fillNewMake(cboMake, cboModel, cboTrim, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	if (cboTrim.options.length > 1) {
		other = true;
	}
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	cboTrim.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboTrim.options[0] = new Option("Select a Variant","Select a Variant");

	cboMake.options.length=0;
	for(i=0; i < makeArray.split("|").length; i++){
		sMake = makeArray.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillNewModel(cboMake, cboModel, cboTrim, sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	cboTrim.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboTrim.options[0] = new Option("Select a Variant","Select a Variant");
	
	var a = fillNewModel.arguments;
	if (a.length > 4) {
		a[4].options.length=0;
		a[4].options[0] = new Option("Select a Colour","");
	}
			
	cboModel.options.length=0;
	for(i=0;i<modelArray[cboMake.selectedIndex].split("|").length;i++){
		sModel = modelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}

function fillNewTrim(cbomake, cboModel, cboTrim, sDefaultTrim){
	var sDefaultTrim, sTrim, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	if (cboTrim.options.length > 1) {
		other = true;
	}
	cboTrim.options.length=0;
	
	var a = fillNewTrim.arguments;
	if (a.length > 4) {
		a[4].options.length=0;
		a[4].options[0] = new Option("Select a Colour","");
	}

	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
		}
	}

	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
			for(j=0; j < modelArray[makeIndex].split("|").length; j++){
				sModel = modelArray[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}
	for(i=0;i<trimArray[makeIndex][modelIndex].split("|").length;i++){
		sTrim = trimArray[makeIndex][modelIndex].split("|")[i];

		if(sDefaultTrim == sTrim){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
			cboTrim.options[i]=new Option(sTrim,sTrim,sDefault,sDefault);
		}
		else{
			cboTrim.options[i]=new Option(sTrim,sTrim);
		}
	}
	if(flag){
		cboTrim.options[foundIndex].selected = true;
	}
	if(other){
		cboTrim.options[i]=new Option("Other","Other");
	}
}
 
function fillNewColor(cbomake, cboModel, cboColor, sDefaultColor){
	var sDefaultColor, sColor, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;
	
	cboColor.options.length=0;	
	cboColor.options[0] = new Option("Select a Colour","");
	
	var a = fillNewColor.arguments;
	if (a.length > 4) {
		a[4].options.length=0;
		a[4].options[0] = new Option("Select a Colour","");
	}
	
	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
		}
			
	}
	
	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
			for(j=0; j < modelArray[makeIndex].split("|").length; j++){
				sModel = modelArray[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}

	
	for(i=1;i<colorArray[makeIndex][modelIndex].split("|").length;i++){
		sColor = colorArray[makeIndex][modelIndex].split("|")[i];

		if(sDefaultColor == sColor){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboColor.options[i]=new Option(sColor,sColor,sDefault,sDefault);
		}
		else{
			cboColor.options[i]=new Option(sColor,sColor);
		}
	}
	if(flag){
		cboColor.options[foundIndex].selected = true;
	}
	
}
<!-------------------- Fill New Color as per make , model, variant  start---->

function fillNewQuoteColor(cbomake, cboModel, cboColor, sDefaultColor){
	var sDefaultColor, sColor, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;
	
	cboColor.options.length=0;
	cboColor.options[0] = new Option("Select a Colour","");	
			
	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake == makeArray.split("|")[i]){
			makeIndex = i;
			
			for(j=0; j < modelArray[makeIndex].split("|").length; j++){
				sModel = modelArray[makeIndex].split("|")[j];
				
				if(sModel == cboModel){
				modelIndex = j;
				   } 				
			}
		}
	}	
	
	for(i=1;i<colorArray[makeIndex][modelIndex].split("|").length;i++){
		sColor = colorArray[makeIndex][modelIndex].split("|")[i];

		if(sDefaultColor == sColor){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
		cboColor.options[i]=new Option(sColor,sColor,sDefault,sDefault);
			
		}
		else{
		cboColor.options[i]=new Option(sColor,sColor);
			
		}
	} 
}

<!-------------------- Fill New Color as per make , model, variant ends ---->

<!-- make State -->
function fillState(cboState, cboCity, sDefaultState)
{
	var sDefaultState, sDefault, sState;
	var foundIndex = 0, flag = false;
	cboState.options.length=0;
	
	for(i=0; i < stateArray.split("|").length; i++)
	{
		sState = stateArray.split("|")[i];
		if (sDefaultState == sState) 
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
			cboState.options[i]=new Option(sState, sState);
		if(flag)
		{
			cboState.selectedIndex = i;
			flag = false;
		}
			
	}
}

function fillCity(cboState, cboCity, sDefaultCity)
{
	var sDefaultCity, sModel, sDefault;
	var foundIndex = 0, flag = false;
	cboCity.options.length=0;
	for(i=0;i<cityArray[cboState.selectedIndex].split("|").length;i++){
		sModel = cityArray[cboState.selectedIndex].split("|")[i];
		if(sDefaultCity == sModel)
		{
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else
		{
			sDefault=false;
		}
		if(sDefault)
		{
			cboCity.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else
		{
			cboCity.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag) {
		cboCity.options[foundIndex].selected = true;
		}
}

<!-- validate Newcar by Price form -->

function validateNewcarbyprice(searchType){

	objForm = document.newcarbyprice;
	if (searchType == "Price")
	   {
		   if(objForm.prPrice.selectedIndex == 0)
			{
			alert("Please select a price range" );
			objForm.prPrice.focus();
			return false;			
			}
	   }
	else if (searchType == "Body Style")
	   {
		   if(objForm.cBody.selectedIndex == 0)
			{
			alert("Please select a body style" );
			objForm.cBody.focus();
			return false;			
			}
	   }
	else if (searchType == "Category")
	   {
		   if(objForm.cCategory.selectedIndex == 0)
			{
			alert("Please select a category" );
			objForm.cCategory.focus();
			return false;			
			}
	   }
	   
	
	
	if(objForm.cState.selectedIndex == 0){
		alert("Please select a state");
		objForm.cState.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	objForm.cType.value = searchType;
	return true;
}


function validateNewcarbypriceHome(){

	objForm = document.newcarbyprice;
	
	if(objForm.prPrice.selectedIndex == 0){
		alert("Please select a price range");
		objForm.prPrice.focus();
		return false;
	}  
	if(objForm.cState.selectedIndex == 0){
		alert("Please select a state");
		objForm.cState.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	return true;
}  

<!-- validate Rebates form -->
function validateRebates(){

	objForm = document.formRebates;
	
	if(objForm.cState.selectedIndex == 0){
		alert("Please select a state");
		objForm.cState.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
/*	if(objForm.cDealer.selectedIndex == 0){
		alert("Please Select a Dealer");
		objForm.cDealer.focus();
		return false;
	}*/
	
	return true;
}


<!-- validate Dealer Locator form -->
function validateDealerLocator(){

	objForm = document.formDealerLocator;
	
	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cState.selectedIndex == 0){
		alert("Please select a state");
		objForm.cState.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus(); 
		return false;
	}
	return true;
}


<!-- validate New Car Showcase form -->
function validateMakeModelStateCity(objForm){

	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.cModel.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	return true;
}


//similar function of old method validatenewcarsearch
function checkNewCarSearch(){
	objForm = document.formNewCarSearch;
	var isValid=true;
	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.cModel.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	
	if(isValid==true)
	submitCheckNewCarSearch();


}//end of function checkNewCarSearch

//used in buyCars.jsp
function submitCheckNewCarSearch(){
	var obj =document;
	var queryString="&cMake="+ obj.getElementById('cMake').value;
		queryString = queryString +"&cModel="+obj.getElementById('cModel').value;
		queryString = queryString +"&cCity="+obj.getElementById('cCity').value;
	document.formNewCarSearch.action="servlet/CarazooController?userAction=NEW_CAR_SEARCH"+queryString;
	document.formNewCarSearch.method="post";
	document.URL="servlet/CarazooController?userAction=NEW_CAR_SEARCH"+queryString;
	document.formNewCarSearch.submit();
	
}//end of submitNewCarByPrice method


//similar to method validateNewcarbypriceHome
function checkNewCarByPriceInHome(){
	//alert("Inside checkNewCarByPriceInHome");
	objForm = document.newcarbyprice;
	var isValid=true;
	if(objForm.prPrice.selectedIndex == 0){
		alert("Please select a price range");
		objForm.prPrice.focus();
		isValid=false;
		return false;
	}  
	if(objForm.cState.selectedIndex == 0){
		alert("Please select a state");
		objForm.cState.focus();
		isValid=false;
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		isValid=false;
		return false;
	}
	
	if(isValid==true)
	submitNewCarByPriceInHome();
	
}


function submitNewCarByPriceInHome()
{
	//alert("Inside submitNewCarByPriceInHome");
	var obj =document;
	var queryString="&prPrice="+ obj.getElementById('prPrice').value;
		queryString = queryString +"&cState="+obj.getElementById('cState').value;
		queryString = queryString +"&cCity="+obj.getElementById('cCity').value;
		queryString = queryString +"&newUsed="+obj.getElementById('newUsed').value;
		
	//alert(queryString);
	document.newcarbyprice.action="servlet/CarazooController?userAction=NEW_CAR_SEARCH_BY_PRICE"+queryString;
	document.newcarbyprice.method="post";
	document.URL="servlet/CarazooController?userAction=NEW_CAR_SEARCH_BY_PRICE"+queryString;
	
	document.newcarbyprice.submit();
}

//-Murugan addition ends


function checkUsedCarsInHome()
{
	objForm = document.formUsedCarSearch;
	var isValid=true;
	if(objForm.uMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.uMake.focus();
		isValid=false;
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		isValid=false;
		return false;
	}
	
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		isValid=false;
		objForm.uCity.focus();
		return false;
	}
	
	if(isValid==true)
		submitUsedCarsInHome();
}

function submitUsedCarsInHome()
{
	var obj =document;
	var queryString="&uMake="+ obj.getElementById('uMake').value;
		queryString = queryString +"&uModel="+obj.getElementById('uModel').value;
		queryString = queryString +"&uCity="+obj.getElementById('uCity').value;
		if(document.formUsedCarSearch.Certified.checked){
			queryString = queryString +"&Certified=YES";
		}else{
			queryString = queryString +"&Certified=NO";
		}
	document.formUsedCarSearch.action="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarSearch.method="post";
	document.URL="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarSearch.submit();

}

//same functionality as validatenewcarasearch
function checkAdvSearchNewCarsInHome()
{
	var isValid=true;
	objForm = document.formNewCarSearch;

	if(objForm.cMake.selectedIndex == 0 || objForm.cMake.selectedIndex == -1){
		alert("Please select a make");
		objForm.cMake.focus();
		isValid=false;
		return false;
	}
	if(objForm.cModel.selectedIndex == 0 || objForm.cModel.selectedIndex == -1){
		alert("Please select a model");
		objForm.cModel.focus();
		isValid=false;
		return false;
	}
	if(objForm.cState.selectedIndex == 0 || objForm.cState.selectedIndex == -1){
		alert("Please select a state");
		objForm.cState.focus();
		isValid=false;
		return false;
	}
	if(objForm.cCity.selectedIndex == 0 || objForm.cCity.selectedIndex == -1){
		alert("Please select a city");
		objForm.cCity.focus();
		isValid=false;
		return false;
	}

	if(isValid==true)
		submitAdvSearchNewCarsInHome();
}


function submitAdvSearchNewCarsInHome()
{
	var obj =document;
	var queryString="&cMake="+ obj.getElementById('cMake').value;
		queryString = queryString +"&cModel="+obj.getElementById('cModel').value;
		queryString = queryString +"&fromPrice="+obj.getElementById('fromPrice').value;
		queryString = queryString +"&toPrice="+obj.getElementById('toPrice').value;
		queryString = queryString +"&cState="+obj.getElementById('cState').value;
		queryString = queryString +"&cCity="+obj.getElementById('cCity').value;

		//alert(queryString);
	document.formNewCarSearch.action="servlet/CarazooController?userAction=NEW_CAR_SEARCH"+queryString;
	document.formNewCarSearch.method="post";
	document.URL="servlet/CarazooController?userAction=NEW_CAR_SEARCH"+queryString;
	document.formNewCarSearch.submit();

}

function checkUsedCarAdvSearch(){
//	alert("Inside checkUsedCarAdvSearch");
	var isValid=true;
	objForm = document.formUsedCarReSearch;
	
	if(objForm.uMake.selectedIndex == 0 || objForm.uMake.selectedIndex == -1){
		alert("Please select a make");
		objForm.uMake.focus();
		isValid=false;
		return false;
	}
	if(objForm.uModel.selectedIndex == 0 || objForm.uModel.selectedIndex == -1){
		alert("Please select a model");
		objForm.uModel.focus();
		isValid=false;
		return false;
	}
	if(objForm.uState.selectedIndex == 0 || objForm.uState.selectedIndex == -1){
		alert("Please select a state");
		objForm.uState.focus();
		isValid=false;
		return false;
	}
	if(objForm.uCity.selectedIndex == 0 || objForm.uCity.selectedIndex == -1){
		alert("Please select a city");
		objForm.uCity.focus();
		isValid=false;
		return false;
	}
	if(isValid==true)
		submitUsedCarAdvSearch();
}

function submitUsedCarAdvSearch()
{
		var obj =document;
		var queryString="&uMake="+ obj.getElementById('uMake').value;
		queryString = queryString +"&uModel="+obj.getElementById('uModel').value;
		queryString = queryString +"&fromYear="+obj.getElementById('fromYear').value;
		queryString = queryString +"&toYear="+obj.getElementById('toYear').value;
		queryString = queryString +"&fromPrice="+obj.getElementById('fromPrice').value;
		queryString = queryString +"&toPrice="+obj.getElementById('toPrice').value;
		queryString = queryString +"&fromMileage="+obj.getElementById('fromMileage').value;
		queryString = queryString +"&toMileage="+obj.getElementById('toMileage').value;
		queryString = queryString +"&uState="+obj.getElementById('uState').value;
		queryString = queryString +"&uCity="+obj.getElementById('uCity').value;
		queryString = queryString +"&uKeyword="+obj.getElementById('uKeyword').value;
		queryString = queryString +"&maxRecords="+obj.getElementById('maxRecords').value;
		if(document.formUsedCarReSearch.uWithImage.checked)
			queryString = queryString +"&uWithImage=YES";
		else
			queryString = queryString +"&uWithImage=NO";
		if(document.formUsedCarReSearch.Certified.checked)
			queryString = queryString +"&Certified=YES";
		else
		queryString = queryString +"&Certified=NO";
		
		//alert(queryString);
	document.formUsedCarReSearch.action="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarReSearch.method="post";
	document.URL="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarReSearch.submit();
}

function checkSellYourCarInHome(){
	//alert("Inside checkSellYourCarInHome");
	var isValid=true;
	objForm = document.formSellYourCar;
	var isValid=true;
	if(objForm.sellMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.sellMake.focus();
		isValid=false;
		return false;
	}
	if(objForm.sellModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.sellModel.focus();
		isValid=false;
		return false;
	}
	if(objForm.sellTrim.selectedIndex == 0){
		alert("Please select a variant");
		isValid=false;
		objForm.sellTrim.focus();
		return false;
	}
	if(isValid==true)
	submitSellYourCarSearchInHome();
}

function submitSellYourCarSearchInHome()
{
	var obj =document;
	var queryString="&sellMake="+ obj.getElementById('sellMake').value;
		queryString = queryString +"&sellModel="+obj.getElementById('sellModel').value;
		queryString = queryString +"&sellTrim="+obj.getElementById('sellTrim').value;
		
	//alert(queryString);
	document.formSellYourCar.action="servlet/CarazooController?userAction=SELL_YOUR_CAR"+queryString;
	document.formSellYourCar.method="post";
	document.URL="servlet/CarazooController?userAction=SELL_YOUR_CAR"+queryString;
	document.formSellYourCar.submit();

}

function checkPriceQuoteInHome()
{
	//alert("Inside checkPriceQuoteInHome");
	var isValid=true;
	objForm = document.formPriceQuote;
	
	if(objForm.Make.selectedIndex == 0){
		alert("Please select a  make");
		objForm.Make.focus();
		isValid=false;
		return false;
	}
	if(objForm.Model.selectedIndex == 0){
		alert("Please select a model");
		objForm.Model.focus();
		isValid=false;
		return false;
	}
	if(isValid==true)
		submitPriceQuoteInHome();
}

function submitPriceQuoteInHome()
{
	//alert("Inside submitPriceQuoteInHome");
	var obj =document;
	var queryString="&Make="+ obj.getElementById('Make').value;
	queryString = queryString +"&Model="+obj.getElementById('Model').value;
	document.formPriceQuote.action="servlet/CarazooController?userAction=GET_PRICE_QUOTE"+queryString;
	document.formPriceQuote.method="post";
	document.URL="servlet/CarazooController?userAction=GET_PRICE_QUOTE"+queryString;
	document.formPriceQuote.submit();
	//alert(queryString);
}

//similar to validateUsedCarMakeModelStateCity
function checkUsedCarInRightForm()
{
	//alert("Inside checkUsedCarInRightForm");
	var isValid=true;
	objForm = document.formUsedCarSearch;

	if(objForm.uMake.selectedIndex == 0){
		alert("Please Select a Make");
		objForm.uMake.focus();
		isValid=false;
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		isValid=false;
		return false;
	}
	if(objForm.uState.selectedIndex == 0){
		alert("Please select a state");
		objForm.uState.focus();
		isValid=false;
		return false;
	}
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		isValid=false;
		objForm.uCity.focus();
		return false;
	}
	
	if(isValid==true)
		submitcheckUsedCarInRightForm();
}

function submitcheckUsedCarInRightForm()
{
	//alert("Inside submitcheckUsedCarInRightForm");
	var obj =document;
	var queryString="&uMake="+ obj.getElementById('uMake').value;
	queryString = queryString +"&uModel="+obj.getElementById('uModel').value;
	queryString = queryString +"&uState="+obj.getElementById('uState').value;
	queryString = queryString +"&uCity="+obj.getElementById('uCity').value;
	queryString = queryString +"&fromPrice="+obj.getElementById('fromPrice').value;
	queryString = queryString +"&toPrice="+obj.getElementById('toPrice').value;
	queryString = queryString +"&fromYear="+obj.getElementById('fromYear').value;
	queryString = queryString +"&toYear="+obj.getElementById('toYear').value;

	//if(obj.getElementById('advancedSearchOn').value=="ON"){
		queryString = queryString +"&fromMileage="+obj.getElementById('fromMileage').value;
		queryString = queryString +"&toMileage="+obj.getElementById('toMileage').value;
		queryString = queryString +"&maxRecords="+obj.getElementById('maxRecords').value;
		if(document.formUsedCarSearch.uWithImage.checked)
			queryString=queryString +"&uWithImage=YES";
		else
			queryString=queryString +"&uWithImage=NO";
		if(document.formUsedCarSearch.Certified.checked)
			queryString=queryString +"&Certified=YES";
		else
			queryString=queryString +"&Certified=NO";
	//}
	document.formUsedCarSearch.action="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarSearch.method="post";
	document.URL="servlet/CarazooController?userAction=USED_CAR_SEARCH"+queryString;
	document.formUsedCarSearch.submit();

}

//murugan addition ends

function validateMakeModelPin(){

	objForm = document.formPriceQuote;
	
	if(objForm.Make.selectedIndex == 0){
		alert("Please select a  make");
		objForm.Make.focus();
		return false;
	}
	if(objForm.Model.selectedIndex == 0){
		alert("Please select a model");
		objForm.Model.focus();
		return false;
	}
	/*if(objForm.PinCode.value != ""){
	if(objForm.PinCode.value!="Pin Code"){
		if(objForm.PinCode.value.length < 6 || objForm.PinCode.value.length > 6){
		alert("Pin code should be six digits only");
		objForm.PinCode.focus();
		return false;
		}
	}
	}*/
	return true;
}

<!-- validate make model Pin -->
function validatenewcarsearch(){

	objForm = document.formNewCarSearch;
	
	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.cModel.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	
	/*if(objForm.cPinCode.value != ""){
	if(objForm.cPinCode.value!="Pin Code"){
		if(objForm.cPinCode.value.length < 6 || objForm.cPinCode.value.length > 6){
		alert("Pin code should be six digits only");
		objForm.cPinCode.focus();
		return false;
		}
	}
	}*/
   // document.getElementById(id).href = "servlet/CarazooController?userAction="+NEW_CAR_SEARCH+"&cMake="+objForm.cMake.value;
//alert("servlet/CarazooController?userAction=NEW_CAR_SEARCH&cMake="+objForm.cMake.value);
//window.opener.document.location="servlet/CarazooController?userAction=NEW_CAR_SEARCH&cMake="+objForm.cMake.value;	
//window.document.location.replace("servlet/CarazooController?userAction=NEW_CAR_SEARCH&cMake="+objForm.cMake.value);
return true;
}

<!-- validate make model Pin -->
function validatenewcarasearch(){

	objForm = document.formNewCarSearch;

	if(objForm.cMake.selectedIndex == 0 || objForm.cMake.selectedIndex == -1){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cModel.selectedIndex == 0 || objForm.cModel.selectedIndex == -1){
		alert("Please select a model");
		objForm.cModel.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0 || objForm.cCity.selectedIndex == -1){
		alert("Please select a city");
		objForm.cCity.focus();
		return false;
	}
	return true;
}

<!-- validate price quote make model Pin -->
function validateMakeModelPin(){

	objForm = document.formPriceQuote;
	
	if(objForm.Make.selectedIndex == 0){
		alert("Please select a  make");
		objForm.Make.focus();
		return false;
	}
	if(objForm.Model.selectedIndex == 0){
		alert("Please select a model");
		objForm.Model.focus();
		return false;
	}
	/*if(objForm.PinCode.value != ""){
	if(objForm.PinCode.value!="Pin Code"){
		if(objForm.PinCode.value.length < 6 || objForm.PinCode.value.length > 6){
		alert("Pin code should be six digits only");
		objForm.PinCode.focus();
		return false;
		}
	}
	}*/
	return true;
}

<!-- Fiance formatt validation ##.## else #.### else .#### -->

function financeValidation()
{
	var finAmount = document.formPriceQuote.FinanceAmount.value;
	re = /^([0-9]*[0-9]+)*(\.[0-9]*[0-9])*$/;
		if(!finAmount.match(re)){
			alert("Please enter valid loan amount");
			document.formPriceQuote.FinanceAmount.focus()
			return false;
		}
		if(parseFloat(finAmount) > 100){
			alert("Loan amount cannot be more than 100%");
			document.formPriceQuote.FinanceAmount.focus()
			return false;
		}
		return true;
}

<!-- validate New Cars Price Quote Form -->//arvind
function validatePriceQuoteForm(variant){
	
	objForm = document.formPriceQuote;
	
if(variant == "" || variant == null)
	{	
	if(objForm.make.selectedIndex == 0){
		alert("Please select a  make");
		objForm.make.focus();
		return false;
	}
	if(objForm.model.selectedIndex == 0){
		alert("Please select a model");
		objForm.model.focus();
		return false;
	}
	if(objForm.variant.selectedIndex == 0){
		alert("Please select a  variant");
		objForm.variant.focus();
		return false;
	}
}

	objForm.FirstName.value = trim(objForm.FirstName.value);
	if (!isName(objForm.FirstName)){ 
		alert("Please enter first name");
		objForm.FirstName.focus();
		return false;
	}
	
	objForm.LastName.value = trim(objForm.LastName.value);
	if (!isName(objForm.LastName)){ 
		alert("Please enter last name");
		objForm.LastName.focus();
		return false;
	}

	objForm.FlatNo.value = trim(objForm.FlatNo.value);
	if (objForm.FlatNo.value == ""){ 
		alert("Please enter house no / flat no");
		objForm.FlatNo.focus();
		return false;
	}

	objForm.Street.value = trim(objForm.Street.value);
	if(objForm.Street.value == ""){
		alert("Please enter street");
		objForm.Street.focus();
		return false;
	}

	objForm.Locality.value = trim(objForm.Locality.value);
	if(objForm.Locality.value == ""){
		alert("Please enter area / locality");
		objForm.Locality.focus();
		return false;
	}
	/*if(objForm.State.selectedIndex == 0){
		alert("Please enter state / union territory");
		objForm.State.focus();
		return false;
	}*/
	if(objForm.City.selectedIndex == 0){
		alert("Please enter city");
		objForm.City.focus();
		return false;
	}

	objForm.zipCode.value = trim(objForm.zipCode.value);
	if(objForm.zipCode.value.length < 6)
	{
		alert("Please enter a 6 digit pincode");
		objForm.zipCode.focus()
		return false;
	}

	if(objForm.zipCode.value != "")
	{
		var val = objForm.zipCode.value;
		if(parseInt(val) == 0) {
		alert("Please check the pincode you have entered")
		objForm.zipCode.focus()
		return false;
		}
		
	}

	objForm.WebuserEmailid.value = trim(objForm.WebuserEmailid.value);
	if(objForm.WebuserEmailid.value == ""){
		alert("Please enter e-mail id");
		objForm.WebuserEmailid.focus();
		return false;
	}

	if (objForm.WebuserEmailid.value!="" && !valid_email(objForm.WebuserEmailid.value) || !spaceCheck(objForm.WebuserEmailid)){ 
		alert("Please enter valid e-mail id");
		objForm.WebuserEmailid.focus();
		return false;
	}

	objForm.HomeStd.value = trim(objForm.HomeStd.value);
	objForm.OfficeStd.value = trim(objForm.OfficeStd.value);
	objForm.MobileNo.value = trim(objForm.MobileNo.value);
	objForm.OfficePhone.value = trim(objForm.OfficePhone.value);
	objForm.HomePhone.value = trim(objForm.HomePhone.value);
	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one contact number");
				objForm.HomeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.OfficePhone)){
			alert("Please enter office phone");
			objForm.OfficePhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomePhone)){
		alert("Please enter home phone");
		objForm.HomePhone.focus();
		return false;
	}

	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
	//alert(phoneLength);
	/*if((objForm.HomeStd.value != null || objForm.HomePhone.value != null) && parseInt(phoneLength) != 11)
	{
		if(parseInt(phoneLength) > 11 || parseInt(phoneLength) < 11)
		{
			alert("Please check the STD code and number you have entered");
			objForm.HomeStd.focus();
			return false;
		}
	}*/

	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}


	if(objForm.OfficeStd.value != "" || objForm.HomeStd.value == "" && objForm.MobileNo.value == "")
	{
		var phoneLength = objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.OfficeStd.focus();
			return false;
		}
		
	}
	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}

	if(objForm.PreferedContact.selectedIndex == 0){
		alert("Please select a preferred mode of contact");
		objForm.PreferedContact.focus();
		return false;
	}
	if(objForm.TimetoContact.selectedIndex == 0){
		alert("Please select the best time to contact");
		objForm.TimetoContact.focus();
		return false;
	}
	if(objForm.YourInterest.selectedIndex == 0){
		alert("Please select when do you plan to buy");
		objForm.YourInterest.focus();
		return false;
	}
	if(objForm.PaymentMode.selectedIndex == 0){
		alert("Please select a purchase method");
		objForm.PaymentMode.focus();
		return false;
	}
	if(document.getElementById('NeedFinanceYes').checked == true) {
			
		if(objForm.ApplicantCategory.selectedIndex == 0){
			alert("Please select an applicant category");
			objForm.ApplicantCategory.focus();
			return false;
		}

		if(objForm.NeedFinancefor.selectedIndex == 0){
			alert("Please select need loan for");
			objForm.NeedFinancefor.focus();
			return false;
		}
		if(objForm.FinanceAmount.value == "")
		{
		alert("Please enter loan amount");
		objForm.FinanceAmount.focus();
		return false;
		}
		if(objForm.FinanceAmount.value != "") {
			if(objForm.FinanceAmount.value.indexOf(".") == -1) {
				if(objForm.FinanceAmount.value.indexOf("0") == 0) {
					alert("Please enter valid loan amount");
					objForm.FinanceAmount.value = "";
					objForm.FinanceAmount.focus();
					return false;
				}
			}
		}
			//return false;
	}
	if(objForm.FinanceAmount.value != "" && !financeValidation())
	{
	objForm.FinanceAmount.focus();
	return false;
	}

	if(objForm.Comments.value.length > 500){
		alert("Please enter comments below 500 characters only");
		objForm.Comments.focus();
		return false;
	}
	return true;
}

<!-- validate New Cars More Info Form -->
function validateNewCarsMoreInfo(){	

	objForm = document.formNewCarsMoreInfo;
	
	if (!isName(objForm.nmFirstName)){ 
		alert("Please enter first name");
		objForm.nmFirstName.focus();
		return false;
	}
	if (!isName(objForm.nmLastName)){ 
		alert("Please enter last name");
		objForm.nmLastName.focus();
		return false;
	}

	if (!valid_email(objForm.nmEmail.value)){ 
		alert("Please enter e-mail id");
		objForm.nmEmail.focus();
		return false;
	}
	if (objForm.nmPhoneCode.value.length < 3){
		alert("Please enter phone number");
		objForm.nmPhoneCode.focus();
		return false;
	}
	if(objForm.nmPhoneCode.value!="" && !checkValidNumber(objForm.nmPhoneCode)){
		alert("Please enter valid phone number");
		objForm.nmPhoneCode.value = "";
		objForm.nmPhoneCode.focus();
		return false;
	}
	if (objForm.nmPhoneNo.value == ""){
		alert("Please enter phone number");
		objForm.nmPhoneNo.focus();
		return false;
	}
	if(objForm.nmPhoneNo.value!="" && !checkValidNumber(objForm.nmPhoneNo)){
		alert("Please enter valid phone number");
		objForm.nmPhoneNo.value = "";
		objForm.nmPhoneNo.focus();
		return false;
	}
	if(objForm.nmPinCode.value == ""){
		alert("Pincode should be six digits only");
		objForm.nmPinCode.focus();
		return false;
	}

	if(objForm.nmPinCode.value != "")
	{
		var val = objForm.nmPinCode.value;
		if(parseInt(val) == 0) {
		alert("Please check the pincode you have entered")
		objForm.nmPinCode.focus()
		return false;
		}
		
	}
	/*if(objForm.nmPinCode.value.length < 6 || objForm.nmPinCode.value.length > 6){
		alert("Please enter Valid Zip Code");
		objForm.nmPinCode.focus();
		return false;
	}*/
	return true;
}

<!-- validate Sell Your Car make model Trim -->
function validateSellYourCar(){

	objForm = document.formSellYourCar;
	
	if(objForm.sellMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.sellMake.focus();
		return false;
	}
	if(objForm.sellModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.sellModel.focus();
		return false;
	}
	if(objForm.sellTrim.selectedIndex == 0){
		alert("Please select a variant");
		objForm.sellTrim.focus();
		return false;
	}
	return true;
}

<!-- validate used make model Pin -->
function validateusedcarsearch(){

	objForm = document.formUsedCarSearch;
	
	if(objForm.uMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.uMake.focus();
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		return false;
	}
	
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.uCity.focus();
		return false;
	}
	return true;
}

<!-- Email alert validation-->
function validateusedcarsearch1(){

	objForm = document.formUsedCarSearch; 
	if(objForm.Year.selectedIndex == 0){
		alert("Please select a year");
		objForm.Year.focus();
		return false;
	}
	if(objForm.uMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.uMake.focus();
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		return false;
	}
	
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.uCity.focus();
		return false;
	}
		if(objForm.cMake.selectedIndex == 0){
		alert("Please select a new make");
		objForm.cMake.focus();
		return false;
	}
	if(objForm.cModel.selectedIndex == 0){
		alert("Please select a new model");
		objForm.cModel.focus();
		return false;
	}
	if(objForm.cCity.selectedIndex == 0){
		alert("Please select a new city");
		objForm.cCity.focus();
		return false;
	}
	return true;
}

<!-- validate Used Cars Price Quote Form -->
function validateContactus(){	
		objForm = document.contactus;
	if (objForm.pFirstName.value ==""){ 
		alert("Please enter first name");
		objForm.pFirstName.focus();
		return false;
	}	
				 
	if (objForm.pLastName.value ==""){ 
		alert("Please enter last name");
		objForm.pLastName.focus();
		return false;
	}

	objForm.pEmail.value = trim(objForm.pEmail.value);
	if(objForm.pEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.pEmail.focus();
		return false;
	}

	if (objForm.pEmail.value!="" && !valid_email(objForm.pEmail.value) || !spaceCheck(objForm.pEmail)){ 
		alert("Please enter valid e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	
	if(!isNotEmpty(objForm.pHomePhone1)){	
	
		alert("Please enter primary phone");
		objForm.pHomePhone1.focus();
		return false;
	}

	if(!isNotEmpty(objForm.pHomePhone2)){
		alert("Please enter primary phone");
		objForm.pHomePhone2.focus();
		return false;
	}

	var phoneLengthHome = objForm.pHomePhone1.value.length + objForm.pHomePhone2.value.length;

	if(isNotEmpty(objForm.pHomePhone2) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) > 11 || parseInt(phoneLengthHome) < 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.pHomePhone1.focus();
				return false;
			}
		}

	if(objForm.zipCode.value.length < 6)
	{
		alert("Please enter a 6 digit pincode");
		objForm.zipCode.focus()
		return false;
	}

	if(objForm.zipCode.value != "")
		{
			var val = objForm.zipCode.value;
			if(parseInt(val) == 0) {
			alert("Please check the pincode you have entered")
			objForm.zipCode.focus()
			return false;
			}
			
		}
	if(objForm.Comments.value.length > 500){
		alert("Please enter comments below 500 characters only");
		objForm.Comments.focus();
		return false;
	}
			return true;
			}
			
			
function goToNextPage()
{
var FileName = "/new-cars/newcar_pricerange.jsp?prPrice=" + document.getElementById('sPrice').value;
window.location = FileName;
}
function Searchbody()
{
var FileName = "/new-cars/newcar_bodystyle.jsp?prBodystyle=" + document.getElementById('sBody').value;
window.location = FileName;
}
function Searchcategory()
{
var FileName = "/new-cars/newcar_category.jsp?category=" + document.getElementById('sCategory').value;
window.location = FileName;
}

<!-- validateSellCarForm2 -->
function validateSellCarForm(){	
	

	objForm = document.formSellYourCarMore;
	
	objForm.pFirstName.value = trim(objForm.pFirstName.value);
	if (!isName(objForm.pFirstName)){ 
		alert("Please enter first name");
		objForm.pFirstName.focus();
		return false;
	}

	objForm.pLastName.value = trim(objForm.pLastName.value);
	if (!isName(objForm.pLastName)){ 
		alert("Please enter last name");
		objForm.pLastName.focus();
		return false;
	}

	objForm.pHouseNo.value = trim(objForm.pHouseNo.value);
	if (objForm.pHouseNo.value == ""){ 
		alert("Please enter house no / flat no");
		objForm.pHouseNo.focus();
		return false;
	}

	objForm.pStreet.value = trim(objForm.pStreet.value);
	if(objForm.pStreet.value == ""){
		alert("Please enter street");
		objForm.pStreet.focus();
		return false;
	}

	objForm.pArea.value = trim(objForm.pArea.value);
	if(objForm.pArea.value == ""){
		alert("Please enter area / locality");
		objForm.pArea.focus();
		return false;
	}
	/*
	if(objForm.pState.selectedIndex == 0){
		alert("Please select state / union territory");
		objForm.pState.focus();
		return false;
	}
	*/
	if(objForm.pCity.selectedIndex == 0){
		alert("Please select city");
		objForm.pCity.focus();
		return false;
	}
	
	objForm.pPin.value = trim(objForm.pPin.value);
	if(objForm.pPin.value.length < 6)
	{
		alert("Please enter 6 digit pincode");
		objForm.pPin.focus()
		return false;
	}

	if(objForm.pPin.value != "")
		{
			if(!validNumericsOnSubmit(objForm.pPin,'pincode')) {
			return false;
		}
			var val = objForm.pPin.value;
			if(parseInt(val) == 0) {
			alert("Please check the pincode you have entered")
			objForm.pPin.focus()
			return false;
			}			
		}
	objForm.pEmail.value = trim(objForm.pEmail.value);
	if(objForm.pEmail.value == ""){
		alert("Please enter a e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	if (objForm.pEmail.value!="" && !valid_email(objForm.pEmail.value)){ 
		alert("Please enter a valid e-mail id");
		objForm.pEmail.focus();
		return false;
	}

	objForm.HomeStd.value = trim(objForm.HomeStd.value);
	objForm.OfficeStd.value = trim(objForm.OfficeStd.value);
	objForm.MobileNo.value = trim(objForm.MobileNo.value);
	objForm.OfficePhone.value = trim(objForm.OfficePhone.value);
	objForm.HomePhone.value = trim(objForm.HomePhone.value);

	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one telephone number");
				objForm.HomeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.OfficePhone)){
			alert("Please enter office phone");
			objForm.OfficePhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomePhone)){
		alert("Please enter home phone");
		objForm.HomePhone.focus();
		return false;
	}
	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;

	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) > 11 || parseInt(phoneLengthHome) < 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) > 11 || parseInt(phoneLengthOff) < 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}


	if(objForm.OfficeStd.value != null)
	{
		var phoneLength = objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
		if(parseInt(phoneLength) > 11)
		{
			alert("Please check the std code and number you have entered");
			objForm.OfficeStd.focus();
			return false;
		}
		
	}

	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}

	if(!img_uploadValidate())
	{
		return false;
	}
	return true;
}

<!-- Date format validation script -->

function monthCheck()
{
	var monthCheck = document.getElementById("pRegistrationMonth");
	var dayCheck = document.getElementById("pRegistrationDay");
	if(monthCheck.value == 04 || monthCheck.value == 06 || monthCheck.value == 09 || monthCheck.value == 11)
	{
		if(dayCheck.value == 31)
		{
			alert("no of days is 30");
			dayCheck.selectedIndex = 1;
			dayCheck.focus()
		}
		
	}
	else if(monthCheck.value == 02 && !checkLeapYear())
	{
		if(dayCheck.value > 28)
		{
			alert("no of days is 28");
			dayCheck.selectedIndex = 1;
			dayCheck.focus()
		}
		
	}
}

function checkLeapYear()
{
	var leapYearCheck = document.getElementById("pRegistrationYear");
	var dayCheck = document.getElementById("pRegistrationDay");
	var monthCheck = document.getElementById("pRegistrationMonth");

	if(((leapYearCheck.value % 4 == 0) && ( (!(leapYearCheck.value % 100 == 0)) || (leapYearCheck.value % 400 == 0))))
	{
		if(dayCheck.value >= 30 && monthCheck.value == 02)
		{
			alert("no of days is 29");
			dayCheck.selectedIndex = 1;
			dayCheck.focus()
			return true;
		}
		return true;
	}
	return false;
}

function checkTrim() {
	if(document.getElementById('pTrim').value == "Other"){
		document.getElementById('pOtherTrim').readOnly = "";
		document.getElementById('pOtherTrim').focus();
		return true;
	}
	else {
		document.getElementById('pOtherTrim').readOnly = "readonly";
		document.getElementById('pOtherTrim').value = "";
		return true;
	}
	return true;
}	

/*function validateSellCar(day, month, year){
	objForm = document.formSellYourCar;	
	*/
	
	/*objForm.pOtherMake.value = trim(objForm.pOtherMake.value);*/
	/*if(objForm.pMake.selectedIndex == 0){
		alert("Please enter make");
		objForm.pMake.focus();
		return false;
	}*/
	
	/*if(objForm.pMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.pMake.focus();
		return false;
	}*/
	/*else if (pOtherMake.value.length == 0)
     {
		objForm.pOtherMake.focus();
		return false;	
	}
*/
	
/*	objForm.pOtherModel.value = trim(objForm.pOtherModel.value);*/
	/*if(objForm.pModel.selectedIndex == 0 && objForm.pOtherModel.value=="" ){
		alert("Please enter model");
		objForm.pModel.focus();
		return false;
	}
	*/
	/*if(document.getElementById('pTrim').value == "Other"){
		document.getElementById('pOtherTrim').disabled = "";
		document.getElementById('pOtherTrim').focus();
		}
	else {
		document.getElementById('pOtherTrim').disabled = "disabled";
		document.getElementById('pOtherTrim').value = "";
	
	}*/
	/*objForm.pOtherT.value = trim(objForm.pOtherT.value);
	if(document.getElementById("pTrim").selectedIndex==0 && objForm.pOtherT.value=="" ) {
		alert("Please select a variant");
		objForm.pTrim.focus();
		return false;
	}
	if(document.getElementById("pTrim").value == "Other") {
		objForm.pOtherTrim.value = trim(objForm.pOtherTrim.value);
		if(!isNotEmpty(objForm.pOtherTrim))
		{
				alert("Please enter any other variant");
				objForm.pOtherTrim.focus();
				return false;		
		}
	}*/
			
	/*
	if(objForm.pManufactureMonth.selectedIndex == 0){
		alert("Please select manufacturing month");
		objForm.pManufactureMonth.focus();
		return false;
	}
	
	if(objForm.pManufactureYear.selectedIndex == 0){
		alert("Please enter year of manufacture");
		objForm.pManufactureYear.focus();
		return false;
	}
	
	//added by sujit
	if(document.getElementById('pManufactureYear').value > year) {
		alert("Please select proper manufacturing year");	
		objForm.pManufactureYear.focus();
		return false;
	}	
	//added by sujit
	
	//added by sujit
	if(document.getElementById('pManufactureYear').value >= year) {
		if(document.getElementById('pManufactureMonth').value > month) {
			alert("Please select proper manufacturing month");	
			objForm.pManufactureMonth.focus();
			return false;
		}
	}
	//added by sujit
	
	
	if(document.getElementById('dateOfReg').value == "") {
		alert("Please select registration date");	
		objForm.dateOfReg.focus();
		return false;
	}
	
	var MOM = objForm.pManufactureMonth.options[objForm.pManufactureMonth.selectedIndex].value;
	var YOM = objForm.pManufactureYear.options[objForm.pManufactureYear.selectedIndex].value;
	
	var dateOfRegVal = objForm.dateOfReg.value.split("/");
	var YOFR = dateOfRegVal[2];
	var MOFR = dateOfRegVal[0];
	
	if(YOFR < YOM) {
		alert("Date of 1st registration must be greater than or equal to date of manufacture");
		objForm.pManufactureMonth.focus();
		return false;	
	}	
	else if (YOFR == YOM && MOFR < MOM) {
		alert("Date of 1st registration must be greater than or equals to date of manufacture");
		objForm.pManufactureMonth.focus();
		return false;	
	}
	
	var fromdate = new Date(objForm.dateOfReg.value);
	var todate = new Date(month+"/"+day+"/"+year);
	if(fromdate > todate) {
		alert("Date of registration should be less than today's date");
		objForm.dateOfReg.focus();
		return false;
	}
	//added by sujit

	objForm.pRegistrationNo.value = trim(objForm.pRegistrationNo.value);

	if (!isNotEmpty(objForm.pRegistrationNo)){ 
		alert("Please enter registration number");
		objForm.pRegistrationNo.focus();
		return false;
	}
	
	if (objForm.pRegistrationNo.value != "")
	{	
			var val = objForm.pRegistrationNo.value;
			val = val.substring(0,1);
			var objRegExp  =  /^[a-zA-Z- ]+$/; 
			var flag = objRegExp.test(val);
			
		 if(val != "" && !flag)
		 {
			 alert("Please enter a valid registration number");
			 objForm.pRegistrationNo.focus();
			 return false;
		 }
		 
	}
	
	objForm.pMileage.value = trim(objForm.pMileage.value);
		
	if (!isNotEmpty(objForm.pMileage)){ 
		alert("Please enter mileage");
		objForm.pMileage.focus();
		return false;
	}
	
	if(!validNumericsOnSubmit(objForm.pMileage,'mileage')) {
			return false;
	}
	
	if(!checkForZeros(objForm.pMileage)) {
		alert("Please enter proper mileage");	
		objForm.pMileage.focus();
		return false;
	}
	
	if(document.getElementById('pExpectedPriceFrom').value == "" )
	{
		alert("Please enter expected price");
		objForm.pExpectedPriceFrom.focus();
		return false;
	}
		
	

	objForm.pPlaceOfRegistration.value = trim(objForm.pPlaceOfRegistration.value);
	if(!isNotEmpty(objForm.pPlaceOfRegistration)){
		alert("Please enter place of registration");
		objForm.pPlaceOfRegistration.focus();
		return false;
	}

	objForm.pColour.value = trim(objForm.pColour.value);
	if(!isNotEmpty(objForm.pColour)){
		alert("Please enter colour");
		objForm.pColour.focus();
		return false;
	}
	if(objForm.pOwners.selectedIndex == 0){
		alert("Please enter number of previous owners");
		objForm.pOwners.focus();
		return false;
	}	
	if(objForm.pBodyStyle.selectedIndex == 0){
		alert("Please select body style");
		objForm.pBodyStyle.focus();
		return false;
	}	
	if(objForm.CarDetails.value.length > 500){
		alert("Please enter comments below 500 characters only");
		objForm.CarDetails.focus();
		return false;
	}
	objForm.pEngineCapacity.value = trim(objForm.pEngineCapacity.value);
	objForm.pTransmission.value = trim(objForm.pTransmission.value);
	objForm.pWarranty.value = trim(objForm.pWarranty.value);

	return true;
}
*/
//added by sujit
function checkForZeros(obj) {
	var count = 0;
	
	for(var i=0; i<obj.value.length; i++) {
		if(obj.value.substring(i,i+1) == "0") {
			count++;
		}
	}
	
	if(count == obj.value.length) {
		return false
	}
	else 
		return true;
}

<!-- validate the number of variants selected -->
function validateCheck(myform){
  var checked = 0;
  for (var i = 0; i < myform.elements.length; i++) {
    var e = myform.elements[i];
    if ((e.className == "compare") && (e.type == "checkbox") && (e.checked)) {
			checked = checked + 1;
    }
  }
  if (checked != 2) {
	alert("Please select any two cars to compare") ;
	return false;
  }
  return true;
}

<!-- validate Car Loan Form -->
function validateformCarLoan(){	
	
	objForm = document.formCarLoan;
		
	if(objForm.lMake.selectedIndex == 0){
		alert("Please select a  make");
		objForm.lMake.focus();
		return false;
	}
	if(objForm.lModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.lModel.focus();
		return false;
	}
	if((objForm.lAmount.value < 100000) && (objForm.lAmount.value < 10000000))
	  {
		  alert("Please enter Price Between 100000 to 10000000");
		  objForm.lAmount.select();
		  return false;
	  }
	if (!isNotEmpty(objForm.lAmount)){ 
	    alert("Please enter loan amount");
		objForm.lAmount.focus();
		return false;
	}
	if(isNotEmpty(objForm.lDownPayment))
	{
	objForm.lDownPayment.value=parseFloat(objForm.lDownPayment.value);
	}
	
	if(isNotEmpty(objForm.lIncome))
	{
	objForm.lIncome.value=parseFloat(objForm.lIncome.value);
	}
	
	if(isNotEmpty(objForm.lAmount))
	{
	objForm.lAmount.value=parseFloat(objForm.lAmount.value);
	}
	
	if (objForm.lAmount.value == 0)
		 {
			alert("Please enter valid loan amount");
			objForm.lAmount.value ="";
			objForm.lAmount.focus();
			return false;
		 }
	else if (parseInt(objForm.lAmount.value) > 10000000)
	{
    alert("Loan amount is limited to 1 Crore");
	objForm.lAmount.focus();
	return false;
	}

	if(objForm.lDuration.selectedIndex == 0){
		alert("Please select loan duration");
		objForm.lDuration.focus();
		return false;
	}
	if(objForm.lEMIMin.selectedIndex == ""){
		alert("Please select minimum EMI");
		objForm.lEMIMin.focus();
		return false;
	}
	if(objForm.lEMIMax.selectedIndex == ""){
		alert("Please select maximum EMI");
		objForm.lEMIMax.focus();
		return false;
	}
	
 
	if(objForm.lLoanType.selectedIndex == 0){
		alert("Please select loan type");
		objForm.lLoanType.focus();
		return false;
	}

	objForm.lFirstName.value = trim(objForm.lFirstName.value);
	if (!isName(objForm.lFirstName)){ 
		alert("Please enter first name");
		objForm.lFirstName.focus();
		return false;
	}
	objForm.lLastName.value = trim(objForm.lLastName.value);
	if (!isName(objForm.lLastName)){ 
		alert("Please enter last name");
		objForm.lLastName.focus();
		return false;
	}
	if(objForm.lState.selectedIndex == 0){
		alert("Please select state");
		objForm.lState.focus();
		return false;
	}
	if(objForm.lCity.selectedIndex == 0){
		alert("Please select city");
		objForm.lCity.focus();
		return false;
	}
	if(objForm.lIncome.selectedIndex == 0){
		alert("Please select state");
		objForm.lState.focus();
		return false;
	}	
	
	if(objForm.lEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.lEmail.focus();
		return false;
	}
	if (objForm.lEmail.value!="" && !valid_email(objForm.lEmail.value)){ 
		alert("Please enter valid e-mail id");
		objForm.lEmail.focus();
		return false;
	}
	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one telephone number");
				objForm.HomeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.OfficePhone)){
			alert("Please enter office phone");
			objForm.OfficePhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomePhone)){
		alert("Please enter home phone");
		objForm.HomePhone.focus();
		return false;
	}
	
	
	/// Ensure length of phone nos..code start 
	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;

	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) > 11 || parseInt(phoneLengthHome) < 11)
			{
				alert("Please check the home std code / phone number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) > 11 || parseInt(phoneLengthOff) < 11)
			{
				alert("Please check the office std code / phone number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}
		
		/////// Ensuring length of phone nos..code ends 

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		} 


	if(objForm.OfficeStd.value != "" || objForm.HomeStd.value == "" && objForm.MobileNo.value == "")
	{
		var phoneLength = objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.OfficeStd.focus();
			return false;
		}		
	}	
	///	Added for ensuring length of phone nos.. start 
	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}
	return true;
}


<!-- Kumar(validate Insurance Policy Form) -->
function validateformInsurancePolicy(){	
	
	objForm = document.formInsurancePolicy;
	
	if(objForm.lMake.selectedIndex == 0){
		alert("Please select a  make");
		objForm.lMake.focus();
		return false;
	}
	if(objForm.lModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.lModel.focus();
		return false;
	}
	objForm.lRegistration.value = trim(objForm.lRegistration.value);
	if (!isNotEmpty(objForm.lRegistration)){ 
		alert("Please enter registration number");
		objForm.lRegistration.focus();
		return false;
	}
	
	if (objForm.lRegistration.value == 0)
		 {
			alert("Please enter a valid registration number");
			objForm.lRegistration.value ="";
			objForm.lRegistration.focus();
			return false;	}

	if (objForm.lRegistration.value != "")
		 {
			var val = objForm.lRegistration.value;
			val = val.substring(0,1);
			var objRegExp  =  /^[a-zA-Z- ]+$/; 
			var flag = objRegExp.test(val);
			
		 if(val != "" && !flag)
		 {
			 alert("Please enter a valid registration number");
			 objForm.lRegistration.focus();
			 return false;
		 }
		 
	}
	
	if(objForm.lManufactureMonth.selectedIndex == 0){
		alert("Please select month & year of manufacture");
		objForm.lManufactureMonth.focus();
		return false;
	}
	
	if(objForm.lManufactureYear.selectedIndex == 0){
		alert("Please select month & year of manufacture");
		objForm.lManufactureYear.focus();
		return false;
	}
	
	var d=new Date();
    var thisMonth = d.getMonth();
	var thisYear = d.getYear();	
	if (((objForm.lManufactureMonth.selectedIndex - 1) > thisMonth ) && ((objForm.lManufactureYear.selectedIndex) == 1))
	{
	 alert("Please check the manufacturing month and year");
	 objForm.lManufactureMonth.focus();
	 return false;
	}
	
	if(objForm.lVehicleType.selectedIndex == 0){
		alert("Please select type of vehicle");
		objForm.lVehicleType.focus();
		return false;
	}
	if(objForm.lVehicleUnder.selectedIndex == 0){
		alert("Please select vehicle under");
		objForm.lVehicleUnder.focus();
		return false;
	}
	
	objForm.lOwnerName.value = trim(objForm.lOwnerName.value);
	if (!isName(objForm.lOwnerName)){ 
		alert("Please enter name of owner");
		objForm.lOwnerName.focus();
		return false;
	}
	/*
	if(objForm.lState.selectedIndex == 0){
		alert("Please select state");
		objForm.lState.focus();
		return false;
	}
	*/
	if(objForm.lCity.selectedIndex == 0){
		alert("Please select city");
		objForm.lCity.focus();
		return false;
	}
	objForm.lEmail.value = trim(objForm.lEmail.value);
	if(objForm.lEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.lEmail.focus();
		return false;
	}
	if (objForm.lEmail.value!="" && !valid_email(objForm.lEmail.value)){ 
		alert("Please enter valid e-mail id");
		objForm.lEmail.focus();
		return false;
	}

	objForm.HomeStd.value = trim(objForm.HomeStd.value);
	objForm.OfficeStd.value = trim(objForm.OfficeStd.value);
	objForm.MobileNo.value = trim(objForm.MobileNo.value);
	objForm.OfficePhone.value = trim(objForm.OfficePhone.value);
	objForm.HomePhone.value = trim(objForm.HomePhone.value);
	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one contact number");
				objForm.HomeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.OfficePhone)){
			alert("Please enter office phone");
			objForm.OfficePhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomePhone)){
		alert("Please enter home phone");
		objForm.HomePhone.focus();
		return false;
	}

	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
	
	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}


	if(objForm.OfficeStd.value != "" || objForm.HomeStd.value == "" && objForm.MobileNo.value == "")
	{
		var phoneLength = objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.OfficeStd.focus();
			return false;
		}
		
	}
	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}
		/////// Ensuring length of phone nos..code ends 
	return true;
}

<!-- Kumar(validate Policy Renewal Form) -->
function validateformPolicyRenewal(){	
	
	objForm = document.formPolicyRenewal;
	
	if(objForm.lMake.selectedIndex == 0){
		alert("Please select a  make");
		objForm.lMake.focus();
		return false;
	}
	if(objForm.lModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.lModel.focus();
		return false;
	}
	
	objForm.lRegistration.value = trim(objForm.lRegistration.value);
	if (!isNotEmpty(objForm.lRegistration)){ 
		alert("Please enter registration number");
		objForm.lRegistration.focus();
		return false;
	}
	
	if (objForm.lRegistration.value == 0)
		 {
			alert("Please enter a valid registration number");
			objForm.lRegistration.value ="";
			objForm.lRegistration.focus();
			return false;
	}
	
	if (objForm.lRegistration.value != "")
		 {
			var val = objForm.lRegistration.value;
			val = val.substring(0,1);
			var objRegExp  =  /^[a-zA-Z- ]+$/; 
			var flag = objRegExp.test(val);
			
		 if(val != "" && !flag)
		 {
			 alert("Please enter a valid registration number");
			 objForm.lRegistration.focus();
			 return false;
		 }
		 
	}
	if(objForm.lManufactureMonth.selectedIndex == 0){
		alert("Please select year of manufacture");
		objForm.lManufactureMonth.focus();
		return false;
	}
	if(objForm.lManufactureYear.selectedIndex == 0){
		alert("Please select year of manufacture");
		objForm.lManufactureYear.focus();
		return false;
	}
	
	var d = new Date();
	var thisMonth = d.getMonth();
	var thisYear = d.getYear();
	 
	if ((objForm.lManufactureMonth.selectedIndex-1 > thisMonth) && (objForm.lManufactureYear.selectedIndex == 1))
	{
		 alert("Please check the manufacturing month and year");
		 objForm.lManufactureMonth.focus();
		 return false;
	}
	
	if(objForm.lVehicleType.selectedIndex == 0){
		alert("Please select type of vehicle");
		objForm.lVehicleType.focus();
		return false;
	}
	
	objForm.lCompany.value = trim(objForm.lCompany.value);
	if (!isNotEmpty(objForm.lCompany)){ 
		alert("Please enter insurance company");
		objForm.lCompany.focus();
		return false;
	}
	
	if (objForm.lCompany.value == 0)
	{
		alert("Please enter a valid insurance company name");
		objForm.lCompany.value ="";
		objForm.lCompany.focus();
		return false;
	}
	if(objForm.lInsuranceType.selectedIndex == 0){
		alert("Please select Insurance Type");
		objForm.lInsuranceType.focus();
		return false;
	}
		
	if(objForm.lInsuranceFromDay.value == ""){
		alert("Please select insurance from date");
		objForm.lInsuranceFromDay.focus();
		return false;
	}
	var fromdate = new Date(objForm.lInsuranceFromDay.value);
	var todate = new Date();
	if(fromdate >= todate) {
		alert(" Insurance from date should be less than today's date");
		objForm.lInsuranceFromDay.focus();
		return false;
	}
	var manumonth = objForm.lManufactureMonth.value;
	var manuyear = objForm.lManufactureYear.value;
	
	var firstdate = fromdate.getDate();
	var firstmonth = fromdate.getMonth();
	var firstyear = fromdate.getFullYear();
	
	firstmonth=parseInt(firstmonth) +1 ;
	if (manuyear > firstyear)
	{     alert("'Insurance from' year should be greater than or equal to year of manufacture");				
		objForm.lInsuranceFromDay.focus();
		return false;
	}
	else if ( manuyear == firstyear)
		{	
		
	    if( manumonth > firstmonth )
	    {alert("'Insurance from' month should be greater than or equal to month of manufacture");
	    objForm.lInsuranceFromDay.focus();
		return false;
		}
	    }
		
	if(objForm.lInsuranceToDay.value == ""){
		alert("Please select insurance to date");
		objForm.lInsuranceToDay.focus();
		return false;
	}

  var finaldate = new Date(objForm.lInsuranceToDay.value);
  var lastdate = finaldate.getDate();
  var lastmonth = finaldate.getMonth();
  var lastyear = finaldate.getFullYear();
  lastmonth=parseInt(lastmonth) +1 ;

  if ( lastyear < firstyear ) 
  { 
  alert("'Insurance to' year should be greater than 'Insurance from' year");
  objForm.lInsuranceToDay.focus();
  return false;
  }
  else if ( firstyear == lastyear )
       {
		if ( lastmonth < firstmonth ) 
	    { 
		alert("'Insurance to' month should be greater than 'Insurance from' month");
	    objForm.lInsuranceToDay.focus();
	    return false;
	    }
	   	else if ((firstmonth == lastmonth) && (firstyear == lastyear) )
	   		  {
			  if (lastdate <= firstdate) 
	   		  { 
			  alert("'Insurance to' date should be greater than 'Insurance from' date");
	   		  objForm.lInsuranceToDay.focus();
			  return false;
	   		  }   
	   		}
	   }
   
	if(objForm.lVehicleUnder.selectedIndex == 0){
		alert("Please select vehicle under");
		objForm.lVehicleUnder.focus();
		return false;
	}
	
	if (trim(objForm.lPremium.value) == 0){ 
		alert("Please enter premium ");
		objForm.lPremium.focus();
		objForm.lPremium.select();
		return false;
	}
	if (trim(objForm.lInsuredAmount.value) == 0){ 
		alert("Please enter insured amount");
		objForm.lInsuredAmount.focus();
		objForm.lInsuredAmount.select();
		return false;
	}
	
	objForm.lOwnerName.value = trim(objForm.lOwnerName.value);
	if (!isName(objForm.lOwnerName)){ 
		alert("Please enter name of owner");
		objForm.lOwnerName.focus();
		return false;
	}
	if(objForm.lCity.selectedIndex == 0){
		alert("Please select city");
		objForm.lCity.focus();
		return false;
	}
	
	objForm.lEmail.value = trim(objForm.lEmail.value);	
	if(objForm.lEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.lEmail.focus();
		return false;
	}
	if (objForm.lEmail.value!="" && !valid_email(objForm.lEmail.value)){ 
		alert("Please enter valid e-mail id");
		objForm.lEmail.focus();
		return false;
	}
	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one contact number");
				objForm.HomeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.OfficePhone)){
			alert("Please enter office phone");
			objForm.OfficePhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomePhone)){
		alert("Please enter home phone");
		objForm.HomePhone.focus();
		return false;
	}
	
	/// Ensure length of phone nos..code start 
	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;

	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) > 11 || parseInt(phoneLengthHome) < 11)
			{
				alert("Please check the home std code / phone number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) > 11 || parseInt(phoneLengthOff) < 11)
			{
				alert("Please check the office std code / phone number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}
	/////// Ensuring length of phone nos..code ends 
	
	if(objForm.Comments.value.length > 500){
		alert("Please enter comments below 500 characters only");
		objForm.Comments.focus();
		return false;
	}
		/// Ensure length of phone nos..code start 
	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;

	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) > 11 || parseInt(phoneLengthHome) < 11)
			{
				alert("Please check the home std code / phone number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficePhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) > 11 || parseInt(phoneLengthOff) < 11)
			{
				alert("Please check the office std code / phone number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}
	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}
		/////// Ensuring length of phone nos..code ends 
	return true;
}

<!-- validate Category Form -->
function validateCategory(){	
	
	objForm = document.newcarbycategory;
	
	if(objForm.category.selectedIndex == 0){
		alert("Please select a category");
		objForm.category.focus();
		return false;
	}
	return true;
}

<!-- validate Bodystyle Form -->
function validateBodystyle(){	
	
	objForm = document.newcarbybody;
	
	if(objForm.bodystyle.selectedIndex == 0){
		alert("Please select a bodystyle");
		objForm.bodystyle.focus();
		return false;
	}
	return true;
}

<!-- validate Makes Form -->
function validateMake(){	
	
	objForm = document.newcarbymake;
	
	if(objForm.cMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.cMake.focus();
		return false;
	}
	return true;
}

function fillMMSCMake(cboMake, cboModel, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	
	cboMake.options.length=0;
	cboModel.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");

	cboMake.options.length=0;
	for(i=0; i < makeArray.split("|").length; i++){
		sMake = makeArray.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillMMSCModel(cboMake, cboModel,sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
			
	cboModel.options.length=0;
	for(i=0;i<modelArray[cboMake.selectedIndex].split("|").length;i++){
		sModel = modelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}

/*function fillMMSCState(cbomake, cboModel, cboState, cboCity, sDefaultState){
	var sDefaultState, sState, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	if (cboState.options.length > 1) {
		other = true;
	}
	cboState.options.length=0;
	cboCity.options.length=0;
	
	cboState.options[0] = new Option("Select a State","Select a State");
	cboCity.options[0] = new Option("Select a City","Select a City");

	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
		}
	}

	for(i=0; i < makeArray.split("|").length; i++){
		if(cbomake.value == makeArray.split("|")[i]){
			makeIndex = i;
			for(j=0; j < modelArray[makeIndex].split("|").length; j++){
				sModel = modelArray[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}
	
	for(i=0;i<stateArray[makeIndex][modelIndex].split("|").length;i++){
		sState = stateArray[makeIndex][modelIndex].split("|")[i];

		if(sDefaultState == sState){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
			cboState.options[i]=new Option(sState,sState,sDefault,sDefault);
		}
		else{
			cboState.options[i]=new Option(sState,sState);
		}
	}
	if(flag){
		cboState.options[foundIndex].selected = true;
	}
	if(other){
		cboState.options[i]=new Option("Other","Other");
	}
}

function fillMMSCCity(cboMake, cboModel, cboState, cboCity, sDefaultCity){

			var sDefaultCity, sCity, sDefault;
			var foundIndex = 0, flag = false;
			cboCity.options.length=0;

			cboCity.options[0] = new Option("Select a City","Select a City");
			for(i=0;i<cityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|").length;i++) {

				sCity = cityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|")[i];

				if(sDefaultCity == sCity) {
					sDefault=true;
					foundIndex = i;
					flag = true;

				}
				else
				{
					sDefault=false;
				}

				if(sDefault)
				{
					cboCity.options[i]=new Option(sCity,sCity,sDefault,sDefault);
				}
				else
				{
					cboCity.options[i]=new Option(sCity,sCity);
				}
			}
			if(flag)
			{
				cboCity.options[foundIndex].selected = true;
			}
			if(cityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|").length == 2){
				cboCity.options[1].selected = true;
			}
		}*/
		
		
		
		
function fillMMCMake(cboMake, cboModel, cboCity, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < make_array.split("|").length; i++){
		sMake = make_array.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillMMCModel(cboMake, cboModel, cboCity, sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");
			
	cboModel.options.length=0;
	for(i=0;i<model_array[cboMake.selectedIndex].split("|").length;i++){
		sModel = model_array[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}

function fillMMCCity(cboMake, cboModel, cboCity, sDefaultCity){
	var sDefaultCity, sCity, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	cboCity.options.length=0;

	cboCity.options[0] = new Option("Select a City","Select a City");

	for(i=0; i < make_array.split("|").length; i++){
		if(cboMake.value == make_array.split("|")[i]){
			makeIndex = i;
		}
	}

	for(i=0; i < make_array.split("|").length; i++){
		if(cboMake.value == make_array.split("|")[i]){
			makeIndex = i;
			for(j=0; j < model_array[makeIndex].split("|").length; j++){
				sModel = model_array[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}
	for(i=0;i<city_array[makeIndex][modelIndex].split("|").length;i++){
		sCity = city_array[makeIndex][modelIndex].split("|")[i];

		if(sDefaultCity == sCity){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
			cboCity.options[i]=new Option(sCity,sCity,sDefault,sDefault);
		}
		else{
			cboCity.options[i]=new Option(sCity,sCity);
		}
	}
	if(flag){
		cboCity.options[foundIndex].selected = true;
	}
	if(other){
		cboCity.options[i]=new Option("Other","Other");
	}
}	

function fillUsedMMCMake(cboMake, cboModel, cboCity, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < usedMakeArray.split("|").length; i++){
		sMake = usedMakeArray.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillUsedMMCModel(cboMake, cboModel, cboCity, sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");
			
	cboModel.options.length=0;
	for(i=0;i<usedModelArray[cboMake.selectedIndex].split("|").length;i++){
		sModel = usedModelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}

function fillUsedMMCCity(cboMake, cboModel, cboCity, sDefaultCity){
	var sDefaultCity, sCity, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	cboCity.options.length=0;

	cboCity.options[0] = new Option("Select a City","Select a City");

	for(i=0; i < usedMakeArray.split("|").length; i++){
		if(cboMake.value == usedMakeArray.split("|")[i]){
			makeIndex = i;
		}
	}

	for(i=0; i < usedMakeArray.split("|").length; i++){
		if(cboMake.value == usedMakeArray.split("|")[i]){
			makeIndex = i;
			for(j=0; j < usedModelArray[makeIndex].split("|").length; j++){
				sModel = usedModelArray[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}
	for(i=0;i<usedCityArray[makeIndex][modelIndex].split("|").length;i++){
		sCity = usedCityArray[makeIndex][modelIndex].split("|")[i];

		if(sDefaultCity == sCity){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
			cboCity.options[i]=new Option(sCity,sCity,sDefault,sDefault);
		}
		else{
			cboCity.options[i]=new Option(sCity,sCity);
		}
	}
	if(flag){
		cboCity.options[foundIndex].selected = true;
	}
	if(other){
		cboCity.options[i]=new Option("Other","Other");
	}
}

<!--Email New -->
function fillMMCMakeEN(cboMake, cboModel, cboCity, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < make_array.split("|").length; i++){
		sMake = make_array.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillMMCModelEN(cboMake, cboModel, cboCity, sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	cboCity.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
	cboCity.options[0] = new Option("Select a City","Select a City");
			
	cboModel.options.length=0;
	for(i=0;i<model_array[cboMake.selectedIndex].split("|").length;i++){
		sModel = model_array[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}

function fillMMCCityEN(cboMake, cboModel, cboCity, sDefaultCity){
	var sDefaultCity, sCity, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	cboCity.options.length=0;

	cboCity.options[0] = new Option("Select a City","Select a City");

	for(i=0; i < make_array.split("|").length; i++){
		if(cboMake.value == make_array.split("|")[i]){
			makeIndex = i;
		}
	}

	for(i=0; i < make_array.split("|").length; i++){
		if(cboMake.value == make_array.split("|")[i]){
			makeIndex = i;
			for(j=0; j < model_array[makeIndex].split("|").length; j++){
				sModel = model_array[makeIndex].split("|")[j];
				if(sModel == cboModel.options[cboModel.selectedIndex].value){
					modelIndex = j;
				}
			}
		}
	}
	for(i=0;i<city_array2[makeIndex][modelIndex].split("|").length;i++){
		sCity = city_array2[makeIndex][modelIndex].split("|")[i];

		if(sDefaultCity == sCity){
			sDefault=true;
			foundIndex = i;
			flag = true;

			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}

		if(sDefault){
			cboCity.options[i]=new Option(sCity,sCity,sDefault,sDefault);
		}
		else{
			cboCity.options[i]=new Option(sCity,sCity);
		}
	}
	if(flag){
		cboCity.options[foundIndex].selected = true;
	}
	if(other){
		cboCity.options[i]=new Option("Other","Other");
	}
}	

<!-- End New -->

function fillUsedMMSCMake(cboMake, cboModel, sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	/*if (cboState.options.length > 1) {
		other = true;
	}*/
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	//cboState.options.length=0;
	//cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	//cboState.options[0] = new Option("Select a State","Select a State");
	//cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < usedMakeArray.split("|").length; i++){
		sMake = usedMakeArray.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
	//cboMake.options[cboMake.options.length] = new Option("-Any-","any");
}

function fillUsedMMSCModel(cboMake, cboModel, sDefaultModel){

	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	//cboState.options.length=0;
			
	if (cboMake.value != "any") {
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	//cboState.options[0] = new Option("Select a State","Select a State");
		
		for(i=0;i<usedModelArray[cboMake.selectedIndex].split("|").length;i++){
			sModel = usedModelArray[cboMake.selectedIndex].split("|")[i];
			if(sDefaultModel == sModel){
				sDefault=true;
				foundIndex = i;
				flag = true;
				if (navigator.appName=="Microsoft Internet Explorer"){
				}
			}
			else{
				sDefault=false;
			}
			if(sDefault){
				cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
			}
			else{
				cboModel.options[i]=new Option(sModel,sModel);
			}
		}
		if(flag){
			cboModel.options[foundIndex].selected = true;
		}

		/*if (cboModel.options.length > 1) {
		cboModel.options[cboModel.options.length] = new Option("-Any-","any");
		}*/
	}
	/*else if (cboMake.value == "any") {
	cboModel.options[cboModel.options.length] = new Option("-Any-","any");
	cboState.options[cboState.options.length] = new Option("-Any-","any");
	cboCity.options[cboCity.options.length] = new Option("-Any-","any");
	}*/
}

function fillUsedMMSCModelCarResearch(cboMake, cboModel, cboCity, sDefaultModel){

	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
			
	if (cboMake.value != "any") {
	cboModel.options[0] = new Option("Select a Model","Select a Model");
		
		for(i=0;i<usedModelArray[cboMake.selectedIndex].split("|").length;i++){
			sModel = usedModelArray[cboMake.selectedIndex].split("|")[i];
			if(sDefaultModel == sModel){
				sDefault=true;
				foundIndex = i;
				flag = true;
				if (navigator.appName=="Microsoft Internet Explorer"){
				}
			}
			else{
				sDefault=false;
			}
			if(sDefault){
				cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
			}
			else{
				cboModel.options[i]=new Option(sModel,sModel);
			}
		}
		if(flag){
			cboModel.options[foundIndex].selected = true;
		}
	}
}

function fillUsedMMSCState(cbomake, cboModel, cboCity, sDefaultState){
	var sDefaultState, sState, sDefault;
	var foundIndex = 0, flag = false;
	var makeIndex = 0, modelIndex = 0, sModel;

	cboState.options.length=0;
	cboCity.options.length=0;

	if (cboModel.value != "any") {
	cboState.options[0] = new Option("Select a State","Select a State");
	cboCity.options[0] = new Option("Select a City","Select a City");
	
		for(i=0; i < usedMakeArray.split("|").length; i++){
			if(cbomake.value == usedMakeArray.split("|")[i]){
				makeIndex = i;
			}
		}
	
		for(i=0; i < usedMakeArray.split("|").length; i++){
			if(cbomake.value == usedMakeArray.split("|")[i]){
				makeIndex = i;
				for(j=0; j < usedModelArray[makeIndex].split("|").length; j++){
					sModel = usedModelArray[makeIndex].split("|")[j];
					if(sModel == cboModel.options[cboModel.selectedIndex].value){
						modelIndex = j;
					}
				}
			}
		}
		
		for(i=0;i<usedStateArray[makeIndex][modelIndex].split("|").length;i++){
			sState = usedStateArray[makeIndex][modelIndex].split("|")[i];
	
			if(sDefaultState == sState){
				sDefault=true;
				foundIndex = i;
				flag = true;
	
				if (navigator.appName=="Microsoft Internet Explorer"){
				}
			}
			else{
				sDefault=false;
			}
	
			if(sDefault){
				cboState.options[i]=new Option(sState,sState,sDefault,sDefault);
			}
			else{
				cboState.options[i]=new Option(sState,sState);
			}
		}
		if(flag){
			cboState.options[foundIndex].selected = true;
		}
		
		/*if (cboState.options.length > 1) {
		cboState.options[cboState.options.length] = new Option("-Any-","any");
		}*/
	}
/*	else if (cboModel.value == "any") {
	cboState.options[cboState.options.length] = new Option("-Any-","any");
	cboCity.options[cboCity.options.length] = new Option("-Any-","any");
	}*/
}
function fillUsedMMSCCity(cboMake, cboModel, cboState, cboCity, sDefaultCity){

	var sDefaultCity, sCity, sDefault;
	var foundIndex = 0, flag = false;
	cboCity.options.length=0;

	if (cboState.value != "any") {
	cboCity.options[0] = new Option("Select a City","Select a City");
		for(i=0;i<usedCityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|").length;i++) {
	
			sCity = usedCityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|")[i];
	
			if(sDefaultCity == sCity) {
				sDefault=true;
				foundIndex = i;
				flag = true;
	
			}
			else
			{
				sDefault=false;
			}
	
			if(sDefault)
			{
				cboCity.options[i]=new Option(sCity,sCity,sDefault,sDefault);
			}
			else
			{
				cboCity.options[i]=new Option(sCity,sCity);
			}
		}
		if(flag)
		{
			cboCity.options[foundIndex].selected = true;
		}
		if(usedCityArray[cboMake.selectedIndex][cboModel.selectedIndex][cboState.selectedIndex].split("|").length == 2){
			cboCity.options[1].selected = true;
		}
		
		/*if (cboCity.options.length > 1) {
		cboCity.options[cboCity.options.length] = new Option("-Any-","any");
		}*/
	}
/*	else if (cboState.value == "any") {
	cboCity.options[cboCity.options.length] = new Option("-Any-","any");
	}*/
	
}

/* leading and trailing space check */

function spaceCheck(url)
{
	var urlVal = url.value;
	if(urlVal.indexOf(" ") == 0)
	{
	url.focus();
	return false;
	}
	
	var len = urlVal.length - 1;

	if(urlVal.lastIndexOf(" ") == len )
	{
	url.focus();
	return false;
	}
	return true;
}

<!-- validate new car make model state city -->
function validateusedcarresearch(){

	objForm = document.formUsedCarReSearch;
	
	if(objForm.uMake.selectedIndex == 0 || objForm.uMake.selectedIndex == -1){
		alert("Please select a make");
		objForm.uMake.focus();
		return false;
	}
	if(objForm.uModel.selectedIndex == 0 || objForm.uModel.selectedIndex == -1){
		alert("Please select a model");
		objForm.uModel.focus();
		return false;
	}
	/*if(objForm.uState.selectedIndex == 0 || objForm.uState.selectedIndex == -1){
		alert("Please select a state");
		objForm.uState.focus();
		return false;
	}*/
	if(objForm.uCity.selectedIndex == 0 || objForm.uCity.selectedIndex == -1){
		alert("Please select a city");
		objForm.uCity.focus();
		return false;
	}
	/*if(objForm.cPinCode.value != ""){
	if(objForm.cPinCode.value!="Pin Code"){
		if(objForm.cPinCode.value.length < 6 || objForm.cPinCode.value.length > 6){
		alert("Pin code should be six digits only");
		objForm.cPinCode.focus();
		return false;
		}

	}
	}*/
	return true;
}

/* finance check */

function needFinance(ID)
{
	var radioId = ID;
	if(document.getElementById(radioId).id == 'NeedFinanceYes')
	{
		document.getElementById("ApplicantCategory").disabled = false;
		document.getElementById("NeedFinancefor").disabled = false;
		document.getElementById("FinanceAmount").readOnly = false;
	}
	if(document.getElementById(radioId).id == 'NeedFinanceNo')
	{
		document.getElementById("ApplicantCategory").disabled = true;
		document.getElementById("NeedFinancefor").disabled = true;
		document.getElementById("FinanceAmount").readOnly = true;
		document.getElementById("ApplicantCategory").selectedIndex = 0;
		document.getElementById("NeedFinancefor").selectedIndex = 0;
		document.getElementById("FinanceAmount").value = "";

	}
}

<!-- validate Used Car left navigation form -->

function validateUsedCarMakeModelStateCity(objForm){

	if(objForm.uMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.uMake.focus();
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		return false;
	}
	if(objForm.uState.selectedIndex == 0){
		alert("Please select a state");
		objForm.uState.focus();
		return false;
	}
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.uCity.focus();
		return false;
	}
	return true;
}

function checkMakeModelStateCity(objForm){

	if(objForm.uMake.selectedIndex == 0){
		alert("Please select a make");
		objForm.uMake.focus();
		return false;
	}
	if(objForm.uModel.selectedIndex == 0){
		alert("Please select a model");
		objForm.uModel.focus();
		return false;
	}
	if(objForm.uState.selectedIndex == 0){
		alert("Please select a state");
		objForm.uState.focus();
		return false;
	}
	if(objForm.uCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.uCity.focus();
		return false;
	}
	return true;
}

function monthCheck()
{
	var monthCheck = document.getElementById("pRegistrationMonth");
	var dayCheck = document.getElementById("pRegistrationDay");
	if(monthCheck.value == 04 || monthCheck.value == 06 || monthCheck.value == 09 || monthCheck.value == 11)
	{
		if(dayCheck.value == 31)
		{
			alert("no of days is 30");
			dayCheck.selectedIndex = 1;
		}
		
	}
	else if(monthCheck.value == 02 && !checkLeapYear())
	{
		if(dayCheck.value > 28)
		{
			alert("no of days is 28");
			dayCheck.selectedIndex = 1;
		}
		
	}
}

function checkLeapYear()
{
	var leapYearCheck = document.getElementById("pRegistrationYear");
	var dayCheck = document.getElementById("pRegistrationDay");
	var monthCheck = document.getElementById("pRegistrationMonth");

	if(((leapYearCheck.value % 4 == 0) && ( (!(leapYearCheck.value % 100 == 0)) || (leapYearCheck.value % 400 == 0))))
	{
		if(dayCheck.value >= 30 && monthCheck.value == 02)
		{
			alert("no of days is 29");
			dayCheck.selectedIndex = 1;
			return true;
		}
		return true;
	}
	return false;
}

function img_uploadValidate()
	{
	var imagePath = document.formSellYourCarMore.userFile.value;
	//setTimeout('',5000);
	if(imagePath != "")
	{
		var extention =	imagePath.substring(imagePath.lastIndexOf("."),imagePath.length);
		extention = extention.toLowerCase();
		if(!(extention ==".jpg" ||extention ==".gif" || extention ==".jpeg"))
		{
			alert ("Not  a valid file !  your file name should extend with .jpg or .jpeg or .gif ");
			document.formSellYourCarMore.userFile.select();
			return false;
		}
	}
	/*else
	{
		alert ("Image Not Selected");
		document.formSellYourCarMore.userFile.focus();
		return false;
	}*/
	return true;
	}

	//added by murugan for email alert page
function fillUsedEmailAlertModel(cboMake, cboModel,sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	//cboCity.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
	//cboCity.options[0] = new Option("Select a City","Select a City");
			
	cboModel.options.length=0;
	for(i=0;i<usedModelArray[cboMake.selectedIndex].split("|").length;i++){
		sModel = usedModelArray[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}
//used in Email Alert
function fillUsedEmailAlertMake(cboMake, cboModel,sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	cboMake.options.length=0;
	cboModel.options.length=0;
//	cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
//	cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < usedMakeArray.split("|").length; i++){
		sMake = usedMakeArray.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}
//used in filling Make of email-alert page.
function fillEmailAlertMake(cboMake, cboModel,sDefaultMake)
{
	var sDefaultMake, sDefault, sMake;
	var foundIndex = 0, flag = false;
	
	cboMake.options.length=0;
	cboModel.options.length=0;
	//cboCity.options.length=0;

	cboMake.options[0] = new Option("Select a Make","Select a Make");
	cboModel.options[0] = new Option("Select a Model","Select a Model");
	//cboCity.options[0] = new Option("Select a City","Select a City");

	cboMake.options.length=0;
	for(i=0; i < make_array.split("|").length; i++){
		sMake = make_array.split("|")[i];
		if (sDefaultMake == sMake){
			sDefault=true;
			foundIndex = i;
			flag = true;
		}
		cboMake.options[i]=new Option(sMake, sMake);
		if(flag){
			//cboMake.options[foundIndex].seleted = true;
			cboMake.selectedIndex = i;
			flag = false;
		}			
	}
}

function fillEmailAlertModel(cboMake, cboModel, sDefaultModel){
	var sDefaultModel, sModel, sDefault;
	var foundIndex = 0, flag = false;
	
	cboModel.options.length=0;
	//cboCity.options.length=0;

	cboModel.options[0] = new Option("Select a Model","Select a Model");
//	cboCity.options[0] = new Option("Select a City","Select a City");
			
	cboModel.options.length=0;
	for(i=0;i<model_array[cboMake.selectedIndex].split("|").length;i++){
		sModel = model_array[cboMake.selectedIndex].split("|")[i];
		if(sDefaultModel == sModel){
			sDefault=true;
			foundIndex = i;
			flag = true;
			if (navigator.appName=="Microsoft Internet Explorer"){
			}
		}
		else{
			sDefault=false;
		}
		if(sDefault){
			cboModel.options[i]=new Option(sModel,sModel,sDefault,sDefault);
		}
		else{
			cboModel.options[i]=new Option(sModel,sModel);
		}
	}
	if(flag){
		cboModel.options[foundIndex].selected = true;
	}
}



/*Kumar-contactuspage*/
function validForm() {
objForm = document.contactusForm;
objForm.pFirstName.value = trim(objForm.pFirstName.value);
objForm.pLastName.value = trim(objForm.pLastName.value);
	if (!isName(objForm.pFirstName)){ 
		alert("Please enter first name");
		objForm.pFirstName.focus();
		return false;
	}
	if (!isName(objForm.pLastName)){ 
		alert("Please enter last name");
		objForm.pLastName.focus();
		return false;
	}
	objForm.pEmail.value = trim(objForm.pEmail.value);
	if(objForm.pEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	if (objForm.pEmail.value!="" && !valid_email(objForm.pEmail.value)){ 
		alert("Please enter valid e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	objForm.pHomePhone1.value = trim(objForm.pHomePhone1.value);
	objForm.pHomePhone2.value = trim(objForm.pHomePhone2.value);
	objForm.pOfficePhone1.value = trim(objForm.pOfficePhone1.value);
	objForm.pOfficePhone2.value = trim(objForm.pOfficePhone2.value);
	objForm.pMobileNo.value = trim(objForm.pMobileNo.value);
	if(!isNotEmpty(objForm.pHomePhone1)){
		if(!isNotEmpty(objForm.pOfficePhone1)){
			if(!isNotEmpty(objForm.pMobileNo)){
				alert("Please enter at least one contact number");
				objForm.pHomePhone1.focus();
				return false;
			}
		}
	else if(!isNotEmpty(objForm.pOfficePhone2)){
		
		alert("Please enter office phone");
		objForm.pOfficePhone2.focus();
		return false;
			} 
		}
	else if(!isNotEmpty(objForm.pHomePhone2)){
			alert("Please enter home phone");
			objForm.pHomePhone2.focus();
			return false;
		}
	if ((isNotEmpty(objForm.pOfficePhone1)) && (!isNotEmpty(objForm.pOfficePhone2)))
	{
		alert("Please enter office phone");
		objForm.pOfficePhone2.focus();
		return false;
	}
	var phoneLengthHome = objForm.pHomePhone1.value.length + objForm.pHomePhone2.value.length;
	var phoneLengthOff =  objForm.pOfficePhone1.value.length + objForm.pOfficePhone2.value.length;
	if((phoneLengthHome != 0) && ((objForm.pHomePhone1.value == 0) || (objForm.pHomePhone2.value == 0)))
		{
			alert("Please check the home std code / phone number you have entered");
			objForm.pHomePhone1.focus();
			return false;
		}
	if(isNotEmpty(objForm.pHomePhone2) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the home std code / phone number you have entered");
				objForm.pHomePhone1.focus();
				return false;
			}
		}
		if( (phoneLengthOff !=0) && ((objForm.pOfficePhone1.value == 0) || (objForm.pOfficePhone2.value== 0)))
		{
			alert("Please check the office std code / phone number you have entered");
			objForm.pOfficePhone1.focus();
			return false;
		}

	if(isNotEmpty(objForm.pOfficePhone2) && parseInt(phoneLengthOff) != 11)
		{		
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the office std code / phone number you have entered");
				objForm.pOfficePhone1.focus();
				return false;
			}
		}
	if(objForm.pHomePhone1.value != "" || objForm.pOfficePhone1.value == "" && objForm.pMobileNo.value == "")
	{		
		var phoneLength = objForm.pHomePhone1.value.length + objForm.pHomePhone2.value.length;
		if(parseInt(phoneLength) < 11 )
			{	alert("Please check the std code and number you have entered");
				objForm.pHomePhone1.focus();
				return false;
			}	
	}
	var mobLength = document.getElementById("pMobileNo").value.length;
	if(document.getElementById("pMobileNo").value != "") {
		var str = document.getElementById("pMobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("pMobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("pMobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("pMobileNo").focus();
				return false;
			}
		}
	}
	document.getElementById("pros_but").style.display = "block";
	setTimeout('document.images["pr_img"].src="/images/buttons/acc-process.gif"', 200);
	window.status = "Processing...";
	document.getElementById("smt_but").style.display = "none";	
	return true;
}





function validatemoreInfoContactus(){	
		objForm = document.moreInfoContactus;
		objForm.pFirstName.value = trim(objForm.pFirstName.value);
	if (objForm.pFirstName.value ==""){ 
		alert("Please enter first name");
		objForm.pFirstName.focus();
		return false;
	}	
	objForm.pLastName.value = trim(objForm.pLastName.value);
	if (objForm.pLastName.value ==""){ 
		alert("Please enter last name");
		objForm.pLastName.focus();
		return false;
	}
	objForm.pEmail.value = trim(objForm.pEmail.value);
	if(objForm.pEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	if (objForm.pEmail.value!="" && !valid_email(objForm.pEmail.value) || !spaceCheck(objForm.pEmail)){ 
		alert("Please enter valid e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	if(objForm.pCity.selectedIndex == 0){
		alert("Please select a city");
		objForm.pCity.focus();
		return false;
	}
	if(document.getElementById("zipCode").value != "") {
			if(!validNumericsOnSubmit(document.getElementById("zipCode"),'Pin Code')) {
				return false;
			}
	}
	if(objForm.zipCode.value.length < 6)
	{
		alert("Please enter a 6 digit pincode");
		objForm.zipCode.focus()
		return false;
	}

	if(objForm.zipCode.value != "")
	{
	var val = objForm.zipCode.value;
		if(parseInt(val) == 0) {
			alert("Please check the pincode you have entered")
			objForm.zipCode.focus()
			return false;
		}

	}
	
	objForm.pHomePhone1.value = trim(objForm.pHomePhone1.value);
	objForm.pHomePhone2.value = trim(objForm.pHomePhone2.value);
	objForm.pOfficePhone1.value = trim(objForm.pOfficePhone1.value);
	objForm.pOfficePhone2.value = trim(objForm.pOfficePhone2.value);
	objForm.pMobileNo.value = trim(objForm.pMobileNo.value);
	
	if(!isNotEmpty(objForm.pHomePhone1)){
		if(!isNotEmpty(objForm.pOfficePhone1)){
			if(!isNotEmpty(objForm.pMobileNo)){
				alert("Please enter at least one telephone number");
				objForm.pHomePhone1.focus();
				return false;
			}
		}
	    else if(!isNotEmpty(objForm.pOfficePhone2)){
		
		alert("Please enter office phone");
		objForm.pOfficePhone2.focus();
		return false;
			} 
		}
		else if(!isNotEmpty(objForm.pHomePhone2)){
			alert("Please enter home phone");
			objForm.pHomePhone2.focus();
			return false;
		}
		
	if ((isNotEmpty(objForm.pOfficePhone1)) && (!isNotEmpty(objForm.pOfficePhone2)))
	{
		alert("Please enter office phone");
		objForm.pOfficePhone2.focus();
		return false;
	}
	
	//else if(!isNotEmpty(objForm.pHomePhone1)){
//		alert("Please enter home phone");
//		objForm.pHomePhone1.focus();
//		return false;
//	}
	//alert("Test1");
	var phoneLengthHome = objForm.pHomePhone1.value.length + objForm.pHomePhone2.value.length;
	var phoneLengthOff =  objForm.pOfficePhone1.value.length + objForm.pOfficePhone2.value.length;
	//alert(phoneLengthOff);
	if(isNotEmpty(objForm.pHomePhone2) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				//alert("Test1");
				alert("Please check the home std code / phone number you have entered");
				objForm.pHomePhone1.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.pOfficePhone2) && parseInt(phoneLengthOff) != 11)
		{		
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				//alert("Test2");
				alert("Please check the office std code / phone number you have entered");
				objForm.pOfficePhone1.focus();
				return false;
			}
		}


	if(objForm.pHomePhone1.value != "" || objForm.pOfficePhone1.value == "" && objForm.pMobileNo.value == "")
	{		
		var phoneLength = objForm.pHomePhone1.value.length + objForm.pHomePhone2.value.length;
		//alert(phoneLength);		
		if(parseInt(phoneLength) < 11 )
		{	alert("Please check the std code and number you have entered");
			objForm.pHomePhone1.focus();
			return false;
		}	
	}
	
	var mobLength = document.getElementById("pMobileNo").value.length;
	if(document.getElementById("pMobileNo").value != "") {
		var str = document.getElementById("pMobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("pMobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("pMobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("pMobileNo").focus();
				return false;
			}
		}
	}
	objForm.Comments.value = trim(objForm.Comments.value);
	if(objForm.Comments.value.length > 500){
		alert("Please enter comments below 500 characters only");
		objForm.Comments.focus();
		return false;
	}
	return true;
	}	
	
/*--------------------------------EditProfilePage--------------------*/
function validateEditProfilePage() {
		
objForm = document.editProfileForm;
objForm.FirstName.value = trim(objForm.FirstName.value);
objForm.LastName.value = trim(objForm.LastName.value);

	if (!isName(objForm.FirstName)){ 
		alert("Please enter first name");
		objForm.FirstName.focus();
		return false;
	}
	if (!isName(objForm.LastName)){ 
		alert("Please enter last name");
		objForm.LastName.focus();
		return false;
	}
	
	objForm.FlatNo.value = trim(objForm.FlatNo.value);
	if (objForm.FlatNo.value == ""){ 
		alert("Please enter flat No.");
		objForm.FlatNo.focus();
		return false;
	}
	
	objForm.Street.value = trim(objForm.Street.value);
	if (objForm.Street.value == ""){ 
		alert("Please enter street name");
		objForm.Street.focus();
		return false;
	}
	
	objForm.Locality.value = trim(objForm.Locality.value);
	if (objForm.Locality.value == "")
	{ 
		alert("Please enter locality name");
		objForm.Locality.focus();
		return false;
	}
	
	
	if(document.getElementById('City').value == "otherct"){
		if(document.getElementById('txtCity').value == ""){
		alert("Please enter Other city");
		document.getElementById('txtCity').focus();		
		return false;
		}//close of inner if
		//return false;
	} // end of  else (document.getElementById('City').value == '0' )

	objForm.zipCode.value = trim(objForm.zipCode.value);
	if(objForm.zipCode.value.length < 6)
	{
		alert("Please enter a 6 digit pincode");
		objForm.zipCode.focus()
		return false;
	}

	if(objForm.zipCode.value != "")
	{
		var val = objForm.zipCode.value;
		if(parseInt(val) == 0) {
		alert("Please check the pincode you have entered")
		objForm.zipCode.focus()
		return false;
		}
		
	}
	objForm.HomeStd.value = trim(objForm.HomeStd.value);
	objForm.HomePhone.value = trim(objForm.HomePhone.value);
	objForm.OfficeStd.value = trim(objForm.OfficeStd.value);
	objForm.OfficePhone.value = trim(objForm.OfficePhone.value);
	objForm.MobileNo.value = trim(objForm.MobileNo.value);
	
	if(!isNotEmpty(objForm.HomeStd)){
		if(!isNotEmpty(objForm.OfficeStd)){
			if(!isNotEmpty(objForm.MobileNo)){
				alert("Please enter at least one telephone number");
				objForm.HomeStd.focus();
				return false;
			}
		}
	    else if(!isNotEmpty(objForm.OfficeStd)){
			alert("Please enter office phone");
			objForm.OfficeStd.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.HomeStd)){
		alert("Please enter home phone");
		objForm.HomeStd.focus();
		return false;
	}
	//alert("Test1");
	var phoneLengthHome = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
	var phoneLengthOff =  objForm.OfficeStd.value.length + objForm.OfficePhone.value.length;
	//alert(phoneLengthOff);
	if(isNotEmpty(objForm.HomePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				//alert("Test1");
				alert("Please check the STD code and number you have entered");
				objForm.HomeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.OfficeStd) && parseInt(phoneLengthOff) != 11)
		{		
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				//alert("Test2");
				alert("Please check the STD code and number you have entered");
				objForm.OfficeStd.focus();
				return false;
			}
		}


	if(objForm.HomeStd.value != "" || objForm.OfficeStd.value == "" && objForm.MobileNo.value == "")
	{		
		var phoneLength = objForm.HomeStd.value.length + objForm.HomePhone.value.length;
		//alert(phoneLength);		
		if(parseInt(phoneLength) < 11 )
		{	alert("Please check the STD code and number you have entered");
			objForm.HomeStd.focus();
			return false;
		}	
	}
	
	var mobLength = document.getElementById("MobileNo").value.length;
	if(document.getElementById("MobileNo").value != "") {
		var str = document.getElementById("MobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("MobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("MobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("MobileNo").focus();
				return false;
			}
		}
	}
		/////// Ensuring length of phone nos..code ends 		
	return true;
	}
/*-------------------------------------------------------------*/




// Kumar(JVC Enquiry) 
function validateJvcInquiry()
{	
	objForm = document.jvcEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}

	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

// Kumar(NeoWheel Enquiry + Webasto Enquiry)
function validateWebastoInquiry()
{	
	objForm = document.webastoEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}
	
	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

//Kumar( Microtech Enquiry )
function validatemicrotechInquiry()

{	
	objForm = document.webastoEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}
	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

// Kumar(Nakamichi Enquiry)
function validatenakamichiInquiry()
{	
	objForm = document.NakamichiEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}
	
	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

// Kumar(Garware Enquiry) 
function validategarwrEnquiry()
{	
	objForm = document.garwrEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}
	
	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

/*Kumar(Validation for misc form)*/
function validateMiscInquiry()
{	
	objForm = document.miscEnquiry;
	objForm.firstName.value = trim(objForm.firstName.value);
	if(!isName(objForm.firstName))
	{
	alert("Please enter first name");
	objForm.firstName.focus();
	return false;	
	}

	objForm.lastName.value = trim(objForm.lastName.value);
	if(!isName(objForm.lastName))
	{
	alert("Please enter last name");
	objForm.lastName.focus();
	return false;	
	}

	objForm.eMail.value = trim(objForm.eMail.value);
	if(objForm.eMail.value == ""){
		alert("Please enter e-mail id");
		objForm.eMail.focus();
		return false;
	}

	if (objForm.eMail.value!="" && !valid_email(objForm.eMail.value) || !spaceCheck(objForm.eMail)){ 
		alert("Please enter valid e-mail id");
		objForm.eMail.focus();
		return false;
	}
	
	if(objForm.city.value == "")
	{
		alert("Please select City");
		objForm.city.focus();
		return false;
	}
	
	objForm.homeStd.value = trim(objForm.homeStd.value);
	objForm.homePhone.value = trim(objForm.homePhone.value);
	objForm.offStd.value = trim(objForm.offStd.value);
	objForm.offPhone.value = trim(objForm.offPhone.value);
	objForm.mobile.value = trim(objForm.mobile.value);
	
	if(!isNotEmpty(objForm.homeStd)){
		if(!isNotEmpty(objForm.offStd)){
			if(!isNotEmpty(objForm.mobile)){
				alert("Please enter at least one contact number");
				objForm.homeStd.focus();
				return false;
			}
		}
		else if(!isNotEmpty(objForm.offPhone)){
			alert("Please enter office phone");
			objForm.offPhone.focus();
			return false;
		}
	}
	else if(!isNotEmpty(objForm.homePhone)){
		alert("Please enter home phone");
		objForm.homePhone.focus();
		return false;
	 }
	 
	var phoneLengthHome = objForm.homeStd.value.length + objForm.homePhone.value.length;
	var phoneLengthOff =  objForm.offStd.value.length + objForm.offPhone.value.length;	

	if(isNotEmpty(objForm.homePhone) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.homeStd.focus();
				return false;
			}
		}

	if(isNotEmpty(objForm.offPhone) && parseInt(phoneLengthOff) != 11)
		{
		if(parseInt(phoneLengthOff) < 11 || parseInt(phoneLengthOff) > 11)
			{
				alert("Please check the std code and number you have entered");
				objForm.offStd.focus();
				return false;
			}
		}
		
	if(objForm.offStd.value != "" || objForm.homeStd.value == "" && objForm.mobile.value == "")
	{
		var phoneLength = objForm.offStd.value.length + objForm.offPhone.value.length;
		if(parseInt(phoneLength) < 11 )
		{
			alert("Please check the std code and number you have entered");
			objForm.offStd.focus();
			return false;
		}		
	}
	var mobLength = document.getElementById("mobile").value.length;
	if(document.getElementById("mobile").value != "") {
		var str = document.getElementById("mobile").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("mobile")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("mobile").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("mobile").focus();
				return false;
			}
		}
	}
return true;
}

/* End of Validation */

/* Validate Ad Form*/

function validAdForm() {		
objForm = document.adForm;
objForm.pFirstName.value = trim(objForm.pFirstName.value);
objForm.pLastName.value = trim(objForm.pLastName.value);

	if (!isName(objForm.pFirstName)){ 
		alert("Please enter first name");
		objForm.pFirstName.focus();
		return false;
	}
	if (!isName(objForm.pLastName)){ 
		alert("Please enter last name");
		objForm.pLastName.focus();
		return false;
	}

	objForm.pEmail.value = trim(objForm.pEmail.value);
	if(objForm.pEmail.value == ""){
		alert("Please enter e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	if (objForm.pEmail.value!="" && !valid_email(objForm.pEmail.value)){ 
		alert("Please enter valid e-mail id");
		objForm.pEmail.focus();
		return false;
	}
	objForm.pCompany.value = trim(objForm.pCompany.value);
	if ((objForm.pCompany.value) == ""){ 
		alert("Please enter company name");
		objForm.pCompany.focus();
		return false;
	}
	
	
	objForm.pOfficePhone1.value = trim(objForm.pOfficePhone1.value);
	objForm.pOfficePhone2.value = trim(objForm.pOfficePhone2.value);
	objForm.pMobileNo.value = trim(objForm.pMobileNo.value);
	
	if(!isNotEmpty(objForm.pOfficePhone1)){
			if(!isNotEmpty(objForm.pMobileNo)){
				alert("Please enter at least one telephone number");
				objForm.pOfficePhone1.focus();
				return false;
			}
		}
		
	var phoneLengthHome = objForm.pOfficePhone1.value.length + objForm.pOfficePhone2.value.length;
	if((phoneLengthHome != 0) && ((objForm.pOfficePhone1.value == 0) || (objForm.pOfficePhone2.value == 0)))
		{
			alert("Please check the office std code / phone number you have entered");
			objForm.pOfficePhone1.focus();
			return false;
		}
	if(isNotEmpty(objForm.pOfficePhone2) && parseInt(phoneLengthHome) != 11)
		{
		if(parseInt(phoneLengthHome) < 11 || parseInt(phoneLengthHome) > 11)
			{
				alert("Please check the office std code / phone number you have entered");
				objForm.pOfficePhone1.focus();
				return false;
			}
		}

	if(objForm.pOfficePhone1.value != ""&& objForm.pMobileNo.value == "")
	{		
		var phoneLength = objForm.pOfficePhone1.value.length + objForm.pOfficePhone2.value.length;
		
		if(parseInt(phoneLength) < 11 )
		{	alert("Please check the std code and number you have entered");
			objForm.pOfficePhone2.focus();
			return false;
		}	
	}
	
	var mobLength = document.getElementById("pMobileNo").value.length;
	if(document.getElementById("pMobileNo").value != "") {
		var str = document.getElementById("pMobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("pMobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("pMobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("pMobileNo").focus();
				return false;
			}
		}
	}
	
	for(i = objForm.advType.length-1 ; i > -1 ; i--  ){
		//alert(i);
	if (!(objForm.advType[i].checked))
	{
	 j = i-1 ;	 
	}
	else {
	document.getElementById("pros_but").style.display = "block";
	setTimeout('document.images["pr_img"].src="/images/buttons/acc-process.gif"', 200);
	window.status = "Processing...";
	document.getElementById("smt_but").style.display = "none";
	return true;}
	if ( j == -1 )
	 {  alert("Please choose an option");
		 return false;
	 }
	}
	/////// Ensuring length of phone nos..code ends 
	return true;
	}
	
	// JavaScript Document
function validIciciForm(){
	var objForm = document.iciciForm;
	var pareObj=parent.document.iciciForm;

	objForm.xmlFileName.value = pareObj.xmlFileName.value;
	//alert("child"+objForm.xmlFileName.value);
	//alert("parent-->"+pareObj.xmlFileName.value);
	
	objForm.pName.value = trim(objForm.pName.value);
		
	if (!isName(objForm.pName)){ 
		alert("Please enter name");
		objForm.pName.focus();
		return false;
	}
	
	objForm.pCity.value = trim(objForm.pCity.value);
	if (objForm.pCity.value == "")
	{ 
		alert("Please enter city name");
		objForm.pCity.focus();
		return false;
	}
	
	objForm.pinCode.value = trim(objForm.pinCode.value);
	if(objForm.pinCode.value.length < 6)
	{
		alert("Please enter a 6 digit pincode");
		objForm.pinCode.focus()
		return false;
	}

	if(objForm.pinCode.value != "")
	{
		var val = objForm.pinCode.value;
		if(parseInt(val) == 0) {
		alert("Please check the pincode you have entered")
		objForm.pinCode.focus()
		return false;
		}		
	}
	
	objForm.pMobileNo.value = trim(objForm.pMobileNo.value);
	objForm.pLandPhone.value = trim(objForm.pLandPhone.value);
	var mobLength = objForm.pMobileNo.value.length;
	var phoneLength = objForm.pLandPhone.value.length;		
	if (mobLength == 0  && phoneLength == 0)
	{
	alert("Please enter mobile or landline phone number");
	document.getElementById("pMobileNo").focus();
	return false;}
	
	if(document.getElementById("pMobileNo").value != "") {
		var str = document.getElementById("pMobileNo").value;
		str = str.substring(0,1);
	if(isNotEmpty(document.getElementById("pMobileNo")) && parseInt(mobLength) != 11) {
		if(str != 9) {
			alert("Please check the number you have entered");
			document.getElementById("pMobileNo").focus();
			return false;
		}
		if(parseInt(mobLength) < 10 || parseInt(mobLength) > 10)
			{
				alert("Please check the number you have entered");
				document.getElementById("pMobileNo").focus();
				return false;
			}
		}
	}
	

	

	if (objForm.pLandPhone.value == "" && mobLength == 0 )
	{ 
		alert("Please enter landline phone number");
		objForm.pLandPhone.focus();
		return false;
	}
	
	if(objForm.pLandPhone.value != "")
	{				
		if(parseInt(phoneLength) < 11 )
		{	alert("Please check the std code and number you have entered");
			objForm.pLandPhone.focus();
			return false;
		}	
	}
	
	
	if(objForm.pManYear.selectedIndex == 0 )
	{
		alert("Please select year of manufacture");
		objForm.pManYear.focus();
		return false;			
	}
	
	if (!objForm.pInsFor[0].checked && !objForm.pInsFor[1].checked)
	 {  
	 alert("Please choose an option of insurance for"); 
	 objForm.pInsFor[0].focus();
	 return false;
	 }	

	/*if(objForm.pManYear.value.length < 4)
	{
		alert("Please enter year in 4 digits");
		objForm.pManYear.focus()
		return false;
	}	
	var thisyear = objForm.pManYear.value;
	var date = new Date();
	var year = date.getFullYear();
	if( thisyear < year - 7)
	{ 
	alert("Insurance cannot be purchased online if Year of manufacture is older than 7 years");
	objForm.pManYear.focus();	
	return false; }	
	else if (thisyear > year )
	{ alert("Please enter a valid year of manufacture"); 	
	objForm.pManYear.focus();
	return false;}*/
	}
/*kailas*/
function validlogin()
{
objForm = document.formUsedCarReSearch;
	objForm.userId.value = trim(objForm.userId.value);
	if(objForm.userId.value == ""){
		alert("Please enter e-mail id");
		objForm.userId.focus();
		return false;
	}
	if (objForm.userId.value!="" && !valid_email(objForm.userId.value)){ 
		alert("Please enter valid e-mail id");
		objForm.userId.focus();
		return false;
	}
	if(objForm.userPassword.value == ""){
		alert("Please enter the password");
		objForm.userPassword.focus();
		return false;
	}
return true;
}
/////////////////////


