var map_engine=document.map_engine_frame;
var G_MAP_OBJ = map_engine;
var dm=null;
var g_dm=null;
var start_finish,end_finish;
var hpListDisplay=false;
var G_ABORT=false;
/**
 * 页面流程的控制中枢,所有从页面地址进来的参数，都由他来负责处理并转发
 */
function PageControlObject () {
	//当前页面做何种操作 1地图搜索2公交3行车
	this.type=1;
	//
	this.pc=map_engine_frame.create_UPointContainer(map_engine_frame.mymap);  
//	this.init();
	this.instance=null;
	//是否进行过定位搜索
	this.hasLocated = false;
	//是否进行操作
	this.DONOTOPERATE=false;
	//记录公有变量
	this.startObject=null;
	this.endObject=null;
	this.centerObject=null;
	this.synchronize=false;
	this.syncArray=new Array();
	//搜索展示的类型
	this.searchDisplay=0;
	//记录点的数组
	this.plc=new Array(); 
	//记录公交和行车是否已经确认起点终点
	this.readyRoute=0;
	//为了方便打印，而记录的线路参数
	this.driveRouteType="T";
	this.sPointIndex=-1;
	this.ePointIndex=-1;
	this.ref_url = "";	
	this.ref_query = "";
	//当前页面的展现方式 0是大地图模式,1是3/7开,2是6/4开,默认是3/7开
	this.displayMode = 1;
	//经整理的keyword
	this.keyword;
		
}
PageControlObject.prototype.getNewPlc = function (){
	this.plc=new Array();
	return this.plc;
}
PageControlObject.prototype.init = function (type){

	if (type == null){
		if (cityCode==100000){
			this.switchTab(0);
		}else{
			this.switchTab(1);
		}
	}else{
		if (cityCode==100000){
			this.switchTab(0);
		}else{
			this.switchTab(type);
		}		
		
	}
//	this.parseUrl();
//	this.initInstance(this.type);
//	this.deSerializeUrl();
}
/**
 * 点选 type 0 中心点，1 起点，2 终点
 */
PageControlObject.prototype.click_a_point = function (type){
	try{
		if (type==1){
			if (dm.sPointIndex>-1)
				this.pc.click_a_point(dm.sPointIndex);
		}else if (type==2){
			if (dm.ePointIndex>-1)
				this.pc.click_a_point(dm.ePointIndex);
		}
	}catch(e){
		
	}
}
/**
 * 切换左侧内容
 */
