﻿	function gname(name)
	{
		return document.getElementsByTagName?document.getElementsByTagName(name):new Array()
	}
	function StrCode(str)
	{
		if(encodeURIComponent) return encodeURIComponent(str);
		if(escape) return escape(str);
	}

	function UnStrCode(str)
	{
		if(decodeURIComponent ) return decodeURIComponent (str);
		if(unescape) return unescape(str);
	}
function InitRequest()
{
	var C_req = null;
	try
	{
		C_req = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			C_req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			C_req = null;
		}
	}
	if (!C_req && typeof XMLHttpRequest != "undefined")
	{
		try
		{
			C_req = new XMLHttpRequest();
		}
		catch(fa)
		{
			alert("对不起!您的浏览器不支持该功能,请使用Internet Explorer 6.0或FireFox浏览器!");
			C_req = null;
		}
	}
	return C_req;
}


function GetRequest(url)
{
	var AjaxRequestObj = InitRequest();
	if (AjaxRequestObj != null)
	{
		AjaxRequestObj.onreadystatechange = function ()
		{
			if (AjaxRequestObj.readyState == 4 && AjaxRequestObj.responseText)
			{
				ProcessAjaxData(AjaxRequestObj.responseText);
			}
		};
		AjaxRequestObj.open("GET", url, true);
        AjaxRequestObj.send(null);
	}
}

function PostRequest(url, data)
{
	var AjaxRequestObj = InitRequest();
	if (AjaxRequestObj != null)
	{
		AjaxRequestObj.onreadystatechange = function ()
		{
			if (AjaxRequestObj.readyState == 4 && AjaxRequestObj.responseText)
			{
				ProcessAjaxData(AjaxRequestObj.responseText);
			}
		};
		AjaxRequestObj.open("POST", url, true);
		AjaxRequestObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        AjaxRequestObj.send(data);
	}
}

function ProcessAjaxData(data)
{
	eval(data);
}

function ScreenConvert()
{
	var browser = new Browser();
	var objScreen = document.getElementById("ScreenOver");
	if (!objScreen)
	{
		var objScreen = document.createElement("div");
	}
	objScreen.id = "ScreenOver";
	objScreen.style.display = "block";
	objScreen.style.top = "0px";
	objScreen.style.left = "0px";
	objScreen.style.margin = "0px";
	objScreen.style.padding = "0px";
	if (document.body.clientHeight)
	{
		//var wh = document.body.clientHeight + "px";
             var wh=document.body.scrollHeight + "px";
	}
	else if (window.innerHeight)
	{
		var wh = window.innerHeight + "px";
	}
	else
	{
		var wh = "100%";
	}

	objScreen.style.width = "100%";
	objScreen.style.height = wh;
	objScreen.style.position = "absolute";
	objScreen.style.zIndex = "3";
	if ((!browser.isSF) && (!browser.isOP))
	{
		objScreen.style.background = "#181818";	
	}
	else
	{
		objScreen.style.background = "#F0F0F0";
	}
	//objScreen.style.filter = "alpha(opacity=40)";
	//objScreen.style.opacity = 40/100;
	//objScreen.style.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";
	}
}

var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;

function DialogLocation()
{
	if (window.innerWidth)
	{
		var ww = window.innerWidth;
		var wh = window.innerHeight;
		var bgX = window.pageXOffset;
		var bgY = window.pageYOffset;
	}
	else
	{
		var ww = document.documentElement.offsetWidth;
		var wh = document.documentElement.offsetHeight;
		var bgX = document.documentElement.scrollLeft;
		var bgY = document.body.scrollTop;//document.documentElement.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;
	DialogLocation();
	objDialog.id = "DialogMove";
	objDialog.style.display = "block";
	objDialog.style.top = t_DiglogY + "px";
	objDialog.style.left = t_DiglogX + "px";
	objDialog.style.margin = "0px";
	objDialog.style.padding = "0px";
	objDialog.style.width = w + "px";
	objDialog.style.height = h + "px";
	objDialog.style.position = "absolute";
	objDialog.style.zIndex = "5";
	objDialog.style.background = "#FFFfcc";
	objDialog.style.border = "solid #003366 2px";
	objDialog.innerHTML = showdata;
	document.body.appendChild(objDialog);
}

function DialogHide()
{
	ScreenClean();
	var objDialog = document.getElementById("DialogMove");
	if (objDialog)
	{
		objDialog.style.display = "none";
	}
}