var iIntervalID;
var gj1;
var gj2;
function mtSubmitGJRoute()
{
	var Method
	var maptool = "QueryBusTransfer";
	var sPT = document.all.txt1.value;
	var ePT = document.all.txt2.value;
	gj1=sPT;
	gj2=ePT;
	Method = document.all.selMethod.options[ document.all.selMethod.selectedIndex ].value;
	if(sPT == ""){
	alert("请输入起点！");
	return
	}
	if(ePT == ""){
	alert("请输入终点！");
	return
	}
	var param="ResultOrder==300,300!!FeatureDescType==Name,,;Name,,!!FeatureDesc=="+sPT+":ALL;"+ePT+":ALL!!QueryBusTransfer=="+Method+",500!!QueryBusTansferParamEx==1";
	finalSubmit( maptool, param);
}

function mtSubmitRouteSearch(s)
{ 
	//var aaa = window.open( url+param,"xinxichaxun","width=420,height=430,top=5,left=360,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes","searchroute");
	//var bbb;
	//open("http://bjbus2002_fang/bus_map/mappage.asp",null,"width=400,height=300");
	//var url = "http://www.bjbus.com/searchline/buslinesearch.asp?linename=";
	
	//var url = "../searchline/buslinesearch.asp?linename="
	var param;
	
	if(s == '')
 		param = document.all.txtFindBus.value;
 	else {
 		var aryTemp = s.split("==");
 		param = aryTemp[1]
 	}
	
	var url = "http://www.bjbus.com/bus_map/mappage.asp?hidden_MapTool=&hidden_Variant=DestGeoset==北京!!HirerID==bjbus!!ShowMap==2!!MapImageSize==605,360&hidden_MapZoom=9.08&hidden_MapCenterX=116.3&hidden_MapCenterY=39.8&InitInput=线路查询&openin=1&linenum=" + document.all.txtFindBus.value;

	if (zbian.checked == true){
		window.open(url,"newwindow","width=790,height=500,top=2,left=2,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes");
	}
	/*if (zbian.checked == true){
 	//alert(url+param);

	if(bbb != null){
	bbb.close();
 		//window.open("http://bjbus2002_fang/bus_map/mappage.asp?hidden_MapTool=LabelBusStation&hidden_Variant=LineFID==731!!SeqNum==" + "1" + "!!DestGeoset==北京公交!!HirerID==bjbus","map");
		//aaa = window.open( url+param,"xinxichaxun","width=420,height=450,top=2,left=370,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes,location=yes","searchroute");
		iIntervalID = window.setInterval("jiaodian()",3000);
		jiaodian();
		//aaa;
			}else{
			aaa = window.open( url+param,"xinxichaxun","width=420,height=450,top=2,left=370,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes,location=yes","searchroute");
			iIntervalID = window.setInterval("jiaodian()",3000);
			//jiaodian();
			}
		}*/
		
	if(zbian.checked == false){
		var url = "../searchline_1/buslinesearch.asp?linename="
		if(aaa != null){
		aaa.close();
		//newwindow.close();
		
		//bbb = window.open( url+param,null,"width=420,height=430,top=5,left=360,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes","searchroute");
		} 
		if(objOutputWindow != null) {
		objOutputWindow.close();
		}
		if(xixi != null) {
		xixi.close();
		}
		if(xinxi != null) {
		xinxi.close();
		}
		document.all.layLoading.style.left = 106;
		document.all.layLoading.style.top = 183;
			bbb = window.open( url+param,"xinxichaxun","width=420,height=255,top=2,left=370,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no","searchroute");
	}
}
function jiaodian(){
	aaa.focus()
	window.clearInterval(iIntervalID);
}
///////////////////////////////////////////////


function closewindow()
{
	newwindow.close();
}

