// Hier kommen alle JavaScript Funktionen rein, die nicht mit php bearbeitet werden...
// Andernfalls sind sie sichtbar auf der Seite...
// alert("bin da jsript.js")

var wload;
var is_ie;
var is_gecko; 
var is_mac_moz;
var browser;
// Emailver.
var mchar 				= "@"; 
var mstr				="mailto"
var aktueldialog;
var myMouseDownOnGriff;// = null
var LayerPosObj 		= {"side_service":0, "side_serviceHOut":-272, "top_service":0, "top_serviceVOut":-123, "FloatingEditorLayer":0, "FloatingEditorLayerHOut":-420};
var dragobj 			= null; 
var refobj 				= null; 
var FloatingEditorXpos 	= null
var FloatingEditorYpos 	= null
var ServiceXpos 	   	= null
var	ServiceYpos 	   	= null
var clickPageTarget;
var moveableEditLayer 	= 0 // Editlayer nicht dragable
var editorObj = {}
var editorObjTextareaName
var aktueldialogEditor
var tim = 0
var getCSSStyleCascade_val;
var F2;

checkbrowser(); // soll immer passieren
window.onmousedown 	 = dialogcheck;				// Fuer Mozilla: Sorgt dafuer, dass kleine fenster vorne bleiben
document.onmousedown = startdragIt
document.onmousemove = dragIt 
document.onmouseup   = stopdragIt



function setReiterGroup(whichid,action) { 
// alert("setReiterGroup " + whichid);
	if (document.getElementById("r0")) {
		for (i=0;i<rgroup.length;i++) {
			r = rgroup[i];
			if (whichid == r) {
				// aktivieren
				document.getElementById(r).style.zIndex = 20
				document.getElementById("lichtkante_"+r).bgColor="#FFFFFF"
				document.getElementById("seitel_"+r).src = ir_aktiv_l.src // "images/r_aktiv_l.gif"
				document.getElementById("seiter_"+r).src = ir_aktiv_r.src //"images/r_aktiv_r.gif"
				document.getElementById("flaeche_"+r).bgColor="#EEEEEE"
				//if (document.all) document.getElementById("bereich_"+r).style.display = "inline"
				//else document.getElementById("bereich_"+r).style.display = "table-row"
			} else {
				// deaktivieren
				//alert("seitel_"+r)
				document.getElementById("seitel_"+r).src = ir_iaktiv_l.src // "images/r_iaktiv_l.gif"
				document.getElementById("seiter_"+r).src = ir_iaktiv_r.src // "images/r_iaktiv_r.gif"
				document.getElementById(r).style.zIndex = 0
				document.getElementById("flaeche_"+r).bgColor="#BBBBBB"
				document.getElementById("lichtkante_"+r).bgColor="#CCCCCC"
				//document.getElementById("bereich_"+r).style.display = "none"
			}
		} // end for
		if (action != "noaction") {
			if (whichid=="r1") window.setTimeout("pagePreview('preview')",10);
			if (whichid=="r2") window.setTimeout("pagePreview('design')",10);
		}
	}
}





// Fenstergroesse erfassen
function getStartWindowSize() {
	if (is_ie) fensterhoehe_start = document.body.clientHeight + 29 // Fenster mit Titelleiste
	else 	   fensterhoehe_start = window.outerHeight
	if (is_ie) fensterbreite = document.body.clientWidth + 8 		// fuer Border
	else 	   fensterbreite = window.outerWidth
	//alert("fensterhoehe_start " + fensterhoehe_start)
}

function goClickPageTarget() {
	document.location.href = clickPageTarget;
}
function cancelBubbling(evt) {
	if (is_ie) 		window.event.cancelBubble=1; 
	if ((is_gecko) && (!is_safari)) evt.stopPropagation();
}

function resizeWindow(width,height) {
	// Diese function macht nur bei fester Fenstergoeese Sinn.
	// Sie vergoessert den Fensterbereich fuer en editmodus, z. B. bei der Microsite
	if (is_ie)  window.resizeTo(width,height);
	else 	    window.outerHeight = height
}

function showElement(elname,height,mozdiff) { 
		// macht ein Element sichtbar und vergoessert das Fenster
		// height = heoehe des fensters ie
		mozdiff = 90;
		if (!document.getElementById(elname)) return;
		klappbereich = document.getElementById(elname)
		if (is_ie) fensterbreite = document.body.clientWidth + 8 // fuer Border
		else 	   fensterbreite = window.outerWidth
		//alert(fensterbreite)
		if (klappbereich.style.display == "none")  {
			if (is_ie)	klappbereich.style.display = "inline";
			else 		klappbereich.style.display = "inline";
			document.getElementById("img_"+elname).src = "../images/icon_klapppfeildown.gif";
			if (is_ie) window.resizeTo(fensterbreite,height);
			else 	   window.outerHeight = height + mozdiff;
		} else {
			klappbereich.style.display = "none";
			document.getElementById("img_"+elname).src = "../images/icon_klapppfeilup.gif";
			if (is_ie) 	window.resizeTo(fensterbreite,fensterhoehe_start);
			else 		window.outerHeight = fensterhoehe_start;
		}
	}



function setEditLayerHeigth() {
	//alert("setEditLayerHeigth")
	editLayerHeigth = document.getElementById("maintable").offsetHeight;
	document.getElementById("img_dist_top_service").style.height 		= editLayerHeigth;			// Abstandhalter anpassen
	if (is_ie) document.getElementById("editlayer_dummy").style.height	 = editLayerHeigth; 		// iframe anpassen
	if (document.edit.switch_service.value == "top_service") 	document.edit.editlayerheighttop.value 		= editLayerHeigth;
	else 														document.edit.editlayerheightside.value  	= editLayerHeigth;
	/*
	alert(	"editlayerheighttop " + document.edit.editlayerheighttop.value + "\n" + 
			"editlayerheightside "+ document.edit.editlayerheightside.value + "\n")
			*/
			
}






function getScrollTop() {
	if (!is_ie) myScrollTop = window.scrollY
	if (is_ie) myScrollTop  = document.body.scrollTop
	//alert(myScrollTop)
	return myScrollTop
}

function checkforOpenWindows(){
if ((wload) && (!wload.closed)) {
	wload.focus();
	}
}
 
// Editmode starten
function initEditmode() {
// alert("initEditmode")
	//setReiterGroup('r2','noaction')	// edit aktiveren
	// alert("document.edit.show_all_fields.value " + document.edit.show_all_fields.value)
	if (document.edit.show_all_fields.value==1) activate_all_fields(1); 				// set = 1 -> schaltet alle Felder an
	// if ((document.edit.ecargopos.value !="") || (document.edit.servicepos.value !="")) readPositions();
	// MICROSITES
	//if ((is_editmode) && (Windowtype=="microsite")) resizeWindow(798,800); // vergoessern des Fensters
	// addEditmodePadding()
}

function addEditmodePadding() {
 	//return;
 	// Zuruecksetzen der editierbaren Felder
	elArr 	= document.getElementsByTagName("div")
	elArrlength 	= elArr.length
	for(i=0;i<elArrlength;i++) {
		el 			= elArr[i];
		pL = parseInt(el.style.paddingLeft)
		if(!pL) pL = 0
		// alert(pL)
		el.style.paddingLeft = (pL + 10) + "px"	
	}
}



function readPositions() {
	// diese Werte muss man der aktuellen Groesse des Floatingeditors anpassen
	FloatingEditorLayerWidth  	= 434
	FloatingEditorLayerHeight 	= 106
	xyArr = document.edit.ecargopos.value.split("x")
	// alert("readPositions " + document.edit.ecargopos.value)
	FloatingEditorXpos 			= xyArr[0]
	FloatingEditorYpos 			= xyArr[1]
	// alert("document.edit.ecargopos.value " + document.edit.ecargopos.value +" FloatingEditorXpos " + FloatingEditorXpos +"\n" + " FloatingEditorYpos " + FloatingEditorYpos)
	if (document.edit.ecargosize.value) {
		xyArr = document.edit.ecargosize.value.split("x")
		FloatingEditorLayerWidth 			= xyArr[0]
		FloatingEditorLayerHeight 			= xyArr[1]
	}
	// Position kontrollieren, darf nicht den sichtbaren Bereich verlassen
	if(is_ie) {
			bodyHeight = document.clientHeight
			bodyWidth = document.clientWidth
		} else {
			bodyWidth  = window.innerWidth
			bodyHeight = window.innerHeight
		}
	
	/*
	alert(	"bodyHeight " 					+ bodyHeight + "\n" + 
			"bodyWidth " 					+ bodyWidth + "\n" + 
			"FloatingEditorYpos " 			+ FloatingEditorYpos + "\n" + 
			"FloatingEditorLayerHeight "	+ FloatingEditorLayerHeight + "\n" + 
			"FloatingEditorLayerWidth "		+ FloatingEditorLayerWidth)
			*/
	if (FloatingEditorXpos > (bodyWidth  - FloatingEditorLayerWidth))  FloatingEditorXpos = bodyWidth  - FloatingEditorLayerWidth
	if (FloatingEditorYpos > (bodyHeight - FloatingEditorLayerHeight)) FloatingEditorYpos = bodyHeight - FloatingEditorLayerHeight
}


