// JavaScript Document

/********************* der folgende Bereich ist auf allen Seiten gleich *********************/

function init(){ // inital-zündung: onLoad-Stuff
	blurAnchors();
	extern();
	hide('ConFSN');
	adjustMCDiv();
}

function blurAnchors(){ // kein Glow bei Links
  if(document.getElementsByTagName){
    var a = document.getElementsByTagName("a");
    for(var i = 0; i < a.length; i++){
      a[i].onfocus = function(){this.blur()};
    }
  }
}

function extern() { // eigen Fenster für externe Links
	for(var i=0; i < document.links.length; ++i){
	if(document.links[i].href.indexOf(window.location.hostname) < 0) {
		document.links[i].target="_blank";
		}
	}
	for(var j=0; j < document.links.length; ++j){
		if(document.links[j].href.indexOf('javascript:') >= 0){
		document.links[j].target="_self";
		}
	}
}

function reloadPage(initial) {  //reloads the window if resized
  if (initial==true){
    document.pgW=window.innerWidth;
		document.pgH=window.innerHeight;
		window.onresize = reloadPage;
		} else if (window.innerWidth!=document.pgW || window.innerHeight!=document.pgH) {
		// window.onmouseup = window.setTimeout('location.reload();', 1); // a little time-delay gets it running with FireFox Mac
		adjustMCDiv();
		}
}

// this function not at the startpage //0
function hide(element){
	h = window.innerHeight;
	if (!h) {
		h = screen.availHeight;
		h = h-164; // Browser
	}
	if (h<=506) {
		document.getElementById(element).style.visibility='hidden';
	} else {document.getElementById(element).style.visibility='visible';}
}
function adjustMCDiv(){
	h = window.innerHeight;
	if (!h) {
		h = screen.availHeight;
		h = h-164; // Browser
	}
	// h = h-350; // startseite  .|.  h = h-182; // sub-pages
	h = h-182; // sub-pages
	h = (Math.floor(h/8))*8; // 16 pixel line-height - 16 pixel grid / half grid
	hval = h+'px';
	document.getElementById('mainContentBox').style.height = hval;
	hide('ConFSN');
}
// für IE
if (!window.innerHeight) {
	// alert('hui');
	h = screen.availHeight
	// h = h-350; // startseite  .|.  h = h-182; // sub-pages
	h = h-182; // sub-pages
	h = h-164; // Browser
	h = (Math.floor(h/8))*8; // 16 pixel line-height - 16 pixel grid / half grid
	hval = h+'px';
	document.write ('\r<style type="text/css" media="screen" >\r<!--\r/***** dyn-styles *****/\r#mainContentBox {\r\theight: '+h+'px;\r\tpadding-right:15px;\r\toverflow: auto;\r}\r/***  dyn-styles end ***/\r-->\r</style>\r<style type="text/css" media="projection" >\r<!--\r/***** dyn-styles *****/\r#mainContentBox {\r\theight: '+h+'px;\r\tpadding-right:15px;\r\toverflow: auto;\r}/***  dyn-styles end ***/\r-->\r</style>\r');
}
reloadPage(true);
