function email_decode(text1, text2, text3) {
	document.write('<a href="' + 'mailto:' + text1 + '@' + text2 + '.' + text3 + '">' + text1 + '@' + text2 + '.' + text3 + '</a>');
}
/* Sizefix.css laden oder nicht ? */
/*
document.write("<link id=\"sizefix_neu\" rel=\"stylesheet\" href=\"../../assets/css/sizefix_neu.css\" media=\"screen\" />");
document.getElementById("sizefix_neu").disabled = true;
*/

function getElement(id) {
return document.getElementById ? document.getElementById(id) :
document.all ? document.all(id) : null;
}

function getClientWidth() {
return document.body && typeof document.body.clientWidth != 'undefined' ?
document.body.clientWidth : window.innerWidth ? innerWidth : null;
}

function getClientHeight() {
return document.body && typeof document.body.clientHeight != 'undefined' ?
document.body.clientHeight : window.innerHeight ? innerHeight : null;
}

function centerIt(el_id, horiz_offset, max_width) {
	if (typeof horiz_offset == 'undefined') horiz_offset = 0;
	if (typeof vert_offset == 'undefined') vert_offset = 0;
	var el = getElement(el_id);
	var cW = getClientWidth();
	var cH = getClientHeight();
	if (el && el.style && cW && cH) {
		var el_lt = (cW - max_width) / 2 + horiz_offset;
		if (cW < max_width ) var el_lt = horiz_offset;
		el.style.left = String(el_lt + 'px');
	}
}

