//-------------------------------------Validation for Annual Income and occupation in search box-----------------------------------
function ApplyNow_NV(web_path,product_item_id,product_id,bank_id)
{
	document.getElementById('final_product_item_ids').value = product_item_id;
 	document.getElementById('light').style.display='block';
	document.getElementById('fade').style.display='block'
	//document.body.style.overflowY = 'hidden';
}
function compare_nv(){
    
	var ids_str = trim(document.getElementById('product_order_list').value);
	//alert(ids_str);
	var new_ids_str = ids_str.replace(",#6","");
	var new_ids_str = new_ids_str.replace(",#3","");
    document.getElementById('final_product_item_ids').value = new_ids_str;
  	document.getElementById('light').style.display='block';
	document.getElementById('fade').style.display='block';
	//document.body.style.overflowY = 'hidden';
}

function validate()
{
	if(document.getElementById("age").value!= '')
	{
		if(IsNumeric(document.getElementById("age").value)== false)
		{
			alert("Character and special character are not allowed in Age.\n Enter only numbers.");
			document.getElementById("age").focus();
			return false;        
		}
	}
	if(document.getElementById("annual_income").value!= '')
	{
		if(IsNumeric(document.getElementById("annual_income").value)== false)
		{
			alert("Character and special character are not allowed in Annual Income.\n Enter only numbers.");
			document.getElementById("annual_income").focus();
				return false;
		}
	}
	if(document.getElementById("annual_income").value)
	{
			if(document.getElementById("DrpListCity").selectedIndex == 0)
			{
				alert("Please select the occupation");
				document.getElementById("DrpListCity").focus();
				return false;        
			}
			else
				return true;
	}
	
	if(document.getElementById("DrpListCity").selectedIndex > 0)
	{
		if(document.getElementById("annual_income").value == '')
		{
			alert("Please select the Annual Income");
            document.getElementById("annual_income").focus();
            return false;
		}
		else
			return true;
	}
	return true;
}

function validatePL()
{
	if(document.getElementById("annual_income").value)
	{
		if(document.getElementById("DrpListCity").selectedIndex == 0)
        {
            alert("Please select the occupation");
            document.getElementById("DrpListCity").focus();
            return false;        
        }
		else
			return true;
	}
	if(document.getElementById("DrpListCity").selectedIndex > 0)
	{
		if(document.getElementById("annual_income").value == '')
		{
			alert("Please select the Annual Income");
            document.getElementById("annual_income").focus();
            return false;
		}
		else
			return true;
	}
	
	if(document.getElementById("loan_amount").value == '')
	{
		alert("Please enter loan amount.");
		document.getElementById("loan_amount").focus();
		return false;        
	}

	if(IsNumeric(document.getElementById("loan_amount").value) == false)
	{
		alert("Character and special character are not allowed.\n Enter only numbers.");
		document.getElementById("loan_amount").focus();
		return false;        
	}

	if(document.getElementById("DrpListRepayment").selectedIndex == 0)
	{
		alert("Please select the repayment period.");
		document.getElementById("DrpListRepayment").focus();
		return false;        
	}
			return true;

}

function validate_home_loan_compare(){
	var loan_amount = document.getElementById("loan_amount");
	var repayment = document.getElementById("repayment");
	var annual_income = document.getElementById("annual_income");
	var age = document.getElementById("age");
	var search_city = document.getElementById("search_city");
	if(trim(loan_amount.value) == ""){
		alert("Please enter your Loan Amount");
		loan_amount.focus();
		return false;
	}
	if(IsNumeric(loan_amount.value) == false)
	{
		alert("Character and special character are not allowed.\n Enter only numbers.");
		loan_amount.focus();
		return false;        
	}
	if(trim(annual_income.value) == "" || trim(annual_income.value) == "0"){
		alert("Please enter your Net monthly income");
		annual_income.focus();
		return false;
	}
	if(IsNumeric(annual_income.value) == false)
	{
		alert("Character and special character are not allowed.\n Enter only numbers.");
		annual_income.focus();
		return false;        
	}
	if(age.value == ""){
		alert("Please select your age");
		age.focus();
		return false;
	}
	/*if(repayment.value == ""){
		alert("Please select your repayment period");
		repayment.focus();
		return false;
	}*/
	if(search_city.value == ""){
		alert("Please select your City");
		search_city.focus();
		return false;
	}
	return true;


}

