function getcontent(targetdiv, page, pars)
{
	//alert(targetdiv + page + pars)
	//alert(page + pars)
	//displaystatus('Loading...');
	//Display Statusinfos
	document.getElementById('status').style.visibility="visible";
	document.getElementById('status').innerHTML = "Loading...";
	
	new Ajax.Updater(targetdiv, page, {
		method: 'get',
		parameters: pars,
		//asynchronous:true, 
		//evalScripts:true,
		onSuccess: function(transport){
					var response = transport.responseText || "no response text";
					text="Geladen am " + currenttime();
					document.getElementById('status').innerHTML=text;
					//hide Statusinfos
					document.getElementById('status').style.visibility="visible";
    				},
		onFailure: function(){ 
					document.getElementById('status').style.visibility="visible" 
					document.getElementById('status').style.color="#333333" 
					text="Fehlerhafte Internetverbindung - Stand: " + currenttime();
					document.getElementById('status').innerHTML=text;
					}
	});
}

//Autoupdates of Screen
function autoupdate (targetdiv, page, pars, secs) {
	new Ajax.PeriodicalUpdater(targetdiv, page, {
		method: 'get',
		parameters: pars,
		frequency: secs,
		//asynchronous:true, 
		//evalScripts:true,
		onSuccess: function(transport){
					var response = transport.responseText || "Kein Antworttext eingetragen.";
					//document.getElementById('status').innerHTML = "Fertig";
					//hide Statusinfos
					//document.getElementById('status').style.visibility="hidden";
					text="Aktualisiert am " + currenttime();
					document.getElementById('status').innerHTML=text;
    				},
		onFailure: function(){ 
					document.getElementById('status').style.visibility="visible" 
					document.getElementById('status').innerHTML = "FEHLER BEIM LADEN - Überprüfen Sie die Internetverbindung!";
					}
	});
}


function currenttime() {
	var currentDate = new Date()
	var currentTime = new Date()
	var datum = new Date();
	var wochentag = new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");
	var hours = currentTime.getHours()
	var minutes = currentTime.getMinutes()
	var seconds = currentTime.getSeconds()
	var day = currentDate.getDate()
	var month = currentDate.getMonth()+1;
	var year = currentDate.getFullYear()
  if (minutes < 10)
  minutes = "0" + minutes

  if (seconds < 10)
  seconds = "0" + seconds
  
  temp= wochentag[datum.getDay()] + ", " + day + "." + month + "." + year + " - " + hours + ":" + minutes + ":" + seconds;
  return temp;
}



//Global Variable for use in Table
var height=0;
//Reads the possible vertical Screen area
//NOT USED!!!!
function getverticalscreenheight() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  //margin for calendarframe
  margin=80
  height=myHeight-margin
  x=height
  //window.alert(x)
  return x
}

function getURLParam(){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")+1).toLowerCase();
    /*var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }*/
  }
  return unescape(strQueryString);
} 

function getHorizontalWidth()
{
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;
}
//Write Style-Info für Plan
//alert (x + " " + y)
/*	document.write("<style type='text/css'>")
	document.write(".plan {width:")
	document.write(800-430)
	document.write("px;")
	document.write("height:")
	document.write(200)
	document.write("px;}")
	document.write("</style>")
*/
return x;	
	
}

function getVerticalWidth()
{
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;
}
//Write Style-Info für Plan
//alert (x + " " + y)
/*	document.write("<style type='text/css'>")
	document.write(".plan {width:")
	document.write(800-430)
	document.write("px;")
	document.write("height:")
	document.write(200)
	document.write("px;}")
	document.write("</style>")
*/
return y;	
	
}

function set_plandivdimensions(width_reducedbyinfobox, height_reducedbytagesmeldung)
{
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;
}
//Write Style-Info für Plan
//alert (x + " " + y)
x=x-width_reducedbyinfobox;
y=y-height_reducedbytagesmeldung;
var elem = document.getElementById("plan");
elem.style.width = x;
elem.style.height = y;	
}

function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 