function checkWidth(bg_img, bg_img_1004){
	if (document.body && document.body.offsetWidth > 1) {
		docwidth = document.body.offsetWidth;
	}
	else {
		docwidth = self.innerWidth;
	}
	if(docwidth > 1014){
		document.getElementById('sizefix_neu').disabled = true;
		document.getElementById('top').style.backgroundImage = "url(" + bg_img_1004 + ")";
		var content_height = content_tmp1024;
		var centerit = 1004;
		var i = 0;
		var run = true;
		while(run){
		//alert('overview'+i);
		if(document.getElementById('overview'+ (i+1))) {
			i++;
			if((i % 3) == 0){
				document.getElementById('overview'+ i).style.marginRight = '0px';
			}
			else{
				document.getElementById('overview'+ (i)).style.marginRight = '56px';
			}
		}
		else
			run = false;
		}
		if(((i % 2) != 0) && i > 2){
			if(document.getElementById('overview'+i)) {
				document.getElementById('overview'+i).style.display = "";
			}
		}
	}
	else{
		document.getElementById('sizefix_neu').disabled = false;
		document.getElementById('top').style.backgroundImage = "url(" + bg_img + ")";
		var centerit = 778;
		var content_height = content_tmp;

		var i = 0;
		var run = true;
		while(run){
		//alert('overview'+i);
		if(document.getElementById('overview'+ (i+1))) {
			i++;
			if((i % 2) == 0){
				document.getElementById('overview'+ i).style.marginRight = '0px';
			}
			else{
				document.getElementById('overview'+ (i)).style.marginRight = '63px';
			}
		}
		else
			run = false;
		}

		if(((i % 2) != 0) && i > 2){
			if(document.getElementById('overview'+i)) {
				document.getElementById('overview'+i).style.display = "none";
			}
		}
	}
	setDivHeight(content_height, subnavi_height, custom_height);
	return centerit;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openpopup2(url) {//PopUp Druckvorschau
	window.open(url,'popup',	'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=620,height=600');
}

function printPage() {//Befehl zum Drucken
		if (window.print) {
	agree = confirm('Ein Klick auf OK genÄgt \nund die Seite wird ausgedruckt. \n\nBereit?');
		if (agree) window.print();
		}
}

function getContentHeight(){
	if(document.getElementById('content')) {
		var obj = document.getElementById('content');
	}
	else if(document.getElementById('content2')) {
		var obj = document.getElementById('content2');
	}
	else if(document.getElementById('content3')) {
		var obj = document.getElementById('content3');
	}
	else if(document.getElementById('content4')) {
		var obj = document.getElementById('content4');
	}
	else if(document.getElementById('content5')) {
		var obj = document.getElementById('content5');
	}
	else {
		var obj = false;
	}

	if(obj != false) {
		// Hoehe des Contents
		var height = obj.offsetHeight;
	}
	else
		var height = false;
	return height;
}

function getSubnaviHeight(){
	if(document.getElementById('subnavi')) {
		var obj = document.getElementById('subnavi');
		var height = obj.offsetHeight;
	}
	else
		var height = false;
	return height;
}

function getCustomHeight(){
	if(document.getElementById('custom')) {
		var obj = document.getElementById('custom');
		var height = obj.offsetHeight;
	}
	else{
		var height = false;
	}
	return height;
}


/*######################################################
	Anpassung der Hˆhe der beiden Spalten im Content
#######################################################*/
function setDivHeight(content_height, subnavi_height, custom_height) {
	//alert(content_height + '-->' + subnavi_height + '-->' + custom_height);
	var padding = 45;

	if(document.getElementById('content')) {
		var content = document.getElementById('content');
		var content_flag = 1;
	}
	else if(document.getElementById('content2')) {
		var content = document.getElementById('content2');
		var content_flag = 2;
	}
	else if(document.getElementById('content3')) {
		var content = document.getElementById('content3');
		var content_flag = 3;
	}
	else if(document.getElementById('content4')) {
		var content = document.getElementById('content4');
		var content_flag = 4;
	}
	else if(document.getElementById('content5')) {
		var content = document.getElementById('content5');
		var content_flag = 5;
	}
	else {
		var content = false;
	}

	if(content != false) {
		// Hoehe des Contents
		/*var content_height = height;
		alert(content_height);*/
		//var content_height = content.offsetHeight;

		/*/ Top -> hat HIER kein Einfluss auf die Hoehe
		if(document.getElementById('top')){
			var top = document.getElementById('top');
			var top_height = top.offsetHeight;
		}
		else { //*/
			var top_height = 0;
		//}

		// Navigation -> hat kein Einfluss auf die Hoehe
		/*if(document.getElementById('naviH')){
			var nav = document.getElementById('naviH');
			var nav_height = nav.offsetHeight;
		}
		else { //*/
			var nav_height = 0;
		//}

		// Mitlaufnavigation
		if(document.getElementById('breadcrumb')){
			var breadcrumb = document.getElementById('breadcrumb');
			var breadcrumb_height = breadcrumb.offsetHeight;
		}
		else { //*/
			var breadcrumb_height = 0;
		}

		// Linke Spalte
		if(document.getElementById('subnavi')) {
			var subnavi = document.getElementById('subnavi');
			//var subnavi_height = subnavi.offsetHeight;
		}
		else{
			//var subnavi_height = false;
		}



		// Linke Spalte auf der Startseite
		if(document.getElementById('lfs_home'))
		{
			var lfs_home = document.getElementById('lfs_home');
			var lfs_height = lfs_home.offsetHeight;
		}
		else
		{
			var lfs_height = false;
		}

		// Mittlere Spalte auf der Startseite
		if(document.getElementById('lfs_home_right'))
		{
			var lfs_home_right = document.getElementById('lfs_home_right');
			var lfs_height_right = lfs_home_right.offsetHeight;
		}
		else
		{
			var lfs_height_right = false;
		}


		if(lfs_height && lfs_height_right)
		{
			if(lfs_height_right < lfs_height)
			{
				var height = lfs_height;
			}
			else
			{
				var height = lfs_height_right;
			}
		}
		else
		{
			var height = content_height;
		}

		// Rechte Spalte
		if(document.getElementById('custom')) {
			var custom = document.getElementById('custom');
			//var custom_height = custom.offsetHeight;
		}
		else {
			//var custom_height = false;
		}

		// Vergleich Content - Subnavi
		if(subnavi_height){
			if(content_height < subnavi_height) {
				var height = subnavi_height;
			}
			else {
				var height = content_height;
			}
		}
		else {
			var height = content_height;
		}

		if(height < 350)
				var height = 350;

		// Wenn Rechte Spalte vorhanden
		if(custom_height){
			if(height < custom_height){
				height = custom_height;
			}
		}


		//alert('height: ' + height);

		if (document.all) { // IE
			if(subnavi_height) {
				document.all.subnavi.style.setAttribute("height", (height + top_height + nav_height + breadcrumb_height), "false");
			}
			if(lfs_height) {
				document.all.lfs_home.style.setAttribute("height", (height + top_height + nav_height + breadcrumb_height), "false");
			}
			if(lfs_height_right) {
				document.all.lfs_home_right.style.setAttribute("height", (height + top_height + nav_height + breadcrumb_height) - padding, "false");
			}

			if(custom_height){
				document.all.custom.style.setAttribute("height", (height), "false");
			}
			if(content_flag == 1)
					document.all.content.style.setAttribute("height", (height - padding), "false");
			else if(content_flag == 2)
					document.all.content2.style.setAttribute("height", (height - padding), "false");
			else if(content_flag == 3)
					document.all.content3.style.setAttribute("height", (height - padding), "false");
			else if(content_flag == 4)
					document.all.content4.style.setAttribute("height", (height - padding), "false");
			else if(content_flag == 5)
					document.all.content5.style.setAttribute("height", (height - padding), "false");
		}
		else { // gscheite Browser
			if(lfs_height)
			{
				lfs_home.style.height = (height+top_height+nav_height+breadcrumb_height)+"px";
				//alert('hoehe rechts gesetzt auf:  '+ height);
			}
			if(lfs_height_right)
			{
				lfs_home_right.style.height = (height - padding)+"px";
					//alert('hoehe mitte gesetzt auf:  '+ height);

			}
			if(subnavi_height){
				subnavi.style.height = (height+top_height+nav_height+breadcrumb_height)+"px";
			}
			if(custom_height){
				custom.style.height = (height)+"px";
			}

			content.style.height = (height-padding)+"px";
		}
	}
	return true;
}


function setTIHeight(id) {
	/* Element Text und Bild Hoehenanpassung*/
	var textID = "it_text" + id;
	var imgID = "it_image" + id;

	var img = document.getElementById(imgID);
	var img_height = img.offsetHeight;
	var text = document.getElementById(textID);
	var text_height = text.offsetHeight;

	if(text_height < img_height) {
		var new_text_height = img_height;
		text.style.height = new_text_height + "px";
	}
}

function setInfoHeight(id) {
	/* Element Text und Bild Hoehenanpassung */
	var padding = 6;
	var textID = "info_text" + id;
	var imgID = "info_image" + id;
	var dateID = "info_dates" + id;

	var text = document.getElementById(textID);
	var text_height = text.offsetHeight;
	if(document.getElementById(imgID)) {
		var img = document.getElementById(imgID);
		var img_height = img.offsetHeight;
	}
	else
		var img_height = 0;
	if(document.getElementById(dateID)) {
		var date = document.getElementById(dateID);
		var date_height = date.offsetHeight;
	}
	else
		var date_height = 0;

	var height = text_height;
	if(height < img_height)
		height = img_height;
	if(height < date_height)
		height < date_height;
	height = height - padding;

	text.style.height = height + "px";
	if(document.getElementById(imgID))
		img.style.height = (height+padding) + "px";
	if(document.getElementById(dateID))
		date.style.height = height + "px";
}


/* Infopool Datum */
var oneMinute = 60 * 1000;  // milliseconds in a minute
var oneHour = oneMinute * 60;
var oneDay = oneHour * 24;
var oneWeek = oneDay * 7;

var today = new Date();
var tag_heute=today.getDate();
var monat_heute=today.getMonth()+1;
var jahr_heute=today.getFullYear();

var feld_von=tag_heute + "." + monat_heute + "." + jahr_heute;
var feld_bis="";

function heute(){
	feld_bis=feld_von;
	setDates();
}

function zukunft(tage){
	var dateInMS = today.getTime() + oneDay * tage;
	var targetDate = new Date(dateInMS);

	var tag_zukunft=targetDate.getDate();
	var monat_zukunft=targetDate.getMonth()+1;
	var jahr_zukunft=targetDate.getFullYear();

	feld_bis=tag_zukunft + "." + monat_zukunft + "." + jahr_zukunft;
	setDates();
}

function setDates(){
	document.infopool_search.start_date.value=feld_von;
	document.infopool_search.end_date.value=feld_bis;
}


function showUploadDiv()
{
	document.getElementById('show_me').style.visibility = 'visible';
}

/*
function setAbstand() {
	if(document.getElementById('subnavi')){
		var subnavi = document.getElementById('subnavi');
		var subnavi_height = subnavi.offsetHeight;
		var liste = document.getElementById('liste');
		var liste_height = liste.offsetHeight;
		var height = subnavi_height - liste_height - 30;
		var abstand = document.getElementById('abstand');
		if(document.all){
			document.all.abstand.style.setAttribute("height", height, "false");
		}
		else{
			abstand.style.height = height + "px";
		}
	}
}*/

/*/ Schickt ein Formular ueber js ab
function sendToPHP(todo, sys_pk, http) {

  if(todo == 'add') {
    document.formular.action = http+'content_scripts/add.php';
    document.formular.image_id.value = sys_pk;
    document.formular.method = 'post';
    document.formular.encoding = 'multipart/form-data';
    document.formular.submit();
  }
  else if(todo == 'del') {
    document.formular.action = http+'content_scripts/del.php';
    document.formular.image_id.value = sys_pk;
    document.formular.method = 'post';
    document.formular.encoding = 'multipart/form-data';
    document.formular.submit();
  }
  else if(todo == 'activate') {
    document.formular3.action = http+'content_scripts/change_cart.php';
    document.formular3.merkzettel_id.value = sys_pk;
    document.formular3.method = 'post';
    document.formular3.encoding = 'multipart/form-data';
    document.formular3.submit();
  }
  else if(todo == 'remove') {
    document.formular3.action = http+'content_scripts/remove_cart.php';
    document.formular3.merkzettel_id.value = sys_pk;
    document.formular3.method = 'post';
    document.formular3.encoding = 'multipart/form-data';
    document.formular3.submit();
  }
  else if(todo == 'rename') {
    document.formular3.action = http+'content_scripts/rename_cart.php';
    document.formular3.merkzettel_id.value = sys_pk;
    document.formular3.method = 'post';
    document.formular3.encoding = 'multipart/form-data';
    document.formular3.submit();
  }
  else if(todo == 'new') {
    document.formular2.action = http+'content_scripts/new_cart.php';
    document.formular2.method = 'post';
    document.formular2.encoding = 'multipart/form-data';
    document.formular2.submit();
  }
  else
    return false;

  return true;
}*/

function chooseAsset($url) {
  window.location.href = $url;
}

/*  Die setLayerPosition und SetLayer2Postion berechnet die Positionen der
* 	horizontalen Aufklapp-Navi
*/

// Erste Ebene
 function setLayerPosition(e, id, layer1_width)
 {




	 layer1_width = parseInt(layer1_width);
	 var ie_offset;
	 var page;
	 var pageWidth;
	 var stop = false;


	 if(document.getElementById && document.getElementById(id))
	 {
		 // Offset geben
		 var offset = 20;
		 var Ex = e.pageX;

		 if(document.all) //INTERNET EXPLORER
		 {
			 // Beim IE wird noch der linke Abstand hinzugerechnet
			 if (document.body && document.body.offsetWidth > 1)
			 {
				 pageWidth = document.body.offsetWidth;
			 }
			 else
			 {
				 pageWidth = self.innerWidth;
			 }
 			 //pageWidth = 780;
			 // Berechnung des rechten Offsets, den der IE braucht
			 // Bei "groﬂer" Seite

			 if(pageWidth > 1014)
			 {
				 ie_offset = (pageWidth - 1004) / 2;
				 page = 1004;
			 }
			 // bei "kleiner" Seite
			 else
			 {
				 ie_offset = (pageWidth - 780) / 2;
				 page = 780;
			 }

			 // Ex = Mouseposition
			 var Ex = window.event.x;
			 var eigenschaft = "left";

			 /* Ab hier startet die Funktionalit‰t, die fr¸her centerIt genannt wurde*/
			 if((Ex + layer1_width + ie_offset) >= (page + ie_offset))
			 {
				 stop = true;
//				 document.getElementById(id).style[eigenschaft] = (ie_offset + page - layer1_width)  + "px";
			 	 document.getElementById(id).style[eigenschaft] = document.getElementById('center').offsetLeft + layer1_width;
//			 	 document.getElementById(id).style[eigenschaft] = layer1_width;
			 }
			 if(!stop)
			 {
//			 	 document.getElementById(id).style[eigenschaft] = document.getElementById('center').offsetLeft + layer1_width;
//			 	 document.getElementById(id).style[eigenschaft] = layer1_width;
				 document.getElementById(id).style[eigenschaft] = (Ex - offset + ie_offset) + "px";
			 }
		 }
		 else // Andere Browser
		 {
			 // Linker Abstand berechnen
			 if (document.body && document.body.offsetWidth > 1)
			 {
				 pageWidth = document.body.offsetWidth;
			 }
			 else
			 {
				 pageWidth = self.innerWidth;
			 }

 			 //pageWidth = 1014;

			 // Berechnung des linken Offsets
			 var left_offset;
			 var page;

			 // Bei "groﬂer" Seite
			 if(pageWidth > 1014)
			 {
				 left_offset = parseInt((pageWidth - 1004) / 2);
				 page = 1004;
			 }
			 // bei "kleiner" Seite
			 else
			 {
				 left_offset = parseInt((pageWidth - 780) / 2);
				 page = 780;
			 }

//		 alert('pageWidth: ' + pageWidth + "\n" + 'left_offset: ' + left_offset + "\n" + 'page: ' + page + "\nEx: " + Ex);

			 /* If-Bedingung: Rand errreicht, stop*/
			 if((Ex + layer1_width) >= (page + left_offset))
			 {
				 stop = true;
//				 document.getElementById(id).style["left"] = (page + left_offset - layer1_width - 1) + "px";
				// document.getElementById(id).style["left"] = (layer1_width) + "px";
//			 	 document.getElementById(id).style[eigenschaft] = document.getElementById('center').offsetLeft + layer1_width;
			 	 document.getElementById(id).style["left"] = document.getElementById('center').offsetLeft + layer1_width + "px";
//			 	 document.getElementById(id).style["left"] = layer1_width + "px";
				 //alert('stop erreicht an stelle: ');
			 }
			 else
			 {
//			 	 alert(document.getElementById('center').offsetLeft);
//				 document.getElementById(id).style["left"] = (Ex - offset) + "px";
//				 document.getElementById(id).style["left"] = (layer1_width) + "px";
			 	 document.getElementById(id).style["left"] = document.getElementById('center').offsetLeft + layer1_width + "px";
//			 	 document.getElementById(id).style["left"] = layer1_width + "px";
			 }
		 }
	}
}

/*/zweite Ebene
function setLayer2Position(e, id_layer1, id_layer2, layer1_width, layer2_width)
{
		 var Ey = e.pageY;
		 var stop = false;
		 var layer1_width = parseInt(layer1_width);
		 var layer2_width = parseInt(layer2_width);
		 if(document.all) //IE
		 {
			 Ey = window.event.y;
			 var eigenschaft = "left";
			 var layer1_left = document.getElementById(id_layer1).style[eigenschaft];
			 layer1_left = layer1_left.replace("px", "");
			 layer1_left = parseInt(layer1_left);

			 // Wenn die Unterebene ¸ber den Rand raus geht, soll sie nach links ausklappen
			 if (document.body && document.body.offsetWidth > 1)
			 {
				 pageWidth = document.body.offsetWidth;
			 }
			 else
			 {
				 pageWidth = self.innerWidth;
			 }
			 pageWidth = 780;
			 // Berechnung des rechten Offsets, den der IE braucht
			 // Bei "groﬂer" Seite

			 if(pageWidth > 1014)
			 {
				 ie_offset = (pageWidth - 1004) / 2;
				 page = 1004;
			 }
			 // bei "kleiner" Seite
			 else
			 {
				 ie_offset = (pageWidth - 780) / 2;
				 page = 780;
			 }
			 if((layer1_width + layer1_left + layer2_width) >= (page + ie_offset))
			 {
				 stop = true;
				 document.getElementById(id_layer2).style[eigenschaft] = (layer1_left - layer2_width)  + "px";
			 }
			 else
			 {
				 document.getElementById(id_layer2).style[eigenschaft] = (layer1_left + layer1_width - 1) + "px";
			 }
		 }
		 else
		 {
			 var layer1_left = document.getElementById(id_layer1).style["left"];
			 layer1_left = layer1_left.replace("px", "");
			 layer1_left = parseInt(layer1_left);

			 // Wenn die Unterebene ¸ber den Rand raus geht, soll sie nach links ausklappen
			 if (document.body && document.body.offsetWidth > 1)
			 {
				 pageWidth = document.body.offsetWidth;
			 }
			 else
			 {
				 pageWidth = self.innerWidth;
			 }
			 pageWidth = 780;
			 // Bei "groﬂer" Seite
			 if(pageWidth > 1014)
			 {
				 ie_offset = (pageWidth - 1004) / 2;
				 page = 1004;
			 }
			 // bei "kleiner" Seite
			 else
			 {
				 ie_offset = (pageWidth - 780) / 2;
				 page = 780;
			 }
			 if((layer1_width + layer1_left + layer2_width) >= (page + ie_offset))
			 {
				 stop = true;
				 document.getElementById(id_layer2).style["left"] = (layer1_left - layer2_width) + "px";
				 //document.getElementById(id_layer2).style["top"] = (Ey) + "px";
					//alert ("summe1 (layer1_width + layer1_left + layer2_width): " + (layer1_width + layer1_left + layer2_width) + "\n" + "page: " +page);
			 }
			 else
			 {
				 document.getElementById(id_layer2).style["left"] = (layer1_left + layer1_width - 1) + "px";
				 //document.getElementById(id_layer2).style["top"] = (Ey) + "px";

			 }
			 //alert((layer1_left + offset + layer1_width) + "px");
		 }
}
*/

function checkForIE() {
	var BrowserName = navigator.appName;
	var BrowserVersion = navigator.appVersion;
	var BVersion = parseFloat (BrowserVersion);
	if (BrowserName == "Microsoft Internet Explorer")
	{
		// version auslesen
		var pos1 = BrowserVersion.indexOf(";")+1;
		var part1 = BrowserVersion.substring(pos1);
		var pos2 = part1.indexOf("E");
		var pos3 = part1.indexOf(";");
		//
		var part2 = part1.substring(0,pos3);
		// es is ne 5 drin
		var pos4 = part2.indexOf("5");
		if (pos4 >= 0) {
			var part3 = part2.substr(pos4);
			var versionAlternativ = parseFloat(part3);
			// version zu klein
			if (versionAlternativ < 5.5) {
				window.location = "version_error.html";
			}
		}
	}
}

function ip_expander(id)
{
  var expander = document.getElementById('ip_expander_'+id);
  var teaser = document.getElementById('ip_teaser_'+id);

  closeDenRest(id);

  if (expander.style.display!='block')
  {
//  	document.all.expander.style.setAttribute('display', 'block', 'false');
//  	document.all.teaser.style.setAttribute('display', 'none', 'false');


    expander.style.display = 'block';
    teaser.style.display = 'none';
  }
  else
  {
    expander.style.display = 'none';
    teaser.style.display = 'block';
  }
}

/**
  *
  */
function closeDenRest(the_one)
{
  var all_details = document.getElementById('all_details').value;
  if (all_details)
  {

     var arr_details = all_details.split(',');

     for (i=0 ; my_id = arr_details[i] ; i++)
     {

       var my_expander = document.getElementById('ip_expander_'+my_id);
       var my_teaser = document.getElementById('ip_teaser_'+my_id);
       if (my_teaser && my_expander && my_id!=the_one)
       {
				 my_expander.style.display = 'none';
				 my_teaser.style.display = 'block';
       }
     }

  }
}


/**
  *
  */
function cm_expander(id)
{
  var expander = document.getElementById('cm_expander_'+id);
  var teaser = document.getElementById('cm_expander_teaser_'+id);

//  cmCloseDenRest(id);

  if (expander.style.display!='block')
  {
//  	document.all.expander.style.setAttribute('display', 'block', 'false');
//  	document.all.teaser.style.setAttribute('display', 'none', 'false');
    expander.style.display = 'block';
    teaser.style.display = 'none';
  }
  else
  {
    expander.style.display = 'none';
    teaser.style.display = 'block';
  }
}

/**
  *
  */
function flashobj(flashId)
{
  if (navigator.appName.indexOf("ie6") !=-1)
  {
    return window[flashId]
  }
  else
  {
    return document[flashId]
  }
}

/**
  *
  */
function setFlashVar(flashId, flash_variable, flash_value)
{

  if (!flashobj(flashId))
    return false;

		// Gew¸nschte Variable und Wert an Flash ¸bergeben
	flashobj(flashId).SetVariable(flash_variable, flash_value);
}



// element ein / ausblenden
 function anzeigen(das)
 {
 	if(document.getElementById(das).style.display=='none')
		 document.getElementById(das).style.display='block';
	else
		 document.getElementById(das).style.display='none';
}
 
 
 
 
 
/*egrid3*/
 /* JQ-Stuff */
 $(document).ready(function()
 {
 	// When the document is ready set up our sortable with it's inherant function(s)
	 
	if (typeof $("#liste_generets").sortable == 'function')
	{
		$("#liste_generets").sortable({
			handle : '.handle',
			update : function () {
				var order = $('#liste_generets').sortable('serialize');
				$("#sort_list").val(order);
			} 
		});
	}

 	// wenn ein loschbutton geklickt wurde hidden field fuer request mit der id einfugen
   $('.delete').click(function() {
     var list_id = $(this).parent().attr('id');
     list_id = list_id.replace('listItem_','');
    	var t = $("#form_liste_generets").append('<input type="hidden" name="delete_item" value="'+list_id+'" />')
     t.val(list_id);
     if (confirm("Eintrag wirklich entfernen?"))
      	$("#form_liste_generets").submit();
   });

   // tooltips zuweisen
   if (typeof $('.tooltip').tooltip == 'function')
   {
	   $('.tooltip').tooltip({showURL: false});
   }

   // checkboxmassenselect in legende integrieren
   $('.legende .cbs').click(function(){
// 	  if (confirm('Gesamte Spalte (de)selektieren?'))
 	  {
 	  	// passende boxen ziehen
 	  	var myclass = $(this).attr('class');
 	  	myclass = myclass.replace('row cbs ','');
 	  	var cb_gruppe = $('.'+myclass+' input.checkbox');
 			var flag = cb_gruppe.attr('checked');
 	  	cb_gruppe.each(function(){ 
  		  	$(this).attr('checked',!flag);
 	  	});
 	  } 
   });

   // zeilenweises massenselekt
   $('.cbsr').click(function(){
// 	  if (confirm('Gesamte Zeile (de)selektieren?'))
 	  {
 	  	// passende boxen ziehen
 	    var list_id = $(this).parent().attr('id');
 			var cb_gruppe = $('#'+list_id+' input.checkbox');
 			var flag = cb_gruppe.attr('checked');
 	  	cb_gruppe.each(function(){
  		  	$(this).attr('checked',!flag);
 	  	});
 	  }
   });

   // selectboxen bei change die zeile verf�rben lassen
   $('select').change(function(){
     $(this).parent().parent().animate({ backgroundColor:"#eed" },1500);
   });

 	// nach neuladen kurz infofeld anzeigen und dann ausfaden lassen
// 	$('#info').animate({opacity: 0},3000);
 });

