var ArrayGlobal = new Array();
var ArrayWarn = new Array();
ArrayWarn[0] = '请先点击热点进入地图';

var NODE = '';
var Authority = '';
var CITYCODE = ''; //城市代码
var CITYNAME = ''; //城市名称
var USERAGENT = '';//浏览器类型
var RESOURCEPATH = 'cityresource/';
var RESOURCEFOLDER = '';
var SKINFOLDER = '';//皮肤文件夹名称
var CAID = 0

var MaxRight;	//右侧最大值
var MaxBot;	    //底最大值
var MaxLeft;	//左侧最大值
var MaxTop;		//顶最大值
var MapWinW;	//当前地图窗口宽度
var MapWinH;	//当前地图窗口高度

var EyeWinW;		//鹰眼的宽度
var EyeWinH;		//鹰眼的高度
var Eye_OffSetX;    //鹰眼的宽度偏移量
var Eye_OffSetY;    //鹰眼的高度偏移量
var Eye_ScaleX;     //宽度比例
var Eye_ScaleY;     //高度
var IsInMap=0; //判断是否在地图中


//公用函数
//返回相对于根目录的深度
function getLayer()
{
	var localPath = document.location.href;
	alert(localPath);
	tempArray = localPath.split('/');
	strAttachPath = '';
	for(var i=2; i<tempArray.length; i++)
	{
		strAttachPath += '../';
	}
	return strAttachPath;	
}
//返回一个元素对象
function getId(_id)
{
	return document.getElementById(_id);
}

//移除一个对象
function removeId(_id)
{
	if( getId(_id) )
		document.body.removeChild(getId(_id));
}

//取得象素值
function getPixel(val)
{
	return val.replace('px','');
}

