//function mouseClickPoint(title,left,top,content1)
//{

////    hideBubblex();//更换方法  只对泡泡清空  gp
////    /* 对title分解split
////     * temp[0]放弹出窗口title，temp[1]放加密的点值
////     */
////    var temp=title.split(",");
////    if(wikinow==1)
////    {
////        
////         msglat=left;
////         msglong=top;
////         var content=ashowMyBubbleObj.DivStrInshowMyBubble(temp[0],content1+DirectionInfo);
////         var aDiv=ad_div("bubble",left,top,0,0,1,5000,content);
////    }
////    else if(mainnow==1)
////    {
////         msglat=left;
////         msglong=top;
////         var content=ashowMyBubbleObj.DivStrInshowMyBubble(temp[0],content1+DirectionInfo);
////         var aDiv=ad_div("bubble",left,top,0,0,1,5000,content);
////    }
////    return aDiv;
//};

var isdragpic=0;//拖拽模式标志
function MoveRedraw()//zy 2010-02-05
{ 
   // document.getElementById("busline").innerHTML='';
//    listx=new Array();          //存储转化后的xy 坐标数组
//    listy=new Array();
//    lsxylist='';



    if(wiki_yuan_list!=''&&wiki_yuan_list.split('|').length>0)//圆
    {
      var myyuans = wiki_yuan_list.split('|');
        for(var i=0;i<myyuans.length-1;i++)
        {
        
         this.myyuan_xy = myyuans[i].split(',');
             // 画图形
        if( this.myyuan_xy!="")
        {
             if(myyuans[i].indexOf('#')>= 0) //设置样式
            {
               this.myyuan_sty=myyuans[i].split('!')[0].split(',')[this.myyuan_xy.length-1];// 取样式
                setStrokeColor(myyuan_sty.split('$')[0]);//设置颜色
                setStrokeWidth(myyuan_sty.split('$')[1]);// 设置变形宽度
                
            }else
            {
                setStrokeColor("#ff0000");//设置颜色
                setStrokeWidth(2);// 设置变形宽度
            }
          drawCircleByCoordinates(myyuan_xy[0].split(':')[1],myyuan_xy[0].split(':')[0], myyuan_xy[1].split(':')[1], myyuan_xy[1].split(':')[0],wiki_yuan_list.split('|')[i].split('!')[5] ,  myyuans[i].split('!')[1]);            
        
        }

       }
    }
   
    if(wiki_rect_list!=''&&wiki_rect_list.split('|').length>0)//矩形
    {
       var myrects = wiki_rect_list.split('|');
        for(var i=0;i<myrects.length-1;i++)
        {
             this.myrec_xy = myrects[i].split(',');

            if(this.myrec_xy!=""){
             if(myrects[i].indexOf('#')>= 0) //设置样式
            {
               this.myrec_sty=myrects[i].split('!')[0].split(',')[this.myrec_xy.length-1];// 取样式
                setStrokeColor(myrec_sty.split('$')[0]);//设置颜色
                setStrokeWidth(myrec_sty.split('$')[1]);// 设置变形宽度
                
            }else
            {
                setStrokeColor("#ff0000");//设置颜色
                setStrokeWidth(2);// 设置变形宽度
            }
             // 画图形
             drawRectByCoordinates(this.myrec_xy[0].split(':')[1],this.myrec_xy[0].split(':')[0], this.myrec_xy[1].split(':')[1], this.myrec_xy[1].split(':')[0],wiki_rect_list.split('|')[i].split('!')[5], myrects[i].split('!')[1]);            

           }
        }
    }
    if(wiki_poly_list!=''&&wiki_poly_list.split('|').length>0)//多边形
    {
        var mypolys = wiki_poly_list.split('|');
       for(i=0;i<mypolys.length-1;i++)
       {
          this.myploy= mypolys[i];
          this.myploy_xys = this.myploy.replace(/\:/g,",");//纬度，经度，纬度，经度，。。。
          this.myploy_xysarr=myploy_xys.split(',');
          this.myploystr="";
          for(j=0;j<(myploy_xysarr.length-1);j++)
          {
            this.myploystr+=myploy_xysarr[j+1]+","+myploy_xysarr[j]+",";
            j++;
          }
          this.myploystr=this.myploystr.substring(0,this.myploystr.length-1); 
          if(this.myploy_xys.indexOf('#')>=0)//设置颜色
          {
                var myploy_sty=this.myploy.split('!')[0].split(',');// 取样式
                setStrokeColor(myploy_sty[myploy_sty.length-1].split('$')[0]);//设置颜色
                setStrokeWidth(myploy_sty[myploy_sty.length-1].split('$')[1]);// 设置变形宽度
                
          }else
            {
                setStrokeColor("#ff0000");//设置颜色
                setStrokeWidth(2);// 设置变形宽度
            }
          drawPolygonByCoordinates(this.myploystr,this.myploy.split('!')[5],this.myploy.split('!')[1]);
       }
    }
        if(wiki_line_list!=''&&wiki_line_list.split('|').length>0)
    {
    
        for(var i=0;i<wiki_line_list.split('|').length-1;i++)// 线
        {
          this.myline=wiki_line_list.split('|')[i];
          this.myline_xys = this.myline.replace(/\:/g,",");//纬度，经度，纬度，经度，。。。
          this.myline_xysarr=myline_xys.split(',');
          this.mylinestr="";
          for(j=0;j<myline_xysarr.length-1;j++)
          {
            this.mylinestr+=myline_xysarr[j+1]+","+myline_xysarr[j]+",";
            j++;
          }
          this.mylinestr=this.mylinestr.substring(0,this.mylinestr.length-1);
           if(this.myline_xys.indexOf('#')>=0)//设置颜色
          {
                var myline_sty=this.myline.split('!')[0].split(',');// 取样式
                setStrokeColor(myline_sty[myline_sty.length-1].split('$')[0]);//设置颜色
                setStrokeWidth(myline_sty[myline_sty.length-1].split('$')[1]);// 设置变形宽度
                
          }else
            {
                setStrokeColor("#ff0000");//设置颜色
                setStrokeWidth(2);// 设置变形宽度
            }
       drawLineByCoordinates(this.mylinestr,this.myline.split('!')[5],this.myline.split('!')[1]);

        }
    };
};
//传入经纬度串转成XY坐标gp (a:a;b:b;c:c)
function  lat_long_xy(lat_long)
{

    var str1='';
    var str2='';
    var list = new Array(); 
    list = lat_long.split(',');
    for(i=0;i<list.length-1;i++)
    {
        var xy = list[i].split(':');
        getXY(xy[0],xy[1]);
        if(i!=list.length-2)
        {
            str1+= bmap.curX+',';
            str2+= bmap.curY+',';
        }else
        {
            str1+= bmap.curX;
            str2+= bmap.curY;
        }
    }
    wiki_style = list[list.length-1].split(':');
    cut_xystr(str1,str2);
  
};
//读取样式
function getstyles(strs)

