function easeInOut(minValue,maxValue,totalSteps,actualStep,powr) {
	var delta = maxValue - minValue;
	var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
	return Math.ceil(stepp)
}

function addFade(element,start,end) {    
	doBGFade(element,start,end,end,60,20,4);
}
function doBGFade(elem,startRGB,endRGB,finalColor,steps,intervals,powr) {
	if (elem.bgFadeInt) window.clearInterval(elem.bgFadeInt);
	var actStep = 0;
	elem.bgFadeInt = window.setInterval(
	function() {
		elem.style.backgroundColor = "rgb("+
		easeInOut(startRGB[0],endRGB[0],steps,actStep,powr)+","+
		easeInOut(startRGB[1],endRGB[1],steps,actStep,powr)+","+
		easeInOut(startRGB[2],endRGB[2],steps,actStep,powr)+")";
		actStep++;
		if (actStep > steps) {
			elem.style.backgroundColor = finalColor;
			window.clearInterval(elem.bgFadeInt);
		}
	}
	,intervals)
}

function changeTagClouds(cloud1,cloud2){
	var tmp = cloud1.innerHTML;
	var tmp2 =cloud2.innerHTML;
	
	$(cloud1).slideUp("slow", function(){
		$(cloud1).html(tmp2);	    
		$(cloud1).slideDown("slow");
		});
	$(cloud2).fadeOut('slow', function(){
	$(cloud2).html(tmp).fadeIn('slow');});
	
}
function doFade(element){
   $(element).find("div.navigationblock").slideDown('slow');
}
function fadeButtons(startcol,counter){
   var start = [255, 195, 145];
   var end = [255,255,255];   
   
   if(startcol==1){
   		$("#ib1").fadeOut('slow', function(){
   		     $(this).html("<h2>Grundst&uuml;cke</h2>").fadeIn('slow');

		});
     startcol=0;
   }else{
     $("#ib1").fadeOut('slow', function(){
   		     $(this).html("<h2>H&auml;user</h2>").fadeIn('slow');

		});
     startcol=1;
   }

   var hide_id=counter-1;
   if(counter==0){
      hide_id=8;
      }
   $("#slideshow_"+hide_id).hide();
   $("#slideshow_"+counter).fadeIn("slow");

   counter=counter+1;
   if(counter==9){
     counter=0;
     startcol=1;
     }
   setTimeout("fadeButtons("+startcol+","+counter+")",5000);
}
function hideAll(){
 $("div.slideshow").find("div:visible").hide();
}

function _slideDown(element,search,lastsearch){

  if(lastsearch!=null){
    if($(element).siblings("."+lastsearch).css("display")!="none"){
     $(element).siblings("."+lastsearch).slideUp('slow');
     }
  }
  if(lastsearch==null || lastsearch != search || $(element).siblings("."+lastsearch).css("display")=="none")
     $(element).siblings("."+search).slideDown('slow');
   
}

function slideDown(element,search,lastsearch){
   
  if(lastsearch!=null){
    if($("#"+lastsearch).css("display")!="none"){
     $("#"+lastsearch).hide('fast');
     }
  }
  if(lastsearch==null || lastsearch != search || $("#"+lastsearch).css("display")=="none")
     $("#"+search).show('fast');
   
}


function loadXMLDoc(arguments) {

   var url="ajax_search.php?arguments="+arguments;

   // Internet Explorer
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
   catch(e) {
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch(oc) { req = null; }
   }

   // Mozailla/Safari
   if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }

   // Call the processChange() function when the page has loaded
   if (req != null) {
      req.onreadystatechange = processChange;
      req.open("GET", url, true);
      
      req.send(null);
   }
}

function processChange() {
   // The page has loaded and the HTTP status code is 200 OK
   if (req.readyState == 4 && req.status == 200) {

      // Write the contents of this URL to the searchResult layer
      getObject("search_results").innerHTML = req.responseText;
   }
}

function getObject(name) {
   var ns4 = (document.layers) ? true : false;
   var w3c = (document.getElementById) ? true : false;
   var ie4 = (document.all) ? true : false;

   if (ns4) return eval('document.' + name);
   if (w3c) return document.getElementById(name);
   if (ie4) return eval('document.all.' + name);
   return false;
}