function http_object()
{
	if (window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert('Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.');
	}
}

function saveOrderInDB(as_orderList, as_webcode, as_table)
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
		xmlHttp.open("GET", 'index.php?page=editor&mode=saveorder&orderlist='+as_orderList+'&webcode='+as_webcode+'&table='+as_table, true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		//xmlHttp.onreadystatechange = function() {if (xmlHttp.readyState == 4) alert('Sortierung gespeichert.')};
		xmlHttp.send(null);
	}
}

function saveMenuDB(ai_id, as_description)
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
		xmlHttp.open("GET", 'index.php?page=editor&mode=savemenu&id='+ai_id+'&description='+urlencode(as_description), true);
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.onreadystatechange = function() {
			if (xmlHttp.readyState == 4) 
			{
				$('menu_'+ai_id).innerHTML = as_description; 
				if($('spanmenu_'+ai_id)) 
					$('spanmenu_'+ai_id).innerHTML = as_description; 
				if($('content_headline')) 
					$('content_headline').value = as_description;
				if($('content_headline_text')) 
					$('content_headline_text').innerHTML = as_description;
				Element.hide('menuEditContainer');
			}
		};
		xmlHttp.send(null);
	}
}

//INIT HTTP
var xmlHttp = http_object();