var $=function(hook){return document.getElementById(hook);}
var AjaxListSeparator = als = "<::AJAXLISTSEPARATOR::>";
function unhtmlspecialchars(str){
	f = new Array(/&lt;/g, /&gt;/g, /&quot;/g, /&amp;/g);
	r = new Array('<', '>', '"', '&');
	for (var i = 0; i < f.length; i++){
		str = str.replace(f[i], r[i]);
	}
	return str.replace(/&#039;/g,"'");
}
function htmlspecialchars(str){
	var f = new Array(new RegExp('&', 'g'),new RegExp('<', 'g'),new RegExp('>', 'g'),new RegExp('"', 'g'));
	var r = new Array('&amp;','&lt;','&gt;','&quot;');
	for (var i = 0; i < f.length; i++){
		str = str.replace(f[i], r[i]);
	}
	return str.replace("'",/&#039;/g);
}
function rndNO(e,s)
{
	switch (e)
	{
		case 0:return ((d = new Date()).getYear()) + (s?"-":"") + (d.getMonth()+1) + (s?"-":"") + (d.getDate()) + (s?"-":"") + (d.getHours()) + (s?"-":"") + (d.getMinutes()) + (s?"-":"") + (d.getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 1:return ((d = new Date()).getMonth()+1) + (s?"-":"") + (d.getDate()) + (s?"-":"") + (d.getHours()) + (s?"-":"") + (d.getMinutes()) + (s?"-":"") + (d.getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 2:return ((d = new Date()).getDate()) + (s?"-":"") + (d.getHours()) + (s?"-":"") + (d.getMinutes()) + (s?"-":"") + (d.getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 3:return ((d = new Date()).getHours()) + (s?"-":"") + (d.getMinutes()) + (s?"-":"") + (d.getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 4:return ((d = new Date()).getMinutes()) + (s?"-":"") + (d.getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 5:return ((d = new Date()).getSeconds()) + (s?"-":"") + (d.getMilliseconds());
		case 6:return ((d = new Date()).getMilliseconds());
	}
}
function loginRetry()
{
	tonyAjax.MODE = "GET";
	tonyAjax.loadHttp(WEB_ROOT_PATH+"library/include/usrpanel_out.php?r="+rndNO(0),true,function(f)
	{
		try{if(typeof(isRefreash)!="undefined"&&isRefreash){window.location.reload();}}catch(e){};
		$("loginregion").innerHTML = f.responseText;
	});
}
Ajax = function ()
{
	var navName = (function ()
	{
		var u = navigator.userAgent.toLowerCase();
		if (/gecko/i.test(u)) return "moz";
		if (/msie/i.test(u)) return "ie";
		return "other";
	})();
	this.MODE = "GET";
	var ie = navName=="ie";
	var elem = $("__AjaxCall_Wait");
	if (!elem) 
	{
		elem = document.createElement("div");
		elem.id = '__AjaxCall_Wait';
		elem.style.position = "absolute";
		elem.style.display = "none";
		elem.style.background = "#3C4040";
		elem.style.left= "40%"; 
		elem.style.top= "50%";
		elem.style.color = "#FF6600";
		elem.style.padding = "7px";
		elem.style.border = "1px solid #FF7700";
		document.body.insertBefore(elem,document.body.firstChild);
	}
	elem.style.width = 250;
	//elem.style.height = 35;
	elem.innerHTML = "";
	this.xmlHttp = function ()
	{
		
		if (ie)
		{
			for (var i=0; i<2; i++)
			try
			{
				var r = new ActiveXObject(["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"][i]);
				return r;
			}
			catch (e) { return null;};
		}
		else return new XMLHttpRequest();
		
	}

	this.loadHttp = function (url, asy, fun ,agv)
	{

		this.enabled = false;
		var xmlHttp = this.xmlHttp();
		$("__AjaxCall_Wait").style.display = "block";
		$("__AjaxCall_Wait").innerHTML = "Processing your request...";
		xmlHttp.open(this.MODE, url, (asy ? true : false));
		if (asy)
		{
			xmlHttp.onreadystatechange = function()
			{
				if(xmlHttp.readyState==4)
				{
					fun (xmlHttp);
					$("__AjaxCall_Wait").innerHTML = "";
					$("__AjaxCall_Wait").style.display = "none";
				}
			};
			this.MODE == "POST"?(xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xmlHttp.send(agv)):xmlHttp.send(null);
		}
		else
		{
			try
			{
				this.MODE == "POST"?(xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xmlHttp.send(agv)):xmlHttp.send(null);
			}
			catch (e)
			{
				throw new Error("LoadHttp Error.");
				return;
			}
			return xmlHttp.responseText;
		}
	}
};
var tonyAjax = new Ajax;var WEB_ROOT_PATH = "/";