function validateInsurance()
{
	if(document.getElementById("age").value!= '')
	{
		if(IsNumeric(document.getElementById("age").value)== false)
		{
			alert("Character and special character are not allowed in Age.\n Enter only numbers.");
			document.getElementById("age").focus();
			return false;        
		}
	}
	if(document.getElementById("term_of_policy").value!= '')
	{
		if(IsNumeric(document.getElementById("term_of_policy").value)== false)
		{
			alert("Character and special character are not allowed in term of policy.\n Enter only numbers.");
			document.getElementById("term_of_policy").focus();
			return false;        
		}
	}
	if(document.getElementById("sum_assured").value!= '')
	{
		if(IsNumeric(document.getElementById("sum_assured").value)== false)
		{
			alert("Character and special character are not allowed in sum assured.\n Enter only numbers.");
			document.getElementById("sum_assured").focus();
			return false;        
		}
	}
			return true;
	
	
}
//-------------------------Car Insurance---------------------------------------------------------------------------------------
//------------------------Manufacturer - Model relationship dropdown------------------------------------------
function dropDown(name)
{
	if(name=='manufacturer')
	{
		var myForm = document.pl_search;
		var manufacturer = myForm.manufacturer.options[myForm.manufacturer.selectedIndex].value;
		var val=document.pl_search.model;
	}
	else if(name=='make')
	{
		var myForm = document.reg_form;
		var manufacturer = myForm.make.options[myForm.make.selectedIndex].value;
		var val=document.reg_form.mod;
	}
	removeAllOptions(val);
	if(manufacturer == '')
	{
		addOption(val,"", "Select");
		addOption(val,"4", "4");
		addOption(val,"3 series", "3 series");
		addOption(val,"Spark", "Spark");
		addOption(val,"UVA", "UVA");
		addOption(val,"Aveo", "Aveo");
		addOption(val,"SRV", "SRV");
		addOption(val,"optra Magnum", "optra Magnum");
		addOption(val,"Tavera", "Tavera");
		addOption(val,"Captiva", "Captiva");
		addOption(val,"Palio stile", "Palio stile");
		addOption(val,"Fiesta", "Fiesta");
		addOption(val,"Ikon", "Ikon");
		addOption(val,"Endeavour", "Endeavour");
		addOption(val,"Fusion", "Fusion");
		addOption(val,"civic", "civic");
		addOption(val,"Accord", "Accord");
		addOption(val,"CRV", "CRV");
		addOption(val,"City ZX", "City ZX");
		addOption(val,"Accent", "Accent");
		addOption(val,"Verna", "Verna");
		addOption(val,"Elantra", "Elantra");
		addOption(val,"Tucson", "Tucson");
		addOption(val,"Getz Prime", "Getz Prime");
		addOption(val,"Santro Xing", "Santro Xing");
		addOption(val,"i10", "i10");
		addOption(val,"Sonata embera", "Sonata embera");
		addOption(val,"Logan", "Logan");
		addOption(val,"bolero", "bolero");
		addOption(val,"Scorpio Getaway", "Scorpio Getaway");
		addOption(val,"Scorpio", "Scorpio");
		addOption(val,"Scorpio Mhawk", "Scorpio Mhawk");
		addOption(val,"Reva", "Reva");
		addOption(val,"Alto", "Alto");
		addOption(val,"800", "800");
		addOption(val,"WagonR", "WagonR");
		addOption(val,"Zen Estilo", "Zen Estilo");
		addOption(val,"Swift", "Swift");
		addOption(val,"Dzire", "Dzire");
		addOption(val,"SX4", "SX4");
		addOption(val,"Omni", "Omni");
		addOption(val,"Versa", "Versa");
		addOption(val,"Gypsy", "Gypsy");
		addOption(val,"Pajero", "Pajero");
		addOption(val,"Montero", "Montero");
		addOption(val,"Cedia", "Cedia");
		addOption(val,"Lancer", "Lancer");
		addOption(val,"Xtrail", "Xtrail");
		addOption(val,"Teana", "Teana");
		addOption(val,"Others", "Others");
		addOption(val,"Fabia", "Fabia");
		addOption(val,"Octavia", "Octavia");
		addOption(val,"Laura/ Superb", "Laura/ Superb");
		addOption(val,"Grand Vitara", "Grand Vitara");
		addOption(val,"Indica", "Indica");
		addOption(val,"Indigo CS", "Indigo CS");
		addOption(val,"Indigo", "Indigo");
		addOption(val,"Sumo Vita", "Sumo Vita");
		addOption(val,"Sumo Grande", "Sumo Grande");
		addOption(val,"Indigo Marina", "Indigo Marina");
		addOption(val,"Safari dicor", "Safari dicor");
		addOption(val,"Corolla", "Corolla");
		addOption(val,"Camry", "Camry");
		addOption(val,"Innova", "Innova");
		addOption(val,"Passat", "Passat");

	}
	if(manufacturer == 'Audi')
	{
		addOption(val,"", "Select");
		addOption(val,"4", "4");
	}
	if(manufacturer == 'BMW 3')
	{
		addOption(val,"", "Select");
		addOption(val,"3 series", "3 series");
	}
	if(manufacturer == 'Chevrolet')
	{
		addOption(val,"", "Select");
		addOption(val,"Spark", "Spark");
		addOption(val,"UVA", "UVA");
		addOption(val,"Aveo", "Aveo");
		addOption(val,"SRV", "SRV");
		addOption(val,"optra Magnum", "optra Magnum");
		addOption(val,"Tavera", "Tavera");
		addOption(val,"Captiva", "Captiva");
	}
	if(manufacturer == 'Fiat')
	{
		addOption(val,"", "Select");
		addOption(val,"Palio stile", "Palio stile");
	}
	if(manufacturer == 'Ford')
	{
		addOption(val,"", "Select");
		addOption(val,"Fiesta", "Fiesta");
		addOption(val,"Ikon", "Ikon");
		addOption(val,"Endeavour", "Endeavour");
		addOption(val,"Fusion", "Fusion");
	}
	if(manufacturer == 'Honda')
	{
		addOption(val,"", "Select");
		addOption(val,"civic", "civic");
		addOption(val,"Accord", "Accord");
		addOption(val,"CRV", "CRV");
		addOption(val,"City ZX", "City ZX");
	}
	if(manufacturer == 'Hyundai')
	{
		addOption(val,"", "Select");
		addOption(val,"Accent", "Accent");
		addOption(val,"Verna", "Verna");
		addOption(val,"Elantra", "Elantra");
		addOption(val,"Tucson", "Tucson");
		addOption(val,"Getz Prime", "Getz Prime");
		addOption(val,"Santro Xing", "Santro Xing");
		addOption(val,"i10", "i10");
		addOption(val,"Sonata embera", "Sonata embera");
	}
	if(manufacturer == 'Mahindra')
	{
		addOption(val,"", "Select");
		addOption(val,"Logan ", "Logan ");
		addOption(val,"bolero", "bolero");
		addOption(val,"Scorpio Getaway", "Scorpio Getaway");
		addOption(val,"Scorpio", "Scorpio");
		addOption(val,"Scorpio Mhawk", "Scorpio Mhawk");
	}
	if(manufacturer == 'Maini')
	{
		addOption(val,"", "Select");
		addOption(val,"Reva", "Reva");
	}
	if(manufacturer == 'Maruti')
	{
		addOption(val,"", "Select");
		addOption(val,"Alto", "Alto");
		addOption(val,"800", "800");
		addOption(val,"WagonR", "WagonR");
		addOption(val,"Zen Estilo", "Zen Estilo");
		addOption(val,"Swift", "Swift");
		addOption(val,"Dzire", "Dzire");
		addOption(val,"SX4", "SX4");
		addOption(val,"Omni", "Omni");
		addOption(val,"Versa", "Versa");
		addOption(val,"Gypsy", "Gypsy");
	}
	if(manufacturer == 'Mitsubhishi')
	{
		addOption(val,"", "Select");
		addOption(val,"Pajero", "Pajero");
		addOption(val,"Montero", "Montero");
		addOption(val,"Cedia", "Cedia");
		addOption(val,"Lancer", "Lancer");
	}
	if(manufacturer == 'Nissan')
	{
		addOption(val,"", "Select");
		addOption(val,"Xtrail", "Xtrail");
		addOption(val,"Teana", "Teana");
	}
			if(manufacturer == 'Others')
	{
		addOption(val,"", "Select");
		addOption(val,"Others", "Others");
	}
			if(manufacturer == 'Skoda')
	{
		addOption(val,"", "Select");
		addOption(val,"Fabia", "Fabia");
		addOption(val,"Octavia", "Octavia");
		addOption(val,"Laura/ Superb", "Laura/ Superb");
	}
			if(manufacturer == 'Suzuki')
	{
				addOption(val,"", "Select");
		addOption(val,"Grand Vitara", "Grand Vitara");
	}
			if(manufacturer == 'Tata')
	{
				addOption(val,"", "Select");
		addOption(val,"Indica", "Indica");
		addOption(val,"Indigo CS", "Indigo CS");
		addOption(val,"Indigo", "Indigo");
		addOption(val,"Sumo Vita", "Sumo Vita");
		addOption(val,"Sumo Grande", "Sumo Grande");
		addOption(val,"Indigo Marina", "Indigo Marina");
		addOption(val,"Safari dicor", "Safari dicor");
	}
			if(manufacturer == 'Toyota')
	{
				addOption(val,"", "Select");
		addOption(val,"Corolla", "Corolla");
		addOption(val,"Camry", "Camry");
		addOption(val,"Innova", "Innova");
	}
			if(manufacturer == 'VW')
	{
				addOption(val,"", "Select");
		addOption(val,"Passat", "Passat");
	}
	return true;
}
function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}
function removeAllOptions(selectbox)
{
	var i;
	var len =selectbox.options.length;
	for(i=len-1;i>=0;i--)
	{
		selectbox.remove(i);
	}
}
function validateCarInsurance()
{
	if(document.getElementById("state_id").selectedIndex == 0)
	{
		alert("Please select the state");
		document.getElementById("state_id").focus();
		return false;        
	}
	if(document.getElementById("city_id").selectedIndex == 0)
	{
		alert("Please select the city");
		document.getElementById("city_id").focus();
		return false;        
	}
	if(document.getElementById("year").selectedIndex == 0)
	{
		alert("Please select the year of manufacture");
		document.getElementById("year").focus();
		return false;        
	}
	if(document.getElementById("manufacturer").selectedIndex == 0)
	{
		alert("Please select the manufacturer");
		document.getElementById("manufacturer").focus();
		return false;        
	}
	if(document.getElementById("model").selectedIndex == 0)
	{
		alert("Please select the model");
		document.getElementById("model").focus();
		return false;        
	}
	if(document.getElementById("engine_cc").selectedIndex == 0)
	{
		alert("Please select the engine cc");
		document.getElementById("engine_cc").focus();
		return false;        
	}
	return true;
}
//-------------------------------------New window for Key-Benefits-----------------------------------
function newWindow(web_path,item_id,id)
{
		//alert('Key-Benefits1.php?product_item_id='+item_id+'&product_id='+id+'&product_page=1');
		window.open(web_path+'Key-Benefits1.php?product_item_id='+item_id+'&product_id='+id+'&product_page=1','mywindow','width=750,height=700,scrollbars=yes,resizable=1');
}