function writePositions() {
 	// alert("ServciePos: "+ServiceXpos + "x" + ServiceYpos)
	thispos = parseInt(FloatingEditorXpos) + "x" + parseInt(FloatingEditorYpos)
 	document.edit.ecargopos.value  = thispos
	if (window.save_editor_position) save_editor_position(thispos);
	// FloatingEditorXpos + "x" + FloatingEditorYpos
	// checken: erst speichern, wenn eine relevante Verschiebung stattgefunden hat.
	// if ((ServiceYpos > 10) && ((ServiceYpos > 10) || (ServiceYpos < -10)))	document.edit.servicepos.value = ServiceXpos + "x" + ServiceYpos
	// else 																	document.edit.servicepos.value = "_x_"
}





 
 
 
// Preview und Editmode FUnktionen
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 function pagePreview(mode) {
	// alert("pagePreview " + mode); 
	if(mode=="preview") {
		hide_Vmarker(0)			//senkrechte Striche weg
		deactivate_all_fields()
		switch_icm_visiblity("none","preview")
	} else {
		hide_Vmarker(1)			//senkrechte Striche
		// editiermodus weider herstellen, wie ervor previewmode "preview" war
		//switch_icm_visiblity(document.edit.icm_visiblity.value) 	// alte Werte einlesen 
		//activate_all_fields(document.edit.show_all_fields.value)	// alte Werte einlesen 
		
		switch_icm_visiblity("inline") 	// alte Werte einlesen 
		activate_all_fields(document.edit.show_all_fields.value)	// alte Werte einlesen 
	}
}
 
function switch_icm_visiblity(mode,previewmode) {
// alle <div>, die eine id mit haben, weren ausgeblendet				z. B. -> "div id=icm_delete....
	allDivsArr = document.getElementsByTagName("div")
 	allDivsArrLength = allDivsArr.length
	for(i=0;i<allDivsArrLength;i++) {
		myDiv = allDivsArr[i];
		//report("myDiv: "+ myDiv.id + " " + hasClassName(myDiv,"icm_")+"<br>")
		
		// Erweitert: icm_ || icmp_ : Manche Elemente sollen in der Preview verschwinden, aber zum Bearbeiten sichtbarsein, wenn die Icons ausgeblndet sein
		if (     ((myDiv.id.indexOf("icm_") != -1 || hasClassName(myDiv,"icm_"))) || (previewmode && myDiv.id.indexOf("icmp_") != -1)           ) { // nur ids mit "icm" erwischen
			if (allDivsArr[i].style.display == "none") 		myVis = "inline" // sichtbar oder nicht, um zu togglen
			else  											myVis = "none"
			// if(myDiv.id=='testgurke') alert( myVis)
			// wenn einParameter uebergeben wurde, dann diesen nehmen
			if (mode) myVis = mode
			myDiv.style.display = myVis
		}
 	}
	// status speichern
	// alert("switch_icm_visiblity previewmode " + previewmode)
	document.edit.icm_visiblity.value = myVis;
	//if (previewmode != "preview") 	document.edit.icm_visiblity.value = "inline"
	//else 							document.edit.icm_visiblity.value = "none"
	// alert("previewmode " + previewmode + " document.edit.icm_visiblity.value " + document.edit.icm_visiblity.value);
	//bis 11.10.06) if (previewmode!="preview") document.edit.icm_visiblity.value = myVis
	//alert("icm_visiblity " + document.edit.icm_visiblity.value)
 }
 

 
function activate_all_fields(set,previewmode) {
	// alert(document.edit.show_all_fields.value)
 	// toggeln zwischen show_all_fields und normalmodus
	// set: um den automatismus zu entgehen, der immer den Umkehrzustand activiert kann man uach direkt setzten
	newstate = 0
	aktuelstate = document.edit.show_all_fields.value
	if (aktuelstate==0) newstate = 1; 		// switchmode; wenn 1 -> aus 0, wenn 0 -> an
	if (set) 			newstate = set 		// ueberschreiben mit set
	
	// alert("set " + set + "  newstate " + newstate) 
	// alle an, wenn 0 oder set
	if (newstate == 1) {
		if (previewmode!="preview") document.edit.show_all_fields.value = 1
		allSpansArr 	= document.getElementsByTagName("div")
		allSpanslength = allSpansArr.length
		// testen: Ist das an aoder aus?
		// alert("allSpanslength " + allSpanslength)
		for(i=0;i<allSpanslength;i++) {
			myspan_id = allSpansArr[i].id;
			if (myspan_id.indexOf("elife_") != -1) {
				myspan_feldname = myspan_id.substr(6,100) // name ohne elife
				switchEditMode(myspan_feldname,"all")
			} // end if
		} // end for
		return;
	}
	// alle aus
	if (newstate == 0) {
		deactivate_all_fields() // alle ausschalten
		if (previewmode!="preview")  document.edit.show_all_fields.value = 0
		// switch_icm_visiblity("block")
	}
	//alert("am Ende: " + document.edit.show_all_fields.value)
}
 
 
 
 
function scfover(el) {
	return
	//fieldActivate(el)
}
function scfout(el) {
	//fieldDeActivate(el)
}
function fieldActivate(el) {
/* // Borderloesung, geht nicht wg. IE5,6
	el.style.borderTopColor 	= "#BBBBBB"
	el.style.borderRightColor 	= "#FFFFFF"
	el.style.borderBottomColor 	= "#FFFFFF"
	*/
	// Padding + BorderLoesung
	/*alert("padding " + el.style.padding + "\n" + 
	" border " + el.style.border + "\n" + 
	" classname " + el.style.className
	)*/
	// Hier werden die Styles des hidden fields (textarea, input) gesetzt
	el.style.paddingLeft  		= 0
	el.style.paddingTop   		= 0
	el.style.paddingRight 		= 0
	el.style.paddingBottom		= 0
	el.style.border				= "1px solid";
	el.style.borderColor		= "#BBBBBB #FFFFFF #FFFFFF #BBBBBB";
}
function fieldDeActivate(el) {
return;
	// Padding + BorderLoesung
	el.style.paddingTop    		= "1px"
	el.style.paddingRight  		= "1px"
	el.style.paddingBottom 		= "1px"
	// el.style.border				= 0;
	el.style.borderLeft			= "1px solid #BBBBBB";
	/* // Borderloesung, geht nicht wg. IE5,6
	if(el.style.borderLeftColor == "#BBBBBB") {
		el.style.borderTopColor 	= "transparent"
		el.style.borderRightColor 	= "transparent"
		el.style.borderBottomColor 	= "transparent"
	}
	*/
	
}