PageControlObject.prototype.switchTab = function (type){
	var action=null;
	this.type=type;
	if (document.all){
			 action=event;
	}else{
			 action=window.event;
	}	
	var this_instance = this;		
	
	try{
		this.clearLines();
		this.clearSearchResult();
	}catch(e){
		
	}
	
	//一些公共变量的初始化
 	//启动移动时搜索状态条
 	$('hot_navi').style.display='';
 	//关闭移动时搜索状态条
 	//$('hot_navi').style.display='none';
 	
 	$('stop_hot_navi').style.display='none';
	$('start_hot_navi').style.display='none';
	for (var i=1;i<=4;i++){
		if (i==type){
			$('hot_'+i+'_tip').style.display="";
		}else{
			$('hot_'+i+'_tip').style.display="none";
		}
	}
	
	this.ref_url="?cityCode="+cityCode+"&tab="+type;	
	if (type==1){
		$import('com.uumap.application.maps.search.*');
		try{
			//this.loadPage();
			TabAlt('hd',1,true);
			
		}catch(e){}
		saveFastLocation();
		if(cityCode == "100000"){
			G_MAP_OBJ.mymap.onmouseup_addon=function (){};
		}
		this.initInstance(this.type);
		httpLoad("/maps/search_seg.jsp?cc="+cityCode+"&cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);getNavigator(action);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};sm.outputPool=$('listtable');sm.clickToChooseStartFlag=true;changeLeftHeight();$('try_tips').innerHTML=(G_SEARCHCENTERTIP);showFastLocation();},action);
		this.parseUrl();
		//this.initInstance(this.type);
		this.deSerializeUrl();		
		//更新url
		
//		//将地图移动到默认中心点//		if (uumap_cjw != null){
//			var cjw=uumap_cjw.split(",");
//			//alert(cjw.toString());
//			map_engine_frame.mymap.move_to_center(Number(cjw[0]),Number(cjw[1]));
//		}
		
		sm.nextPage_addon = function (flag){
			if (flag){
				$('img_nextpage').style.display="none";				
			}else{
				$('img_nextpage').style.display="";
				$('img_prevpage').style.display="";
			}
		}
		sm.prevPage_addon = function (flag){
			if (flag){
				$('img_prevpage').style.display="none";
				
			}else{
				$('img_prevpage').style.display="";
				$('img_nextpage').style.display="";
			}
		}
		
	}else if (type==2){
		$import('com.uumap.application.maps.bus.*');
		try{
			sm.clearSearchResult();
			//关闭移动时搜索
			//this.disableSearchWhenMove();
		}catch(e){
			$import('com.uumap.application.maps.search.*');
			this.initInstance(this.type);
		}
		saveFastLocation();
		if(cityCode == "100000"){
			G_MAP_OBJ.mymap.onmouseup_addon=function (){};
		}

		
		
		TabAlt('hd',2,true);

		dm = new DriveManager();
		g_dm=dm;
		
		g_dm.setStart_addon=function (){
			$('start_point_ok').style.display='';
			$('start_point_modify').style.display='';
			start_finish=true;
			//$('sn_input_start_'+type).value="自定义起点";
			
		}	
		g_dm.setEnd_addon=function (){
			$('end_point_ok').style.display='';
			$('end_point_modify').style.display='';
			end_finish=true;
			//$('sn_input_end_'+type).value="自定义终点";			
		}			
		//dm.clickToChooseStartFlag=false;
		dm.init();
		httpLoad("/maps/bus_seg.jsp?"+"cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};changeLeftHeight(0.5);$('try_tips'+this_instance.type).innerHTML=(G_BUSTRANSTIP);},action);
		
	}else if (type==3){
		$import('com.uumap.application.maps.drive.*');
		try{
			sm.clearSearchResult();
		}catch(e){
			$import('com.uumap.application.maps.search.*');
			this.initInstance(this.type);
		}
		saveFastLocation();
		TabAlt('hd',3,true);

		dm = new DriveManager();
		g_dm=dm;
		g_dm.setStart_addon=function (){
			$('start_point_ok').style.display='';
			$('start_point_modify').style.display='';
			start_finish=true;
			//$('sn_input_start_'+type).value="自定义起点";
			
		}	
		g_dm.setEnd_addon=function (){
			$('end_point_ok').style.display='';
			$('end_point_modify').style.display='';
			end_finish=true;	
			//$('sn_input_end_'+type).value="自定义终点";				
		}		
		//dm.clickToChooseStartFlag=false;	
		dm.init();		
		httpLoad("/maps/drive_seg.jsp?cc="+cityCode+"&cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};changeLeftHeight(0.5);$('try_tips'+this_instance.type).innerHTML=(G_DRROUTETIP);},action);
	}else if (type==4){
		$import('com.uumap.application.maps.search.*');
		try{
			//this.loadPage();
			TabAlt('hd',4,true);

		}catch(e){}
		saveFastLocation();
		if(cityCode == "100000"){
			G_MAP_OBJ.mymap.onmouseup_addon=function (){};
		}
		this.initInstance(this.type);
		
		sm.setStart_addon=function (){
			$('start_point_ok').style.display='';
			$('start_point_modify').style.display='';
			start_finish=true;
			//$('sn_input_start_'+type).value="自定义起点";
			
		}		
		//alert("in switch tab "+this.type);
		httpLoad("/maps/csearch_seg.jsp?cc="+cityCode+"&cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);getNavigator(action);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};sm.outputPool=$('listtable');sm.clickToChooseStartFlag=true;changeLeftHeight();$('try_tips').innerHTML=(G_SEARCHCENTERTIP);},action);
		//alert("in switch tab "+this.type);
		//this.parseUrl();
		//this.initInstance(this.type);
		//this.deSerializeUrl();			
		//alert("in switch tab "+this.type);
//		//将地图移动到默认中心点
//		if (uumap_cjw != null){
//			var cjw=uumap_cjw.split(",");
//			//alert(cjw.toString());
//			map_engine_frame.mymap.move_to_center(Number(cjw[0]),Number(cjw[1]));
//		}
		
		
		
		
	}else if (type==0){
		$import('com.uumap.application.maps.city.*');
		if(cityCode == "100000"){
			G_MAP_OBJ.mymap.onmouseup_addon=function (){};
		}
		saveFastLocation();
		//全国首页
//		httpLoad("/maps/qg_city_zw.jsp?cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};changeLeftHeight(0.5);},action);
		httpLoad("/maps/qg_city_337.jsp?cn="+URLEncode(g_CITYNAME),function (xmlhttp){$('leftBlock').innerHTML=(xmlhttp.responseText);this_instance.loadPage_addon();this_instance.loadPage_addon=function (){};changeLeftHeight(0.5);},action);
		
	}
}
/**
 * 切换显示数量
 */
PageControlObject.prototype.resetPageLen = function (len){
	for (var i=2;i<=4;i++){		
		if (i*5==len){
			$('pi_set'+i*5).setAttribute("class","lq_3c");
			$('pi_set'+i*5).setAttribute("className","lq_3c");	
		}else{
			$('pi_set'+i*5).setAttribute("class","lq_3");
			$('pi_set'+i*5).setAttribute("className","lq_3");				
		}
	}
	//清空数据
	this.clearSearchResult();
	this.clearLines();
	sm.resetPageLen(len);
}

PageControlObject.prototype.parseUrl = function (){
	var url=window.location.href;
	this.url=url;
	var reg=/^.*t=(\d*).*$/;
	if (reg.test(url)){
		this.type=parseInt(RegExp.$1);
	}else{
		this.type=1;
	}
	//alert(this.type);
	//var type=url.
}
PageControlObject.prototype.initInstance = function (type){
	switch(type){
		case 4:
			sm=new SearchManager();
			sm.outputPool=$('listtable');
			var this_instance=this;
			sm.setStart_addon=function (){
				this_instance.hasLocated=true;
				this.DONOTOPERATE=false;
			}
			sm.initDblClick();
			//sm.initMouseClick();
			this.instance=sm;
			break;		
		default:
		//如果没有type,默认转到地图搜索功能模块
		    sm=new SearchManager();
		    sm.outputPool=$('listtable');
		    sm.clickToChooseStartFlag=false;
		    sm.removeDblClick();
		    this.instance=sm;
		    
		break;
		
	}
}
PageControlObject.prototype.deSerializeUrl = function (){
//	$('pi_set10').setAttribute("class","lq_3");
//	$('pi_set10').setAttribute("className","lq_3");
//	$('pi_set15').setAttribute("class","lq_3");
//	$('pi_set15').setAttribute("className","lq_3");
//	$('pi_set20').setAttribute("class","lq_3");
//	$('pi_set20').setAttribute("className","lq_3");
//	$('list').style.display='';
//	//alert('d');
//	$('loadingbar').style.display='';
//	$('listtable').style.display='none';
	this.instance.afterGetResult_addon=function (){
		$('loadingbar').style.display='none';
		$('list').style.display='';
		$('listtable').style.display='';
		//alert($('listtable').innerHTML);
		$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
	    if (sm.totalCount>10){
	    	$('pi_set10').setAttribute("class","lq_3b");
	    	$('pi_set10').setAttribute("className","lq_3b");
	    }
	    if (sm.totalCount>25){
	    	$('pi_set15').setAttribute("class","lq_3b");
	    	$('pi_set15').setAttribute("className","lq_3b");
	    }
	    if (sm.totalCount>40){
	    	$('pi_set20').setAttribute("class","lq_3b");
	    	$('pi_set20').setAttribute("className","lq_3b");
	    }	   
	    FastLocation(); 
	}	
	this.onNoResult_addon=function (){
		FastLocation(); 
	}
	//sm.outputPool=$('listtable');
	this.instance.deSerializeUrl(this.url);
}

/**
 * 验证输入
 */
PageControlObject.prototype.validate = function (type){
	switch (type){
		case 'map':
			break;
		case 'near':
			if (this.hasLocated == false){
				alert('请选择中心点');
				this.DONOTOPERATE=true;
				this.validate_error_addon= function (){
					pco.locate($('sn_input_wd').value,$('kw_match_list'));
				}
			}else{
				this.DONOTOPERATE=false;
			}
			break;
		default:
			break;
	}
}




/**
 * 页面流中的搜索中枢
 */
PageControlObject.prototype.search = function (type,keyword,cityCode,pool,co,curPage){
	var searchRoad=0;
	var leftTitle="";
	var leftTitle2="";
	if (this.type == 0){
		//自动切换到地图搜索
		this.go2search('map',$('searchText').value,cityCode,null);
		return;
	}
	//有效性验证
	if (this.DONOTOPERATE == true ){
		this.validate_error_addon();
		return;
	}
	if (this.searchDisplay==2 && type != 'bus2'){
		//线路查询
		//alert('线路查询');
		if ($('sn_stype_2').checked==true){
			//alert("你选择了公交线路查询");
			type='bus';
		}else{
			//alert("你选择了普通搜索");
		}
		
		
	}else if (this.searchDisplay==3){
		//道路查询
		if ($('sn_stype_3').checked==true){
			//验证路的有效性
			searchRoad=1;
			leftTitle="道路查询";
			leftTitle2="地图搜索";
		}else{
			//alert("你选择了普通搜索");
			searchRoad=0;
			leftTitle="地图搜索";
			leftTitle2="道路查询";
		}
	}
	//将这个数据置空
	this.searchDisplay=0;	
	var yellowParam=null;
	var cur_instance=this.instance;
	var this_instace=this;
	//alert(sm.searchArray.length);
	//alert(this.instance);
	//凡是搜索，则都要在左侧初始化
		if (keyword!=null){
				//$('search_word').innerHTML=keyword;
		}
    	if (keyword!=null && keyword.trim()==''){	
    		//alert('请填写完表单');    	
	    	return;
	    }
		if (pool == null){
			pool=$('listtable');
		}
		//判断如果类别是公交的
		if (keyword.replace(/^\s*公交\s*$/g,'公交')=='公交' && type=='near'){
			//alert'进入公交周边');
			type='busnear';
		}else{
		
			//判断如果输入的关键字字中含有公交字样，则取其中的数字
			var busreg=/^公交(.*)$/;
			if (busreg.test(keyword)){
				var busline =RegExp.$1;
				//将可能存在的空格去掉
				busline=busline.replace(/\s*/gi,"");
				//alert("您输入的路线是"+busline);
				if (cityCode!="100000")
					type="bus";
					
				keyword=busline;
				
				//this_instace.searchDisplay=2;
			}
		}		
		try{		
		    	var parentId=pool.getAttribute("id").replace("listtable","");
		    	
		    	$('list'+parentId).style.display='';
				$('loadingbar').style.display='';
				//$('listtable').style.display='none';
				pool.style.display='none';
			
					//将文字菜单隐掉
					$('article_menu').style.display="none";
				    //将特色服务隐掉
				    $('service').style.display="none";
				    //将tip隐掉
				     $('sn_2').style.display="none";
				    //将搜索条件隐掉
				     $('sn_1').style.display="none";		
			     	//将分类条隐掉
			     	$('sn_3').style.display="none";					          	

			     	//清除点
			     	this.clearSearchResult();
			     	this.clearLines();
			     	
			     	//启动移动时搜索状态条
			     	$('hot_navi').style.display='none';
			     	$('stop_hot_navi').style.display='';
			     	
			     	//关闭移动时搜索状态条
			     	//$('hot_navi').style.display='none';
			     	//$('stop_hot_navi').style.display='none';
			     	
			     				     	
			     	if (keyword.indexOf(",")>=0){
			     		//alert(type);
			     		$('hot_navi_kwd').innerHTML=keyword.substring(0,keyword.indexOf(","));	
			     	}else{
			     		$('hot_navi_kwd').innerHTML=keyword;
			     	}
			     		
			     		
			    	$('pi_set10').setAttribute("class","lq_3");
			    	$('pi_set10').setAttribute("className","lq_3");
			    	$('pi_set15').setAttribute("class","lq_3");
			    	$('pi_set15').setAttribute("className","lq_3");
			    	$('pi_set20').setAttribute("class","lq_3");
			    	$('pi_set20').setAttribute("className","lq_3");	
			    	
			    	
			    	if (type!='busnear'){
				     	//将道路查询条隐掉
				     	$('sn_road_block').style.display="none";			    		
					    //将线路查询条隐掉
				  		$("sn_line_block").style.display="none";	
					    //将地图搜索条隐掉
				  		$("sn_map_block").style.display="none";					  					    	
				     	//将线路结果隐掉
				     	$('bus_near_res').style.display='none';
			    	}    			
		}catch(e){
			window.status=(e.message);
		}			
	if (sm==null){
		$import('com.uumap.application.maps.search.*');
		try{
			sm=new SearchManager();
		}catch(e){}
	}	
	//禁止用户在搜索显示结果上自建点
	sm.clickToChooseStartFlag=false;	
				
	//清空内存中的页码
	if (curPage == null){
		sm.page=1;
	}else{
		sm.page=curPage;
	}
	//将道路搜索扩展值设为false
	sm.isRoad=searchRoad;	
	sm.onNoResult_addon = function (){	
		//	alert("no data");
		$('listtable').style.display='';
		$('loadingbar').style.display='none';
		$('listtable').innerHTML=getNoDataHTML(type);	
//		$('listtable').innerHTML='<li>没有数据</li>';		
		$('res_switch').style.display='none';
									
//					this_instace.switchTab(1);
	}
	
	//有关黄页的判断
	if (type=='yellow'){
		sm.isYellow=true;
		type='map';
	}else{
		sm.isYellow=false;
	}
	//alert(this_instace.type);

	//这个搜索主要是用于头部的控制的	
	switch (type){
		//地图搜索
		case 'map':
//				var cur_instance=sm;
//				//新的搜索，一些页码要清零
//				cur_instance.type="1";
//				cur_instance.keyword=keyword;
//				cur_instance.cityCode=cityCode;
//				if (pool!=null)
//					cur_instance.outputPool=pool;
//				//alert(pool.id);
//				cur_instance.param='keyword='+URLEncode(keyword)+'&cityCode='+cityCode+'&perNum='+cur_instance.pageLength+'&curPage='+cur_instance.page;
//				//cur_instance.sendRequest(keyword,cityCode,);
//				cur_instance.sendRequest();	
				sm.afterGetResult_addon=function (){
					//将当前选中的值赋给内存中的中心点对象
					sm.centerObject={jwx:'',jwy:'',nameChi:keyword};
					//得出结果后对页面展现进行调整 
					$('loadingbar').style.display='none';
					//设定title
					//$('left_title').innerHTML='地图搜索';
					//显示tooltip
					$('left_tooltip').style.display='';
				    //显示数量条
				    $("res_switch").style.display="";
				    //显示结果
				    $('listtable').style.display="";
				  // $('ffpool').innerHTML=$('listtable').innerHTML;
				    
					pool.style.display='';
					//分页条处理
					$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
				    //在有结果的前提下，启动移动搜索
//				    this_instace.enableSearchWhenMove();  
				    		    
					ControlCountBlock();
				    sm.hasLocated = true;
				    
				    $('left_title2').style.display=""; 
				}
				if (leftTitle!="")
					$('left_title').innerHTML=leftTitle;
				else
					$('left_title').innerHTML='地图搜索';
				/*	
				if (leftTitle2!="")
					$('left_title2').innerHTML=leftTitle2;
				else
					$('left_title2').innerHTML='分类搜索';
				*/
			    //更新url
			    this_instace.ref_query="&kw="+keyword; 					
			    //更新cookie，将用户的查询记到cookie中
			    this_instace.recordHistory(keyword); 	
				sm.type="1";
				sm.sendRequest(keyword,cityCode,pool);
				
			break;
		
		//周边搜索的话
		case 'near':
//				var centerObject = sm.searchArray[sm.currentSelectIndex];
//				if (keyword==null || centerObject == null){
//					alert('请选择中心点');
//					$('list').style.display='none';
//					return;
//				}

			    if (this.hasLocated == false && sm.centerObject == null){
			    	alert('尚未定位');
			    	this_instace.switchTab(this_instace.type);
			    	return;
			    } 
			   

			   
				if (co==null){
					var centerObject = sm.centerObject;
				}else{
					var centerObject = co;
					sm.centerObject = centerObject;
				}
				//alert(centerObject == null);
				//sm.page=2;
				this_instace.centerObject=centerObject;
				
				if (pool!=null)
					sm.outputPool=pool;
				else
					sm.outputPool=$('listtable');
				sm.afterGetResult_addon=function (){
					$('loadingbar').style.display='none';
					$('listtable').style.display='';
					//获得新的中心点的地址，然后更新
					$('sn_center_word').value=centerObject.nameChi;
					//alert("df");
					$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
					//设定title
					//$('left_title').innerHTML='周边搜索';	
					//显示tooltip
					$('left_tooltip').style.display='';									
				    //显示数量条
				    $("res_switch").style.display="";					    			
					ControlCountBlock();
				    //显示当前移动搜索所获得个数
				    $('hot_navi_cnt').innerHTML="("+sm.totalCount+")";	

					//标出中心点
					sm.setPoint(centerObject.jwx,centerObject.jwy,"s");				    				
				    //在有结果的前提下，启动移动搜索
				    this_instace.enableSearchWhenMove(false);   

				    $('left_title2').style.display=""; 				     
				}	
				//if (this_instace.type==4)
				$('left_title').innerHTML='周边搜索';	
			    //更新url
			    this_instace.ref_query="&kw="+URLEncode(centerObject.nameChi+","+keyword)+"&oll="+centerObject.jwx+","+centerObject.jwy;				    			
			    //更新cookie，将用户的查询记到cookie中
			    this_instace.recordHistory(centerObject.nameChi+"周边的"+keyword);				
				
				//sm.onErrorCallBack
				sm.movingKeyword=keyword;
				//将周边搜索的类型赋到头上
				$('sn_center_type').value=keyword;
				sm.searchNear(centerObject,keyword,pool); 		    			
				
			break;
		//分类搜索
		case 'type':
			//alert("keyword is "+keyword);
			//alert("pool == null "+(pool == null));
			if (pool!=null)
				sm.outputPool=pool;
			else
				sm.outputPool=$('listtable');
					
			if (keyword!=null){
				var type=keyword.split(",");
				//var typeName=keyword.typeName;
				sm.keyword=keyword;
				this.hasLocated = true;

				sm.afterGetResult_addon=function (){
					//alert(keyword.indexOf(","));
					//分类搜索完毕后，就开始移动周边搜索，所以要对keyword过滤处理
			     	if (keyword.indexOf(",")>=0 && sm.movingKeyword=="" || sm.startRecord=='1' && keyword.indexOf(",")>=0 ){
			     		//alert('trimming');
			     		//sm.keyword=keyword.substring(0,keyword.indexOf(","));
			     		sm.movingKeyword=keyword.substring(0,keyword.indexOf(","));	
			     	}
			     	//alert("in type sm.movingKeyword"+sm.movingKeyword);
					//将当前选中的值赋给内存中的中心点对象,由于是分类搜索，所以系统自己取中心点值
					var cjw=G_MAP_OBJ.mymap.getCenterJwOf("all");
					sm.centerObject={jwx:cjw.jwx,jwy:cjw.jwy,nameChi:sm.movingKeyword};	
					this_instace.centerObject=sm.centerObject;				
					$('loadingbar').style.display='none';
					$('listtable').style.display='';
					$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
					//设定title
					//$('left_title').innerHTML='分类搜索';	
					//显示tooltip
					$('left_tooltip').style.display='';	
				    //显示数量条
				    $("res_switch").style.display="";
				    //显示当前移动搜索所获得个数
				    $('hot_navi_cnt').innerHTML="("+sm.totalCount+")";

				    //在有结果的前提下，启动移动搜索
				    this_instace.enableSearchWhenMove();  
				    				    
				    //todo 在分类搜索时，这里有问题，先注释掉
				    this_instace.pc.go_to_the_best_view();				    				    													
					ControlCountBlock();
					$('left_title2').style.display="";
				}				
				sm.searchByType(type[0],type[1]);
				//设定title
				$('left_title').innerHTML='分类搜索';
				//显示tooltip
				$('left_tooltip').style.display='';	
				//关闭移动时搜索
				this.disableSearchWhenMove();		
			}
			
		break;
		case 'busnear':
				//alert('bus near');
				if(sm.centerObject!=null){	
					sm.afterGetResult_addon=function (){
						//alert(keyword.indexOf(","));
						//分类搜索完毕后，就开始移动周边搜索，所以要对keyword过滤处理
						
				     	//alert("in type sm.movingKeyword"+sm.movingKeyword);
						//将当前选中的值赋给内存中的中心点对象
						//alert("trace ms.search.busnear");
						sm.centerObject={jwx:'',jwy:'',nameChi:keyword};					
						$('loadingbar').style.display='none';
						$('listtable').style.display='';
						$('page_info').innerHTML=sm.startRecord+"-"+(sm.endRecord+1)+"/"+(sm.totalCount+1);
						//设定title
						//$('left_title').innerHTML='分类搜索';	
						//显示tooltip
						$('left_tooltip').style.display='';	
					    //显示数量条
					    $("res_switch").style.display="";
					    //显示当前移动搜索所获得个数
					    $('hot_navi_cnt').innerHTML="("+sm.totalCount+")";
					    //在有结果的前提下，启动移动搜索
					    //this_instace.enableSearchWhenMove();  
					    //因为是周边公交，东西是一次性显示完的，所以totalPage设为1,
					    if (sm.totalPage>0)
					    	sm.totalPage=1;				    													
						ControlCountBlock();
						$('left_title2').style.display="";
					}				
					sm.getNearStop($('listtable'));
				}else{
					alert('点尚未定位');
				}
		break;
		case 'bus':

			$('bus_near_res').style.display='';
			//得出结果后对页面展现进行调整 
			$('list').style.display='none';
			//$('listtable').style.display='';
			var date=new Date();
			this.searchBusLine("/bus/findBusLines2.action?busLineName="+URLEncode(keyword)+"&cityCode="+cityCode+"&timestamp="+date.getTime());
			//alert($('searchText').value);
			//findBusLines();
			//busLineFrameObj.src="/bus/findBusLines2.action?busLineName="+URLEncode(keyword)+"&cityCode="+cityCode+"&timestamp="+date.getTime();
		   	//$('searchText').value="公交 "+keyword;
		   	$('left_title2').style.display="";
		break;	
		case 'bus2':
			$('bus_near_res').style.display='';
			//得出结果后对页面展现进行调整 
			$('list').style.display='none';
		break;					
		default:
		break;
	}
}

/**
 * 页面流中的路线中枢
 */
PageControlObject.prototype.getRoute = function (type,keyword,cityCodeOut,pool,co){
	//如果是全地图模式，不进行查询
	if (this.displayMode == 0) return;
	var historyToken = "";
	
				if (type=='bus') {
					
					type=2;
				
				}else if (type=='drive'){	
					
					type=3;
				
				
				}
				//alert(cityCode;
				if (type==3){		
					this.driveRouteType="T";						
					if (cityCode=="100000"){
						//alert('ddd');
						//todo 如果是全国行车，启动省略模式
						//alert("G_MAP_OBJ.mymap.id="+G_MAP_OBJ.mymap.map_container_id);
					}
					historyToken = "驾车";
				}else if (type==2){
					//公交
					this.driveRouteType="0";
					historyToken = "公交";
				}
				
				if (!(start_finish && end_finish)){
					alert('请定完起点与终点');
					return;
				}
				if (dm.startObject==null){
					start_finish=false;
					return;
				}
				if (dm.endObject==null){
					end_finish=false;
					return;
				}
				if (dm.startObject.jwx==dm.endObject.jwx && dm.startObject.jwy==dm.endObject.jwy){
					alert('起终点相同');
					return;
				}
				

				
				//显示loading条
		    	$('list').style.display='';
				$('loadingbar').style.display='';
				$('listtable').style.display='none';
				$("error_info").style.display="none";
				$("loadingStatus").style.display="";				
				//显示线路展示块
				$(dm.prefix+"_2").style.display='';
				$(dm.prefix+"_2c").style.display='';				
				//隐藏掉不需要的
			    //将特色服务隐掉
			    $('service').style.display="none";
			    //将tip隐掉
			    $(dm.prefix+'_1').style.display="none";		
				//将文字菜单隐掉
				$('article_menu').style.display="none";
		    	//将起终点选择隐藏掉
		    	$('kw_pool1').style.display="none";
		    	$('kw_pool2').style.display="none";	
	    		//更新起始点的input值
				$('sn_input_start_'+type).value=dm.startObject.nameChi;
				$('sn_input_end_'+type).value=dm.endObject.nameChi;
				
				try{
				//周边公交,将周边公交隐藏掉
				$('bus_3').style.display="none";
				//把显示路线的区块隐藏
				$('bus_route_bar').style.display='none';

				}catch(e){}
							
				//清空线
				//this.clearLines();
				//this.clearSearchResult();
				type='bus';
		
	var this_instance=this;
	//这个搜索主要是用于头部的控制的	
	switch (type){
		//地图搜索
		case 'bus':
					//alert('english');
					var className="";
					for (var i=0;i<3;i++){
						$('rd_tab'+(i+1)).style.display='none';
						if (i==0){
							className="routeSelected";
						}else{
							className="routeUnSelected";	
						}
						$('rd_tab'+(i+1)).setAttribute("class",className);
						$('rd_tab'+(i+1)).setAttribute("className",className);						
					}
				dm.onNoResult_addon=function (type){
						$("error_info").style.display="";
						if (type!=null)
							$("error_info_detail").innerHTML = type;
						else
							$("error_info_detail").innerHTML = "服务器正忙,请稍后再试";
						$("loadingStatus").style.display="none";

					
					//this_instance.switchTab(this_instance.type);
				}
			
				//将起始点和终止点的坐标记录到公共变量中，以便行车和公交间的沟通
				this_instance.startObject=dm.startObject;
				this_instance.endObject=dm.endObject;
				//设置好起点终点的名称
				dm.getRoute_addon = function (){
					$('loadingbar').style.display='none';
					$('listtable').style.display='';
					//显示tooltip
					$('left_tooltip').style.display='';					
					//alert('此次查询共有'+dm.bustransferLineArr.length+'线路');
					//先把显示路线的区块显示出来
					$('bus_route_bar').style.display='';
				
					//将返程,功能切换控制条显示
					$('route_footer').style.display="";

					//根据线路的多少来决定显示有几条线路
					for (var i=0;i<dm.shwTabCount;i++){
						$('rd_tab'+(i+1)).style.display='';
					}
					
					//重画起点，终点
					//dm.setPoint(dm.startJwx,dm.startJwy,'s');
					//dm.setPoint(dm.endJwx,dm.endJwy,'e');

					$('left_title2').style.display='';
				}
					//更新url	
					this_instance.ref_query="&kw="+URLEncode(dm.startObject.nameChi+","+dm.endObject.nameChi)+"&sll="+dm.startObject.jwx+","+dm.startObject.jwy+"&dll="+dm.endObject.jwx+","+dm.endObject.jwy
				
				    //更新cookie，将用户的查询记到cookie中
				    this_instance.recordHistory(historyToken+":"+dm.startObject.nameChi+"到"+dm.endObject.nameChi); 
				dm.getBusTransfer($('listtable'));
			break;
		
		//周边搜索的话
		case 'near':


			break;
		//分类搜索
		case 'type':
			
		break;			
		default:
		break;
	}
}
/**
 * 获得返程路线
 */
PageControlObject.prototype.getReverseRoute = function (type){
	//更换经纬度
	var tempJwx=dm.startJwx;
	var tempJwy=dm.startJwy;
	dm.startJwx=dm.endJwx;
	dm.startJwy=dm.endJwy;
	dm.endJwx=tempJwx;
	dm.endJwy=tempJwy;
	
	var tempName=dm.driveStartName;
	dm.driveStartName=dm.driveEndName;
	dm.driveEndName=tempName;
	
	//更换点
	dm.setPoint(dm.startJwx,dm.startJwy,'s');
	dm.setPoint(dm.endJwx,dm.endJwy,'e');
	

	//更新返程标识
	if (dm.reverse==0){
		dm.reverse=1;
	}else{
		dm.reverse=0;
	}
	//这里直接置为'bus'
	//清空线
	this.clearLines();
	this.clearSearchResult();
	//重画起点，终点
	dm.setPoint(dm.startJwx,dm.startJwy,'s');
	dm.setPoint(dm.endJwx,dm.endJwy,'e');	
	
		
	this.getRoute(type);
}

/**
 * 更换线路
 */
PageControlObject.prototype.switchRoute = function (type,index){
	//删除中间点
	if (sPointIndex!=-1) g_pc.remove_a_point(sPointIndex);	

	//这个搜索主要是用于头部的控制的	
	switch (type){
		//地图搜索
		case 'bus':
			if (dm.result_url != null && dm.result_url != "" ){
				dm.result_url=dm.result_url.replace(/rb=\d/,"rb="+(index-1));			
			}
			this.driveRouteType=index-1;
			if (index==1){
				$('listtable').innerHTML=dm.content;				
			}else if (index==2){		
				$('listtable').innerHTML=dm.cross_content;
			}else if (index==3){				
				$('listtable').innerHTML=dm.third_content;
			}
			
			for (var i=0;i<dm.shwTabCount;i++){
				if (index-1==i){
					$('rd_tab'+(i+1)).setAttribute("class","routeSelected");
					$('rd_tab'+(i+1)).setAttribute("className","routeSelected");
				}else{
					$('rd_tab'+(i+1)).setAttribute("class","routeUnSelected");
					$('rd_tab'+(i+1)).setAttribute("className","routeUnSelected");
				}
			}
		
			try{
				dm.drawBusTransferLine(index);
			}catch(e){}
		break;
		case 'dr':		
					if (index % 2 != dm.driveSearchType % 2) return;
				
					$('loadingbar').style.display='';
					$('listtable').style.display='none';
					
					//隐藏tab,防止恶意点击
					try{					
						//根据线路的多少来决定显示有几条线路
						for (var i=0;i<dm.shwTabCount;i++){
							$('rd_tab'+(i+1)).style.display='none';
						}
					}catch(e){}							
					try{
						//alert("trace MS.switchRoute()");
						//dm.clearLines();
						this.clearLines();
					}catch(e){}					
					//alert(dm.driveSearchType);
					if (dm.driveSearchType==0){
							//最短路径
							//TabChooser(2,null);
							this.driveRouteType="L";
							dm.getBusTransfer($('listtable'),"L");
							dm.driveSearchType=1;
							$('rd_tab2').setAttribute("class","routeSelected");
							$('rd_tab2').setAttribute("className","routeSelected");
							$('rd_tab1').setAttribute("class","routeUnSelected");
							$('rd_tab1').setAttribute("className","routeUnSelected");								
					}else if (dm.driveSearchType==1){
							//最短时间
							//TabChooser(1,null);
							this.driveRouteType="T";
							dm.getBusTransfer($('listtable'),"T");
							dm.driveSearchType=0;
							$('rd_tab1').setAttribute("class","routeSelected");
							$('rd_tab1').setAttribute("className","routeSelected");
							$('rd_tab2').setAttribute("class","routeUnSelected");
							$('rd_tab2').setAttribute("className","routeUnSelected");								
					}	

					
		break;
	}
}


PageControlObject.prototype.go2near = function (){
				if (co==null){
					var centerObject = sm.centerObject;
				}else
					var centerObject = co;
				
				//sm.page=2;
				if (pool!=null)
					sm.outputPool=pool;
				else
					sm.outputPool=$('listtable');
				sm.afterGetResult_addon=function (){
					$('loadingbar').style.display='none';
					$('listtable').style.display='';
					$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
					//获得新的中心点的地址，然后更新
					$('sn_center_word').value=centerObject.nameChi;
					
					//显示tooltip
					$('left_tooltip').style.display='';					
				    if (sm.totalCount>10){
				    	$('pi_set10').setAttribute("class","lq_3b");
				    	$('pi_set10').setAttribute("className","lq_3b");
				    }
				    if (sm.totalCount>25){
				    	$('pi_set15').setAttribute("class","lq_3b");
				    	$('pi_set15').setAttribute("className","lq_3b");
				    }
				    if (sm.totalCount>40){
				    	$('pi_set20').setAttribute("class","lq_3b");
				    	$('pi_set20').setAttribute("className","lq_3b");
				    }	    
				}	
				sm.onErrorCallBack = function (){			
					alert('服务器正忙,请稍后再试');
					$('list').style.display='none';
				}
				sm.searchNear(centerObject,keyword,pool);
}

/**
 * 行车，公交互相跳转
 */
PageControlObject.prototype.go2bus = function (){
	//如果是全国则不做查询
	if (cityCode=="100000"){
		alert("全国模式下暂不能做");
		return;
	}	
	//从行车到公交，要跳转的有
	try{
	//0.将当前的所有结果清除
	dm.clearLines();
	}catch(e){}
	//1.先把头部换掉,函数来源于头部
	TabAlt('hd',2,true);
	var this_instance=this;
	//因为要跳转，所以事先要存储全局起点对象，终点对象
	this_instance.startObject=dm.startObject;
	this_instance.endObject=dm.endObject;

	//2.设定切换后的函数,进行获得路线的查询
	this.loadPage_addon=function (){
		//alert('la');
		dm.driveStartName=(''+this_instance.startObject.nameChi);
		dm.driveEndName=(''+this_instance.endObject.nameChi);
		try{			
			$('sn_input_start_'+this_instance.type).value=this_instance.startObject.nameChi;
			$('sn_input_end_'+this_instance.type).value=this_instance.endObject.nameChi;
		}catch(e){
			//alert(e.message);
		}		
		dm.startObject=this_instance.startObject;
		dm.endObject = this_instance.endObject;
		dm.setPoint(dm.startObject.jwx,dm.startObject.jwy,'s');
		dm.setPoint(dm.endObject.jwx,dm.endObject.jwy,'e');		

		this_instance.getRoute(2);
	}
	//3.将左侧换成公交
	this.switchTab(2);	
	
}
/**
 * 外部功能到search的跳转
 */
PageControlObject.prototype.go2search = function (type,keyword,cityCode,pool,co,curPage){
	if (this.type == 1){

		this.search(type,keyword,cityCode,pool,co,curPage);
	}else{
		//从行车到公交，要跳转的有
		try{
		//0.将当前的所有结果清除
		this.clearLines();
		this.clearSearchResult();
		}catch(e){}
		//1.先把头部换掉,函数来源于头部
		TabAlt('hd',1,true);
		var this_instance=this;
		//2.设定切换后的函数,进行获得路线的查询
		this.loadPage_addon=function (){
			if (pool==null){
				pool=$('listtable');
			}
			if (type=='bus'){
				this_instance.chooseSubFunc('sn_line_block','','sn_map_block,sn_road_block,service,sn_3,sn_2,bus_near_res','线路查询');
			}
			
			this_instance.search(type,keyword,cityCode,pool,co,curPage);
		}
		//3.将左侧换成搜索
		this.switchTab(1);	
	}	
}
/**
 * 外部功能到周边服务公交的跳转
 */
PageControlObject.prototype.go2busnear = function (){
		//从行车到公交，要跳转的有
		try{
		//0.将当前的所有结果清除
		this.clearLines();
		this.clearSearchResult();
		}catch(e){}
		//1.先把头部换掉,函数来源于头部
		TabAlt('hd',4,true);
		var this_instance=this;
		//2.设定切换后的函数,把周边类别设定为公交
		this.loadPage_addon=function (){
			$('sn_point_type').value='公交';
			$('sn_center_type').value='公交';
		}
		//3.将左侧换成周边
		this.switchTab(4);	
}
/**
 * 外部功能到线路查询，道路查询的跳转 type 2:线路 3:道路
 */
PageControlObject.prototype.go2miniSearch = function (type){
		//从行车到公交，要跳转的有
		try{
		//0.将当前的所有结果清除
		this.clearLines();
		this.clearSearchResult();
		}catch(e){}
		//1.先把头部换掉,函数来源于头部
		TabAlt('hd',1,true);
		var this_instance=this;
		this_instance.searchDisplay=type;
		//2.设定切换后的函数,进行获得路线的查询
		this.loadPage_addon=function (){
			if (this_instance.searchDisplay==2){
				pco.chooseSubFunc('sn_line_block','','sn_road_block,sn_1,service,sn_2,sn_3','线路搜索');

			}else if (this_instance.searchDisplay==3){
				pco.chooseSubFunc('sn_road_block','','sn_line_block,sn_1,service,sn_2,sn_3','道路搜索');
			}
			$('searchText').select();
			$('searchText').focus();
		}
		//3.将左侧换成搜索
		this.switchTab(1);	
}

/**
 * 搜索到行车，公交的跳转,direction 为0,是从搜索点到目的地,1是从出发地到搜索点
 */
PageControlObject.prototype.go2bus4search = function (keyword,direction){
	//如果是全国则不做查询
	if (cityCode=="100000"){
		alert("全国模式下暂不能做");
		return;
	}	
	//获得keyword的值后，先对其进行合法性检验
	if (keyword==null || keyword.trim() == ''){
		alert('您输入的为空喔!');
		return;		
	}
	//alert(keyword);
	var this_instance=this;
	//alert("trace go2bus4search "+direction);	
	
	//从行车到公交，要跳转的有
	try{
	//0.将当前的所有结果清除
	this_instance.clearLines();
	this_instance.clearSearchResult();
	}catch(e){}
	//1.先把头部换掉,函数来源于头部
	TabAlt('hd',2,true);
	//2.将当前所选的中心点记录下来
	this_instance.readyRoute=0;
	this_instance.startObject=sm.centerObject;
	//alert(sm.centerObject.nameChi);
	var switchIndex=0;
	if (direction==1){
		switchIndex=2;
	}else{
		switchIndex=1;
	}
	//3.设定切换后的函数,进行获得路线的查询
	this.loadPage_addon=function (){
			//alert(keyword);
			var obj=this_instance.startObject;
			$('kw_match'+switchIndex).style.display='none';
			$('kw_pool'+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex+"f").style.display='none';
			if (direction == 1){
				//起点待定
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveEndName=obj.nameChi;
					//alert(dm.driveStartName);
					dm.setPoint(obj.jwx,obj.jwy,"e");
				}
				this_instance.locate(keyword,$('kw_match_list'),1,false);
			}else{
				//终点待定	
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveStartName=obj.nameChi;
					dm.setPoint(obj.jwx,obj.jwy,"s");
				}				
				this_instance.locate(keyword,$('kw_match_list2'),2,false);
			}
	}
	//4.将左侧换成公交
	this.switchTab(2);		

}
PageControlObject.prototype.go2drive4search = function (keyword,direction){
	//获得keyword的值后，先对其进行合法性检验
	if (keyword==null || keyword.trim() == ''){
		alert('您输入的为空喔!');
	}
	var this_instance=this;	
	try{
	//0.将当前的所有结果清除
	this_instance.clearLines();
	this_instance.clearSearchResult();
	}catch(e){}
	//1.先把头部换掉,函数来源于头部
	TabAlt('hd',3,true);
	//2.将当前所选的中心点记录下来
	this_instance.readyRoute=0;
	this_instance.startObject=sm.centerObject;
	//alert(sm.centerObject.nameChi);
	var switchIndex=0;
	if (direction==1){
		switchIndex=2;
	}else{
		switchIndex=1;
	}
	//3.设定切换后的函数,进行获得路线的查询
	this.loadPage_addon=function (){
			//alert(keyword);
			var obj=this_instance.startObject;
			$('kw_match'+switchIndex).style.display='none';
			$('kw_pool'+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex+"f").style.display='none';
			if (direction == 1){
				//起点待定
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveEndName=obj.nameChi;
					//alert(dm.driveStartName);
					dm.setPoint(obj.jwx,obj.jwy,"e");
				}
				this_instance.locate(keyword,$('kw_match_list'),1,false);
			}else{
				//终点待定	
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveStartName=obj.nameChi;
					dm.setPoint(obj.jwx,obj.jwy,"s");
				}				
				this_instance.locate(keyword,$('kw_match_list2'),2,false);
			}
	}
	//4.将左侧换成行车
	this.switchTab(3);			
}
PageControlObject.prototype.go2bus4url = function (sll,dll,sname,dname){
	var sjws = sll.split(",");
	var ejws = dll.split(",");
	//如果是全国则不做查询
	if (cityCode=="100000"){
		alert("全国模式下暂不能做");
		return;
	}	
	//获得keyword的值后，先对其进行合法性检验
	if (keyword==null || keyword.trim() == ''){
		alert('您输入的为空喔!');
		return;		
	}
	//alert(keyword);
	var this_instance=this;
	//alert("trace go2bus4search "+direction);	
	
	//从行车到公交，要跳转的有
	try{
	//0.将当前的所有结果清除
	this_instance.clearLines();
	this_instance.clearSearchResult();
	}catch(e){}
	//1.先把头部换掉,函数来源于头部
	TabAlt('hd',2,true);
	//2.将当前所选的中心点记录下来
	this_instance.readyRoute=0;
	//this_instance.startObject=sm.centerObject;
	this_instance.startObject={jwx:sjws[0],jwy:sjws[1],nameChi:sname};
	this_instance.endObject={jwx:ejws[0],jwy:ejws[1],nameChi:dname};
	//alert(sm.centerObject.nameChi);
	var switchIndex=0;
	if (direction==1){
		switchIndex=2;
	}else{
		switchIndex=1;
	}
	//3.设定切换后的函数,进行获得路线的查询
	this.loadPage_addon=function (){
			//alert(keyword);
			var obj=this_instance.startObject;
			$('kw_match'+switchIndex).style.display='none';
			$('kw_pool'+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex).style.display='';
			$("kw_match_hint"+switchIndex+"f").style.display='none';
			if (direction == 1){
				//起点待定
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveEndName=obj.nameChi;
					//alert(dm.driveStartName);
					dm.setPoint(obj.jwx,obj.jwy,"e");
				}
				this_instance.locate(keyword,$('kw_match_list'),1,false);
			}else{
				//终点待定	
				if (obj!=null){	
					this_instance.readyRoute++;
					dm.driveStartName=obj.nameChi;
					dm.setPoint(obj.jwx,obj.jwy,"s");
				}				
				this_instance.locate(keyword,$('kw_match_list2'),2,false);
			}
	}
	//4.将左侧换成公交
	this.switchTab(2);		

}