//-------------------------------------New window for Compare Products-----------------------------------

function newCompareWindow(compare_cc,item_id)
{
	var item_arr =item_id.split(",");
	var len = item_arr.length-1
	if(item_id =="no" || len==0 || len==1)
	{
		alert("Please select at least two products for comparision.");
	}
	else
	{
		window.open(compare_cc+'.php?ids='+item_id+'','newwindow','width=950,height=500,scrollbars=yes,resizable=1');
	}
}
//-------------------------------------Open register form on Apply button-----------------------------------
function compare()
{
	//document.getElementById("slidder").style.display = "block";
	//document.getElementById("aslam.nextSibling").style.display = "block";
	if(dnt==0)
	{
		document.getElementById("slidder").style.display = "block";
		togglePannelAnimatedStatus(aslam.nextSibling,50,50);
		dnt=1;
	}
}
//-------------------------------------On Sort-----------------------------------
function redirect(web_path,product_url_name,fields,field_nm,sort)
{
	var p_ids = document.getElementById('product_order_list').value;
	var strResult = p_ids.split("#");
	window.location= web_path+product_url_name+"/compare.php?field_name=`"+field_nm+"`&product_order_list="+strResult[0]+"&sort="+sort+"&"+fields;
	return true;
}

//-------------------------------------OnLoad-----------------------------------
function OnLoad(web_path,product_id,product_item_ids,myAssoc,count,compare_id) {
		
		//alert(product_item_ids+"  "+myAssoc+"   "+compare_id);
		var product_item_ids_array = product_item_ids.split(",");
		if(document.test.checkgroup.length) 
		{
			//alert(document.test.checkgroup.length);
			for (i=0; i<product_item_ids_array.length; i++)
			{
				if(i == 0)
				{
					var evel_val = eval("document.test.checkgroup["+product_item_ids_array[0]+"].value");
					var f1 = evel_val.split("/");
					var s1 = f1[f1.length-1].split(".");
					var product_item_id1 = s1[0];

					document.getElementById("a1").innerHTML = returnProductName(myAssoc[evel_val]);  
					document.getElementById("b1").innerHTML = "";
					var title1 = document.getElementById("a1").innerHTML.substring(4);
					document.getElementById("first").innerHTML = "<a href='#'><img border='0' alt='"+title1+"' src='"+evel_val+"' onclick=newWindow('"+web_path+"',"+product_item_id1+","+product_id+")></a>" +"<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif' onclick='return remove(1,"+product_item_ids_array[0]+");' title='Remove'></span>";
					document.test.checkgroup[product_item_ids_array[0]].checked=true;
					compare_id = product_item_id1 +","+compare_id;
					count = 1;
				}
				if(i == 1)
				{
					var evel_val1 = eval("document.test.checkgroup["+product_item_ids_array[1]+"].value");
					var f2 =  evel_val1.split("/");
					var s2 = f2[f2.length-1].split(".");
					var product_item_id2 = s2[0];

					document.getElementById("a2").innerHTML = returnProductName(myAssoc[evel_val1]);
					var title2 = document.getElementById("a2").innerHTML.substring(4);
					document.getElementById("second").innerHTML = "<a href='#'><img border='0' alt='"+title2+"' src='"+evel_val1+"' onclick=newWindow('"+web_path+"',"+product_item_id2+","+product_id+")></a>" + "<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif'  onclick='return remove(2,"+product_item_ids_array[1]+");' title='Remove'></span>";
					document.test.checkgroup[product_item_ids_array[1]].checked=true;
					compare_id = product_item_id2 +","+compare_id;
					count = 2;
				}
				if(i== 2)
				{
					var evel_val2 = eval("document.test.checkgroup["+product_item_ids_array[2]+"].value");
					var f3 = evel_val2.split("/");
					var s3 = f3[f3.length-1].split(".");
					var product_item_id3 = s3[0];

					document.getElementById("a3").innerHTML =returnProductName(myAssoc[evel_val2]); 
					var title3 = document.getElementById("a3").innerHTML.substring(4);
					document.getElementById("third").innerHTML = "<a href='#'><img border='0' alt='"+title3+"' src='"+evel_val2+"' onclick=newWindow('"+web_path+"',"+product_item_id3+","+product_id+")></a>" + "<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif'  onclick='return remove(3,"+product_item_ids_array[2]+");' title='Remove'></span>";
					document.test.checkgroup[product_item_ids_array[2]].checked=true;
					compare_id = product_item_id3 +","+compare_id;
					count = 3;
				}
				if(i== 3)
				{
					var evel_val3 = eval("document.test.checkgroup["+product_item_ids_array[3]+"].value");
					var f4 = evel_val3.split("/");
					var s4 = f4[f4.length-1].split(".");
					var product_item_id4 = s4[0];

					document.getElementById("a4").innerHTML = returnProductName(myAssoc[evel_val3]);
					var title4 = document.getElementById("a4").innerHTML.substring(4);
					document.getElementById("fourth").innerHTML = "<a href='#'><img border='0' alt='"+title4+"' src='"+evel_val3+"' onclick=newWindow('"+web_path+"',"+product_item_id4+","+product_id+")></a>"+"<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif'  onclick='return remove(4,"+product_item_ids_array[3]+");' title='Remove'></span>";
					document.test.checkgroup[product_item_ids_array[3]].checked=true;
					compare_id = product_item_id4 +","+compare_id;
					count = 4;
				}

				//-------------------1.Selected Row Background Gray -- Onload------------
				//alert("onload");
				//selectedRow();
				//-----------------------------------------------------------------
				//document.getElementById("compare").style.display = "block";

			}
		}
		else 
		{
			//----------------------For single record-------------------------------------------
					var evel_val = eval("document.test.checkgroup.value");
					var f1 = document.test.checkgroup.value.split("/");
					var s1 = f1[f1.length-1].split(".");
					var product_item_id1 = s1[0];

					document.getElementById("a1").innerHTML = returnProductName(myAssoc[evel_val]);
					var title5 = document.getElementById("a1").innerHTML.substring(4);
					document.getElementById("first").innerHTML = "<a href='#'><img alt='"+title5+"' border='0' src='"+evel_val+"' onclick=newWindow('"+web_path+"',"+product_item_id1+","+product_id+")></a>" +"<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif' onclick='return remove(1,"+product_item_ids_array[0]+");' title='Remove'></span>";
					document.test.checkgroup.checked=true;
					
					compare_id = s1[0] +","+compare_id;
					count = 1;
					//-------------------2.Selected Row Background Gray -- Onload------------
					var chkVal = document.test.checkgroup.value;
					document.getElementById(chkVal).className= "even";
					//-----------------------------------------------------------------

		}
			document.getElementById("compareLink").name = compare_id;
			document.getElementById("compareLink").href = "#";
			document.getElementById("product_order_list").value = compare_id+"#"+product_id;
			if(count == 0){
				document.getElementById("compare").style.display = "none";
				document.getElementById("slidder").style.display = "none";
				document.getElementById("msg1").style.display = "none";
				document.getElementById("msg2").style.display = "none";
			}

}

