// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Projekt individuelle JS-Funktionen kommen in die m_project.js //
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

var globalJSVersion='170804-00';

var NAV6 = (parseInt(navigator.appVersion) >= 5 && navigator.appName == "Netscape") ? 1 : 0;
var NAV4 = (navigator.appName.indexOf("Netscape") >= 0 &&  parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
var IE5 = (IE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;
var OP = navigator.appName.indexOf("Opera") ? 1 : 0;
var shadowPageOf = '';
var ie = document.all;
var w3 = document.getElementById && !document.all;
var quickEditInUse;
var cmsFlashAlreadyPlayed = new Array();

var __flashvars = ''; // wird z.B. für Seitentyp4 benötigt
var __itemCount = 0; // wird z.B. für Seitentyp4 benötigt
var hotspotFlashIds = new Array(); // wird für Seitentyp4 benötigt, standard
var hotspotIds = new Array();
var hotspotLayerGroups = new Array();
var layerLinkStatus = new Array();
var linkIdsByLayerId = new Array();
var layerGroupById = new Array();

var cmsLayerElements = {
	byGroup:[],
	byId:[]
};

var cmsLinkElements = {
	byGroup:[],
	byId:[],
	byLayerId:[]
};

var merkenLink='';
var printLink='';

// ####################################################################################################
// 
// 	Formular-Checker
//
//	var felder=new Array();
//	var formname='form'; 	// Name des Formulares
//	var werte=new Array();
//
//	werte['feld']='email';	// Name des Formularfeldes
//	werte['feld2']='email';	// z.B. für Passwortprüfung 2er Felder
//	werte['pruef']='email';	// Prüfen auf (email,datum,plz,password,custom oder leer lassen)
//	werte['typ']='text';	// Feldtype
//	werte['pflicht']=1;		// Pflichtfeld
//	werte['fehler']='Bitte geben Sie eine gültige E-Mail Adresse an!'; // Fehlermeldung bei ungültiger E-Mail Adresse!
//	felder[felder.length]=werte;
//
// Prüftyp: Ein Feld mit Prüftyp wird zusätzlich genauer überprüft. Möglich ist hier email, datum oder plz.
// 			Eien Prüfung findet statt, wenn das Feld ein Pflichtfeld ist oder der Benutzer das Feld ausfüllt.
//
// Datum: Ein Datum wird auf das Format TT.MM.YYYY geprüft.
// PLZ: Eine PLZ wird auf 5-stellen und auf vorkommen von Zeichen ausser Zahlen geprüft.
// zahl: es wird geprüft ob das feld nur ziffern enthält
// E-Mail: Eine E-Mail wird auf name, domain und toplevel geprüft. Es dürfen keine 2 @ vorkommen.
//		   Die Domain muss aus mind. 2 Zeichen bestehen. Der Name darf die Zeichen a-z, A-Z, 0-9, ., - und _ enthalten.
//		   Die Domain darf die Zeichen a-z, A-Z, 0-9, . und - enthalten.
// Custom: Eine Javascript Funktion mit den Parametern element-Objekt, Feld-Parameter (Ein trag aus dem Konfigurationsarray für dieses Feld) wird aufgerufen und der Rückgabewert auf Wahrheit überprüft
//
// by Thorsten Peters, t.peters@rosomm-partner.de
//
// ###############################	#####################################################################

function mCheckAll() {
	for (feld=0;feld<felder.length;feld++) {
		var fld=felder[feld];
		var wert;
		if (felder[feld]['feld']) {
			var element=document.forms[formname][felder[feld]['feld']];
		} else {
			var element=document.getElementById(felder[feld]['feldID']);
		}
		if (fld['pflicht']) {
			if (fld['typ']=='text') wert=element.value;
			if (fld['typ']=='checkbox') wert=element.checked;
			if (fld['typ']=='radio') {
				wert=false;
				for (i=0; i<element.length;i++) if (element[i].checked) {
					wert=true;
				}
			}
			if (fld['typ']=='dropdown') wert=element[element.selectedIndex].value;
			if (!wert) {
				alert(unescape(fld['fehler']));
				if (fld['typ']!='radio' && element.type!='hidden')element.focus();
				return false;
			}
		}
		if (document.forms[formname][felder[feld]['feld']] && document.forms[formname][felder[feld]['feld']].value!='') {
			if (fld['pruef']=='email') if (!mCheckEmail(element,fld['fehler'])) return false;
			if (fld['pruef']=='datum') if (!mCheckDatum(element)) {
				alert(unescape(fld['fehler']));
				if (element.type!='hidden') element.focus();
				return false;
			}
			if (fld['pruef']=='plz') if (!mCheckPLZ(element,fld['fehler'])) return false;
			if (fld['pruef']=='zahl') if (!mCheckINT(element,fld['fehler'])) return false;
			if (fld['pruef']=='length') if (!mCheckLength(element,fld['fehler2'],fld['maxlength'])) return false;
			if (fld['pruef']=='password') if (!mCheckPassword(element,fld['fehler2'],document.forms[formname][fld['field2']])) return false;
			if (fld['pruef']=='custom') {
				eval('var result='+fld['function']+'(element,fld)');
				if (!result) return false;
			}
		}
	}
	return true;
}

function mCheckEmail(email,error) {
	check=email.value.indexOf("@");
	if (check==-1) {
		alert(error); email.focus(); return false;
	} else {
		ename=email.value.substring(0,check);
		rest=email.value.substring(check+1,email.value.length);
		for (i=0; i<ename.length; i++) {
			ok=false;
			if (ename.charAt(i)>='a' && ename.charAt(i)<='z') ok=true;
			if (ename.charAt(i)>='A' && ename.charAt(i)<='Z') ok=true;
			if (ename.charAt(i)>='0' && ename.charAt(i)<='9') ok=true;
			if (ename.charAt(i)=='.' || ename.charAt(i)=='-' || ename.charAt(i)=='_') ok=true;
			if (!ok) { alert(error); email.focus(); return false; }
		}
		if (rest.indexOf("@")!=-1) {
			alert(error); email.focus(); return false;
		} else {
			if (!ename) {
				alert(error); email.focus(); return false;
			} else {
				check=rest.lastIndexOf(".");
				domain=rest.substring(0,check);
				land=rest.substring(check+1,rest.length);
				for (i=0; i<domain.length; i++) {
					ok=false;
					if (domain.charAt(i)>='a' && domain.charAt(i)<='z') ok=true;
					if (domain.charAt(i)>='A' && domain.charAt(i)<='Z') ok=true;
					if (domain.charAt(i)>='0' && domain.charAt(i)<='9') ok=true;
					if (domain.charAt(i)=='.' || domain.charAt(i)=='-') ok=true;
					if (!ok) { alert(error); email.focus(); return false; }
				}
				for (i=0; i<land.length; i++) {
					ok=false;
					if (land.charAt(i)>='a' && land.charAt(i)<='z') ok=true;
					if (land.charAt(i)>='A' && land.charAt(i)<='Z') ok=true;
					if (!ok) { alert(error); email.focus(); return false; }
				}
				if (land.indexOf(".")!=-1) {
					alert(error); email.focus(); return false;
				} else {
					if (!land || !domain) {
						alert(error); email.focus(); return false;
					} else {
						if (domain.length<2) {
							alert(error); email.focus(); return false;
						} else return true;
					}
				}
			}
		}	
	}
}

function mCheckPLZ(plz,error) {
	if (plz.value.length!=5) {
		alert(error);
		plz.focus();
		return false;
	}
	for (i=0; i<plz.value.length; i++) {
		s=plz.value.substring(i,i+1);
		check=parseInt(s);
		if (isNaN(check)) {
			alert(error);
			plz.focus();
			return false;
		}
	}
	return true;
}

function mCheckINT(zahl,error) {
	
	for (i=0; i<zahl.value.length; i++) {
		s=zahl.value.substring(i,i+1);
		check=parseInt(s);
		if (isNaN(check)) {
			alert(error);
			zahl.focus();
			return false;
		}
	}
	return true;
}

function mCheckPassword(password,error,password2) {
	if(password.value!=password2.value) {
		alert(error);
		password.value = '';
		password2.value = '';
		password.focus();
		return false;
	}
	return true;
}

function mCheckDatum(datefield,error) {
	var mNames="JanFebMarAprMayJunJulAugSepOctNovDec"
	var mValues="312831303130313130313031"
	var errormsg=error;
	var date=datefield.value;
	var dots=new Array();
	
	if (date.length<6) {
		return false;
	}
	for (var i=0; i < date.length;i++) if (date.substr(i,1)=='.') dots[dots.length]=i;
	if (dots.length!=2) {
		return false;
	}
	myDD=parseInt(date.substr(0,dots[0]),10);
	myMM=parseInt(date.substr(dots[0]+1,dots[1]-dots[0]-1),10);
	myYYYY=parseInt(date.substr(dots[1]+1,date.length),10);
	if (myYYYY < 1850) return false;
	if ((isNaN(myDD)) || (isNaN(myMM)) || ( isNaN(myYYYY))) {
		return false;		
	}
	var lastdatum = 0
	if (myMM == 2) {
		if (isLeapYear(myYYYY)) lastdatum = 29;
		else lastdatum = 28;
	} else lastdatum = mValues.substr((myMM-1)*2,2);
	
	if ((myDD > lastdatum) || (myDD <=0)) {
		return false;
	}
	var newValue="";
	if (myDD<10) myDD = "0"+myDD;
	if (myMM<10) myMM = "0"+myMM;
	if (myYYYY<10) myYYYY = "0"+myYYYY;
	if (myYYYY<1000) myYYYY = "20"+myYYYY;
	datefield.value=myDD+'.'+myMM+'.'+myYYYY;
	return true;
}

function isLeapYear (Year) { 
	if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) return true;
	else return false;
}

function mCheckLength(field, error, maxlength) {
	if(field.value.length>maxlength) {
		alert(error);
		return false;
	} else return true;
}

function radiovalue(element) {
	for (i=0; i<element.length;i++) if (element[i].checked) {
		return element[i].value
	}
	return false;
}

// ####################################################################################################

// Popup 
function openWin(url,weite,hoehe,id,parameters,centered) {
	var pos='';
	if (centered) {
		var coord=getWindowCenterCoordinates(weite,hoehe);
		pos=',left='+coord['x']+',top='+coord['y']+'';
	} else {
		pos=',left=50,top=50';
	}
	if (!parameters) parameters='menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no';
	if (parameters.indexOf('left=')==-1) parameters+=pos;
	parameters+=',width='+weite+',height='+hoehe;
	popupWin = window.open(url,id,parameters);
}

function changeLang(value,loc) {
	pos1=loc.indexOf("&ID");
	pos2=loc.indexOf("?ID");
	if (pos2>-1) {
		pos=pos2;
		z="?";
	}
	if (pos1>-1) {
		pos=pos1;
		z="&";
	}
	if (pos>-1) {
		teil=loc.substring(pos,loc.length);
		pos3=teil.indexOf("&")
		if (pos3==-1) pos3=loc.length;
		teil2=loc.substring(pos,pos+pos3);
		ok=str_replace(teil2,z+"ID="+value,loc);
		if (ok) location.href=ok;
	}
}

// Abfrage der Fensterhoehe/-breite fuer IE und NN 
function getHeightAndWidth() {
	if (IE4 || IE5) {
		var screenHeight = document.body.clientHeight;
		var screenWidth = document.body.clientWidth;
	}
	
	if (NAV4) {
		var screenHeight = window.innerHeight;
		var screenWidth = window.innerWidth;
	}
}

// Seite / Layout Config im dms
function confWin(ID,eleID,onoff) {
}

function conf(ID,eleID,onoff,eleName,reDo,quickEdit) {
	if (quickEditInUse) {
		return;
	}
	if (quickEdit == null) {
		quickEdit = false;
	}
	quickEditEnabled = quickEdit;
	curEditElementId = eleID;
	curEditElementName = eleName;
	if (reDo == null) {
		reDo = false;		
	}
	
	var rowID = 'rowLay'+eleID;
	if (parent && parent.frames && parent.frames.editframe.document.getElementById(rowID)) { 
		toggleFormColor(parent.frames.editframe.document.getElementById(rowID),onoff);
	}
	
	var editPreviewInfoDiv = document.getElementById('editPreviewInfo');
	var editPreviewHiliteDiv = document.getElementById('editPreviewHilite');
	var editTextDiv = document.getElementById('editTextDiv-' + eleID);
	if (editPreviewInfoDiv != undefined) {
		if (onoff == 2) {
			var epTop = getAbsTop(ID);
			var epLeft = getAbsLeft(ID);
			
			var width = getSpanWidth(ID) + 2;
			var height = getSpanHeight(ID) + 2;
			
			var infoText = eleName;
			if (document.all && quickEdit) {
				infoText += ' (QuickEdit: Shift + Click)';
			}
			
			editPreviewInfoDiv.innerHTML = infoText;
			editPreviewInfoDiv.style.top = (epTop - 18) + 'px';
			editPreviewInfoDiv.style.left = (epLeft - 1) + 'px';
			
			
			editPreviewHiliteDiv.style.top = (epTop - 1) + 'px';
			editPreviewHiliteDiv.style.left = (epLeft - 1) + 'px';
			editPreviewHiliteDiv.style.width = width + 'px';
			editPreviewHiliteDiv.style.height = height + 'px';
			editPreviewHiliteDiv.style.display = 'block';
			editPreviewInfoDiv.style.display = 'block';
		} else {
			editPreviewHiliteDiv.style.top = (-1000) + 'px';
			editPreviewHiliteDiv.style.left = (-1000) + 'px';
			editPreviewInfoDiv.style.top = (-1000) + 'px';
			editPreviewInfoDiv.style.left = (-1000) + 'px';
			editPreviewHiliteDiv.style.display = 'none';
			editPreviewInfoDiv.style.display = 'none';
		}
	}
}

function toggleFormColor(ID, onoff) {
	if (!onoff) {
   	if (ID.style.backgroundColor == '' || ID.style.backgroundColor == '#ffffff') {
			onoff = 2;
		} else {
			onoff = 1;
		}
	}
   
	if (onoff == 2) {
		ID.style.backgroundColor = '#D7D7D7';
	} else {
		ID.style.backgroundColor = '';
	}
}


function openWindowScroll(url,weite,hoehe,name,ret) {
	if (!name) name='unitsPopup';
	popupWin = window.open(url,name,'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,width='+weite+',height='+hoehe+',left=50,top=50');
	if (ret) return popupWin;
}

function openWindow(url,weite,hoehe,name) {
	if (!name) name="unitsPopup";
	popupWin = window.open(url,name,'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,width='+weite+',height='+hoehe+',left=50,top=50')
}

function openFreeWindow(url,name,mbar,sta,loc,tbar,res,scr,width,height,left,top) {
	if (res > 1 && scr > 1 && !width && !height) { // alter Aufruf, Signatur hat sich dämlicherweise geändert.
		width=res;
		height=scr;
		res=0;
		scr=0;
	}
	
	if (!mbar) mbar="no"; else mbar="yes";
	if (!tbar) tbar="no"; else tbar="yes";
	if (!res) res="no"; else res="yes";
	if (!sta) sta="no"; else sta="yes";
	if (!loc) loc="no"; else loc="yes";
	popupWin = openWin(url,width,height,name,'menubar='+mbar+',status='+sta+',location='+loc+',toolbar='+tbar+',resizable='+res+',scrollbars='+scr,true);
}

// Flip - Funktion fuer Bilder im Layer
// flLayer = Layername in dem sich das Bild befindet
// flName = Imagename
// flRoll = Rolloverimage

function fliplay(flLayer, flName, flRoll){
	sLN = '\'' + eval("flLayer") + '\'';
	if(document.images) {
		if(document.layers) document.layers[eval(sLN)].document.images[eval("flName")].src = eval(flRoll + '.src');
		else document.images[eval("flName")].src = eval(flRoll + '.src');
	}
} 

// Overskripte v2

var over=new Array();
var selected=new Array();
var mouseOvers=new Array();
var moClickDeselects=false; // Wird der aktive Punkt beim Klicken wieder deselektiert?

function moInit(group,id,overImage,clickImage,layer) {
	if (!mouseOvers[group]) mouseOvers[group]=new Array();
	mouseOvers[group][id]=new Array();
	mouseOvers[group][id]['layer']=layer;
	normal=moGetImage(group,id);
	if (document.images) {
		mouseOvers[group][id]['normalImage']=new Image;
		mouseOvers[group][id]['normalImage'].src=normal.src;
		mouseOvers[group][id]['overImage']=new Image;
		mouseOvers[group][id]['overImage'].src=overImage;
		mouseOvers[group][id]['clickImage']=new Image;
		if (clickImage) {
			mouseOvers[group][id]['clickImage'].src=clickImage;
		} else{
			mouseOvers[group][id]['clickImage'].src=overImage;
		}
	}
}

function moGetImage(group,id) {
	if (mouseOvers[group][id]['layer']) {
		if (document.layers) {
			var img=document.layers[mouseOvers[group][id]['layer']].document.images[group+id];
			if (!img) {
				alert(group+','+id+','+img+' ('+document.layers[mouseOvers[group][id]['layer']].document.images.length+') in '+mouseOvers[group][id]['layer']+'('+document.layers[mouseOvers[group][id]['layer']]+')');
			}
			return img;
		} else {
			return document.images[group+id];
		}
	} else {
		return document.images[group+id];
	}
}

function moSetImage(group,id,mode) {
	img=moGetImage(group,id);
	debug('set '+group+','+id+' ('+img+') to '+mode);
	//alert('set '+group+','+id+' ('+img+') to '+mode);
	//alert(mouseOvers[group][id][mode]);
	modeImg=mouseOvers[group][id][mode];
	src=modeImg.src;
	//alert(img+' && '+img.src+'!='+src);
	var noSet='';
	if (img && img.src!=src) img.src=src;
	else noSet=' (no change)';
	if (img) debug('real img set to '+img.src+noSet);
	else {
		debug('no img for '+group+','+id+','+mode);
	}
}

function moOver(group,id) {
	debug('\nover '+group+','+id+'sel:'+selected[group]+',over:'+over[group]);
	if (over[group]) { // letztes Over zurück
		old=over[group];
		if (selected[group]==old || mouseOvers[group][old]['selected']) {
			moSetImage(group,old,'clickImage');
		} else {
			moSetImage(group,old,'normalImage');
		}
	}
	over[group]=id;
	//alert('over:'+id+','+mouseOvers[group][id]['overImage'].src);
	moSetImage(group,id,'overImage');
}

function moOut(group,id) {
	debug('\nout '+group+','+id+'sel:'+selected[group]+',over:'+over[group]);
	//alert('out:'+id+'ov?'+over[group]+'=='+id+',sel?'+selected[group]+'=='+id);
	if (selected[group]==id || mouseOvers[group][id]['selected']) { // geclicktes zurücksetzen
		moSetImage(group,id,'clickImage');
	} else if (over[group]==id) { //geovertes zurücksetzen
		moSetImage(group,id,'normalImage');
	}
	over[group]=0;
}

function moClick(group,id) {
	debug('\nclick '+group+','+id+'sel:'+selected[group]+',over:'+over[group]+',sel2:'+mouseOvers[group][id]['selected']);
	if (!moClickDeselects && selected[group]) { // zuletzt angeklickten Punkt zurück
		old=selected[group];
		moSetImage(group,old,'normalImage');
		mouseOvers[group][old]['selected']=false;
	} 
	
	if (moClickDeselects && mouseOvers[group][id]['selected']) {
		mouseOvers[group][id]['selected']=false;
		moSetImage(group,id,'normalImage');
		selected[group]=null;
	} else if (!moClickDeselects || id!=selected[group]) {
		selected[group]=id;
		moSetImage(group,id,'clickImage');
		mouseOvers[group][id]['selected']=true;
	}
}

//top && top.frames && top.frames.headerg && top.frames.headerg.
var debugOnOff='on';
function debug(msg) {
	var debugObj=false;
	//alert(document.forms.debugform);
	if (document.forms && document.forms.debugform) debugObj=document.forms.debugform.elements[0];
	if (debugOnOff=='on' && debugObj) {
		debugObj.value+=msg+'\n';
	}
}


function flipImage(imgName,imgNo) { 
	var newSrc=eval(imgNo+'.src');
	//alert(imgName+':'+imgNo+' to:'+newSrc);
	document.images[imgName].src = newSrc;
}


// Flip - Funktion (Austausch eines Bildes)

function flipNavi(imgName,imgNo) { 
	document.images[imgName].src = './_images/'+imgNo+'.gif';
}

function delconfirmrelocate(msg,url, frame) // OK Abbrechen fragen und bei OK weiterleiten
{
        var check;
        check = confirm(msg);
        if (check) 
        {
			if (frame) {
				windowObject = frame;
			} else {
                windowObject = window;
			}
			windowObject.location=url;
        }
}   

// Abfrage der Formularfelder
function chkmail() {
	if (document.mail.surname.value == "") {
		alert("Bitte Ihren Vornamen eingeben!");
		document.mail.surname.focus();
		return false;
	}
	if (document.mail.name.value == "") {
		alert("Bitte Ihren Namen eingeben!");
		document.mail.name.focus();
		return false;
	}
	if (document.mail.street.value == "") {
		alert("Bitte Ihre Straße eingebe!");
		document.mail.street.focus();
		return false;
    }
	if (document.mail.zipcity.value == "") {
		alert("Bitte geben sie ihre PLZ und den Ort ein!");
		document.mail.zipcity.focus();
		return false;
    }
	if (document.mail.email.value == "") {
		alert("Bitte Ihre eMail-Adresse eingeben!");
    	document.mail.email.focus();
    	return false;
    }	
	if (document.mail.email.value.indexOf('@') == -1) {
		alert("Bitte eine gültige eMail-Adresse eingeben!");
    	document.mail.email.focus();
    	return false;
    }
	if (document.mail.email.value.indexOf('.') == -1) {
		alert("Bitte eine gültige eMail-Adresse eingeben!");
    	document.mail.email.focus();
    	return false;
    }
	clickedButton();
}

function loadHeadline(nr, session) {
	parent.headline.location = '../../ginab/frm_headline.php?hl='+nr+'&dbc='+session;
}
function str_replace(from,to,str) {
	var ret;
	from = replaceSpecialChars(from);
	
	var daReg = new RegExp(from, 'g');
	
	ret = str.replace(daReg, to);
	return ret;
}

function str_ireplace(from,to,str) {
	var ret;
	from = replaceSpecialChars(from);
	
	var daReg = new RegExp(from, 'gi');
	
	ret = str.replace(daReg, to);
	return ret;
}

function replaceSpecialChars(str) {
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\//g,'\\/');
	str=str.replace(/\^/g,'\\^');
	str=str.replace(/\$/g,'\\$');
	str=str.replace(/\./g,'\\.');
	str=str.replace(/\+/g,'\\+');
	str=str.replace(/\(/g,'\\(');
	str=str.replace(/\)/g,'\\)');
	str=str.replace(/\?/g,'\\?');
	str=str.replace(/\*/g,'\\*');
	str=str.replace(/\[/g,'\\[');
	str=str.replace(/\]/g,'\\]');
	
	return str;
}

function ucfirst(str) {
	var newString=str.charAt(0).toUpperCase();
	newString+=str.substring(1,str.length);
	return newString;
}

function chklogin()
  {

   if(document.login.usr.value == "")
    {
     alert("Bitte Ihren Benutzernamen eingeben!");
     document.login.usr.focus();
     return false;
    }
	
   if(document.login.pass.value == "")
    {
     alert("Bitte Ihr Passwort eingeben!");
     document.login.pass.focus();
     return false;
    }
}


function debugHandler(msg) {
	if (!top.frames.mnav) var f=top.opener.top.frames.mnav.document.forms.debug.elements[0];
	else var f=top.frames.mnav.document.forms.debug.elements[0];
	if (f && f.name) f.value+=msg+'\n';
}

// Für Vorschau im CMS
function openEditWin(ID,ele,parentID,sess,lang) {
	if (quickEditInUse == true) {
		return;
	}
	if (!lang) lang = '';
	if (parent.frames.editframe
		&& parent.frames.editframe.isShadowPage < 1
		&& shadowPageOf < 1
	) {
		
		parent.frames.editframe.location.href='cms/elements/element_edit.php?ID='+ID+'&element='+ele+'&parent='+parentID+'&lang='+lang+'&dbc='+sess;
		parent.showHideLayout(true, true, true);
	}
}

// Für Vorschau im CMS
function newReturnWindow(url,name,width,height) {
	return window.open(url,name,'status=yes,left=100,top=100,width='+width+',height='+height+',scrollbars=yes,resizable=yes,status=yes');
}

// Für Vorschau im CMS
function openUnitsWin(modul,parent,altLink) {
	if (quickEditInUse == true) {
		return;
	}
	if (typeof top.frames.mnav.moduleLinks[modul]=='undefined') {
		eval(altLink);
	} else {
		var js=top.frames.mnav.moduleLinks[modul];
		js=str_replace('<parent>',parent,js);
		js=str_replace('<parent>',parent,js);
		js=str_replace(")",",1)",js); // Parameter fromCMS übergeben um Pfad anzupassen
		evl='top.frames.mnav.'+js;
		eval(evl);
	}
}

// Flip Skripte v1, nicht mehr verwenden

var current=0; // aktives image, wird bei onclick gesetzt
var sel=0; // ausgewähltes image, wird bei onmouseover gesetzt

function flip(imgName,imgNo) { 
	var newSrc=eval(imgNo+'.src');
	document.images[imgName].src = newSrc;
}

function allout(){ // blendet sel aus und current ein
	if (sel != 0 && sel!=current){
		flipmnav = 'sel' + sel;
		flipimage = 'no' + sel;
		flip(flipmnav,flipimage);
	}
	if (current != 0){
		himnav = 'sel' + current;
		hiimage = 'sel' + current;
		flip(himnav,hiimage);
	}
}

function alloutall(){  // blendet sel und current aus
	if (sel != 0){
		flipmnav = 'sel' + sel;
		flipimage = 'no' + sel;
		flip(flipmnav,flipimage);
	}
	if (current != 0 && sel!=current){
		himnav = 'sel' + current;
		hiimage = 'no' + current;
		flip(himnav,hiimage);
	}
}

function getWindowCenterCoordinates(width,height) {
	var ret=new Array();
	ret['x']=0;
	ret['y']=0;
	if (screen) {
		//alert(screen.availHeight+':'+height);
		ret['y']=Math.floor((screen.availHeight-height)/2);
		ret['x']=Math.floor((screen.availWidth-width)/2);
		if (ret['x']<0 || isNaN(ret['x'])) ret['x']=0;
		if (ret['y']<0 || isNaN(ret['y'])) ret['y']=0;
	}
	return ret;
}

// Fensterobjekt in die Bildschirmmitte bringen
function centerWindow(win) {
	if (!win) win=top;
	if (win.top.frames) return ""; // Pflegetoolframeset
	var dim=getWindowDimensions(win);
	var coord=getWindowCenterCoordinates(dim['x'],dim['y']);
	if (win.moveTo) {
		//alert('move to: '+coord['x']+','+coord['y']);
		win.moveTo(coord['x'],coord['y'])
	}
}

// Fensterabmessungen ermittlen, funzt erst nachdem die Seite geladen ist.
function getWindowDimensions(win) {
	if (!win) win=top;
	var ret=new Array();
	ret['x']=800;
	ret['y']=600;
	if (win.document.documentElement && win.document.documentElement.offsetWidth) {
		ret['x']=win.document.documentElement.offsetWidth;
		ret['y']=win.document.documentElement.offsetHeight;
	} else if (win.self && win.self.innerWidth) {
		ret['x']=win.self.innerWidth;
		ret['y']=win.self.innerHeight;
	} else if (win.screen.availWidth && win.screen.availWidth) {
		ret['x']=win.screen.availWidth;
		ret['y']=win.screen.availHeight;
	}
	return ret;
}

function cmsLayerShowHide(divID, hideAll)
{
	if(hideAll) {
		if(NAV6){
			var all = document.getElementsByTagName("DIV");
			var ID = '';
			for(i=0; i<=all.length; i++) {
				if(all[i])  {
					ID = all[i].getAttribute('id')+'';
					if(ID.indexOf('cmsSHLayer')!=-1 && ID!=divID) {
						layShowHide(ID, 'hidden');
					}
				}
			}
		} else if(NAV4){
			for(k in document) {
				if(k.indexOf('cmsSHLayer')!=-1 && k!=divID) layShowHide(k, 'hidden');
			}
			//return eval("document." + name); 
		} else if(IE5 || IE4){
			for(k in document.all) {
				if(k.indexOf('cmsSHLayer')!=-1 && k!=divID) layShowHide(k, 'hidden');
			}
		}
	}
	layShowHide(divID, 'visible');
}

// Texteinblenden mit Confirm bei OK zu URL gehen
function delconfirmrelocate(msg,url) {
    var check;
    check = confirm(msg);
	if (check) window.location=url;
}  

// In Tabellenseiten über ein Dot die Session am Leben halten ohne Frames zu benutzen oder sie Seite neuzuladen

var keepAliveCount=0;
var testjens = 0;
function keepSessionAliveLoop(init,sid,path,seconds) {
	if (!sid) sid=session;
	if (!seconds) seconds=19*60;
	//seconds=20;
	if (!path) path="..";

	if (path.indexOf('/') == -1) {
		path += '/';
	}
	
	if (document.images['dbcSessionKeepaliveDot'] && !init) {
		var url=path+'keepalive.php?dbc='+sid+'&image=1&nocache='+Math.random()+'-'+(++keepAliveCount);
		document.images['dbcSessionKeepaliveDot'].src=url;
		//alert('keepalive');
	}
	var evl="keepSessionAliveLoop(0,'"+sid+"','"+path+"',"+seconds+");";
	//alert(evl);
	window.setTimeout(evl,seconds*1000);
}


function changeNavi(value,loc) {
	pos1=loc.indexOf("&lang");
	pos2=loc.indexOf("?lang");
	if (pos2>-1) {
		pos=pos2;
		z="?";
	}
	if (pos1>-1) {
		pos=pos1;
		z="&";
	}
	if (pos>-1) {
		teil=loc.substring(pos,loc.length);
		f=eval(pos+6+value.length);
		teil3=loc.substring(f,loc.length);
		teil2=loc.substring(0,pos);
		ok=str_replace(teil,z+"lang="+value,loc);
		ok=ok+'&'+teil3;
		if (ok) top.parent.navi.location.href=ok;
	}
}

function mnavHandler(menu,level) {
}

function module_searchForm () {
	f = document.forms.module_search;
	needle = f.needle.value;
	rule = f.rule.value;
	
	var ar=f.needle.value.split(" ");
	var nd="";
	var con="";
		
	// Verbindung der Suchwörter ermitteln
	if (f.rule.value) con=f.rule.value;
	if (!con) con="OR";
	
	// Wörter mit Verbindungswort verbinden
	for (i=0; i<ar.length; i++)
	{
		if ((i+1)<ar.length) nd+="'"+ar[i]+"' "+con+" ";
		else nd+="'"+ar[i]+"'";
	}
	f.searchString.value=nd;
	if(f.target && f.target.substring(0, 1) != '_') {
		window.document.iamDaSearchWindow = true;
		if (f.isSearchPopup) {
			f.isSearchPopup.value=1;
		}
		openFreeWindow('',f.target,'','','','','','1',550,500,0,0);
	}
	if (nd) {
		document.forms.module_search.submit();
	}
}

function hilightNavi(no) {
	if(no)
	{
		var reload=0;
		if (parent.frames && parent.frames.frm_mnav) {
			var naviframe=parent.frames.frm_mnav;
			naviframe.setHighlight(no, true);
		} else {
			reload=1;
		}
		if (reload) {
			window.setTimeout('hilightNavi()',750);
		}
	}
}

function onInteractionEvent(e)
{
	if(e)
	{
		var fname = 'onInteraction'+e.toUpperCase();
		eval('if(window.'+fname+') '+fname+'();')
	}
}

function goPopup(url,width,height,abschnitt,scroll) {
        var popupID='popup'+width+'x'+height+'_'+scroll;
        //popupID='test';
        //alert(popupID);
        //alert(scroll);
        if (scroll==1) {
                
                openWin(url+'&dbc='+dbc+abschnitt,width,height,popupID,'menubar=no,toolbar=no,directories=no,status=no,location=no,scrollbars=yes,resizable=no',false);
        } else {
                openWin(url+'&dbc='+dbc+abschnitt,width,height,popupID,'menubar=no,toolbar=no,directories=no,status=no,location=no,scrollbars=no,resizable=no',false);        
        }

}

function getFlash (flashId) {
        if (document.all) {
                if (document.all[flashId]) {
                        return document.all[flashId];
                }
                if (window.opera) {
                        var movie = eval(window.document + flashId);
                        if (movie.SetVariable) {
                                return movie;
                        }
                }
                return;
        }
        if(document.layers) {
                if(document.embeds) {
                        var movie = document.embeds[flashId];
                        if (movie.SetVariable) {
                                return movie;
                        }
                }
                return;
        }
        if (!document.getElementById) {
                return;
        }
        try {
        	var movie = document.getElementById(flashId);
        }
        catch(e) {
        	//alert('Es ist ein Fehler aufgetreten:\n\n' + e + '\n\nflash: ' + flashId);
        }
        if (movie.SetVariable) {
                return movie;
        }
        var movies = movie.getElementsByTagName('embed');
        if (!movies || !movies.length) {
                return;
        }
        movie = movies[0];
        if (movie.SetVariable) {
                return movie;
        }
        return;
}

function setFlashVar (variable, wert, name) {
        if (!name) name='flash';
        //window.document.flash.SetVariable(variable, wert);
        //eval('window.document.' + name + '.SetVariable(variable, wert);');
        
        var movie = getFlash(name);
		if (movie) {
			movie.SetVariable(variable, wert);
		}
}

function printOpeningTag(name, params) {
	var output = '<' + name;
	for (key in params) {
		output += ' ' + key + '="' + params[key] + '"'
	}
	output += '>';
	document.write(output);
}

function printClosingTag(name) {
	var output = '</' + name + '>';
	document.write(output);
}

function printObjectOpeningTag(params) {
	params['classid'] = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
	params['codebase'] = 'https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0';
	printOpeningTag('object', params);
}

function getUrlParams() {
	var search = location.search.substr(1);
	var curPair = null;
	var pairs = search.split('&');
	var params = new Array();
	for (var i=0; i<pairs.length; i++) {
		curPair = pairs[i];
		tmp = curPair.split('=');
		params[tmp[0]] = tmp[1];
	}
	return params;
}

function tellafriend(path, pageID, ID, session) {
	url = path + '/addon/tellafriend/?ID=' + ID + '&' + session + '&pageID=' + pageID + '&link=' + escape(document.location.search);
	openWin(url, 340, 440, 'tellafriend');
}

function getSearchWin (languageid, dbcsessionid, path, f) {
	if (f == null) {
		var f = document.forms.search;
	}
	var needle = f.needle.value;
	var rule = f.rule.value;
	var ar = f.needle.value.split(" ");
	//var clients = f.elements['client\[\]'];
	var clients = [];
	for (var i = 0; i < f.elements.length; i++) {
		if (f.elements[i].name.match(/client\[[0-9]*\]/gi)) {
			clients[clients.length] = f.elements[i];
		}
		
	}
	var nd = '';
	var con = '';
	var url = '';
	var isSearchPopup = 0;
	if (f.isSearchPopup) {
		isSearchPopup = f.isSearchPopup.value;
	}
	
	// Gucken ob von index.php oder von page.php der Aufruf kommt
	lookFor = document.location.href;
	
	if (lookFor.indexOf('?') >= 0) {
		lookForPath = lookFor.substring(0, lookFor.indexOf('?'));
	} else {
		lookForPath = lookFor;
	}
	var lastChar = lookForPath.substring(lookFor.length - 1 , lookFor.length);
	if (lookFor.indexOf('content_manager') == -1 && 
			(lookFor.indexOf('index.php') > 0
			|| lastChar == '/' // direct call to index document, invisible in path
			)
	) {
		url = './content_manager/';
	} 
	
	if (path) {
		url = path;
	}
	
	if (lookFor.indexOf('content_manager') == -1 && lookFor.indexOf('/go/') > -1) {
		if (path) {
			url = path + '/content_manager/';
		} else {
			url = '../../../../content_manager/';
		}
	}	
	
	needle = needle.replace(/%/g, '*');
	if (needle == '*') {
		nd = "'#ANYWORD#'";
	} else {
		// Verbindung der Suchwörter ermitteln
		if (f.rule.value) con = f.rule.value;
		if (!con) con = "OR";
		
		// Wörter mit Verbindungswort verbinden
		/*
		for (i=0; i<ar.length; i++)
		{
			if ((i+1)<ar.length) nd+="'"+ar[i]+"' "+con+" ";
			else nd+="'"+ar[i]+"'";
		}
		*/
		
		var a = 0;
		var s = '';
		for (i=0; i<ar.length; i++)
		{
			var curWord = ar[i];
			if (curWord.length > 2) {
				nd += s + "'" + curWord + "'";
				s = " " + con + " ";
			}
		}
	}
	
	f.searchString.value = nd;
	url += 'page.php';
	url += '?ID=' + languageid;
	url += '&dbc=' + dbcsessionid;
	url += '&mod=communicate';
	url += '&searchString=' + escape(f.searchString.value);
	url += '&needle=' + escape(needle);
	url += '&rule=' + rule;
	url += '&isSearchPopup=' + isSearchPopup;
	if (f.display && f.display.checked) {
		url += '&display=' + f.display.value;
	}
	
	if (clients != undefined && clients.length > 0) {
		for (var i = 0; i < clients.length; i++) {
			if (clients[i].type == 'hidden' || (clients[i].type == 'checkbox' && clients[i].checked)) {
				url += '&client[]=' + clients[i].value;
			}
		}
	}
	
	if (f.target == '_self') {
		location.href = url;
	} else {
		if (f.isSearchPopup) {
			f.isSearchPopup.value=1;
		}
		url += '&isSearchPopup=1';
		window.document.iamDaSearchWindow = true;
		openSearchWindow(url);
	}
	return false;
}

// echt ein scheiss, dass wir die funktionen alle doppelt haben müssen, für front- und backend, :((
function getAbsLeft(el) {
	if (el == undefined || el == null) {
		return 0;
	}
	return (el.offsetParent != undefined || el.offsetParent != null)?el.offsetLeft+getAbsLeft(el.offsetParent):el.offsetLeft;
}

function getAbsTop(el) {
	if (el == undefined || el == null) {
		return 0;
	}
	return (el.offsetParent != undefined || el.offsetParent != null)?el.offsetTop+getAbsTop(el.offsetParent):el.offsetTop;
}

function lockElement(lockElement, lockDivId, text, withInformationIcon) {
	if (lockElement == undefined || lockElement == null) {
		return false;
	}
	if (lockElement.offsetHeight == undefined || lockElement.offsetHeight == null) {
		return false;
	}
	if (lockElement.offsetWidth == undefined || lockElement.offsetWidth == null) {
		return false;
	}
	
	var statusDiv = document.getElementById(lockDivId);
	var statusTd = document.getElementById(lockDivId + 'Td');

	var catX = getAbsTop(lockElement);
	var catY = getAbsLeft(lockElement);

	var catHeight = lockElement.offsetHeight;
	var catWidth = lockElement.offsetWidth;

	statusDiv.style.top = catX;
	statusDiv.style.left = catY;
	statusDiv.style.width = catWidth;
	statusDiv.style.height = catHeight;

	statusDiv.style.filter = "alpha(opacity=75)";
	statusDiv.style.opacity = "0.75";

	if (withInformationIcon) {
		statusTd.innerHTML = "<table width='100%' height='100%' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><table><tr><td class='" + lockDivId + "Icon'>&nbsp;</td><td class='" + lockDivId + "Text'>" + text + "</td></tr></table></td></tr></table>";
	} else {
		statusTd.innerHTML = text;
	}
	statusDiv.style.display = 'block';
	showHideCovered(statusDiv, false);
}

function unlockElement(lockDivId) {
	var statusDiv = document.getElementById(lockDivId);
	statusDiv.style.display = 'none';
	showHideCovered(statusDiv, true);
}

function showHideCovered(el, hidden) {
	if (el == undefined || el == null) {
		return 0;
	}
	if (el.offsetHeight == undefined || el.offsetHeight == null) {
		return false;
	}
	if (el.offsetWidth == undefined || el.offsetWidth == null) {
		return false;
	}
	
	if (!ie) return;
	var tags = new Array("applet", "iframe", "select");

	var EX1 = getAbsLeft(el);
	var EX2 = el.offsetWidth + EX1;
	var EY1 = getAbsTop(el);
	var EY2 = el.offsetHeight + EY1;

	for (var k = tags.length; k > 0; ) {
		var ar = document.getElementsByTagName(tags[--k]);
		var cc = null;

		for (var i = ar.length; i > 0;) {
			cc = ar[--i];

			var CX1 = getAbsLeft(cc);
			var CX2 = cc.offsetWidth + CX1;
			var CY1 = getAbsTop(cc);
			var CY2 = cc.offsetHeight + CY1;

			if (hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
				if (!cc.__msh_save_visibility) {
					if (!cc.style.visibility) {
						cc.style.visibility = 'visible';
					}
					cc.__msh_save_visibility = cc.style.visibility;
				}
				cc.style.visibility = cc.__msh_save_visibility;
			} else {
				if (!cc.__msh_save_visibility) {
					if (!cc.style.visibility) {
						cc.style.visibility = 'visible';
					}
					cc.__msh_save_visibility = cc.style.visibility;
				}
				cc.style.visibility = "hidden";
			}
		}
	}
}
var actionLayer;
var actionTd;

function getWindowWidth() {
	if (self.innerWidth) {
		return self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	} else if (document.body) {
		return document.body.clientWidth;
	}
}

function getWindowHeight() {
	if (self.innerHeight) {
		return self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	} else if (document.body) {
		return document.body.clientHeight;
	}
}

function showActionLayer(itemID, noCheck) {
  	if (document.getElementById) {
    	var actionLayer = document.getElementById('actionLayer' + itemID);
		if (actionLayer) {
			actionTd = document.getElementById('actionTd' + itemID);
			if (noCheck == null || noCheck == false) {
				/* Keine Ahnung was das bewirken soll??? Macht aber alles kaputt!!! (SV)
				checkActionLayer();
				*/
			}
			actionLayer.style.visibility = 'visible';
		}
	}
}

function checkActionLayer() {
	if (actionLayer) {
		actionTdTop = getAbsTop(actionTd);
		actionTdLeft = getAbsLeft(actionTd);
		actionLayerHeight = actionLayer.offsetHeight;
		actionLayerWidth = actionLayer.offsetWidth;
		windowWidth = getWindowWidth();
		windowHeight = getWindowHeight();
		if (windowWidth < (actionTdLeft + actionLayerWidth)) {
			actionLayerLeft = windowWidth - actionLayerWidth;
		} else {
			actionLayerLeft = actionTdLeft;
		}
		if (windowHeight < (actionTdTop + actionLayerHeight)) {
			actionLayerTop = windowHeight - actionLayerHeight;
		} else {
			actionLayerTop = actionTdTop;
		}
		actionLayer.style.top = (actionLayerTop)+17;
		actionLayer.style.left = (actionLayerLeft - 1)+9;
	}
}
		
function hideActionLayer(itemID) {
  	if (document.getElementById) {
    	var actionLayer = document.getElementById('actionLayer' + itemID);
		if (actionLayer) {
			actionLayer.style.visibility = 'hidden';
		}
	}
}

function onLoadActionLayer() {
	if(typeof(al_itemID) != 'undefined') {
		showActionLayer(al_itemID);
	}
}

/*@deprecated*/ 
function cmsLinkElementShowLayer(linkId, divId, layerGroup, hideAll) {
	if (YAHOO.dbcYuiContainer['overlay_' + linkId]) {
		YAHOO.dbcYuiContainer['overlay_' + linkId].show();
	} else {
		document.getElementById('cmsSHLayer-' + divId + '-' + layerGroup).style.visibility = 'visible';
	}
	/*
	if (hideAll && layerGroup) {
		var allLayers = document.getElementsByTagName('DIV');
		
		for (var i = 0; i < allLayers.length; i++) {
			var curLayer = allLayers[i];
			if (curLayer.id.indexOf('cmsSHLayer') !== -1) {
				var group = curLayer.id.substr(curLayer.id.lastIndexOf('-') + 1);	
				if (group == layerGroup) {
					var tmp = curLayer.id.split('-');
					if (tmp[1] != divId) {
						cmsLayerElementHideLayer(tmp[1], layerGroup);
					}
				}
			}
		}
	}
	*/
}

function cmsElementShowLayer(divId, layerGroup, conf, hideAll, skipIds, linkId) {
	if (typeof divId != 'object') {
		var divIds = [divId];
	} else {
		var divIds = divId;
	}
	
	if (typeof layerGroup != 'object') {
		var layerGroups = [layerGroup];
	} else {
		var layerGroups = layerGroup;
	}
	
	if (conf.toggle == undefined || !conf.toggle) {
		conf.toggle = false;
	}
	
	var showHide = true;
	if (conf.toggle) {
		if (linkId != null) {
		var linkEle = cmsLinkElements.byId[linkId];
			if (linkEle != undefined) {
				if (linkEle.active == false) {
					showHide = true;
				} else {
					showHide = false;
				}
				linkEle.active = !linkEle.active;
			}
		}
	}
	
	var useCustomShowFunction = false;
	if (typeof customOnCmsElementShowLayer == 'function') {
		useCustomShowFunction = true;
	}
	
	var groups = [];
	var divIdsByGroup = [];
	var divCount = divIds.length;
	for (var i = 0; i < divCount; i++) {
		if (divIdsByGroup[layerGroups[i]] == undefined) {
			divIdsByGroup[layerGroups[i]] = [];
		}
		groups[layerGroups[i]] = true;
		divIdsByGroup[layerGroups[i]][divIds[i]] = true;
		
		if (showHide) {
			cmsElementShowHideLayer('show', divIds[i], layerGroups[i], conf, hideAll);
			if (useCustomShowFunction) {
				customOnCmsElementShowLayer(divIds[i], layerGroups[i], conf, hideAll, skipIds, linkId);
			}
		} else {
			cmsElementHideLayer(divIds[i], layerGroups[i], conf);
		}
	}
	
	if (hideAll && showHide) {
		var useCustomFunction = false;
		if (typeof customOnCmsElementHideLayer == 'function') {
			useCustomFunction = true;
		}
		var allLayers = document.getElementsByTagName('DIV');
		
		if (skipIds == null) {
			skipIds = [];
		}
		
		var skipIdsOpt = new Array();
		for (var k = 0; k < skipIds.length; k++) {
			skipIdsOpt[skipIds[k]] = true;
		}
		conf.hideAll = true;
		for (var i = 0; i < allLayers.length; i++) {
			var curLayer = allLayers[i];
			if (curLayer.id.indexOf('cmsSHLayer') !== -1) {
				var curGroup = curLayer.id.substr(curLayer.id.lastIndexOf('-') + 1);	
				if (groups[curGroup]) {
					var tmp = curLayer.id.split('-');
					if (!divIdsByGroup[curGroup][tmp[1]] && !skipIdsOpt[tmp[1]]) {						
						cmsElementHideLayer(tmp[1], curGroup, conf);
						if (useCustomFunction) {
							customOnCmsElementHideLayer(tmp[1], curGroup, conf);
						}
					}
				}
			}
		}
	}
}

function cmsElementHideLayer(divId, layerGroup, effectConf, options) {
	if (typeof divId != 'object') {
		var divIds = [divId];
	} else {
		var divIds = divId;
	}
	
	if (typeof layerGroup != 'object') {
		var layerGroups = [layerGroup];
	} else {
		var layerGroups = layerGroup;
	}
	
	var divCount = divIds.length;
	for (var a = 0 ; a < divCount; a++) {
		var linkElements = cmsLinkElements.byLayerId[divIds[a]];
		if (linkElements != undefined) {
			for (var i = 0; i < linkElements.length; i++) {
				linkElements[i].active = false;
			}
		}
		cmsElementShowHideLayer('hide', divIds[a], layerGroups[a], effectConf);
		if (typeof customOnCmsElementHideLayer == 'function') {
			customOnCmsElementHideLayer(divIds[a], layerGroups[a], effectConf, options);
		}
	}
}

function cmsElementShowHideLayer(action, divId, layerGroup, effectConf, hideAll) {
	var container = document.getElementById('cmsSHLayer-' + divId + '-' + layerGroup);
	if (container != undefined && effectConf.effect && effectConf.effect != '-1') {
		if (effectConf.duration == undefined || !effectConf.duration) {
			effectConf.duration = 1;
		}
		
		var myOverlay = new YAHOO.widget.Overlay(
			'cmsSHLayer-' + divId + '-' + layerGroup,
			{
				visible: false,
				iframe: false
			}
		);
		
		var containerEffect = new YAHOO.widget.ContainerEffect[effectConf.effect](
			myOverlay,
			effectConf.duration
		);
		
		if (action == 'show') {
			container.style.display = 'block';
			containerEffect.animateIn();
		} else if (action == 'hide') {
			containerEffect.animOut.onComplete.subscribe(
				function() {
					container.style.display = 'none';
				},
				containerEffect
			);
	
			containerEffect.animateOut();
		}
	} else {
		if (action == 'show') {
			container.style.visibility = 'visible';
			container.style.display = 'block';
		} else if (action == 'hide') {
			container.style.visibility = 'hidden';
			container.style.display = 'none';
		}
	}
}

function jumpTo(flashID, num) {
	setFlashVar('jumpTo', num, flashID);
}

// Kalender im Pagefooter anzeigen
// by DR

function showCalenderInPage (){
	var div = document.getElementById('calenderExistsTrue');
	if (div != undefined) {
            showEventCalender();
	}
}

function cmsElementPlayFlash(flashId) {
	// workaround: wenn flash direkt abgespielt
	// wird klappt es im firefox nicht, wenn das flash
	// voher erst sichbar gemacht wird (display: block)
	window.setTimeout(
		function () {
			if (cmsFlashAlreadyPlayed[flashId] != true) {
				var flash = getFlash(flashId);
				flash.Play();
				cmsFlashAlreadyPlayed[flashId] = true;
			}
		},
		0
	);
}

function onClickHotspotLayerClose(hotspotId) {
	var hotspotFlashId = hotspotFlashIds[hotspotId];
	if (hotspotFlashId != undefined) {
		var flashId = 'hotspotFlash-' + hotspotFlashId;
		setFlashVar('unhiliteAll', 1, flashId);
	}
}

function in_array(value, array) {
	for(var i = 0; i < array.length; i++) {
		if(array[i] == value) return true;
	}
	return false;
}

function rewindFlash(flashId) {
	if (typeof flashId != 'object') {
		var flashIds = [flashId];
	} else {
		var flashIds = flashId;
	}
	
	for (var i = 0; i < flashIds.length; i++) {
		if (document.getElementById(flashIds[i]) != undefined) {
			var flash = getFlash(flashIds[i]);
			//alert(flash);
			if (flash != undefined) {
				// alert(flash);
				flash.Rewind();
			}
		}
	}
}

function addCmsLayerElement(element) {
	cmsLayerElements.byId[element.id] = element;
	if (cmsLayerElements.byGroup[element.group] == undefined) {
		cmsLayerElements.byGroup[element.group] = [element];
	} else {
		cmsLayerElements.byGroup[element.group].push(element);
	}
}

function addCmsLinkElement(element) {
	cmsLinkElements.byId[element.id] = element;
	if (cmsLinkElements.byGroup[element.group] == undefined) {
		cmsLinkElements.byGroup[element.group] = [element];
	} else {
		cmsLinkElements.byGroup[element.group].push(element);
	}
	
	for (var i = 0; i < element.layerIds.length; i++) {
		if (cmsLinkElements.byLayerId[element.layerIds[i]] == undefined) {
			cmsLinkElements.byLayerId[element.layerIds[i]] = [element];
		} else {
			cmsLinkElements.byLayerId[element.layerIds[i]].push(element);
		}
	}
}

function selectOption(selectField, option) {
	for (var i = 0; i < selectField.options.length; i++) {
		if (selectField.options[i].value == option) {
			selectField.selectedIndex = i;
			break;
		}
	}
}

function getCheckedRadio(radios) {
	for (var i = 0; i < radios.length; i++) {
		if (radios[i].checked == true) {
			return radios[i];
		}
	}
}

function getSpanWidth(span) {
	var childs = span.childNodes;
	var width = 0;
	
	if (span.tagName != 'SPAN') {
		width = span.offsetWidth;
	} else {
		width = span.offsetWidth;
		for (var i = 0; i < childs.length; i++) {
			var child = childs[i];
			var sw = getSpanWidth(child);
			if (sw > width) {
				width = sw;
			}
		}
	}
	
	return width;
}

function getSpanHeight(span) {
	var childs = span.childNodes;
	var height = 0;
	
	if (span.tagName != 'SPAN') {
		height = span.offsetHeight;
	} else {
		height = span.offsetHeight;
		for (var i = 0; i < childs.length; i++) {
			var child = childs[i];
			var sh = getSpanHeight(child);
			if (sh > height) {
				height = sh;
			}
		}
	}
	return height;
}


/**
  * adds an the passed function to the specified object as event
  *
  * Wed Oct 17 18:34:19 CEST 2007
  * @author j.dieckmann@db-central.com
  *
  * @param string eventName
  * @param object object
  * @param function func
  * @param boolean flag
*/
function dbcAddEvent(eventName, object, func, flag) {
	if (object.addEventListener) {
		if (flag == null) {
			flag = false;
		}
		object.addEventListener(eventName, func, flag);
	} else {
		object.attachEvent('on' + eventName, func);
	}
}

if (typeof Ext != 'undefined') {
	var dbcExtLayer = {
		
		stack: {},
		
		load: function(layerId, params, callback, forceLayer) {
			var fn = function() {
				if (typeof params != 'object') {
					params = {};
				}
				if (params['modal'] == undefined) {
					params['modal'] = false;
				}
				if (params['width'] == undefined) {
					params['width'] = 350;
				}
				if (params['height'] == undefined) {
					params['height'] = 400;
				}
				if (params['autoCreate'] == undefined) {
					params['autoCreate'] = true;
				}
				if (params['shadow'] == undefined) {
					params['shadow'] = true;
				}
				if (params['proxyDrag'] == undefined) {
					params['proxyDrag'] = true;
				}
				if (params['minWidth'] == undefined) {
					params['minWidth'] = params['width'];
				}
				if (params['minHeight'] == undefined) {
					params['minHeight'] = params['height'];
				}
				if (params['collapsible'] == undefined) {
					params['collapsible'] = false;
				}
				if (params['title'] == undefined) {
					params['title'] = '&nbsp;';
				}
				this.stack[layerId] = new Ext.BasicDialog(layerId, params);
				this.stack[layerId].addKeyListener(27, this.stack[layerId].hide, this.stack[layerId]); // ESC can also close the dialog
				if (typeof callback == 'function') {
					callback.call(this, this.stack[layerId]);
				}
			};
			if (forceLayer != undefined) {
				fn.call(this);
			} else {
				Ext.onReady(fn, this);
			}
		},
		
		get: function(layerId) {
			if (this.stack[layerId] == undefined) {
				return null;
			}
			return this.stack[layerId];
		},
		
		showWithIframe: function(layerId, url, title, params) {
			var fn = function(layer) {
				layer.purgeListeners();
				while(layer.body.dom.childNodes.length > 0) {
					Ext.get(layer.body.dom.firstChild).removeAllListeners();
					Ext.get(layer.body.dom.firstChild).remove();
				}
				layer.addKeyListener(27, layer.hide, layer); // ESC can also close the dialog
				var iframe = this.createIframe(layer);
				/*
				
				layer.body.dom.appendChild(iframe);
				*/
				var fitIframe = function() {
					Ext.get(iframe).fitToParent();
				}
				layer.on('resize', fitIframe, this);
				layer.on('show', fitIframe, this);
				layer.show();
				iframe.src = url;
				if (title != undefined) {
					layer.setTitle(title);
				}
			};
			if (this.stack[layerId] == undefined) {
				this.load(layerId, params, fn);
			} else {
				fn.call(this, this.stack[layerId]);
			}
		},
		
		createIframe: function (layer, layerId) {
			var replaceDiv = document.createElement('div');
			layer.body.dom.appendChild(replaceDiv);
			var template = new Ext.Template('<iframe id="' + layerId + 'Iframe" src="about:blank" frameborder="0" width="100%" height="100%" scrolling="auto"></iframe>');
			template.overwrite(replaceDiv, {});
			/*
			var iframe = document.createElement('iframe');
			iframe.setAttribute('frameborder', '0');
			iframe.setAttribute('id', layerId + 'Iframe');
			*/
			return document.getElementById(layerId + 'Iframe');
		},
		
		hide: function (layerId) {
			var layer = this.get(layerId);
			if (layer != null) {
				layer.hide();
			}
		}
		
		
	};
}

function getHexCodeForColor(cname) {
	
	var htmlColorNames = new Array();
	htmlColorNames[htmlColorNames.length] = 'aliceblue';
	htmlColorNames[htmlColorNames.length] = 'antiquewhite';
	htmlColorNames[htmlColorNames.length] = 'aquamarine';
	htmlColorNames[htmlColorNames.length] = 'azure';
	htmlColorNames[htmlColorNames.length] = 'beige';
	htmlColorNames[htmlColorNames.length] = 'blueviolet';
	htmlColorNames[htmlColorNames.length] = 'brown';
	htmlColorNames[htmlColorNames.length] = 'burlywood';
	htmlColorNames[htmlColorNames.length] = 'cadetblue';
	htmlColorNames[htmlColorNames.length] = 'chartreuse';
	htmlColorNames[htmlColorNames.length] = 'chocolate';
	htmlColorNames[htmlColorNames.length] = 'coral';
	htmlColorNames[htmlColorNames.length] = 'cornflowerblue';
	htmlColorNames[htmlColorNames.length] = 'cornsilk';
	htmlColorNames[htmlColorNames.length] = 'crimson';
	htmlColorNames[htmlColorNames.length] = 'darkblue';
	htmlColorNames[htmlColorNames.length] = 'darkcyan';
	htmlColorNames[htmlColorNames.length] = 'darkgoldenrod';
	htmlColorNames[htmlColorNames.length] = 'darkgray';
	htmlColorNames[htmlColorNames.length] = 'darkgreen';
	htmlColorNames[htmlColorNames.length] = 'darkkhaki';
	htmlColorNames[htmlColorNames.length] = 'darkmagenta';
	htmlColorNames[htmlColorNames.length] = 'darkolivegreen';
	htmlColorNames[htmlColorNames.length] = 'darkorange';
	htmlColorNames[htmlColorNames.length] = 'darkorchid';
	htmlColorNames[htmlColorNames.length] = 'darkred';
	htmlColorNames[htmlColorNames.length] = 'darksalmon';
	htmlColorNames[htmlColorNames.length] = 'darkseagreen';
	htmlColorNames[htmlColorNames.length] = 'darkslateblue';
	htmlColorNames[htmlColorNames.length] = 'darkslategray';
	htmlColorNames[htmlColorNames.length] = 'darkturquoise';
	htmlColorNames[htmlColorNames.length] = 'darkviolet';
	htmlColorNames[htmlColorNames.length] = 'deeppink';
	htmlColorNames[htmlColorNames.length] = 'deepskyblue';
	htmlColorNames[htmlColorNames.length] = 'dimgray';
	htmlColorNames[htmlColorNames.length] = 'dodgerblue';
	htmlColorNames[htmlColorNames.length] = 'firebrick';
	htmlColorNames[htmlColorNames.length] = 'floralwhite';
	htmlColorNames[htmlColorNames.length] = 'forestgreen';
	htmlColorNames[htmlColorNames.length] = 'gainsboro';
	htmlColorNames[htmlColorNames.length] = 'ghostwhite';
	htmlColorNames[htmlColorNames.length] = 'gold';
	htmlColorNames[htmlColorNames.length] = 'goldenrod';
	htmlColorNames[htmlColorNames.length] = 'greenyellow';
	htmlColorNames[htmlColorNames.length] = 'honeydew';
	htmlColorNames[htmlColorNames.length] = 'hotpink';
	htmlColorNames[htmlColorNames.length] = 'indianred';
	htmlColorNames[htmlColorNames.length] = 'indigo';
	htmlColorNames[htmlColorNames.length] = 'ivory';
	htmlColorNames[htmlColorNames.length] = 'khaki';
	htmlColorNames[htmlColorNames.length] = 'lavender';
	htmlColorNames[htmlColorNames.length] = 'lavenderblush';
	htmlColorNames[htmlColorNames.length] = 'lawngreen';
	htmlColorNames[htmlColorNames.length] = 'lemonchiffon';
	htmlColorNames[htmlColorNames.length] = 'lightblue';
	htmlColorNames[htmlColorNames.length] = 'lightcoral';
	htmlColorNames[htmlColorNames.length] = 'lightcyan';
	htmlColorNames[htmlColorNames.length] = 'lightgoldenrodyellow';
	htmlColorNames[htmlColorNames.length] = 'lightgreen';
	htmlColorNames[htmlColorNames.length] = 'lightgrey';
	htmlColorNames[htmlColorNames.length] = 'lightpink';
	htmlColorNames[htmlColorNames.length] = 'lightsalmon';
	htmlColorNames[htmlColorNames.length] = 'lightseagreen';
	htmlColorNames[htmlColorNames.length] = 'lightskyblue';
	htmlColorNames[htmlColorNames.length] = 'lightslategray';
	htmlColorNames[htmlColorNames.length] = 'lightsteelblue';
	htmlColorNames[htmlColorNames.length] = 'lightyellow';
	htmlColorNames[htmlColorNames.length] = 'limegreen';
	htmlColorNames[htmlColorNames.length] = 'linen';
	htmlColorNames[htmlColorNames.length] = 'mediumaquamarine';
	htmlColorNames[htmlColorNames.length] = 'mediumblue';
	htmlColorNames[htmlColorNames.length] = 'mediumorchid';
	htmlColorNames[htmlColorNames.length] = 'mediumpurple';
	htmlColorNames[htmlColorNames.length] = 'mediumseagreen';
	htmlColorNames[htmlColorNames.length] = 'mediumslateblue';
	htmlColorNames[htmlColorNames.length] = 'mediumspringgreen';
	htmlColorNames[htmlColorNames.length] = 'mediumturquoise';
	htmlColorNames[htmlColorNames.length] = 'mediumvioletred';
	htmlColorNames[htmlColorNames.length] = 'midnightblue';
	htmlColorNames[htmlColorNames.length] = 'mintcream';
	htmlColorNames[htmlColorNames.length] = 'mistyrose';
	htmlColorNames[htmlColorNames.length] = 'moccasin';
	htmlColorNames[htmlColorNames.length] = 'navajowhite';
	htmlColorNames[htmlColorNames.length] = 'oldlace';
	htmlColorNames[htmlColorNames.length] = 'olivedrab';
	htmlColorNames[htmlColorNames.length] = 'orange';
	htmlColorNames[htmlColorNames.length] = 'orangered';
	htmlColorNames[htmlColorNames.length] = 'orchid';
	htmlColorNames[htmlColorNames.length] = 'palegoldenrod';
	htmlColorNames[htmlColorNames.length] = 'palegreen';
	htmlColorNames[htmlColorNames.length] = 'paleturquoise';
	htmlColorNames[htmlColorNames.length] = 'palevioletred';
	htmlColorNames[htmlColorNames.length] = 'papayawhip';
	htmlColorNames[htmlColorNames.length] = 'peachpuff';
	htmlColorNames[htmlColorNames.length] = 'peru';
	htmlColorNames[htmlColorNames.length] = 'pink';
	htmlColorNames[htmlColorNames.length] = 'plum';
	htmlColorNames[htmlColorNames.length] = 'powderblue';
	htmlColorNames[htmlColorNames.length] = 'rosybrown';
	htmlColorNames[htmlColorNames.length] = 'royalblue';
	htmlColorNames[htmlColorNames.length] = 'saddlebrown';
	htmlColorNames[htmlColorNames.length] = 'salmon';
	htmlColorNames[htmlColorNames.length] = 'sandybrown';
	htmlColorNames[htmlColorNames.length] = 'seagreen';
	htmlColorNames[htmlColorNames.length] = 'seashell';
	htmlColorNames[htmlColorNames.length] = 'sienna';
	htmlColorNames[htmlColorNames.length] = 'skyblue';
	htmlColorNames[htmlColorNames.length] = 'slateblue';
	htmlColorNames[htmlColorNames.length] = 'slategray';
	htmlColorNames[htmlColorNames.length] = 'snow';
	htmlColorNames[htmlColorNames.length] = 'springgreen';
	htmlColorNames[htmlColorNames.length] = 'steelblue';
	htmlColorNames[htmlColorNames.length] = 'tan';
	htmlColorNames[htmlColorNames.length] = 'thistle';
	htmlColorNames[htmlColorNames.length] = 'tomato';
	htmlColorNames[htmlColorNames.length] = 'turquoise';
	htmlColorNames[htmlColorNames.length] = 'violet';
	htmlColorNames[htmlColorNames.length] = 'wheat';
	htmlColorNames[htmlColorNames.length] = 'whitesmoke';
	htmlColorNames[htmlColorNames.length] = 'yellowgreen';
	htmlColorNames[htmlColorNames.length] = 'black';
	htmlColorNames[htmlColorNames.length] = 'maroon';
	htmlColorNames[htmlColorNames.length] = 'green';
	htmlColorNames[htmlColorNames.length] = 'olive';
	htmlColorNames[htmlColorNames.length] = 'navy';
	htmlColorNames[htmlColorNames.length] = 'purple';
	htmlColorNames[htmlColorNames.length] = 'teal';
	htmlColorNames[htmlColorNames.length] = 'silver';
	htmlColorNames[htmlColorNames.length] = 'gray';
	htmlColorNames[htmlColorNames.length] = 'red';
	htmlColorNames[htmlColorNames.length] = 'lime';
	htmlColorNames[htmlColorNames.length] = 'yellow';
	htmlColorNames[htmlColorNames.length] = 'blue';
	htmlColorNames[htmlColorNames.length] = 'fuchsia';
	htmlColorNames[htmlColorNames.length] = 'aqua';
	htmlColorNames[htmlColorNames.length] = 'white';
	
	var htmlColorNamesHex = new Array();
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F0F8FF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FAEBD7';
	htmlColorNamesHex[htmlColorNamesHex.length] = '7FFFD4';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F0FFFF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F5F5DC';
	htmlColorNamesHex[htmlColorNamesHex.length] = '8A2BE2';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'A52A2A';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DEB887';
	htmlColorNamesHex[htmlColorNamesHex.length] = '5F9EA0';
	htmlColorNamesHex[htmlColorNamesHex.length] = '7FFF00';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'D2691E';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF7F50';
	htmlColorNamesHex[htmlColorNamesHex.length] = '6495ED';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFF8DC';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DC143C';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00008B';
	htmlColorNamesHex[htmlColorNamesHex.length] = '008B8B';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'B8860B';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'A9A9A9';
	htmlColorNamesHex[htmlColorNamesHex.length] = '006400';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'BDB76B';
	htmlColorNamesHex[htmlColorNamesHex.length] = '8B008B';
	htmlColorNamesHex[htmlColorNamesHex.length] = '556B2F';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF8C00';
	htmlColorNamesHex[htmlColorNamesHex.length] = '9932CC';
	htmlColorNamesHex[htmlColorNamesHex.length] = '8B0000';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'E9967A';
	htmlColorNamesHex[htmlColorNamesHex.length] = '8FBC8F';
	htmlColorNamesHex[htmlColorNamesHex.length] = '483D8B';
	htmlColorNamesHex[htmlColorNamesHex.length] = '2F4F4F';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00CED1';
	htmlColorNamesHex[htmlColorNamesHex.length] = '9400D3';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF1493';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00BFFF';
	htmlColorNamesHex[htmlColorNamesHex.length] = '696969';
	htmlColorNamesHex[htmlColorNamesHex.length] = '1E90FF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'B22222';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFAF0';
	htmlColorNamesHex[htmlColorNamesHex.length] = '228B22';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DCDCDC';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F8F8FF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFD700';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DAA520';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'ADFF2F';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F0FFF0';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF69B4';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'CD5C5C';
	htmlColorNamesHex[htmlColorNamesHex.length] = '4B0082';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFFF0';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F0E68C';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'E6E6FA';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFF0F5';
	htmlColorNamesHex[htmlColorNamesHex.length] = '7CFC00';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFACD';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'ADD8E6';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F08080';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'E0FFFF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FAFAD2';
	htmlColorNamesHex[htmlColorNamesHex.length] = '90EE90';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'D3D3D3';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFB6C1';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFA07A';
	htmlColorNamesHex[htmlColorNamesHex.length] = '20B2AA';
	htmlColorNamesHex[htmlColorNamesHex.length] = '87CEFA';
	htmlColorNamesHex[htmlColorNamesHex.length] = '778899';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'B0C4DE';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFFE0';
	htmlColorNamesHex[htmlColorNamesHex.length] = '32CD32';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FAF0E6';
	htmlColorNamesHex[htmlColorNamesHex.length] = '66CDAA';
	htmlColorNamesHex[htmlColorNamesHex.length] = '0000CD';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'BA55D3';
	htmlColorNamesHex[htmlColorNamesHex.length] = '9370DB';
	htmlColorNamesHex[htmlColorNamesHex.length] = '3CB371';
	htmlColorNamesHex[htmlColorNamesHex.length] = '7B68EE';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00FA9A';
	htmlColorNamesHex[htmlColorNamesHex.length] = '48D1CC';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'C71585';
	htmlColorNamesHex[htmlColorNamesHex.length] = '191970';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F5FFFA';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFE4E1';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFE4B5';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFDEAD';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FDF5E6';
	htmlColorNamesHex[htmlColorNamesHex.length] = '6B8E23';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFA500';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF4500';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DA70D6';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'EEE8AA';
	htmlColorNamesHex[htmlColorNamesHex.length] = '98FB98';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'AFEEEE';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DB7093';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFEFD5';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFDAB9';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'CD853F';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFC0CB';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'DDA0DD';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'B0E0E6';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'BC8F8F';
	htmlColorNamesHex[htmlColorNamesHex.length] = '4169E1';
	htmlColorNamesHex[htmlColorNamesHex.length] = '8B4513';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FA8072';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F4A460';
	htmlColorNamesHex[htmlColorNamesHex.length] = '2E8B57';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFF5EE';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'A0522D';
	htmlColorNamesHex[htmlColorNamesHex.length] = '87CEEB';
	htmlColorNamesHex[htmlColorNamesHex.length] = '6A5ACD';
	htmlColorNamesHex[htmlColorNamesHex.length] = '708090';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFAFA';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00FF7F';
	htmlColorNamesHex[htmlColorNamesHex.length] = '4682B4';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'D2B48C';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'D8BFD8';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF6347';
	htmlColorNamesHex[htmlColorNamesHex.length] = '40E0D0';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'EE82EE';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F5DEB3';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'F5F5F5';
	htmlColorNamesHex[htmlColorNamesHex.length] = '9ACD32';
	htmlColorNamesHex[htmlColorNamesHex.length] = '000000';
	htmlColorNamesHex[htmlColorNamesHex.length] = '800000';
	htmlColorNamesHex[htmlColorNamesHex.length] = '008000';
	htmlColorNamesHex[htmlColorNamesHex.length] = '808000';
	htmlColorNamesHex[htmlColorNamesHex.length] = '000080';
	htmlColorNamesHex[htmlColorNamesHex.length] = '800080';
	htmlColorNamesHex[htmlColorNamesHex.length] = '008080';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'C0C0C0';
	htmlColorNamesHex[htmlColorNamesHex.length] = '808080';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF0000';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00FF00';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFF00';
	htmlColorNamesHex[htmlColorNamesHex.length] = '0000FF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FF00FF';
	htmlColorNamesHex[htmlColorNamesHex.length] = '00FFFF';
	htmlColorNamesHex[htmlColorNamesHex.length] = 'FFFFFF';
	
	for (var i = 0; i < htmlColorNames.length; i++) {
		if (htmlColorNames[i] == cname) {
			return '#' + htmlColorNamesHex[i];
		}
	}
	return false;
}


//-->	

