window.status = "India's No.1 local search engine";
var area_json;
//document.onkeydown=demo

function count_review(id,type,num,inc)
{

url = 'srch/display/rating_count.php?docid='+id+'&type='+type+'&num='+num+'&inc=1';
var xmlHttpReq_user = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq_user = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq_user = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq_user.open('POST', url, true);
self.xmlHttpReq_user.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq_user.send(null);
self.xmlHttpReq_user.onreadystatechange = function() 
{
if (self.xmlHttpReq_user.readyState == 4) 
{		
	if(self.xmlHttpReq_user.responseText!="")
	{
		updatepageSearch_positive(self.xmlHttpReq_user.responseText,id);
	}
}
}
}
function updatepageSearch_positive(user_feed,id)
{
document.getElementById("rating_count_"+id).innerHTML = user_feed;
document.getElementById("positive_table_disable_"+id).style.display = "none";
document.getElementById("positive_table_enable_"+id).style.display = "block";
document.getElementById("rating_count_enable_"+id).innerHTML = user_feed;
}
function count_review_negative(id,type,num,inc)
{
url = 'srch/display/rating_count.php?docid='+id+'&type='+type+'&num='+num+'&inc=2';

var xmlHttpReq_user_negative = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq_user_negative = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq_user_negative = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq_user_negative.open('POST', url, true);
self.xmlHttpReq_user_negative.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq_user_negative.send(null);
self.xmlHttpReq_user_negative.onreadystatechange = function() 
{
if (self.xmlHttpReq_user_negative.readyState == 4) 
{

  if(self.xmlHttpReq_user_negative.responseText!="")
	{
		updatepageSearch_negative(self.xmlHttpReq_user_negative.responseText,id);
	}
}
}
}
function updatepageSearch_negative(user_feed,id)
{
document.getElementById("rating_count_negative_"+id).innerHTML = user_feed;
document.getElementById("negative_table_disable_"+id).style.display = "none";
document.getElementById("negative_table_enable_"+id).style.display = "block";
document.getElementById("rating_count_negative_enable_"+id).innerHTML = user_feed;
}
function show_city()
{
var show_city_div = document.getElementById('city_div');
show_city_div.style.visibility = "visible";

var change_city = document.getElementById('city_change');
change_city.style.visibility = "hidden";
}
function city_function(pag,adv){
if(document.justDial.city.value=='Select City')
{
	document.justDial.city.value= '';
}
//alert('here');
var city_pop = new Array("Ahmedabad","Bangalore","Chandigarh","Chennai","Coimbatore","Delhi / NCR","Ernakulam","Goa","Hyderabad","Indore","Jaipur","Kolkata","Mumbai","Mysore","Nagpur","Nashik","Pune","Surat","Vadodara","Vizag");

 if(adv=='adv')
{
str_inner_pop = "<table border='0' cellspacing='0' cellpadding='0' height='200' valign='top' width='500'><tr><td height='5' colspan='10'></td></tr><tr><td align='center' colspan='9'></td><td><A HREF='javascript:close_div(\"close\");'><IMG SRC='../../image/images_just_right/close.gif' WIDTH='11' HEIGHT='11' BORDER='0' ALT='' title='Close'></a>&nbsp;</TD></tr><TR><TD class='headorng123' colspan='2' style='padding-left:10'><B>Popular Cities :</B></TD></tr><tr><td height='10' colspan='10'></td></tr><tr><td><table border='0' cellspacing='0' cellpadding='0'>";
str_inner_pop += "<tr><td height='5'></td></tr><tr><td width='10'></td><td></td></tr>";
}
else 
{ 
 str_inner_pop = "<table border='0' cellspacing='0' cellpadding='0' height='200' valign='top' width='500'><tr><td height='5' colspan='10'></td></tr><tr><!--<td align='center' colspan='9'><a href='javascript: Go_AllIndiaSearch();' class='popsearchfontblue'><b>All India Search<b></td>--><td align='right' colspan='10'><A HREF='javascript:close_div(\"close\");'><IMG SRC='../../image/images_just_right/close.gif' WIDTH='11' HEIGHT='11' BORDER='0' ALT='' title='Close'></a>&nbsp;</TD></tr><TR><TD class='headorng123' colspan='2' style='padding-left:10'><B>Popular Cities :</B></TD></tr><tr><td height='10' colspan='10'></td></tr><tr><td><table border='0' cellspacing='0' cellpadding='0'>";
str_inner_pop += "<tr><td width='10'></td><td width='170'><a href='javascript: Go_AllIndiaSearch();' class='popsearchfontblue'><b>All India Search<b></a>&nbsp;<sup><font style='COLOR: #FF6400;FONT-FAMILY: Arial;FONT-SIZE: 11px;FONT-WEIGHT: BOLD;text-decoration: none;' >New!</font></sup></td></tr><tr><td height='5'></td></tr>";
}
for(k=0;k<12;k++)
{
	if(adv=='adv')
	  { //alert('in');
	str_inner_pop += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_pop[k]+"\",\"advance\")' class='popsearchfontblue'>"+city_pop[k]+"</td></tr><tr><td height='5'></td></tr>";
	 }
	 else
		 { str_inner_pop += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_pop[k]+"\")' class='popsearchfontblue'>"+city_pop[k]+"</td></tr><tr><td height='5'></td></tr>";
		}
}
str_inner_pop += "</table></td><td width='10'></td>";

str_inner_pop += "<td valign='top'><table border='0' cellspacing='0' cellpadding='0'>";
for(k=12;k<20;k++)
{
	if(adv=='adv')
	  { str_inner_pop += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_pop[k]+"\",\"advance\")' class='popsearchfontblue'>"+city_pop[k]+"</td></tr><tr><td height='5'></td></tr>";
	
	  }
	  else
	{ if(k==12)
	   str_inner_pop += "<tr><td height='5'></td></tr>";
	   
	  str_inner_pop += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_pop[k]+"\")' class='popsearchfontblue'>"+city_pop[k]+"</td></tr><tr><td height='5'></td></tr>";
	  }
}
str_inner_pop += "</table></td><td width='10'></td>";

var city_array =  new Array("Agartala","Agra","Ahmedabad","Ahmednagar","Aizawl","Ajmer","Akola","Alappuzha","Aligarh","Allahabad","Alwar","Amalapuram","Ambala","Amravati","Amreli","Amritsar","Anand","Anantapur","Ankleshwar","Asansol","Aurangabad","Azamgarh","Banaskantha","Bangalore","Banswara","Baran","Bareilly","Batala","Beed","Belgaum","Bellary","Bengaluru","Bhandara","Bharuch","Bhatinda","Bhavnagar","Bhilwara","Bhongir","Bhopal","Bhubaneshwar","Bhuj","Bijapur","Bikaner","Bilaspur","Buldhana","Bundi","Calcutta","Calicut","Chandigarh","Chandrapur","Chengalpattu","Chennai","Chidambaram","Chikmagalur","Chitradurga","Chittoor","Chittorgarh","Coimbatore","Coonoor","Cuddalore","Cuddapah","Cuttack","Dahod","Darjeeling","Davangere","Dehradun","Delhi / NCR","Dhanbad","Dharmapuri","Dharmavaram","Dharwad","Dhule","Dindigul","Dispur","Dungarpur","Durg","Durgapur","Eluru","Ernakulam","Erode","Ferozepur","Firozabad","Gadag","Gandhidham","Gandhinagar","Gangtok","Goa","Gondia","Gorakhpur","Gulbarga","Guntakal","Guntur","Gurdaspur","Guwahati","Gwalior","Haldia","Haridwar","Hassan","Hissar","Hoshangabad","Hoshiarpur","Hosur","Hubli","Hyderabad","Idukki","Imphal","Indore","Itanagar","Jabalpur","Jaipur","Jaisalmer","Jalandhar","Jalgaon","Jammu","Jamnagar","Jamshedpur","Jhalawar","Jhansi","Jodhpur","Junagadh","Kadiri","Kakinada","Kanchipuram","Kannur","Kanpur","Kanyakumari","Kapoorthala","Karaikal","Karaikudi","Karimnagar","Karnal","Karur","Kasargod","Kashipur","Khammam","Kharagpur","Kodaikanal","Kolhapur","Kolkata","Kollam","Kota","Kotkapura","Kottayam","Kovilpatti","Kozhikode","Krishnagiri","Kullu","Kumbakonam","Kurnool","Kurukshetra","Latur","Lucknow","Ludhiana","Madanapaly","Madikeri","Madras","Madurai","Mahabubnagar","Malappuram","Maligaon","Manali","Mandya","Mangalore","Mannargudi","Mathura","Mayiladuthurai","Medak","Meerut","Mehsana","Moradabad","Mumbai","Mundra","Mysore","Nagapattinam","Nagercoil","Nagpur","Nainital","Nalgonda","Namakkal","Nanded","Nandyal","Nashik","Navsari","Nawanshahr","Nellore","Nizamabad","Ongole","Ooty","Palakkad","Palani","Palanpur","Pali","Panipat","Patan","Pathankot","Patiala","Patna","Periyar","Phagwara","Pondicherry","Pune","Puri","Raichur","Raigarh","Raipur","Rajamumdry","Rajkot","Rajpura","Rameswaram","Ranchi","Ranipet","Ratlam","Ratnagiri","Rehabari","Rishikesh","Rohtak","Roorkee","Rourkela","Rudrapur","Saharanpur","Salem","Samrala","Sangareddy","Sangli","Satara","Shillong","Shimla","Shimoga","Siliguri","Solan","Solapur","Sonepat","Srikakulam","Surat","Surendranagar","Tadpatri","Tanuku","Tenali","Thanjavur","Thiruvananthapuram","Thrissur","Tindivanam","Tinsukia","Tiruchengode","Tirunelveli","Tirupathi","Tirupur","Tiruvannamalai","Trichy","Tumkur","Tuticorin","Udaipur","Udupi","Ujjain","Vadodara","Valsad","Vapi","Varanasi","Vellore","Vijayapuram","Vijayawada","Virudhunagar","Vizag","Vizianagaram","Warangal","Wardha","Wayanad","Yamunanagar","Yavatmal","Zahirabad");			

var str_main = '';
var str_inner = '';
var str_main_end = '';
var cntr=0;
var stopLmt = 12;
var pg = pag;
var oc = 'headorng123';
var bc = 'popsearchfont3';
	if(pg==0)
	{
		str_inner = str_inner_pop; 
		var noPerPage =  stopLmt * 5;
		var noPerPage_0 =  stopLmt * 3;
		var nopage = Math.round(city_array.length/noPerPage);
	}
	else
	{
		str_inner += "<table border='0' cellspacing='0' cellpadding='0' height='200' valign='top' width='500'><tr><td height='10' colspan='10' valign='top'></td></tr><tr><TD align='right' colspan='9' style='padding-right:10'><A HREF='javascript:close_div();'><IMG SRC='../../image/images_just_right/close.gif' WIDTH='11' HEIGHT='11' BORDER='0' ALT='' title='Close'></a></TD></tr><tr><td height='10' colspan='10' valign='top'></td></tr><tr><td height='5' colspan='10'></td></tr>"; 
		
		var noPerPage =  stopLmt * 5;
		var noPerPage_0 =  stopLmt * 5;
		
		var nopage = Math.round(city_array.length/noPerPage);
	}
	thispageno=pg*noPerPage_0;
	if(pg!=0) {
		thispageno=thispageno-24;
	}

	for(i=thispageno;i<city_array.length;i++){
		if(cntr==0)
		{
			str_inner += "<td valign='top'><table border='0' cellspacing='0' cellpadding='0'><tr><td height='5'></td></tr>";
		}
		if(adv=='adv')
	  { str_inner += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_array[i]+"\",\"advance\");remove_sec();' class='popsearchfont3'>"+city_array[i]+"</td></tr><tr><td height='5'></td></tr>";
	  }
	  else
		{
		str_inner += "<tr><td width='10'></td><td><a href='javascript:fillcity(\""+city_array[i]+"\");remove_sec();' class='popsearchfont3'>"+city_array[i]+"</td></tr><tr><td height='5'></td></tr>";
		}
		cntr++;
		if(cntr==stopLmt || i == city_array.length-1)
		{
			str_inner += "</table></td><td width='10'></td>";
			cntr = 0;
		}
		if(i == (thispageno+noPerPage_0)-1) {
		break;
		}
	}
		str_inner += "</tr>";
	str_inner += "<tr><td height='5' colspan='10'></td></tr><tr><TD colspan='8' style='padding-left:10'><A HREF='javascript:close_div();' class='headorng123' >Close</A></TD><td colspan='2' align='right'><table border='0' cellspacing='0' cellpadding='0' ><tr>";
	if(pg==0)
	   {	
		str_inner += "<td ><a href='javascript:city_function(0);' class="+oc+" >1</td><td width='5'></td>";

		str_inner += "<td ><a href='javascript:city_function(1);' class="+bc+" id='b'>2</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(2);' class="+bc+" id='h'>3</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(3);' class="+bc+" id='m'>4</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(4);' class="+bc+" id='r'>5</td><td width='10'></td>";
	   }
	   else if(pg==1)
	  {
		str_inner += "<td ><a href='javascript:city_function(0);' class="+bc+" >1</td><td width='5'></td>";
		str_inner += "<td ><a href='javascript:city_function(1);' class="+oc+" id='b'>2</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(2);' class="+bc+" id='h'>3</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(3);' class="+bc+" id='m'>4</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(4);' class="+bc+" id='r'>5</td><td width='10'></td>";
      }
	  else if(pg==2)
	  {
		str_inner += "<td ><a href='javascript:city_function(0);' class="+bc+" >1</td><td width='5'></td>";
		str_inner += "<td ><a href='javascript:city_function(1);' class="+bc+" id='b'>2</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(2);' class="+oc+" id='h'>3</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(3);' class="+bc+" id='m'>4</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(4);' class="+bc+" id='r'>5</td><td width='10'></td>";
      }
	  else if(pg==3)
     {
		str_inner += "<td ><a href='javascript:city_function(0);' class="+bc+" >1</td><td width='5'></td>";
		str_inner += "<td ><a href='javascript:city_function(1);' class="+bc+" id='b'>2</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(2);' class="+bc+" id='h'>3</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(3);' class="+oc+" id='m'>4</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(4);' class="+bc+" id='r'>5</td><td width='10'></td>";
      }
	  else if(pg==4)
     {
		str_inner += "<td ><a href='javascript:city_function(0);' class="+bc+" >1</td><td width='5'></td>";
		str_inner += "<td ><a href='javascript:city_function(1);' class="+bc+" id='b'>2</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(2);' class="+bc+" id='h'>3</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(3);' class="+bc+" id='m'>4</td><td width='5'></td>";
		str_inner += "<td><a href='javascript:city_function(4);' class="+oc+" id='r'>5</td><td width='10'></td>";
      }

	str_inner += "</tr></table></td></tr><tr><td height='10' colspan='10'></td></tr></table>";			
	document.getElementById('city_div').innerHTML = str_inner;
	var show_city = document.getElementById('city_div');
	show_city.style.visibility = "visible";
	
}
function close_div(c)
{
var show_city = document.getElementById('city_div');
show_city.style.visibility = "hidden";

var change_city = document.getElementById('city_change');
change_city.style.visibility = "visible";

}