function switchEditMode(fieldname,mode) {
	//alert(fieldname)
	el				= document.getElementById("elife_"+fieldname) 	// Das element, in das der Text ausgegeben wurde
 	field			= document.getElementById(fieldname)			// Das feld, das den Text zum editieren aufnimmt -> editierbar
	life_field 		= document.getElementById("life_"+fieldname) 	// Das zuerst sichtbare Element
	infospan 		= document.getElementById("infospan_"+fieldname) // ein unsichtbares span, das Zusatzinformationen enthaelt
	infotext 		= infospan.innerHTML
	if (mode != "all") {
		// Alle anderen zuruecksetzten, nur dieses eine aktivieren
		if (el.style.display == "none") { 							// Dieses Element ist momentan editierbar 
		 	deactivate_all_fields() 								// alle ausschalten
		} 
		if (!editorObj[field.id]) { 								// alert("field.id "+ field.id);
			if (document.edit.editorTextareabyUser) document.edit.editorTextareabyUser.value = ''; 
		}
	}
	field.name = field.id 											// ab hier wird das Feld speicherbar !! +++ Achtung!	
	
	
	// S T Y L E S   V O M   L I F E   F E L D 
	// hier werden die aktuellen Styles berechnet und der Textarea zugewiesen
	if(!is_ie) {
		// Soll immer von Life ubernommen werden:
		field.style.fontFamily 			= getCSSStyle(life_field,"font-family")
		field.style.fontWeight 			= getCSSStyle(life_field,"font-weight")
		field.style.fontSize 			= getCSSStyle(life_field,"font-size")
		field.style.lineHeight  		= getCSSStyle(life_field,"line-height")
		// Soll nur von Life uebernommen werden, wenn nicht explizit als style definiert
		if(!field.style.color)			field.style.color 				= getCSSStyle(life_field,"color")
	} else {
		//alert(life_field.nodeName)
		field.style.fontSize 			= getCSSStyle(life_field,"fontSize")
		field.style.fontFamily 			= getCSSStyle(life_field,"fontFamily")
		field.style.fontWeight 			= getCSSStyle(life_field,"fontWeight")
		field.style.color 				= getCSSStyle(life_field,"color")
	/*
		// Soll immer von Life ubernommen werden:
		field.style.fontFamily 			= getCSSStyle(life_field,"fontFamily")
		field.style.fontWeight 			= getCSSStyle(life_field,"fontWeight")
		field.style.fontSize 			= getCSSStyle(life_field,"fontSize")
		field.style.lineHeight  		= getCSSStyle(life_field,"lineHeight")
		// Soll nur von Life uebernommen werden, wenn nicht explizit als style definiert
		if(!field.style.color)			field.style.color 				= getCSSStyle(life_field,"color")
		*/
		//getCSSStyleCascade_val= ""; getCSSStyleCascade(field,"fontFamily",1); 	field.style.fontFamily 	= getCSSStyleCascade_val;
		//alert(getCSSStyleCascade_val);
		//getCSSStyleCascade_val= ""; getCSSStyleCascade(field,"fontWeight",1); 	field.style.fontWeight 	= getCSSStyleCascade_val;
		//getCSSStyleCascade_val= ""; getCSSStyleCascade(field,"fontSize",1); 	field.style.fontSize 	= getCSSStyleCascade_val;
		//alert(getCSSStyleCascade_val);
		//getCSSStyleCascade_val= ""; getCSSStyleCascade(field,"lineHeight",1); 	field.style.lineHeight 	= getCSSStyleCascade_val;
		//alert(getCSSStyleCascade_val);
		// getCSSStyleCascade_val= ""; getCSSStyleCascade(field,"color",1); 		field.style.color 		= getCSSStyleCascade_val
	}
	/*
	alert(	"fontSize " 	+ field.style.fontSize + "\n" + 
			"lineHeight " 	+ field.style.lineHeight + "\n" + 
			"fontFamily " 	+ field.style.fontFamily + "\n" + 
			"fontWeight " 	+ field.style.fontWeight + "\n" + 
			"color " 		+ field.style.color)
	*/
	//alert(field.style.lineHeight)
	/*
	// alert(field.style.border)
	// Border Loesung, scheitert an IE 5-6
	if (!field.style.border)			{
		field.style.border 				= field.style.border 	= "1px solid" 
		field.style.borderLeftColor 	= "#BBBBBB"		 // evlt mit fieldActivate abgleichen
		// field.style.display 	= "block";
		fieldActivate(field,"click");
	} 
	*/
	fieldActivate(field,"click");
	
	// A U S N A H M E   H I N T E R G U N D F A R B E
	//alert("field.style.backgroundColor " + field.style.backgroundColor)
	if (!field.style.backgroundColor) 	field.style.backgroundColor = "#F8F8F8"; // nur ueberschreiben, wenn leer
	//alert(getCSSStyle(life_field,"color"));
	//alert(getCSSStyle(life_field,"fontSize"));
	/*
	alert(	"padding " + field.style.padding + "\n" + 
			"margin "  + field.style.margin  + "\n" + 
			"border "  + field.style.border + "\n" + 
			"fontSize "  + field.style.fontSize + "\n" + 
			"lineHeight "  + field.style.lineHeight 
	)
	*/
	
	
	
	
	
	
	
	
	// F E L D G R O S S E N 
	// W I D T H
	// wenn keine style.width und keine cols... -> life_field width
	//alert("field.style.width: "+ field.style.width + " cols: "+ field.cols +" rows: "+ field.rows)
	// 33er Trick -> das ist ein Dummy wert, der fuer nicht definiert steht
	lifeWidth = life_field.style.width;
	if ((field.style.width == "") && ((field.cols==33) || (field.size==33)))	 {
		// lifeWidth = life_field.style.width;
		// alert("lifeWidth " + lifeWidth);
		// "l":linke Position: Hier muss vermeidenwerden, daß die textaera/das inputfield 100% nehmen und das Icon nicht mehr passt
		if ((infotext.indexOf("l") != -1) && (lifeWidth=="100%"))  lifeWidth = "80%"; // das ist eine Annäherung, es muss so viel Platz geschaffen werden, daß das Icon Passt
		field.style.width = lifeWidth
	}
	// alert("lifeWidth " + lifeWidth);
	// field.style.width = life_field.offsetWidth;
	
	
	
	// H E I G H T
	lifeHeight = "";
	if ((field.style.height == "") && (field.rows==33)) { 
		lifeHeight = life_field.offsetHeight + "" // in string umwandeln // die aktuelle Hoehe
		
		if (lifeHeight.indexOf("%") != -1) 		{
			lifeHeight = parseInt(lifeHeight) + "%" 	// Prozentwerte
		} else {
			lifeHeight = parseInt(lifeHeight)// - 2 		// Pixel 2 pixel abziehen, ich bin mit nicht sicher, es hat mit der border zu tun...
			if (lifeHeight <= 0) lifeHeight = 14; // IE: Wenn textarea und rows=0, dann kann ein negativer Wert entstehen, IE Fehler ungueltiger Wert, hier bafangen
			lifeHeight += "px"	 		// Pixel 2 pixel abziehen, ich bin mit nicht sicher, es hat mit der border zu tun...
		}
		
	}
	// alert(is_ie)
	// alert("lifeHeight " + lifeHeight)
	if (lifeHeight) field.style.height = lifeHeight
	
	if (is_ie) {
		field.style.marginTop 		= "-1px" // Das ist eine IE Merkwuerdigkeit
		field.style.marginBottom 	= "-1px" // "
		// if (field.type=="text") field.style.height = lifeHeight - 2) + "px" // bei Input Feldern muss man fuer IE die Hoehe definieren
	}
	/*
	alert(	"lifeHeight " 			+ lifeHeight + "\n" + 
			"field.style.height " 	+ field.style.height
	)
	*/
	// DISABLED
	// +++ Achtug: das geht nur in IE, overflow = visible
	// if (!field.size) field.style.overflow = "visible" // "auto" // kein Scrollbar s fuer textareas
	field.style.overflow = "hidden" // "auto" // kein Scrollbar s fuer textareas
	// if(is_ie) field.style.overflow = "visible" 
	// alert(field.style.overflow)
	if (editorObj[field.id] && editorObj[field.id].isFloatingEditor == 0) {
		// nichts tun
	} else {
		// alert("resette "+el.id)
		if(life_field) {life_field.style.display 			= "none";}
		if (editorObj[field.id])	el.style.display 		= "block"; 	// vorher inline -> Probleme beim Swutchen mit Editoren designmode
		else 						el.style.display 		= "inline"; // inline wird fuer alle nicht editorfelder verwendet, damit das Icon lins stehen kann, sonst enststehen Umbrueche
		// el.style.display 		= "inline";
	}
	// if (    (field.nodeName.toLowerCase() == "textarea") && (!field.size) && (window.adjustTextareaHeight)  ) adjustTextareaHeight("init",field)
	if (mode != 'all') {
		if ((fadeEditorbuttons) && editorObj[editorObjTextareaName]) editorObj[editorObjTextareaName].switchButtonModeFade(editorObjTextareaName) 		 
		fadeEditorbuttons = 1;
		try {field.focus()} 
		catch (e) {}
	}
} 




 
 
 function deactivate_all_fields() {
 	//return;
 	// Zuruecksetzen der editierbaren Felder
	allSpansArr 	= document.getElementsByTagName("div")
	allSpanslength 	= allSpansArr.length
	
	
	
	//alert("allSpanslength " + allSpanslength)
	for(i=0;i<allSpanslength;i++) {
		mySpan 			= allSpansArr[i];
		mySpanEditId 	= mySpan.id;
		if (mySpanEditId.indexOf("elife_") != -1) { 		// wenn es ein editerbarer Bereich ist
			if (mySpan.style.display != "none") { 			// Es ist ein sichtbarer editierbarer Bereich
				mySpanId   	= mySpanEditId.substr(1,mySpanEditId.length)
				myFieldId 	= mySpanId.substr(5,mySpanId.length)
				// alert("mySpanEditId " + mySpanEditId + "   mySpanId " + mySpanId + " myFieldId " + myFieldId)
				// alert("deactivate_all_fields " + myFieldId)
				is_editorfield 			= 0
				// ist es ein vom Editor bearbeitetet Feld? Gibt es ein Editorobjekt dazu?
				if (editorObj[myFieldId]) {
				// return;
				// if(mySpanId == "life_"+editorTextareabyUser) {
					//alert( "editorfelf: " + editorTextareabyUser)
					myVal = getContentForField()								// Hier wird der Content gewitcht
					// alert("nach getContentForField() " + myVal);
					is_editorfield = 1
				} else {
					myVal = document.getElementById(myFieldId).value
					myVal = myVal.replace(	/\n/gi			, '<br>') 
				}
				
				//if (editorObj[field.id] && editorObj[field.id].isFloatingEditor == 0) {
				// continue
				//} 
				mySpan.style.display  	= "none";
				myLifeSpan 				= document.getElementById(mySpanId)
				
				// Zuruecksetzten
				fieldDeActivate(myLifeSpan)
				
				// Lifespan sichtbar machen und den aktuellen Inhalt einsetzen
				// Das ist ein Provisorium, hier muss eigenlich sauber berechnet werden, z. B. wenn ich eine Tabelle einfuege
				/*
				alert(	"mySpanEditId (mySpan.id) " 	+ mySpanEditId + "\n" + 
						"mySpanId  " 					+ mySpanId)
				*/
				
				// alert(myVal)
				// myLifeSpan.innerHTML = myVal // Feld.value an life-Span zuruekgeben
				// alert(mySpan.id)
				// alert(myLifeSpan.id)
				// alert(mySpanId)
				// alert("is_editorfield " + is_editorfield + " myVal " + myVal)
				
				// Bilder schonmal zeigen....
				// Voraussetzung: SCF("i",..) -> Abfrage von reinen Bildnamen
				// hier gibt es ein paar probleme mit dem Erkennen der Bilder
				// der Mehrzeilen modus "m" geht nicht, wenn Bilder imtext auftreten, scheint die Bedingung bereits erfuellt zu sein
				
				// testen, ob ein "i" Feld, nur dort soll des Bild eingeblendet werden
				showImage = 0
				infospan = document.getElementById("infospan_"+mySpanId) // ein unsichtbares span, das Zusatzinformationen enthaelt
				if (infospan) {
					infospanText = infospan.innerHTML
					if (infospanText.indexOf("/") != -1) showImage = 1
				}
				if ((!is_editorfield) && showImage && (myVal.match(/^[a-zA-Z0-9-_]+\.(jpg)|(jpeg)|(gif)|(png)$/))     ) {
					//alert ("Bild gefunden: img_+mySpanId " + "img_"+mySpanId)
					//alert("myVal " + myVal)
					if (document.getElementById("img_"+mySpanId)) {
						//alert ("exisiert: img_"+mySpanId)
						// alert(infospan.innerHTML)
						CeImagePath = infospan.innerHTML 			// infotext enthaelt CeImagePath
						// alert("infospan.innerHTML " + infospan.innerHTML)
						document.getElementById("img_"+mySpanId).src = CeImagePath + myVal // JSImagePath wird in JSeditmodefunction definiert
						// alert("JSImagePath + myVal " +CeImagePath + myVal)
						myLifeSpan.style.display = "none" // Feldtext nicht Zeigen
					}
				} else {
					// Ansonsten Inhalt zeigen
					if(myVal == "") myVal = "&nbsp;" ; 		// ganz leere Felder erzeugen ein strichfoermiges Eingabefeld beim Zuruechswitchen
					myLifeSpan.innerHTML = myVal 			// Feld.value an life-Span zuruekgeben
					if (mySpanId.indexOf("bild") != -1) myLifeSpan.style.display="none" // Wenn Bildabfrage, Feldtext nicht Zeigen
					// alert("resette "+ myLifeSpan.id + " myVal " + myVal)
					myLifeSpan.style.display  = "block";
				}
			} // end if
		} // end indexOf
	} // end for i
} // end function




