var suchbegriff_feld = new Spry.Widget.ValidationTextField("suchbegriff_feld", "none", {hint:"Suche"});

function getWinHeight() // based on a script by projectseven.com (PVII)

{
 if (window.innerHeight) { var h = window.innerHeight; } // ns4
 else if(document.body)
 {
  var h = document.body.clientHeight;
  if (document.body.offsetHeight == h && document.documentElement && document.documentElement.clientHeight)
  {
   var h = document.documentElement.clientHeight;
  }
 }
 return h;
}

function resize_content() {
	
	// Höhe des divs 'content' anpassen
	
	// Alle divs innerhalb von content feststellen
	var bereich = document.getElementById("content");
	var divs = bereich.getElementsByTagName("div");
	
	var hoehe_content = 0;
	var hoehe_content_footer = 0;
	
	for (var i = 0; i < divs.length; i++) {
	  
	  var id_name = "" + divs[i].id + "";
	  
	  	if( id_name != "" && id_name != null ) {
		  var sub_div = document.getElementById("" + id_name + "");
		  // Position von oben und die Hoehe der einzelnen ermitteln
		  var position = sub_div.offsetTop;
		  var hoehe = sub_div.offsetHeight;
		  var neue_hoehe = position + hoehe;
		  if ( neue_hoehe > hoehe_content ) {
			hoehe_content = neue_hoehe;	
		  }		  					  
		  if ( id_name != "navi-box" && neue_hoehe > hoehe_content_footer ) {
			  hoehe_content_footer = neue_hoehe;	
		  }		  
		}  	  
	}
	
	var komplett = getWinHeight() - 6;
	
	var footer_top_distance = 25;
	
	var footer = document.getElementById("footer");
	var hoehe_footer = footer.offsetHeight + footer_top_distance;
	
	hoehe_content = hoehe_content + hoehe_footer + 10;
	
	if ( hoehe_content < komplett ) {
		bereich.style.height = "" + komplett + "px";
		var footer_pos = komplett - hoehe_footer;
	} else {
		bereich.style.height = "" + hoehe_content + "px";
		var footer_pos = hoehe_content_footer + footer_top_distance;
	}
	
	footer.style.top = "" + footer_pos + "px";

}

resize_content();


// Externe Links markieren

var own = window.location.host;
var aTags = document.getElementsByTagName("a");
var laenge_aTags = aTags.length;
for (var i = 0; i < laenge_aTags; ++i) {
	var l = aTags[i].href;	
	if ( l.indexOf(own) == -1 ) {
		var li = aTags[i];
		li.className += " extern";
		li.target = "_blank";
	}	
}


function str_replace(search, replace, subject) {
return subject.split(search).join(replace);
}
