function logout()
{
	getcontent('content','logout.php','');
	getcontent('navigation','navigation.php','');
	getcontent('content','content.php','kategorie=News');
	getcontent('newsbox','content.php','kategorie=newsbox');

}

function getcontent (div, seite, param)
{
	speedin=350;
	speedout=700;
	$("#status").fadeIn(250);
	//Inhalt ausfaden	
	$("#"+div).fadeOut(speedout, function()
		{
			//WENN AUSGEFADED DANN SEITE LADEN
		   	$("#"+div).load(seite,param,function()
	  			{
	  				//Shadowbox.init({ skipSetup: true }); 
					//Shadowbox.setup();		
					//WENN GELADEN DANN EINBLENDEN
					
					$("#"+div).fadeIn(speedout, function()
				      		{
							//LOADER AUSBLEDEN
				          		$("#status").fadeOut(250)   	
			          			xinha_load()
			          			
			          			//$("div[id^='content_item']").sortable();

				      		});
	  			});
		});
}

function submit_form(datei,param,returnurl,returndiv,returnparam){
	$("#status").fadeIn();
				$.post(datei,param, function() 
					{
						
						
						getcontent(returndiv,returnurl,returnparam);
						$("#status").fadeOut();
					});
			return false;
			
}


function delete_item(id){
bestaetigt = window.confirm ("Möchten Sie den Beitrag wirklich löschen?");

						if (bestaetigt == true)
							{
							 	$.get("delete.php","id="+id, function() 
									{
										
										$("#"+id).fadeOut();
										
									});
					
							}
}
function xinha_load(){
	
	xinha_plugins = ['Linker','ImageManager','SuperClean','ExtendedFileManager'];
	xinha_editors =['htmlarea','htmlarea2'];
	var config = new Xinha.Config();
	if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
	editors = Xinha.makeEditors(xinha_editors, config, xinha_plugins);
	
	Xinha.startEditors(editors);
	
}

function xinha_init()
{	xinha_plugins = ['Linker','ImageManager','SuperClean','ExtendedFileManager'];
	var config = new Xinha.Config();
	if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
	editors = Xinha.makeEditors(xinha_editors, config, xinha_plugins);
	
	Xinha.startEditors(editors);

}
//Autoupdates of Screen
function autoupdate (pars,secs) {
	new Ajax.PeriodicalUpdater('content', 'cal_view.php', {
		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";
    				},
		onFailure: function(){ 
					document.getElementById('status').style.visibility="visible" 
					document.getElementById('status').innerHTML = "FEHLER BEIM LADEN - �berpr�fen Sie die Internetverbindung!";
					}
	});
}

function getigoogle (){
		document.getElementById('status').style.visibility="visible";
		document.getElementById('status').innerHTML = "LADEN...";
		new Ajax.Updater('content', 'http://www.google.com/ig', {
		method: 'get',
		//parameters: pars,
		//asynchronous:true, 
		//evalScripts:true,
		onSuccess: function(transport){
					var response = transport.responseText || "no response text";
					//document.getElementById('status').innerHTML = "Fertig";
					//hide Statusinfos
					document.getElementById('status').style.visibility="hidden";
    				},
		onFailure: function(){ 
					document.getElementById('status').style.visibility="visible" 
					document.getElementById('status').innerHTML = "FEHLER BEIM LADEN - �berpr�fen Sie die Internetverbindung!";
					}
	});

}

function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

function buttonstate(button,imgSrc)
{
switchImage('button1','images/views/calendar_notpressed.jpg')
switchImage('button2','images/views/igoogle_notpressed.jpg')
switchImage('button3','images/views/month_notpressed.jpg')
switchImage('button4','images/views/week_notpressed.jpg')
switchImage('button5','images/views/day_notpressed.jpg')
//Switch on
//alert(button)
switchImage(button,imgSrc)
}

//Global Variable for use in Table
var height=0;
//Reads the possible vertical Screen area
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
}
