function setContentHolder(verweis)
{
	//alert(verweis);
	$('#contentHolder').html('<img src="img/ajax_preloader.gif" width="64" height="64" class="preloader" />');
	//alert($.get(verweis));
	//$('#contentHolder').html($.get(verweis));
	$.get(verweis,function(msg){
				$('#contentHolder').html(msg);
				
				/* After page was received, add it to the cache for the current hyperlink: */
				//element.data('cache',msg);
			});
}

function DivEinAusblenden(divName){
 //Gibt es das Objekt mit dem Namen der in divName übergeben wurde?
 if(document.getElementById(divName)){
  /*"Sichtbarkeit" des Divs umschalten. 
  Wenn es sichtbar war, unsichtbar machen und umgedreht.*/
  document.getElementById(divName).style.display = 
   (document.getElementById(divName).style.display == 'none') ? 'inline' : 'none';
 }
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
$(document)

	
	.ready(
	function()	
	{
		
		
		
		//$().MessageBox('Test');
		/* Defining an array with the tab text and AJAX pages: */
		var Tabs = {
			'Home'	: 'content/home-de.htm',
			'Situation'	: 'content/situation-de.htm',
			'Projekte'	: 'content/projekt-de.htm',
			'Aktivit&auml;ten/News'	: 'content/aktivitaeten.htm',
			'Galerie'	: 'content/galerie.htm',
			'Archiv'	: 'content/archiv.htm',
			'Download'	: 'content/download.htm'
		}
		
		/* The available colors for the tabs: */
		var colors = ['red','red','red','red'];
		
		/* The colors of the line above the tab when it is active: */
		var topLineColor = {
			blue:'lightblue',
			green:'lightgreen',
			red:'red',
			orange:'orange',
			grey:"lightgrey"
		}
	
		/* Looping through the Tabs object: */
		var z=0;
		$.each(Tabs,function(i,j){
		/* Sequentially creating the tabs and assigning a color from the array: */
		//alert(j);
		var tmp = $('<li><a href="?content='+j+'" class="tab '+colors[(z++%4)]+'">'+i+' <span class="left" /><span class="right" /></a></li>');
		
		/* Setting the page data for each hyperlink: */
		tmp.find('a').data('page',j);
		
		/* Adding the tab to the UL container: */
		$('ul.tabContainer').append(tmp);
		})

	/* Caching the tabs into a variable for better performance: */
	var the_tabs = $('.tab');
	
	
	the_tabs.click(
		function(e)
		{
			/* "this" points to the clicked tab hyperlink: */
			var element = $(this);
			
			/* If it is currently active, return false and exit: */
			//if(element.find('#overLine').length) return false;
			
			/* Detecting the color of the tab (it was added to the class attribute in the loop above): */
			var bg = element.attr('class').replace('tab ','');
	
			/* Removing the line: */
			$('#overLine').remove();
		
		/* Creating a new line with jQuery 1.4 by passing a second parameter: */
		$('<div>',{
			id:'overLine',
			css:{
				display:'none',
				width:element.outerWidth()-2,
				background:topLineColor[bg] || 'white'
			}}).appendTo(element).fadeIn('slow');
		
		/* Checking whether the AJAX fetched page has been cached: */
		
		if(!element.data('cache'))
		{	
			/* If no cache is present, show the gif preloader and run an AJAX request: */
			//window.location.href="";
			$('#contentHolder').html('<img src="img/ajax_preloader.gif" width="64" height="64" class="preloader" />');

			$.get(element.data('page'),function(msg){
				$('#contentHolder').html(msg);
				
				/* After page was received, add it to the cache for the current hyperlink: */
				//element.data('cache',msg);
			});
		}
		else $('#contentHolder').html(element.data('cache'));
		
		e.preventDefault();
	})
	
	/* Emulating a click on the first tab so that the content area is not empty: */
	$('a').click(function (e) 
	{ 
	  //alert(event.target)
		//event.preventDefault(); 
    	//here you can also do all sort of things 
	});
	the_tabs.eq(0).click();
					
		var parContent= gup('content');
		if(parContent != "")
		{
			//document.location.assign("index.html");
			//setTimeout("",1250);
			//wait(500);
			setContentHolder(parContent);
		}
	
	
	
});

