//获取当前页面
var this_url = location.href;
/////////////////
mapabc_poiids = "";
var sp = new MLocalSearchOptions();   
var sis =new MLocalSearch();   
var keytemp = "";
var ctemp = "" ;
var cktemp = "";
var cenXtemp = "";
var cenYtemp  = "";
/////////////////
function ct_zone(){
		var ct_html = "";
		var cities = citylist.city;
		var isHotcity = false;
		for (var t in cities){
			if (cities[t].length > 0){
				ct_html += "<ul><li class='letters'>" + t + "</li>";
				for (var i = 0;i < cities[t].length; ++i){
					isHotcity = false;
					for (var j = 0; j < citylist.hot_city.length; ++j){
						if (cities[t][i] == citylist.hot_city[j]){
							isHotcity = true;
							break;
						}
					}
					ct_html += "<li><a" + (isHotcity?" class=\"red\"":"") + " href=\"javascript:void(0)\" onclick=\"setCurrentCity('" + cities[t][i] + "')\">" + cities[t][i] + "</a></li>";
				}
				ct_html += "</ul>";
			}
		}
		$("status").style.display = "none";
		$("no_action").style.display = "block";
		$("cityzone").innerHTML = ct_html;
		setZoom("");
}

function setZoom(n){
	var args = $("zoom").childNodes;
	for (var i = 0; i < args.length; ++i){
		//args[i].onClick = "";
		args[i].className = "";
	}
	if(n!=""){mapObj.setZoomLevel(n);}
}

function around_search(s,x,y,id){//显示周边搜索界面
	$('result').style.display="none";
	$('page').style.display="none";
	$('result_info').style.display="none";
	$('around_div').style.display="block";
	$('point_name').value = s;
	$('point_key').focus();
	poiname = s;
	poix = x;
	poiy = y;
	sw_searchbox($("around_tab"));
	$("around_center").value = s;
	show_all_poi(0);
	poi_one(id);
}

function backtoresult(){
	$('around_div').style.display="none";
	$('result_info').style.display="block";
	$('result').style.display="block";
	$('page').style.display="block";
	sw_searchbox($("around_tab"));
	show_all_poi(1);
}

function no_result(){
		//$('result_info').style.display="none";
		removeAllOverlays();
		$('around_div').style.display="none";
		$('page').style.display="none";
		$('result').style.display = "block";
}

function jumpurl(s){
	location.href = s;
}
//tip点操作
function show_all_poi(ii){//显示地图位置点
	for(var i=0;i<number;i++){
		try{
			mapObj.openOverlayTip(i+1,ii==0?false:true);
		}catch(e){}
	}
	try{mapObj.openOverlayTip("1000",ii==0?false:true);}catch(e){}

}

function poi_one(i){//显示某个POI点在地图的位置
		mapObj.openOverlayTip(i,true);
		//mapObj.openTipById(i);
}


//To avoid mapfmp errors
function removeAllOverlays(){
	if('undefined' != typeof mapObj){
		mapObj.removeAllOverlays();
	}
}

function addOverlay(o){
	if('undefined' != typeof mapObj){
		mapObj.addOverlay(o, true);
	}
}

function drawCustomPoints(o){
	if('undefined' != typeof mapObj){
		mapObj.drawCustomPoints(o, true);
	}
}

/*                               功能结束                                   */

//字符串处理
function checkurl(t){
	if(!t||t==null||t==""||t==" "||t=="null"){
		return "NAN";
	}else{
		return t;
	}
}

//		0类型
//		1起点城市
//		2终点城市
//		3起点关键字
//		4钟点关键字
//		5起点X
//		6起点Y
//		7终点X
//		8终点Y
//		9起点地址
//		10终点地址
//		11起点电话
//		12终点电话
//		13起点类型
//		14终点类型
//		15起点poiid
//		16终点poiid
//		17中心点关键字
//		18中心点X
//		19中心点Y
//获取结束
var page_now = 1,typenow,citycode,cityName,centerkeyword,keyword,searchType,number = 10,batch=1,range=3000,mapIntitedCheck,mapInfo={},poix,poiy,poiname;

