﻿



function $(objId)
{
    return document.getElementById(objId);
}
String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function GetPara(name)
{   
    var reg = new   RegExp("(^|&)"+ name +"=([^&]*)(&|$)","i");   
    var r = window.location.search.substr(1).match(reg);   
    if(r!=null)
    {
        return unescape(r[2]);  
    }
     return   null;   
}
//地图POP层
var _PopLayer;
//地图放大和缩小
var _MapSizeState=false;
var CommendState = false;
function ChangeMapSize()
{
   var objMap=$("MapBorder");
   var map=$("EdushiMap");
   var objTable=$("divContext");
   if(fnCheckBrowser())
   {
        if(!CommendState)
        {
            if(_MapSizeState)
            {
              _MapSizeState=false;
              if($("aControlSize"))
              {
                 $("aControlSize").title = "最大化";
              }
              $("divChange").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/zuida.png',sizingMethod='image')";
              objMap.style.width="440px";
              objMap.style.margin="5px auto auto 460px";
              objTable.style.margin="-540px auto auto 0px";
              map.style.width="408px";
              vEdushiMap.MapWidth(408);

            }
            else
            {
              _MapSizeState=true;
              if($("aControlSize"))
              {
                 $("aControlSize").title = "还原";
              }
              $("divChange").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/huanyan.png',sizingMethod='image')";
              objMap.style.width="900px";
              objMap.style.margin="5px auto auto 0px";
              objTable.style.margin="0px auto auto 0px";     
              map.style.width="870px";
              vEdushiMap.MapWidth(868);
            }
        }
        else
        {
            _MapSizeState=true;
            if($("aControlSize"))
            {
             $("aControlSize").title = "还原";
            }
            $("divChange").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/huanyan.png',sizingMethod='image')";
            objMap.style.width="900px";
            objMap.style.margin="5px auto auto 0px";
            objTable.style.margin="0px auto auto 0px";     
            map.style.width="870px";
            vEdushiMap.MapWidth(868);
        }
   }
   else
   {
        if(!CommendState)
        {
            if(_MapSizeState)
           {
              _MapSizeState=false;
              if($("aControlSize"))
              {
                 $("aControlSize").title = "最大化";
              }
              $("ImgChange").src = "images/zuida.png";
              objMap.style.width="432px";
              objMap.style.margin="5px auto auto 460px";
              objTable.style.margin="-540px auto auto 0px";
              map.style.width="408px";
              vEdushiMap.MapWidth(408);
            
           }
           else
           {
              _MapSizeState=true;
              if($("aControlSize"))
              {
                 $("aControlSize").title = "还原";
              }
              $("ImgChange").src = "images/huanyan.png";
              objMap.style.width="892px";
              objMap.style.margin="5px auto auto 0px";
              objTable.style.margin="0px auto auto 0px";     
              map.style.width="868px";
              vEdushiMap.MapWidth(868);
           }
        }
        else
        {
            _MapSizeState=true;
            if($("aControlSize"))
            {
             $("aControlSize").title = "还原";
            }
            $("ImgChange").src = "images/huanyan.png";
            objMap.style.width="892px";
            objMap.style.margin="5px auto auto 0px";
            objTable.style.margin="0px auto auto 0px";     
            map.style.width="868px";
            vEdushiMap.MapWidth(868);
        }
   }
   CommendState = false;
}
var _vBigZoom = 0;
var _vSmallZoom = 3;
var _vNowZoom = 3;
function fZoomMap(num)
{
	if(num == 0) return ;
	if(num > 0 && _vSmallZoom <= _vNowZoom) return;
	if(num < 0 && _vBigZoom >= _vNowZoom) return;
	zoomTo(_vNowZoom+num);
}
function fZoomTo(num)
{
   zoomTo(num);
}
function fScrollZoomMap()
{
   	$("dZoom"+_vNowZoom).className='Uaction';
	_vNowZoom = getZoom();
	$("dZoom"+_vNowZoom).className='Action';
}