{
    redrawcolor='';
    redrawsize='';
    p_id=0;
    enda='';
    var what='';
    redrawcolor=strs.substring(strs.indexOf('#'),strs.indexOf('#')+7);
    redrawsize=strs.substring(strs.indexOf('$')+1,strs.indexOf('$')+2);
    what=strs.substring(strs.indexOf('@')+1,strs.indexOf('@')+2);
    if(what=='n')
    {
        enda='none';
    }
    else
    {
        enda='block';
    }
    zindex=strs.substring(strs.indexOf('^')+1,strs.indexOf('^')+5);
    p_id=strs.substring(strs.indexOf('~')+1,strs.length);  
};
    //根据经纬度获得XY坐标  GP
    this.getXY=function(latx,longy)
    { 
        this.curY = Math.round(this.height/2-(latx-this.mapLong)*this.map_pix_lat/this.cur_zoom_lat_perMap+this.top); //相对页面Y坐标 
        this.curX = Math.round(this.width/2-(this.mapLat-longy)*this.map_pix_long/this.cur_zoom_long_perMap+this.left)  //经度
    };

//输入点xy坐标修正偏移量
function cut_xystr(str1,str2)
{
    var x = str1.split(',');
    var y = str2.split(',');
    listx.length=0;
    listy.length=0;
    for(i=0;i<x.length;i++)//修正地图坐标偏移
    {
        listx.push(parseInt(x[i])-bmap.left);
        listy.push(parseInt(y[i])-bmap.top);
    }
};

function hideBubblex()//mainmap控制泡泡
{
    var aBubble=document.getElementById("bubble");
    if(aBubble)
    {
        aBubble.parentNode.removeChild(aBubble);
    }
    if(bmap.bubble)
    {
        bmap.bubble=null;
    }
};
/**函数名：MoveToolTip(placeDivName,divTop,divLeft,err)
 **功能：移动ToolTip
 */
function MoveToolTip(placeDivName,divTop,divLeft,err)
{
    if(isIE)
    {
        document.getElementById(placeDivName).style.top=(eval(divTop)+document.body.scrollTop-15);
    }
    else
    {
        document.getElementById(placeDivName).style.top=eval(divTop-15);
    }
    document.getElementById(placeDivName).style.left=eval(divLeft);
};
    //标点