PageControlObject.prototype.go2busCallback = function (){
	
}
PageControlObject.prototype.go2drive = function (){
	//从公交到行车，要跳转的有
	//0.将当前的所有结果清除
	try{
		dm.clearLines();
	}catch(e){
		
	}
	//1.先把头部换掉,函数来源于头部
	TabAlt('hd',3,true);
	var this_instance=this;
	//因为要跳转，所以事先要存储全局起点对象，终点对象
	this_instance.startObject=dm.startObject;
	this_instance.endObject=dm.endObject;

	//2.设定切换后的函数,进行获得路线的查询
	this.loadPage_addon=function (){
		//alert('la');
		dm.driveStartName=(''+this_instance.startObject.nameChi);
		dm.driveEndName=(''+this_instance.endObject.nameChi);
		try{			
			$('sn_input_start_'+this_instance.type).value=this_instance.startObject.nameChi;
			$('sn_input_end_'+this_instance.type).value=this_instance.endObject.nameChi;
		}catch(e){
			//alert(e.message);
		}	
		dm.startObject=this_instance.startObject;
		dm.endObject = this_instance.endObject;
		dm.setPoint(dm.startObject.jwx,dm.startObject.jwy,'s');
		dm.setPoint(dm.endObject.jwx,dm.endObject.jwy,'e');	
	
		this_instance.getRoute(3);
	}	
	//3.将左侧换成行车
	this.switchTab(3);
}
PageControlObject.prototype.go2driveCallback = function (){
	
}
/**
 * 自动定位搜索,自动搜索起点与终点
 * 公交和驾车
 */
