var isFullScreen;
function initWindowSize(){
	isFullScreen=false;
	setWindowSize();
	window.onresize =setWindowSize;	
}
/**
 * 初始化页面元素大小
 * @return
 */
function setWindowSize(){
	//alert('width='+screen.width+',height='+screen.height);
	var sw=screen.width;
	var sh=screen.height;
	var resuletSetDIV=document.getElementById("middel_container");
	var panelDIV=document.getElementById("panel");
	var headerDIV=document.getElementById("header");
	var gmDIV=document.getElementById("gmap");
	var leftDIV=document.getElementById("frmTitle");
	var h=document.documentElement.clientHeight;//document.body.clientHeight;//document.documentElement.clientHeight;
	var w=document.documentElement.clientWidth;//document.body.clientWidth;//document.documentElement.clientWidth;
	var hh=parseInt(headerDIV.style.height);
	//alert(hh);
	var newHeight=null;
	var newWidth=null;
	/*
	GLog.write(isFullScreen);
	GLog.write(h);
	GLog.write(document.documentElement.offsetHeight);*/
	if(isFullScreen==true){
		newHeight=h;
		newWidth=w;
	}else{
		newHeight=h-hh;
		newWidth=w-404;
	}
	if(newHeight<150){
		resuletSetDIV.style.height=150+"px";
		panelDIV.style.height=150+"px";
		panelDIV.style.width=newWidth+"px";
		gmDIV.style.height=150-6+"px";
		gmDIV.style.width=newWidth-6+"px";
		metroMap_maxHeight=150-6;
		return;
	}else if(newWidth<100){
		resuletSetDIV.style.height=newHeight+"px";
/*		alert(w+100);
		resuletSetDIV.style.width=w+100+"px";*/
		panelDIV.style.height=newHeight+"px";
		panelDIV.style.width=100+"px";
		gmDIV.style.height=newHeight-6+"px";
		gmDIV.style.width=100-6+"px";
		metroMap_maxHeight=newHeight-6;
		return;
	}
	resuletSetDIV.style.height=newHeight+"px";
	panelDIV.style.height=newHeight+"px";
	panelDIV.style.width=newWidth+"px";
	gmDIV.style.height=newHeight-6+"px";
	gmDIV.style.width=newWidth-6+"px";
	metroMap_maxHeight=newHeight-6;
}
/**
 * 切换左边内容
 * @param num
 * @param pre
 * @return
 */
function changLiBG(num, pre) {

	var div = document.getElementById("titleLeft");
	var lists = div.getElementsByTagName("li");
	lists[0].className = "indexDefault";
	lists[1].className = "classDefault";
	lists[num].className = pre + "Select";
}
function handleOnMouseOverLI(obj){
	obj.style.cursor="pointer";
}
function handleOnMouseOutLI(obj){
	obj.style.cursor="default";
}

function fullSrceen(e){
	//alert(e);
	var frmTitle=document.getElementById("frmTitle");
	var headerDIV=document.getElementById("header");
	var h=document.documentElement.clientHeight;
	var operaterImg=document.getElementById("spn_fullScreen");
	if(operaterImg.title=="全屏"){
		operaterImg.title="退出全屏";
		operaterImg.className="imgexitfullScreen";
		operaterImg.src="images/index/exitfullScreen.gif";
		headerDIV.style.display="none";
		frmTitle.style.display="none";
		isFullScreen=true;
	}else{
		operaterImg.title="全屏";
		operaterImg.className="imgfullScreen";
		operaterImg.src="images/index/fullScreen.gif";
		headerDIV.style.display="block";
		frmTitle.style.display="block";
		isFullScreen=false;
	}
	setWindowSize();
	gmap.checkResize();
}
function dufaultSrceen(){
	var frmTitle=document.getElementById("frmTitle");
	var headerDIV=document.getElementById("header");
	var h=document.documentElement.clientHeight;
	headerDIV.style.display="block";
	frmTitle.style.display="block";
/*	var gmDIV = document.getElementById("gmap");
	gmDIV.style.height = h + "px";*/
	isFullScreen=false;
	setWindowSize();
	 gmap.checkResize();
}
function changeMapTypeBG(mapDIV,currentMapType){
	var MapTypeImgList=mapDIV.getElementsByTagName("img");
	alert(MapTypeImgList.length);
}
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
var metroMap_maxHeight,eStatus=false;
/**
 * 展开地铁线路地图
 */
function folding() {
	var div = document.getElementById("metroMap");
	var h = div.offsetHeight;
	h += 45;

	if (h <= parseInt(metroMap_maxHeight)) {
		 //alert('inside');
		div.style.height = h + "px";
		setTimeout("folding()",100);
	}else{
		//alert('ff');
		var gmDIV=document.getElementById("gmap");
		div.style.height = metroMap_maxHeight + "px";
		/*GLog.write("gmDIV:"+gmDIV.style.height);
		GLog.write("metroMap_maxHeight:"+metroMap_maxHeight);*/
		var div2 = document.getElementById("metroMap");
		//GLog.write("clientHeight"+div2.clientHeight);
		//GLog.write("offsetHeight"+div2.offsetWidth);
		eStatus=false;
		var img_daohang=document.getElementById("img_daohang");
		img_daohang.src="./images/index/metrodaohang_mmview.png";
	}
}
/**
 * 折叠地铁线路地图
 */
function unfold() {
	var divM = document.getElementById("metroMap");
	var h = divM.offsetHeight;
	var newH=h-45;//alert(h+"奇怪:"+newH);
	if (newH > 0) {
		 //alert("inside:"+h);
		divM.style.height = newH + "px";
		setTimeout("unfold()",100);
	} else {
		//alert('dd');
		divM.style.height = "0px";
		eStatus=false;
		var img_daohang=document.getElementById("img_daohang");
		img_daohang.src="./images/index/metrodaohang_lview.png";
	}
}
function daohangHeader() {
	if(eStatus){
		return;
	}
	eStatus=true;
	var div = document.getElementById("metroMap");
	var h = div.offsetHeight;
	//alert(h);
	if (h == 0) {
		folding();
	} else {
		unfold();
	}
}
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
function showStation3D(name){
	var iWidth = 700; //����ڵĿ��;
	var iHeight = 500; //����ڵĸ߶�;
	var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //��ô��ڵĴ�ֱλ��;
	var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
	var url='./3DshowPage.html?stationName='+name
	window.open (url, '3D', 'height=500, width=700, top='+iTop+', left='+iLeft+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
}