function selectedRow()
{
	/*var count = 0;
	//alert(document.test.checkgroup.length);
	for (s=0; s<document.test.checkgroup.length; s++)
	{
		var chkVal = document.test.checkgroup[s].value;
			//alert(chkVal);
			if (document.test.checkgroup[s].checked==1)
			{
					count++;
					if(count > 4)
					{
						document.getElementById(chkVal).className= "odd";
					}
					else
				   {
						document.getElementById(chkVal).className= "even";
				   }
			}
			else
			{
				document.getElementById(chkVal).className= "odd";
			}
	}*/
}
function returnProductName(myFirst)
{
	var myFirstResult = myFirst.split("-");
	//var myFirstProduct = myFirstResult[0]+"<br>"+myFirstResult[1];
	var myFirstProduct = "<br>"+myFirstResult[1];
	return myFirstProduct;
}
function getProductName(myString)
{
		var myStringResult = myString.split(",");
		var myAssoc = [];
		myCt = myStringResult.length;
		for (d=0; d<myCt; d++)
		{
			myAssoc[myStringResult[d]] = myStringResult[d+1] ;
		}
		return myAssoc;
}
//-------------------------------------Apply Now----------------------------------
function ApplyNow(web_path,product_item_id,product_id,bank_id)
{
	//alert(product_id+"=="+bank_id);	
	//var link = product_item_id+","+ product_id+"#";
	var link = product_item_id+",#"+ product_id;
	var order_ids = document.getElementById("product_order_list").value;
	var order_array = order_ids.split(",");
	var order_len = order_array.length;
	document.getElementById("second").innerHTML = "&nbsp;";
	document.getElementById("a2").innerHTML = "&nbsp;";
	document.getElementById("b2").innerHTML = "&nbsp;";
	document.getElementById("third").innerHTML = "&nbsp;";
	document.getElementById("a3").innerHTML = "&nbsp;";
	document.getElementById("b3").innerHTML = "&nbsp;";
	document.getElementById("fourth").innerHTML = "&nbsp;";
	document.getElementById("a4").innerHTML = "&nbsp;";
	document.getElementById("b4").innerHTML = "&nbsp;";
	document.getElementById("product_order_list").value = link;
	document.getElementById("compareLink").name = "no";
	document.getElementById("compareLink").href = "#";
	document.getElementById("compare").style.display = "block";
		for (var i=0; i<document.test.checkgroup.length; i++)
		{	
			var evel_val = eval("document.test.checkgroup["+i+"].value");
			var f1 = evel_val.split("/");
			var s1 = f1[f1.length-1].split(".");
			var product_item_id1 = s1[0];
			var myAssoc = getProductName(myString);
			if(product_item_id1 == product_item_id)
			{
				//-------code for kotak bank(id=6)-applynow button redirected to kotak site------------------------
				var p_name = returnProductName(myAssoc[evel_val]); 
				var arr = p_name.split('<br>');
				var bank_name = arr[0];
				if(bank_id == 5){
					window.open('http://www.s2d6.com/x/?x=c&amp;z=s&amp;v=1126300&amp;k=[NETWORKID]','mywindow','width=750,height=700,scrollbars=yes,resizable=1');
					//document.getElementById("slidder").style.display = "none";  //closes the form
					dnt=0;
				} else 	{
					document.getElementById("a1").innerHTML = returnProductName(myAssoc[evel_val]); 
					document.getElementById("b1").innerHTML = "";
					document.getElementById("first").innerHTML = "<a href='#'><img border='0' src='"+evel_val+"' onclick=newWindow('"+web_path+"',"+product_item_id1+","+product_id+")></a>" +"<span style='vertical-align:top;margin-left:12px'><img src='"+web_path+"images/black-close.gif' onclick='return remove(1,"+i+");' title='Remove'></span>";
					document.test.checkgroup[i].checked=true;
					var chkVal = document.test.checkgroup[i].value;
					document.getElementById(chkVal).className= "even";
					//dnt=1;
					//if(document.getElementById("slidder").style.display=='none')
					//	dnt=0;
					//else
					//	dnt=1;
				}
			}
			else
			{
				var chkVal = document.test.checkgroup[i].value;
				document.getElementById(chkVal).className= "odd";
				document.test.checkgroup[i].checked=false;
			}
		}
		//alert(dnt)
		if(order_len ==2)
		{
			document.getElementById("slidder").style.display = "block";
			document.getElementById("aslam.nextSibling").style.display = "block";
			//alert("111111")
			dnt =1;
		}
		else if(dnt == 0)
		{
			document.getElementById("slidder").style.display = "block";
			togglePannelAnimatedStatus(aslam.nextSibling,50,50);
			//alert("22222")
			dnt =1;
		}
		
}
//-------------------------------------On Remove -----------------------------------