function fnZoomBar(){}
fnZoomBar.prototype.Init=function(){
    this.zoombar = $('EzoomBar');    
    this.zoomBarSign = $('MapSilder');
    vEdushiMap.Body.flgShowPlot = true;
    vEdushiMap.Body.flgContextMenu = false;
    
    $('Ezoom0').onclick=this.zoomBar_click.bindAsEventListener(this);
    $('Ezoom1').onclick=this.zoomBar_click.bindAsEventListener(this);
    $('Ezoom2').onclick=this.zoomBar_click.bindAsEventListener(this);
    $('Ezoom3').onclick=this.zoomBar_click.bindAsEventListener(this);
    $('EzoomMax').onclick=this.ZoomMax.bindAsEventListener(this);
    $('EzoomMin').onclick=this.ZoomMin.bindAsEventListener(this);
    $('Change2D3D').onclick=this.C23D.bindAsEventListener(this);
    this.ZoomBarSignPos(vEdushiMap.Zoom());  
    this.zoombar.onmousedown = this.doc_mousedown.bindAsEventListener(this);
    this.zoombar.onmousemove = this.doc_mousemove.bindAsEventListener(this);
    this.zoombar.onmouseup = this.doc_mouseup.bindAsEventListener(this);
    
}
fnZoomBar.prototype.C23D=function(){
//if(vEdushiMap.Switch23D())
//           $('Change2D3D').innerHTML = $('Change2D3D').innerHTML.replace('/Change3D.gif','/Change2D.gif');
//    else
//           $('Change2D3D').innerHTML = $('Change2D3D').innerHTML.replace('/Change2D.gif','/Change3D.gif');
}
fnZoomBar.prototype.doc_mousedown=function(evt){
        var src = evt.srcElement ? evt.srcElement : evt.target;
        this.ocx = evt.clientX;
        this.ocy = evt.clientY;
        if (src.id == 'MapSilder')
        {
            this.zoomFlag = true;
            this.bmy = this.ocy - this.zoomBarSign.offsetTop;
            this.bmTop = this.zoomBarSign.offsetTop;
        }
}
fnZoomBar.prototype.doc_mousemove=function(evt){
    var ex = evt.clientX;
    var ey = evt.clientY;
    
    if (this.zoomFlag)
    {
        this.zoomBarSign.style.top = (ey - this.bmy) + 'px';
        //if((this.zoomBarSign.offsetTop >= 50)&&(this.zoomBarSign.offsetTop <= 113))$('EdushiMap').style.zoom=(ey - this.bmy)+'%';
        
        if (this.zoomBarSign.offsetTop < 128)this.zoomBarSign.style.top = '128px';
        if (this.zoomBarSign.offsetTop > 190)this.zoomBarSign.style.top = '190px';
        var zz = Math.pow(2,  - (this.zoomBarSign.offsetTop - this.bmTop) /18).toFixed(3);
        //this.slowZoom(zz);
    }
}
fnZoomBar.prototype.doc_mouseup=function(evt){
    var src = evt.srcElement ? evt.srcElement : evt.target;
    if (this.zoomFlag)
    {
        this.zoomFlag = false;
        var z = Math.round((this.zoomBarSign.offsetTop - 128) / 21);
        vEdushiMap.FlatZoom(z);
        this.ZoomBarSignPos(z);
        return false;
    }
}
fnZoomBar.prototype.ZoomBarSignPos=function(z){

    this.zoomBarSign.style.top = (130+21 * z) + 'px';
}
fnZoomBar.prototype.zoomBar_click=function(e){
    var src = e.srcElement ? e.srcElement : e.target;
    var z=src.id.replace('Ezoom','');
    if (z < 0 || z > 3)return ;
    this.ZoomBarSignPos(z);
    vEdushiMap.FlatZoom(z);
}
fnZoomBar.prototype.ZoomMax=function(){
    vEdushiMap.FlatZoom(0);
    this.ZoomBarSignPos(0);
}
fnZoomBar.prototype.ZoomMin=function(){
    vEdushiMap.FlatZoom(3);
    this.ZoomBarSignPos(3);
}
//IE浏览器返回true;其它浏览器返回false
function fnCheckBrowser()
{
    if(navigator.appName=="Microsoft Internet Explorer"){
        return true;
    }else{
        return false;
    }
}
function showflash(id,name,citycode,number,x,y,type)
{
 if (_PopLayer)
    {
       _PopLayer.innerHTML = '';
        var _PoPModel;
        //alert(type);     
       _PoPModel= '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="200" height="180"><param name="movie" value="cd-16.swf" /><param name="quality" value="high" /><embed src="cd-16.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="180"></embed></object>';

        var o = vEdushiMap.$C('div');
        o.id = "objDiv_Pop";
        o.innerHTML = _PoPModel.replace( "{$Name}" , name).replace("{$id}",id);
        vEdushiMap.appendEntity(o, _PopLayer, false, x,y,500,500,15,28, false);
        vEdushiMap.MoveTo(x*1,y*1,true);
    }
}
//显示实体纠错对话
//function ShowDebugPop(id,name,x,y)
//{
//    if (_PopLayer)
//    {
//       _PopLayer.innerHTML = '';
//       var _PopLayerid=_PopLayer.id;
//        var _PoPModel;
//        _PoPModel= "<div><iframe src=\"http://www.3dyiwu.com/skins/zh-chs/4.2.0925/default/Controls/debugcontrol.aspx?ID="+id+"&Name="+escape(name)+"&Flag=0\" name=\"popfrom\" width=\"310\" height=\"310\" scrolling=\"No\" frameborder=\"0\" allowtransparency='true' id=\"frame\"> </iframe></div>";
//        var o = vEdushiMap.$C('div');
//        o.id = "objDiv_Pop";
//        o.innerHTML = _PoPModel;
//       vM.appendEntity(o, _PopLayer, false, x,y,500,500,0,50, false);
//       var xz=eval(x)+340;
//        MoveTo(xz,y);

