/********************
 * 页面信息提示 (成功错误信息)
 ******************/
function showMessage() {
	var message = $("messageDiv");
	if (message != null) {
		message.style.left = (document.documentElement.clientWidth - 400) / 2 +getScrollLeft()+ "px";
		message.style.top = (document.documentElement.clientHeight - 80) / 2 + getScrollTop() + "px";
		message.style.display = "";
	}
}
function hideMessage() {
	$("messageDiv").style.display = "none";
}
/********************
 * 页面信息提示 
 ******************/
function showInfor(w, h) {
	var infor = $("inforDiv");
	if (infor != null) {
            //Drag.init(infor);
		infor.style.width = w + "px";
		infor.style.height = h + "px";
		infor.style.left = (document.documentElement.clientWidth - w) / 2 +getScrollLeft()+ "px";
		infor.style.top = (document.documentElement.clientHeight - h) / 2 + getScrollTop() + "px";
		infor.style.display = "";
	}
}

function showInfor1(w, h) {
	var infor = $("inforDiv");
	if (infor != null) {
            //Drag.init(infor);
		infor.style.width = w + "px";
		infor.style.height = h + "px";
		infor.style.left = (document.documentElement.clientWidth - w) / 2 +getScrollLeft()+ "px";
		infor.style.top = 25 + (window.screen.availHeight - h - 240) / 2 + getScrollTop() + "px";
		infor.style.display = "";
		Drag.init(infor);
	}
}


function showInfor2(id,message,w, h) {
	var infor = $(id);
	if (infor != null) {
		infor.style.width = w + "px";
		infor.style.height = h + "px";
		infor.style.left = (document.documentElement.clientWidth - w) / 2 +getScrollLeft()+ "px";
		infor.style.top = 25 + (window.screen.availHeight - h - 280) / 2 + getScrollTop() + "px";
		infor.style.display = "";
		infor.innerHTML=message;
		Drag.init(infor);
	}
}

function showInfor3(id ,w, h) {
	var infor = $(id);
	if (infor != null) {
		infor.style.width = w + "px";
		infor.style.height = h + "px";
		infor.style.left = (getClientWidth() - w) / 2 +getScrollLeft() + "px";
		infor.style.top = (getClientHeight() - h) / 2 + getScrollTop() + "px";
		infor.style.display = "";
		Drag.init(infor);
	}
}
function hideInfor2(id) {
	$(id).style.display = "none";
	$(id).innerHTML = "";
}

function hideInfor() {
	$("inforDiv").style.display = "none";
	$("inforDiv").innerHTML = "";
}
var name;
function showAlert(w, h, message, name1) {
	name = name1;
	var aa = $(name);
	var infor = $("inforDiv");
	if (infor != null) {
		infor.style.width = w + "px";
		infor.style.height = h + "px";
		infor.style.left = (document.documentElement.clientWidth - w) / 2 +getScrollLeft()+ "px";
		infor.style.top = (document.documentElement.clientHeight - h) / 2 + getScrollTop()+ "px";
		infor.style.border = "#35A8DA solid 3px";
		infor.style.background = "#ffffff";
		infor.innerHTML = "<table width=\"100%\" height=\"100%\" cellpadding=\"0\" cellspacing=\"0\"  onclick=\"hideAlert()\">"
		                + "<tr>"
		                + "<td align=\"center\" style=\"color:red;font-size:14px;\">"
		                + message
		                + "</td>"
		                + "</tr>"
		                + "<tr align='center'>"
		                + "<td>"
		                + "<img src='/images/loading.gif'>"
		                + "</td>"
		                + "</tr>"
		                + "</table>";
		                
		infor.style.display = "";
		window.setTimeout(hideAlert, 3000);
	}
}

function hideAlert() {
	var aa = $(name);
	$("inforDiv").style.display = "none";
	$("inforDiv").innerHTML = "";
	if (aa) {
		aa.focus();
	}
}

/********************
 * 取窗口滚动条高度 
 ******************/
function getScrollTop() {
	var scrollTop = 0;
	if (document.documentElement && document.documentElement.scrollTop) {
		scrollTop = document.documentElement.scrollTop;
	} else {
		if (document.body) {
			scrollTop = document.body.scrollTop;
		}
	}
	return scrollTop;
}
function getScrollLeft() {
	var scrollLeft = 0;
	if (document.documentElement && document.documentElement.scrollLeft) {
		scrollLeft = document.documentElement.scrollLeft;
	} else {
		if (document.body) {
			scrollLeft = document.body.scrollLeft;
		}
	}
	return scrollLeft;
}
function getScrollWidth() {
	return Math.max(document.body.scrollWidth, document.body.clientWidth, document.documentElement.scrollWidth, document.documentElement.clientWidth);
}
function getScrollHeight() {
	return Math.max(document.body.scrollHeight, document.body.clientHeight, document.documentElement.scrollHeight, document.documentElement.clientHeight);
}
/********************
 * 取窗口可视范围的高度 
 *******************/
function getClientHeight() {
	var winHeight = 0;
	//获取窗口高度
	if (window.innerHeight) {
		winHeight = window.innerHeight;
	} else if ((document.body) && (document.body.clientHeight)) {
		winHeight = document.body.clientHeight;
	}
	//通过深入Document内部对body进行检测，获取窗口大小
	if (document.documentElement && document.documentElement.clientHeight)	{
		winHeight = document.documentElement.clientHeight;
	}
	return winHeight;
}
/********************
 * 取窗口可视范围的宽度 
 *******************/
function getClientWidth() {
	var winWidth = 0;
	//获取窗口宽度
	if (window.innerWidth) {
		winWidth = window.innerWidth;
	} else if ((document.body) && (document.body.clientWidth)) {
		winWidth = document.body.clientWidth;
	}
	//通过深入Document内部对body进行检测，获取窗口大小
	if (document.documentElement && document.documentElement.clientWidth) {
		winWidth = document.documentElement.clientWidth;
	}
	return winWidth;
}
function doShowMessage() {
	var message = $("messageDiv");
	var messageFlag = $("showMessageFlag");
	if (message != null && messageFlag.value == 1) {
		messageFlag.value = 0;
		showMessage();
		window.setTimeout(doHideMessage, 3000);
	}
}
function doHideMessage() {
	hideMessage();
}

window.onload = doShowMessage;