PageControlObject.prototype.autoLocateBusAndCar = function (skwd,ekwd,pool1,pool2){
	this.readyRoute=0;
	this.syncArray=null;
	this.syncArray=new Array();
	if (skwd == "" && ekwd == ""){
		alert("请填写关键字");
		return;
	}
	if (skwd == ekwd ){
		alert("起点与终点相同");
		return;
	}
	
	//如果用户没有输入起点值，或者起点已经点选了
	if (skwd==""){
		$("kw_match_hint"+1).style.display='none';
		$("kw_match_hint"+1+"f").style.display='';
		$('kw_match1').style.display='none';
		$('kw_pool'+1).style.display='';		
		this.locateBusAndCar(ekwd,pool2,2);	
	}else if (ekwd==""){
			$("kw_match_hint"+2).style.display='none';
			$("kw_match_hint"+2+"f").style.display='';
			$('kw_match2').style.display='none';
			$('kw_pool'+2).style.display='';	
			this.locateBusAndCar(skwd,pool1,1);
	}else{
			var this_instance=this;
			this.synchronize=true;
			this.syncArray.push(function (){pco.locateBusAndCar(ekwd,pool2,2,false);pco.synchronize=false;});
			this.locateBusAndCar(skwd,pool1,1);
	}
}

/**
 * 定位搜索  pointType 0 中心点 1起点 2 终点 3起点终点一起搜   sync是同步
 */
