var divArray=new Array("m001","m002","o011","o012","o021","o022","o031","o032","o041","o042");
var urls="http://www.mapbar.com/localsearch/index.html";
function iniddiv(){
	var CID="192168016";
	var did="o032";
	if(CID=="" || did==""){
		return;
	}
	
	var mid="";
	var word="y";
	var kw="100";
	var bw="200";
	var bs="n";
	var sl="t";
	var ss="";
	var bst="";
	if(checkDid(did)){
		
		document.getElementById(did).style.display="block";
		document.getElementById(did).style.width=bw+"px";
		if(bs=="y"){
			document.getElementById(did).style.border="1px solid #ccc";
		}else if(bs=="n"){
			document.getElementById(did).style.border="0px solid #ccc";
		}
		if(did=="m001"){
			if(mid!=""){
				if(mid.indexOf("k")!=-1){
					document.getElementById("NavBarTagB1").style.display="inline";
					document.getElementById("m001kt").style.width=kw+"px";
				}
				if(mid.indexOf("b")!=-1){
					document.getElementById("NavBarTagB2").style.display="inline";
					var tw=(kw-30)/2;
					document.getElementById("m001bbt1").style.width=tw+"px";
					document.getElementById("m001bbt2").style.width=tw+"px";
					document.getElementById("m001blt").style.width=kw+"px";
					document.getElementById("m001bst").style.width=kw+"px";
				}
				if(mid.indexOf("c")!=-1){
					document.getElementById("NavBarTagB3").style.display="inline";
					var tw=(kw-108)/2;
					document.getElementById("m001ct1").style.width=tw+"px";
					document.getElementById("m001ct2").style.width=tw+"px";
				}
				if(mid.indexOf("n")!=-1){
					document.getElementById("NavBarTagB4").style.display="inline";
					var tw=(kw-52)/2;
					document.getElementById("m001nt1").style.width=tw+"px";
					document.getElementById("m001nt2").style.width=tw+"px";
				}
				var m=mid.substring(0,1);
				if(m=="k"){
					document.getElementById("searchForm1").style.display="block";
					document.getElementById("NavBarTagB1").className="onDownA";
				}else if(m=="b"){
					document.getElementById("searchForm2").style.display="block";
					document.getElementById("NavBarTagB2").className="onDownA";
				}else if(m=="c"){
					document.getElementById("searchForm3").style.display="block";
					document.getElementById("NavBarTagB3").className="onDownA";
				}else if(m=="n"){
					document.getElementById("searchForm4").style.display="block";
					document.getElementById("NavBarTagB4").className="onDownA";
				}
			}

		}else if(did=="m002"){
			if(mid!=""){
				if(mid.indexOf("k")!=-1){
					document.getElementById("NavBarTagC1").style.display="inline";
					document.getElementById("m002kt").style.width=kw+"px";
				}
				if(mid.indexOf("b")!=-1){
					document.getElementById("NavBarTagC2").style.display="inline";
					document.getElementById("m002bbt1").style.width=kw+"px";
					document.getElementById("m002bbt2").style.width=kw+"px";
					document.getElementById("m002blt").style.width=kw+"px";
					document.getElementById("m002bst").style.width=kw+"px";
				}
				if(mid.indexOf("c")!=-1){
					document.getElementById("NavBarTagC3").style.display="inline";
					document.getElementById("m002ct1").style.width=kw+"px";
					document.getElementById("m002ct2").style.width=kw+"px";
				}
				if(mid.indexOf("n")!=-1){
					document.getElementById("NavBarTagC4").style.display="inline";
					document.getElementById("m002nt1").style.width=kw+"px";
					document.getElementById("m002nt2").style.width=kw+"px";
				}
				var m=mid.substring(0,1);
				if(m=="k"){
					document.getElementById("searchFormC1").style.display="block";
					document.getElementById("NavBarTagC1").className="onDownA";
				}else if(m=="b"){
					document.getElementById("searchFormC2").style.display="block";
					document.getElementById("NavBarTagC2").className="onDownA";
				}else if(m=="c"){
					document.getElementById("searchFormC3").style.display="block";
					document.getElementById("NavBarTagC3").className="onDownA";
				}else if(m=="n"){
					document.getElementById("searchFormC4").style.display="block";
					document.getElementById("NavBarTagC4").className="onDownA";
				}
			}
		}else{
			if(did!="o022" && did!="o032"){
				if(word=="n"){
					document.getElementById(did+"word").style.display="none";
				}else{
					if(did=="o021" || did=="o031" || did=="o041"){
						if(sl=="l"){
							document.getElementById(did+"wordl").style.display="";
							document.getElementById(did+"wordt").style.display="none";
						}
					}
				}
			}
			if(did=="o011" || did=="o012"){
				document.getElementById(did+"kw").style.width=kw+"px";
			}else if(did=="o021" || did=="o022"){
				if(bst.indexOf("b")!=-1){
					document.getElementById(did+"b").style.display="inline";
					if(did=="o021"){
						var wh=(kw-15)/2;
						document.getElementById("o021bt1").style.width=wh+"px";
						document.getElementById("o021bt2").style.width=wh+"px";
					}else if(did=="o022"){
						document.getElementById("o022bt1").style.width=kw+"px";
						document.getElementById("o022bt2").style.width=kw+"px";
						if(ss=="r"){
							document.getElementById("o022ssb").style.display="";
						}
					}
				}
				if(bst.indexOf("l")!=-1){
					document.getElementById(did+"l").style.display="inline";
					if(did=="o021"){
						document.getElementById("o021lt").style.width=kw+"px";
					}else if(did=="o022"){
						document.getElementById("o022lt").style.width=kw+"px";
						if(ss=="r"){
							document.getElementById("o022ssl").style.display="";
						}
					}
				}
				if(bst.indexOf("s")!=-1){
					document.getElementById(did+"s").style.display="inline";
					if(did=="o021"){
						document.getElementById("o021st").style.width=kw+"px";
					}else if(did=="o022"){
						document.getElementById("o022st").style.width=kw+"px";
						if(ss=="r"){
							document.getElementById("o022sss").style.display="";
						}
					}
				}
				if(did=="o021"){
					var m=bst.substring(0,1);
					if(m=="b"){
						document.getElementById(did+"bl").checked=true;
						document.getElementById("busBoxB1").style.display="block";
					}else if(m=="l"){
						document.getElementById(did+"ll").checked=true;
						document.getElementById("busBoxB2").style.display="block";
					}else if(m=="s"){
						document.getElementById(did+"sl").checked=true;
						document.getElementById("busBoxB3").style.display="block";
					}
				}
			}else if(did=="o031" || did=="o032"){
				document.getElementById(did).style.display="block";
				document.getElementById(did+"t1").style.width=kw+"px";
				document.getElementById(did+"t2").style.width=kw+"px";
			}else if(did=="o041" || did=="o042"){
				document.getElementById(did).style.display="block";
				document.getElementById(did+"t1").style.width=kw+"px";
				document.getElementById(did+"t2").style.width=kw+"px";
			}
		}
		autoSetSize();
		
	}else{
		alert("无此搜索框，无法显示！");
		return;
	}
}
function autoSetSize(){
	if(""=="ptf"){
		var frm = parent.document.getElementById("ifsb");
		var subWebHeight = document.body.scrollHeight;
		if(frm != null && subWebHeight != null) {
		   frm.height = subWebHeight;
		}
	}
}
function checkDid(value){
	for(var i=0;i<divArray.length;i++){
		if(divArray[i]==value){
			return true;
		}
	}
	return false;
}

