/**
* @author Georg Rothweiler, SCREENdesignR
* @author Marc Hass
*/

setWitdth();
iFrameHeight();

/* Überwachung von Netscape initialisieren */
if (!window.Weite && window.innerWidth) 
{
	window.onresize = neuAufbau;
	Weite = Fensterweite();
	Hoehe = Fensterhoehe();
}

/* Überwachung von Internet Explorer initialisieren */
if (!window.Weite && document.body && document.body.offsetWidth) {
	window.onresize = neuAufbau;
	Weite = Fensterweite();
	Hoehe = Fensterhoehe();
}

function iFrameHeight() 
{
	var h = Fensterhoehe()-280;
	var iFrame = document.getElementById('iFrame');
	
	if((iFrame == null) && document.all) 
	  iFrame = document.all.iFrame;

	if(iFrame != null) 
	  iFrame.style.height = h+'px';
}

function wechsel(num) {
	var styles = document.getElementsByTagName('style');
	for(var i = 1; i < (styles.length); i++) {
		if(i==num) {
		styles[i].disabled = false;
		}
		else {
			if(styles[i].getAttribute("title")!="") {
				styles[i].disabled = true;
				}
		}
	}
}

function setWitdth() {
	if(Fensterweite()>=1000) {
		//alert("Fensterweite ist gross: ("+Fensterweite()+"px)");
		wechsel(0);
	}
	else { 
		wechsel(1);
		//alert("Fensterweite ist gering: ("+Fensterweite()+"px)");
	}
}

function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function neuAufbau () {
  if (Weite != Fensterweite() || Hoehe != Fensterhoehe())
    location.href = location.href;
}

function iFrameSrc(page){
	link=location.search.substring(1,location.search.length);
	var x= link.split('&');
	
	for (var i=0;i<x.length;i++){
		if(i===1){
			liTag = document.getElementById(x[1]);
			if (liTag !== null){
				liTag.className="active";
			}else{
				return;
			}
		}
		if(i===2){
			aTag = document.getElementById(x[2]);
			aTag.className='active';
		}
	}
//	alert(location);
	if (page !== link){
//		alert('nicht identisch');
		document.getElementById('iFrame').src=(x[0] + ".html");
	}

	if (page === link){
//		alert('identisch');
		return;
	}

}	

function li_switch(link){
	var allLiTags = link.parentNode.parentNode.getElementsByTagName('LI');
	for (var i=0; i< allLiTags.length; i++) {
		allLiTags[i].className = 'passiv';
	}
	var allATags = link.parentNode.parentNode.getElementsByTagName('A');
	for (var j=0; j< allATags.length; j++){
		allATags[j].className = 'passiv';
		link.parentNode.className='active';
		document.getElementById('iFrame').focus();
	}
}
function li_lvl2_switch(link){
	allATags = link.parentNode.parentNode.getElementsByTagName('A');
	for (var i=0; i< allATags.length; i++){
		allATags[i].className = 'passiv';
		link.className='active';
		document.getElementById('iFrame').focus();
	}
}