function fillcity(id,advc)
{
sec = "";
document.justDial.area.value="";
document.getElementById('txt2').value= id;
var city_value =  document.getElementById('txt2').value;

var show_city = document.getElementById('city_div');
show_city.style.visibility = "hidden";

var change_city = document.getElementById('city_change');
change_city.style.visibility = "visible";
sel_id=id;
document.getElementById('sel_city').innerHTML=sel_id;
document.getElementById('sel_city').style.visibility = "visible";
if(advc!='advance')
{ //alert('main');
selectcity(id);
}
}




function login_div()
{	
document.getElementById("overlay").style.visibility = "visible";
document.getElementById("login").style.visibility = "visible";
document.getElementById("login").style.zIndex = 50;
document.getElementById("overlay").style.zIndex = 30;
city_div.style.visibility = "hidden";
}
function login_review_function(a,i)
{
if(i=="")
{
overlay.style.visibility ="visible";
login_review.style.visibility = "visible";
}
else
{
document.resultdata.docId.value = a
document.resultdata.Stype.value = Stype;
document.resultdata.area.value = area;		
document.resultdata.city.value = city;
document.resultdata.searchtype.value = searchtype;
document.resultdata.action= "search_cmd.php?srch=true&review="+i+"&city="+city;
document.resultdata.submit();}
}
function forget_div(a)
{
if(a=="login")
{
overlay.style.visibility = "visible";
forget_login_1.style.visibility = "visible";
login.style.visibility = "hidden";
forget.style.visibility = "hidden";
document.getElementById("forget_login_1").style.zIndex = 50;
document.getElementById("overlay").style.zIndex = 30;

}
if(a=="pass")
{
overlay.style.visibility ="visible";
login.style.visibility = "hidden";
forget.style.visibility = "hidden";
forget_login_pass.style.visibility = "visible";
document.getElementById("forget_login_pass").style.zIndex = 50;
document.getElementById("overlay").style.zIndex = 30;
}	
if(a=="forget")
{
overlay.style.visibility ="visible";
login.style.visibility = "hidden";
forget.style.visibility = "visible";
login_review.style.visibility = "hidden";
document.getElementById("forget").style.zIndex = 50;
document.getElementById("overlay").style.zIndex = 30;

}
}
function close_forget(a)
{
if(a!="")
{
if(a=="login")
{
forget_login_1.style.visibility = "hidden";
overlay.style.visibility ="hidden";
forget.style.visibility = "hidden";
}
if(a=="pass")
{
	overlay.style.visibility ="hidden";
	forget.style.visibility = "hidden";	
	forget_login_1.style.visibility = "hidden";
	forget_login_pass.style.visibility = "hidden";
}
}
overlay.style.visibility ="hidden";
forget.style.visibility = "hidden";
}
function close_review()
{
overlay.style.visibility ="hidden";
login_review.style.visibility = "hidden";
}
function close_login()
{   document.getElementById("overlay").style.visibility = "hidden";
document.getElementById("login").style.visibility = "hidden";
document.getElementById("login_review").style.visibility = "hidden";
}
function loginalert(a,i)
{    //alert('hii');

if(a=="out")
{
document.resultdata.login_name.value		=	"logout";

document.resultdata.docId.value = i;
document.resultdata.Stype.value = Stype;
document.resultdata.area.value = area;		
document.resultdata.city.value = city;
document.resultdata.searchtype.value = searchtype;
document.resultdata.action= "?srch=true";
document.resultdata.submit();
}
if(a!="out")
{
chk = 'true';
if(login_alert.login_name.value=="")
{
alert("Please Enter login !!");
document.login_alert.login_name.focus();
return false;
chk = "false";

}
if(login_alert.login_pass.value=="")
{
alert("Please Enter Password !!");
document.login_alert.login_pass.focus();
return false;
chk = "false";
}
if(chk == "true") 
{
if((document.login_alert.login_name.value != "")&&(document.login_alert.login_pass.value != ""))
{
	sTasus = "true";
}
else
{
	sTasus = "false";
}
if(sTasus == "true")
{
	document.resultdata.login_name.value		=	document.login_alert.login_name.value;
	document.resultdata.login_pass.value		=	document.login_alert.login_pass.value;
								
	document.resultdata.docId.value = a;
	document.resultdata.Stype.value = Stype;
	document.resultdata.area.value = area;		
	document.resultdata.city.value = city;
	document.resultdata.searchtype.value = searchtype;
	document.resultdata.action= "?srch=true";
	document.resultdata.submit();
}
}
}
}
function loginalert_review(a,i)
{
chk = 'true';
if(login_alert_review.login_name_review.value=="")
{
alert("Please Enter login !!");
document.login_alert_review.login_name_review.focus();
return false;
chk = "false";

}
if(login_alert_review.login_pass_review.value=="")
{
alert("Please Enter Password !!");
document.login_alert_review.login_pass_review.focus();
return false;
chk = "false";
}
if(chk == "true") 
{
if((document.login_alert_review.login_name_review.value != "")&&(document.login_alert_review.login_pass_review.value != ""))
{
	sTasus = "true";
}
else
{
	sTasus = "false";
}
if(sTasus == "true")
{
	document.resultdata.login_name_review.value		=	document.login_alert_review.login_name_review.value;
	document.resultdata.login_pass_review.value		=	document.login_alert_review.login_pass_review.value;
	document.resultdata.docId.value = a;
	document.resultdata.Stype.value = Stype;
	document.resultdata.area.value = area;		
	document.resultdata.city.value = city;
	document.resultdata.searchtype.value = searchtype;
	document.resultdata.action= "?srch=true";
	document.resultdata.submit();
}
}
}
function logout_review(a)
{		
a = a +"&logout=logout";	
document.review.action = a;
document.review.submit();
}
function forget_login(a,b)
{
chk = 'true';
if(b=='login')
{
	if(document.login_alert1.login_name1.value=="")
	{
		alert("Please Enter login !!");
		document.login_alert1.login_name1.focus();
		return false;
		chk = "false";
	}
	if(document.login_alert1.img_forget.value=="")
	{
		alert("Please Enter Security Image !!");
		document.login_alert1.img_forget.focus();
		return false;
		chk = "false";
	}
	if(chk == "true") {
			if((document.login_alert1.login_name1.value != ""))
			{
				sTasus = "true";
			}else{
			
			sTasus = "false";
			}
			if(sTasus == "true")
			{
				document.resultdata.login_name1.value		=	document.login_alert1.login_name1.value;
				
				document.resultdata.img_forget.value		=   document.login_alert1.img_forget.value;

				document.resultdata.docId.value = a;
				document.resultdata.Stype.value = Stype;
				document.resultdata.area.value = area;		
				document.resultdata.city.value = city;
				document.resultdata.searchtype.value = searchtype;
				document.resultdata.action= "?srch=true";
				document.resultdata.submit();
			}
}
}
else if(b=='pass')
{
if(document.login_pass_alert.login_pass1.value=="")
	{
		alert("Please Enter Password !!");
		document.login_pass_alert.login_pass1.focus();
		return false;
		chk = "false";
	}
if(document.login_pass_alert.screen_name.value=="")
	{
		alert("Please Enter Screen Name !!");
		document.login_pass_alert.screen_name.focus();
		return false;
		chk = "false";
	}
if(document.login_pass_alert.img_forget.value=="")
	{
		alert("Please Enter Security Image !!");
		document.login_pass_alert.img_forget.focus();
		return false;
		chk = "false";
	}
	if(chk == "true") 
	{
		if((document.login_pass_alert.login_pass1.value != ""))
		{
			sTasus = "true";
		}else{
		
		sTasus = "false";
		}
		if(sTasus == "true")
		{
			document.resultdata.login_pass1.value		=	document.login_pass_alert.login_pass1.value;
			document.resultdata.screen_name.value		=	document.login_pass_alert.screen_name.value;
			document.resultdata.img_forget.value		=   document.login_pass_alert.img_forget.value;

			document.resultdata.docId.value = a;
			document.resultdata.Stype.value = Stype;
			document.resultdata.area.value = area;		
			document.resultdata.city.value = city;
			document.resultdata.searchtype.value = searchtype;
			document.resultdata.action= "?srch=true";
			document.resultdata.submit();
		}
	}
}
}
function news_popup(url) 
{
newwindow = window.open(url,'name','height=490,width=490,resizable=yes,scrollbars=yes,top=200,left=80');
}
function lowestprice_popup(url) 
{
newwindow = window.open(url,'name','height=230,width=440,resizable=yes,scrollbars=yes,top=200,left=80');
}
/* New Addition For Autosuggest By Bankim with JSN: 10August09 */
var options = {
	script:function (input) { return "../optimized/autosuggest_category_company.php?type=" + (_b.DOM.gE('company').checked ? "company" : "category") + "&city=" + _b.DOM.gE("txt2").value+"&search="+ escape(_b.DOM.gE("q").value); },
	varname:"search",
	json:true,
	delay:0,
	shownoresults:false,
	maxresults:6,
	timeout:1500,
	cache: false,
	callback:function (obj) {cb_center(obj); 
	}
};
var center_json = new bsn.AutoSuggest('q', options);
function search_input_blur(){
center_json.clearSuggestions();
}
function setcheckblur_search(){
 center_json.chkblur='false';
 //alert(center_json.chkblur);
}
//alert(center_json.chkblur);
var autosuggest_id = "";
function cb_center(obj)
{       
	//alert(obj.value);
	//alert(_b.DOM.gE("q").value);
	if(_b.DOM.gE("q").value != "")
	{		
		if(obj==null || center_json.chkblur=='true')
		{	remove_sec();
			getResult(''); 
		}
		else
		{
			if(obj != null)
			    document.justDial.q.value = obj.value;
				document.justDial.AutoCatId.value = obj.id;
			    var search_type = _b.DOM.gE('company').checked ? "company" : "category";
			remove_sec();
			getResult(''); 
		}
	}
	else
	{
		alert("Please enter category / company name for search.");
	}
}