function hide_Vmarker(anaus) {
	allSpansArr 	= document.getElementsByTagName("div")
	allSpanslength = allSpansArr.length
	for(i=0;i<allSpanslength;i++) {
		mySpan 			= allSpansArr[i];
		mySpanEditId 	= mySpan.id;
		//alert(mySpanEditId)
		if (mySpanEditId.indexOf("life_") != -1) { // wenn es ein editerbarer Bereich ist
			if (anaus==0) 	mySpan.style.borderLeftWidth = 0;
			else 			mySpan.style.borderLeftWidth = 1;
		}
	}
}


function test() {
	alert("test");
}

function submitWarn(warn,form) {
	// alert(form.name);
	if(confirm(warn)==true) form.submit();
}


function submitform(form) {
	//alert(form.sprachauswahl.value);
	//form.action=form.sprachauswahl.value;
	form.submit();
	
}

function submitsprachauswahl(form) {
	//alert(form.sprachauswahl.value);
	//alert(form.name)
	//form.submit();
	document.selectversion.submit();
}




function fensterauf(fenstertyp,vars,url) {
	// alert("fenstertyp: "+fenstertyp + " url: "+ url+vars);
	// return;
	if(fenstertyp=="kmicrosite"){
		(url.indexOf("emode=1") != -1) ? res = "yes"  : res = "no";
		{F2 = window.open(url,'microsite','toolbar=no,location=no,menubar=no,statusbar=no,scrollbars=no,resizable='+res+',width=798,height=560,left=0,top=0');}
	}
	/*if(fenstertyp=="kmicrosite"){
		if(!window.opener) {
			// Fenster soll im editmode resizable geoffnet werden
			(vars.indexOf("emode=1") != -1) ? res = "yes"  : res = "no";
			F2 = window.open(url+vars,'microsite','toolbar=no,location=no,menubar=no,statusbar=no,scrollbars=no,resizable='+res+',width=798,height=560,left=0,top=0');
		}
	}
	*/
	if(fenstertyp=="edituserrigths") 			{F2 = window.open('userrights.php?'                     		  	+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=700,left=10,top=10');}
	if(fenstertyp=="PDFgen")         			{F2 = window.open('/cms/pdf_generation/pdfgen.php?'               	+vars+'&r='+document.location.href,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=480,height=720,left=0,top=0');}
	if(fenstertyp=="email")          			{F2 = window.open('/cms/email.php?'                               	+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=500,left=0,top=0');}
	if(fenstertyp=="productfeatures")			{F2 = window.open('/cms/productfeatures.php?'                     	+vars,'','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=520,height=280,left=0,top=0');}
	if(fenstertyp=="productfeatures_icon_only")	{F2 = window.open('/cms/productfeatures.php?'                 		+vars,'','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width=260,height=280,left=0,top=0');}
	if(fenstertyp=="formgenerator")				{F2 = window.open('/cms/mod/formgenerator/formgenerator.php?'     	+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600,left=0,top=0');}
	if(fenstertyp=="compareproducts")			{F2 = window.open(url                 								+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=1024,height=810,left=0,top=0');}
	if(fenstertyp=="productform")				{F2 = window.open(url      											+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=800,left=0,top=0');}
	if(fenstertyp=="cleaningagents_details")	{F2 = window.open(url      											+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=800,left=0,top=0');}
	if(fenstertyp=="appadvisor")				{F2 = window.open(url                 								+vars,'','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,status=no,width=794,height=560,left=20,top=20');}
	if(fenstertyp=="pumpadvisor")				{F2 = window.open(url                 								+vars,'','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,status=no,width=794,height=560,left=20,top=20');}
	if(fenstertyp=="html2pdf")					{F2 = window.open(url												+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400,left=20,top=20');}
	if(fenstertyp=="productoutput")				{F2 = window.open(url      											+vars,'','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=800,left=0,top=0');}
	if(fenstertyp=="printtemplate")				{F2 = window.open('/cms/popups/printtemplate.php?'     				+vars,'','toolbar=no,location=no,menubar=yes,scrollbars=yes,resizable=yes,width=720,height=1024,left=0,top=0');}
}

function openNewWindow(theURL,winName,features) {
	// alert('theURL: '+theURL+' winName: ' + winName + ' features: ' + features)
	window.open(theURL,winName,features);
}
function Dfensterauf(path,name,xy) {
// Downloadfenster fŸr PDF...
//alert(path);
F2 = window.open(path,'download','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=340,height=160,left=-10,top=-10');
}


function FlashMovie(src, movie, width, height, version, quality, menu, bgcolor, flashvars) {

/*
Flash Einbettung, wmode Probleme.

Popuplayer mit Mircosite und Flash im Hintergund der Seite:
Firefox Mac: Film läuft nur im Windowmode "window", alles andere fuehrt nur beim Popuplayer zum Verschwinden des Flashfilms.
Da der Flashlim allerdings im Iframe läuft, gibt es keine Ueberlagerungen mit andern Flashfilemen!
alle anderen Browser kein Problem.

Popuplayer mit Video direkt:
Windowmode muß auf "transparent" stehen, sonst gibt es Ueberlagerungen mit anderen Flashfilmen.

Geht wmode Transparent in Firefox Mac beim normalen Videopopup?
Das Problem: 
Wmode Window: Menues verschwinden
Im PopupLayer : wmode transparent ib Zusammenhang mit dem Popuplayer verschwindet der Flashfilm
					Pc					Mac		
IE 6				transparent		transparent
IE 7				transparent		transparent
Firefox				transparent		transparent
Safari				transparent		transparent
			
*/
	
	wmode 					= 'transparent'
	if (is_mac_moz) wmode 	= 'transparent'
	// alert("is_mac_moz " + is_mac_moz)
	// alert("wmode " + wmode)
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+",0,0,0' width='" +width+ "' height='" +height+ "' id='" +movie+ "'>");
	document.write("<param name='movie' value='" +src+ "' />");
	document.write("<param name='FlashVars' value='" +flashvars+ "'>");
	document.write("<param name='quality' value='" +quality+ "' />");
	document.write("<param name='menu' value='" +menu+ "' />");
	document.write("<param name='bgcolor' value='" +bgcolor+ "' />");
	document.write("<param name='wmode' value='"+wmode+"'/>");
	document.write("<embed src='" +src+ "' swLiveConnect='true' menu='" +menu+ "' wmode='"+wmode+"' FlashVars='" +flashvars+ "' quality='" +quality+ "' bgcolor='" +bgcolor+ "' width='" +width+ "' height='" +height+ "' name='" +movie+ "' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}


function popup(path,w,h) {
	// $downloadlink = '<a href="javascrip:\"Dfensterauf(/cms/download.php?path='$ImagePath.$thissrc.'&name='.$bu.');">'.$bu.'</a>';
	//alert(fenstertyp);
	// alert('w ' + w + ' h '+ h);
	F2 = window.open(path,'download','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width='+w+',height='+h+',left=-10,top=-10');
}







/*

*/





// +popupLayer
function popupLayer(path,w,h,info,P) { // neu: P Objekt
	// alert(path);
	// alert('w ' + w + ' h '+ h);
	// alert("window.is_editmode " + window.is_editmode);
	if (!P) P = {} 
	var sq = 0;
	
	
	// O B J E C T 
	// Doctype Switch: IE 7 unterstuetzt ohne Doctype kein position fixed!
	// Die neue Positiopn fixed Loesung geht nur im karcher2008 Layout
	// alert("document.compatMode: " + document.compatMode)
	// alert("P.usePopupLayerObj: " + P.usePopupLayerObj)
	if (document.compatMode == 'CSS1Compat' || P.usePopupLayerObj) {
		var popupLayer = new popupLayerObj(path,w,h,info,P)
		return;
	}

	
	// Opener:
	// javascript: popupLayer( 'http://www.karcher.de/micrositeSound/index.php?version=followme', 796,560,'microsite follow me');
	/* report(			"path: " 		+ path 				+ "\n" + 
					"w: " 			+ w 				+ "\n" + 
					"h: " 			+ h 				+ "\n" + 
					"info: " 		+ info 				+ "\n" + 
					"popupImgPos: " + popupImgPos 		+ "\n"
				)
	*/
	// pos: die aktiuelle Bildposition in eine range
	// rangenum: die Anzahl der Bilder in der Range
	if (!w) w = 796
	if (!h) h = 600
	if (window.is_editmode) return;
	// if (!info) info = '&nbsp;'
	if (!info) info = 'K&Auml;RCHER'
	if (!window.popupLayer_text_close) var text_close 	= '&nbsp;&npsp;&npsp;'
	else 							   var text_close 	= window.popupLayer_text_close
	// var text_close 	= ''
	//if (!window.text_print) 			var text_print 	= 'Print'
	//if (!window.text_pdf) 				var text_pdf 	= 'PDF'
	
	
	var popupImgPos,popupImgArr,text_pdf,text_print,scrolling,onclose
	if(P) {
		P.popupImgPos 			?   popupImgPos = P.popupImgPos 		:	popupImgPos 	= 0
		P.popupImgArr 			?   popupImgArr = P.popupImgArr 		:	popupImgArr 	= ''
		P.text_pdf 				?   text_pdf = P.text_pdf 				:	text_pdf 		= ''
		P.text_print 			?   text_print = P.text_print 			:	text_print 		= ''
		P.scrolling 			?   scrolling = P.scrolling 			:	scrolling 		= 'no' // auto
		P.onclose 				?   onclose = P.onclose 				:	onclose 		= ''
		P.function_print		? 	function_print = P.function_print	:	function_print	= 'window.print();'
	}
	// alert(onclose)
	if (popupImgArr) popupImgNum = popupImgArr.length
	if(sq) {
		alert(	"getWindowHeight():" 			+ getWindowHeight() + "\n" + 
				"document.body.offsetHeight:" 	+ document.body.offsetHeight + "\n" + 
				"document.body.scrollHeight:" 	+ document.body.scrollHeight + "\n" + 
				"document.body.scrollTop:" 		+ document.body.scrollTop + "\n" + 
				"layerContentTop: " 			+ this.layerContentTop +"\n"
		)
	}
	// alert(path)
	popupLayerElement = document.getElementById('popupLayer');
	// return;
	if (!popupLayerElement) {
		zIndex  			= 1000
		layerTrans			= 27
		popupLayerTransImg	= 'popupLayerTrans.png'
		//layerWidth 			= '100%'
		//layerHeight 		= '100%' // document.body.scrollHeight + 'px'
		
		layerHeight = document.body.clientHeight
		if (document.body.scrollHeight > layerHeight) 	layerHeight = document.body.scrollHeight
		layerWidth = document.body.clientWidth
		if (document.body.scrollWidth > layerWidth) 	layerWidth = document.body.scrollWidth
		layerHeight += 'px'
		layerWidth  += 'px'
		// alert(layerHeight)
		// report(layerHeight + " x " + layerWidth)
		// isDirectEmbed = 0
		// alert("layerHeight " + layerHeight)
		// Wenn das Fenser kleiner ist als der Inhalt: Scrollwidth nehmen,m damit 
		// Ansonsten 100%
		// if (document.all) layerHeight = ';height:expression(eval(document.body.offsetHeight));';
		//if (document.all) 	{layerPosition = 'absolute'; 	layerTop = 'expression(eval(document.body.scrollTop));'}
		//else				{layerPosition = 'absolute'; 	layerTop = 0;}
		layerTop = 0;
		layerPosition = 'absolute';
		// Der Dimmer
		popupLayerDimmer = document.createElement('div')
		popupLayerDimmer.id = 'popupLayerDimmer'
		// alert("hier")
		// Explorer bekommt CSS Transparenz, Moz/Firefox png, wegen des Firefox CSS-Transparenz-Flash-Pluginn Bugs
		if (document.all) 	popupLayerDimmer.style.cssText 	= 'z-index:'+zIndex+'; background-color:black; position:'+layerPosition+'; left:0; top:'+layerTop+'; width: '+layerWidth+'; height:'+layerHeight+'; filter: alpha(opacity = '+layerTrans+');-moz-opacity: 0.'+layerTrans+'; opacity: 0.'+layerTrans+';';
		else  				popupLayerDimmer.style.cssText 	= 'z-index:'+zIndex+'; background-image:url(/cms/images/'+popupLayerTransImg+'); position:'+layerPosition+'; left:0; top:'+layerTop+'; width: '+layerWidth+'; height:'+layerHeight+';';
		document.body.appendChild(popupLayerDimmer);
		
		popupLayerElement 					= document.createElement('div')
		popupLayerElement.id 				= 'popupLayerElement'
		popupLayerElement.className 		= 'popuplayer'
		popupLayerElement.style.cssText 	= 'z-index:'+zIndex +'; position:absolute; left:0; top:0; width:100%; height:100%;';
		document.body.appendChild(popupLayerElement);
		// registerEventListeners(popupLayerElement,'click', function(){ document.body.removeChild(document.getElementById('popupLayerDimmer')); document.body.removeChild(document.getElementById('popupLayerElement'));},0);
		registerEventListeners(popupLayerElement,'click', function() {popupLayerClose(onclose)},0);
		// registerEventListeners(window,'resize', popupLayerResize,1);
		/*
		shTrans  				= 10
		versatz 				= -1
		for(i=0;i<10;i++) {
			versatz++
			shadow 					= document.createElement('div')
			shadow.style.cssText 	= 'z-index:'+zIndex +'; background-color:black; position:absolute; left:50%; top:50%; width:'+w+'px; height:'+h+'px; margin-top:-'+(w/2-versatz)+'px; margin-left:-'+(h/2-versatz)+'px; filter: alpha(opacity = '+shTrans+');-moz-opacity: 0.'+shTrans+';';
			document.body.appendChild(shadow);
		}
		*/
		var div =  document.createElement('div')
		//div.style.height = h +'px';
		//div.style.width = w +'px';;
		//alert(getWindowWidth())
		//alert(getWindowHeight())
		// alert( document.body.scrollTop)
		var layerContentTop = getWindowHeight()/2 + document.body.scrollTop - 20 // Schattenkante abziehen
		/*alert(	"window.innerHeight:" + window.innerHeight + "\n" + 
				"window.body.scrollHeight:" + document.body.scrollHeight + "\n" + 
				//  "diffH: " +  diffH + "\n" + 
				"layerContentTop: " + layerContentTop
		)
		*/
		// alert(text_close)
		registerEventListeners(div,'click', function(e){e.cancelBubble=true;},0);
		var frame 	 	=  '<table class="popuplayerFrame" border="0" width="100%" height="100%" cellpadding="0" cellspacing="0"><tr><td height="100%" width="90%" valign="top" id="popuplayer_content_td" class="content_td">'
			frame		+= '<div class="titlebar"><div class="title">'+info+'</div>'
			frame		+= '<div class="button_close" style="" onclick="popupLayerClose(\''+onclose+'\')">'+text_close+'&nbsp;</div>'
			if (text_pdf) 		frame	+= '<div class="button_pdf" onclick="">'+text_pdf+'</div>'
			if (text_print) 	frame	+= '<div class="button_print" onclick="'+function_print+'">'+text_print+'</div>'
			frame       += '</div>'
			frame 		+= '{popupcontent}'
			frame 		+= '</td><td class="rt"></td></tr>'
			frame 		+= '<tr><td class="lb"></td><td class="rb"></td></tr></table>'
			
		// F L A S H
		if (path.match(/.swf$/)) {
			// Flash direkt einbetten
			// alert("flash")
			// wmode auf opaque? fuer firefox mac?
			//report("swf" + layerContentTop+"\n")
			// Hier wird der Flashfilm direkt eingebunden, wmode = opaque
			div.style.cssText = 'z-index:'+zIndex+'; position:absolute; left:50%; top:'+layerContentTop+'; width:'+(w+10)+'px; height:'+(h+10)+'px; margin-top:-'+h/2+'px; margin-left:-'+w/2+'px;';
			flashCode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'" id="backgroundSound" align="">'
			flashCode += '<param name="movie" value="'+ path +'">'
			flashCode += '<param name="quality" value="high">'
			flashCode += '<param name="bgcolor" value="#FFFFFF">' 
			flashCode += '<param name="wmode" value="transparent">' 
			flashCode += '<embed id="backgroundSound" wmode="transparent" src="'+ path +'" quality="high" bgcolor="#FFFFFF"  width="'+w+'px" height="'+h+'px" name="backgroundSound" align="" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer"></embed>'
			flashCode += '</object>'
			div.innerHTML = frame.replace('{popupcontent}',flashCode)
			popupLayerElement.appendChild(div);
			
		// I M A G E S
		} else if (path.match(/(.(jpg)|(gif)|(png))$/)) {
			// report("img" + layerContentTop+"\n")
			// alert("bin Bild layerContentTop:" + layerContentTop)
			div.style.cssText 	= 'z-index:'+zIndex+'; position:absolute; left:50%; top:'+layerContentTop+'px; width:'+(w+10)+'px; height:'+(h+10)+'px; border:0px solid red; margin-top:-'+h/2+'px; margin-left:-'+w/2+'px;'
			var content 		= '<img id="popupImage" src="'+path+'" width="'+w+'px" height="'+h+'px">'
			div.innerHTML 		= frame.replace('{popupcontent}',content)
			popupLayerElement.appendChild(div);
		
		
		// D I V,    H T M L  Element
		} else if (document.getElementById(path)) { // wenn es ein Element mit dieser ID gibt, dann nehmen
			//report("div" + layerContentTop+"\n")
			div.style.cssText 	= 'z-index:'+zIndex+'; position:absolute; left:50%; top:'+layerContentTop+'px; width:'+(w+10)+'px; height:'+(h+10)+'px; border:0px solid red; margin-top:-'+h/2+'px; margin-left:-'+w/2+'px;'
			div.innerHTML 		= frame
			popupLayerElement.appendChild(div);
			div.innerHTML 		= frame.replace('{popupcontent}','')
			popupLayerElement.appendChild(div);
			document.getElementById('popuplayer_content_td').appendChild(document.getElementById(path))
			//var y = document.getElementById(path)
			
			document.getElementById(path).style.display = 'block' // sichtbar machen
			//popupLayerElement.appendChild(div);
			
		// I F R A M E
		} else {
			// alert('iframe ' + path)
			var xtrpx = 0;
			if (document.all) xtrpx = 2 // warum auch immemr...
			div.style.cssText 	= 'z-index:'+zIndex+'; position:absolute; left:50%; top:'+layerContentTop+'px; width:'+(w+10)+'px; height:'+(h+10)+'px; border:0px solid red; margin-top:-'+h/2+'px; margin-left:-'+w/2+'px;'
			var content 				= '<iframe frameborder="0" width="'+(w)+'px" height="'+(h)+'px" scrolling="'+scrolling+'" src="'+path+'"></iframe>';
			div.innerHTML 				= frame.replace('{popupcontent}',content)
			popupLayerElement.appendChild(div);
			
		}
		// Schliessen bei click auf die Flaeche...
		
		// alert(popupImgPos)
		// Pfeile zum weiterschalten
		if (popupImgArr) {
			arrowLeft 					 = document.createElement('img')
			arrowRight 					 = document.createElement('img')
			arrowLeft.style.cssText 	 = 'z-index:100; cursor:pointer; border:0px solid red; position:absolute; left:10px; top:'+(h-30)+'px;'
			arrowRight.style.cssText 	 = 'z-index:100; cursor:pointer; border:0px solid red; position:absolute; left:'+(w-30)+'px; top:'+(h-34)+'px;'
			arrowLeft.src 				 = "/cms/templates/karcher/images/arrow_popuplayer_left.gif" 
			arrowRight.src 				 = "/cms/templates/karcher/images/arrow_popuplayer_right.gif" 
			div.appendChild(arrowLeft);
			div.appendChild(arrowRight);
			// alert(popupImgArr.join("\n"))
			
			// Kreisfoermiges weiterschalten: Die Pfeile springen von n auf 0 zuruecke, bzw. 0 -> n
			registerEventListeners(arrowLeft,	'click', function(e){popupImgPos--; if(popupImgPos<0) 			 popupImgPos = popupImgNum-1;   document.getElementById('popupImage').src = popupImgArr[popupImgPos];e.cancelBubble=true;},0);
			registerEventListeners(arrowRight,	'click', function(e){popupImgPos++; if(popupImgPos==popupImgNum) popupImgPos = 0;   			document.getElementById('popupImage').src = popupImgArr[popupImgPos];e.cancelBubble=true;},0);
		}
	} 
}
function popupLayerClose(P) {
	document.body.removeChild(document.getElementById('popupLayerDimmer')); 
	document.body.removeChild(document.getElementById('popupLayerElement'));
	if (P=='back') window.history.back();
}
function popupLayerResize() {
	// report("popupLayerResize")
	// Dimmer ausblenden, dann messen, sonst blockt der Dimmer beim verkleinern des Fensters
	// document.getElementById('popupLayerDimmer').style.display = 'none'
	// alert("popupLayerResize")
	
	// zum Messen wird der 1. Inhaltscontainer genommen, wenn vorhanden
	// der Dimmer wurde an den Body gehaengt und blockt das Ausmessen der Inhaltsausmasse beim resizen
	var dimmer = document.getElementById('popupLayerDimmer')
	if (dimmer) {
		var el 			= document.getElementById('firstContainer')
		if (!el) el 	= document.body
		// alert(el.id)
		var scrollBarSize = 0
		var sW = el.scrollWidth			// Inhalt
		var sH = el.scrollHeight
		var wW = getWindowWidth()		// Fenster
		var wH = getWindowHeight()
		if (sH <= wH) sH = wH			// wenn der Inhalt < als das Fenster
		else scrollBarSize = (document.all ?  20: 15	)	// Inhalt groesse, wir haben einen Scrollbalken rechts, Achtung: Scollbars unterschiedlich gross!
		if (sW <= wW) sW = wW
		document.getElementById('popupLayerDimmer').style.height = sH  + 'px'
		document.getElementById('popupLayerDimmer').style.width  = sW - scrollBarSize + 'px'
	}
}








































/*
function popupLayerResize() {
	// report("popupLayerResize")
	// Dimmer ausblenden, dann messen, sonst blockt der Dimmer beim verkleinern des Fensters
	// document.getElementById('popupLayerDimmer').style.display = 'none'
	// alert("popupLayerResize")
	
	// zum Messen wird der 1. Inhaltscontainer genommen, wenn vorhanden
	// der Dimmer wurde an den Body gehaengt und blockt das Ausmessen der Inhaltsausmasse beim resizen
	var dimmer = document.getElementById('popupLayerDimmer')
	if (dimmer) {
		var el 			= document.getElementById('firstContainer')
		if (!el) el 	= document.body
		// alert(el.id)
		var scrollBarSize = 0
		var sW = el.scrollWidth			// Inhalt
		var sH = el.scrollHeight
		var wW = getWindowWidth()		// Fenster
		var wH = getWindowHeight()
		if (sH <= wH) sH = wH			// wenn der Inhalt < als das Fenster
		else scrollBarSize = (document.all ?  20: 15	)	// Inhalt groesse, wir haben einen Scrollbalken rechts, Achtung: Scollbars unterschiedlich gross!
		if (sW <= wW) sW = wW
		document.getElementById('popupLayerDimmer').style.height = sH  + 'px'
		document.getElementById('popupLayerDimmer').style.width  = sW - scrollBarSize + 'px'
	}
}
*/
var lastColor="#FFFFFF";
var lastObj;
function roll(obj,mybgColor) { 
	if (lastObj) lastObj.bgColor = lastColor; // zuraecksetzen
	lastColor = obj.bgColor // speichern
	obj.bgColor = mybgColor;
	lastObj = obj;
}
function rollback(obj) {
	obj.bgColor = lastColor;
}
function rollclass(obj,myclass) { 
	obj.className = myclass;
}
function rollImg(thisimg, wObj){ 
	document[thisimg].src = wObj.src;
}
function rollImgBg(imgName, wObj, bgElName,col){ 
// Aendert farbe + 1 Bild
	//document.getElementById(imgName).src = wObj.src;
	document.getElementById(imgName).src = wObj.src;
	document.getElementById(bgElName).bgColor = col;
}
function activateInputField(obj) {
	myobj = document.getElementById(obj)
	d = myobj.disabled
	//alert(d)
	if (d == 1) myobj.disabled = 0;
	else 		myobj.disabled = 1
}


/*
function btn_Set(obj,className) 		{obj.className=className}
function btn_hover(obj) 	{obj.className="btn_hover"}
function btn_out(obj) 		{obj.className="btn"}
function btn_down(obj) 		{obj.className="btn_active"}
function btn_up(obj) 		{obj.className="btn"}
function btntop_hover(obj) 	{obj.className="btntop_hover"}
function btntop_out(obj) 	{obj.className="btntop"}
function btntop_down(obj) 	{obj.className="btntop_active"}
function btntop_up(obj) 	{obj.className="btntop"}
function btnhell_hover(obj) {obj.className="btnhell_hover"}
function btnhell_out(obj) 	{obj.className="btnhell"}
function btnhell_down(obj) 	{obj.className="btnhell_active"}
function btnhell_up(obj) 	{obj.className="btnhell"}
*/

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+                                                                 +
//+                                                                 +
//+                                                                 +
//+                            +FENSTER                             +  
//+                                                                 +
//+                                                                 +
//+                                                                 +
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function openDialog(DialogData)  {
		// Dialogfenster bekommen ein Beschreibungsobjekt mit, das aus 3 Elementen besteht
		// 1) url und andere Fensterparameter
		// 2) args: 			dcmd=Befahl, der nach dem Schissen des Fenster ausgefuehrt wird, obligaorisch
		//					    color= irgendwelche anderen Daten fuer das Fenster
		// bsp: dialogData = {url:"select_color.html", w:250, h:180, args:{dcmd:"forecolor", color:"#FFFFFF"}}
		// damit lassen isch alle gaengigen Dialoge bewaeltigen 
		url = DialogData.url
		
		/*
		if (!DialogData.h)        h       = 100;        else h = DialogData.h;
		if (!DialogData.w)        w       = 100;        else w = DialogData.w;
		if (!DialogData.t)        t       = 100;        else t = DialogData.t;
		if (!DialogData.l)        l       = 100;        else l = DialogData.l;
		if (!DialogData.resize)   resize  = 0;          else resize = DialogData.resize;
		if (!DialogData.status)   status  = 0;          else status = DialogData.status;
		if (!DialogData.scrollen) scrollen= 0;          else scrollen = DialogData.scrollen;
		if (!DialogData.edge)     edge    = "raised";   else edge = DialogData.edge;
		if (!DialogData.loc)      loc     = 0;    		else loc = DialogData.loc;
		if (!DialogData.modus)    modus   = "modeless"; else modus = DialogData.modus;
		*/ 
		if (!DialogData.h)        h       = 100;        else h = DialogData.h;
		if (!DialogData.w)        w       = 100;        else w = DialogData.w;
		if (!DialogData.t)        t       = 100;        else t = DialogData.t;
		if (!DialogData.l)        l       = 100;        else l = DialogData.l;
		if (!DialogData.resize)   resize  = 'no';       else resize = DialogData.resize;
		if (!DialogData.menubar)  menubar = 'no';      	else menubar = DialogData.menubar;
		if (!DialogData.status)   status  = 'no';       else status = DialogData.status;
		if (!DialogData.scrollen) scrollen= 'no';       else scrollen = DialogData.scrollen;
		if (!DialogData.edge)     edge    = "raised";   else edge = DialogData.edge;
		if (!DialogData.loc)      loc     = 'no';    	else loc = DialogData.loc;
		if (!DialogData.modus)    modus   = "modeless"; else modus = DialogData.modus;
		
		// DialogData.args muss mindestens 1en wer enthalten: dcmd, der ruft dei Function "doDialogCommand" nach Schliessen des Fensters auf...
		myDialogArguments = DialogData.args // wird von Mozilla abgerufen, wenn ein Fenster geoeffnet wurde
		// +++ Achtung: Ausnahme popupeditor, hier gibt es ein Problem mit dem iframe in einem modelessdialog
		
		// Die  Unterscheidung zwischen modeless und nicht habe ich aufgegben, zu viele Probleme nach IE 7 mit Menüleisten
		//if ((is_ie) && (modus != "normal")) {
			//if (modus == "modeless") 	aktueldialog = showModelessDialog(url, window, 'resizable: '+resize+'; help: no; status: '+status+'; dialogHeight:'+h+'px; dialogWidth:'+w+'px; dialogTop:'+t+'px; dialogLeft:'+l+'px; scroll:'+scrollen+'; edge:'+edge+';');
			//else 						aktueldialog = showModalDialog(   url, window, 'resizable: '+resize+'; help: no; status: '+status+'; dialogHeight:'+h+'px; dialogWidth:'+w+'px; dialogTop:'+t+'px; dialogLeft:'+l+'px; scroll:'+scrollen+'; edge:'+edge+';');
			// alert("showModelessDialog OR showModalDialog")
			// if (aktueldialog) doDialogCommand(aktueldialog) // sofort ausfuehren, wenn ein result vom Fenster kommt
		//} else {
			// alert("window.open")
			// _features = 'menuebar=no, width='+(w-12)+', height='+(h-26)+', left='+l+', top='+t+',status='+status+', toolbar=no, scrollbars='+scrollen+', resizable='+resize+', location='+loc+',fullscreen=no'
			
			
			// Probleme mit Features in IE 7...fullscreen=no, bringt IE7 dazu, alle Leisten zu zeigen!
			_features = 'toolbar=no,status='+status+',location='+loc+',menubar='+menubar+',scrollbars='+scrollen+',resizable='+resize+',width='+(w-12)+',height='+(h-26)+',left='+l+',top='+t
			// _features = 'toolbar=no,status=no,location=no,menubar=no,scrollbars=no,resizable=no,width=800,height=800,left=20,top=20'
			// alert('features: ' + _features);
			// alert("DialogData.windowmode: " + DialogData.windowmode) 
			if (DialogData.windowmode == 'inline') 	window['cargowindow_'+window.cwCounter] = new cargowindowObj({url:url, width:w, height:h, left:l, top:t, cwCounter:window.cwCounter})
			else 									aktueldialog = window.open(url, "", _features);
			
		//}
		return aktueldialog
}


function dialogcheck() { // Dialoge kontrollieren
	// chekcen, ob es die Focus function gibt
	// Editorfenster ueberwachen
	if ((aktueldialogEditor) && (aktueldialogEditor.focus)) aktueldialogEditor.focus() 
	// cms Fenster ueberwachen
	if ((wload) && (!wload.closed)) {
		if ((aktueldialog) && (aktueldialog.focus)) aktueldialog.focus() 
	}
}

















function switch_service_direction() {
// alert("switch_service_direction")
// alert("input "+ document.edit.switch_service.value)
	if (document.edit.switch_service.value == "top_service") {
		document.edit.switch_service.value = "side_service"
	} else {
		document.edit.switch_service.value = "top_service"
	}
	// alert("output " + document.edit.switch_service.value)
	document.edit.submit()
}






////////////////////////////////
// Draging Elements
function startdragIt(evt) {
	if (window.toggleTicker) {toggleTicker()}
	MouseUpMenue = 0; 				// wird fuer Menues bnoetigt
	checkforOpenWindows();
	evt = (evt) ? evt : event;
	dragobj 	= (evt.target) ? evt.target : evt.srcElement;
	refobj 		= null;
	if (dragobj) {
		el = dragobj.id
		// alert(el)
		switch (el) {
			case "FloatingEditorGriff":
				dragobj = document.getElementById("FloatingEditorLayer")
				refobj  = document.getElementById("FloatingEditorLayer")
				if (is_mac_moz) {
					moveDummy 					= document.getElementById("moveDummy")
					FloatingEditorLayer 		= document.getElementById("FloatingEditorLayer")
					FloatingEditorTable 		= document.getElementById("FloatingEditorTable")
					moveDummy.style.display 	= "block"
					moveDummy.style.width 		= FloatingEditorTable.offsetWidth +'px'
					moveDummy.style.height 		= FloatingEditorTable.offsetHeight  +'px' 
					moveDummy.style.left 		= FloatingEditorLayer.offsetLeft  +'px'
					moveDummy.style.top 		= FloatingEditorLayer.offsetTop  +'px'
					dragobj = moveDummy
				}
			break;
			/*
			case "FloatingEditorLayer":
				dragobj = document.getElementById("FloatingEditorLayer")
				refobj  = document.getElementById("FloatingEditorLayer")
				if (is_mac_moz) {
					moveDummy 					= document.getElementById("moveDummy")
					FloatingEditorLayer 		= document.getElementById("FloatingEditorLayer")
					FloatingEditorTable 		= document.getElementById("FloatingEditorTable")
					moveDummy.style.display 	= "block"
					moveDummy.style.width 		= FloatingEditorTable.offsetWidth  +'px'
					moveDummy.style.height 		= FloatingEditorTable.offsetHeight  +'px'
					moveDummy.style.left 		= FloatingEditorLayer.offsetLeft  +'px'
					moveDummy.style.top 		= FloatingEditorLayer.offsetTop  +'px'
					dragobj = moveDummy
				}
			break;
			*/
			
		} // end switch
		if (refobj) {
			OffsetLeft 		= parseInt(refobj.offsetLeft) 
			OffsetTop 	 	= parseInt(refobj.offsetTop) 
		 	dragdistLeft 	= parseInt(evt.clientX) - OffsetLeft
			dragdistTop  	= parseInt(evt.clientY) - OffsetTop
		}
		// benoetigt, sonst keine sauberes Dragging in Moz, aber auch kein eingeben in Felder moeglich
		// deshlb testen, ob ein Drag Element angeklickt wurde (dann muss ein refobj vorliegen) 
		if (refobj) return false;
	}
}

function dragIt(evt) {
	evt = (evt) ? evt : event;
	if ((dragobj) && (refobj)){
		thisposH  = (evt.clientX - dragdistLeft) +'px'
		thisposV  = (evt.clientY - dragdistTop)  +'px'
		//thisposH  = evt.pageX - dragdistLeft
		//thisposV  = evt.pageY - dragdistTop
		
		dragobj.style.left = thisposH
		dragobj.style.top  = thisposV
		FloatingEditorXpos = thisposH
		FloatingEditorYpos = thisposV
		// document.getElementById("ilayer").innerHTML = "thisposH: "+ thisposH + " thisposV: "+ thisposV; 
		// document.getElementById("infolayer").style.display = "block";
		// document.getElementById("infolayer").innerHTML = "thisposH:" + thisposH +"<br>" + "thisposV:" + thisposV +"<br>" + "dragdistLeft:" + dragdistLeft +"<br>" + "dragdistTop:" + dragdistTop +"<br>"
		//if (is_ie) return false;
		//evt.cancelBubble = true;
		//return false;
	}
}

function stopdragIt(evt) {
	if (window.M_out)					M_out()
	if (window.checkforOpenWindows)  	checkforOpenWindows()
	if ((dragobj) && (refobj)) {
		
		if ((is_mac_moz) && (dragobj.id=="moveDummy")){
			moveDummy 					= document.getElementById("moveDummy")
			moveDummy.style.display 	= "none"
			FloatingEditorLayer 		= document.getElementById("FloatingEditorLayer")
			FloatingEditorLayer.style.left = moveDummy.style.left
			FloatingEditorLayer.style.top = moveDummy.style.top
		}
		if (window.writePositions) writePositions()		
	} // end if
	dragobj = null;	
	refobj  = null;	
}



function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
}





function adjustTextareaHeight(ev,el) {
/* 
Es ist wichtig, daß diese Funktion onkeyup aufgerufen wird, sonst verschwindet in Moz die 1. Zeile
*/
	//if (!is_ie) {
		// alert("ev.keyCode " + ev.keyCode)
		/*
		alert(	"el.style.height " + el.style.height + "\n" + 
				"el.scrollHeight " + el.scrollHeight + "\n" 
		);
		*/
		if (parseInt(el.style.height) != parseInt(el.scrollHeight)) {
			el.overflow
			el.style.height = parseInt((el.scrollHeight)+2) +"px";
		}
	//}
}

/*
// wird nirgendwo verwendet
function adjustTextareaHeightIframe(Aktuelkey,iframe,iframebody,textarea,thiseditorObjTextareaName) {
	// getElementInfo(el)
	alert(	"iframebody.style.height " + iframebody.style.height + "\n" + 
			"iframebody.scrollHeight " + iframebody.scrollHeight + "\n" 
	);
	
	if (is_ie) {
		if (parseInt(iframebody.style.height+2) != parseInt(iframebody.scrollHeight)) {
			iframe.scrollTop = 0;
			iframe.height 			= iframebody.scrollHeight + 2;
			//textarea.style.height 	= iframebody.scrollHeight + 2;
			res 					= iframebody.scrollHeight + 2;
			// iframe.scrollTop = 0;
			// alert("iframe.scrollTop " + iframe.scrollTop)
		}
	} else {
		if (parseInt(iframebody.style.height) != parseInt(iframebody.scrollHeight)) {
			iframe.height 			= iframebody.scrollHeight -2;
			//textarea.style.height 	= iframebody.scrollHeight;
			res 					= iframebody.scrollHeight;
			//iframe.contentWindow.scrollY = 0 // hgat keine Wirkung...
		}
	}
	// merken
	document.getElementById("tempid__"+thiseditorObjTextareaName+"_editorHeightbyUser").value = res
	// alert("save thiseditorObjTextareaName " + thiseditorObjTextareaName + "  " + document.getElementById("tempid__"+thiseditorObjTextareaName+"_editorHeightbyUser").value)
}
*/





function readCSSRule(classname,prop) {
	//alert(document.styleSheets.item(3).href)
	//alert("classname " + classname + " prop " + prop)
	
	var rules
	var docstyle = document.styleSheets.item(document.styleSheets.length-2); // Achtung: hier muß das richtige Stylesheet verwendet werden
	// styles sind mit items numeriert, ich nehme das letzte -> standardstytes
	//alert(docstyle.disabled)
	if (docstyle.rules)		rules=docstyle.rules;
  	if (docstyle.cssRules)	rules=docstyle.cssRules;
  	var rl=rules.length;
	for(var i=0;i<rl;i++){
    	//if(rules.item(i).selectorText=="."+classname) return rules.item(i).style[prop];
		// alert(rules.item(i).selectorText);
	// alert("classname "+ classname + " prop " + prop + " selectorText "  + rules.item(i).selectorText +"  " + rules.item(i).style[prop])
	// alert(rules.item(i))
		if(rules.item(i).selectorText==("."+classname)) {
			//alert(" selectorText "  + rules.item(i).selectorText + " prop " + prop + rules.item(i).style[prop])
			return rules.item(i).style[prop];
		}
  	}
}






function switchLangTabs(ce_type,ce_ID,ce_lang) {
	allLangTabs = document.getElementsByTagName("div")
	allLangTabsL = allLangTabs.length
	// alert("allLangTabsL " + allLangTabsL)
	// all wegschalten, ausser dem passenden
	// alert("langTab_"+ce_type+"_"+ce_ID +"_"+ce_lang);
	for (i=0; i<allLangTabsL; i++) {
		thisTab = allLangTabs[i]
		
		if (thisTab.id.indexOf('langTab_'+ce_type+'_'+ce_ID+'_bar') != -1) {
			// alert(thisTab.id)
			if (thisTab.id ==  'langTab_'+ce_type+'_'+ce_ID+'_bar_'+ce_lang) 	{
				thisTab.style.position 	= ""
				thisTab.style.top 		= "0px"
			} else { 												
				//thisTab.style.display = "none"
				thisTab.style.position 	= "absolute"
				thisTab.style.top		= "-100000px"
			}
			// alert(thisTab.style.top)
		}
	} // end for
}

function synchronizeInputElement(el) {
	thisNodeName = el.nodeName
	val 	 	 = el.value
	id2	= el.getAttribute("id2") // Fantasie Attribut, ID ist belegt fuer andere Funktionen
	// alert("thisNodeName: "+ thisNodeName);
	// alert("val "+ val);
	// alert("id2 "+ id2);
	id2Stamm = id2.split("_synchonize_")[0]
	// alert("id2Stamm " + id2Stamm)
	if (thisNodeName.toLowerCase() == "select" ){						// alle selects synchonisieren
		allEl 		= document.getElementsByTagName("select")    
		allElLength = allEl.length
		for(i=0;i<allElLength;i++) {
			thisel = allEl[i]
			if (thisel.getAttribute("id2") && (thisel.getAttribute("id2").indexOf(id2Stamm) != -1)) {
				//alert("aendere select " + thisel.getAttribute("id2"))
				thisel.value = val
			}
		} // end for
	}
	if (thisNodeName.toLowerCase() == "input" ){						// alle inputs synchonisieren
		allEl 		= document.getElementsByTagName("input")    
		allElLength = allEl.length
		for(i=0;i<allElLength;i++) {
			thisel = allEl[i]
			// alert("thisel.id2 "+thisel.getAttribute("id2"))
			if (thisel.getAttribute("id2") && (thisel.getAttribute("id2").indexOf(id2Stamm) != -1)) {
				//alert("aendere input " + thisel.getAttribute("id2"))
				thisel.value = val
			}
		} // end for
	}
}





function createDealerSessionSaveLinks(sessionID) {
	// nur IE  + Safari
	if (document.all || navigator.userAgent.toLowerCase().indexOf("safari") != -1) {
		
		// Hanegt an alle Links mit einem Href eine SessionID dran
		allLinksArr = document.getElementsByTagName('a') 
		L = allLinksArr.length
		// alert(L + " sid: " + sessionID)
		for (var i=0;i<L;i++) {
			var a = allLinksArr[i];
			var href = a.getAttribute('href')
			if (href.indexOf('avascript')!=-1) continue;
			if (href) {
				if (href.indexOf("?") != -1) href += "&PHPSESSID="+sessionID;
				else 						 href += "?PHPSESSID="+sessionID;
				// alert(href)
				a.setAttribute('href',href)
			}
		}
	}
}






// cdrom-tool
// var vari = 0
function cdromToolToggleTextbox(boxid,boxtype) {
	// report("boxid: " + boxid + ', boxtype: ' + boxtype)
    if (boxtype == 'alternCont') {
		if (document.getElementById('alt['+boxid+']').checked == true){
	        document.getElementById('box['+boxid+']').style.display = 'block';
	        document.getElementById('barr['+boxid+']').checked      = false;
	    } else {
	        document.getElementById('box['+boxid+']').style.display = 'none';
	    }
	}
	else if (boxtype == 'hide') {
		if (document.getElementById('barr['+boxid+']').checked == true){
	        document.getElementById('box['+boxid+']').style.display = 'none';
	        document.getElementById('alt['+boxid+']').checked      = false;
	    } 
	}
}



function save_cdrom_form(func, formName, statusElemet,workmode){
    var pars        = getHTMLVarsForAjax('all',formName)
    var ajaxProcess =  '';
    if (workmode == 0) 	var recall = function(state, vals) {document.getElementById(statusElemet).innerHTML=vals} 	// editmode
    else 				var recall = function(state, vals) {document.location.reload();}								// preview
    ajaxProcess = new ajax('/cms/mod/cdrom/a_target.php',recall,'post',0,pars+'&func='+func,statusElemet);


}
function open_cdrom_preview(path){
    window.open(path, 'funky');
}



// Markieren von Elemeten mit dem Inhalt von Str in src oder href
function markInPage(str, nodeStr) {
	/* I N F O 
	Der zu findende Text muss in einem href, name oder src Attribut stehen, fuer Elemetne, die in "nodeStr" definiert sind
	nodeStr; 'a,div,...'
	*/
	
	// report("markInPage: " + str)
	// return;
	sq = 0;
	
	targetNodesArr = nodeStr.split(',')
	for (var i=0; i<targetNodesArr.length; i++) {
		var nodeName 	= targetNodesArr[i]
		elArr 			= document.getElementsByTagName(nodeName)
		// report("markInPage nodeName: " + nodeName)
		// report(sO(elArr));
		if (elArr) {
			var L = elArr.length
			if(sq) report("Length: "+ nodeName + ': ' +L)
			for (var k=0; k<L; k++) {
				var el 		= elArr[k]
				var mark 	= '';
				// report("el.name: " + el.name)
				var href 	= el.getAttribute('href'); // +++ Achtung: es gibt eine Unterscheid zu el.href, '#' wird in Link ungesetzt
				var src  	= el.getAttribute('src');
				var name  	= el.getAttribute('name');
				// if (hasClassName(el,'htmlmarker_text')) continue; 
				//report("name: " + name + " str: #" + str + "#")
				if (href && href.indexOf(str) != -1) 					{mark = 1;	if(sq) report("found str: " + str + " in:" + el.nodeName)}
				if (src  && src.indexOf(str)  != -1) 					{mark = 1;	if(sq) report("found str: " + str + " in:" + el.nodeName)}
				if (name && name.indexOf(str) != -1) 					{mark = 1;	if(sq) report("found str: " + str + " in:" + el.nodeName)}
				// Kommentare
				//if (el.innerHTML  && el.innerHTML.indexOf(str)  != -1) 	{mark = 1;	if(sq) report("found str: " + inf + " in:" + el.nodeName)}
				
				// report("el.href: " + el.href)
				// if (el.src 	== str) {mark = 1;	if(sq) report("found str: " + str)}
				// if (el.href == str) {mark = 1;	if(sq) report("found str: " + str)}
				if (mark) {
					// report("el.nodeName: " + el.nodeName + " " + source(el.innerHTML))
					// report("el.nodeName: " + el.nodeName + " parentNode: " + el.parentNode.nodeName + " name: " + name)
					// el.style.border = '1px solid red'
					// el.className += ' htmlmarker'
					var arrow = document.createElement('div')
					// var l = absLeft(el)
					// var t = absTop(el)-150
					//var l = el.offsetLeft - 8
					//var t = el.offsetTop  - 60
					var l = - 8
					var t = - 60
					// report("l: " + l)
					// report("t: " + t)
					arrow.style.cssText = 'position:relative; left:'+l+'px; top:'+t+'px; width:0px; height:0px; z-index:10000; border:0px solid blue';
					var html = '<div class="htmlmarker" style="position:absolute">'
					html 	+= '<div class="htmlmarker_text">' + str + '</div>'
					html 	+= '</div>'
					arrow.innerHTML = html // report(arrow.innerHTML)
					// report("append: "+el.parentNode.nodeName)
					el.parentNode.insertBefore(arrow,el)
				}
			} // end for k
		}
	} // end for i
}