function remove(rm,ind)
{
	var count=0;
	var compare_id = '';

	if(document.test.checkgroup.length)
	{
			document.test.checkgroup[ind].checked = false;
			//-------------------3.Selected Row Background Gray --On Remove------------
			var chkVal=document.test.checkgroup[ind].value;
			//document.getElementById(chkVal).className= "odd";
			//--------------------------------------------------------------
			for (i=0; i<document.test.checkgroup.length; i++)
			{
				
				if(document.test.checkgroup[i].checked==true){
					//--------------------Get product_item_id------------------
					var mySplit = document.test.checkgroup[i].value.split("/");
					var compareSplit = mySplit[mySplit.length-1].split(".");
					compare_id = compareSplit[0] +","+compare_id;
					//--------------------------------------------------------
					count++;
				}
			}
			if(count == 0)
			{
				document.getElementById("compare").style.display = "none";
				document.getElementById("slidder").style.display = "none";
				document.getElementById("msg1").style.display = "none";
				document.getElementById("msg2").style.display = "none";
			}
			if(rm == 1)
			{
				document.getElementById("first").innerHTML = "&nbsp;";
				document.getElementById("a1").innerHTML = "&nbsp;";
				document.getElementById("b1").innerHTML = "&nbsp;";
			}
			if(rm == 2)
			{
				document.getElementById("second").innerHTML = "&nbsp;";
				document.getElementById("a2").innerHTML = "&nbsp;";
				document.getElementById("b2").innerHTML = "&nbsp;";
			}
			if(rm == 3)
			{
				document.getElementById("third").innerHTML = "&nbsp;";
				document.getElementById("a3").innerHTML = "&nbsp;";
				document.getElementById("b3").innerHTML = "&nbsp;";
			}
			if(rm == 4)
			{
				document.getElementById("fourth").innerHTML = "&nbsp;";
				document.getElementById("a4").innerHTML = "&nbsp;";
				document.getElementById("b4").innerHTML = "&nbsp;";
			}
			if(count == 1)
			{
				document.getElementById("compareLink").name = "no";
				document.getElementById("compareLink").href = "#";
			}
			else
			{
				document.getElementById("compareLink").name = compare_id;
				document.getElementById("compareLink").href = "#";
			}
			document.getElementById("product_order_list").value = compare_id+"#"+product_id;
	}
	else 
	{
			document.test.checkgroup.checked = false;
			document.getElementById("first").innerHTML = "&nbsp;";
			document.getElementById("a1").innerHTML = "&nbsp;";
			document.getElementById("b1").innerHTML = "&nbsp;";
			document.getElementById("compare").style.display = "none";
			document.getElementById("slidder").style.display = "none";
			document.getElementById("msg1").style.display = "none";
			document.getElementById("msg2").style.display = "none";
			
			//-------------------4.Selected Row Background Gray -- On Remove------------
			var chkVal = document.test.checkgroup.value;
			document.getElementById(chkVal).className= "odd";
			//--------------------------------------------------------------

	}
	return false;
}
//-------------------------------------On checkbox click -----------------------------------
function showcheck(myString)
{
		
		var myStringResult = myString.split(",");
		var myAssoc = [];
		var compare_id = "";
			
		myCt = myStringResult.length;
		for (d=0; d<myCt; d++)
		{
			myAssoc[myStringResult[d]] = myStringResult[d+1] ;
		}
		var j =0;
		var count = 0;
		if(document.test.checkgroup.length) {
		for (i=0; i<document.test.checkgroup.length; i++)
		{
					if (document.test.checkgroup[i].checked==1){
						j++;
						var chkVal = document.test.checkgroup[i].value;
						//--------------------Get product_item_id------------------
						var mySplit = document.test.checkgroup[i].value.split("/");
						var compareSplit = mySplit[mySplit.length-1].split(".");
						var product_item_id = compareSplit[0];
						compare_id = product_item_id +","+compare_id;
						//----------------------------------------------------------
						if(j==1)
						{
							var a1 = ""+document.test.checkgroup[i].value+"";
							var b1 = "<img src='"+web_path+"images/black-close.gif'  onclick='return remove(1,"+i+");' title='Remove'>";
							document.getElementById("first").innerHTML = "<img src='"+document.test.checkgroup[i].value+"' onclick=newWindow('"+web_path+"',"+product_item_id+","+product_id+")  width='90' height='50' title='"+myAssoc[a1]+"' alt='"+myAssoc[a1]+"'>" + "<span style='vertical-align:top;margin-left:12px'>"+b1+"</span>";
							document.getElementById("a1").innerHTML = returnProductName(myAssoc[a1]);
							document.getElementById("b1").innerHTML = "&nbsp;";
							document.getElementById("second").innerHTML = "&nbsp;";
							document.getElementById("third").innerHTML = "&nbsp;";
							document.getElementById("fourth").innerHTML = "&nbsp;";
							document.getElementById("a2").innerHTML = "&nbsp;";
							document.getElementById("a3").innerHTML = "&nbsp;";
							document.getElementById("a4").innerHTML = "&nbsp;";
							document.getElementById("b2").innerHTML = "&nbsp;";
							document.getElementById("b3").innerHTML = "&nbsp;";
							document.getElementById("b4").innerHTML = "&nbsp;";
						
						}
						if(j==2)
						{
								var a2 = ""+document.test.checkgroup[i].value+"";
								var b2 = "<img src='"+web_path+"images/black-close.gif'  onclick='return remove(2,"+i+");' title='Remove'>";
								document.getElementById("second").innerHTML = "<img src='"+document.test.checkgroup[i].value+"' onclick=newWindow('"+web_path+"',"+product_item_id+","+product_id+") width='90' height='50' title='"+myAssoc[a2]+"' alt='"+myAssoc[a2]+"'>" + "<span style='vertical-align:top;margin-left:12px'>"+b2+"</span>";
								document.getElementById("a2").innerHTML = returnProductName(myAssoc[a2]);
								document.getElementById("b2").innerHTML = "";
						}
						if(j==3)
						{
							var a3 = ""+document.test.checkgroup[i].value+"";
							var b3 = "<img src='"+web_path+"images/black-close.gif'  onclick='return remove(3,"+i+");' title='Remove'>";
							document.getElementById("third").innerHTML = "<img src='"+document.test.checkgroup[i].value+"' onclick=newWindow('"+web_path+"',"+product_item_id+","+product_id+") width='90' height='50' title='"+myAssoc[a3]+"' alt='"+myAssoc[a3]+"'>" + "<span style='vertical-align:top;margin-left:12px'>"+b3+"</span>";
							document.getElementById("a3").innerHTML = returnProductName(myAssoc[a3]);
							document.getElementById("b3").innerHTML = "";
						}
						if(j==4)
						{
							var a4 = ""+document.test.checkgroup[i].value+"";
							var b4 = "<img src='"+web_path+"images/black-close.gif'  onclick='return remove(4,"+i+");' title='Remove'>";
							document.getElementById("fourth").innerHTML = "<img src='"+document.test.checkgroup[i].value+"' onclick=newWindow('"+web_path+"',"+product_item_id+","+product_id+") width='90' height='50' title='"+myAssoc[a4]+"' alt='"+myAssoc[a4]+"'>" + "<span style='vertical-align:top;margin-left:12px'>"+b4+"</span>";
							document.getElementById("a4").innerHTML = returnProductName(myAssoc[a4]);
							document.getElementById("b4").innerHTML = "";
						}
					}
					
					document.getElementById("compare").style.display = "block";
					document.getElementById("msg1").style.display = "block";
					document.getElementById("msg2").style.display = "block";
		
					if(j==0)
					{
						
						document.getElementById("first").innerHTML = "&nbsp;";
						document.getElementById("a1").innerHTML = "&nbsp;";
						document.getElementById("b1").innerHTML = "&nbsp;";
						document.getElementById("compare").style.display = "none";
						document.getElementById("msg1").style.display = "none";
						document.getElementById("msg2").style.display = "none";
					}
				
		}
				 //-------------------5.Selected Row Background Gray -- On Check------------
				//selectedRow();
				//-----------------------------------------------------------------
		}
		else
		{
			//----------------------------------------Start For single checkbox -------------------------------------------
			if(document.test.checkgroup.checked == true)
			{
				document.getElementById("compare").style.display = "block";
				document.getElementById("slidder").style.display = "block";
				document.getElementById("msg1").style.display = "block";
					document.getElementById("msg2").style.display = "block";

				var mySplit = document.test.checkgroup.value.split("/");
				var compareSplit = mySplit[mySplit.length-1].split(".");
				var product_item_id = compareSplit[0];
				compare_id = product_item_id +","+compare_id;

				var a1 = ""+document.test.checkgroup.value+"";
				var b1 = "<img src='"+web_path+"images/black-close.gif'  onclick='return remove(1,0);'>";
				document.getElementById("first").innerHTML = "<img src='"+document.test.checkgroup.value+"' onclick=newWindow('"+web_path+"',"+product_item_id+","+product_id+") width='90' height='50' title='"+myAssoc[a1]+"' alt='"+myAssoc[a1]+"'>" + "<span style='vertical-align:top;margin-left:12px'>"+b1+"</span>";
				document.getElementById("a1").innerHTML = returnProductName(myAssoc[a1]);
				document.getElementById("b1").innerHTML = "";
				//-------------------6.Selected Row Background Gray -- On Check------------
				var chkVal = document.test.checkgroup.value;
				document.getElementById(chkVal).className= "even";
				//-----------------------------------------------------------------
			}
			else
			{
					document.getElementById("first").innerHTML = "&nbsp;";
					document.getElementById("a1").innerHTML = "&nbsp;";
					document.getElementById("b1").innerHTML = "&nbsp;";
					document.getElementById("compare").style.display = "none";
					document.getElementById("slidder").style.display = "none";
					document.getElementById("msg1").style.display = "none";
					document.getElementById("msg2").style.display = "none";
					//-------------------7.Selected Row Background Gray -- On UnCheck------------
					var chkVal = document.test.checkgroup.value;
					document.getElementById(chkVal).className= "odd";
					//-----------------------------------------------------------------
			}
			//----------------------------------------End For single checkbox -------------------------------------------
		}
		window.scrollBy(0,-2000);
		if(j == 1)
		{
			document.getElementById("compareLink").name = "no";
			document.getElementById("compareLink").href = "#";
		}
		else
		{
			document.getElementById("compareLink").name = compare_id;
			document.getElementById("compareLink").href = "#";
		}
		//document.getElementById("compareLink").name = compare_id;
		//document.getElementById("compareLink").href = "#";
		document.getElementById("product_order_list").value = compare_id+"#"+product_id;
		window.location.hash = "#recommended"; 
}