urlinfo = location.href;
urlinfo = decodeURI(urlinfo);
try{
	urlinfo=urlinfo.split("?");
	urlinfo=urlinfo[1].split(",");
}catch(e){}

mapInfo['url']={};
for(var i=0;i<20;i++){
	mapInfo['url']['u'+i] = checkurl(urlinfo[i]);
}
var mapProperty = mapInfo['url'];

if (this_url.indexOf("?") != -1){
	searchtype = mapProperty.u0;
	cityName = mapProperty.u1;
	citycode = city.ctn2c(cityName);
	centerkeyword = mapProperty.u17;
	keyword = mapProperty.u3;
	poix = mapProperty.u4;
	poiy = mapProperty.u5;
	poiname = mapProperty.u6;
	if(searchtype == "a" && citycode != "" && keyword != "" && centerkeyword != ""){
		search_around(cityName,keyword,centerkeyword);
		$('around_center').className="input4 Icolor";
		$('around_keyword').className="input2 Icolor";
		$('around_center').value = centerkeyword;
		$('around_keyword').value = keyword;
		sw_searchbox($("around_tab"));
		setCurrentCity(cityName);
	}else if(searchtype == "l" && citycode != "" && keyword != ""){
		search_index(cityName,keyword);
		$('local_keyword').className="input2 Icolor";
		$('local_keyword').value = keyword;
		if(cityName=="total"){setCurrentCity("全国");}else{setCurrentCity(cityName);}
	}else if(searchtype == "map" && cityName != ""){
		setCurrentCity(cityName);
		setZoom("");
		ct_zone();
		if (cityName=="全国"){setZoom(5)};
		hide_left();
		$('geturl').innerHTML = "<a href=\"getURL.html?localsearch.shtml?map,"+cityName+"\" class=\"black\" target=\"_blank\">获取本页链接</a>";
	}else if(searchtype == "traffic" && cityName != ""){
		setCurrentCity(cityName);
		ct_zone();
		bj_ssjt(cityName);
		hide_left();
		$('geturl').innerHTML = "<a href=\"getURL.html?localsearch.shtml?traffic,"+cityName+"\" class=\"black\" target=\"_blank\">获取本页链接</a>";
	}else if(searchtype == "xy" && citycode != "" && keyword != "" && poix != "" && poiy != ""){
		search_xy(cityName,poix,poiy,keyword);
		$('around_center').className="input4 Icolor";
		$('around_keyword').className="input2 Icolor";
		$('around_center').value = poiname;
		$('around_keyword').value = keyword;
		sw_searchbox($("around_tab"));
		setCurrentCity(cityName);
	}else{
		ct_zone();//加载默认提示项
	}

}else{
		ct_zone();//加载默认提示项
}

function changerange(){
	var ar = arguments[0];
	if (typeof ar != "undefined"){
		range = ar;
	}else{
		range = parseInt($('range').value);
	}
		if(typenow == "xy"){
			search_xy(cityName,poix,poiy,keyword);
		}else{
			search_around(cityName,keyword,centerkeyword);
		}
}

function left_search_around(){
	var cityname = $("around_cityname").value;
	keyword = $("point_key").value;
	centerkeyword = poiname;
	center_x = poix;
	center_y = poiy;
	$("around_keyword").value = keyword;
	//searchType = $F("searchType");
	//batch = $F("batch");
	if(cityname == ""){
		//alert("请填写城市，此处不能为空!");
		return;
	}
	if(keyword == ""||keyword == "输入关键字：银行，加油站…"){
		//alert("请填写查询关键子，此处不能为空!");
		return;
	}
	if(centerkeyword == ""){
		//alert("请填写中心点关键子，此处不能为空!");
		return;
	}
	citycode = city.ctn2c(cityname);
	if(citycode == null){return false;}
	var keyQ=keyword.substring(0,4);
	var keyW=keyword.indexOf("锦江之星");
	if(keyQ=="锦江之星" || keyW>0){
		location.href="http://channel.mapabc.com/jinjiang/localsearch.shtml?xy,"+cityname+",,"+keyword+","+center_x+","+center_y+","+centerkeyword+",5000";
	}else{
		search_xy(cityname,center_x,center_y,keyword);
	}
}
//关键字查询代码开始