//    }
//}

//显示实体pop框
function ShowOwnerInfoPop(spot)
{
var x=spot.CenterX;
var y=spot.CenterY;
var UnitID=spot.ID;
var OwnerName=spot.OwnerName;
var ImgPath=spot.ImgPath;
var OwnerPic=spot.OwnerPic;
var address=spot.Oaddress;
    if (_PopLayer)
    {
       _PopLayer.innerHTML = '';
       var _PopLayerid=_PopLayer.id;

        var _PoPModel;
        var strcompic="";
        if (OwnerPic=="")
        {
          strcompic="无图片";
        }
        else
        {
         strcompic=" <img src=\"http://www.3dyiwu.com//userupImages/pic_yiwu/"+ImgPath+"/"+OwnerPic+"\" width=\"94\" height=\"66\" >";
        }
       var Etext="http://www.3dyiwu.com/?x="+x+"&y="+y+"&title="+escape(OwnerName)+"&content="+escape(address);
        _PoPModel= "<div style='float:left'><img src='mapimage/PopContro/left1.gif' /></div><div style='float:left; width:290px; height:161px; background:url(mapimage/PopContro/left2.gif) repeat-x; color:#3F3F3F; font-size:12px; line-height:120%;'><div style='font-weight:bold; margin-top:5px; float:left;'>{$Name}</div> <div style='float:right;margin-top:5px; margin-right:10px;'><img src='mapimage/PopContro/x.gif'style=\"cursor:pointer\" onClick=\"{$divid}\" /></div> <div style=' clear:both;margin:0px; padding:0px; font-size:0px; border:0px;'></div> <div style='border:#CCCCCC 1px solid; padding:2px; width:90px; height:60px; margin-top:2px; background:#FFFFFF; float:left;text-align:center;line-height:40px;'>"+strcompic+"</div> <div style='float:left; margin-left:5px;'> <div style='font-weight:bold; margin-bottom:5px;'>入驻企业:<img src='mapimage/PopContro/ddf.gif' width='12' height='11' /></div> <div> <iframe src=\"ajax/ShowOwnerInfoPop.aspx?id={$id}\" name=\"popfrom\" width=\"185\" height=\"45\" scrolling=\"No\" frameborder=\"0\" allowtransparency='true' id=\"frame\"> </iframe></div></div> <div style=' clear:both;margin:0px; padding:0px; font-size:0px; border:0px;'></div> <div style='border-top:#333333 1px dotted; margin-top:5px;'> <a href=\"http://www.3dyiwu.com/LiveIn/Default.aspx?OwnerID="+UnitID+"&OwnerName="+escape(OwnerName)+"\" target=\"_blank\"><img src=\"mapimage/PopContro/ArchitBtn.gif\" border=\"0\"></a>  <img src=\"mapimage/PopContro/PutRightBtn.gif\" style=\"cursor:pointer;\"onclick=\"{$DebugControl}\"> </div><div style='clear:both; margin-top:0px; padding-top:2px;font-size:12px; color:#979797;'> <div style='float:left; margin-right:2px;'> <input type=\"text\" style=\"width:184px; height:20px;\" value=\""+Etext+"\"></div> <div style='float:left;'><img src=\"mapimage/PopContro/copy.gif\" style=\"cursor:pointer;\" onclick=\"{$CopyEaddress}\" ></div></div></div><div style='float:left'><img src='mapimage/PopContro/left3.gif' /></div>";
      
        var o = vEdushiMap.$C('div');
        o.id = "objDiv_Pop";
        o.innerHTML = _PoPModel.replace( "{$Name}" , OwnerName).replace("{$id}",UnitID).replace("{$CopyEaddress}","parent.CopyEaddress('"+ x +"','"+ y +"','"+ OwnerName +"','"+ address +"')").replace("{$divid}","parent.removeMapPop('"+ o.id +"')" ).replace("{$DebugControl}","parent.DebugControl('"+ UnitID +"','"+ OwnerName +"')" );
          vM.appendEntity(o, _PopLayer, false, x,y,500,500,0,125, false);
          var xz=eval(x)+340;
MoveTo(xz,y);

    }
}

