var bannerSlideShowDivPos = false;
var _iSizeX = 0;
var _iSizeY = 0;
var slideShowInterval = null;


var xmlhttp;
var xmlhttp2;
function as_ajaxLoader()
{
	if (window.XMLHttpRequest)
	{
		try {
			return new XMLHttpRequest();
		} 
		catch(event) {
			return false;
		}
	}
	else if (window.ActiveXObject)
	{
	try {return new ActiveXObject("Msxml2.XMLHTTP");}
	catch(event) {try {return new ActiveXObject("Microsoft.XMLHTTP");} catch(event) {return false;}}
	}
}

function as_BrowserSize()
{
	if ((window) && (document))
	{
		if (typeof(document.documentElement) != 'undefined')
		{
			if (typeof(document.documentElement.clientWidth) != 'undefined')
			{
				_iSizeX = document.documentElement.clientWidth;
			}
		}
		if ((typeof(window.innerWidth) != 'undefined') && (_iSizeX == 0)) {_iSizeX = window.innerWidth;}
		if ((typeof(document.body.clientWidth) != 'undefined') && (_iSizeX == 0)) {_iSizeX = document.body.clientWidth;}
		if ((typeof(document.body.offsetWidth) != 'undefined') && (_iSizeX == 0)) {_iSizeX = document.body.offsetWidth;}
	}
	
	if ((window) && (document))
	{
		if (typeof(document.documentElement) != 'undefined')
		{
			if (typeof(document.documentElement.clientHeight) != 'undefined')
			{
				_iSizeY = document.documentElement.clientHeight;
			}
		}
		if ((typeof(window.innerHeight) != 'undefined') && (_iSizeY == 0)) {_iSizeY = window.innerHeight;}
		if ((typeof(document.body.clientHeight) != 'undefined') && (_iSizeY == 0)) {_iSizeY = document.body.clientHeight;}
		if ((typeof(document.body.offsetHeight) != 'undefined') && (_iSizeY == 0)) {_iSizeY = document.body.offsetHeight;}
	}
	
	if(bannerSlideShowDivPos == false) { document.getElementById('bannerSlideInhalt').style.left = _iSizeX+"px"; bannerSlideShowDivPos = true; }
	
	document.getElementById('content').style.height = (_iSizeY - 300)+"px";
	document.getElementById('cc_content').style.height = (_iSizeY - 300)+"px";
	document.getElementById('content').style.width = "100%";
}

window.onresize = as_BrowserSize;


// bannerSlide-Show

function as_moveSlideShow()
{
	var posX = parseInt(document.getElementById('bannerSlideInhalt').style.left);
	var widthX = document.getElementById('bannerSlideInhalt').offsetWidth;
	document.getElementById('bannerSlideInhalt').style.left = (posX-2)+"px";
	if((posX-2) <= (0-widthX)) { document.getElementById('bannerSlideInhalt').style.left = _iSizeX+"px"; }
}

function as_showCalendar(Year, Month, TerminID)
{
	xmlhttp = as_ajaxLoader();
	if(xmlhttp)
	{
		xmlhttp.onreadystatechange = function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				document.getElementById("calendarDiv").innerHTML=xmlhttp.responseText;
			}
		}
		
		xmlhttp.open("POST", "calendar.php", true);
		xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		xmlhttp.send("jahr="+Year+"&monat="+Month+"&TerminID="+TerminID);
	}
}

function as_showPress(Year, PresseID)
{
	xmlhttp2 = as_ajaxLoader();
	
	if(xmlhttp2)
	{
		xmlhttp2.onreadystatechange = function()
		{
			if(xmlhttp2)
			{
				if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
				{
					document.getElementById("pressDiv").innerHTML=xmlhttp2.responseText;
				}
			}
		}
	}
	
	xmlhttp2.open("POST", "press.php", true);
	xmlhttp2.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp2.send("jahr="+Year+"&PresseID="+PresseID);
}