function show_busBox(num){
	for(i=0;i<4;i++){
		if(document.getElementById('busBox'+i)){
		document.getElementById('busBox'+i).style.display='none';
		 }	 
	}
	document.getElementById('busBox'+num).style.display='block';//触发以后信息块
	autoSetSize();
}

function show_busBoxB(numB){
	for(i=0;i<4;i++){
		if(document.getElementById('busBoxB'+i)){
		document.getElementById('busBoxB'+i).style.display='none';
		 }	 
	}
	document.getElementById('busBoxB'+numB).style.display='block';//触发以后信息块
	autoSetSize();
}

function show_busBoxC(num){
	for(i=0;i<4;i++){
		if(document.getElementById('busBoxC'+i)){
		document.getElementById('busBoxC'+i).style.display='none';
		 }	 
	}
	document.getElementById('busBoxC'+num).style.display='block';//触发以后信息块
	autoSetSize();
}

function show_NavBarTag2(numb){
	for(i=0;i<5;i++){
		if(document.getElementById('NavBarTagB'+i)){
		document.getElementById('NavBarTagB'+i).className='';
		document.getElementById('searchForm'+i).style.display='none';
		 }	 
	}
	document.getElementById('NavBarTagB'+numb).className='onDownA';
	document.getElementById('searchForm'+numb).style.display='block';
	autoSetSize();
}