function f_go2mapline()
{
	window.open("http://www.bjbus.com/bus_map/mappage.asp?hidden_MapTool=LabelBusStation&hidden_Variant=LineFID==731!!SeqNum==" + "1" + "!!DestGeoset==北京!!HirerID==bjbus!!MapImageHeight==360!!MapImageWidth==605","map","width=790,height=500,top=2,left=2,resizable=0,scrollbars=yes,menubar=yes,toolbar=yes,location=yes");
}
var FindNearestName="";
var FindNearestLayer="";
var FindNearest="";
function mtSubmitQueryFindZBHJ()
{
	var maptool = "FindNearest"
	var searchRadiu = ".5";
	var centerName = text1.value;
	FindNearestName=centerName;
	var areaName = SearchLayerFindZBHJ.options[SearchLayerFindZBHJ.selectedIndex].value;
	FindNearestLayer=areaName;
	var param = "hidden_MapTool=" + maptool + "&hidden_Variant=HirerID==bjbus!!DestGeoset==北京!!MapImageSize==605,360!!ShowMap==1";
	param+= "!!FeatureDescType==Name,,!!ResultOrder==10!!FeatureDesc=="+ centerName +":all!!ObjectLayers=="+areaName+"!!ObjectName==&InitInput=周边环境";
	FindNearest="http://www.bjbus.com/bus_map/mappage.asp?"+param+"&FindNearestLayer="+areaName;
	if (zbian.checked == true){
	var mpURL = "http://www.bjbus.com/bus_map/mappage.asp?";
	var url = mpURL + param+"&FindNearestLayer="+areaName;
	if(objOutputWindow != null) {
		objOutputWindow.close();
	}
	if(document.all.text1.value == "") {
		alert("关键字不能为空！")
		return
	}
	xixi = open( url,"map","width=790,height=500,top=2,left=2,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes" );
	}else{
	if(xixi != null) {
		xixi.close();
	}
	if(xinxi != null) {
		xinxi.close();
	}
	if(objOutputWindow != null) {
		objOutputWindow.close();
	}
	if(bbb != null) {
		bbb.close();
	}
	if(aaa != null) {
		aaa.close();
	}
	if(document.all.text1.value == "") {
		alert("关键字不能为空！")
		return
	}
	document.all.layLoading.style.left = 111;
	document.all.layLoading.style.top = 243;
	mtQuerySubmit( maptool, param )
	}
}

var GJmethodview
function finalSubmit( maptool, vt)
{
	//var curCity = document.all.N_CityName.value;
	var curCity = "北京"
	if(maptool=="QueryBusTransfer")
		{
			if(document.all.selMethod.options[ document.all.selMethod.selectedIndex ].value==0)
			{
				GJmethodview="距离短";
			}else{
				GJmethodview="月票有效";
			}
		}

	if (duoxuan.checked == true){
	var param = "hidden_MapTool=" + maptool;
	if(maptool=="QueryBusTransfer")
		{
			if(document.all.selMethod.options[ document.all.selMethod.selectedIndex ].value==0)
			{
				param+="&GJmethodview=距离短";
			}else{
				param+="&GJmethodview=月票有效";
			}
		}
	param += "&hidden_Variant=" + vt + "!!HirerID==bjbus!!DestGeoset==北京!!MapImageSize==605,360&InitInput=公交换乘&s=" + document.all.txt1.value + "&e=" + document.all.txt2.value+"&gjMothed="+document.all.selMethod.options[ document.all.selMethod.selectedIndex ].value;
	var mpURL = "http://www.bjbus.com/bus_map/mappage.asp?";
	var url = mpURL + param
	
	if(objOutputWindow != null){
	objOutputWindow.close();
	}
	if(aaa != null){
	aaa.close();
	}
	xinxi = open( url,"map","width=790,height=500,top=2,left=2,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,location=yes" );
	}else if (duoxuan.checked == false){
	if(xinxi != null){
	xinxi.close();
	}
	if(xixi != null) {
		xixi.close();
	}
	if(objOutputWindow != null) {
		objOutputWindow.close();
	}
	if(bbb != null) {
		bbb.close();
	}
	if(aaa != null) {
		aaa.close();
	}
	document.all.layLoading.style.left = 111;
	document.all.layLoading.style.top = 133;
	mtSubmitQueryGJRoute();
	}

	
}