/*
	Format: typenow,citycode,keyword,centerkeyword,centerX,centerY

*/
function base_search(typenow,c,k,ck,cenX,cenY){
	if (typeof MLocalSearch == "undefined"){
		$('loading').style.display = "none";
		$('result').innerHTML = ("数据查询服务连接异常，请<a href=\"javascript:void(0);\" onclick=\"location.reload();\">刷新</a>页面后重试!");
		return;
	}
	cityName = c;
	cityArray = city.ctall(c);
	/*sis = new MSISSearch();
	sp = new MSearchPointPara();
	sis.setSISCallbackFunction(keywordCallBack); 
	sp.setCitycode(cityArray[1]);
	//sp.setCitycode(c);
	sp.setKeyword(k);
	sp.setNumber(number);
	sp.setPageSum(number);
	sp.setBatch(batch);
	sp.setSearchType(searchType);*/
	sis =new MLocalSearch();   
	sp= new MLocalSearchOptions();   
	sis.setCallbackFunction(keywordCallBack); 
	sp.pageNum=batch;
	//mlsp.recordsPerPage=number;
	cenYtemp = cenY ;
	cenXtemp = cenX ;
	cktemp = ck ;
	keytemp = k ;
	ctemp = c ;
	if(ctemp=="连云港" || ctemp=="南通" ){ctemp=ctemp+"市";}

	switch (typenow){
	case "index":
		sis.poiSearchByKeywords(keytemp,ctemp,sp);  
		break;
	case "around":
		sp.range = range;
		sis.poiSearchByCenterKeywords(ck,k,c,sp);
		break;
	case "xy":
		sp.range = range;
		sis.poiSearchByCenterXY(new MLngLat(cenXtemp,cenYtemp),k,c,sp);
		break;
	default:
		return;
	}
}

function search_index(c,k){//本地搜索
	if(c=="全国"){c="total";}
	var cityArray = new Array();
	cityArray = city.ctall(c);
	$('result_info').style.display="block";
	$('result_info').innerHTML = "在&nbsp;<b>" + cityArray[0] + "</b>&nbsp;搜索&nbsp;<b>" + (k.length>15?(k.substring(0,15)+"..."):k) + "</b>";
	$('print').innerHTML="<a href=\"http://"+ location.host+"/print.html?"+cityArray[0]+","+k+",10,"+page_now+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";
	page_now = 1;
	$('loading').style.display = "";
	keyword = k;
	$('local_keyword').value = keyword;
	typenow = "index";
	var u = "localsearch.shtml?l,"+cityName+",,"+k;
	$('geturl').innerHTML = "<a href=\"getURL.html?"+u+"\" class=\"black\" target=\"_blank\">获取本页链接</a>";
	base_search("index",c,k,'','','');
}

