function printPage() {
	if (window.print) {
		jetztdrucken = confirm('Soll die Seite gedruckt werden?');
		if (jetztdrucken) window.print();
   }
}
function getTDS(id) {
	if(document.getElementById(id)){
		var m1 = document.getElementById(id);
		var tds = m1.getElementsByTagName("TD");
		return tds;
	}
}
function initSeminarkalender() {
	var setHeight = new Array();
	var tds = getTDS("monat0");
	if(tds) {
		for(i=0;i<tds.length;i++) {
			setHeight[i] = tds[i].offsetHeight;
		}
	}
	var tds2 = getTDS("monat1");
	if(tds2) {
		for(i=0;i<tds2.length;i++) {
			setHeight[i] = Math.max(setHeight[i], tds2[i].offsetHeight);
		}
	}
	var tds3 = getTDS("monat2");
	if(tds3) {
		for(i=0;i<tds3.length;i++) {
			setHeight[i] = Math.max(setHeight[i], tds3[i].offsetHeight);
		}
	}
	if(tds) {
		for(i=0;i<tds.length;i++) {
			tds[i].style.height = setHeight[i]+"px";
		}
	}
	if(tds2) {
		for(i=0;i<tds2.length;i++) {
			tds2[i].style.height = setHeight[i]+"px";
		}
	}
	if(tds3) {
		for(i=0;i<tds3.length;i++) {
			tds3[i].style.height = setHeight[i]+"px";
		}
	}
}

// Clean leading & trailing slashes
function cleanURL (url, end) {
	var url = url.toString();
	var urlLen = url.length;
	
	if (end) {
		if (url.charAt((urlLen-1))=='/')
			url = url.substring(0,(urlLen-1));
	}
	else {
		if (url.charAt(0)=='/')
			url = url.substring(1,urlLen);
	}
	return url;
}

//function maskEmail(name, domain) {
//	document.writeln('<a href="mailto:'+name+'@'+domain+'">'+name+'@'+domain+'</a>');
//}

function maskEmail(name, domain) {
 var email = name+'@'+domain;
 var url = cleanURL(window.location, true);
 var mail_path = '/virtual/mailto/'+url+'/'+email;
	document.writeln('<a href="mailto:'+name+'@'+domain+'" class="colorForPage" onclick="_gaq.push([\'_trackPageview\', \''+mail_path+'\']);">'+name+'@'+domain+'</a>');
}

function init() {
	initSeminarkalender();
	hoverIE();
	
		if(document.getElementById("menue")){
		var menu = document.getElementById("menue");
		var b = menu.getElementsByTagName("LI");
		for(j=0;j<b.length;j++) {
					if(b[j].className.match(/ebene2_active/)) {
					st = parseInt(RegExp.$1);
					ul = b[j].parentNode.parentNode;
							ul.className = "ebene1_active";
			}
		}
	}
}
function hoverIE() {
  if(window.navigator.systemLanguage && !window.navigator.language) {
	if(document.getElementById("menue")){
		var LI = document.getElementById("menue").firstChild;
    do {
      if (sucheUL(LI.firstChild)) {
        LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
      }
      LI = LI.nextSibling;
    }
    while(LI);
    }
  }
}

function sucheUL(UL) {
  do {
    if(UL) UL = UL.nextSibling;
    if(UL && UL.nodeName == "UL") return UL;
  }
  while(UL);
  return false;
}
function einblenden() {
  var UL = sucheUL(this.firstChild);
  UL.style.display = "block";
}
function ausblenden() {
  sucheUL(this.firstChild).style.display = "none";
}

function openPopup(link) {
	window.open(link , 'neuesFenster' ,'width=870,height=700,resizeable=no,scrollbars=yes');
}
function openPopup2(pic, width, height) {
	window.open('/dauphin/bild2.php?pic=' +pic+'&width='+width+'&height='+height,'Bildansicht','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+width+',height='+height);
}
/*
  function einblenden() {
    var UL = sucheUL(this.firstChild);
    UL.style.display = "block"; UL.style.backgroundColor = "#008468";
  }
  function ausblenden() {
    sucheUL(this.firstChild).style.display = "none";
  }

*/

	
window.onload = init;
window.onscroll=scrollToplink;

function scrollToplink() {
	var x,y;

	if( navigator.userAgent.match(/MSIE 6.0/)){
		if (self.pageYOffset) // all except Explorer
		{
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		var linkname = document.getElementById("toplink");
		y += document.documentElement.clientHeight;
		y -= 20;
		linkname.style.top = y +"px";
	}
}

// Popup Bionic
function popUp1(wintype) {
  var nwl = (screen.width-1000)/2;
  var nwh = (screen.height-750)/2;
  popUp=window.open(wintype, 'PopUp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1000,height=750,left='+nwl+',top='+nwh+''); 
  popUp.window.focus(); 
}