PageControlObject.prototype.locateBusAndCar = function (keyword,pool,pointType,sync,syncFunc){
//alert("bus and car");
	if (keyword==null) {
		alert('请输入关键字');
		return;
	}
	if (keyword == "当前中心点"){
		return;
	}
	
	if (pointType==null) {
		$import('com.uumap.application.maps.search.*');
		sm = new SearchManager();
		pointType=0;
	}
	
	
	if (sm==null){
		 //载入sm失败
		 //alert('oh my god');
	}
	sm.locateType=pointType;
	if (pool!=null)
		sm.outputPool=pool;	
	else
		sm.outputPool=$('kw_match_list');
		
	sm.type="11";
	var this_instance=this;
	
	if (this_instance.type==4){
		//pco.chooseSubFunc('sn_','1','service,sn_3,sn_2','周边搜索');$('list').style.display='none';
	}else if (this_instance.type==2){
		this_instance.chooseSubFunc('','','bus_2,bus_3,service,bus_1,bus_near_title,left_tooltip','公交换乘');
	}else if (this_instance.type==3){
		this_instance.chooseSubFunc('','','dr_2,dr_1,service','驾车路线');
	}
	if (this_instance.type!=1 && pointType>0){
		if($('kw_pool'+pointType))
		$('kw_pool'+pointType).style.display='';
	}
	//清空点和线
	try{
		if (pointType==1){
			this_instance.pc.remove_a_point(dm.sPointIndex);
		}else if (pointType==2){
			this_instance.pc.remove_a_point(dm.ePointIndex);
		}
		this_instance.clearLines();
		//如果之前有做过公交，行车数据，要隐藏
		$('list').style.display="none";
		$('bus_route_bar').style.display="none";
	}catch(e){}
	try{
		//删除中间点
		if (sPointIndex!=-1) g_pc.remove_a_point(sPointIndex);
	}catch(e){}		
	//当没有搜索到结果时
	sm.onNoResult_addon=function (){
		//alert("很抱歉，uumap定位不了您输入的地址!");
		//alert(pointType);
		//alert("ms.locate "+pointType);
		$("kw_match_hint"+pointType).style.display='none';
		$("kw_match_hint"+pointType+"f").style.display='';
		if(pointType!=0){
		$('kw_match'+pointType).style.display='none';
		}else{
			alert("很抱歉，uumap定位不了您输入的地址!");
		}
		if (this_instance.synchronize){						
			(this_instance.syncArray.pop())();
			this_instance.synchronize=false;
		}		
	}
	
	//当搜索到结果时
	sm.afterGetResult_addon=function (){
		//$('kw_match').style.display='';

		
		//定位成功
		this_instance.hasLocated=true;
		//alert('在哪儿清了2？');
		//alert("trace pco.locate 怎么没出列表值呢?");
		if (pointType > 0){
			
			$("kw_match_hint"+pointType).style.display='';
			$("kw_match_hint"+pointType+"f").style.display='none';
					//alert(this_instance.synchronize);
					if (this_instance.synchronize){						
						setTimeout ("(pco.syncArray.pop())()","2500");
						this_instance.synchronize=false;
					}
					
			if (pointType==1){
//				var pos=getElementPos("sn_input_start_"+this_instance.type);
//				var x=pos.x-40;
//				var y=pos.y+20;
//				$('kw_match'+pointType).style.left=x+"px";
//				$('kw_match'+pointType).style.top=y+"px";
				$('kw_match'+pointType).style.display='';
				sm.locateStart_addon=function (){
					//alert(sm.centerObject.nameChi);
					var ro=sm.centerObject;
					//dm.setPoint(ro.jwx,ro.jwy,'s');
						$('sn_input_start_'+this_instance.type).value=ro.nameChi;
						dm.driveStartName=ro.nameChi;					
						dm.setPoint(ro.jwx,ro.jwy,'s');
						dm.startObject=ro;
						dm.startJwx=ro.jwx;
						dm.startJwy=ro.jwy;
	
//						$('kw_match1').style.display='none';
						
						if(sm.totalCount=="1"){
							//alert('单条记录');
							this_instance.readyRoute++;
						}
						if (this_instance.readyRoute==2){
							this_instance.getRoute(this_instance.type);
						}
					
				};
			}else if (pointType==2){
//				var pos=getElementPos("sn_input_end_"+this_instance.type);
//				var x=pos.x-40;
//				var y=pos.y+20;
//				$('kw_match'+pointType).style.left=x+"px";
//				$('kw_match'+pointType).style.top=y+"px";
				$('kw_match'+pointType).style.display='';
								
				sm.locateEnd_addon=function (){
					var ro=sm.centerObject;
					$('sn_input_end_'+this_instance.type).value=ro.nameChi;
					dm.driveEndName=ro.nameChi;						
					dm.setPoint(ro.jwx,ro.jwy,'e');
					dm.endObject=ro;
					dm.endJwx=ro.jwx;
					dm.endJwy=ro.jwy;	
			
//					$('kw_match2').style.display='none';
					if(sm.totalCount=="1"){
						//alert('单条记录');
						this_instance.readyRoute++;
					}
					if (this_instance.readyRoute==2){
						this_instance.getRoute(this_instance.type);
					}
				};
			}
			//判断个数
			var sch_count=sm.totalCount;
			//如果为1则直接定位
			if (sch_count==1){
				//alert('直接定位');
				sm.showLocation(0,null,pointType);
			}	

		}else{
			//如果是周边搜索的中心点locate
			try{
			//如果之前有数据，要清空
			this_instance.clearSearchResult();
			}catch(e){
				
			}
			//隐去其他的面板
			pco.chooseSubFunc('sn_','1','service,sn_3,sn_2','周边搜索');$('list').style.display='none';
			//将获得的值反邹到输入框
			
			//搜索模块中调用
			$('kw_match').style.display='';
			sm.locate_addon=function (){
				var pc=sm.pc;
				var ro=sm.centerObject;	
				$('sn_center_word').value=ro.nameChi;	
				//如果是公交的中心点
				if (this_instance.type=="2"){
					dm.startJwx=ro.jwx;
					dm.startJwy=ro.jwy;
					dm.startObject=ro;					
				}
				
						
				//左侧列表展现
				try{
					//逐个画点
				    var tempIndex=pc.create_a_point('centerpoint',ro.jwx,ro.jwy,"",ro.nameChi,"","customicon_tower_23_25_offical_i","off_h:-60,off_w:-10,auto_size:true",""); 			   		   
				    pc.pois[tempIndex].use_info="yes";		   
				    pc.pois[tempIndex].can_be_moved="no"; 	
					//this.outputPool.parent.style.display='none';
					$('kw_match').style.display='none';
				}catch(e){
					alert(e.message);
				}	
				//右侧点展开气泡	
				pc.pois[tempIndex].click();	
				
				//判断如果用户输了类别则直接去搜
				if ($('sn_center_type').value=='例：银行' || $('sn_center_type').value==""){
					//说明这个用户没选类别
					alert('请选择类别');
					$('sn_center_type').select();
					$('sn_center_type').focus();
					//隐去其他的面板
					pco.chooseSubFunc('service','','sn_3,sn_1,sn_2','周边搜索');$('list').style.display='none';					
				}else{
					pco.validate('near');pco.search('near',$('sn_center_type').value,$('listtable'));
				}	
			}	
			if (sm.totalCount==1){
				//alert('直接定位');
				sm.showLocation(0,null,0);
			}				
		}
	}
//	alert("what's wrong");
	sm.locateBusAndCar(keyword,cityCode,pool);
}
/**
 * 自动定位搜索,自动搜索起点与终点
 */
PageControlObject.prototype.autoLocate = function (skwd,ekwd,pool1,pool2){
	this.readyRoute=0;
	this.syncArray=null;
	this.syncArray=new Array();
	if (skwd == "" && ekwd == ""){
		alert("请填写关键字");
		return;
	}
	if (skwd == ekwd ){
		alert("起点与终点相同");
		return;
	}
	
	//如果用户没有输入起点值，或者起点已经点选了
	if (skwd==""){
		$("kw_match_hint"+1).style.display='none';
		$("kw_match_hint"+1+"f").style.display='';
		$('kw_match1').style.display='none';
		$('kw_pool'+1).style.display='';		
		this.locate(ekwd,pool2,2);	
	}else if (ekwd==""){
			$("kw_match_hint"+2).style.display='none';
			$("kw_match_hint"+2+"f").style.display='';
			$('kw_match2').style.display='none';
			$('kw_pool'+2).style.display='';	
			this.locate(skwd,pool1,1);
	}else{
			var this_instance=this;
			this.synchronize=true;
			this.syncArray.push(function (){pco.locate(ekwd,pool2,2,false);pco.synchronize=false;});
			this.locate(skwd,pool1,1);
	}
}

/**
 * 定位搜索  pointType 0 中心点 1起点 2 终点 3起点终点一起搜   sync是同步
 */
