var m_CurrentTool=0;
var curCommandStr="";
var m_CurrentIndex=-1;
//地图边界距离页面各个部分的距离
var TOPPAD=120;//changed by wkm
var LEFTPAD=0;
var RIGHTPAD=218;//changed by wkm
var BOTTOMPAD=100;
var OVERVIEWPAGENAME="overview.jsp"
var firstDisplayOverViewPage=true
//鹰眼显示控制变量
var m_overview_display=false;

//显示鹰眼帧
function showOverView(name){	
	document.all.item("overViewTR").style.display=""
}

function showNewPage(pageName,pageURL){

	eval(pageName).location=pageURL;
}

function ChangeMapSize(width,height){
	MapApplet.style.width=width;
	MapApplet.style.height=height;
}

function changeinfoframelocation()
{
   parent.Layer1.style.top="363px";
   parent.Layer2.style.top="363px";
   infoFrameTD.height = window.screen.height - 436;
}

///////////////////////////
function showInfoWindow(str){

	var opString="";
	if(str.indexOf("||")>-1){
		tempArray=str.split("||");
		opString=tempArray[1];
		arrayOfStrings = tempArray[0].split(";");
	}else{
		arrayOfStrings = str.split(";");
	}
	 if(opString.indexOf("overView")>-1){
		//鹰眼开启状态
		overViewTR.style.display=""		
        
		//改变Layer1、Layer2的位置
		changeinfoframelocation();

		if(firstDisplayOverViewPage){
			overViewFrame.location=OVERVIEWPAGENAME+""
			firstDisplayOverViewPage=false;
			document.MapApplet.repaintMap();
		}else{
			mWidth=overViewFrame.document.MapApplet.getM_mapWidth();
			mHeight=overViewFrame.document.MapApplet.getM_mapHeight();
			overViewFrame.document.MapApplet.doDirectQuery(0,"map=overView&point=1&"+"X0="+mWidth+"&Y0="+mHeight);
			document.MapApplet.repaintMap();
		}
	 }
	//初始化地图后的操作
	 if(opString.indexOf("mainMapInit")>-1){
		//改变地图至适应屏幕大小
		        mapHeight=window.screen.height;
                mapWidth=window.screen.width;
				//alert("will change map size :" + "[" + (mapWidth-LEFTPAD-RIGHTPAD) + "][" +(mapHeight-TOPPAD-BOTTOMPAD) + "]");
                document.MapApplet.ChangeMapSize(mapWidth-LEFTPAD-RIGHTPAD,mapHeight-TOPPAD-BOTTOMPAD);
		//设置地图初始化工具
		document.MapApplet.SetCommandTools(2,10,0,1,'','','')
 	 }
	 if(opString.indexOf("refreshMain")>-1){
		parent.document.MapApplet.redraw();
	 }
	 if(opString.indexOf("busy")>-1){
		alert("服务器太忙，请稍后再进入谢谢！")
	 }
	if(opString.indexOf("overviewSet")>-1){
		document.MapApplet.SetCommandTools(122,10,1,12,'','','map=overView','鹰眼')
	 }
}

function appletHtmlOutput(frame,s){
	//新窗口显示	
	
	if(frame=="blank"){
		winWidth=300
		winHeight=250
		winLeft=(window.screen.width-winWidth)/2;
		winTop=(window.screen.height-winHeight)/2;
		opwnWinName=window.open("","infoWindow","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes ,resizable=yes,width=330,height=250");
		opwnWinName.document.open("text/html","replace")
		opwnWinName.document.write(s);
		opwnWinName.location.reload(true);
		opwnWinName.moveTo(winLeft,winTop);
		opwnWinName.focus();
	}else{
		f=eval(frame)
		f.document.open("text/html","replace")
		f.document.write( s);
		f.location.reload(true)
	}
}
function display_search2()
{
  document.all.searchTD.style.display='';
  document.all.resultTD.style.display='none';
}
function display_result2()
{

  document.all.searchTD.style.display='none';
  document.all.resultTD.style.display='';
}
function display_search()
{
  parent.searchTD.style.display='';
  parent.resultTD.style.display='none';
}
function display_result()
{

  parent.searchTD.style.display='none';
  parent.resultTD.style.display='';
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
    if ((obj=MM_findObj(args[i]), parent.document)!=null)
	  { v=args[i+2];
        alert("dfsdfdsfsd");
	    if (obj.style) 
	      { 
			obj=obj.style; 
			v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
    	}
        obj.visibility=v;
	  }
}
function turn2result()
{
  var obj, v;
  
  v = 'hide';
  obj = parent.Layer2.style;
  v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
  obj.visibility=v;
  
  v = 'show';
  obj = parent.Layer1.style;
  v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
  obj.visibility=v;
   
  display_result();
}

function testIfNull(obj1, msg1, obj2, msg2)
{
	if (obj1.value == "")
	{
		alert(msg1);
		return false;
	}
	else
	if (obj2 != null && obj2.value == "")
	{
		alert(msg2);
		return false;
	}
	else
		return true;
}