function search_around(c,k,ck){//关键字周边搜索
	var cityArray = new Array();
	cityArray = city.ctall(c);
	$('result_info').style.display="block";
	$('result_info').innerHTML = "在&nbsp;<b>" + ck + "</b>&nbsp;附近搜索&nbsp;<b>" + (k.length>12?(k.substring(0,12)+"..."):k) + "</b><span class='area'>范围&nbsp;<select id=\"range\"  onchange='changerange();' style='display:inline;vertical-align:middle'><option value=1000>1公里</option><option value=3000>3公里</option><option value=5000>5公里</option></select></span>";
	$('range').value = range;
	$('print').innerHTML="<a href=\"http://"+ location.host+"/print_a.html?"+cityName+","+k+",10,"+page_now+","+ck+","+range+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";
	centerkeyword = ck;
	keyword = k;
	$('around_center').value = centerkeyword;
	$('around_keyword').value = keyword;
	page_now = 1;
	$('loading').style.display = "";
	typenow = "around";
	var u = "localsearch.shtml?a,"+cityName+",,"+k+",,,,,,,,,,,,,,"+ck;
	$('geturl').innerHTML = "<a href=\"getURL.html?"+u+"\" class=\"black\" target=\"_blank\">获取本页链接</a>";
	base_search("around",c,k,ck,'','')
}
var tmpname = "";
function search_xy(c,cenX,cenY,k){//中心点周边搜索
	var cityArray = new Array();
	cityArray = city.ctall(c);
	$('result_info').style.display="block";
	tmpname= poiname;
	$('result_info').innerHTML = "在&nbsp;<b>" + poiname + "</b>&nbsp;附近搜索&nbsp;<b>" + (k.length>12?(k.substring(0,12)+"..."):k) + "</b><span class='area' >范围&nbsp;<select id=\"range\"  onchange='changerange();' style='display:inline;vertical-align:middle'><option value=1000>1公里</option><option value=3000>3公里</option><option value=5000>5公里</option></select></span>";
	$('range').value = range;
	$('print').innerHTML="<a href=\"http://"+ location.host+"/print_xy.html?"+cityName+","+k+","+poix+","+poiy+",10,"+page_now+","+$('around_center').value+","+range+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";
	poix = cenX;
 	poiy = cenY;
	keyword = k;
	centerkeyword = poiname;
	page_now = 1;
	$('loading').style.display = "";
	typenow = "xy";
	var u = "localsearch.shtml?xy,"+cityName+",,"+k+","+cenX+","+cenY+","+poiname;
	$('geturl').innerHTML = "<a href=\"getURL.html?"+u+"\" class=\"black\" target=\"_blank\">获取本页链接</a>";
	base_search("xy",c,k,'',cenX,cenY)
}

