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) { 
	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"
			} else {
				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"
			}
		} // 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
}

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) {
	if (is_ie)  window.resizeTo(width,height);
	else 	    window.outerHeight = height
}

function showElement(elname,height,mozdiff) { 
		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() {
	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;
		
}






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() {
	if (document.edit.show_all_fields.value==1) activate_all_fields(1); 				// set = 1 -> schaltet alle Felder an
}

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
		}
	
	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);
}

// 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 (mode) myVis = mode
			myDiv.style.display = myVis
		}
 	}
	document.edit.icm_visiblity.value = myVis;
 }
 

 
function activate_all_fields(set,previewmode) {
	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
	
	if (newstate == 1) {
		if (previewmode!="preview") document.edit.show_all_fields.value = 1
		allSpansArr 	= document.getElementsByTagName("div")
		allSpanslength = allSpansArr.length
		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")
	}
}
 
 
 
 
function scfover(el) {
	return
	//fieldActivate(el)
}
function scfout(el) {
	//fieldDeActivate(el)
}
function fieldActivate(el) {
	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;
	el.style.paddingTop    		= "1px"
	el.style.paddingRight  		= "1px"
	el.style.paddingBottom 		= "1px"
	el.style.borderLeft			= "1px solid #BBBBBB";

}



function switchEditMode(fieldname,mode) {
	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!	
	
	
	if(!is_ie) {
		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")
		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")
	}
	fieldActivate(field,"click");
	
	if (!field.style.backgroundColor) 	field.style.backgroundColor = "#F8F8F8"; // nur ueberschreiben, wenn leer
	lifeWidth = life_field.style.width;
	if ((field.style.width == "") && ((field.cols==33) || (field.size==33)))	 {
		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
	}
	
	// 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...
		}
		
	}
	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
	}
	field.style.overflow = "hidden" // "auto" // kein Scrollbar s fuer textareas
	if (editorObj[field.id] && editorObj[field.id].isFloatingEditor == 0) {
	} else {
		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
	}
	if (mode != 'all') {
		if ((fadeEditorbuttons) && editorObj[editorObjTextareaName]) editorObj[editorObjTextareaName].switchButtonModeFade(editorObjTextareaName) 		 
		fadeEditorbuttons = 1;
		try {field.focus()} 
		catch (e) {}
	}
} 




 
 
 function deactivate_all_fields() {
	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)
				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)$/))     ) {
					if (document.getElementById("img_"+mySpanId)) {
						CeImagePath = infospan.innerHTML 			// infotext enthaelt CeImagePath
						document.getElementById("img_"+mySpanId).src = CeImagePath + myVal // JSImagePath wird in JSeditmodefunction definiert
						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) {
	form.submit();
	
}

function submitsprachauswahl(form) {
	document.selectversion.submit();
}

function fensterauf(fenstertyp,vars,url) {
	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=="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) {

    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+ -/index.htm' 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) {
	F2 = window.open(path,'download','toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,width='+w+',height='+h+',left=-10,top=-10');
}

function getInternetExplorerVersion() {
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;

}

// +popupLayer
function popupLayer(path, title, w, h, text_pdf, text_print, popupImgArr) { // neu: P Objekt
	var sq = 0;
	if (!w) w = 796;
	if (!h) h = 600;
	if (window.is_editmode) return;

	var info = 'K&Auml;RCHER';
	
	if (!window.popupLayer_text_close) 
	    var text_close = '&nbsp;&npsp;&npsp;';
	else 
	    var text_close = window.popupLayer_text_close;

	var popupImgPos, popupImgArr, text_pdf, text_print, scrolling, onclose;

	if (popupImgArr) 
	    popupImgNum = popupImgArr.length;

	popupLayerElement = document.getElementById('popupLayer');

	var ie_ver = getInternetExplorerVersion();

	h_orig = h;
	if (h > getWindowHeight()) {
	    h = getWindowHeight() - 50;
	}
	
	if (!popupLayerElement) {
	    zIndex = 1000;
		layerTrans = 27;
		popupLayerTransImg = 'popupLayerTrans.png';

		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';

		layerTop = 0;
		
		if (ie_ver > -1 && ie_ver < 7.0 )
		    layerPosition = 'absolute';
		else
    		layerPosition = 'fixed';

		popupLayerDimmer = document.createElement('div');
		popupLayerDimmer.id = 'popupLayerDimmer';

		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(/site/image/'+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);

		onclose = '';

		registerEventListeners(popupLayerElement, 'click', function() { popupLayerClose(onclose) }, 0);
		
		var div = document.createElement('div');

		if (ie_ver > -1 && ie_ver < 7.0 ) {
		    var layerContentTop = parseInt( getWindowHeight() / 2 + document.documentElement.scrollTop - 20);
		}
		else {
		    var layerContentTop = parseInt( getWindowHeight() / 2 + document.body.scrollTop - 20);
		}

		registerEventListeners(div, 'click', function(e) { e.cancelBubble = true; }, 0);

		if(document.getElementById("windowTitle"))
		    title = title + " " + document.getElementById("windowTitle").innerHTML;

		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">' + title + '</div>';
		frame += '<div class="button_close" onclick="popupLayerClose(\'' + onclose + '\')">&nbsp;</div>';
		if (text_pdf) {
		    text_pdf_function = "popupLayerClose();popupLayer('" + text_pdf + "', 'Cat&aacute;logo', 717,560);";
		    frame += '<div class="button_pdf" onclick="' + text_pdf_function + '">PDF</div>';
		}
		if (text_print) frame += '<div class="button_print" onclick="self.frames[\'frameprint\'].focus(); self.frames[\'frameprint\'].window.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$/)) {
	        div.style.cssText = 'z-index:' + zIndex + '; position:' + layerPosition + '; left:50%; top:' + layerContentTop + 'px; 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))$/)) {            div.style.cssText = 'z-index:' + zIndex + '; position:' + layerPosition + '; 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_orig + 'px">';
			div.innerHTML = frame.replace('{popupcontent}', content);
			popupLayerElement.appendChild(div);
		
		// PDF
        } else if (path.match(/.pdf$/)) {

			var xtrpx = 0;
			if (document.all) xtrpx = 2 // warum auch immemr...
			div.style.cssText = 'z-index:' + zIndex + '; position:' + layerPosition + '; 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);

	    // D I V,    H T M L  Element
        } else if (document.getElementById(path)) { // wenn es ein Element mit dieser ID gibt, dann nehmen

            div.style.cssText = 'z-index:' + zIndex + '; position:' + layerPosition + '; 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}', document.getElementById(path).innerHTML);
			popupLayerElement.appendChild(div);
		//	document.getElementById('popuplayer_content_td').appendChild(document.getElementById(path));
		//	document.getElementById(path).style.display = 'block';

        } else if (document.getElementById("compareFrame")) {
            compFrame = document.getElementById("compareFrame").contentWindow.document;
            if (compFrame.getElementById(path)) { // wenn es ein Element mit dieser ID gibt, dann nehmen

                div.style.cssText = 'z-index:' + zIndex + '; position:' + layerPosition + '; 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}', compFrame.getElementById(path).innerHTML);
                popupLayerElement.appendChild(div);
            }
        }

		if (popupImgArr) {
		    arrLength = popupImgArr.length;
		    var popupImgPos = 0;
            if (arrLength > 1) {
                for (var i = 0; i < arrLength; i++) {
                    if ((path) == popupImgArr[i])
                        popupImgPos = i;
                }
    			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_orig-30)+'px;'
		    	arrowRight.style.cssText 	 = 'z-index:100; cursor:pointer; border:0px solid red; position:absolute; left:'+(w-30)+'px; top:'+(h_orig-34)+'px;'
			    arrowLeft.src 				 = "/site/image/arrow_popuplayer_left.gif" 
    			arrowRight.src 				 = "/site/image/arrow_popuplayer_right.gif" 
	    		div.appendChild(arrowLeft);
		    	div.appendChild(arrowRight);
			    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() {
	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
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+                                                                 +
//+                                                                 +
//+                                                                 +
//+                            +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  = '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
				// 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
			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
	if ((aktueldialogEditor) && (aktueldialogEditor.focus)) aktueldialogEditor.focus() 
	if ((wload) && (!wload.closed)) {
		if ((aktueldialog) && (aktueldialog.focus)) aktueldialog.focus() 
	}
}

function switch_service_direction() {
	if (document.edit.switch_service.value == "top_service") {
		document.edit.switch_service.value = "side_service"
	} else {
		document.edit.switch_service.value = "top_service"
	}
	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;
			
		} // 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'
		dragobj.style.left = thisposH
		dragobj.style.top  = thisposV
		FloatingEditorXpos = thisposH
		FloatingEditorYpos = thisposV
	}
}

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) {
		if (parseInt(el.style.height) != parseInt(el.scrollHeight)) {
			el.overflow
			el.style.height = parseInt((el.scrollHeight)+2) +"px";
		}
}

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)) {
			//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		= "-10000px"
			}
			// 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
}