//--------------------- Email Product Cotes ------------------------//

function ShowEmailCotesPopUp(el) {
var web_img_path = document.getElementById("web_img_path").value;
var cvr = document.getElementById("cover2")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
dlg.innerHTML = '<div style="position:absolute;left:350px;top:10px;"><a href="#" onclick="closeEmailCotesPopUp(\'dialog2\');"><img src="'+web_img_path+'close.jpeg" border="0"></a></div><table bgcolor="white" border="0" width="100%" height="100%" align="center"><tr><td id="inner_td" align="center">'+document.getElementById("email_cotes_div").innerHTML+'</td></tr></table>';
if (document.body.style.overflow = "hidden") {
cvr.style.width = "1300"
cvr.style.height = "100%"
window.location.hash = '#';
}
}

function closeEmailCotesPopUp(el) {
var cvr = document.getElementById("cover2")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
document.body.style.overflowY = "scroll"
}

function send_quotes(core_id){
		
	var content = escape(document.test.innerHTML);
	var web_path = document.getElementById('web_path').value;
	var web_img_path = document.getElementById('web_img_path').value;
    
	var email = trim(document.getElementById('quote_email').value);
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   
   	if(email=="" || email=="Email Id"){
		alert('Enter your email Id.');
		document.getElementById("quote_email").focus();
	}else
	if(reg.test(email) == false)
	{
	   alert('Your email address seems incorrect.Please enter valid email id.\n E.g. email@domain.com');
	   document.getElementById("quote_email").focus();
	}else{
      
		document.getElementById("email_quote_span").innerHTML = '<span><img src="'+web_img_path+'loading-bar.gif"></span>&nbsp;Sending Result...&nbsp;&nbsp;&nbsp;';  
		var act = 'email_product_quotes';
		var bodyVars = {
			action : act,
			to : email,
			product_id : core_id,
			pi_ids : ids
        }
		var URLVars = ''; 
		ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, SendCotesResponse, false, null);
		}
}