function keywordCallBack(data){
	hide_left(1);
	//show_loading(1);
	var points = "";
	var rs = data;
	//rs.message
switch(rs.message){
	case 'ok':
	var allcount = rs.count;
	var html = "",href_from_here = "",herf_to_here = "",href_detail = "";
	//var pguid = new MPoiHtmlUtil();

	mapInfo['url1']={};
	for(var i=0;i<20;i++){
		mapInfo['url1']['u'+i] = "NAN";
	}
	mapProperty = mapInfo['url1'];

//拼音纠错开始
	var search_ls_pinyin = "";
	/*var arr = sis.getLocalSearchByPinyin(rs);
	if(arr.length=="0"){
		search_ls_pinyin="";
	}else{
		var suggest="";
		for (var i = 0; i < arr.length; i++) {
			var pinyin = arr[i];
			suggest += "<a href=\"javascript:void(0);\" onclick=\"" + (typenow == "index"?"search_index('" + citycode + "','" + pinyin + "')":"search_around('" + citycode + "','" + pinyin + "','" + $('around_center').value + "')") + "\" style=\"text-decoration:underline;font-weight:bold;color:#2155bc;\">"+pinyin+"</a>&nbsp;&nbsp;";
		}
		search_ls_pinyin = "<span style=\"text-indent:10px;\">您要找的是不是：" + suggest + "</span>";
	}*/
//拼音纠错结束

	if (allcount == 0){
		no_result();
		var no_result_html = search_ls_pinyin + "<div class=\"default\"><div class=\"default_title\">未查找到任何结果!</div><div class=\"d_link\"><div class=\"d_right\"></div><div class=\"suggest\"><strong>建议：</strong><br />1.请确保所有字词拼写正确。<br />2.尝试不同的关键字。<br />3.尝试更宽泛的关键字。</div></div><div class=\"bold\">您可以尝试以下链接：<span class=\"inner\"><a href='localsearch.shtml?a,北京,,车站,,,,,,,,,,,,,,西单'>在 北京 西单 附近找 车站</a><br /></span><span class=\"inner\"><a href='localsearch.shtml?a,北京,,银行,,,,,,,,,,,,,,北三环'>在 北京 北三环 附近找 银行</a></div></span><div class=\"new_msg \"><a href=\"javascript:void(0);\" onclick=\"CorrectBox('1','','','','','"+cityName+"','','','')\">提交新的位置点</a></div></div>";
		$("result").innerHTML = no_result_html;
	}else{
			removeAllOverlays();
			var pointStyle = new Array();
			var customPoint = new Array();
			var sContent = "";
			var centerPoint;
			var s_time = (rs.searchtime=="0"?"0.001":rs.searchtime/1000);
			var s_total = rs.total;
			var centX,centY;
				var markerOptions ;   
				var pointsearch;   
				var overarr= new Array();   
			//$("result_info").innerHTML = "共" + s_total + "条结果 耗时" + s_time + "秒";

			if((typenow == "xy"||typenow == "around") && 'undefined' != typeof mapObj){//仅加点操作
				//XY周边查询中心点tip
				/*var centerPointStyle = new MStyle();
				centerPointStyle.lineColor = 0xff230b;
				centerPointStyle.lineSize = 2;
				centerPointStyle.fillColor = 0xffffff;
				centerPointStyle.fillOpacity = 100;
				centerPointStyle.labelColor = 0xffffff;

				centerPointStyle.labels = "中心点";
				centerPointStyle.isShowLabels = true;
				centerPointStyle.isShowTip = false;
				centerPointStyle.textSize = 13;
				centerPointStyle.isLabelsFontBold = true;
				centerPointStyle.backgroundColor = 0xff230b;
				centerPointStyle.isLabelsBackground = true;
				centerPointStyle.textColor = 0xffffff;
					if(rs.cenpoi){
						//关键字周边查询中心点tip
						var cpoi = rs.cenpoi;
						sContent = "<font color='#000000'><b>中心点 "+ cpoi.name + "</b><br>";
						//sContent += "地址：" + (cpoi.address?cpoi.address:"暂无") + "<br>";
						//sContent += "电话：" + (cpoi.tel?cpoi.tel:"暂无") + " <br>";
						centX = cpoi.x;
						centY = cpoi.y;
					}else{
						sContent = "<font color='#000000'>" + poiname + "</font><br>";
						centX = poix;
						centY = poiy;
					}
				centerPointStyle.textContent = sContent;
				centerPoint = new MCustomPointOverlay(new MLatLng(centY, centX), "http://" + location.host + "/images/center.swf", centerPointStyle, "1000");
				//mapObj.drawCustomPoints(centerPoint, true);
					addOverlay(centerPoint);*/

					
					if(rs.cenpoi){
						//关键字周边查询中心点tip
						var cpoi = rs.cenpoi;
						sContent = "<font color='#000000'><b>中心点 "+ cpoi.name + "</b><br>";
						centX = cpoi.x;
						centY = cpoi.y;
					}else{
						sContent = "<font color='#000000'>" + poiname + "</font><br>";
						centX = poix;
						centY = poiy;
					}
					var markerOption = new MMarkerOptions();      
					var labelOptions=new MLabelOptions();   
					var fontstyle = new MFontStyle();  //定义字体风格对象   
					fontstyle.name ="Arial";   
					fontstyle.size = 13;   
					fontstyle.color = 0xffffff;   
					fontstyle.bold = true;   
					labelOptions.fontStyle=fontstyle;   
					labelOptions.borderColor =0x000000  ; 
					labelOptions.content="中心点";   
					labelOptions.hasBorder =true;   
					labelOptions.hasBackground =true;   
					labelOptions.backgroundColor =0xff230b;   
					markerOption.labelOption=labelOptions;   

					//markerOption.imageAlign=6;       
					markerOption.canShowTip= true;   
					markerOption.imageUrl ="http://" + location.host + "/images/center.swf";   
					markerOption.labelPosition= new MPoint(5,0);
					var tipOption = new MTipOptions();
					tipOption.borderStyle.color= 0xEA2907; 
					tipOption.titleFillStyle.color=0xEA2907;   
					tipOption.title=sContent ;
					markerOption.tipOption = tipOption;
					var ll = new MLngLat(centX,centY);      
					var Mmarker = new MMarker(ll,markerOption);      
					//Mmarker.id="point3";      
					mapObj.addOverlay(Mmarker,true) ; 
			}


			var address_link,tel_link,ars,pname,pid,data_citycode,cityname,x,y,type,address,tel,href_detail,poi_url,poi_img;
			for (var i = 0; i < rs.poilist.length; i++) {
				
				ars = rs.poilist[i];
				pname = ars.name;
				pid = ars.pguid;
				data_citycode = Trim(ars.citycode);
				cityname = city.ctc2n(data_citycode);
				x = ars.x;
				y = ars.y;
				type = ars.type;
				/////////////////
				mapabc_poiids = pid+","+mapabc_poiids;
				/////////////////
				if (type == "" || type == "undefined" || type == null || type == " undefined"){type = "暂无";}
				address = (!ars.address?"":ars.address);
				tel = (!ars.tel?"":ars.tel);

				address_link = (address==""?"<a href=\"javascript:CorrectBox(1,'" + ars.pguid + "','" + ars.name + "','" + address + "','" + tel + "','" + cityname + "','" + x + "','" + y + "','"+type+"');\" class=\"tipContent\">提交信息</a>":address);
				tel_link = (tel==""?"<a href=\"javascript:CorrectBox(1,'" + pid + "','" + ars.name + "','" + address + "','" + tel + "','" + cityname + "','" + x + "','" + y + "','"+type+"');\" class=\"tipContent\">提交信息</a>":tel);

				//href_detail = pguid.getPoiStaticPath(data_citycode,pid);//获取详细页地址
				href_detail = "detail/"+ars.citycode+"/"+pid+".html";//新详细页地址
				//判断是否为基础数据还是编辑器数据
				poi_url = "";
				poi_img = "";
				if(ars.srctype=="enpoi"){
					poi_url = ars.dn;
					poi_img = "<img src=\"/images/enpoi.gif\">";
				}else{
					poi_url = "http://www.mapabc.com/" + href_detail;
				}

				href_from_here = "search.shtml?b_e," + cityname + "," + cityname + "," + pname + "," + mapProperty.u4 + "," + x + "," + mapProperty.u7 + "," + y + "," + mapProperty.u8 + "," + (address==""?"暂无":address) + "," + mapProperty.u10 + "," + (tel==""?"暂无":tel) + "," + mapProperty.u12 + "," + type + "," + mapProperty.u14 + "," +pid+ "," + mapProperty.u16 + "," + poi_url + "," + mapProperty.u18 + "," + mapProperty.u19;
				href_to_here = "search.shtml?b_s," + cityname + "," + cityname + "," + mapProperty.u3 + "," + ars.name + "," + mapProperty.u5 + "," + x + "," + mapProperty.u6 + "," + y + "," + mapProperty.u10 + "," + (address==""?"暂无":address) + "," + mapProperty.u12 + "," + (tel==""?"暂无":tel) + "," + mapProperty.u13 + "," + type + "," + mapProperty.u15 + "," + pid + "," + mapProperty.u17 + "," + poi_url + "," + mapProperty.u19;

				//sContent = "<font color='#000000'><b>" + (i+1) + ". "+ pname + "</b><br>";
				sContent = "<font color='#000000'>地址：" + address_link + "<br>";
				sContent += "电话：" + tel_link + " <br>";
				sContent += "<a href=\"javascript:around_search('" + pname + "','" + x + "','" + y + "','" + (i+1) + "');\" class=\"tipContent\">周边搜索</a>　<a href=\"javascript:jumpurl('" + href_from_here + "');\" class=\"tipContent\">从这里出发</a>　<a href=\"javascript:jumpurl('" + href_to_here + "');\" class=\"tipContent\">到这里去</a>　<a href=\"javascript:CorrectBox(1,'" + pid + "','" + pname + "','" + address + "','" + tel + "','" + cityname + "','" + x + "','" + y + "','"+type+"');\" class=\"tipContent\">纠错</a>　<a href=\"javascript:zoom('"+y+"','"+x+"')\" class=\"tipContent\">定位放大</a></font>";
				//drawCustomPointImg(sContent,x,y,"http://www.mapabc.com/images/1.gif",i)
			if('undefined' != typeof mapObj){
				/*pointStyle[i] = new MStyle();
				pointStyle[i].lineColor = 0xff230b;
				pointStyle[i].lineSize = 2;
				pointStyle[i].fillColor = 0xffffff;
				pointStyle[i].fillOpacity = 100;
				pointStyle[i].labelColor = 0x000000;
				//pointStyle.showTip = false;
				pointStyle[i].textContent = sContent;

				if(ars.match=="10"){
					customPoint[i] = new MCustomPointOverlay(new MXY(x,y), "http://" + location.host + "/images/num/" + (i+1) + "_10.gif?070701", pointStyle[i], (i+1));
				}else{
					customPoint[i] = new MCustomPointOverlay(new MXY(x,y), "http://" + location.host + "/images/num/" + (i+1) + ".gif?070701", pointStyle[i], (i+1));
				}*/
				markerOptions = new MMarkerOptions();   
				markerOptions.isDraggable=false;//是否可以拖动 
				markerOptions.picAgent=false;
				if(ars.match=="10")
					markerOptions.imageUrl ="http://" + location.host + "/images/num/" + (i+1) + "_10.gif?070701";   
				else
					markerOptions.imageUrl ="http://" + location.host + "/images/num/" + (i+1) + ".gif?070701";  

				var tipOption = new MTipOptions();  
				tipOption.borderStyle. color= 0xEA2907; 
				tipOption.titleFillStyle.color=0xEA2907;
				tipOption.title="<font color='#ffffff'><b>" + (i+1) + ". "+ pname + "</b>" ;
				tipOption.content=sContent;
				tipOption.tipType=DIVTIP;
				markerOptions.tipOption = tipOption;
				var ll=new MLngLat(ars.x,ars.y);   
				pointsearch =  new MMarker(ll,markerOptions);   
				pointsearch.id=(i+1);   
				overarr.push(pointsearch);   
				mapObj.addEventListener(pointsearch,MOUSE_CLICK,active_div);
			}
			var temp_img = "";
			if(ars.match=="10"){
				temp_img = "<img src=\"/images/num/" + (i+1) + "_10.gif?070701\" title=\"精确位置\"/>";
			}else{
				temp_img = "<img src=\"/images/num/" + (i+1) + ".gif?070701\" title=\"估计位置\"/>";
			}
				//加点操作结束

				html += "<div onclick=\"mapObj.setCenter(new MLngLat('"+ x +"','"+ y +"'));mapObj.openOverlayTip('"+(i+1)+"')\"\"><table id=\"div" + (i+1) + "\" class=\"Lsearch\"cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" onmouseover=\"this.style.backgroundColor='#eeeeee'\" onmouseout=\"this.style.backgroundColor='#ffffff'\"><tr><td colspan=4 height=6></td></tr><tr><td width=\"34\" height=27 align=\"center\">"+temp_img+"</td><td width=304><h5>" + pname + "&nbsp;" + poi_img + "</h5></td><td width=\"86\" align=\"center\" ><a href=\"" + poi_url + "\" target=\"_blank\">详细&raquo;</a></td><td width=20></td></tr><tr><td></td><td colspan=\"2\" class=\"gray2\">地址："+ address_link +"<br />电话："+ tel_link +"</td><td width=20></td></tr><tr><td></td><td colspan=2><a href=\"javascript:void(0);\" onclick=\"around_search('" + pname + "','" + x + "','" + y + "','" + (i+1) + "');\">周边搜索</a>&nbsp;&nbsp;&nbsp;<a href=\"" + href_from_here + "\">从这里出发</a> 或 <a href=\"" + href_to_here + "\">到这里去</a>&nbsp;&nbsp;&nbsp;<a href=\"javascript:CorrectBox(1,'" + ars.pguid + "','" + pname + "','" + address + "','" + tel + "','"+cityname+"','" + x + "','" + y + "','" + type + "','"+ars.match+"')\">纠错</a></td><td></td></tr><tr><td colspan=4 height=9></td></tr></table></div>";
		}
		mapObj.addOverlays(overarr,true);

		html += "<div class=\"info\">没有您要找的?<a href=\"javascript:void(0)\" onclick=\"CorrectBox('1','','','','','"+cityname+"','','','')\">提交信息</a><br />　　<img src=\"/images/num/0_10.gif?070701\" title=\"精确位置\"/>&nbsp;精确位置　　<img src=\"/images/num/0.gif?070701\" title=\"估计位置\"/>&nbsp;估计位置</div><div style='float:left;display:inline;margin-left:18px;'><iframe src='/ss.html' scrolling=0 frameborder=0 width=376 height=310></iframe></div>";
		$('around_div').style.display = "none";
		$('result').style.display = "block";
		$('page').style.display = "block";
		$('result').innerHTML=   "&nbsp;&nbsp;共" + s_total + "条结果 耗时" + s_time + "秒<div class='brand'><a id='brand'></a></div>" + html;
		page_allnum = Math.floor((allcount + number-1) / number);//页数
		ShowoPage("上一页","下一页","<font color='red'>","</font>","[<font color='red'>","</font>]",allcount,number,4,page_now,"page");
		brand_inf(keyword);//加载品牌
		GetJF();
	}
	//show_loading(0);
	$('loading').style.display = "none";
	break;
	case 'error':
		no_result();
		var no_result_html = "<div class=\"default\"><div class=\"default_title\">网络忙！请重新尝试！</div><div class=\"d_link\"><div class=\"d_right\"></div><div class=\"suggest\"><strong>建议：</strong><br />如果您刷新页后仍无法显示结果，请过几分钟后再次尝试或者与我们的服务人员联系。<br />Email：service@mapabc.com <br />电话：400 810 0080</div></div></span>错误信息："+rs.message+"</div>";
		$("result").innerHTML = no_result_html;
		$('loading').style.display = "none";
	break;
	default:
       no_result();
		var no_result_html = "<div class=\"default\"><div class=\"default_title\">对不起！网络繁忙！请稍后重新尝试！</div><div class=\"d_link\"><div class=\"d_right\"></div><div class=\"suggest\"><strong>建议：</strong><br />如果您刷新页后仍无法显示结果，请过几分钟后再次尝试或者与我们的服务人员联系。<br />Email：service@mapabc.com <br />电话：400 810 0080</div></div></span>错误信息："+rs.message+"</div>";
		$("result").innerHTML = no_result_html;
		$('loading').style.display = "none";
}
}