this.myshowicon=function(event,id)
{

	event=event?event:window.event;
	this.tt=document.getElementById(id);
	this.daps=document.getElementById("myLayerIcon").style;
	this.ttop=this.tt.offsetTop;
	this.thei=this.tt.clientHeight;
	this.tleft=this.tt.offsetLeft;
	this.ttyp=this.tt.type;
	while(this.tt=this.tt.offsetParent)
	{
		this.ttop+=this.tt.offsetTop;
		this.tleft+=this.tt.offsetLeft
	}
if(daps.display=="block")
	{
		daps.display="none"
	}else 
	{
		daps.display="block"
	}
colorpanel.style.display="none";
	LayerPen.style.display="none"
 };
 function swithicon1()
{	
    //var myLayerIcon=document.getElementById("myLayerIcon");    	    
	if(myLayerIcon.style.display=="block")
	{
		myLayerIcon.style.display="none";
	}
	else 
	{
		myLayerIcon.style.display="block";
	}
	colorpanel.style.display="none";
	LayerPen.style.display="none";
};
//拖拽模式
var tz_z,tz_x,tz_y;
function dragsover()
{
    if(event.button==1&&isdragpic==1)
    {
      var thisid=this.id;
      var temp=IconContents[thisid].split(',');
      var p_id=temp[0];
      var nowx=tz_z.style.pixelLeft+bmap.left+this.width/2;
      var nowy=tz_z.style.pixelTop+bmap.top+this.height;
      var p_x_y=convertToLon(nowx,nowy);
      updatexy(p_id,p_x_y);
    }
};
function move()
{
    if (event.button==1&&isdragpic==1)
    {
        tz_z.style.pixelLeft=temp1+event.clientX-tz_x;
        tz_z.style.pixelTop=temp2+event.clientY-tz_y;
        return false;
    }
};
function drags(){
    if(event.button==2&&isdragpic!=1)
    {
        getPID(IconContents[this.id]);
        return;
    }
    if (!document.all)
    {
        return;
    }
    if (event.srcElement.className=="drag")
    {
        tz_z=event.srcElement;
        temp1=tz_z.style.pixelLeft;
        temp2=tz_z.style.pixelTop;
        tz_x=event.clientX;
        tz_y=event.clientY;
    }
};
function updatexy(id,p_x_y)
{
    var apx=p_x_y.substring(0,p_x_y.indexOf(':'));
    var apy=p_x_y.substring(p_x_y.indexOf(':')+1,p_x_y.length-1);
	if(myupdate.readyState==4||myupdate.readyState==0)
	{		
		myupdate.open("GET",'instant_update_xy_ajax.aspx?id='+id+'&apx='+apx+'&apy='+apy,true);
		myupdate.onreadystatechange = overupdate;
		myupdate.send(null);
	}
};
function overupdate()
{
	if(myupdate.readyState==4)
	{
		parent.frames['tree_iframe'].document.location=parent.frames['tree_iframe'].document.location;
	}
};
function convertToLon(x,y)
{
    var mouse_click_x=x-bmap.left;
    var mouse_click_y=y-bmap.top;
    var code_x;
    var code_y;
    code_x=bmap.mapLong+((-mouse_click_y+(bmap.height/2))*bmap.cur_zoom_lat_perMap)/bmap.map_pix_lat;
    code_y=bmap.mapLat-(((bmap.width/2)-mouse_click_x)*bmap.cur_zoom_long_perMap)/bmap.map_pix_long;
    return code_x+':'+code_y+',';
};
//点击wiki右边树的时候
function mouseClickPoint(title,left,top,content1,pid)
{
    my_vars.bubbleLong = left;
    my_vars.bubbleLat = top;


    var left = longToImageX(left);
    var top = latToImageY(top);

    doMapPans(bmap.width / 2 - left, bmap.height / 2 - top);


    document.getElementById("tips").style.visibility = "hidden";
    var bubleObj = document.getElementById("bubble");
    
    bubleObj.style.display = "block";
    bubleObj.style.left = left + 10 + "px";
    bubleObj.style.top = top - 30 + "px";
	bubleObj.innerHTML='<div unselectable="on" style="z-index:1">'+'<table width="270"  border="0" cellspacing="0" cellpadding="0">'+'<tr>'+' <td width="10"><img src="'+imagesUrl+'images/new_r1_c1.png" width="10" height="10"></td>'+'<td width="270" background="'+imagesUrl+'images/new_r1_c2.gif"></td>'+'<td width="10"><img src="'+imagesUrl+'images/left1_r1_c6.png" width="10" height="10"></td>'+'</tr>'+'<tr>'+' <td height="240" background="'+imagesUrl+'images/new_r2_c1.gif">&nbsp;</td>'+'<td align="right" valign="top" bgcolor="#FFFFFF">'+'<a href="javascript:closeBuble();"><img src="'+imagesUrl+'images/close.gif" width="14" height="13" border="0"></a><br><br><Br><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>'+'</td>'+' <td background="'+imagesUrl+'images/new_r3_c6.gif">&nbsp;</td>'+' </tr>'+'<tr>'+'<td><img src="'+imagesUrl+'images/left1_r5_c1.png" width="10" height="10"></td>'+'<td background="'+imagesUrl+'images/new_r5_c2.gif"></td>'+'<td><img src="'+imagesUrl+'images/left1_r5_c6.png" width="10" height="10"></td>'+'</tr>'+'</table>'+'<img src="'+imagesUrl+'images/qqqq_r1_c2.png" width="1" height="109">'+'</div><div class=tooltiptitle unselectable="on" style="position:absolute; left:10px; top:8px; width:217px; height:20px;">'+title+'</div><div unselectable="on" style="position:absolute; left:5px; top:25px; width:260x; height:250px;overflow-x:no;overflow-y:no">'+'<iframe scrolling="no" frameborder="0" width="260px" height="232px" scrolling="auto" src="mainContent.aspx?p_name='+title+'&p_id='+pid+'"></iframe></div>';
    my_vars.bubbleTips = 1;
}
/*颜色板显示相关start*/
var current=null;
function ShowColorPal(event,id)
{
    var event=event?event:window.event;
	var tt=document.getElementById(id);
	var colorpanelObj = document.getElementById("colorpanel");
	colorpanelObj.eventSrc=event.srcElement || event.target;
	//var daps=document.all.colorpanelObj.style;
	var ttop=tt.offsetTop;
	var thei=tt.clientHeight;
	var tleft=tt.offsetLeft;
	var ttyp=tt.type;
	while(tt=tt.offsetParent)
	{
		ttop+=tt.offsetTop;
		tleft+=tt.offsetLeft;
	}
	colorpanelObj.style.display="block";
	document.getElementById("LayerPen").style.display="none";
	document.getElementById("myLayerIcon").style.display="none";
};