function show_NavBarTag1(numb){
	for(i=0;i<5;i++){
		if(document.getElementById('NavBarTagC'+i)){
		document.getElementById('NavBarTagC'+i).className='';
		document.getElementById('searchFormC'+i).style.display='none';
		 }	 
	}
	document.getElementById('NavBarTagC'+numb).className='onDownA';
	document.getElementById('searchFormC'+numb).style.display='block';
	autoSetSize();
}

var cityListRs = {
    initcityOption:function(defaultcity){
        for(var i=0;i<cityData.province.length;i++){
            document.writeln('<option value='+cityData.province[i].pname+'>'+cityData.province[i].pname+'</option>\n');
            for(var j=0;j<cityData.province[i].city.length;j++){
				if(defaultcity==cityData.province[i].city[j].cityName){
					document.writeln('<option value='+cityData.province[i].city[j].cityName+' selected >&nbsp;├'+cityData.province[i].city[j].cityName+'</option>\n');
				}else{
					document.writeln('<option value='+cityData.province[i].city[j].cityName+' >&nbsp;├'+cityData.province[i].city[j].cityName+'</option>\n');
				}
            }
        }
    } 
}
//关键字查询
function showLc(kw,city){
	var url=urls;
	url+="#ac=lc&keyword="+encodeURIComponent(kw);
	url+="&city="+encodeURIComponent(city);
	window.open(url,"_blank");
}
//公交查询
function showBus(origName,destName,city){
	var url="http://bus.mapbar.com/mapview/index.jsp#ac=bus";
	url+="&origName="+encodeURIComponent(origName);
	url+="&destName="+encodeURIComponent(destName);
	url+="&city="+encodeURIComponent(city);
	window.open(url,"_blank");
}
//线路查询
function showLine(kw,city){
	var url="http://bus.mapbar.com/mapview/index.jsp#ac=line";
	url+="&keyword="+encodeURIComponent(kw);
	url+="&city="+encodeURIComponent(city);
	window.open(url,"_blank");
}
//站点查询
function showStop(kw,city){
	var url="http://bus.mapbar.com/mapview/index.jsp#ac=station";
	url+="&keyword="+encodeURIComponent(kw);
	url+="&city="+encodeURIComponent(city);
	window.open(url,"_blank");
}
//驾车查询
function showCar(origName,destName,origCity,destCity){
	if(origName==null || destName==null || origName=="" || destName==""){
		alert("起点终点都不能空！");
		return;
	}
	var url="http://nav.mapbar.com/mapview/index1.jsp";
	url+="#ac=nav&origName="+encodeURIComponent(origName);
	url+="&destName="+encodeURIComponent(destName);
	url+="&origCity="+encodeURIComponent(origCity);
	url+="&destCity="+encodeURIComponent(destCity);
	window.open(url,"_blank");
}
//周边查询
function showNear(pid,poitype,city){
	var url=urls;
	url+="#ac=nb&pid="+encodeURIComponent(pid);
	url+="&poitype="+encodeURIComponent(poitype);
	url+="&city="+encodeURIComponent(city);
	window.open(url,"_blank");
}