function pageNum(num){//分页
	$('loading').style.display = "";
	$('result').innerHTML = "";
	page_now = num;
	//sp.setBatch(num);
	//sp.setPageSum(num);
	sp.pageNum=num;
	sis.setCallbackFunction(keywordCallBack); 
	switch (typenow){
		case "index":
			$('print').innerHTML="　<a href=\"http://"+ location.host+"/print.html?"+cityName+","+keyword+",10,"+num+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";	
			sis.poiSearchByKeywords(keytemp,ctemp,sp);  
		break;
		case "around":
			$('print').innerHTML="　<a href=\"http://"+ location.host+"/print_a.html?"+cityName+","+keyword+",10,"+num+","+centerkeyword+","+range+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";
			sp.range = range;
			sis.poiSearchByCenterKeywords(cktemp,keytemp,ctemp,sp);
		break;
		case "xy":
			$('print').innerHTML="　<a href=\"http://"+ location.host+"/print_xy.html?"+cityName+","+keyword+","+poix+","+poiy+",10,"+page_now+","+centerkeyword+","+range+"\" target=\"_blank\" style=\"color:#FF0000;font-weight:bold;\">打印</a>";
			sp.range = range;
			sis.poiSearchByCenterXY(new MLngLat(cenXtemp,cenYtemp),keytemp,ctemp,sp);
		break;
		default:;
	}
}

function nextPageNum(){
		if(page_now < page_allnum){
				pageNum(page_now+1);
		}
}

function lastPageNum(){
	if(page_now > 0){
			pageNum(page_now-1);
	}
}

function addpoint_key(point_name){
	$('point_key').value = point_name;
}
function GetJF(){
	if(User!=""){
		var jf={};jf['i'] = User;jf['j'] = '1';jf['b'] = 'a';jf['f'] = '1';
		jf_ad(jf);
	}
}