PageControlObject.prototype.locate = function (keyword,pool,pointType,sync,syncFunc){
//alert("locate");
	if (keyword==null) {
		alert('请输入关键字');
		return;
	}
	if (keyword == "当前中心点"){
		return;
	}
	
	if (pointType==null) {
		$import('com.uumap.application.maps.search.*');
		sm = new SearchManager();
		pointType=0;
	}
	
	
	if (sm==null){
		 //载入sm失败
		 //alert('oh my god');
	}
	sm.locateType=pointType;
	if (pool!=null)
		sm.outputPool=pool;	
	else
		sm.outputPool=$('kw_match_list');
		
	sm.type="11";
	var this_instance=this;
	
	if (this_instance.type==4){
		//pco.chooseSubFunc('sn_','1','service,sn_3,sn_2','周边搜索');$('list').style.display='none';
	}else if (this_instance.type==2){
		this_instance.chooseSubFunc('','','bus_2,bus_3,service,bus_1,bus_near_title,left_tooltip','公交换乘');
	}else if (this_instance.type==3){
		this_instance.chooseSubFunc('','','dr_2,dr_1,service','驾车路线');
	}
	if (this_instance.type!=1 && pointType>0){
		if($('kw_pool'+pointType))
		$('kw_pool'+pointType).style.display='';
	}
	//清空点和线
	try{
		if (pointType==1){
			this_instance.pc.remove_a_point(dm.sPointIndex);
		}else if (pointType==2){
			this_instance.pc.remove_a_point(dm.ePointIndex);
		}
		this_instance.clearLines();
		//如果之前有做过公交，行车数据，要隐藏
		$('list').style.display="none";
		$('bus_route_bar').style.display="none";
	}catch(e){}
	try{
		//删除中间点
		if (sPointIndex!=-1) g_pc.remove_a_point(sPointIndex);
	}catch(e){}		
	//当没有搜索到结果时
	sm.onNoResult_addon=function (){
		//alert("很抱歉，uumap定位不了您输入的地址!");
		//alert(pointType);
		//alert("ms.locate "+pointType);
		$("kw_match_hint"+pointType).style.display='none';
		$("kw_match_hint"+pointType+"f").style.display='';
		if(pointType!=0){
		$('kw_match'+pointType).style.display='none';
		}else{
			alert("很抱歉，uumap定位不了您输入的地址!");
		}
		if (this_instance.synchronize){						
			(this_instance.syncArray.pop())();
			this_instance.synchronize=false;
		}		
	}
	
	//当搜索到结果时
	sm.afterGetResult_addon=function (){
		//$('kw_match').style.display='';

		
		//定位成功
		this_instance.hasLocated=true;
		//alert('在哪儿清了2？');
		//alert("trace pco.locate 怎么没出列表值呢?");
		if (pointType > 0){
			
			$("kw_match_hint"+pointType).style.display='';
			$("kw_match_hint"+pointType+"f").style.display='none';
					//alert(this_instance.synchronize);
					if (this_instance.synchronize){						
						setTimeout ("(pco.syncArray.pop())()","2500");
						this_instance.synchronize=false;
					}
					
			if (pointType==1){
//				var pos=getElementPos("sn_input_start_"+this_instance.type);
//				var x=pos.x-40;
//				var y=pos.y+20;
//				$('kw_match'+pointType).style.left=x+"px";
//				$('kw_match'+pointType).style.top=y+"px";
				$('kw_match'+pointType).style.display='';
				sm.locateStart_addon=function (){
					//alert(sm.centerObject.nameChi);
					var ro=sm.centerObject;
					//dm.setPoint(ro.jwx,ro.jwy,'s');
						$('sn_input_start_'+this_instance.type).value=ro.nameChi;
						dm.driveStartName=ro.nameChi;					
						dm.setPoint(ro.jwx,ro.jwy,'s');
						dm.startObject=ro;
						dm.startJwx=ro.jwx;
						dm.startJwy=ro.jwy;
	
//						$('kw_match1').style.display='none';
						
						if(sm.totalCount=="1"){
							//alert('单条记录');
							this_instance.readyRoute++;
						}
						if (this_instance.readyRoute==2){
							this_instance.getRoute(this_instance.type);
						}
					
				};
			}else if (pointType==2){
//				var pos=getElementPos("sn_input_end_"+this_instance.type);
//				var x=pos.x-40;
//				var y=pos.y+20;
//				$('kw_match'+pointType).style.left=x+"px";
//				$('kw_match'+pointType).style.top=y+"px";
				$('kw_match'+pointType).style.display='';
								
				sm.locateEnd_addon=function (){
					var ro=sm.centerObject;
					$('sn_input_end_'+this_instance.type).value=ro.nameChi;
					dm.driveEndName=ro.nameChi;						
					dm.setPoint(ro.jwx,ro.jwy,'e');
					dm.endObject=ro;
					dm.endJwx=ro.jwx;
					dm.endJwy=ro.jwy;	
			
//					$('kw_match2').style.display='none';
					if(sm.totalCount=="1"){
						//alert('单条记录');
						this_instance.readyRoute++;
					}
					if (this_instance.readyRoute==2){
						this_instance.getRoute(this_instance.type);
					}
				};
			}
			//判断个数
			var sch_count=sm.totalCount;
			//如果为1则直接定位
			if (sch_count==1){
				//alert('直接定位');
				sm.showLocation(0,null,pointType);
			}	

		}else{
			//如果是周边搜索的中心点locate
			try{
			//如果之前有数据，要清空
			this_instance.clearSearchResult();
			}catch(e){
				
			}
			//隐去其他的面板
			pco.chooseSubFunc('sn_','1','service,sn_3,sn_2','周边搜索');$('list').style.display='none';
			//将获得的值反邹到输入框
			
			//搜索模块中调用
			$('kw_match').style.display='';
			sm.locate_addon=function (){
				var pc=sm.pc;
				var ro=sm.centerObject;	
				$('sn_center_word').value=ro.nameChi;	
				//如果是公交的中心点
				if (this_instance.type=="2"){
					dm.startJwx=ro.jwx;
					dm.startJwy=ro.jwy;
					dm.startObject=ro;					
				}
				
						
				//左侧列表展现
				try{
					//逐个画点
				    var tempIndex=pc.create_a_point('centerpoint',ro.jwx,ro.jwy,"",ro.nameChi,"","customicon_tower_23_25_offical_i","off_h:-60,off_w:-10,auto_size:true",""); 			   		   
				    pc.pois[tempIndex].use_info="yes";		   
				    pc.pois[tempIndex].can_be_moved="no"; 	
					//this.outputPool.parent.style.display='none';
					$('kw_match').style.display='none';
				}catch(e){
					alert(e.message);
				}	
				//右侧点展开气泡	
				pc.pois[tempIndex].click();	
				
				//判断如果用户输了类别则直接去搜
				if ($('sn_center_type').value=='例：银行' || $('sn_center_type').value==""){
					//说明这个用户没选类别
					alert('请选择类别');
					$('sn_center_type').select();
					$('sn_center_type').focus();
					//隐去其他的面板
					pco.chooseSubFunc('service','','sn_3,sn_1,sn_2','周边搜索');$('list').style.display='none';					
				}else{
					pco.validate('near');pco.search('near',$('sn_center_type').value,$('listtable'));
				}	
			}	
			if (sm.totalCount==1){
				//alert('直接定位');
				sm.showLocation(0,null,0);
			}				
		}
	}
//	alert("what's wrong");
	sm.locate(keyword,cityCode,pool);
}
/**
 * 初始化公交行车页面双击
 */
PageControlObject.prototype.initSearchPoint = function (){
	//清除点，和线
	this.clearSearchResult();
	this.clearLines();
	//开启用户在搜索显示结果上自建点
	sm.clickToChooseStartFlag=true;
} 
/**
 * 初始化公交行车页面双击
 */
PageControlObject.prototype.initDrawPoint = function (){
	$('start_point_ok').style.display='none';
	$('start_point_modify').style.display='none';	
	$('end_point_ok').style.display='none';
	$('end_point_modify').style.display='none';
	start_finish=false;
	end_finish=false;	
	//清除点，和线
	this.clearSearchResult();
	this.clearLines();
	dm.step=0;
	dm.clickToChooseStartFlag=true;
	dm.sPointIndex=-1;
	dm.ePointIndex=-1;
	//起始点的名字清空
	dm.driveStartName=null;
	dm.driveEndName=null;
} 
/**
 * 通过点选，选择中心点
 */
PageControlObject.prototype.locateByDblClick = function (type){
	switch (type){
		case 'bus':
			//清除场内点线
			this.clearLines();
			this.clearSearchResult();
			dm.driveStartName="自定义中心点";
			dm.setCenter_addon = function (){
				//alert(dm.startJwx+","+dm.startJwy);
				dm.centerObject={nameChi:"自定义中心点",jwx:dm.startJwx,jwy:dm.startJwy};
				
			}
			dm.onErrorCallBack=function (){
				alert('点尚未定位');
			}
			dm.initCenterPoint();
		break;
	}
}
/**
 * 翻页
 */
PageControlObject.prototype.naviPage = function (type){
	if (sm!=null){
		if (this.keyword!="" && this.page < this.totalPage){
			
		}
		
		if (type=="prev" && sm.page>1 || type=="next" && sm.page<sm.totalPage){
	    	$('list').style.display='';
			$('loadingbar').style.display='';
			$('listtable').style.display='none';			
		}
		if (this.centerObject!=null) {
			sm.centerObject = this.centerObject;
		}
			if (type=="next"){				
				sm.nextPage();
			}else if (type=="prev"){
				sm.prevPage();
			}

		
	}	
}

/**
 * 装载页面时显示
 */
PageControlObject.prototype.loadPage = function (){
	$('leftBlock').innerHTML='装载页面中不要急!';
	//alert('d');
}
PageControlObject.prototype.clearLines=function (type){
	try{

		if (type=='road'){
			for(i=0;i<this.road_line.length;i++){
				this.road_line[i].remove();
			}
			this.road_line=new Array();
		}else{
			//alert("trace PCO.clearLines "+this.plc.length);
			//alert("trace PCO.clearLines dm.plc.length="+dm.plc.length);
			for(i=0;i<this.plc.length;i++){
				
				this.plc[i].remove();
			}
			this.plc=new Array();
			//dm.clearLines();
			
			for(i=0;i<this.road_line.length;i++){
				this.road_line[i].remove();
			}
			this.road_line=new Array();			
		}
		

	}catch(e){
		//alert(e.message);
	}	
};
/**
 * 清空结果
 */
PageControlObject.prototype.clearSearchResult = function (){
//	alert('trace PCO.clearSearchResult')
	//清除点阵
	this.pc.remove_all_points();
	this.pc.poi_now_index=-1;
	
	try{
		$('img_prevpage').style.display="";
		$('img_nextpage').style.display="";
	}catch(e){}
	
	try{
		//关闭移动时周边搜索
		this.disableSearchWhenMove();
		//清除小图点
		if (sPointIndex>-1){
			g_pc.remove_a_point(sPointIndex);
		}else{
			sPointIndex=-1;
		}
	}catch(e){
		
	}
}

/**
 * 切换左侧子功能的函数
 */
PageControlObject.prototype.chooseSubFunc = function (prefix,curid,hideid,value){
	var curs = curid.split(",");
		for (var i=0;i<curs.length;i++){
			try{
				$(prefix+curs[i]).style.display='';	
			}catch(e){}
			try{
				$(prefix+curs[i]+"c").style.display='';
			}catch(e){}			
		}
		

	var hides = hideid.split(",");
	for (var i=0;i<hides.length;i++){
		if($(hides[i])){
		$(hides[i]).style.display='none';
		}
	}
	$('helpList').style.display='none';
	if($('article_menu')){
		//$('article_menu').style.display='none';
	}
	//将当前的服务赋值到title
	if (value!=$('left_title').innerHTML){
		//$('left_title2').innerHTML=$('left_title').innerHTML;
		$('left_title').innerHTML=value;
		//$('map_on_funcname').innerHTML="->"+value;
	}
	//将菜单隐去
	//$('helpList').style.display='none';
}

PageControlObject.prototype.validate_error_addon=function (){}
/**
 * 周边搜索移动时查询
 */
PageControlObject.prototype.enableSearchWhenMove = function (updateCenter){
	var this_instance = this;
	if (null == updateCenter){
		updateCenter=true;
	}

	
	//将结果显示条再隐掉
	sm.afterGetResult_addon=function (){
		var centerObject = sm.centerObject;
		
		//alert('gogogo');
		this_instance.centerObject = centerObject;
		$('loadingbar').style.display='none';
		$('listtable').style.display='';		
		//将当前选中的值赋给内存中的中心点对象
		//sm.centerObject={jwx:'',jwy:'',nameChi:"当前中心点"};					
		$('page_info').innerHTML=sm.startRecord+"-"+sm.endRecord+"/"+sm.totalCount;
	    //显示当前移动搜索所获得个数
	    $('hot_navi_cnt').innerHTML="("+sm.totalCount+")";

	    $('res_switch').style.display='';	
		//todo 标出中心点,此处与分类搜索go_to_the_best_view 冲突了
		sm.setPoint(centerObject.jwx,centerObject.jwy,"s");		    
	    //在有结果的前提下，启动移动搜索
	    this_instance.enableSearchWhenMove(updateCenter);  
	    				    													
		ControlCountBlock();
	}	
	sm.enableSearchWhenMove();
}
/**
 * 禁止移动时搜索，参数 needClear true把当前结果清空 false 不清空，默认不清空
 */
PageControlObject.prototype.disableSearchWhenMove = function (needClear){
	if (needClear){
		this.clearSearchResult();
		this.clearLines();		
	}
	sm.disableSearchWhenMove();
}
/**
 * 强制取消掉本次ajax请求
 */
PageControlObject.prototype.abortThisQuery = function (){
	if (this.type==1){
		sm.ajaxHandle.abort();
		pco.chooseSubFunc('sn_map_block','','sn_line_block,sn_road_block,service,sn_3,sn_2,bus_near_res','地图搜索');$('list').style.display='none';pco.searchDisplay=1;
	}else if(this.type==2){
		g_dm.ajaxHandle.abort();
		pco.chooseSubFunc('','service','bus_3,bus_2,bus_1,bus_near_title,bus_near_res,left_tooltip','点选换乘');pco.initDrawPoint();dm.init();
	}else if (this.type==3){
		g_dm.ajaxHandle.abort();
		pco.chooseSubFunc('','service','dr_1,dr_2','点选查询');sm.clearSearchResult();pco.initDrawPoint();
		
	}else if (this.type==4){
		sm.ajaxHandle.abort();
		pco.chooseSubFunc('','service','sn_1,sn_3,sn_2','点选周边');$('list').style.display='none';pco.disableSearchWhenMove();pco.initSearchPoint();
	}
	
}

/**
 * 退回到初始面板
 */
PageControlObject.prototype.backToPanel = function (){
	if (this.type==1){
		pco.chooseSubFunc('sn_map_block','','sn_line_block,sn_road_block,service,sn_3,sn_2,bus_near_res','地图搜索');$('list').style.display='none';pco.searchDisplay=1;$('list').style.display='none';pco.disableSearchWhenMove();pco.initSearchPoint();
	}else if(this.type==2){
		pco.chooseSubFunc('','service','bus_3,bus_2,bus_1,bus_near_title,bus_near_res,left_tooltip','点选换乘');pco.initDrawPoint();dm.init();
	}else if (this.type==3){
		pco.chooseSubFunc('','service','dr_1,dr_2','点选查询');sm.clearSearchResult();pco.initDrawPoint();
		
	}else if (this.type==4){
		pco.chooseSubFunc('','service','sn_1,sn_3,sn_2','点选周边');$('list').style.display='none';pco.disableSearchWhenMove();pco.initSearchPoint();
	}
	
	$('left_title2').style.display='none';
	//将功能导航显示出来
	$('article_menu').style.display='';
	
}