//弹出企业资料显示框
function ShowYPPop(id,name,x,y,address,tel,compic,url)
{


    if (_PopLayer)
    {
       _PopLayer.innerHTML = '';
       var _PopLayerid=_PopLayer.id;

        var _PoPModel;
        var strcompic="";
        if (compic=="F")
        {
          strcompic="<div style=\"width:80px; line-height:22px; text-align:center;font-size:12px; \">无图</div><div style=\"width:80px; line-height:22px;text-align:center ;\"><a href=\"http://member.3dyiwu.com/Company/CompanyPic.aspx\" target=\"_blank\"><span style=\"text-decoration:none;font-size:12px\">我来添加</span></a></div>";
        }
        else
        {
         strcompic=" <img src=\""+compic+"\" width=\"96\" height=\"66\" >";
        }
       var Etext="http://www.3dyiwu.com/?x="+x+"&y="+y+"&title="+escape(name)+"&content="+escape(address);
        _PoPModel= "   <div><img src=\"mapimage/tu_03.gif\" width=\"313\" height=\"11\" alt=\"\"></div><div style=\"background:url(mapimage/tu_05.gif) repeat-y; height:auto; width:313px; padding-left:15px;\"><div style=\"font-family:'宋体'; float:left; color:#000000; font-size:12px; font-weight:bold; margin-top:2px;\">{$Name}</div><div style=\"float:right; padding-right:25px;\"><img src=\"mapimage/x.gif\" width=\"9\" height=\"9\" style=\"cursor:pointer\" onClick=\"{$divid}\"></div><div style=\"clear:both; margin:0px; padding:0px; border:0px; font-size:0px;\"></div><div style=\" margin-top:5px; float:left;border:#979797 1px solid;width:96px; height:66px;text-align:center;line-height:40px;\">"+strcompic+"</div> <div style=\"margin-left:10px; float:left; overflow:hidden;\"><div style=\"margin-top:10px; font-size:12px; color:#979797;\">电话:{$tel}</div><div style=\"margin-top:5px; font-size:12px; color:#979797;\">地址:{$address}</div><div style=\"margin-top:12px;\"><a href=\"http://hy.3dyiwu.com/detail-{$id}.htm\" target=\"_blank\"><img src=\"mapimage/ArchitBtn.gif\" border=\"0\"></a> <img src=\"mapimage/PutRightBtn.gif\" style=\"cursor:pointer;\"onclick=\"{$DebugControl}\"></div></div><div style=\"clear:both; width:267px; margin-top:0px; padding-top:2px; border-top:#CCCCCC 1px dotted; font-size:12px; color:#979797;\"><div style=\"float:left; margin-right:1px;\"> <input type=\"text\" style=\"width:184px; height:20px;\" value=\""+Etext+"\"> </div><div style=\"float:left;\"><img src=\"mapimage/copy.gif\" style=\"cursor:pointer;\" onclick=\"{$CopyEaddress}\" > </div> </div><div style=\"clear:both; margin:0px; padding:0px; border:0px; font-size:0px;\"></div><div style=\"padding-top:5px; text-align:center; font-size:12px; color:#979797;\">此数据仅供参考-<span style=\"color:#990000; font-size:12px; font-weight:bold\">网上义乌</span>直通商贸城</div> </div><div><img src=\"mapimage/tu_07.gif\" width=\"313\" height=\"58\" alt=\"\"></div>";
      
        var o = vEdushiMap.$C('div');
        o.id = "objDiv_Pop";
        o.innerHTML = _PoPModel.replace( "{$Name}" , name).replace("{$id}",id).replace("{$address}",address).replace("{$tel}",tel).replace("{$MCI_Internet}",url).replace("{$CopyEaddress}","parent.CopyEaddress('"+ x +"','"+ y +"','"+ name +"','"+ address +"')").replace("{$divid}","parent.removeMapPop('"+ o.id +"')" ).replace("{$DebugControl}","parent.DebugControl('"+ id +"','"+ name +"')" );
          vM.appendEntity(o, _PopLayer, false, x,y,500,500,0,211, false);
          var xz=eval(x)+320;
MoveTo(xz,y);

       
    }
}
function CopyEaddress(x,y,title,content)
{
var ttext="http://www.3dyiwu.com/?x="+x+"&y="+y+"&title="+escape(title)+"&content="+escape(content);
clipboardData.setData("text",ttext);
alert("复制成功,请贴到QQ,MSN发送给好友!");
}
function DebugControl(id,name)
{
popdialog.openWithIframe('纠错','http://hy.3dyiwu.com/DebugControl.aspx?ID=1929&Name=%u9526%u7ee3%u5bb6%u56ed&Flag=0',450,400)
}
function fjmove(x,y)
{
vEdushiMap.MoveTo(x*1,y*1,true);
}