var area_options = {
	script:function (input) { return "../optimized/autosuggest_area.php?&city=" + _b.DOM.gE("txt2").value+"&search=" + escape(_b.DOM.gE("txt1").value); },
	varname:"search",
	json:true,
	delay:0,
	shownoresults:false,
	maxresults:6,
	timeout:1500,
	cache: false,
	offsety: -5,
	callback:function (obj) { cb_area(obj); }
};
var area_json = new bsn.AutoSuggest('txt1', area_options);
function area_input_blur(){
 area_json.clearSuggestions();
}
function setcheckblur_area(){
 area_json.chkblur='false';	
}
function cb_area(obj)
{
	var search_input = _b.DOM.gE("q");
	var area_input = _b.DOM.gE("txt1");
	
	if(search_input.value == "")//If Search Box Empty Then Put Alert And Focus on Search Text Box
	  { alert("Please enter category/company name for search");
	    search_input.focus();}
	else{remove_sec();getResult('');
	  }
}
/*var city_options = {
	script:function (input) { return "../optimized/autosuggest_city.php?&search=" + escape(_b.DOM.gE("txt2").value); },
	varname:"search",
	json:true,
	delay:0,
	shownoresults:false,
	maxresults:6,
	timeout:1500,
	cache: false,
	offsety: -5,
	callback:function (obj){setCookie_auto(obj);}
};
function setCookie_auto(obj)
{  if(City_Check()=='false'){
    return false; }
   else{  
	    if(obj!=null)
		 {setCity(obj.id);}	
		else
		 {setCity(_b.DOM.gE("txt2").value);}
	    
	    if(_b.DOM.gE("q").value == "") // Focus On Search Text Box If Empty
		 {_b.DOM.gE("q").focus();}
		else{_b.DOM.gE("txt1").value = ""; // Focus On Area Text Box If Empty
		   remove_sec();getResult('');}
		}   	 
}
var city_json = new bsn.AutoSuggest('txt2', city_options);*/

/*Auto City Check*/
function City_Check(from_tag)
{
  var city = document.getElementById('txt2').value;
  //alert(city);
  var city_falg='true';
  if(city=='')
	{
	  if(from_tag != 'movie'){
	 alert('Please fill city');
	 document.getElementById("txt2").focus();
	  }
	  city_falg = 'false'; 
	}
  else{	
	var city_in_list = isCityInList(city);
	if(city_in_list == 'false'){
	 if(from_tag != 'movie'){
	alert('Sorry City Not In List');
	document.getElementById("txt2").focus();
	 }
	 city_falg = 'false'; 
	}
   }
   if(city_falg=='true')
	{
	if(city.toLowerCase()=='madras')
	   _b.DOM.gE("txt2").value = 'Chennai';
	 else if(city.toLowerCase()=='culcutta')
	    _b.DOM.gE("txt2").value = 'Kolkata';
	 else if(city.toLowerCase()=='bengaluru')
	    _b.DOM.gE("txt2").value = 'Bangalore';
	 else if(city.toLowerCase()=='calicut')
	    _b.DOM.gE("txt2").value = 'Kozhikode';
	 else if(city.toLowerCase()=='kovai')
	    _b.DOM.gE("txt2").value = 'Coimbatore';
	 else if(city.toLowerCase()=='kochine')
	    _b.DOM.gE("txt2").value = 'Arnakurlam';	
	setCity(_b.DOM.gE("txt2").value);	
	}
	return(city_falg);
}
function isCityInList(city)
{	//alert(city);
    var city_flag = 'false';
	if(city == null || trim(city).length <= 0){
	return city_flag;}

	var city_list = city_drop_str.split(",");
	for(var i = 0; i < city_list.length; i++)
	{
    	if(city.toLowerCase() == city_list[i].toLowerCase() || city.toLowerCase() == 'delhi')
		{  city_flag = 'true';
			break;
		}
	}
	return city_flag;
}
/*Auto City Check*/

function demo(evt)
{
 evt=evt ? evt : event;
 if(evt.keyCode == 13 && document.getElementById('SendMailDiv').style.display != "block")
 {
   if(adv != "true")
   {
	if(document.areaAlert.area.value!='')
	{document.areaAlert.GO.focus();}
    else if(document.LowestQuote.from_lowest.value =='true'){SmsLowquote(document.LowestQuote.low_docid.value);} 
   else{getResult('');}
   }
   else{advSearch();}
  }
}
function oTxtbox(autoid){
var oTextbox = new AutoSuggestControl(document.getElementById(autoid), new StateSuggestions()); 
}
function oTxtbox2(autoid){
var oTextbox = new AutoSuggestControl(document.getElementById(autoid), new StateSuggestions());        
}
function GetCatSuggestions()
{
if(document.justDial.Stype[1].checked){
if(document.justDial.q.value.length > 2)
{xmlhttpauto("../search/area_auto/cat.php?city_cat="+document.justDial.city.value+"&cat_auto="+document.justDial.q.value);}
}
}
function remove_sec(){sec="";}