//获取一个元素的位置
function getDim(el)
{
  for(var lx=0,ly=0; el!=null; lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
  return {x:lx,y:ly};
}
//打开页卡大图片
function OpenImages(imgUrl)
{
	var strImgFileName = imgUrl.split('/')[imgUrl.split('/').length-1];
	imgUrl = imgUrl.replace(strImgFileName,'');
	imgUrl += strImgFileName.substring(1,strImgFileName.length);
	window.open(imgUrl,'图片','');
}

//弹出窗口
function winopen(page,winName,w,h,scrollbars,resizable,left,top)
{
	if( !scrollbars ) scrollbars = 0;
	if( scrollbars==1) scrollbars= 'yes';
	if( scrollbars==0) scrollbars= 'no';
	
	if( !resizable ) resizable = 0;
	if( resizable==1) resizable= 'yes';
	if( resizable==0) resizable= 'no';
	if(!top)top = 0;
	if(!left)left = 0
	
	str = 'width=' + w + ', height=' + h + ',top='+top+',left='+left+',scrollbars=' + scrollbars + ',resizable=' + resizable + ',toolbar=no,location=no,directories=no,status=no,menubar=no';
	window.open(page, winName, str);
	return false;
}
function openFullScreen()
{
	
	var targeturl='fullscreen.aspx?cx=' + GetCenterx() + '&cy=' + GetCentery() + '&cityCode=' + CITYCODE;
	newwin=window.open("","","scrollbars")
	if (document.all){
	newwin.moveTo(0,0)
	newwin.resizeTo(screen.width,screen.height)
	}
	newwin.location=targeturl
	//str = 'fullscreen=0,scrollbars=0,resizable=1,toolbar=no,location=no,directories=no,status=no,menubar=no';
	//window.open('fullscreen.aspx?cx=' + GetCenterx() + '&cy=' + GetCentery() + '&cityCode=' + CITYCODE, '全屏', str);
}

//获取路径中的文件名
function getFileName(filepath)
{	
	filename = '';
	i = filepath.lastIndexOf('/');
	if(i>-1)
		filename = filepath.substring(i+1);
	else
	{
		i = filepath.lastIndexOf('.');
		if(i>-1)
			filename = filepath;
	}
	return filename;

}

//取得文件后缀名称
function getFilePostfix(filename)
{
	i = filename.lastIndexOf('.');
	if(i>-1)
		postfix = filename.substring(i+1);
	else
		postfix = '';
	return postfix;
}

//获取一个指定范围的随机数
function GetRandomNum(minNum, maxNum)
{
	return minNum + Math.round((Math.random()*(maxNum-minNum)));
}

//获取一个随机数生成的序列
function getRandomList(count)
{
	var rndStr = '';
	for(var i=0; i<count; i++)
	{
		rndStr += Math.round((Math.random()*10));
	}
	return rndStr;
}

//判断一个点是否在一个矩形中
function inRect(fx, fy, lx, ly, rx, ry)
{
	//alert('fx='+fx+'fy='+fy+'lx='+lx+'ly='+ly+'rx='+rx+'ry='+ry);
	if(fx>=lx&&fx<=rx&&fy>=ly&&fy<=ry)
		return true;
	else
		return false;
}
var Eds_Map_Around_Service_objId;
function getService(strServiceUrl,objID)
{
	Eds_Map_Around_Service_objId = objID;
	var objService = document.createElement('script');
	objService.language = 'javascript';
	objService.src = strServiceUrl;
	document.body.appendChild(objService);	
}
function Eds_Map_Around_Service_Init()
{
	objId = left.document.getElementById(Eds_Map_Around_Service_objId);
	try
	{
		if(objId)
		{
			var HTML = '';
			if(Eds_S_Title.length>0)
			{
				HTML += '<span style="font-size:14px;text-align:center;width:100%;height:25px;line-height:25px">'+Eds_S_SiteName+'提供信息</span>';
			}
			HTML += '<ul>';
			for(i=0;i<Eds_S_Title.length;i++)
			{
				HTML += '<li><a href="'+Eds_S_Url[i]+'" target="_blank">'+Eds_S_Title[i]+'</a></li>';
			}
			HTML += '</ul>';
			objId.innerHTML = HTML;
		}
	}
	catch(e)
	{
		return;
	}
	
}


//获取天气信息
function createWeatherXml()
{
	ArrayGlobal['WeatherStr'] = document.getElementById('labWeather').innerHTML;
	getId('labWeather').innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	ArrayGlobal['WeatherActiveX'] = new ActiveXObject("Microsoft.XMLDOM");
	var url = 'XmlService.aspx?action=weather&cityName=' + CITYNAME;
	ArrayGlobal['WeatherActiveX'].async = true;
	ArrayGlobal['WeatherActiveX'].load(url);
	getWeatherXml();
	url=null;
	delete(url);
	return ;
}
var objXmlActiveX
function getXmlService(strXmlUrl,objID)
{
	if (!objXmlActiveX)
	{
		var url = strXmlUrl;
		objXmlActiveX = new ActiveXObject("Microsoft.XMLDOM");
		objXmlActiveX.async = true;
		objXmlActiveX.load(url);
	}
	if(objXmlActiveX.readyState<=3)
	{
	    var strFun = 'getXmlService(\''+strXmlUrl+'\',\''+objID+'\')';
	    window.setTimeout(strFun, 1000);
	}
	else
	{
		objXml = eval('document.left.'+objID);
		try
		{
			SiteName  = objXmlActiveX.getElementsByTagName("SiteName").item(0).text;
			Authority = objXmlActiveX.getElementsByTagName("Authority").item(0).text;
			Record    = objXmlActiveX.getElementsByTagName("Record");
			for(i=0;i<Record.length;i++)
			{
				objXml.innerHTML += '<li><a href="'+Record.item(i).getElementsByTagName('Url').item(0).text+'" target="_blank">'+Record.item(i).getElementsByTagName('Caption').item(0).text+'</a></li>';
			}
			objXmlActiveX=null
			url = null;
			delete(url);
		}
		catch(e)
		{
		}
	}
	
}

			
function getWeatherXml(timeCount)
{
	if(!timeCount) timeCount = 0 ;
	timeCount++;
	if(timeCount>1000) return;
	if( ArrayGlobal['WeatherActiveX'].readyState<=3 )
	{
		var funstr = 'getWeatherXml('+ timeCount + ')';
		window.setTimeout(funstr, 1000);
		return;
	}
					
	if(!ArrayGlobal['WeatherActiveX'].documentElement || ArrayGlobal['WeatherActiveX'].parseError.errorCode != 0)
	{
		//alert('XML解析出现了错误！\n');
		//return false;
		var funstr = 'getWeatherXml('+ timeCount + ')';
		window.setTimeout(funstr, 1000);
		return;
	}
	else
	{
		try
		{
			resultItem = ArrayGlobal['WeatherActiveX'].getElementsByTagName("result");
			for(var i=0; i<resultItem.length; i++)
			{
				ArrayGlobal['WeatherStr'] = ArrayGlobal['WeatherStr'].replace( '{$Wea}', resultItem.item(i).getElementsByTagName("weather").item(0).text );
				ArrayGlobal['WeatherStr'] = ArrayGlobal['WeatherStr'].replace( '{$Tem}', resultItem.item(i).getElementsByTagName("temperature").item(0).text );
				getId('labWeather').innerHTML = ArrayGlobal['WeatherStr'];
			}
		}
		catch(e)
		{
		
		}
	}
}

function checkMapIni()
{	
	if( !ArrayGlobal['MapIni'] )
	{
		mapIni();
		ArrayGlobal['MapIni'] = true;
	}
}

//开始定位
function goAnchor(iUnitID, iCompanyID, iType, timeCount)
{
	if(!timeCount) timeCount = 0;
	if(!iType) iType=1;
	IsInMap=1;
	timeCount++;
	if(timeCount>1000) 
	{
		alert('定位超时!');
		return;
	}
	
	try{
		window.self.focus();
		if(!iUnitID) iUnitID = 0;
		if(!iCompanyID) iCompanyID = 0;
		var objAnchor = document.createElement('script');
		objAnchor.language = 'javascript';
		objAnchor.src = 'script.aspx?action=anchor&unitID=' + iUnitID + '&companyID=' + iCompanyID + '&type=' + iType + '&node=' + NODE;
		document.body.appendChild(objAnchor);
	}
	catch(e)
	{
		funcStr = 'goAnchor(' + iUnitID + ', ' + iCompanyID + ', ' + timeCount + ');';
		setTimeout(funcStr,500);
	}
}


function createAnchor(lx,ly,w,h,iOwnerID,iCompanyID,anchorName,iType,timeCount)
{
    IsInMap=1;
	for(i=0;i<MaxRight.length;i++)
	{
		if(inRect(lx,ly,MaxLeft[i],MaxTop[i],MaxRight[i],MaxBot[i]))
		{
			if(CAID!=i)
			{
				CAID = i;
				ifraEye.SwitchEye(CAID);
			}
		}
	}


	if(!timeCount) timeCount = 0;
	if(!iType) iType=1;
	
	timeCount++;
	if(timeCount>1000) return;
	try
	{
		if( getMapStatus() )
		{
			checkMapIni();
			showDivWelcome(0);
			switchDivSearch(0);
			showDivMap(1);
			//setConMenu(true);
			window.self.focus();
			go2xy(lx,ly);
			initializeEye();
			astr ='<table border="0" align="center" cellpadding="0" cellspacing="0">';
			astr +='<tr>';
			astr +='<td><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_01.gif" width="12" height="24"></td>';
			astr +='<td valign="bottom" nowrap background="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_03.gif"><a style="font-size: 14px; line-height: 20px; font-weight: bold; color: #FF0000;text-decoration: none;" href=javascript:parent.showLeftCard(' + iOwnerID + ',' + iCompanyID + ')>' + anchorName + '</a></td>';
			astr +='<td style="cursor:hand" onClick="removePop(\'AnchorSign\');"><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_04.gif" width="18" height="24"></td>';
			astr +='</tr>';
			astr +='<tr>';
			astr +='<td valign="top"><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_05.gif" width="12" height="4"></td>';
			astr +='<td valign="top" background="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_08.gif"><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_06.gif" width="41" height="4"></td>';
			astr +='<td><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_09.gif" width="18" height="4"></td>';
			astr +='</tr>';
			astr +='<tr>';
			astr +='<td>&nbsp;</td>';
			astr +='<td><img src="skins/'+ SKINFOLDER +'/images_skin/anchor/dw_11.gif" width="41" height="26"></td>';
			astr +='<td>&nbsp;</td>';
			astr +='</tr>';
			astr +='</table>';
		
			astr +='<div style="position:absolute; left:-8; top:33 ">';
			astr +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="42" height="42">'
			astr +='  <param name="movie" value="skins/' + SKINFOLDER + '/images_skin/anchor/anchor.swf">'
			astr +='  <param name="quality" value="high">'
			astr +='  <param name="wmode" value="transparent">'
			astr +='  <param name="SeamlessTabbing" value="1">'
			astr +='  <embed src="skins/' + SKINFOLDER + '/images_skin/anchor/anchor.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="42" height="42" swLiveConnect="true"></embed>'
			astr +='</object>'
			astr +='</div>'
			x = Math.round(lx+w/2);
			y = Math.round(ly+h/2);
			removePop('AnchorSign');
			putPop(x,y,12,54,astr,'AnchorSign');
			if(iType==1) showLeftCard(iOwnerID, iCompanyID);
			//if( GetZoom()==1 ) 
			getDyInfo();
			setCenChExFunc('onMapZoom()');
			//marker.Load();
　　　　　	//marker.mapLoadStatus = true;
		}
		else
		{
			funcStr = 'createAnchor('+lx+','+ly+','+w+','+h+','+iOwnerID+','+iCompanyID+',\''+anchorName+'\','+iType+','+timeCount+');';
			setTimeout(funcStr,500);
		}
	}catch(e)
	{
		//alert(e.description);
		funcStr = 'createAnchor('+lx+','+ly+','+w+','+h+','+iOwnerID+','+iCompanyID+',\''+anchorName+'\','+iType+','+timeCount+');';
		setTimeout(funcStr,500);
	}
}

function onMapZoom()
{
	//if( GetZoom()==1 )
	 getDyInfo();
}

// 重置地图宽度高度
function onLoadMap()
{
	try
	{
		//self.moveTo(0,0);
		//self.resizeTo(screen.availWidth,screen.availHeight);
		//resetMapSize();
		self.focus();
	}
	catch(e)
	{}
}

function resetMapSize()
{
	constW = 722;
	width = document.body.clientWidth-250;
	if(width<constW) width=constW;
	getId('divMap').style.width = width;
	width = document.body.clientWidth-250;
	if(width<constW) width=constW;
	getId('divNav').style.width = width;
}

//获取动态信息
function getDyInfo(timeCount)
{	
	if(!timeCount) timeCount = 0;
	timeCount++;
	if(timeCount>1000) return;

	try{	
		lx = GetCenterx()-377;
		ly = GetCentery()-245;
		rx = GetCenterx()+377;
		ry = GetCentery()+245;
		randID = 'dyInfo' + getRandomList(5);
		var objDyInfo = document.createElement('script');
		objDyInfo.id = randID;
		objDyInfo.language = 'javascript';
		objDyInfo.src = 'script.aspx?action=dyinfo&objID=' + randID + '&lx=' + lx + '&ly=' + ly + '&rx=' + rx + '&ry=' + ry + '&node=' + NODE;
		document.body.appendChild(objDyInfo);
		//document.write(objDyInfo.src);
	}
	catch(e)
	{
		funcStr = 'getDyInfo(' + timeCount + ');';
		setTimeout(funcStr,1500);
	}
}

function modeDyInfo()
{
	var str = '';
	str += '<div style="width:198px; height:139px; background:url(skins/' + SKINFOLDER + '/images_skin/logo/bgdyinfo.gif); filter:Alpha(Opacity=80); text-align:center">';
	str += '<div style="width:13px; height:14px; cursor:hand;" onclick="removePop(\'{$DivDyInfo}\');">&nbsp;</div>';
	str += '<marquee behavior=scroll direction=up onMouseOver="this.stop()" onMouseOut="this.start()" width=175px height=70px scrollamount=1 scrolldelay=0>';
	str += '{$DyInfo}';
	str += '</marquee>';
	str += '</div>';
	return str;
}

function createDyInfo(x, y, w, h, infoStr)
{
	objStr = 'divDyInfo' + x + y;
	tempArray = infoStr.split('|');
	var str = '';
	var isShow = false;
	for( var i=0; i<tempArray.length; i++ )
	{	
		detailArray = tempArray[i].split(', ');
		var showFlag = detailArray[0].split('*')[0];	
		//alert(showFlag);
		//alert(GetZoom());
		var tempShow = false;
		if(showFlag < 4 && showFlag > 0)
		{
			if(GetZoom() < showFlag){
				isShow = true;
				tempShow = true;
			}
		}else{		
			if(showFlag <= GetZoom())
			{
				isShow =true;
				tempShow =true;
			}
		}
		if(tempShow)
		{
		  if(i%2==0)
		  {
			  str += '<a style="font-size: 12px;color: #1B5D0D;text-decoration: underline;line-height: 17px;" href="#" onclick="javascript:parent.winopen(\'popuppage.aspx?pagemode=dyinfo&node=' + NODE + '&dyInfoID=' + detailArray[0].split('*')[1] + '\',\'动态信息\',540,370,0,0)">'+ (i+1) + '.' + detailArray[1] + '</a><br>';
		  }
		  else
		  {
		  	  str += '<a style="font-size: 12px;color: #FF0101;text-decoration: underline;line-height: 17px;" href="#" onclick="javascript:parent.winopen(\'popuppage.aspx?pagemode=dyinfo&node=' + NODE + '&dyInfoID=' + detailArray[0].split('*')[1] + '\',\'动态信息\',540,370,0,0)">'+ (i+1) +'.' + detailArray[1] + '</a><br>';
		  }
		}
	}
	str = modeDyInfo().replace('{$DyInfo}', str);
	str = str.replace('{$DivDyInfo}', objStr);
	removePop(objStr);
	if(isShow)
	{
		putPopT(Math.round(x+w/2), Math.round(y+h/2), 99, 139, str, objStr);
	}
}

//显示分类地图2.1
function showProMapPop(companyTypeId)
{
	try
	{
		if(getMapStatus())
		{
			if( getDivWelcomeStatus() )
			{
				mapIni();
				zoomto(4);
				showDivWelcome(0);
				switchDivSearch(0);
				showDivMap(1);
			}
			removeAllPop();
			var obj = document.createElement('script');
			obj.language = 'javascript';
			var src = 'script.aspx?action=promap&companytypeid='+companyTypeId+'&Node='+NODE;
			
			obj.setAttribute('src',src);
			document.body.appendChild(obj);
			//document.write(obj);
			return true;
		}
		else
		{
			setTimeout("showProMapPop('+companyTypeId+')",500);
			return false;
		}
	}
	catch(e)
	{
		setTimeout("showProMapPop('+companyTypeId+')",500);
		return false;
	}
	
}
//显示更多分类地图2.1
function ShowProMapType(objId)
{
    var obj  = document.getElementById(objId);
	//alert(obj);
	var left = obj.offsetLeft;
	while(obj=obj.offsetParent)
	{
	  left += obj.offsetLeft;
	}
	var obj = document.getElementById(objId);
	var top = obj.offsetTop;
	while(obj=obj.offsetParent)
	{
		top += obj.offsetTop;
	}
	var obj = document.getElementById('ProMapTypes');
	obj.style.display = '';
	obj.style.left = left - 250;
	obj.style.top  = top  - 100;
}
function ShowMzInfo(status)//免责声明　成都
	{
	  var objMz=document.getElementById('mzInfo');
	  
	  if(status)
	   {
	  var obj  = document.getElementById('mzsm');
	//alert(obj);
	var left = obj.offsetLeft;
	while(obj=obj.offsetParent)
	{
	  left += obj.offsetLeft;
	}
	var obj = document.getElementById('mzsm');
	var top = obj.offsetTop;
	while(obj=obj.offsetParent)
	{
		top += obj.offsetTop;
	}
	    objMz.style.display = '';
		objMz.style.left = left-250;
		objMz.style.top = top-70;
	    //alert(objMz.innerHTML);
	   }
	   else
	   {
	    objMz.style.display='none';
	   }
	}

//2.1
function ShowProMapInfo(intProCompanyId,intTypeId)
{
		var obj = document.createElement('script');
		obj.language = 'javascript';
		obj.src = 'script.aspx?action=promapinfo&companytypeid='+intTypeId+'&procompanyId='+intProCompanyId+'&Node='+NODE;
		document.body.appendChild(obj);
		//document.write(obj.src);
}
//2.1
function MapInfoHtml(intX,intY,intCompanyId,intCompanyTypeId,strCompanyName,strAdImgSrc,strAdUrl,strADH,intLx,intLy)
{
	removePop('MapInfo');
	setConMenu(true);
	var strMapInfo = '';
	strMapInfo += '<table border="0" align="center" cellpadding="0" cellspacing="0">';
	strMapInfo += '  <tr>';
	strMapInfo += '    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">';
	strMapInfo += '      <tr>';
	strMapInfo += '        <td width="2"><img src="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_01.gif" width="2" height="17"></td>';
	//strMapInfo += '        <td width="15" background="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_03.gif"><img src="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_02.gif" width="15" height="17"></td>';
	strMapInfo += '        <td valign="bottom" background="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_03.gif" nowrap="nowrap"><a href=card.aspx?CompanyID={$CompanyId}&ProMapTypeID={$CompanyTypeId}&node='+NODE+' target=left style="font-size: 13px;font-weight: bold;color: #FFFFFF;text-decoration: none;">{$CompanyName}</td>';
	strMapInfo += '        <td width="20" background="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_03.gif" style="font-size: 13px;font-weight: bold;color: #FFFFFF;cursor:hand;" onclick="removePop(\'MapInfo\');">×</td>';
	strMapInfo += '        <td width="2"><img src="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_05.gif" width="2" height="17"></td>';
	strMapInfo += '      </tr>';
	strMapInfo += '    </table></td>';
	strMapInfo += '  </tr>';
	strMapInfo += '  <tr>';
	strMapInfo += '    <td colspan="2" align="center" valign="middle"><table border="0" cellpadding="0" cellspacing="0" class="kuang">';
	strMapInfo += '      <tr>';
	strMapInfo += '        <td>{$AdImg}</td>';
	strMapInfo += '      </tr>';
	strMapInfo += '    </table></td>';
	strMapInfo += '  </tr>';
	//strMapInfo += '  <tr>';
	//strMapInfo += '    <td width="20" align="center"><img src="skins/'+ SKINFOLDER +'/images_skin/Promap_images/fl_09.gif" width="7" height="16"></td>';
	//strMapInfo += '    <td width="180" align="left">&nbsp;</td>';
	//strMapInfo += '  </tr>';
	strMapInfo += '</table>';
	strMapInfo = strMapInfo.replace('{$CompanyName}',strCompanyName).replace('{$CompanyId}',intCompanyId).replace('{$CompanyTypeId}',intCompanyTypeId);
	var lx = 19;
	var ly = 34;
	if (strAdImgSrc=='')
	{
		strMapInfo = strMapInfo.replace('{$AdImg}','');
		lx = -(intLx/2-2);
		ly = intLy;
	}
	else
	{
		if(strAdUrl!='')
		{
			strMapInfo = strMapInfo.replace('{$AdImg}','<a href='+strAdUrl+' target=_blank><img src=cityresource/'+SKINFOLDER+'/promap/'+strAdImgSrc+' border=0></a>');
		}
		else
		{
			strMapInfo = strMapInfo.replace('{$AdImg}','<img src=cityresource/'+SKINFOLDER+'/promap/'+strAdImgSrc+' border=0>');
		}
		lx = intLx/2+1;
		ly = intLy+strADH;
	}
	putPop(intX,intY,lx,ly,strMapInfo,'MapInfo');
}

//热点导航层函数
function showDivWelcome(sign)//1显示, 0隐藏, 其他自动切换
{
	objWelcome1 = document.getElementById('divWelcome');
	if(sign==0||sign==1)
	{
		if(sign==1)
			objWelcome1.style.display = '';
		else
			objWelcome1.style.display = 'none';
	}
	else
	{
		if(objWelcome1.style.display == 'none')
			objWelcome1.style.display = '';
		else
			objWelcome1.style.display = 'none';
	}
}

function showDivMap(sign)
{
	objMap = document.getElementById('divMap');
	if(sign==0||sign==1)
	{
		if(sign==1)
			objMap.style.display = '';
		else
			objMap.style.display = 'none';
	}
	else
	{
		if(objMap.style.display == 'none')
			objMap.style.display = '';
		else
			objMap.style.display = 'none';
	}
}

function getDivWelcomeStatus()//显示返回true, 隐藏返回false
{
	objWelcome1 = document.getElementById('divWelcome');
	if(objWelcome1.style.display=='none')
		return false;
	else
		return true;
}

//显示地图头部导航条
function showTopNav(url, w, h)
{
	w = 753;
	document.getElementById('divTopNav').style.display = '';
	obj = document.getElementById('ifrTopNav');
	obj.src = url;
	obj.width = w;
	obj.height = h;
}
//显示整个头部整个页面导航条
function showTopAllNav(url, w, h)
{
	if(!w) w = '100%';
	if(!h) h = '100%';
	 objMap=getId('divWelcome');
	 objMap.top=h;
	document.getElementById('TopAllNav').style.display = '';
	obj = document.getElementById('ifrTopAllNav');
	obj.src = url;
	obj.width = w;
	obj.height = h;
}

//显示底部导航条
function showBottomNav(url, w, h)
{
	if(!w) w = '100%';
	if(!h) h = '100%';
	getId('trBottomNav').style.display = '';
	obj = getId('ifrBottomNav');
	obj.src = url;
	obj.width = w;
	obj.height = h;
}

//显示头部广告
/*function showTopAd(innerAd, t, l)
{
	if(!t) t = '0';
	if(!l) l = '0';
	obj = getId('divTopAd')
	obj.style.display = '';
	obj.innerHTML     = innerAd;
	obj.style.top     = t;
	obj.style.left    = l;
}*/

//显示头部广告
function showTopAd(innerAd, t, l)
{
	if(!t) t = '0';
	if(!l) l = '0';
	obj = getId('divTopAd')
	obj.style.display = '';	
	//obj.innerHTML     = '<div onclick="javascript:obj.style.display='+"'none'"+'" style="height:11px;padding-top:3px;position:absolute;z-index:100; font-size:12px;cursor:pointer;width:50px;color:#333;">关闭<img  src="images/close.gif" /></div>'+'<div stle="position:absolute; z-index:11;text-align:right;">'+innerAd+'</div>'
	obj.innerHTML     = '<div onclick="javascript:obj.style.display='+"'none'"+'" style="height:11px;background:#fff;width:44px;	color:#333;	padding-top:3px;position:absolute;	z-index:100;font-size:12px;	cursor:pointer;	left: 78px;	top: 1px; padding-left:2px; padding-right:2px; filter:alpha(opacity=85)">关闭 <img src="images/close.gif" /></div>'+'<div stle="position:absolute; z-index:11;text-align:right;width:120px; height:110px;">'+innerAd+'</div>'
	obj.style.top     = t;
	obj.style.left    = l;
}

//搜索显示层函数
function switchDivSearch(sign)//1显示, 0隐藏, 其他自动切换
{
	objSearch1 = document.getElementById('divSearch');
	if(sign==0||sign==1)
	{
		if(sign==1)
			objSearch1.style.display = '';
		else
			objSearch1.style.display = 'none';
	}
	else
	{
		if(objSearch1.style.display == 'none')
			objSearch1.style.display = '';
		else
			objSearch1.style.display = 'none';
	}
}

function getDivSearchStatus()
{
	objSearch1 = document.getElementById('divSearch');
	if(objSearch1.style.display=='none')
		return false;
	else
		return true;
}


//显示左边页卡
function showLeftOwner()
{
	iOwnerID = getCurOwnerID();
	if( iOwnerID<=0 ) return;
	
	if( left.location.href.indexOf('card.aspx?OwnerID='+iOwnerID)==-1 )
		left.location.href='card.aspx?OwnerID=' + iOwnerID + '&node=' + NODE;
}
function showLeftCompany(){
	iCompanyID = getCurCompanyID();
	if( iCompanyID<=0 ) return;
	
	if( left.location.href.indexOf('card.aspx?CompanyID='+iCompanyID)==-1 )
		left.location.href='card.aspx?CompanyID=' + iCompanyID + '&node=' + NODE;
}
function showLeftCard(iOwnerID, iCompanyID)
{
	if( left.location.href.indexOf('card.aspx?OwnerID='+iOwnerID+ '&CompanyID=' + iCompanyID)==-1 )
		left.location.href='card.aspx?OwnerID='+iOwnerID+ '&CompanyID=' + iCompanyID + '&node=' + NODE;
}
function setEventLeftCard()
{
	try
	{
		if( getMapStatus() )
		{
			setOwnerExFunc('showLeftOwner()');
			setComExFunc('showLeftCompany()');
		}
		else
			setTimeout("setEventLeftCard()",500);
	}
	catch(e)
	{
		setTimeout("setEventLeftCard()",500);
	}
}
var downStr;
function setMap(aevent,timeCount)
{	
	if( getMapStatus() )
	{
		eye_X = aevent.clientX;
		eye_Y = aevent.clientY;
		
		objEyeSign = ifraEye.divEyeSign;
		objEyeSign.style.pixelLeft = eye_X - Math.round(objEyeSign.style.pixelWidth/2);
		objEyeSign.style.pixelTop = eye_Y - Math.round(objEyeSign.style.pixelHeight/2);
		
		map_X = Math.round((eye_X+Eye_OffSetX)*Eye_ScaleX) + parseInt(MaxLeft[CAID]);
		map_Y = Math.round((eye_Y+Eye_OffSetY)*Eye_ScaleY) + parseInt(MaxTop[CAID]);
		showDivWelcome(0);
		showDivMap(1);
		if(location.href.indexOf('ok')>0)
		 {
		   test();
		 }
		go2xy(map_X, map_Y);
	}
	else
	{
		go2xy(map_X, map_Y);
	}
	
}
function test()
{
try{
 
  downStr = setEvent('onmousedown','mydown');
   startGetCoo();
  }
  catch(e)
  {
   setTimeout('test()',500);
  }
}
function mydown(aevent)
{
  alert(getCoox());
  eval(downStr);
  windows.status=GetCurx(aevent)+','+getCurx(aevent);
}
//鹰眼调用函数
function initializeEye(timeCount)
{
	if(!timeCount) timeCount = 0;
	timeCount++;
	if( timeCount>500 ) return;
	
	try
	{
		objEyeSign = ifraEye.divEyeSign;
		Eye_ScaleX = (MaxRight[CAID]-MaxLeft[CAID])/EyeWinW[CAID];
		Eye_ScaleY = (MaxBot[CAID]-MaxTop[CAID])/EyeWinH[CAID];
		objEyeSign.style.width = 20;
		objEyeSign.style.height = 20;
		objEyeSign.style.pixelLeft = Math.round( GetCenterx()/Eye_ScaleX ) - Eye_OffSetX - Math.round(getPixel(objEyeSign.style.width)/2);
		objEyeSign.style.pixelTop = Math.round( GetCentery()/Eye_ScaleY ) - Eye_OffSetY - Math.round(getPixel(objEyeSign.style.height)/2);
	}
	catch(e)
	{
		funstr = 'initializeEye(' + timeCount + ')';
		setTimeout(funstr, 500);
	}
}

function setEye(aevent)
{
	eval(ArrayGlobal['event_eye']);
	objEyeSign = ifraEye.divEyeSign;
	if(objEyeSign)
	{ 
		objEyeSign.style.pixelLeft =  Math.round((GetCenterx()-MaxLeft[CAID])/Eye_ScaleX) - Eye_OffSetX - Math.round(objEyeSign.style.pixelWidth/2);
		objEyeSign.style.pixelTop =  Math.round((GetCentery()-MaxTop[CAID])/Eye_ScaleY) - Eye_OffSetY - Math.round(objEyeSign.style.pixelHeight/2);
	}
	
	if(!ArrayGlobal["oCenterX"])
		ArrayGlobal["oCenterX"] = GetCenterx();	
	if(!ArrayGlobal["oCenterY"])
		ArrayGlobal["oCenterY"] = GetCentery();
	if( Math.abs(ArrayGlobal["oCenterX"]-GetCenterx())>256||Math.abs(ArrayGlobal["oCenterY"]-GetCentery())>256 )
	{
		ArrayGlobal["oCenterX"] = GetCenterx();	
		ArrayGlobal["oCenterY"] = GetCentery();
		//alert(NODE);
		
		if( (NODE=='chengdu.edushi.com' || NODE=='weihai.edushi.com' || NODE=='sz.edushi.com') && GetZoom()==1)
		{
			//window.status = NODE;
            setTimeout("goXunBao()",2000);
		}
	}
	
	if(!ArrayGlobal["oDyCenterX"])
		ArrayGlobal["oDyCenterX"] = GetCenterx();	
	if(!ArrayGlobal["oDyCenterY"])
		ArrayGlobal["oDyCenterY"] = GetCentery();
	if( Math.abs(ArrayGlobal["oDyCenterX"]-GetCenterx())>377||Math.abs(ArrayGlobal["oDyCenterY"]-GetCentery())>245 )
	{
		ArrayGlobal["oDyCenterX"] = GetCenterx();	
		ArrayGlobal["oDyCenterY"] = GetCentery();
		//if( GetZoom()==1&&Get_eds_v()==3 )
			getDyInfo();
	}
}

function setEyeEvent()
{
	try
	{
		if( getMapStatus() )
		{
			ArrayGlobal['event_eye'] = setEvent('onmouseup','setEye');
		}
		else
			setTimeout("setEyeEvent()",500);
	}
	catch(e)
	{
		setTimeout("setEyeEvent()",500);
	}
}



//导航条函数
function goSearch(url)
{
	divSearch.style.display = '';
	try{
		if( url.split('?')[1]==ifraSearch.location.href.split('?')[1] )
			return ;
	}
	catch(e){}
	ifraSearch.location.href = url;
}
function initializeZoomBar()
{
	sizeobj = document.getElementById('zoomsize');
	zoombarobj = document.getElementById('zoombar');
	zoomsignobj = document.getElementById('zoomsign');
	width = (4-Zoom)*(zoombarobj.width-zoomsignobj.width);
	sizeobj.width = width;
}


function showCheckBok()
{
	if( getDivWelcomeStatus() )
	{
		alert(parent.ArrayWarn[0]);
		return;
	}
	
	obj = event.srcElement;
	//if (!obj) obj = event.target;
	switch(obj.id)
	{
		case 'buttonbusstation':
			if( !obj.checked )
				showBus();
			else
				hiddenBus();
			break;
		case 'buttonroad':
			if( !obj.checked )
				showRoad();
			else
				hiddenRoad();
			break;
		case 'buttonjit':
			if( !obj.checked )
				showJit();
			else
				hiddenJit();
			break;
		default:
			break;
	}
}

//搜索框函数
var Search_Address_HtmlCode = '';
var Search_Bus_HtmlCode = '';
var Search_House_HtmlCode = '';
var Search_DyInfo_HtmlCode = '';

var arrayAddress = new Array();
var arrayAddressKey = new Array();
var arrayBusNumber = new Array();
var arrayBusNumberKey = new Array();
var arrayBusStation = new Array();
var arrayBusStationKey = new Array();
var arrayHouse = new Array();
var arrayDyInfo = new Array();
var arrayDyInfoKey = new Array();

function changeSearchType(searchType)
{
	obj = document.getElementById('divSearchHtml');
	switch(searchType)
	{
		case '2':
			obj.innerHTML = Search_Bus_HtmlCode;
			initializeExample(2);
			break;
		case '3':
			obj.innerHTML = Search_House_HtmlCode;
			initializeExample(3);
			break;
		case '4':
			obj.innerHTML = Search_DyInfo_HtmlCode;
			initializeExample(4);
			break;
		default:
			obj.innerHTML = Search_Address_HtmlCode;
			initializeExample(1);
			break;
	}
}
function initializeExample(searchType)
{
	switch(searchType)
	{
		case 1:
			checkTxtValue('txtAddress', 'arrayAddress', 3);
			break;
		case 2:
			checkTxtValue('txtBusNumber', 'arrayBusNumber', 3);
			checkTxtValue('txtBusStation', 'arrayBusStation', 3);
			break;
		case 3:
			break;
		case 4:
			checkTxtValue('txtDyInfo', 'arrayDyInfo', 3);
			break;
	}
}


//op 0清空 1匹配到后随机  2替换成Key  3直接随机
function checkTxtValue(txtobj, arrayobj, op)
{	
	tempobj = eval(arrayobj);
	txtobj = document.getElementById(txtobj);
	
	val = txtobj.value;
	for(var i=0; i<tempobj.length; i++)
	{
		if(tempobj[i]==val)
		{
			if(op==0)
				txtobj.value='';
			else
			if(op==1)
				txtobj.value=tempobj[Math.floor(Math.random() * tempobj.length)];
			else
			if(op==2)
				txtobj.value=eval(arrayobj+'Key')[i];
			return true;
		}
	}
	if(op==3) txtobj.value=tempobj[Math.floor(Math.random() * tempobj.length)];
	return false;
}

function keyClick(txtID)
{
	arrayobj = '';
	switch(txtID)
	{
		case 'txtAddress':
			arrayobj = 'arrayAddress';
			break;
		case 'txtAddress2':
			var obj = document.getElementById(txtID);
			if(obj.value=='可以为空')
			obj.value = '';
			break;
		case 'txtBusNumber':
			arrayobj = 'arrayBusNumber';
			break;
		case 'txtBusStation':
			arrayobj = 'arrayBusStation';
			break;
		case 'txtDyInfo':
			arrayobj = 'arrayDyInfo';
			break;
	}
	
	if(arrayobj!='')
		checkTxtValue(txtID, arrayobj, 0);
}

function toSubmit(subID,busNum)
{
	labSearch.style.display = '';
	
	switch(subID)
	{
		case 'Submit_Search':
			localsearch = document.getElementById('txtAddress');
			if(localsearch.value=='') return;
			checkTxtValue('txtAddress', 'arrayAddress', 2);
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=address&SearchType=1&KeyWord=' + localsearch.value;
			goSearch(url);
			break;
		
		case 'Submit_BusNumber':
			BusNumber = document.getElementById('txtBusNumber');
			if(BusNumber.value=='') return;
			checkTxtValue('txtBusNumber', 'arrayBusNumber', 2);
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=busnumber&SearchType=21&BusNumber=' + BusNumber.value;
			goSearch(url);
			break;
		case 'Submit_BusNumber_Card':
			BusNumber =busNum;
			if(BusNumber.value=='') return;
			checkTxtValue('txtBusNumber', 'arrayBusNumber', 2);
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=busnumber&SearchType=21&BusNumber=' + busNum;
			goSearch(url);
			break;
		case 'Submit_BusStation':
			BusStation = document.getElementById('txtBusStation');
			if(BusStation.value=='') return;
			checkTxtValue('txtBusStation', 'arrayBusStation', 2);
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=busstation&SearchType=22&StationName=' + BusStation.value;
			goSearch(url);
			break;
						
		case 'Submit_BusRoute':
			objStartStation = document.getElementById('txtStartStation');
			objEndStation = document.getElementById('txtEndStation');
			if(objStartStation.value.length<1&&objEndStation.value.length<1) return;
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=busroute&SearchType=23&StartStationName=' +objStartStation.value+'&EndStationName='+objEndStation.value;
			goSearch(url);
			break;
		
		case 'Submit_DyInfo':
			txtDyInfo = document.getElementById('txtDyInfo');
			if(txtDyInfo.value=='') return;
			checkTxtValue('txtDyInfo', 'arrayDyInfo', 2);
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=dyinfo&SearchType=4&DyInfoKeyWord=' + txtDyInfo.value;
			goSearch(url);
			break;
		case 'Submit_house':
			obj1 = document.getElementById('select1');
			obj2 = document.getElementById('acreage1');
			obj3 = document.getElementById('acreage2');
			obj4 = document.getElementById('price1');
			obj5 = document.getElementById('price2');
			obj6 = document.getElementById('fRegionId');
			obj7 = document.getElementById('housetype');
			obj8 = document.getElementById('fRoomId');
			obj9 = document.getElementById('fHallId');
			obj10 = document.getElementById('fCooRentId');
			url = 'search/search.aspx?node=' + NODE + '&City=' + CITYCODE + '&PageSite=2&Submit=housesearch&SearchType=3&fStyle=' + obj1.value  + '&fAcreage=' + obj2.value + '&fAcreage2=' + obj3.value + '&fPrice=' + obj4.value + '&fPrice2=' + obj5.value + '&fRegionId=' + obj6.value + '&fHouseStyleId=' + obj7.value + '&fRoomId=' + obj8.value + '&fHallId=' + obj9.value + '&fCooRentId='+obj10.value;
			goSearch(url);
			break;
	}
	return false;
}
//判断在线视频是否在线
//IsOnline=1,在线,否则不在线
function CheckVideoOnLine(IsOnline)
{
var objVr=left.document.getElementById('Vr_Id');
var objVideo=left.document.getElementById('Video_Id');
  if(IsOnline==0)
  {
   if(objVideo)
   {
    
     objVideo.src=objVideo.src.replace('zaixian.jpg','buzaixian.jpg');
     objVideo.onclick="alert('该视频当前不在线');";
   }
  }
 
   if(objVr)
   {
   objVr.style.display='none';
   }
}
//显示公交查询
function nav_chg(td_now)
{	
	if(td_now.id == "bus")
	{
		locals.style.display = "none";
		buss.style.display = "";
		initializeExample(2);
	}
	if(td_now.id == "local")
	{
		locals.style.display = "";
		buss.style.display = "none";
		initializeExample(1);
		
	}
}
function AnchorAffiche(x,y,title)
{   
    //var htmlStr='<table  border="0" cellspacing="0" cellpadding="0"><tr><td height="29"><img src="images/youhui06.gif" width="26" height="31" /></td><td><table  border="0" cellspacing="0" cellpadding="0" style=" margin-top:2px; padding-right:4px; font-size:14px; color:#fff; font-weight:bold"><tr><td nowrap height="23" valign="middle" bgcolor="#FE9601">'+title+'</td></tr></table></td></tr></table>'
    var htmlStr='<table height="31" border="0" cellpadding="0" cellspacing="0"><tr><td width="26"><img src="images/popo.gif" width="26" height="31" /></td><td valign="top"><table height="23" border="0" cellpadding="0" cellspacing="0" style="margin-left:1px; margin-top:1px"><tr><td nowrap valign="middle" bgcolor="#FE9601" style=" font-size:14px; color:#fff; padding-left:5px; padding-right:5px; font-weight:bold">'+title+'</td></tr></table></td></tr></table>'
    try{
    removePop("AnchorAffiche");
    }catch(e){}
    putPop(x,y,0,0,htmlStr,"AnchorAffiche");
    go2xy(x,y);
}