// JScript File

//返回毫秒
function GetNowTime()
{
    d = new Date();  
    return d.getSeconds() * 1000 + d.getMilliseconds();
}

// 用户定义的
// Action 将要开始时的事件。 //
function GetNameFromMapQuery(strName)
{
	//var name = document.getElementById(CustomLayerID);
	document.getElementById("txt_Name").value=strName;
	
	//var _map = document.getElementById(mapId +"_MVIMAGE");
	// alert(document.getElementById("txt_Name").value);
	// alert(document.getElementById("Result_tmp").value);
	//return strName;
}

// 用户定义的, 控制界面上的查询窗口
function setDivVisuableFalse(strName)
{
	if (document.getElementById(strName).style.visibility = 'visible')
	{
	  document.getElementById(strName).style.visibility ='hidden';
	}
	
}


var bOutputIsVisible = false;

function showdiv()
{
 //   alert(showdiv);
// 	 ShwoControl("MapControl1", "output", true);
     bOutputIsVisible = true;
}

function showdiv2()
{
    if(bOutputIsVisible == false)
    {      
       // alert(showdiv2);  
        ShwoControl("MapControl1", "output", true);
    	bOutputIsVisible = true;
    }
    else
    {
        ShwoControl("MapControl1", "output", false);
    	bOutputIsVisible = false;
    }
}

function hidediv()
{
    ShwoControl("MapControl1", "output", false);
    bOutputIsVisible = false;
	// document.all.output.style.left="-2000px";
}
function showOrhidediv()
{
	if(document.all.output.style.left=="-200px")
	  {
	  document.all.output.style.left="-200px";
	  		//  alert("-200");
   	}
	else if(document.all.output.style.left=="20px")
	{
		document.all.output.style.left="-200px";
				  //alert("20 ");
		}
	
}

function showmaplayerdiv()
{
	document.all.layercontrol.style.left="500px";
}
function hidemaplayerdiv()
{
	document.all.layercontrol.style.left="-2000px";
}



function showMoreInfo(url)
{
	var win = window.open(url);
	win.focus();
}


// ------------------弹出window.open窗口--------------------


function dialogwin(fileName,str_dialogWidth,str_dialogHeight)
{ 
    window.showModalDialog(fileName,null,"dialogWidth:"+str_dialogWidth+"px;dialogHeight:"+str_dialogHeight+"px;center:1;scroll:0;help:0;status:0");
    
}

function dialogwin2(fileName)
{ 
    
  // window.showModalDialog(fileName,null,ss);
  window.showModalDialog(fileName,null,"dialogHeight: 220px; dialogWidth: 340px; dialogTop: 0px; dialogLeft: 0px;center: No; help: No; resizable: No; status: No;");
}





// 定位工具栏
function SetToolControlPosition(mapID, toolControlID, offsetX, offsetY)
{
	if(mapID == null) {	return;	}

//	var mapImageID			= mapID + '_MVIMAGE';
//	SetMapAbsPosition(mapImageID);

	var map = document.getElementById(mapID);
	
	var toolControl = document.getElementById(toolControlID);
	//alert(map.style.top);
	if(toolControl)
	{
	    toolControl.style.left = SMISGetNumFromPixel(map.style.left) + offsetX;
	    toolControl.style.top = SMISGetNumFromPixel(map.style.top) + offsetY;
	    	 
	}
}

function ShwoControl(mapID, toolControlID, bVisible)
{
    // alert(toolControlID + bVisible);
	var toolControl = document.getElementById(toolControlID);
	if(bVisible == true)
	{
	    SetToolControlPosition(mapID,toolControlID,18,0);
	}
	else
	{
	    toolControl.style.left = -1000;
	}	
}


//原来在tomap.aspx中的
function openMoreInfoWin(strhtmlName)
{
	window.open(strhtmlName,null,'left=0,top=0,width=600,height=410,status=no,toolbar=no,resizable=no,menubar=no,location=no,scrollbars=no');
}

function openwin()
{  
	window.open('amap.aspx',null,'toolbar=no,status=yes,directories=no,scrollbars=yes,menubar=no');
}
function openlegendwin()
{  
	window.open('legend.aspx',null,'toolbar=no,status=yes,directories=no,scrollbars=yes,menubar=no,width=340,height=320');
}

//		function smresizeControls()
//		{			
//		    SetToolControlPosition("MapControl1", "tool1", 700, 0);
//		    SetToolControlPosition("MapControl1", "output", -233, 0);
//		 }

function smresizeControls()
{			
   // alert(smresizeControls);
   SMISMapSetPosition('MapControl1'); 
   // SMISOverviewSetPosition('OverviewControl1');
    SetToolControlPosition("MapControl1", "tool1", 685, 0);
    SetToolControlPosition("MapControl1", "search1", 0, 0);		
    ShwoControl('MapControl1', 'output', bOutputIsVisible);					   
    		   		
 }