//返回内容左边界，默认为780宽度居中，可选参数为调整值。
function getLeftBound(l){
	var contentWidth = 780;
	var leftBound = Math.round((document.body.clientWidth - contentWidth)/2);
	if(leftBound < 0){
		leftBound = 0;
	}
	if(l!=undefined){
		leftBound += l;
	}
	return leftBound;
}

//定义页面各块的距顶值。
var LE_pageHead_top = 0;
var LE_navBarMain_top = 80;
var LE_body_top = 110;

var LE_mainMenu_top = 80;
var LE_visualBar_top = 103;
var LE_subMenu_top = 173;
var LE_content_top = 211;

//当浏览器改变大小时，重排页面。
function resetLayout(){
	document.all.LE_pageHead.style.left = getLeftBound()+"px";
	document.all.LE_navBarMain.style.left = getLeftBound()+"px";
	document.all.LE_body.style.left = getLeftBound()+"px";
	document.all.LE_pulldownMenu_1_div.style.left = getLeftBound()+"px";
	document.all.LE_pulldownMenu_2_div.style.left = getLeftBound(92)+"px";
/*
	document.all.LE_mainMenu.style.left = getLeftBound()+"px";
	document.all.LE_visualBar.style.left = getLeftBound(4)+"px";
	document.all.LE_subMenu.style.left = getLeftBound(4)+"px";
	document.all.LE_content.style.left = getLeftBound()+"px";
*/
}
window.onresize = resetLayout;


function cncPop(){
	var divPop=document.createElement("div");
	with(divPop){
		innerHTML='<img src="/mysvw/jsp/mysvw/images/stopservice.jpg" alt="点击关闭" onclick="hideDivPop()">';
		id="divPop"
	}
	document.body.appendChild(divPop)
}

function hideDivPop(){
	//document.getElementById("divPop").style.display="none"
	document.body.removeChild(document.getElementById("divPop"))
}
//if(getCookie("popFlag")==null){
//	cncPop();
//	setCookie("popFlag","yes");
//}

function setCookie(name,value){
	document.cookie=name+"="+value;
}
	
function _getCookieVal(offset){
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name){
	if(name == "path" || name == "expires" || name == "domain" || name == "version") name = "badCookieName";

	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen){
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return _getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
	}
	return null;
}
