//v1
// author: Emi Huber, macREC GmbH, 2010

function GetXmlHttpObject() {
	if (window.XMLHttpRequest) {
  		// code for IE7+, Firefox, Chrome, Opera, Safari
  		return new XMLHttpRequest();
  	} else if (window.ActiveXObject) {
  		// code for IE6, IE5
  		return new ActiveXObject("Microsoft.XMLHTTP");
  	}
	return null;
}

function stateChanged1() {
	if (xmlhttp1.readyState==4) {
  		parent.document.getElementById('div_content').innerHTML=xmlhttp1.responseText;
  	}
}
function load_div1(hauptmenu1,untermenu1)
{
	xmlhttp1=GetXmlHttpObject();
	if (xmlhttp1==null) {
  		alert ("Your browser does not support XMLHTTP!");
  		return;
  	} 
	url="content.php";
	url=url+"?h="+hauptmenu1+"&u="+untermenu1;
	// prevent caching
	url=url+"&sid="+Math.random();
	xmlhttp1.onreadystatechange=stateChanged1;
	xmlhttp1.open("GET",url,true);
	xmlhttp1.send(null);
}

function stateChanged1a() {
	if (xmlhttp1.readyState==4) {
  		parent.document.getElementById('div_content').innerHTML=xmlhttp1a.responseText;
  	}
}
function load_div1a(hauptmenu1,untermenu1,offset,currentdate,direction,typeofevent)
{
	xmlhttp1a=GetXmlHttpObject();
	if (xmlhttp1a==null) {
  		alert ("Your browser does not support XMLHTTP!");
  		return;
  	}
	url="content.php";
	url=url+"?h="+hauptmenu1+"&u="+untermenu1+"&o="+offset+"&date="+currentdate+"&d="+direction+"&t="+typeofevent;
	// prevent caching
	url=url+"&sid="+Math.random();
	xmlhttp1a.onreadystatechange=stateChanged1a;
	xmlhttp1a.open("GET",url,true);
	xmlhttp1a.send(null);
}

function stateChanged2() {
	if (xmlhttp2.readyState==4) {
  		parent.document.getElementById('div_sidebar').innerHTML=xmlhttp2.responseText;
		//initLytebox();
		createPicker();
  	}
}
function load_div2(hauptmenu2,untermenu2,currentdate,offset)
{
	xmlhttp2=GetXmlHttpObject();
	if (xmlhttp2==null) {
  		alert ("Your browser does not support XMLHTTP!");
  		return;
  	} 
	url="sidebar.php";
	url=url+"?h="+hauptmenu2+"&u="+untermenu2+"&date="+currentdate+"&o="+offset;
	// prevent caching
	url=url+"&sid="+Math.random();
	xmlhttp2.onreadystatechange=stateChanged2;
	xmlhttp2.open("GET",url,true);
	xmlhttp2.send(null);
}