//颜色版鼠标悬停事件
this.doOver=function(event)
{
     var event=event?event:window.event;
     var myobj =event.srcElement ||event.target;
    if((myobj.tagName=="TD")&&(current!=myobj))
    {
        if(current!=null)
        {
	        current.style.backgroundColor=current._background;
        }
        myobj._background=myobj.style.backgroundColor;
        document.getElementById("DisColor").style.backgroundColor=myobj.style.backgroundColor;
        document.getElementById("HexColor").value=myobj.style.backgroundColor.toUpperCase();
        myobj.style.backgroundColor="white";
        current=myobj;
    }
};

//颜色版鼠标点击事件
this.doclick=function(event)
{
    
     var event=event?event:window.event;
     var  myobj = event.srcElement || event.target;
    if(myobj.tagName=="TD")
    {
        var curColor=myobj._background.toUpperCase();
        tempcolor=curColor;
        setStrokeColor(tempcolor);
        document.getElementById("colorpanel").style.display="none";
        color1=curColor;
    }
};

//颜色版鼠标移出事件
this.doOut=function()
{
    if(current!=null)current.style.backgroundColor=current._background;
};

//颜色版关闭事件
this.cl=function()
{
    document.getElementById("colorpanel").style.display="none";
};
//粗细选择
this.selectpen=function(penname)
{
    tempsize=penname;
    setStrokeWidth(tempsize);
    swithpen();
};

//粗细面板
this.showpen=function(event,id)
{
    var event=event?event:window.event;
	var tt=document.getElementById(id);
	var LayerPenObj = document.getElementById("LayerPen");
	LayerPenObj.eventSrc=event.srcElement ||event.target;
	this.daps=LayerPenObj.style;
	this.ttop=tt.offsetTop;
	this.thei=tt.clientHeight;
	this.tleft=tt.offsetLeft;
	this.ttyp=tt.type;
	while(tt=tt.offsetParent)
	{
		this.ttop+=tt.offsetTop;
		this.tleft+=tt.offsetLeft;
	}
	swithpen();
};


function swithpen()
{
	document.getElementById("colorpanel").style.display="none";
	document.getElementById("myLayerIcon").style.display="none";
	if(document.getElementById("LayerPen").style.display=="block")
	{
		document.getElementById("LayerPen").style.display="none";
	}
	else 
	{
		document.getElementById("LayerPen").style.display="block";
	}
};
/*粗细版显示end*/