function SendCotesResponse(text, headers, callingContext) {
	
	if(text=='succ'){
	   document.getElementById("email_quote_span").innerHTML = 'Search result has been emailed to you successfully.';
	}else{
	   document.getElementById("email_quote_span").innerHTML = '<font color="red">Error occured while sending search result.Please try latter!</font>';
	}
}



function get_search_result(){
	alert("sdfksf");
}

function apply_product_home(web_path,product_id){
	
	
    document.getElementById('fade').style.display='block';
	document.getElementById('light').style.display='block';
    window.location.hash = "#";
	document.getElementById('tempids').value = '';
	var chk = 'product_'+product_id+'[]';
	var chkobj = document.getElementsByName(chk)
    var product_item_ids = '';
	for(var i=0; i < chkobj.length; i++){
        if(chkobj[i].checked == true){
            if(product_item_ids=='')product_item_ids = chkobj[i].value;
            else product_item_ids = product_item_ids+','+chkobj[i].value;
		}
	}
	document.getElementById('tempids').value = product_item_ids;
	var div = 'light'; 
	var img = web_path+'images/load.gif'; 
	document.getElementById(div).style.border = '2px solid lightblue';
	fnLoading('Please wait..',div,img);
	var act = 'add_product_app_frm';
	var bodyVars = {
		action : act ,
		product_id :product_id 
	}
	var URLVars = ''; 
	ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, productAppFormResponse, false, null);
	return false;
}
function productAppFormResponse(text, headers, callingContext){
	document.getElementById('light').innerHTML = text;
	document.getElementById('light').style.display='block';
    window.location.hash = "#"; 
	document.getElementById('final_product_item_ids').value = document.getElementById('tempids').value 
}


function validate_hl_cons_form(web_path){
var customer_name = document.getElementById('customer_name');
var mobile = document.getElementById('mobile');
var email = document.getElementById('email');
var total_exp = document.getElementById('total_exp');
var monthly_income = document.getElementById('monthly_income');
var DOB_Month = document.getElementById('DOB_Month');
var DOB_Day = document.getElementById('DOB_Day');
var DOB_Year = document.getElementById('DOB_Year');
var city_id = document.getElementById('city_id');
var other_emi = document.getElementById('other_emi');
var property_value = document.getElementById('property_value');
var loan_amt = document.getElementById('loan_amt');
var repay_period = document.getElementById('repay_period');
var occupation = document.getElementById('occupation');
var txtCaptcha = document.getElementById('txtCaptcha').value;

if(customer_name.value ==''){
	alert("Please enter your Name.");
	 customer_name.focus();
	return false;
}else
if(mobile.value ==''){
	alert("Please enter your mobile number.");
	mobile.focus();
	return false;
}else
if(ValidateContact(mobile) == false){
    return false;
}else
if(email.value ==''){
	alert("Please enter your Email-ID.");
	email.focus();
	return false;
}else
if(checkEmail(email.value) == false){
    alert("Please enter valid email-Id.\n Eg. example@domain.com");
	email.focus();
	return false;
}else
if(total_exp .value ==''){
	alert("Please select your work experience.");
	total_exp.focus();
	return false;
}else
if(other_emi .value ==''){
	alert("Please enter your EMI.");
	other_emi.focus();
	return false;
}else
if(property_value.value ==''){
	alert("Please enter the property value.");
	property_value.focus();
	return false;
}else
if(loan_amt.value ==''){
	alert("Please enter the loan amount.");
	loan_amt.focus();
	return false;
}else
if(repay_period.value ==''){
	alert("Please select your repayment period");
	repay_period.focus();
	return false;
}else
if(monthly_income.value ==''){
	alert("Please enter your monthly income");
	monthly_income.focus();
	return false;
}else
if(occupation.value ==''){
	alert("Please select your occupation");
	occupation.focus();
	return false;
}else
if(DOB_Month.value ==''){
	alert("Please select month for date of birth.");
	DOB_Month.focus();
	return false;
}else
if(DOB_Day.value ==''){
	alert("Please select day for date of birth.");
	DOB_Day.focus();
	return false;
}else
if(DOB_Year.value ==''){
	alert("Please select year for date of birth.");
	DOB_Year.focus();
	return false;
}else
if(city_id.value ==''){
    alert("Please select city.");
	city_id.focus();
	return false;
} else {


	var act = 'captcha_frm';
	var bodyVars = {
		action : act ,
		txtCaptcha :txtCaptcha 
	}
	var URLVars = ''; 
	ajaxCaller.postVars(web_path+"ajax_common.php", bodyVars,URLVars, CaptchaResponse, false, null);
	return false;

	//return true;
}
}

function CaptchaResponse(text, headers, callingContext){
	//alert(text);
	if(text != 'true'){
		document.getElementById('result_captcha').innerHTML = text;
		return false;
	}
	//window.document.hl_cons_form.action = "?action_type=insert_hl_consultant";
	document.getElementById("hl_cons_form").submit();
	return true;

		
	//document.getElementById('light').style.display='block';
    //window.location.hash = "#"; 
	//document.getElementById('final_product_item_ids').value = document.getElementById('tempids').value 

}