function getResult_best(a){
if(a=='magic')
{
city	= document.justDial.city.value;
copCat = document.justDial.q.value;
document.justDial.intermid.value = sec;
if(document.justDial.Stype[0].checked==true)
 Stype = document.justDial.Stype[0].value;
else 
 Stype = document.justDial.Stype[1].value;

if((city !="")&&(copCat!="" && copCat!="Enter Your Search")){	
	setCookie('CITY', document.justDial.city.value);
	if((Stype == 'company')&&(area != '')){document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((Stype == 'company')&&(area == '')){document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((sec != '')&&(area != '')){document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((sec != '')&&(area == '')){document.justDial.action='../srch/search_best_deals.php?srch=true&city='+city+'';}
	else
	{
	document.justDial.action='../srch/search_cat_deals.php?srch=true&city='+city+'';}
	document.justDial.submit();
}else{
	if(city ==""){alert("Please select city for search");
		document.justDial.city.focus();return false;
	}
	if(copCat=="" || copCat=="Enter Your Search"){alert("Please enter category/company name for search");
	document.justDial.q.value='';
	document.getElementById('key_txt').className = 'ftextbox1';
	document.justDial.q.focus();return false;}
}
}
else
{
if(document.justDial.Stype[0].checked){Stype = 'company';}
city	= document.justDial.city.value;
copCat	= document.justDial.q.value;	
area	= document.justDial.area.value;
document.justDial.intermid.value = sec;
if((city !="")&&(copCat!="")){	
	if((Stype == 'company')&&(area != '')){document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((Stype == 'company')&&(area == '')){
		document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((sec != '')&&(area != '')){document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else if((sec != '')&&(area == '')){
		
		document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
	else{
	
	document.justDial.action='../srch/search_cat.php?srch=true&city='+city+'';}
	document.justDial.submit();
}else{
	if(city ==""){alert("Please select city for search");
		document.justDial.city.focus();return false;
	}
	if(copCat==""){alert("Please enter category/company name for search");
	document.justDial.q.focus();return false;}
}
}
}
function getResult(a,b){
 /*if(City_Check()=='false')
    return false;*/
var city;var Stype;var copCat;var area;
if(a=='magic')
{
document.justDial.bestseeAlso.value = b;	
if(document.justDial.Stype[0].checked){Stype = 'company';}
city = document.justDial.city.value;
copCat	= document.justDial.q.value;
area	= document.justDial.area.value;
document.justDial.intermid.value = sec;
if((city !="")&& (city !="Select City") && (copCat!="")){	
	setCookie('CITY', document.justDial.city.value);
	if((Stype == 'company')&&(area != '')&&(document.justDial.AutoCatId.value=='')){document.justDial.action='../srch/search_best_deals.php?srch=true&city='+city+'&bestseeAlso='+b+'';
	}
	else if((Stype == 'company')&&(area == '')&&(document.justDial.AutoCatId.value=='')){document.justDial.action='../srch/search_best_deals.php?srch=true&city='+city+'&bestseeAlso='+b+'';}
	else if(document.justDial.AutoCatId.value!=''){
			if(Stype == 'company')
			{document.justDial.action='../srch/search_cmd.php?srch=true'+'&city='+city+''; }
			else
			{document.justDial.action='../srch/search_cwa.php?srch=true&city='+city+'';}
		  }
	else if((sec != '')&&(area != '')){document.justDial.action='../srch/search_best_deals.php?srch=true&city='+city+'';}
	else if((sec != '')&&(area == '')){document.justDial.action='../srch/search_best_deals.php?srch=true&city='+city+'';}
	else{
	document.justDial.action='../srch/search_cat.php?srch=true&city='+city+'';}
	document.justDial.submit();
}else{
	if(city =="" || city=="Select City"){alert("Please select city for search");
		document.justDial.city.focus();return false;
	}
	if(copCat==""){alert("Please enter category/company name for search");
	document.justDial.q.focus();return false;}
}
}
else
{
if(document.justDial.Stype[0].checked || document.justDial.Stype.value=='company'){	Stype = 'company';}
city	= document.justDial.city.value;
//var t = window.event.keycode;
//alert(t);
if(a!='' && a!= 'undefined' && a!= 'topresult' && a!= 'proximity' && a!= 'popularity'){ 
document.justDial.q.value= a;
}

copCat	= document.justDial.q.value;	
//alert(copCat);
area	= document.justDial.area.value;
if(a=='proximity')
{
document.justDial.intermid.value = sec; 
document.justDial.proximity.value="proximity";
document.justDial.action=document.URL;
document.justDial.submit();
}
else if(a=='topresult')
{
document.justDial.intermid.value = sec;
document.justDial.proximity.value="";
document.justDial.action=document.URL;
document.justDial.submit();
}
if(a=='proximity')
{
	if(!area)
	{
		area	= document.areaAlert.area.value;
		document.justDial.area.value = area;
		
	}

	if((area=='') && (document.getElementById('areaID').style.visibility=='visible'))
	{
	 alert('Please Enter an Area');
	 return false;
	}
}
document.justDial.intermid.value = sec;
if((city !="")&&(copCat!=""))
{	

	//alert(a);
	setCookie('CITY', document.justDial.city.value);
	if(a=='popularity' || a=='proximity' || a=='topresult')
	{
	/*alert(document.URL);
	document.justdial.action=document.URL;
	document.justdial.proximity.value=a;
	document.justdial.submit();*/
	var areaval=document.areaAlert.area.value;
	var areaval1;
	var searchtype_url;
	//alert(searchtype);
	searchtype=searchtype.toLowerCase();
	searchtype_url=searchtype.replace(/ /gi,"-");
	areaval=areaval.toLowerCase();
	areaval1=areaval.replace(/ /gi,"-");
	setCookie('CITY', document.justDial.city.value);
	city = document.justDial.city.value;
	copCat	= document.justDial.q.value;
	document.justDial.intermid.value = sec;
	if(areaval1=='')
	{
	areaval1 = document.justDial.area.value;
	areaval1=areaval1.toLowerCase();
	areaval1=areaval1.replace(/ /gi,"-");
	}
	else
	{
	document.justDial.area.value=document.areaAlert.area.value;
	}
	//alert(areaval1);
	if(areaval1=='')
	{
	if(page=='')
	document.justDial.action="/" + searchtype_url + "_" + city + ".html";
	else
	document.justDial.action="/" + searchtype_url + "_" + city + "_" + page + "_DWOA.html";
	}
	else
	{
	//alert('hi');
	if(page=='')
	document.justDial.action="/" + searchtype_url + "_" + areaval1 + "_" + city + ".html";
	else
	document.justDial.action="/" + searchtype_url + "_" + areaval1 + "_" + city + "_" + page + "_DWA.html";
	}
	document.justDial.submit();
	}
	else
	{
	if((Stype == 'company')&&(area != '')&&(document.justDial.AutoCatId.value==''))
	{
	document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password+'&proximity='+a+'';
	}
	else if((Stype == 'company')&&(area == '')&&(document.justDial.AutoCatId.value==''))
	{
	document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password;
	}
	else if(document.justDial.AutoCatId.value!='')
	{
			if(Stype == 'company')
			{document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password; }
			else
			{document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password;}
		 }
	else if((sec != '')&&(area != ''))
	{document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password+'&proximity='+a+'';}
	else if((sec != '')&&(area == '')){document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password+'&proximity='+a+'';}
	else{
		document.justDial.action='http://search.justdial.com/search/search.php?srch=true&city='+city+'&searchtype='+copCat+'&Stype='+Stype+'&area='+area+'&login_name='+mysession_login+'&login_pass='+mysession_password+'&proximity='+a+'';
		}
	document.justDial.submit();
	}
	}
	else
	{
	if(city ==""){alert("Please select city for search");
		document.justDial.city.focus();return false;
	}
	if(copCat==""){alert("Please enter category/company name for search");
	document.justDial.q.focus();return false;}
	}
}
}
function getProximity()
{
 /*if(City_Check()=='false')
    return false;*/
 //alert('hi');		
 area	= document.justDial.area.value;
 if(area=='')
  { area	= document.areaAlert.area.value; } 
 if(area=='')
 {
  show_divsarea('areaID');
  document.areaAlert.area.focus();
   var area_options2 = {
	script:function (input) { return "../optimized/autosuggest_area.php?&city=" + _b.DOM.gE("txt2").value+"&search=" + escape(_b.DOM.gE("txtarea1").value); },
	varname:"search",
	json:true,
	delay:0,
	shownoresults:false,
	maxresults:6,
	timeout:1500,
	cache: false,
	offsety: -5,
	callback:function (obj) {cb_area2(obj); } 
	};
	area_json2 = new bsn.AutoSuggest('txtarea1', area_options2);
 }
 else
 {
  getResult('proximity');
 }
}
function area_input_blur2(){
 area_json2.clearSuggestions();
}
function setcheckblur_area2(){
 area_json2.chkblur='false';	
}
function cb_area2(obj){
	//remove_sec();
	getResult('proximity');
}
function show_divsarea(dv){
		//citys = eval(city);
		dx = eval(dv);
		
		dx.style.visibility ="visible";
		dx.style.display = '';
		//return false;
		//selectcity('<?=$city?>');
	}//this is for show div for proximity.
function more_sponser(page){
/*if(City_Check()=='false')
    return false;	*/
document.resultdata.Stype.value = Stype;
document.resultdata.city.value = city;
document.resultdata.area.value = area;
document.resultdata.searchtype.value = searchtype;
document.resultdata.docId.value = "";
if( ADVSEARCH != ""){
	document.resultdata.action= "search_adv.php?page_sponser="+page+"&careMode="+caseMode;	document.resultdata.submit();
}else
{
	if(caseMode == 'DWOA'){
		
		document.resultdata.action= "search_cwa.php?page_sponser="+page+"&careMode="+caseMode;}if(caseMode == 'DWA'){document.resultdata.action= "search_cwa_sponser.php?page_sponser="+page+"&careMode="+caseMode;}
	if(caseMode == 'CAT'){
		//alert();
	document.resultdata.intermid.value = '';
	document.resultdata.action= "search_cat.php?page_sponser="+page+"&careMode="+caseMode;
	}
	document.resultdata.submit();
}
}
function set_focus()
{
if(window.event.keyCode == 13)
{
remove_sec();
getResult_best('magic');
}
}
function get_company_best_deals(z)
{
document.resultdata.intermid.value = document.justDial.intermid.value; 
document.resultdata.searchtype.value = z;
document.resultdata.Stype.value = "category";
if(area != "")
{
document.resultdata.action='search_best_deals.php?srch=true&city='+city+'';
}
else
{
document.resultdata.action='search_best_deals.php?srch=true&city='+city+'';
}
document.resultdata.submit();
}
function setCookie(CookieName,CookieValue)
{ var expireDate = new Date (); var offset = 2 / 1; expireDate.setYear(expireDate.getFullYear()+offset); 
document.cookie = escape(CookieName ) + "=" + escape(CookieValue) + "; expires=" + expireDate.toGMTString() + "; path=/";
}

function getResult_index(){	

var city; var Stype;	var copCat; 	var area;
city	=document.MagicAlert.city.value;
copCat	=document.MagicAlert.q.value;
area	=document.MagicAlert.area.value;
if(document.MagicAlert.Stype[0].checked){Stype = 'company';}

if((city !="")&&(copCat!="")){
setCookie('CITY', document.MagicAlert.city.value);
if((Stype == 'company')&&(area != '')){document.MagicAlert.action='../srch/search_cwa.php?srch=true&city='+city+'';}
else if((Stype == 'company')&&(area == '')){document.MagicAlert.action='../srch/search_cwoa.php?srch=true&city='+city+'';}
else{document.MagicAlert.action='../srch/search_cat.php?srch=true&city='+city+'';}
document.MagicAlert.submit();
}
else
{
if((city == "")||(city == "Select City"))
{
	alert("Please select city for search")
	document.MagicAlert.city.focus()
	return false
}
if(copCat=="")
{
	alert("Please enter category/company name for search")
	document.MagicAlert.q.focus()
	return false
}
}
}
function getResult_index_call(){	
var city;var Stype;var copCat;var area;
if(document.justDial.Stype[0].checked){Stype = 'company';}city	=document.justDial.city.value;
copCat	=document.justDial.q.value;
area	=document.justDial.area.value;
if((city!="")&&(copCat!="")){	
setCookie('CITY', document.justDial.city.value);

if((Stype == 'company')&&(area != '')){document.justDial.action='../search/search_cwa.php?srch=true&city='+city+'';}
else if((Stype == 'company')&&(area == '')){document.justDial.action='../search/search_cwa.php?srch=true&city='+city+'';}

else{document.justDial.action='../search/search_cat.php?srch=true&city='+city+'';}
document.justDial.submit();
}
else{if(city ==""){alert("Please select city for search");document.justDial.city.focus();return false;}
if(copCat==""){alert("Please enter category/company name for search");document.justDial.q.focus();return false;}}
}
function selectcity(aa){
if(aa != "body"){city = aa;}
var str;
switch (city)
{
	case "Ahmedabad":
		str='(E.g. Ashram Road)'
	break											
	case "Ernakulam":
		str='(E.g. M G Road)'
	break 
	case "Vizag":
		str='(E.g. Dwaraka Nagar)'
	break 
	case "Vadodara":
		str='(E.g. Sayaji Gunj)'
	break
	case "Coimbatore":
		str='(E.g. Ram Nagar)'
	break
	case "Kovai":
		str='(E.g. Ram Nagar)'
	break
	case "Bangalore":
		str='(E.g. Indira Nagar)'
		break
	case "Bengaluru":
		str='(E.g. Indira Nagar)'
		break
	case "Chennai":
		str='(E.g. Adyar)'
		break
	case "Madras":
		str='(E.g. Adyar)'
		break
	case "Delhi":
		str='(E.g. Noida,Connaught Place,Gurgaon )'
		break
	case "Delhi / NCR":
		str='(E.g. Noida,Connaught Place,Gurgaon )'
		break
	case "Hyderabad":
		str='(E.g. Banjara Hills)'
		break
	case "Kolkata":
		str='(E.g. Park Street)'
		break
	case "Calcutta":
		str='(E.g. Park Street)'
		break
	case "Mumbai":
		str='(E.g. Juhu, Thane, Vashi)'
		break
	case "Pune":
		str='(E.g. Koregaon Park)'
		break
	case "Indore":
		str='(E.g. Vallabh Nagar)'
		break
	case "Jaipur":
		str='(E.g. C Scheme)'
		break
	case "Chandigarh":
		str='(E.g. Sector 17)'
		break
	case "Vijayawada":
		str='(E.g. Benz Circle)'
		break
	case "Madurai":
		str='(E.g. Arignar Anna Nagar)'
		break
	case "Mysore":
		str='(E.g. Saraswathipuram)'
		break
	case "Goa":
		str='(E.g. Calangute)'
		break
	case "Jamshedpur":
		str='(E.g. Circuit House)'
		break
	case "Jodhpur":
		str='(E.g. Sardarpura)'
		break
	case "Ludhiana":
		str='(E.g. Model Town)'
		break
	case "Surat":
		str='(E.g. Ring Road)'
		break
	case "Mangalore":
		str='(E.g. Hampankatta)'
		break
	case "Nagpur":
		str='(E.g. Mahal)'
		break
	case "Pondicherry":
		str='(E.g. Karaikal)'
		break
	case "Ranchi":
		str='(E.g. Namkum)'
		break
	case "Rajkot":
		str='(E.g. Ring Road)'
		break
	case "Agra":
		str='(E.g. Sanjay Palace)'
	break
	case "Thiruvananthapuram":
		str='(E.g. Sasthamangalam)'
	break
	case "Varanasi":
		str='(E.g. Sigra Road)'
	break
	case "Bhopal":
		str='(E.g. T T Nagar)'
	break
	case "Kanpur":
		str='(E.g. Civil Lines)'
	break
	case "Tirunelveli":
		str='(E.g. Palayamkottai)'
	break
	case "Nashik":
		str='(E.g. College Road)'
	break
	case "Hubli":
		str='(E.g. Vidyanagar)'
	break
	case "Jalandhar":
		str='(E.g. Model Town)'
	break
	case "Lucknow":
		str='(E.g. Gomti Nagar)'
	break
	case "Patna":
		str='(E.g. kankarbagh)'
	break
	case "Salem":
		str='(E.g. Fair Lands)'
	break
	case "Bhubaneshwar":
		str='(E.g. Sahid Nagar)'
	break
	case "Allahabad":
		str='(E.g. Civil Lines)'
	break
	case "Cuttack":
		str='(E.g. College Square)'
	break
	case "Kolhapur":
		str='(E.g. Rajarampuri)'
	break
	case "Jamnagar":
		str='(E.g. New Supermarket)'
	break
	case "Kozhikode":
		str='(E.g. Beypore)'
	break

	default :
		str=''
	break

}
document.getElementById('areatd').innerHTML=str;
if(city!=""){
document.justDial.city.value = city;}

if(ADVSEARCH == ""){
if(document.justDial.Stype[0].value == Stype)
{document.justDial.Stype[0].checked = true;}
}

if(altsearch == 'comp'){
document.justDial.Stype[1].checked = true;
}
xmlhttpauto("../search/area_auto/ajax_area.php?str="+city);
}
function showdetails(i,j,k,m,n)
{
/*if(City_Check()=='false')
    return false;*/	
document.resultdata.docId.value = i
document.resultdata.Stype.value = Stype;
document.resultdata.area.value = area;		
document.resultdata.city.value = city;
document.resultdata.searchtype.value = searchtype;
document.resultdata.lowest.value='';
document.resultdata.jdG.value=n;
if( ADVSEARCH != ""){
document.resultdata.action= "search_adv.php?srch=true&sms="+j+"&city="+city+"&define="+k+"";
document.resultdata.submit();
}else{
 if(j!='#read'){
    document.resultdata.action= "search_cmd.php?srch=true&sms="+j+"&city="+city+"&define="+k+"&value="+m+"";}
  else{
    document.resultdata.action= "search_cmd.php?srch=true&city="+city+"&define="+k+"&value="+j+"";
  }
document.resultdata.submit();}
}

function GotoLowQuote(docid,page)
{
/*if(City_Check()=='false')
    return false;*/
//For Lowest Quote
document.resultdata.docId.value =	docid;
document.resultdata.Stype.value = Stype;
document.resultdata.area.value = area;		
document.resultdata.city.value = city;
document.resultdata.searchtype.value = searchtype;
document.resultdata.lowest.value='true';
document.resultdata.return_page.value = page;
document.resultdata.action= "search_cmd.php?srch=true&sms=&city="+city+"&define=&value=&lowest=true";
document.resultdata.submit();
}
function refreshImg()
{
var img = document.getElementById('simg');
img.src = "../srch/Code_srch/security-image.php?" + Math.random();
}
function refreshImgmob()
{
var img = document.getElementById('simgmob');
img.src = "../srch/Code_srch/security-image.php?" + Math.random();
}
function refreshImgemail()
{
var img = document.getElementById('simgemail');
img.src = "../srch/Code_srch/security-image.php?" + Math.random();
}
function showImg(i)
{
document.resultdata.docId.value = i;
document.resultdata.sms_visible.value = 1;
document.resultdata.Stype.value = Stype;
document.resultdata.area.value = area;		
document.resultdata.city.value = city;
document.resultdata.searchtype.value = searchtype;
document.resultdata.action= "?srch=true";
document.resultdata.submit();
}
function get_company(z){
/*if(City_Check()=='false')
    return false;	*/
document.resultdata.docId.value = "";document.resultdata.intermid.value = "true";document.resultdata.city.value = city;
area	=  document.justDial.area.value;document.resultdata.area.value = area;document.resultdata.searchtype.value = z;
document.resultdata.Stype.value = "category";
if(area != ""){document.resultdata.action='search_cwa.php?srch=true&city='+city+'';}
else{document.resultdata.action='search_cwa.php?srch=true&city='+city+'';}document.resultdata.submit();}

function loadPage(page,caseMode,tpro){
document.resultdata.Stype.value = Stype;
document.resultdata.city.value = city;
document.resultdata.area.value = area;
document.resultdata.searchtype.value = searchtype;
document.resultdata.docId.value = "";
if( ADVSEARCH != ""){
	document.resultdata.action= "search_adv.php?page="+page+"&careMode="+caseMode;	document.resultdata.submit();
}else{
	if(caseMode == 'DWOA'){document.resultdata.action= "search_cwa.php?page="+page+"&careMode="+caseMode+"&proximity="+tpro;}if(caseMode == 'DWA'){document.resultdata.action= "search_cwa.php?page="+page+"&careMode="+caseMode+"&proximity="+tpro;}
	if(caseMode == 'CAT'){
	document.resultdata.intermid.value = '';
	document.resultdata.action= "search_cat.php?page="+page+"&careMode="+caseMode;
	}
	document.resultdata.submit();
}
}
function changefont(a)
{
if(a=="Name")
{
if(document.MagicAlert.magic_email.value=="")
{
	document.MagicAlert.magic_email.value="Email Address";
	document.getElementById('magic_email_id').className = 'inputtext';
}
else if(document.MagicAlert.magic_mobile.value=="")
{
	document.MagicAlert.magic_mobile.value="Mobile Number";
	document.getElementById('magic_mobile_id').className = 'inputtext';
}
document.MagicAlert.magic_name.value="";
document.getElementById('magic_name_id').className = 'searchareafont1';
}
if(a=="Email Address")
{
if(document.MagicAlert.magic_name.value=="")
{
	document.MagicAlert.magic_name.value="Name";
	document.getElementById('magic_name_id').className = 'inputtext';
}
else if(document.MagicAlert.magic_mobile.value=="")
{
	document.MagicAlert.magic_mobile.value="Mobile Number";
	document.getElementById('magic_mobile_id').className = 'inputtext';
}

document.MagicAlert.magic_email.value="";
document.getElementById('magic_email_id').className = 'searchareafont1';
}
if(a=="Mobile Number")
{
if(document.MagicAlert.magic_name.value=="")
{
	document.MagicAlert.magic_name.value="Name";
	document.getElementById('magic_name_id').className = 'inputtext';
}
else if(document.MagicAlert.magic_email.value=="")
{
	document.MagicAlert.magic_email.value="Email Address";
	document.getElementById('magic_email_id').className = 'inputtext';
}
document.MagicAlert.magic_mobile.value="";
document.getElementById('magic_mobile_id').className = 'searchareafont1';
}
}
function isValid(value, type)
{
 	switch(type)
 	{
		case 'name':
		return/^[a-zA-Z]+([.]{0,1}[ ]{0,1}[a-zA-Z]+)*$/.test(value);
		//return /^[a-zA-Z]+[ a-zA-Z]+$/.test(value);
		case 'alpha':
   		return /^[A-Za-z]*$/.test(value);
  		case 'numeric':
   		return /^[0-9]*$/.test(value);
  		case 'email':
   		return /^(([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}){0,1}$/.test(value);
 	}
}

function SmsAlert(i,j)
{
var chk = 'true';
var sTasus;
		
if(document.smsAlert.NameAlert.value != "")
{	
	var trimmed_name = document.smsAlert.NameAlert.value.replace(/^\s+|\s+$/g,"");
	document.smsAlert.NameAlert.value = trimmed_name;
	
	if(!isValid(document.smsAlert.NameAlert.value, 'name'))
	{ 	
		alert("Invalid name.");
		document.smsAlert.NameAlert.focus();
		chk = "false";
		return;
	} 
}
if (document.smsAlert.Mobile.value != "")
{
	var trimmed_mobile = document.smsAlert.Mobile.value.replace(/^\s+|\s+$/g,"");
	document.smsAlert.Mobile.value = trimmed_mobile;
	
	if (!isValid(document.smsAlert.Mobile.value, 'numeric'))
	{
		alert("Please enter numbers only.");
		document.smsAlert.Mobile.focus();
		chk = "false";
		return;
	}
	if(document.smsAlert.Mobile.value.indexOf("+91") != -1)
	{
		alert("Please don't use +91 at the begining of the mobile number.");
		document.smsAlert.Mobile.focus();
		chk = "false";
		return;
	}	
	if(document.smsAlert.Mobile.value.indexOf("0") == 0)
	{
		alert("Please don't use 0 at the begining of the mobile number.")
		document.smsAlert.Mobile.focus();
		chk = "false";
		return;
	}
	var mobileNoFirstChar = document.smsAlert.Mobile.value.charAt(0);
	if(mobileNoFirstChar != 9)
	{
		alert("Mobile number should start with 9.")
		document.smsAlert.Mobile.focus();
		chk = "false";
     	return;
	}	
	var cell = document.smsAlert.Mobile.value.length;
	if(cell != 10)
	{
		alert("Mobile number must be of 10 digits.");
		document.smsAlert.Mobile.focus();
		chk = "false";
		return;
	}
}

if(document.smsAlert.email.value != "")
{
	var trimmed_email = document.smsAlert.email.value.replace(/^\s+|\s+$/g,"");
	document.smsAlert.email.value = trimmed_email;
	
	if (!isValid(document.smsAlert.email.value,'email'))
	{
		alert("Entered Email id is invalid.");
		document.smsAlert.email.focus();
		chk = "false";
		return;
	}
}

if(chk == "true")
{
	if((document.smsAlert.Mobile.value != "")||(document.smsAlert.email.value != ""))
	{
		sTasus = "true";
	}
 	else if(((document.smsAlert.Mobile.value != "")||(document.smsAlert.email.value != ""))&&(document.smsAlert.img.value != ""))
	{
		sTasus = "true";
	}
	else
	{
		if((document.smsAlert.Mobile.value == "")&&(document.smsAlert.email.value == ""))
		{
			alert("Please enter your mobile number or Email id.");
			document.smsAlert.Mobile.focus();
			sTasus = "false";
		}
		else if(document.smsAlert.sendSMS.value!='')
		{
			if(document.smsAlert.img.value == "")
		 	{ 
		  		alert("Please Enter Verification Code From SMS");
		  		sTasus = "false";
		 	}
		}
	}
	//alert(sTasus);
	if(sTasus == "true")
	{
		document.resultdata.smsAlert.value		= document.smsAlert.Mobile.value;
		document.resultdata.emailAlert.value	= document.smsAlert.email.value;
		document.resultdata.NameAlert.value		= document.smsAlert.NameAlert.value;
		document.resultdata.smsDetail.value		= document.smsAlert.smsDet.value;
		if(document.smsAlert.sendSMS.value!='')
		{
			document.resultdata.sms_button.value    =  document.smsAlert.sendSMS.value;
		 	document.resultdata.img_check.value     =  document.smsAlert.img_check.value; 
			// alert(document.resultdata.img_check.value);
		}
		else
		{
			document.resultdata.sms_button.value    =  document.smsAlert.GetCode.value;
		}
		if(document.smsAlert.sendSMS.value!='')
		{
			document.resultdata.img.value			= document.smsAlert.img.value;
		}
		document.resultdata.sinfo.value			= document.smsAlert.sinfo.value;
		document.resultdata.seeAlso.value		= document.smsAlert.seeAlso.value;
		if( ADVSEARCH != "")
		{
			document.resultdata.docId.value = i;
			//alert(document.resultdata.docId.value);
			document.resultdata.searchtype.value = searchtype;
			document.resultdata.action = "?srch=true&advSearch=search";
			//alert(document.resultdata.action);
			document.resultdata.submit();
		}
		else
		{
			if(j!='comArea')
			{
				document.resultdata.docId.value = i;}
				document.resultdata.Stype.value = Stype;
				document.resultdata.area.value = area;		
				document.resultdata.city.value = city;
				document.resultdata.searchtype.value = searchtype;
				//document.resultdata.action= "?srch=true";
				document.resultdata.submit();
			}
		}
	}
}
function SmsLowquote(i)
{
chk = 'true';
chklowcat = 'false';
var regex = /^[_]*[a-zA-Z_.]+[ .a-zA-Z0-9_]*$/;
var Lowcat = '';
var j;
for(j=0;j<(document.all['Lowcat[]'].length);j++)
{
 if(document.all['Lowcat[]'][j].checked==true)	
 { 
  chklowcat = 'true';
  break; 
 }
}
if(chklowcat=='false')
{
 alert('Please select atleast one category');
 chk = "false";
}
if(document.LowestQuote.NameAlert.value != "")
{
 if(!regex.test(document.LowestQuote.NameAlert.value))
 {
  alert("Please Enter Valid Name");
  document.LowestQuote.NameAlert.focus();
  chk = "false";
 }
}
if (document.LowestQuote.Mobile.value != "")
{
	if (isNaN(document.LowestQuote.Mobile.value)==true)
	{
	alert("Please Enter Numbers Only");
	
	document.LowestQuote.Mobile.value = "";
	document.LowestQuote.Mobile.focus();
	chk = "false";
	}
	if(document.LowestQuote.Mobile.value.indexOf("+91") != -1){
		alert("Please Don't Use +91 at the begining of the mobile No.")
	chk = "false";
	}
	
	if(document.LowestQuote.Mobile.value.indexOf("0") == 0){
		alert("Please Don't Use 0 at the begining of the mobile No.")
	chk = "false";
	}
	
	var cel = document.LowestQuote.Mobile.value;
	var cell = cel.length;
	if(cell < 10 || cell > 10)
	{
		alert("Enter Valid Cell No. !!!");
		document.LowestQuote.Mobile.focus();
		chk = "false";
	}
}
if(document.LowestQuote.email.value != ""){
	apos=document.LowestQuote.email.value.indexOf("@"); 
	dotpos=document.LowestQuote.email.value.lastIndexOf(".");
	if (apos<1 || dotpos-apos < 2 ) 
	{alert('Invalid email Id. !!!'); 
	document.LowestQuote.email.focus(); 
	chk = "false";
	}
	if(document.LowestQuote.email.value.indexOf("..") != -1){
			alert('Invalid email Id. (Remove "..")')
		chk = "false";
	}
	eml = document.LowestQuote.email.value;
	if(eml.indexOf(",") != -1){
			alert('Invalid email Id. (Only One E-mail ID Allowed)')
		chk = "false";
	}
	if(eml.indexOf(";") != -1){
			alert('Invalid email Id. (Only One E-mail ID Allowed!)')
		chk = "false";
	}
}
if(chk == "true") {
	if((document.LowestQuote.Mobile.value != "")||(document.LowestQuote.email.value != "")){
		sTasus = "true";
	}else if(((document.LowestQuote.Mobile.value != "")||(document.LowestQuote.email.value != ""))&&(document.LowestQuote.img.value != "")){
		sTasus = "true";
	}
	else{
		if((document.LowestQuote.Mobile.value == "")&&(document.LowestQuote.email.value == ""))
		{
		alert("Please Enter Your Mobile Number or email id.");
		sTasus = "false";
		}
		else if(document.LowestQuote.sendSMS.value!='')
		{
		  if(document.LowestQuote.img.value == "")
		 {
		  alert("Please Enter Security Image");
		  sTasus = "false";
		  }
		}
	}
	if(sTasus == "true")
	{	//document.LowestQuote.lowquote.value		= 'true';
		document.LowestQuote.lowest.value		= 'true';	
		document.resultdata.smsAlert.value		= document.LowestQuote.Mobile.value;
		document.resultdata.emailAlert.value	= document.LowestQuote.email.value;
		document.resultdata.NameAlert.value		= document.LowestQuote.NameAlert.value;
		if(document.LowestQuote.sendSMS.value!='')
		{document.resultdata.sms_button.value    =  document.LowestQuote.sendSMS.value;
		 document.resultdata.img_check.value     =  document.LowestQuote.img_check.value; 
		// alert(document.resultdata.img_check.value);
		}
		else
		{document.resultdata.sms_button.value    =  document.LowestQuote.GetCode.value;}
		if(document.LowestQuote.sendSMS.value!='')
		{document.resultdata.img.value			= document.LowestQuote.img.value;}
		document.resultdata.lowest.value		= document.LowestQuote.lowest.value;
		document.resultdata.return_page.value	= document.LowestQuote.return_page.value;
		//alert(document.resultdata.return_page.value);
		for(j=0;j<(document.all['Lowcat[]'].length);j++)
		{
		 //alert(document.all['Lowcat[]'][j].checked);
		 if(document.all['Lowcat[]'][j].checked==true)	
		 { 
		  //alert(document.all['Lowcat[]'][j].value);
		  Lowcat += document.all['Lowcat[]'][j].value+',';
		 }
		}
		document.resultdata.Lowcat.value = Lowcat;
		
	if( ADVSEARCH != ""){
	document.resultdata.docId.value = i;
	document.resultdata.action= "?srch=true&advSearch=search";
	document.resultdata.submit();
	}else{
	document.resultdata.docId.value = i;
	document.resultdata.Stype.value = Stype;
	document.resultdata.area.value = area;		
	document.resultdata.city.value = city;
	document.resultdata.searchtype.value = searchtype;
	
	document.resultdata.action= "?srch=true";
	//document.resultdata.action = '?'+document.resultdata.LowURL.value;
	//alert(document.resultdata.action);
	document.resultdata.submit();}
	}
}
}
function MagicAlert1(i)
{		

chk = 'true';

if(document.MagicAlert.magic_name.value == "")
{
	
		alert("Please Enter Your Name.");
		document.MagicAlert.magic_name.focus();
		return false;
		chk = "false";
}
if(document.MagicAlert.magic_email.value != "")
{
 var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,3})+$/;
 if (filter.test(document.MagicAlert.magic_email.value))
 {}
 else
 {
   alert(" Enter Valid Email id ");
   document.MagicAlert.magic_email.focus();
   return ;
 }
}
	if(document.MagicAlert.magic_mobile.value =="" && document.MagicAlert.magic_tel.value =="")
	{	
		alert("Please Enter Mobile Number or Telephone No.");
		document.MagicAlert.magic_mobile.focus();
		return false;
		chk = "false";
	}

   if(document.MagicAlert.magic_mobile.value!=""){

   if(isNaN(document.MagicAlert.magic_mobile.value)==true)
	{
		alert("Please Enter Numbers Only");
		
		document.MagicAlert.magic_mobile.value = "";
		document.MagicAlert.magic_mobile.focus();
		return false;
		chk = "false";
	}
	else if(document.MagicAlert.magic_mobile.value.indexOf("+91") != -1){
		alert("Please Don't Use +91 at the begining of the mobile No.")
		return false;
		chk = "false";
	}
	
	else if(document.MagicAlert.magic_mobile.value.indexOf("0") == 0){
		alert("Please Don't Use 0 at the begining of the mobile No.")
		return false;
		chk = "false";
	}
	
	var cel = document.MagicAlert.magic_mobile.value;
	var cell = cel.length;
	if(cell < 10)
	{
		alert("Enter Valid Cell No. !!!");
		document.MagicAlert.magic_mobile.focus();
		return false;
		chk = "false";
	}
 }

 if(document.MagicAlert.magic_tel.value !=""){

	if(isNaN(document.MagicAlert.magic_tel.value)==true)
	{
		alert("Please Enter Numbers Only");
		
		document.MagicAlert.magic_tel.value = "";
		document.MagicAlert.magic_tel.focus();
		return false;
		chk = "false";
	}
	else if(document.MagicAlert.magic_tel.value.indexOf("+91") != -1){
		alert("Please Don't Use +91 at the begining of the Telephone No.")
		return false;
		chk = "false";
	}
	
	else if(document.MagicAlert.magic_tel.value.indexOf("0") == 0){
		alert("Please Don't Use 0 at the begining of the Telephone No.")
		return false;
		chk = "false";
	}
	
	var tel = document.MagicAlert.magic_tel.value;
	var tell = tel.length;
	if(tell < 6 || tell > 8)
	{
		alert("Enter Valid Telephone No. !!!");
		document.MagicAlert.magic_tel.focus();
		return false;
		chk = "false";
	}
}

if(chk == "true") {

	if(((document.MagicAlert.magic_name.value != ""))&&((document.MagicAlert.magic_mobile.value != "" )||(document.MagicAlert.magic_tel.value != "")) ){
		sTasus = "true";
	}else{
	alert("Please Enter Name and Mobile Number/Telephone No.")

	sTasus = "false";
	}
	if(sTasus == "true")
	{
	document.resultdata.magic_mobile.value		=	document.MagicAlert.magic_mobile.value;
	document.resultdata.magic_email.value		=	document.MagicAlert.magic_email.value;
	document.resultdata.magic_name.value		=	document.MagicAlert.magic_name.value;
	document.resultdata.magic_tel.value			=	document.MagicAlert.magic_tel.value;
	if( ADVSEARCH != ""){
	document.resultdata.docId.value = i;
	document.resultdata.action= "?srch=true&advSearch=search";
	document.resultdata.submit();
	}else{
	document.resultdata.docId.value = i;
	document.resultdata.Stype.value = Stype;
	document.resultdata.area.value = area;		
	document.resultdata.city.value = city;
	if(document.MagicAlert.bestseeAlso.value!='')
	{ 
	 document.resultdata.searchtype.value = document.MagicAlert.bestseeAlso.value;
	}
	else
	{
	 document.resultdata.searchtype.value = searchtype;
	}
	document.resultdata.action= "?srch=true";
	document.resultdata.submit();
	}
	}
}
}

function xmlhttpauto(url){

var city = document.justDial.city.value.toLowerCase();

if(city=='mumbai' || city=='ahmedabad' || city=='bangalore' || city=='bengaluru' || city=='chennai' || city=='madras' || city=='delhi' || city=='delhi / ncr' || city=='hyderabad' || city=='kolkata' || city=='calcutta' || city=='pune' )
{
url = "../../autosuggest_area.php?city="+escape(document.justDial.city.value);
}
else
{
url = "../../search/area_auto/ajax_area.php?str="+escape(document.justDial.city.value);
}
var xmlHttpReq = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.onreadystatechange = state_Change_auto
self.xmlHttpReq.open('GET', url, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.send(null);
}

function state_Change_auto()
{
if (self.xmlHttpReq.readyState == 4) 
{
var strResText = self.xmlHttpReq.responseText;

if(strResText == "-1") //invalid arguments
{
	alert('Please select city');
	return;
}
if(strResText != "-2")
{
	var str = strResText.split("||")
	arry(str[0],str[1]);
}
}
}
var area_sug = ["Select A City"];
var area_sug_cat = "";
function arry(sTr,ajax_type)
{
if(ajax_type=="category")
{
area_sug_cat = sTr.split(",");
area_sug_cat = area_sug_cat.sort();
}
else
{	area_sug = sTr.split(",");
area_sug = area_sug.sort();
}
}
function showall(type,path,cname)
{/*if(City_Check()=='false')
    return false;*/
if(type == 'video'){
ops = 'no'; ops1 = 'no'; ops2 = '400'; ops3 = '450'; 
}else{
ops = 'yes'; ops1 = 'yes'; ops2 = '580'; ops3 = '500'; 
}
cname = escape(cname);
args = 'toolbar=no,location=no,directories=no,status=no,menubar=no,' + 'scrollbars='+ops+',resizable='+ops1+',' + 'width='+ops2+',height='+ops3+',left=0,top=20';    
window.open("http://search.justdial.com/srch/display/promo.php?type="+type+"&detail="+path+"&cname="+cname,"Image",args)
}

function advSearch(){
//alert('advn srch');
//document.justDial.action='../search/search_adv.php?srch=true&advSearch=search';
document.justDial.action='../srch/search_adv.php?srch=true&advSearch=search';
document.justDial.submit();

}
function test(test)
{
alert('hello');
alert(test);
return false;
}
function trim(s){
return s.replace(/^\s*(.*?)\s*$/,"$1")
}

function changetext(last)
{
document.justDial.last_event.value = last;
last_event = document.justDial.last_event.value;

if(last_event==0)
{
document.justDial.q.value = "Enter Your Search";
document.getElementById('key_txt').className = 'indexlighttext';
}
else if(last_event==1)
{
}
else if(last_event==2)
{
}

}
function changefont(a)
{
if(a!="Enter Your Search")
{
document.getElementById('key_txt').className = 'ftextbox1';
}

}
var t;
function timestampReview()
{
t = setTimeout('ajax_review()',3000000)
}

function ajax_review(docid1,weight)
{
url = '../srch/display/randam_review.php?docid='+docid1+'&weight='+weight;
var xmlHttpReq_user = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq_user = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq_user = new ActiveXObject("Microsoft.XMLHTTP");
} 

self.xmlHttpReq_user.open('POST', url, true);
self.xmlHttpReq_user.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq_user.send(null);
self.xmlHttpReq_user.onreadystatechange = function() 
{
if (self.xmlHttpReq_user.readyState == 4) 
{
  if(self.xmlHttpReq_user.responseText!="")
	{
		reviewSearch(self.xmlHttpReq_user.responseText);
	}
}
}
timestampReview();
}
function reviewSearch(rev)
{
document.getElementById("userReview").style.visibility = "visible" ;
document.getElementById("userReview").innerHTML=rev;
}
function show_promo_details(cid,cimg,cname) 
{	cname=escape(cname);
//alert(cname);
var clength = cimg.length;
var catindex = cimg.indexOf('catalog');
catindex = catindex + 8;				
var img = cimg.substr(catindex,clength);
var h=1000;
var w=1000;
var attribs = "width="+w+",height="+h+",scrollbars=1,resizable=yes";
trial=window.open("/srch/display/promo_popup.php?cid="+cid+"&img="+img+"&cname="+cname,'Catalog',attribs);
}		
function show_all(cata,comp_id,compname)
{	
var h=1000;
var w=710;
var attribs = "width="+w+",height="+h+",scrollbars=1,resizable=yes";
trial=window.open("/srch/display/promo_thumb.php?comp_id="+comp_id+"&Catalog="+cata+"&compname="+compname,'',attribs);		
}
var cur = -1; /* autosuggest */
function xmlHttpReq123() {
if (window.XMLHttpRequest) {
	return new XMLHttpRequest();
} else if(window.ActiveXObject) {
	return new ActiveXObject("Microsoft.XMLHTTP");
} else {
	alert("This application is not compatile with your browser.");
}
}
function showCompCat(ev){
var city = document.justDial.city.value;
var search = document.justDial.q.value;	

if(ev)
	var Keyval = ev.keyCode
else
	var Keyval = window.event.keyCode;
	if(search.length > 1 && (Keyval!=38 && Keyval!=40)){
		if(document.justDial.Stype[0].checked==true)
		{ var URL = "autosuggest_company_query.php?city="+city+"&search="+escape(search); 
		 //alert(URL);
		}
		else if(document.justDial.Stype[1].checked==true)
		{ if(city=='Chennai'|| city=='Delhi / NCR' || city=='Mumbai' ||city=='Kolkata' ||city=='Ahmedabad' || city=='Pune' || city=='Hyderabad' || city=='Bangalore')
					{var URL = "autosuggest_category_query_main.php?city="+city+"&search="+escape(search);}
					else
					{var URL = "autosuggest_category_query.php?city="+city+"&search="+escape(search);}
		}
		else{
			alert("Please select Company/Category Option");
			return false;
		}
		newObj = xmlHttpReq123();
		newObj.onreadystatechange=showResult;
		newObj.open("POST",URL,true);
		newObj.send(null);
	}
	else if(Keyval==13 || search==""){
		hideResult();
	}
}

function suggestResultOver(div_value){
div_value.className = 'resultOver';
}
function assignVal(div_value,catId){
//alert(div_value.innerHTML);
var idivval = div_value.innerHTML;
if(catId!='')
{ 	
var val = navigator.userAgent; 
if(val.indexOf("MSIE") != -1 || val.indexOf("Opera") != -1)
{ 
var Array_divval = idivval.split("<INPUT");
}else{ 
var Array_divval = idivval.split("<input");
}
//alert(Array_divval[1]);
var result_final = Array_divval[0].replace('&amp;','&');
document.getElementById("q").value = result_final;
//alert(catId);
document.justDial.AutoCatId.value = catId;
}
}
function suggestResultOut(div_value)
{
div_value.className = 'resultOut';
}
function showResult(){
	if (newObj.readyState==4 || newObj.readyState=="complete"){
	var arrSearchVal = newObj.responseText.split("|%@%|~|$#`");
	//alert(arrSearchVal);
	var resultVal="";
	//alert(arrSearchVal.length);
	
	for(var s=0; s<arrSearchVal.length; s++){
		
		var autoVal = '';
		var autoId = '';
		
			if(arrSearchVal[s].search(/#/)!= -1 )
			{ 
			 var autoArray = arrSearchVal[s].split('#');
			 autoVal = autoArray[0];
			 catname = autoVal; 
			 autoId = autoArray[1];
			 catid = autoId;
			}
		else
		{   //alert(arrSearchVal[s]);
			autoVal = arrSearchVal[s];
		}			
		resultVal += "<div onmousedown=assignVal(this,'"+catid+"'); onMouseOver='suggestResultOver(this);' onMouseOut='suggestResultOut(this);'>"+autoVal;
		resultVal += "<input type='hidden' name='autoId' id='autoId"+s+"' value='"+catid+"'>";
		resultVal += "<input type='hidden' name='catname' id='catname"+s+"' value='"+catname+"'>";
		resultVal +="</div>"; 
	}
   
	//alert(resultVal);
	document.getElementById("comp_catList").innerHTML = resultVal;
	var val = navigator.userAgent; 
		if(val.indexOf("MSIE") != -1)
      { //alert('ie');
       document.getElementById("comp_catList").style.width = 394;
      } 
if(val.indexOf("Firefox") != -1)
      {  //alert('firefox');
       document.getElementById("comp_catList").style.width = 374;
      } 
	document.getElementById("comp_catList").style.visibility = "visible";
	document.getElementById("q").onkeydown=fn_keyAct;
}
}
function hideResult(){
document.getElementById("comp_catList").style.visibility = "hidden";
}
function fn_keyAct(oEvent){
var cSuggestionNodes = comp_catList.childNodes;
oEvent=oEvent ? oEvent : event;
iKeyCode =  oEvent.keyCode;
if (iKeyCode==38){	
	if (cSuggestionNodes.length > 0 && cur > 0) {
		var oNodenext = cSuggestionNodes[cur];
		window.suggestResultOut(oNodenext);
		
		var oNodecur = cSuggestionNodes[--cur];
		window.suggestResultOver(oNodecur);
		document.getElementById("q").value = oNodecur.firstChild.nodeValue;   
	}
	else
	{
	 var oNodecur = cSuggestionNodes[0];
	 window.suggestResultOut(oNodecur);
	 cur = cSuggestionNodes.length-1;
	}
} else if (iKeyCode==40){
	if (cSuggestionNodes.length > 0 && cur < cSuggestionNodes.length-1) {
		if(cur > -1) {
			var oNodeprev = cSuggestionNodes[cur];
			window.suggestResultOut(oNodeprev);
		}
		var oNodecur = cSuggestionNodes[++cur];
		window.suggestResultOver(oNodecur);
		if(oNodecur.firstChild.nodeValue==null){cur=-1}
		if(oNodecur.firstChild.nodeValue!=null)
		{document.getElementById("q").value = oNodecur.firstChild.nodeValue;}
	}
	else
	{
	 cur = -1;
	}
} else if (iKeyCode==13){
	
	var catid = document.getElementById('autoId'+(cur)).value;
	//alert(catid);
	document.justDial.AutoCatId.value = catid;
	//alert(document.justDial.AutoCatId.value);
	 var catname = document.getElementById('catname'+(cur)).value;
	 //alert(catname);
	document.justDial.catname.value = catname;
	
	hideResult();
}else{
	cur = -1;
	showCompCat();
}
}
function hideResult(){
document.getElementById("comp_catList").style.visibility = "hidden";
}
//* End Auto Suggest */
/*All India Search*/
function Go_AllIndiaSearch()
{
city	=document.justDial.city.value;
copCat	=document.justDial.q.value;
document.justDial.Allsearchtype.value = copCat;
document.justDial.Allcity.value = city;
document.justDial.AllIndiaSearch.value = true;
// setCookie('CITY', "All India Search");
if(copCat!='')
{ 
document.justDial.action='http://search.justdial.com/srch/all_indiasrch/all_india.php';
}
else
{
document.justDial.action='http://search.justdial.com/index_allindia.php';
}
document.justDial.submit();
}
/*End All India Search*/

function GO_advsearch()
{ 
  /*if(City_Check()=='false')
    {return false;}*/
document.justDial.action='http://search.justdial.com/search/advSearch.php';
document.justDial.submit();
}
/* For Flash Banner  */
   function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
 
 function doMask(src_id, dest_id)
 {
  var src = document.getElementById(src_id);
  var dest = document.getElementById(dest_id);
  
  dest.style.left = findPosX(src) + "px";
  dest.style.top = findPosY(src) + "px";
  
  dest.style.width = src.offsetWidth + "px";
  dest.style.height = src.offsetHeight + "px";
  
  dest.style.backgroundColor = "#ffffff";
}  
/* For Flash Banner  */

/****************************For Report Abuse*********************************/

function reportAbuse(id, city, companyname)
{
	var comments = document.getElementById('comments').value;
	comments = comments.replace(/^\s+|\s+$/g,"");
	document.getElementById('comments').value = comments;

	if(comments=='')
	{ 
		alert('Please enter the reason for reporting abuse');
        document.getElementById('comments').focus();
	}
	
	else if(document.getElementById('comments').value.length >1000)
	{
		alert('You have entered more than 1000 chars.');
		document.getElementById('comments').focus();
	}
	
	else
	{
	
		document.getElementById('report').style.visibility='hidden';
		document.getElementById('report').style.display='none';
		
		url = 'srch/display/Report_Abuse.php?docid='+id+'&city='+city+'&cmpname='+escape(companyname)+'&comments='+comments;
	
		var xmlHttpReq_user = false;
		var self = this;
		
		if (window.XMLHttpRequest)
		{
			self.xmlHttpReq_user = new XMLHttpRequest();
		}
	
		else if (window.ActiveXObject)
		{
			self.xmlHttpReq_user = new ActiveXObject("Microsoft.XMLHTTP");
		}
		self.xmlHttpReq_user.open('GET', url, true);
		self.xmlHttpReq_user.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		self.xmlHttpReq_user.send(null);
		self.xmlHttpReq_user.onreadystatechange = function() 
		{
			
			if (self.xmlHttpReq_user.readyState == 4) 
			{
				document.getElementById('report2').style.visibility='visible';
				document.getElementById('report2').style.display='block';
						
				if(self.xmlHttpReq_user.responseText == "daily max limit reached")
				{
					document.getElementById('response_report_abuse').innerHTML = "You have reached your daily limit of reporting companies as Abuse"
				}
	
				else if(self.xmlHttpReq_user.responseText == "only one enquiry per docid")
				{
					document.getElementById('response_report_abuse').innerHTML = "You have already sent abuse report for the same company today."
				}
				else
				{			
					document.getElementById('response_report_abuse').innerHTML = "Thank you, for taking out time to report abuse on Just Dial, our team shall review this listing and take appropriate action within 72 hours."
				}
			}
		}
	}
}

function closeraam2(divid){
	document.getElementById('report').style.visibility='hidden';
	document.getElementById('report').style.display='none';
}
function closeraam3(divid){
	document.getElementById('report2').style.visibility='hidden';
	document.getElementById('report2').style.display='none';
}
/****************************End For Report Abuse*********************************/