function ShowCommendPop(title,content,x,y)
{
    CommendState = true;
    ChangeMapSize();
    _PopLayer.innerHTML = '';
    var _CommendHtml = '<div id="wrap"><div id="tjgg"><div id="tjgg-1">{$title}</div><div id="tjgg-2"><div class="box"> <div class="h"></div> <p><img src="images/10.jpg" style="cursor:pointer" onclick=parent.removeMapPop("CommendDiv_Pop") /></p></div> </div></div><div class="left"></div><div id="tjgg-3"><img src="images/11.jpg" /></div><div id="tjgg-4">{$content}</div><div id="tjgg-5"><img src="images/12.jpg" /></div><div id="footer"><img src="images/13.jpg" /></div></div>';
    var o = vEdushiMap.$C('div');
    o.id = "CommendDiv_Pop";
    o.innerHTML = _CommendHtml.replace("{$title}",title).replace( "{$content}" , content);
    vEdushiMap.appendEntity(o, _PopLayer, false, x,y,500,500,0,135, false);
    vEdushiMap.MoveTo(x*1,y*1,true);
}
function removeMapPop(id)
{
    _PopLayer.removeChild(vEdushiMap.$(id));
}
//详细页的定位
function ShowOwnerDetailPop()
{
    ShowDetailPop(L_Oi, 'OwnerDetail.aspx', 'Ownerdetail_Pop');
}
function ShowCompanyDetailPop()
{
    ShowDetailPop(L_Oi, 'CompanyDetail.aspx', 'Companydetail_Pop');
}
function ShowDetailPop(obj, urlPage, obj_PopID)
{
    _PopLayer.innerHTML = '';
    var _PoPModel = "<div class=\"header\"><div class=\"content\">{$Name}</div><div class=\"abc\"></div></div>";    
    var o = vEdushiMap.$C('div');
    o.id = obj_PopID;
    o.Class = "Popo";
    o.innerHTML = _PoPModel.replace( "{$Name}" , obj.OName).replace("{$id}",obj.OID); 
    vEdushiMap.appendEntity(o, _PopLayer, false,obj.CenterX, obj.CenterY,500,500,15,28, false);
    vEdushiMap.MoveTo(obj.CenterX*1, obj.CenterY*1,true);
}
var PicIndex = 1;
function ShowPic()
{
   if( arrPicName.length <= 1) return;
   if(arrPicName.length <= PicIndex) PicIndex = 0; 
   $("detailimg").src = sPicPath+arrPicPath[PicIndex] +'/s'+arrPicName[PicIndex];
   $("detailimga").href = sPicPath+arrPicPath[PicIndex] +'/'+ arrPicName[PicIndex];
   PicIndex++;
   setTimeout("ShowPic()",2000); 
}   
function GoSearch()
{
    if($("txtKeyword").value=="")
    {
        alert("请输入你要查找的关键字!");
        $("txtKeyword").focus();
        return;
    }
    if($("txtKeyword").value.length>50)
    {
        alert("查找的关键字过长，请适当删减!");
        $("txtKeyword").focus();
        return;
    }
    if(RiskWord($("txtKeyword").value))
    {
        alert("关键字中不能包含<>()'\"+;\?%--等特殊字符");
        $("txtKeyword").focus();
        return;
    }
    var Keyword = escape($("txtKeyword").value);
    window.location.href='KeywordSearchList.aspx?Keyword='+Keyword;
}
function RiskWord(str)  //检测是否包含'<>()'"+;\?%--'字符，有返回true，否则返回false
{
  var Letters= "<>()'\"+;\?%";
  var i;
  var c;
  for( i = 0; i < str.length; i ++ )
  {
    c = str.charAt( i );
	   if(Letters.indexOf( c )>=0)
	   return true;
  }
  if(str.indexOf("--")>=0)
    return true;
  return false;
}
function ShowCorrent()
{
    $("BG").style.height = document.body.scrollHeight + 'px';
    $("BG").style.width =  document.body.scrollWidth + 'px'
    $('BG').style.display='block';
    
    $('Correntiframe').style.display='block';       
    $('Correntiframe').style.left=(document.body.scrollWidth-$('Correntiframe').offsetWidth)/2 + 'px';
    $('Correntiframe').style.top="200px";//document.body.scrollTop+(document.body.clientHeight-$("Correntiframe").offsetHeight)/2 +'px';
}
function HideCorrent()
{
    parent.document.getElementById('BG').style.display='none';
    parent.document.getElementById('Correntiframe').style.display='none';
}