PageControlObject.prototype.locate_addon = function (){
	
}
/**
 * 载入页面后的附加函数
 */
PageControlObject.prototype.loadPage_addon=function (){
	
}
/**
 * 智能搜索框提示
 */
PageControlObject.prototype.smartHint = function(type,keyword,cityCode,pool,co,eventKeyCode){	
	var busline = '';
	if (this.searchDisplay == 2){
		//如果是线路搜索，调智能小助手
		type='bus';
		busline = keyword;
	}else if(type='map'){

		//判断如果类别是公交的
		if (keyword.replace(/^\s*公交\s*$/g,'公交')=='公交' && type=='near'){
			//alert('进入公交周边');
			type='busnear';
		}else{
		
			//判断如果输入的关键字字中含有公交字样，则取其中的数字
			var busreg=/^公交(.*)$/;
			if (busreg.test(keyword)){
				var busline =RegExp.$1;
				//将可能存在的空格去掉
				busline=busline.replace(/\s*/gi,"");
				//alert(busline);
				$('searchText').value=""+busline;
				//alert("您输入的路线是"+busline);
				if (cityCode!="100000")
					type="bus";				
			}
		}		
		
	}

	if(type=='bus'){
		this.search('bus2',keyword,cityCode,pool,co);		
		findBusLines(eventKeyCode);
		this.searchDisplay=2;
	}else{		
		if(eventKeyCode==13){
		 this.search(type,keyword,cityCode,pool,co);
		}
	}
	
}

/**
 * 产品url的控制
 * 在公交和行车中,如果没有经纬度说明是模糊查询，调另外的函数
 * 周边搜索也是，如果没有经纬度说明则是模糊查询,调另外的函数
 */
PageControlObject.prototype.refConsole = function (type,argObj){
	this.type=type;
	var keywords = argObj.keyword;
	var kw_split = keywords.split(",");	
	if (type == 1){
		this.ref_url="?cityCode="+cityCode+"&tab=1";
		this.go2search('map',argObj.keyword,argObj.cityCode,null,null,argObj.page);
	}else if (type ==2 ){

		//公交
		var this_instance = this;
		if (argObj.swjx != null){
				this.loadPage_addon = function (){
					//设置两个点的位置
		
					
					dm.startObject={jwx:argObj.sjwx,jwy:argObj.sjwy,nameChi:kw_split[0]};	
					dm.driveStartName=kw_split[0];
					dm.startJwx = 	argObj.sjwx;
					dm.startJwy = 	argObj.sjwy;	
					dm.setPoint(dm.startJwx,dm.startJwy,'s');
					
					dm.endObject={jwx:argObj.ejwx,jwy:argObj.ejwy,nameChi:kw_split[1]};
					dm.driveEndName=kw_split[1];	
					dm.endJwx = 	argObj.ejwx;
					dm.endJwy = 	argObj.ejwy;			
					dm.setPoint(dm.endJwx,dm.endJwy,'e');			
					//dm.getBusTransfer($('listtable'));
					start_finish = true;
					end_finish = true;		 
					this_instance.getRoute('bus');
				}
		}else{
				this.loadPage_addon = function (){
					//设置两个点的位置
					this_instance.autoLocate(kw_split[0],kw_split[1],$('kw_match_list'),$('kw_match_list2'));					
				}			
		}		
		
		
		this.switchTab(2);
		

		
	}else if (type ==3 ){
		//驾车导航	
		var this_instance = this;
		if (argObj.swjx != null){
				this.loadPage_addon = function (){
					//设置两个点的位置
		
					
					dm.startObject={jwx:argObj.sjwx,jwy:argObj.sjwy,nameChi:kw_split[0]};	
					dm.driveStartName=kw_split[0];
					dm.startJwx = 	argObj.sjwx;
					dm.startJwy = 	argObj.sjwy;	
					dm.setPoint(dm.startJwx,dm.startJwy,'s');
					
					dm.endObject={jwx:argObj.ejwx,jwy:argObj.ejwy,nameChi:kw_split[1]};
					dm.driveEndName=kw_split[1];	
					dm.endJwx = 	argObj.ejwx;
					dm.endJwy = 	argObj.ejwy;			
					dm.setPoint(dm.endJwx,dm.endJwy,'e');	
					
					//dm.getBusTransfer($('listtable'));
					start_finish = true;
					end_finish = true;		 
					 this_instance.getRoute('drive');
				}
		}else{
				this.loadPage_addon = function (){
					//设置两个点的位置
					this_instance.autoLocate(kw_split[0],kw_split[1],$('kw_match_list'),$('kw_match_list2'));					
				}			
		}
		this.switchTab(3);		
	}else if (type ==4 ){
		//var keywords = argObj.keyword;
		//var kw_split = keywords.split(",");
		this.ref_url="?cityCode="+cityCode+"&tab=4";
		
		if (argObj.jwx != null){		
			var centerObject={jwx:argObj.jwx,jwy:argObj.jwy,nameChi:kw_split[0]};
			this.hasLocated=true;
			this.search('near',kw_split[1],argObj.cityCode,null,centerObject,argObj.page);
		}else{
			var this_instance = this;
			this.loadPage_addon = function (){
				this_instance.locate(kw_split[0],kw_split[1],0);	
			}
			this.switchTab(4);	
		}
	}
}

/**
 * 读取IP逻辑
 */
PageControlObject.prototype.checkIP = function(ipaddr){
			var url="ipagent.jsp";
			
			if (document.all){
			httpLoad(url,this.checkIPCallBack,event);
			//alert("url"+url);
			}else{
			httpLoad(url,this.checkIPCallBack,window.event);
			//alert("url"+url);
			}	
			
			
}
PageControlObject.prototype.checkIPCallBack = function(xmlhttp){
	var jsonDoc = xmlhttp.responseText;
	
	root = jsonDoc.parseJSON();
	//alert(root.searchRoot);
	var list = root.searchResult;
//	alert(list.length);
//	alert(list[0].cityName+","+list[0].cityDetail);
	pco.setPoint(Number(list[0].jwx),Number(list[0].jwy),'stop','您所在的位置:'+list[0].cityDetail);
	if (sm!=null){
		//this.setPoint(Number(list[0].jwx),Number(list[0].jwy),'stop','您所在的位置:'+list[0].cityDetail);
	}else{
	}
}
/**
 * 画点
 */
PageControlObject.prototype.setPoint = function (jwx,jwy,type,info){

	if (type=='stop'){
		try{
			
			if (this.ePointIndex!=-1){
				this.pc.remove_a_point(this.ePointIndex);
			}
			this.ePointIndex=this.pc.create_a_point('clw_stop_point',jwx,jwy,info,"","","customicon_tower_22_28_offical_1","off_h:-60,off_w:0,auto_resize:yl","");
		
			this.pc.pois[this.ePointIndex].use_info="yes";
			this.pc.pois[this.ePointIndex].use_hint="no";
			this.pc.pois[this.ePointIndex].can_be_moved="no";
	
			//自动将信息展现开
			this.pc.click_a_point(this.ePointIndex);
			//this.startJwx=jwx;
			//this.startJwy=jwy;	
		
		}catch(e){
			//alert(e.message);
		}		
	}

}
/**
 * 将用户的查询记录到cookie中
 */
PageControlObject.prototype.recordHistory = function (recordName){
	var uumap_his=getCookie('uumap_history');
	var newHis = recordName+"|"+this.ref_url+this.ref_query;
	this.keyword=recordName;
	uumap_his += "|^"+newHis;
	setCookie('uumap_history',uumap_his);
	//$("history_url").innerHTML = "<a href='"+this.ref_url+this.ref_query+"' target='_blank'>"+recordName+"</a>";
	//$("historyList").innerHTML = "<li>"+"<a href='"+this.ref_url+this.ref_query+"' target='_blank'>"+recordName+"</a>"+"</li>"+$("historyList").innerHTML;
}
/**
 * 将用户的查询记录显示到页面中,每次仅写5条,从最近的时间开始
 */
PageControlObject.prototype.viewHistory = function (recordName){

	var uumap_his=getCookie('uumap_history');
	if (uumap_his == null) return;
	var historys = uumap_his.split("|^");
	$("historyList").innerHTML = "";
	var len = 5;
	if (len > historys.length){ len = historys.length;}
	//for (var i=historys.length-1;i>=historys.length-1-len;i--){
	for (var i=0;i<len;i++){
		if (historys[i] == null || historys[i]=="null") continue;
		var temp = historys[i].split("|");
		if (temp[0] == "null" || temp[1] == "null" )  continue;
		$("historyList").innerHTML = "<li>"+"<a href='"+temp[1]+"' target='_blank'>"+temp[0]+"</a>"+"</li>"+$("historyList").innerHTML;
		
	}
}

/**
 * 将用户的查询记录到cookie中
 */
PageControlObject.prototype.recordFav = function (recordName){
	var uumap_his=getCookie('uumap_history');
	var newHis = recordName+","+this.ref_url+this.ref_query;
	uumap_his += "|"+newHis;
	setCookie('uumap_history',uumap_his);
	$("history_url").innerHTML = "<a href='"+this.ref_url+this.ref_query+"' target='_blank'>"+recordName+"</a>";
	$("historyList").innerHTML = "<li>"+"<a href='"+this.ref_url+this.ref_query+"' target='_blank'>"+recordName+"</a>"+"</li>"+$("historyList").innerHTML;
}
/**
 * 将用户的查询记录显示到页面中,每次仅写5条,从最近的时间开始
 */
PageControlObject.prototype.viewFav = function (recordName){
	var uumap_his=getCookie('uumap_history');
	alert(uumap_his);
	var historys = uumap_his.split("|");
	$("historyList").innerHTML = "";
	var len = 5;
	for (var i=historys.length-1;i>=historys.length-1-len;i--){
		var temp = historys[i].split(",");
		$("historyList").innerHTML = "<li>"+"<a href='"+temp[1]+"' target='_blank'>"+temp[0]+"</a>"+"</li>"+$("historyList").innerHTML;
		
	}
}

/**
 * 搜索结果的抽象类
 */
function ResultObject (){
		   this.nameChi="";	 	     
		   this.address="";	    
		   this.phone="";	 
		   this.website="";	 
		   this.jwx="";	    	   
		   this.jwy="";	 
		   this.iconName="";	 
		   this.geoInfoType="";	 
		   this.id="";	 
		   this.uumapURL="";	 
		   this.jws="";
		   this.viewLevel=0;
		   this.type="";
		   this.precise="";
		   //和周边搜索有关的属性
		   //和UI有关的属性
		   this.drawed=false;
		   this.radius=0;
		   this.distance=0;
}
//一些公用的函数
//控制显示数量样式
function ControlCountBlock(){
					return;
				    if (sm.totalCount>10 && $('pi_set10').getAttribute("class")!="lq_3c"){
				   		$('pi_set10').setAttribute("class","lq_3b");
				    	$('pi_set10').setAttribute("className","lq_3b");
				    }
				    if (sm.totalCount>25 && $('pi_set15').getAttribute("class")!="lq_3c"){
				    	$('pi_set15').setAttribute("class","lq_3b");
				    	$('pi_set15').setAttribute("className","lq_3b");
				    }
				    if (sm.totalCount>40 && $('pi_set20').getAttribute("class")!="lq_3c"){
				    	$('pi_set20').setAttribute("class","lq_3b");
				    	$('pi_set20').setAttribute("className","lq_3b");
				    }
}

