function gid(id){return document.getElementById?document.getElementById(id):null;}

function gname(name){return window.document.getElementsByTagName?window.document.getElementsByTagName(name):new Array()}


function DialogLoc(){var dde = window.document.documentElement;if (window.innerWidth){var ww = window.window.innerWidth;var wh = window.window.innerHeight;var bgX = window.pageXOffset;var bgY = window.pageYOffset;}else{var ww = dde.offsetWidth;var wh = dde.offsetHeight;var bgX = dde.scrollLeft;var bgY = dde.scrollTop;}t_DiglogX = (bgX + ((ww - t_DiglogW)/2));t_DiglogY = (bgY + ((wh - t_DiglogH)/2));}

function DialogShow(showdata,ow,oh,w,h){var objDialog = document.getElementById("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;DialogLoc();objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = document.body.scrollTop+t_DiglogY + "px";oS.left = t_DiglogX + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}

function DialogHide(){ScreenClean();var objDialog = document.getElementById("DialogMove");if (objDialog) objDialog.style.display = "none";}

function ScreenConvert(){var browser = new Browser();var objScreen = gid("ScreenOver");if(!objScreen) var objScreen = document.createElement("div");var oS = objScreen.style;objScreen.id = "ScreenOver";oS.display = "block";oS.top = oS.left = oS.margin = oS.padding = "0px";if (document.body.clientHeight)	{var wh = document.body.scrollHeight + "px";}else if (window.innerHeight){var wh = window.innerHeight + "px";}else{var wh = "100%";}oS.width = "100%";oS.height = wh;oS.position = "absolute";oS.zIndex = "3";if ((!browser.isSF) && (!browser.isOP)){oS.background = "#181818";}else{oS.background = "#F0F0F0";}oS.filter = "alpha(opacity=80)";oS.opacity = 40/100;oS.MozOpacity = 40/100;document.body.appendChild(objScreen);var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";}

function ScreenClean(){var objScreen = document.getElementById("ScreenOver");if (objScreen) objScreen.style.display = "none";var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";}

function HideWindow(Content)
{
	ScreenConvert();
	DialogShow(Content,350,123,280,100);
}

function Browser()
{
	var ua, s, i;
	this.isIE = false;
	this.isNS = false;
	this.isOP = false;
	this.isSF = false;
	ua = navigator.userAgent.toLowerCase();
	s = "opera";
	if ((i = ua.indexOf(s)) >= 0)
	{
	this.isOP = true;return;
	}
	s = "msie";
	if ((i = ua.indexOf(s)) >= 0)
	{this.isIE = true;return;}
	s = "netscape6/";
	if ((i = ua.indexOf(s)) >= 0)
	{this.isNS = true;return;}
	s = "gecko";
	if ((i = ua.indexOf(s)) >= 0)
	{this.isNS = true;return;}
	s = "safari";
	if ((i = ua.indexOf(s)) >= 0)
	{
		this.isSF = true;return;
	}
}
////////

function $(o){return document.getElementById(o)}

//ShowBox
function ShowBox(d,w,h,act)
{
	ScreenConvert();
	//$("_box").style.left = (parseInt(document.body.clientWidth)-241)/2;
	//$("_box").style.top = (parseInt(document.body.clientHeight)-176)/2;
	$("_box").style.margin = "-88px 0px 0px -120px;";
	$("_box").style.display = "";
	Getbox(d,w,h,act);
}

function Getbox(d,w,h,act)
{
	var url ="?timeStamp=" + new Date().getTime();
	var url = url + "&w=" + w;
	var url = url + "&h=" + h;
	var url = url + "&act=" + act;
	//window.open("ajax.asp" + url);
	var xmlHttp = window.XMLHttpRequest?(new XMLHttpRequest()):(new ActiveXObject("Microsoft.XMLHTTP"));
	xmlHttp.open("get","ajax.asp" + url,true);
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{
				var T = (parseInt(document.body.clientHeight)-h)/2;
				if (T<0){T = 0;}
				$("box").style.top = T;
				var L = 0-parseInt(w)/2;
				$("box").style.margin = "0px 0px 0px " + L + "px";
				$("box_c").innerHTML = xmlHttp.responseText;
				$("box").style.display = "";
				$("_box").style.display = "none";
			}
			else
			{
				$("_box_c").innerHTML = "数据加载失败，请重新加载";
			}
		}
		
	}
	xmlHttp.send(null);
	return false;
}

function GetList(act,type2)
{
	var url ="?timeStamp=" + new Date().getTime();
	var url = url + "&act=" + act;
	var url = url + "&type2=" + type2;
	//window.open("ajax.asp" + url);
	var xmlHttp = window.XMLHttpRequest?(new XMLHttpRequest()):(new ActiveXObject("Microsoft.XMLHTTP"));
	xmlHttp.open("get","ajax.asp" + url,true);
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{
				$("ic").innerHTML = xmlHttp.responseText;
			}
			else
			{
				$("ic").innerHTML = "数据加载失败，请重新加载";
			}
		}
		
	}
	xmlHttp.send(null);
	return false;
}

var _sw = 5; 
var _tw;
function CWTime() {
	_sw --;
	if (_sw==0) {
		location.href="/"; 
	}
	else
	{
		document.getElementById("timeSpan").innerHTML = _sw;
		setTimeout('CWTime()', 1000);
	}
}

function ShowDiv(d,w,h){
	ScreenConvert();
	$(d).style.left = (parseInt(document.body.clientWidth)-w)/2;
	$(d).style.top = (parseInt(document.body.clientHeight)-h)/2;
	$(d).style.display = "";
}

function HideDiv(d){
	$(d).style.display = "none";
	DialogHide();
}