function validate_product_app_form(frm,web_path,product_id){

var fname = frm.fname.value;
var lname = frm.lname.value;
var email = frm.email.value;
var gender_obj = frm.gender;
var maritalstatus_obj = frm.maritalstatus;
var DOB_Month = frm.DOB_Month.value;
var DOB_Day = frm.DOB_Day.value;
var DOB_Year = frm.DOB_Year.value;
var city_id = frm.city_id.value;
var address = frm.address.value;
var phone = frm.phone.value;
var mobile = frm.mobile.value;
var terms_condition_obj = frm.terms_condition;

var gender;var maritalstatus;
if(gender_obj[0].checked==true) gender = gender_obj[0].value;
else gender = gender_obj[1].value;
if(maritalstatus_obj[0].checked==true) maritalstatus = maritalstatus_obj[0].value;
else maritalstatus = maritalstatus_obj[1].value;
if(terms_condition_obj.checked==true) terms_condition = 'yes';
else terms_condition = 'no';
var itemids = document.getElementById('final_product_item_ids').value;
if(fname==''){
	alert("Please enter first name.");
	 frm.fname.focus();
	return false;
}else
if(lname==''){
	alert("Please enter last name.");
	frm.lname.focus();
	return false;
}else
if(email==''){
	alert("Please enter email-Id.");
	frm.email.focus();
	return false;
}else
if(checkEmail(email) == false){
    alert("Please enter valid email-Id.\n Eg. abc@yahoo.com");
	frm.email.focus();
	return false;
}else
if(DOB_Month==''){
	alert("Please select month for date of birth.");
	frm.DOB_Month.focus();
	return false;
}else
if(DOB_Day==''){
	alert("Please select day for date of birth.");
	frm.DOB_Day.focus();
	return false;
}else
if(DOB_Year==''){
	alert("Please select year for date of birth.");
	frm.DOB_Year.focus();
	return false;
}else
if(city_id==''){
    alert("Please select city.");
	frm.city_id.focus();
	return false;
}else
if(address==''){
	alert("Please enter residence address.");
	frm.address.focus();
	return false;
}else
if(phone==''){
	alert("Please enter residence phone no.");
	frm.phone.focus();
	return false;
}else
if(ValidateContact(frm.phone)==false){
    return false;
}else
if(mobile==''){
	alert("Please enter mobile no.");
	frm.mobile.focus();
	return false;
}else
if(ValidateContact(frm.mobile)==false){
    return false;
}else{
	var img = web_path+'images/load.gif'; 
	var div = 'light'; 
	document.getElementById(div).style.border = '10px solid lightblue';
	fnLoading('Please wait..',div,img);
	var act = 'add_lic_app_frm';
	var bodyVars = {
		action : act, product_id : product_id,
		fname:fname,lname:lname,email:email,gender:gender,maritalstatus:maritalstatus,DOB_Month:DOB_Month,DOB_Day:DOB_Day,DOB_Year:DOB_Year,
		city :city_id,address:address,phone:phone,mobile:mobile,terms_condition:terms_condition,product_item_ids:itemids
	}
	var URLVars = ''; 
	ajaxCaller.postVars(web_path+"ajax-lic-product.php", bodyVars,URLVars, LicAppFormResponse, false, null);
	return false;
}
  
}


function validate_product_home_app_form(frm,web_path,product_id){

var fname = frm.fname.value;
var lname = frm.lname.value;
var email = frm.email.value;
var gender_obj = frm.gender;
var DOB_Month = frm.DOB_Month.value;
var DOB_Day = frm.DOB_Day.value;
var DOB_Year = frm.DOB_Year.value;
var city_id = frm.city_id.value;
var address = frm.address.value;
var mobile = frm.mobile.value;
var occupation = frm.occupation.value;
var total_exp = frm.total_exp.value;
var net_income = frm.net_income.value;
var loan_amt = frm.loan_amt.value;
 var terms_condition_obj = frm.terms_condition;

var gender;var maritalstatus;
if(gender_obj[0].checked==true) gender = gender_obj[0].value;
else gender = gender_obj[1].value;
if(terms_condition_obj.checked==true) terms_condition = 'yes';
else terms_condition = 'no';
var itemids = document.getElementById('final_product_item_ids').value;
if(fname==''){
	alert("Please enter first name.");
	 frm.fname.focus();
	return false;
}else
if(lname==''){
	alert("Please enter last name.");
	frm.lname.focus();
	return false;
}else
if(email==''){
	alert("Please enter email-Id.");
	frm.email.focus();
	return false;
}else
if(checkEmail(email) == false){
    alert("Please enter valid email-Id.\n Eg. abc@yahoo.com");
	frm.email.focus();
	return false;
}else
if(DOB_Month==''){
	alert("Please select month for date of birth.");
	frm.DOB_Month.focus();
	return false;
}else
if(DOB_Day==''){
	alert("Please select day for date of birth.");
	frm.DOB_Day.focus();
	return false;
}else
if(DOB_Year==''){
	alert("Please select year for date of birth.");
	frm.DOB_Year.focus();
	return false;
}else
if(city_id==''){
    alert("Please select city.");
	frm.city_id.focus();
	return false;
}else
if(address==''){
	alert("Please enter residence address.");
	frm.address.focus();
	return false;
}else
if(mobile==''){
	alert("Please enter mobile no.");
	frm.mobile.focus();
	return false;
}else
if(ValidateContact(frm.mobile)==false){
    return false;
}else
if(occupation==''){
	alert("Please select the occupation.");
	frm.occupation.focus();
	return false;
}else
if(total_exp==''){
	alert("Please enter Total Experince.");
	frm.total_exp.focus();
	return false;
}else
if(net_income==''){
	alert("Please enter Net Income.");
	frm.net_income.focus();
	return false;
}else
if(loan_amt==''){
	alert("Please enter Loan Amount.");
	frm.loan_amt.focus();
	return false;
}else{
	var img = web_path+'images/load.gif'; 
	var div = 'light'; 
	document.getElementById(div).style.border = '10px solid lightblue';
	fnLoading('Please wait..',div,img);
	var act = 'add_lic_app_frm';
	var bodyVars = {
		action : act, product_id : product_id,
		fname:fname,lname:lname,email:email,gender:gender,DOB_Month:DOB_Month,DOB_Day:DOB_Day,DOB_Year:DOB_Year,
		city :city_id,address:address,mobile:mobile,occupation:occupation,total_exp:total_exp,net_income:net_income,loan_amt:loan_amt,terms_condition:terms_condition,product_item_ids:itemids
	}
	var URLVars = ''; 
	ajaxCaller.postVars(web_path+"ajax-hl-product.php", bodyVars,URLVars, LicAppFormResponse, false, null);
	return false;
}
  
}

function LicAppFormResponse(text, headers, callingContext){
	var res = text.split("~");
	window.location = res[1]+'thankyou.php?dis_msg=order&product_id='+res[2]+'&quick_lead_id='+res[3]; 
      
}

//--------------------------------------------//