function ShowHideUpload()
{
    $("BG").style.height = document.body.scrollHeight + 'px';
    $("BG").style.width = document.body.scrollWidth + 'px'
    $('BG').style.display='block';
    $('iframeUpImg').style.display='block';       
    $('iframeUpImg').style.left=(document.body.scrollWidth-$('iframeUpImg').offsetWidth)/2 + 'px';
    $('iframeUpImg').style.top=document.body.scrollTop+(document.body.clientHeight-$("iframeUpImg").offsetHeight)/2+'px';
}

function HideUpload()
{
    parent.document.getElementById('BG').style.display='none';
    parent.document.getElementById('iframeUpImg').style.display='none';
}
function InitZoomBar()
{
    var mapZB=new fnZoomBar();
    mapZB.Init();
    _PopLayer = vEdushiMap.NewMapLayer('Pop',269, 0);
    vEdushiMap.onMapZoomChange = function()
    {
        mapZB.ZoomBarSignPos(vEdushiMap.Zoom());
    }
}
function Scall()
{
//    if($("BG_con"))
//    {
//        $("BG_con").style.top=document.body.scrollTop+(document.body.clientHeight-$("BG_con").offsetHeight)/2;
//    }
    if($("Correntiframe"))
    {
        $("Correntiframe").style.top= "200px";//document.body.scrollTop+(document.body.clientHeight-$("Correntiframe").offsetHeight)/2;
    }
    if($("iframeUpImg"))
    {
        $("iframeUpImg").style.top=document.body.scrollTop+(document.body.clientHeight-$("iframeUpImg").offsetHeight)/2;
    }
}
window.onscroll=Scall;

