 
///////////////////////////////////////////////////////////////
function RequestQueryString(strName)
{
	var strHref = window.document.location.href;
	var intPos = strHref.indexOf("?");
	var strRight = strHref.substr(intPos + 1);
	var arrTmp = strRight.split("&");
	for(var i = 0; i < arrTmp.length; i++)
	{
		var arrTemp = arrTmp[i].split("=");
		if(arrTemp[0].toUpperCase() == strName.toUpperCase()) 
			return arrTemp[1];
	}
	return "";
}

function GetQueryString(strSource,strName)
{
	var arrTmp = strSource.split("&");
	for(var i = 0; i < arrTmp.length; i++)
	{
		var arrTemp = arrTmp[i].split("=");
		if(arrTemp[0].toUpperCase() == strName.toUpperCase()) 
			return arrTemp[1];
	}
	return "";
}

function HideFocus(tName)
{ 
	aTag=document.getElementsByTagName(tName); 
	for(i=0;i<aTag.length;i++)
		aTag[i].hideFocus=true; 
	for(i=0;i<aTag.length;i++)
		aTag[i].onfocus=function(){this.blur();}; 
} 

var foto1;
function OpenImages(img)
{
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img)
{
  if((foto1.width!=0)&&(foto1.height!=0))
	{
    viewFoto(img);
	}
  else
	{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}

function viewFoto(img)
{
  largh=foto1.width+20;
  altez=foto1.height+20;
  if (largh<300)
	stringa="resizable=1,width="+largh+",height="+altez;
  else
	stringa="resizable=1,width="+parseInt(300)+",height="+parseInt(300*foto1.height/foto1.width);
  finestra=window.open(img,"",stringa);
}

/////////////////////////////////////////////////////////////// 
function   MaxWin()   
{     
	try   
	{   
		var   b   =   top.screenLeft   ==   0;   
		var   b   =   b   &&   top.screen.availHeight   -   top.screenTop   -   top.body.offsetHeight   -   20   ==   0;   
		if(!b)   
		{   
			var   str     =   '<object   id=meizzMax   classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'   
			str   +=   '<param   name="Command"   value="Maximize"></object>';   
			if(typeof(meizzMax)!="object")   document.body.insertAdjacentHTML("beforeEnd",   str);   
				document.getElementById("meizzMax").Click();   
		}   
	}
	catch(e)
	{
	}   
     
 }     


var ScreenX=1024,ScreenY=768;
function GetSXY()
{
	ScreenX=screen.width;
	ScreenY=screen.height;
}

function SWS()
{
	MaxWin();
	


	document.all("tblBody").style.height=document.body.clientHeight-100;
	
	document.all("tblBody").style.width=document.body.clientWidth-300;

	document.all("ifraNav").width=document.body.clientWidth-300;
	document.all("ifraNav").height=document.body.clientHeight-100;

	document.all("ifraBusSearch").width=document.body.clientWidth-300;
	document.all("ifraBusSearch").height=document.body.clientHeight-100;

	document.all("ifraMap").style.width=document.body.clientWidth-300;
	document.all("ifraMap").style.height=document.body.clientHeight-100;

	document.all("tdPanel").height=document.body.clientHeight-100;
	document.all("ifraPanel").style.height=document.body.clientHeight-100;
	
	document.all("divCommon").style.left=document.body.clientWidth-300-200;


	if (screen.width==800 && screen.height==600)
	{
		document.getElementById("ifraNav").src="skins/zz/welcomes.htm";
		//document.getElementById("ifraMap").src="..//?h=39648&v=19780&z=1";
		document.getElementById("ifraMap").src="..//?h=81444&v=59960&z=2";
	}
	else
	{
		document.getElementById("ifraNav").src="skins/zz/welcome.htm";
		//document.getElementById("ifraMap").src="..//?h=39648&v=19780&z=1";
		document.getElementById("ifraMap").src="..//?h=81444&v=59960&z=2";
	}
/*
	if (divWelcome.style.display=='none')
	{
	document.all('chkNav').checked=true;
	SwitchWelcomeAndMap(1);
	} 
	else 
	{
	
	SwitchWelcomeAndMap(0);
	}
*/	
}

function Adjust()
{
	MaxWin();
	
	if (screen.width!=ScreenX && screen.height!=ScreenY)
	{
		document.all("tblBody").style.height=document.body.clientHeight-100;
		document.all("tblBody").style.width=document.body.clientWidth-300;

		document.all("ifraNav").width=document.body.clientWidth-300;
		document.all("ifraNav").height=document.body.clientHeight-100;

		document.all("ifraBusSearch").width=document.body.clientWidth-300;
		document.all("ifraBusSearch").height=document.body.clientHeight-100;

		document.all("ifraMap").style.width=document.body.clientWidth-300;
		document.all("ifraMap").style.height=document.body.clientHeight-100;

		document.all("tdPanel").height=document.body.clientHeight-100;
		document.all("ifraPanel").style.height=document.body.clientHeight-100;

		document.all("divCommon").style.left=document.body.clientWidth-300-200;

		if (screen.width==800 && screen.height==600)
		{
			document.getElementById("ifraNav").src="skins/zz/welcomes.htm";
			//document.getElementById("ifraMap").src="..//?h=39648&v=19780&z=1";
			document.getElementById("ifraMap").src="..//?h=81444&v=59960&z=2";
		}
		else
		{
			document.getElementById("ifraNav").src="skins/zz/welcome.htm";
			//document.getElementById("ifraMap").src="..//?h=39648&v=19780&z=1";
			document.getElementById("ifraMap").src="..//?h=81444&v=59960&z=2";
		}
		GetSXY();
	}

}

///////////////////////////////////////////////////////////////

function Init()
{
	HideFocus('a');
	document.all('chkBus').hideFocus=true;
	//document.all('chkRoad').hideFocus=true;
	//document.all('chkTrack').hideFocus=true;
	document.all('chkNav').hideFocus=true;
}


function SwitchBus()
{
	var objDivs=window.frames['ifraMap'].document.getElementsByTagName("DIV"); 
	for (var i=0;i<objDivs.length;i++)
	{
		var e = objDivs[i];
		var strDivID=e.id;
		if (strDivID.indexOf("divBusStation")!=-1)
		{
			if (document.all("chkBus").checked)
				e.style.display="block";
			else
				e.style.display="none";
		}
   }
}

function SwitchBus2(f)
{
	var objDivs=window.frames['ifraMap'].document.getElementsByTagName("DIV"); 
	for (var i=0;i<objDivs.length;i++)
	{
		var e = objDivs[i];
		var strDivID=e.id;
		if (strDivID.indexOf("divBusStation")!=-1)
		{
			if (f==1)
				e.style.display="block";
			else
				e.style.display="none";
		}
   }
}


function CheckMapStatus()
{
	document.getElementById('ifraBusSearch').style.display='none';
	strTmpHref=window.frames['ifraMap'].document.location.href;
	if (strTmpHref.indexOf("skins/zz/welcome.htm")!=-1)
	{
		alert("请先单击热点进入地图！");
		return false;
	}
	else
		return true;

}

function SwitchNav(sign)
{
	if (sign==0)
	{
		parent.document.all("chkNav").checked=false;
	}
	if (sign==1)
	{
		parent.document.all("chkNav").checked=true;
	}
}

function SwitchWelcomeAndMap(sign)
{
	if (sign==0)
	{
		document.all("divWelcome").style.display="none";
	}
	if (sign==1)
	{
		document.all("divWelcome").style.display="block";
	}
}

function SwitchBusSearch(sign)
{
	if (sign==1)
		{
		document.getElementById('ifraBusSearch').style.display='block';
		document.getElementById('divWelcome').style.display='none';
		document.getElementById('ifraMap').style.display='none';

		}
	else
	{	
		document.getElementById('ifraBusSearch').style.display='none';
		document.getElementById('divWelcome').style.display='none';
		document.getElementById('ifraMap').style.display='block';

	}
}

function ShowHelp()
{

		window.frames['ifraLocalSearch'].document.location.href="Help/index.htm";
		document.all("divCommon").style.display="block";

}


function ShowDeclare()
{

		window.frames['ifraLocalSearch'].document.location.href="Help/Declare.htm";
		document.all("divCommon").style.display="block";

}


function FullScreen()
{
	strTmpHref=window.frames['ifraMap'].document.location.href;
	if (strTmpHref.indexOf("skins/zz/welcome.htm")!=-1)
	{
		alert("请先单击热点进入地图！");
		return false;
	}
	strTmpHref='FullScreen.aspx?url='+escape(strTmpHref);
	str = "fullscreen=0,scrollbars=0,resizable=0,toolbar=no,location=no,directories=no,status=no,menubar=no,width=" +window.screen.Width + ",height="+window.screen.Height;
	//str = "fullscreen=0,scrollbars=0,resizable=0,toolbar=no,location=no,directories=no,status=no,menubar=no,width=800,height=600";
	
	var win=window.open(strTmpHref, '', str);
	//win.moveTo((parseInt(window.screen.Width)-800)/2,(parseInt(window.screen.Height)-600)/2);
	win.moveTo(0,0);

}


function AdjustOverview(sign)
{
	var objDivs=window.frames['ifraMap'].document.getElementsByTagName("DIV"); 
	
	for (var i=0;i<objDivs.length;i++)
	{
		var e = objDivs[i];
		var strDivID=e.id;
		if (strDivID.indexOf("Ov_")!=-1 && strDivID.substring(0,7)!="Ov_Map_")
		{
			if (sign==1)
				e.style.left=parseInt(e.style.left)+310;
			else
			    e.style.left=parseInt(e.style.left)-310;
		}
   }
}


///////////////////////////////////////////////////////////////


function Locate()
{
	var x=0,y=0,CID=0;
	if ( window.onload )
	{
		if ((RequestQueryString("v")!="") && (RequestQueryString("h")!=""))
		{
			x=RequestQueryString("h");
			y=RequestQueryString("v");
			if (window.document.getElementById('divWelcome')!=null)
			window.document.getElementById('divWelcome').style.display='none';
			if (window.document.getElementById('ifraMap')!=null)
			{
			window.document.getElementById('ifraMap').style.display='block';
			window.frames['ifraMap'].document.location.href="..//?h="+parseInt(parseInt(x)/2)+"&v="+parseInt(parseInt(y)/2)+"&z=2&a=0";
			}
			if (RequestQueryString("CID")!="")
			CID=RequestQueryString("CID");
		}
	}
}


function go2xy(x,y)
{
	if (parent!=null)
	{
	if (parent.frames['ifraMap']!=null)
	{
		parent.frames['ifraMap'].document.location.href="../..//?h="+parseInt(parseInt(x)/2)+"&v="+parseInt(parseInt(y)/2)+"&z=2";
		parent.document.getElementById('ifraMap').style.display='block';
	}
	if (parent.document.getElementById('divWelcome')!=null)
		parent.document.getElementById('divWelcome').style.display='none';
	}
}

function g(x,y,l)
{
		if (parent!=null)
	{
		if (parent.frames['ifraMap']!=null)
	{
		parent.frames['ifraMap'].document.location.href="../..//?h="+parseInt(parseInt(x)/Math.pow(2,l-1))+"&v="+parseInt(parseInt(y)/Math.pow(2,l-1))+"&z="+l;
		parent.document.getElementById('ifraMap').style.display='block';
	}
	if (parent.document.getElementById('divWelcome')!=null)
		parent.document.getElementById('divWelcome').style.display='none';
	}

}


function gu(x,y,l,a)
{
			if (parent!=null)
	{
			if (parent.frames['ifraMap']!=null)
	{
	parent.frames['ifraMap'].document.location.href="../..//?h="+parseInt(parseInt(x)/Math.pow(2,l-1))+"&v="+parseInt(parseInt(y)/Math.pow(2,l-1))+"&z="+l+"&a="+a;
	parent.document.getElementById('ifraMap').style.display='block';
	}
	if (parent.document.getElementById('divWelcome')!=null)
	parent.document.getElementById('divWelcome').style.display='none';
	}
}


function go(str)
{
	
	var strTmp=str.slice(4);
	var strTemp=strTmp.replace(/a/i,"CID");
	//parent.parent.frames['ifraPanel'].document.location.href="Information.aspx"+strTemp;
	
	var strTmpTwo=strTmp.slice(1);
	strH=GetQueryString(strTmpTwo,"h");
    strV=GetQueryString(strTmpTwo,"v");
	strA=GetQueryString(strTmpTwo,"a");
if (parent.frames['ifraMap']!=null)
	parent.frames['ifraMap'].document.location.href="..//?h="+parseInt(parseInt(strH)/2)+"&v="+parseInt(parseInt(strV)/2)+"&z=2&a="+strA;
	//czc parent.parent.frames['ifraMap'].document.location.href="..//?h="+parseInt(parseInt(strH)/2)+"&v="+parseInt(parseInt(strV)/2)+"&z=2&a="+strA;
}

function gotoxy(strCenterX,strCenterY)
{
	if (parent!=null)
	{
	if (parent.frames["ifraMap"]!=null)
	{
		parent.frames["ifraMap"].document.location.href="..//?h="+parseInt(parseInt(strCenterX)/2)+"&v="+parseInt(parseInt(strCenterY)/2)+"&z=2&a=0";
		parent.document.getElementById('ifraMap').style.display="block";
	}
	if (parent.document.getElementById('ifraBusSearch')!=null)
		parent.document.getElementById('ifraBusSearch').style.display="none";
	if (parent.document.getElementById('divWelcome')!=null)
		parent.document.getElementById('divWelcome').style.display="none";
	}
}


function Anchor(strCenterX,strCenterY,strZoomLevel,strCID)
{
	
	if (parent!=null)
	{
	if (parent.frames["ifraMap"]!=null)
	{
		//parent.frames["ifraMap"].document.location.href="..//?h="+strCenterX+"&v="+strCenterY+"&z="+strZoomLevel+"&a="+//strCID;
	parent.frames["ifraMap"].document.location.href="..//?h="+parseInt(parseInt(strCenterX)/2)+"&v="+parseInt(parseInt(strCenterY)/2)+"&z=2&a="+strCID;
	parent.document.getElementById('ifraMap').style.display="block";
	}
	if (parent.document.getElementById('ifraBusSearch')!=null)
	parent.document.getElementById('ifraBusSearch').style.display="none";
	if (parent.document.getElementById('divWelcome')!=null)
	parent.document.getElementById('divWelcome').style.display="none";
	}

}

function AnchorInSubPage(strCenterX,strCenterY,strZoomLevel,strCID)
{
	if (parent!=null)
	{
	if (parent.frames["ifraMap"]!=null)
	{
	//parent.frames["ifraMap"].document.location.href="..//?h="+strCenterX+"&v="+strCenterY+"&z="+strZoomLevel+"&a="+//strCID;
	parent.frames["ifraMap"].document.location.href="..//?h="+parseInt(parseInt(strCenterX)/2)+"&v="+parseInt(parseInt(strCenterY)/2)+"&z=2&a="+strCID;
	}
	if (parent.document.getElementById('ifraMap')!=null)
	parent.document.getElementById('ifraMap').style.display="block";
		if (parent.document.getElementById('divWelcome')!=null)
	parent.document.getElementById('divWelcome').style.display="none";

	}
}

function AnchorInSubPage2(strCenterX,strCenterY,strZoomLevel,strCID)
{
	
	
	if (parent!=null && strCenterX!='0' && strCenterY!='0')
	{
	if (parent.parent.parent.frames["ifraMap"]!=null)
	{
	parent.parent.parent.frames["ifraMap"].document.location.href="../../..//?h="+parseInt(parseInt(strCenterX))+"&v="+parseInt(parseInt(strCenterY))+"&z=1&a="+strCID;
	}
	if (parent.parent.parent.document.getElementById('ifraMap')!=null)
	parent.parent.parent.document.getElementById('ifraMap').style.display="block";
		if (parent.parent.parent.document.getElementById('divWelcome')!=null)
	parent.parent.parent.document.getElementById('divWelcome').style.display="none";
	}
	else
	alert('用于定位的数据有误，暂不能定位！');
}

function AnchorInSubPage3(strCenterX,strCenterY,strZoomLevel,strCID)
{
	
	
	if (parent!=null && strCenterX!='0' && strCenterY!='0')
	{
	if (parent.parent.parent.frames["ifraMap"]!=null)
	{
	parent.parent.parent.frames["ifraMap"].document.location.href="../../..//?h="+parseInt(parseInt(strCenterX)/2)+"&v="+parseInt(parseInt(strCenterY)/2)+"&z=2&a="+strCID;
	}
	if (parent.parent.parent.document.getElementById('ifraMap')!=null)
	parent.parent.parent.document.getElementById('ifraMap').style.display="block";
		if (parent.parent.parent.document.getElementById('divWelcome')!=null)
	parent.parent.parent.document.getElementById('divWelcome').style.display="none";
	}
	else
	alert('用于定位的数据有误，暂不能定位！');
}

function Go2Pos(iCenterX,iCenterY,strZoomLevel)
{

	if (iCenterX!=0 && iCenterY!=0) 
	{
		if (parent.frames['ifraMap']!=null)
		parent.parent.frames["ifraMap"].document.location.href="..//?h="+iCenterX+"&v="+iCenterY+"&z="+strZoomLevel+"&e=0";
//parent.parent.frames["ifraMap"].document.location.href="..//?h="+parseInt(parseInt(iCenterX)/2)+"&v="+parseInt(parseInt(iCenterY)/2)+"&z=2&e=0";

	}

}

///////////////////////////////////////////////////////////////

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();
var arrayClass = new Array();
var arrayClassKey = new Array();


function initializeExample(searchType)
{
	switch(searchType)
	{
		case 1:
			checkTxtValue('edtAddress', 'arrayAddress', 3);
			break;
		case 2:
			checkTxtValue('edtBusLine', 'arrayBusNumber', 3);
			checkTxtValue('edtBusStation', 'arrayBusStation', 3);
			break;
		case 3:
			break;
		case 4:
			checkTxtValue('edtDyInfo', 'arrayDyInfo', 3);
			break;
		case 5:
			checkTxtValue('edtClassKey', 'arrayClass', 3);
			break;
	}
}



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 ClickText(txtID)
{
	arrayobj = '';
	switch(txtID)
	{
		case 'edtAddress':
			arrayobj = 'arrayAddress';
			break;
		case 'edtBusLine':
			arrayobj = 'arrayBusNumber';
			break;
		case 'edtBusStation':
			arrayobj = 'arrayBusStation';
			break;
		case 'edtDyInfo':
			arrayobj = 'arrayDyInfo';
			break;
		case 'edtClassKey':
			arrayobj = 'arrayClass';
			break;
	}
	
	if(arrayobj!='')
		checkTxtValue(txtID, arrayobj, 0);
}




function SwitchPage(td)
{	
	if(td.id == "tdBus")
	{
		tblLocal.style.display = "none";
		tblBus.style.display = "";
		initializeExample(2);
	}
	if(td.id == "tdLocal")
	{
		tblLocal.style.display = "";
		tblBus.style.display = "none";
		initializeExample(1);
		
	}
}



function BusLineSearch(ln)
{
	window.frames['ifraBusSearch'].document.location.href='BusSearch.aspx?ln='+ln;
	SwitchBusSearch(1);
}

function BusSiteSearch(sn)
{
	window.frames['ifraBusSearch'].document.location.href='BusSearch.aspx?sn='+sn;
	SwitchBusSearch(1);
}


function BusLineSearchByBus(ln)
{
	parent.document.getElementById("ifraBusSearch").src='BusSearch.aspx?ln='+ln;
	SwitchBusSearch(1);
}

function SearchDemo(strKey,strType)
{
	//if (strKey=="")
	//{
	//	alert("关键字不能为空！");
	//	edtAddress.focus();
	//	return false;
	//}
	
	var str;
	var localPath = document.location.href;
	var iIndex=localPath.lastIndexOf("/");
	localPath=localPath.substring(0,iIndex+1);
	
	str=localPath+"LocalSearch.aspx?KeyWord="+escape(strKey)+"&Type="+escape(strType);

	if (document.all("divCommon")!=null)
	{
		document.getElementById("ifraLocalSearch").src=str;
		document.all("divCommon").style.display="block";
	}
}

function SearchByPopedom(strKey,strType,strPopedom)
{
	//if (strKey=="")
	//{
	//	alert("关键字不能为空！");
	//	edtAddress.focus();
	//	return false;
	//}
	
	var str;
	var localPath = document.location.href;
	var iIndex=localPath.lastIndexOf("/");
	localPath=localPath.substring(0,iIndex+1);
	
	str=localPath+"LocalSearch.aspx?KeyWord="+escape(strKey)+"&Type="+escape(strType)+"&p="+escape(strPopedom);
	
	if (document.all("divCommon")!=null)
	{
		document.getElementById("ifraLocalSearch").src=str;
		document.all("divCommon").style.display="block";
	}

	if (parent.document.all("divCommon")!=null)
	{
		parent.document.getElementById("ifraLocalSearch").src=str;
		parent.document.all("divCommon").style.display="block";
	}
}


function SearchClass(strKey,strType)
{
	//if (strKey=="")
	//{
	//	alert("关键字不能为空！");
	//	edtClassKey.focus();
	//	return false;
	//}
	var str;
	str="../CityEvent/index.aspx?k="+escape(strKey)+"&t="+escape(strType);
	window.open(str);
}


function Classification(strKey)
{
	window.open('../ClassMap/Detail.aspx?Type='+escape(strKey)+'&A=B');
}

function Class(strKey,strType)
{
	window.open('../ClassMap/Detail.aspx?Type='+escape(strKey)+'&A='+strType);
}