//浏览器兼容性相关参数
String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
};
var MapEngine = {
getElementById:function (id){
	return window.frames['map_engine_frame'].document.getElementById(id);
},
getElementsByName:function (name){
	return window.frames['map_engine_frame'].document.getElementsByName(name);
}
};
function getNavigator (action){
	//httpLoad("/management/uumapTypeAjax.jsp",function (xmlhttp){alert(xmlhttp.responseText);},action);
}
var start_finish=false;
var end_finish=false;
//开启修改
function allowDrawPoint (type){
	
	if (type=='c'){
		document.getElementById('start_point_ok').style.display='none';
		document.getElementById('start_point_modify').style.display='none';
		return;
	}
	
	g_dm.clickToChooseStartFlag=true;
	var temp_step=g_dm.step;
	var ptype=0;
	if (type=='s'){
		g_dm.step=0;
		start_finish=false;
		document.getElementById('start_point_ok').style.display='none';
		document.getElementById('start_point_modify').style.display='none';		
		//alert(end_finish);
		//添加一些根据本页特殊业务需求而需要的信息
		g_dm.setStart_addon=function (){
			document.getElementById('start_point_ok').style.display='';
			document.getElementById('start_point_modify').style.display='';
			//alert(temp_step);
			if (temp_step>1)
				g_dm.clickToChooseStartFlag=false;
				start_finish=true;
				if (end_finish==true)
						g_dm.step=2;
				else
						g_dm.step=0;
			//$('sn_input_start_'+pco.type).value="自定义起点";		
		};
		
	}else if (type=='e'){
		if (start_finish==true){
			g_dm.step=1;
		}else{
			g_dm.step=0;
			g_dm.setStart_addon=function (){
				document.getElementById('start_point_ok').style.display='';
				document.getElementById('start_point_modify').style.display='';
				//alert(temp_step);
				if (temp_step>1)
					g_dm.clickToChooseStartFlag=false;
					start_finish=true;
				//$('sn_input_start_'+pco.type).value="自定义起点";
			};			
				
		}
		end_finish=false;
		document.getElementById('end_point_ok').style.display='none';
		document.getElementById('end_point_modify').style.display='none';	
		//添加一些根据本页特殊业务需求而需要的信息
		g_dm.setEnd_addon=function (){
			document.getElementById('end_point_ok').style.display='';
			document.getElementById('end_point_modify').style.display='';
			end_finish=true;
			//$('sn_input_end_'+pco.type).value="自定义终点";
		}	
	}else if (type=='c'){
		//alert('修改中心点');
	}
	
}
//用于打印
var g_result_url="";
function printCurrentResult(){
		
		try{
		if (g_dm.result_url != null && g_dm.result_url != '' ){
			//alert('系统将弹出一个窗口来显示您要打印的页面，如果该窗口未弹出请检查您的安全工具是否屏蔽了弹出窗口');
				if (dm.prefix=='bus')
					window.open('/maps/print/print_bus.jsp?'+g_dm.result_url);
				else if (dm.prefix=='dr')
					window.open('/maps/print/print_dr.jsp?'+g_dm.result_url);
					//g_dm.result_url = null;

		}else{
			alert('请先做查询');
		}
		}catch(e){
			alert('该功能暂未开通打印');
		}		
		//window.location.href='/test/print/index_print.jsp?'+g_dm.result_url;

}
function getReferenceURL(){
	window.open(pco.ref_url+pco.ref_query);

}
//用于保存
function printCurrentMap(){

			alert('系统将弹出一个窗口来显示您要保存的页面，如果该窗口未弹出请检查您的安全工具是否屏蔽了弹出窗口');
		//	alert(map_engine.mymap.getLevel());
			window.open('/mapbase/route.action?cx='+map_engine.mymap.getCenterJwOf("jwx")+"&cy="+map_engine.mymap.getCenterJwOf("jwy")+"&tz="+map_engine.mymap.level+"&oz=1&");


}
//用于发送邮件
function sendMail(){
	/*
	var emailto=window.prompt("请输入你要发送的对象之email:","chenlw@uumap.com");
	if (emailto==null){
		return;
	}
	*/
	emailto = $('mail2user').value;
	
	if (emailto=='' || emailto=='undefined'){
		 alert('email不能为空');
		 return;
	}

	var c_jwx=(dm.startJwx+dm.endJwx)/2;
	var c_jwy=(dm.startJwy+dm.endJwy)/2;	

	//window.open("/maps/print/sendPrintDo.jsp?frm="+URLEncode(dm.driveStartName)+"&to="+URLEncode(dm.driveEndName)+"&c_jwx="+c_jwx+"&c_jwy="+c_jwy+"&s_jwx="+dm.startJwx+"&s_jwy="+dm.startJwy+"&t_jwx="+dm.endJwx+"&t_jwy="+dm.endJwy+"&emailto="+emailto+"&type="+(Number(pco.type)-2)+"&steps="+"&rb="+pco.driveRouteType);
	var url="/maps/print/sendPrintDo.jsp?frm="+URLEncode(dm.driveStartName)+"&to="+URLEncode(dm.driveEndName)+"&c_jwx="+c_jwx+"&c_jwy="+c_jwy+"&s_jwx="+dm.startJwx+"&s_jwy="+dm.startJwy+"&t_jwx="+dm.endJwx+"&t_jwy="+dm.endJwy+"&emailto="+emailto+"&type="+(Number(pco.type)-2)+"&steps="+"&rb="+pco.driveRouteType;
	if (document.all){
		httpLoad(url,sendMailCallBack,event);
	}else{
		httpLoad(url,sendMailCallBack,window.event);
	}
}
function sendMailCallBack(response){
	var str=response.responseText;
	if (str.indexOf('ok')>-1){
		alert('发送成功');
		//$('mailtoBox').style.display="none";
	}else{
		alert(str);
	}
}

//发送评价
function sendComment(){
	var note = URLEncode($("cmtNote").value);
	var code = "310000";
	
	var fromPlace;
	var toPlace;
	var sjwx;
	var sjwy;
	var ejwx;
	var ejwy;			
	var keyword;
	keyword = URLEncode(pco.keyword);
	if (pco.type == 1 || pco.type == 4){
		 sjwx = 0;
		 sjwy = 0;
		 ejwx = 0;
		 ejwy = 0;
	}else{
		try{
			 fromPlace = URLEncode(dm.startObject.nameChi);
			 toPlace = URLEncode(dm.endObject.nameChi);
			 sjwx = dm.startObject.jwx;
			 sjwy = dm.startObject.jwy;
			 ejwx = dm.endObject.jwx;
			 ejwy = dm.endObject.jwy;
		}catch(e){
			alert(e.message);
			 sjwx = 0;
			 sjwy = 0;
			 ejwx = 0;
			 ejwy = 0;			
		}		
	}
	//组装评价url
		var businessCode = pco.type;

		var resultCount = 3;
		//var cmtCityCode = cityCode;
		var resultBack=URLEncode($("cmtNote").value);
		var resultRank = "";
		var cmtRanks = document.getElementsByName("cmtRank");
		for (var i=0;i<cmtRanks.length;i++){
			if (cmtRanks[i].checked == true){
				resultRank=cmtRanks[i].value
				break;
			}
			
		}
	var requestURL = pco.ref_url+URLEncode(pco.ref_query);
	
	requestURL = requestURL.replace(/&/g,"^");

	

	var url="poi/report.action?businessCode="+businessCode+"&fromPlace="+fromPlace;
	url += "&toPlace="+toPlace+"&sjwx="+sjwy+"&sjwy="+sjwy+"&ejwx="+ejwx+"&ejwy="+ejwy;
	url += "&resultCount="+resultCount+"&cityCode="+cityCode+"&resultBack="+resultBack+"&resultRank="+resultRank;
	url += "&requestURL="+requestURL+"&keyword="+keyword;
	
	//document.write(url);
	//alert(url);
	
	if (document.all){
		httpLoad(url,sendCommentCallBack,event);
	}else{
		httpLoad(url,sendCommentCallBack,window.event);
	}
}
function sendCommentCallBack(response){
	var str=response.responseText;
	if (str.indexOf('ok')>-1){
		alert('评价成功');
		//$('mailtoBox').style.display="none";
	}else{
		alert(str);
	}
}


//全国城市，暂放这里
var cdomain=window.location.host;
if (cdomain.indexOf(".")>-1){
	cdomain=cdomain.substring(cdomain.indexOf("."));
}else{
	cdomain=cdomain.substring(cdomain.indexOf("/"));
}
function cityByPro (p,c){
	if (p==""){
		//直辖市
			var url="http://"+c+cdomain+"/maps";
			recordFavoriteCity(url);
			window.location.href=url;		
	}else{
		//普通城市
		var str=cityList[p];
		var reg=new RegExp(".*"+c+"市\\|(\\w*).*","g");	
		if (reg.test(str)){
			var cityUrl=(RegExp.$1);
			var url="http://"+cityUrl+cdomain+"/maps";
			recordFavoriteCity(url);
			window.location.href=url;
		}else{
			alert('对不起，该城市尚未开通');
		}
	}
}
function getNoDataHTML(type){
	var actionArray = new Array();
//	var map=0;
//	var 
	var index=0;
	if (type=="map")index=0;
	else if (type=="type") index=1;
	else if (type=="near") index=2;
	else index=1;
	actionArray.push("pco.chooseSubFunc('sn_map_block','','sn_line_block,sn_road_block,service,sn_3,sn_2,bus_near_res','地图搜索');$('list').style.display='none';pco.searchDisplay=1;");
//	actionArray.push("pco.chooseSubFunc('sn_line_block','','sn_map_block,sn_road_block,service,sn_3,sn_2,bus_near_res','线路查询');$('list').style.display='none';pco.searchDisplay=2;pco.disableSearchWhenMove(true);");
//	actionArray.push("pco.chooseSubFunc('sn_road_block','','sn_map_block,sn_line_block,service,sn_3,sn_2,bus_near_res','道路查询');$('list').style.display='none';pco.searchDisplay=3;pco.disableSearchWhenMove(true);");
	actionArray.push("pco.chooseSubFunc('sn_','3','sn_line_block,sn_road_block,sn_map_block,sn_1,service,sn_2,bus_near_res','分类搜索');$('list').style.display='none';pco.searchDisplay=0;pco.disableSearchWhenMove(true);");
	actionArray.push("pco.chooseSubFunc('','service','sn_1,sn_3,sn_2','点选周边');$('list').style.display='none';pco.disableSearchWhenMove();pco.initSearchPoint();");	
	
	var nodata='<li class="no_result">当前范围条件下没有符合你搜索的数据，请返回。</li>'+
		'<li class="listtable_bottom"></li>'+
		'<li class="listtable_return"><img src="../engine/style/loadstyle/return_last.gif" alt="返回上一步" width="70" height="19" onclick="'+actionArray[index]+'"></li>';
	return nodata;
}
var showHistory = function(obj)
{
	$('mailBlock').style.display='none';
	$('pannelBlock').style.display='none';
	$('printBlock').style.display='none';		
	//先判断历史里面的值是否为空 
	if ($("historyList").innerHTML == ""){
		pco.viewHistory();
	}else{
	//	alert("dd");
	}
	
	var position = getPosition(obj);
	var top = position.top;
	var left = position.left;
	
	var cityList = $("historyListBlock");
	cityList.style.position = "absolute";
	cityList.style.left = left ;
	cityList.style.top = top + 20;
	cityList.style.width = "300px";
	cityList.style.height = "150px";
	cityList.style.display = "";
	
}
var showingHdl = null;
var showingId = null;
var showBlock = function(id,obj,height)
{

	var position = getPosition(obj);
	var top = position.top;
	var left = position.left;
	
	var cityList = $(id);
	cityList.style.position = "absolute";
	cityList.style.left = left ;
	cityList.style.top = top + 20;
	cityList.style.width = "300px";
	if (height == null){
		cityList.style.height = "150px";
	}else{
		cityList.style.height = height+"px";
	}
	cityList.style.display = "";

		
}

function showPrintConfirm (){
	$('mailBlock').style.display='none';
	$('pannelBlock').style.display='none';
	$('historyListBlock').style.display='none';	
	$('commentBlock').style.display='none';
	showBlock ('printBlock',$('map_top'));	
}
function showMailConfirm (){
	$('printBlock').style.display='none';
	$('pannelBlock').style.display='none';
	$('historyListBlock').style.display='none';
	$('commentBlock').style.display='none';
	showBlock ('mailBlock',$('map_top'));	
}
function showPanelConfirm (){
	$('printBlock').style.display='none';
	$('mailBlock').style.display='none';
	$('historyListBlock').style.display='none';	
	$('commentBlock').style.display='none';
	showBlock ('pannelBlock',$('map_top'));	
}

function showCommentConfirm (){
	$('printBlock').style.display='none';
	$('mailBlock').style.display='none';
	$('historyListBlock').style.display='none';	
	$('pannelBlock').style.display='none';	
	showBlock ('commentBlock',$('map_top'),270);	
}





PageControlObject.prototype.searchBusLine = function(strSrc){
	
	$("bl_table").src=strSrc;
	
}
PageControlObject.prototype.changeLeftWidth = function(width){
	if (width == 0){
		$("leftBlock").style.display="none";	
	}else{
		if ($("leftBlock").style.display == "none"){
			$("leftBlock").style.display = "";
		}
		$("main").style.width=width+'px';
	}
}