function fnGetWindowWidth(){
	var vw = 0;
	var _dEt = document.documentElement;
	var _dBy = document.body;
	if(typeof window.innerWidth=='number')vw = window.innerWidth;
	else{
		if(_dEt&&_dEt.clientWidth)vw = _dEt.clientWidth;
		else{
			if(_dBy&&_dBy.clientWidth)vw = _dBy.clientWidth;
		}
	}
	if(!vw||vw<100)vw = 100;
	return vw;
}
function fnGetWindowHeight(){
	var vh = 0;
	var _dEt = document.documentElement;
	var _dBy = document.body;
	if(typeof window.innerHeight=='number')vh = window.innerHeight;
	else{
		if(_dEt&&_dEt.clientHeight)vh = _dEt.clientHeight;
		else{
			if(_dBy&&_dBy.clientHeight)vh = _dBy.clientHeight;
		}
	}
	if(!vh||vh<100)vh = 100;
	return vh;
}

var fraCityList;
function LoadCityList()
{
    if (!fraCityList){
        fraCityList = document.createElement('IFRAME');
        fraCityList.id = 'fraCityList';
        fraCityList.frameBorder = '0';
        fraCityList.scrolling = "no";
        fraCityList.style.position = 'absolute';
        fraCityList.style.overflow = 'hidden';
        fraCityList.allowTransparency = 'true';
        fraCityList.style.width = '800px';
        fraCityList.style.height = '620px';  
        fraCityList.style.left = (fnGetWindowWidth()-800)/2 + 'px';
        fraCityList.style.top = '100px';
        fraCityList.style.zIndex = '10001';
        fraCityList.src = 'CityListControl.aspx';
        document.body.appendChild(fraCityList);
    }
    fraCityList.style.display = 'block';
    $('BG').style.display = 'block';
    $('BG').style.width = fnGetWindowWidth() + 'px';
    $('BG').style.height = fnGetWindowHeight() + 'px';
}

function fnCityListHiddn()
{
    fraCityList.style.display = 'none';
    $('BG').style.display = 'none';
}


    function Map_Move (direction)
    {
        var iMapCenterX = vM.CenterX();
        var iMapCenterY = vM.CenterY();
        var moveStepPixel=256;
        switch(direction)
        {
            case "up":
                MoveTo(iMapCenterX+vM.GetMapPos(moveStepPixel/2), iMapCenterY-vM.GetMapPos(moveStepPixel), true); 
                break;
            case "down":
                MoveTo(iMapCenterX-vM.GetMapPos(moveStepPixel/2), iMapCenterY+vM.GetMapPos(moveStepPixel), true); 
                break;
            case "left":
                MoveTo(iMapCenterX-vM.GetMapPos(moveStepPixel), iMapCenterY, true);  
                break; 
            case "right":
                MoveTo(iMapCenterX+vM.GetMapPos(moveStepPixel), iMapCenterY, true);  
                break; 
            case "center":
                MoveTo(vM.Property.CenterX, vM.Property.CenterY);
                break;                                 
        }
    }
   
//地图移动和鹰眼联动
function MoveTo(x,y)
{
    vM.MoveTo(x, y, true); 
    vMe.MoveTo(x, y, true);
}
function fnShowEntityPop(id,x,y){
    vM.MoveTo(x*1 + vM.GetMapPos(170), y*1, true);
    vMe.MoveTo(x*1 + vM.GetMapPos(170), y*1, true);
               
    cEntityPopControl.CID = '';
    if(cEntityPopControl.OID!=id){
        cEntityPopControl.Hide();
        setTimeout(function(){
           vM.moveEntity(cEntityPopControl.ID, x*1, y*1);
            cEntityPopControl.ShowEntityPop(id);   
        }, 100);  
    }
    else{
        
        vM.moveEntity(cEntityPopControl.ID, x*1, y*1);
        cEntityPopControl.Show();
    }
}

