/*
changelogs:
	21042005 pr
		infopopup jetzt mit Fenster Eigenschaften, abwaertskompatibel [startseiteRedesign042005]
	03062005 pr
		infopopup Breite d. gelber Strichts v. 90% auf 95% erhoeht, da rechts zu schmal	
	14062005 pr
		checkboxCtrl Funktion bekommt jetzt optional noch den Stil mitgegeben, bei coba wird dann das Standard Popup Fenster geoeffnet [01072005COMVIA]	
	30062005 pr
		rechter Rand f. infopopup , Demo layoutstil ebenfalls analog coba beim Infopopup	
	13022006 pr
		locator funktion ueberarbeitet, damit sie auch in einem Popup laeuft	
*/

// Beim Schliessen des Framesets die Session beenden
function ipFinish(){
	//this.appversion = navigator.appVersion;			        //Version string
	//this.dom=document.getElementById?1:0			                //w3-dom
	//shref=this.location.href;
	//this.location.href="registration/logout.cfm";
	//if(this.dom && this.appversion.indexOf("MSIE ") == -1){
		//this.location.href=shref;
	//}
	//F1 = window.open("registration/kill_session.cfm", "action_frame", "width=1,height=1,left=0,top=0");
	//15032007 pr funktionierte nicht, da es den Parameter nur im alten extranet index gab:
	//if(typeof top.newLogin != "undefined"){
	//	if(top.newLogin == 0){
	//		top.action_frame.location.href="registration/kill_session.cfm";
	//	}
	// }
	top.action_frame.location.href="registration/kill_session.cfm";
}

// Beim Schliessen des ETT-Fensters die Session beenden
function kill_ett_session(){
	alert('1');
	opener.action_frame.location.href="registration/kill_ett_session.cfm";
	alert('2');
}

// test:
function myAlert(message) {
  if (message != "") alert(message);
}	

// open a new Window:
function newWin(url,windowname,window_apperance) {
  if (url == null) url = '';
  if (windowname == null) windowname = '_blank';
  if (window_apperance == null || window_apperance == '') window_apperance = 'left=250,top=150,height=500,width=520,scrollbars=yes,menubar=no,resizable=yes,toolbar=no,location=no';
  // newwindow = open(url,windowname,window_apperance); 05042004 pr start:
  
  // NS4.7 evtl. Probleme beim Aufruf eines anderen Rahmen des selben Frames
  if ((window.name!=windowname) && (windowname!='_self'))
  	newwindow = open(url,windowname,window_apperance);
  else
  	this.location.href=url;		
  // 05042004 pr ende	
}	

//oefnet ein selbstschliessendes Hilfsfenster, eigene Instanz wird fuer check_lexis_nexis  - s.u. -benoetigt
function helperWin(url,windowname) {
  if (url == null) url = '';
  if (windowname == null) windowname = '_blank';
  window_apperance = 'height=1,width=1,scrollbars=no,menubar=no,resizable=no,toolbar=no,location=no';
  if ((window.name!=windowname) && (windowname!='_self'))
  	hwindow = window.open(url,windowname,window_apperance);
  else
  	this.location.href=url;		
}	

//checked den Zustand des Hilfsfensters
function check_lexis_nexis(){
 if(typeof top.window.hwindow != 'undefined'){
  if(top.window.hwindow.closed == true){
       //alert("Connection established");
       return true;
  }
  else{
       alert("Connection not yet established, please try again");
       return false;
  }
 }
}

// close the window, optionally show message and/or refresh calling page:
function CloseWindow(message,bReload) {
  window.onerror = errorcheck;
  if (message == null) message="";
  if (bReload == null) bReload = true;
  if (bReload) { 
    if (self.opener != null) {
	    // standard refresh of calling page via ...
		// (a) self.opener.location.reload(true): RE-POST of DATA is possible, but there might be "page has to be reloaded"-warning
		// (b) self.opener.location = self.opener.location: just a new HTTP-Get, no RE-POST of DATA, but no warning either
	    // 25062007 pr: self.opener.location = self.opener.location; funktioniert aber nicht weder unter IE noch unter Firefox!!
		self.opener.location.reload(true);
	}
  }	
  if (message != "") alert(message);
  self.close();
} 

// error-handling (low level ;-)
function errorcheck() {
  if (window.opener != null) window.close();
  return true;
}	

// set the URL (=href) for a anker tag:
function setURL(anker,string,hrefPre,hrefPos,bConfirm,message) {
  newHREF = "";
  if (bConfirm == null) bConfirm = false;
  if (message == null) message = 'Are you sure?';
  if (hrefPre != null) newHREF = hrefPre;
  if (string != null) newHREF = newHREF + escape(string);	
  if (hrefPos != null) newHREF = newHREF + hrefPos;
  anker.href = newHREF;
  if (bConfirm) return confirm(message);
  else return true;
}

// set the value of a form-field in another window:
function sendToCaller(string,formname,fieldname) {
  window.onerror = errorcheck;
  control = window.opener.document[formname][fieldname];
  if (control != null) {
    control.value = string; 
  }	
  window.close();
}

// resetting the multiselect-SelectBOX "on button click":
function resetSelectBox(selectbox) {
	opts = selectbox.options;
	for (i = 0; i < opts.length; i++)
	  if (opts[i].defaultSelected)
	    {opts[i].selected = true;}
	  else
	    {opts[i].selected = false;}
}

// selecting all entries of a multiselect-SelectBOX "on button click":
function selectAllSelectBox(selectbox) {
	opts = selectbox.options;
	for (i = 0; i < opts.length; i++)
      opts[i].selected = true;
}

// DATE-validation:
function dateValidate(sDate,sMask,sDelimiter,sErrorMessage){
	if (sErrorMessage == null) sErrorMessage = "Invalid Date Entry.";
	bSuccess = false;
    stDateParts = new Object();
 	if ((sMask.length == 3) && (sDelimiter.length == 1)) {
 	  iFirstPos = sDate.indexOf(sDelimiter);
	  iLastPos  = sDate.indexOf(sDelimiter, iFirstPos+1);
	  stDateParts[sMask.charAt(0).toUpperCase()]= sDate.substring(0, iFirstPos);
	  stDateParts[sMask.charAt(1).toUpperCase()]= sDate.substring(iFirstPos + 1, iLastPos);	
	  stDateParts[sMask.charAt(2).toUpperCase()]= sDate.substring(iLastPos + 1, sDate.length);	
	  day = stDateParts.D;
	  month = stDateParts.M;
	  year = stDateParts.Y;
	  if ((year != null)&&(year.length > 0)&&(year.length < 5)&&
	  	  (month != null)&&(month.length > 0)&&(month.length < 3)&&
		  (day != null)&&(day.length > 0)&&(day.length < 3)) {
		if ((year > 0) && (year < 10000)) {
		  if ((month > 0) && (month < 13)) {
		    if ((day > 0) && (day < 32)) {		    
			  if ((month == 4) || (month == 6) ||(month == 9) ||(month == 11)) {
			    if (day < 31) {
				  bSuccess = true;
				}  
			  }
			  else if (month == 2){
				if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
			      if (day < 30) {
				    bSuccess = true;				  
				  }	
				}  
				else {
			      if (day < 29) {
				    bSuccess = true;				  				  
				  }	
				}  
			  }
			  else {
			  	bSuccess = true;
			  }	
		    }
		  }  
		}
	  }	
	}
	if ((bSuccess == false) && (sErrorMessage != "")) alert(sErrorMessage);
	return bSuccess;
}		

// mandatory INPUT-field:
function mandatoryInput(control,name,message) {
  if (control == null) return;
  if (name == null) name=control.name;
  if (message == null) message="mandatory input";
  if (control.value == '' || control.value.charAt(0) == ' ') {
     if (message != "") alert( message + ' (' + name + ')' );
	 control.focus();
  }	 
} 

// append (navigation-)information to an ANKER's HREF-attribute
// from the GLOBAL jsUIC-object:
var jsUIC; // filled via "UIController-Data" inside gbformatting.cfm

function appendNodeIDsToURL(myAnker) {
  if ((jsUIC != null) && (myAnker != null) && (myAnker.href != null)) {
    myURL = myAnker.href;
	if (jsUIC.CategoryNodeID != null) {
      myURL = myURL + '&CategoryNodeID=' + jsUIC.CategoryNodeID;
	}
	if (jsUIC.MenuNodeID != null) {
      myURL = myURL + '&MenuNodeID=' + jsUIC.MenuNodeID;
	}
    myAnker.href =  myURL;
  }
  return true;
}  


// array filled while building page in browser when using dynamic navigation (gbNavigator)
// used by gbInitialize() to initialize all navigator layers
var NavigatorInitData = new Array();

// general initialization function, called by body's onload event
// here you can add functionality which will be executed after building the page
function gbInitialize() {
	// initializiation of dynamic navigation (if enabled)
	for(i = 0; i < NavigatorInitData.length; i++) {
		InitNavigationLayer(NavigatorInitData[i][0], NavigatorInitData[i][1]);
	}
	// add further functionality here
}

// Change selection in a select control depending on the text-property
function changefiliale(wert){
	for(i=0;i<document.suchform.filiale.length;i++){
		if(document.suchform.filiale.options[i].text == wert) {
			document.suchform.filiale.selectedIndex=i;
		}
	}
}

// Builds the confirm Popup:
function buildConfirmPopup(imagedir,style,titel,frage,buttonAction1,buttonValue1,buttonAction2,buttonValue2,buttonAction3,buttonValue3){
	if(buttonAction1 == null) buttonAction1 = '';
	if(buttonValue1 == null) buttonValue1 = '';
	if(buttonAction2 == null) buttonAction2 = '';
	if(buttonValue2 == null) buttonValue2 = '';
	if(buttonAction3 == null) buttonAction3 = '';
	if(buttonValue3 == null) buttonValue3 = '';
	if(style.indexOf("~") != -1){
		bSkillInfo=1;
		style=style.slice(style.indexOf("~")+1);
	}
	else{
		bSkillInfo=0;		
	}
	vConfirmPopup.document.open();
	// Setup the page...
	with (vConfirmPopup.document) {
		writeln("<html>");
		writeln("<head><title>"+titel+"</title>");
		writeln("<link rel='STYLESHEET' type='text/css' href='"+style+"'>");
		writeln("<script type=\"text/javascript\">");
		writeln("function confirmPopupAction(myAction){");
		writeln("	if(myAction == null || myAction.length <= 1)");
		writeln("		;");
		writeln("	else {");	
		writeln("		eval(myAction)");
		writeln("	}");
		writeln("	window.setTimeout('this.close()',100);");	
		writeln("}");
		writeln("</script>");
		writeln("</head>");
		if(style.indexOf("clm_demo") == -1){
			if(!bSkillInfo){
				writeln("<body><center><br>");
			}
			else{
				writeln("<body><br><div class='pad10'");
			}
			writeln("<form>");
			if(!bSkillInfo){
				writeln("<div class='mainbold'>"+titel+"</div>");
			}
			else{
				writeln("<table width='95%' border='0'><tr class='bgcolor_grau_b'><td class='listheadline_px'>"+titel+"</td></tr></table>");
			}
			writeln("<br><br>");
			writeln("<div class='main'>"+frage+"</div>");
			writeln("<br><br><div class='pad5'>");
			if(bSkillInfo){
				writeln("<center>");
			}
			if(buttonAction1.length > 0 && buttonValue1.length > 0) 
				writeln("<span class='pad10'><input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue1+"\" onClick=confirmPopupAction(\""+buttonAction1+"\")></span>")
			if(buttonAction2.length > 0 && buttonValue2.length > 0) 
				writeln("<span class='pad10'><input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue2+"\" onClick=confirmPopupAction(\""+buttonAction2+"\")></span>")
			if(buttonAction3.length > 0 && buttonValue3.length > 0) 
				writeln("<span class='pad10'><input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue3+"\" onClick=confirmPopupAction(\""+buttonAction3+"\")></span>")
			if(bSkillInfo){
				writeln("</center>");
			}
			writeln("</div></form>");
			if(!bSkillInfo){
				writeln("</center>");
			}
			else{
				writeln("</div>");
			}
			writeln("</body>");
			writeln("</html>");
			}
		else{
			writeln("<body class='bodypopup'><br>");
			writeln("<form>");
			writeln("<br><div align='right'>")
			if(buttonAction1.length > 0 && buttonValue1.length > 0) 
				writeln("<input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue1+"\" onClick=confirmPopupAction(\""+buttonAction1+"\")>")
			if(buttonAction2.length > 0 && buttonValue2.length > 0) 
				writeln("<input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue2+"\" onClick=confirmPopupAction(\""+buttonAction2+"\")>")
			if(buttonAction3.length > 0 && buttonValue3.length > 0) 
				writeln("<input type=\"button\" class=\"buttonsmall\" value=\""+buttonValue3+"\" onClick=confirmPopupAction(\""+buttonAction3+"\")>")
			writeln("</div")
			writeln("<br><br><div class='pad5'>");
			writeln("<div class='mainbold'>"+titel+"</div>");
			writeln("<br>");
			writeln("<div class='main'>"+frage+"</div>");
			writeln("</div></form>");
			writeln("</body>");
			writeln("</html>");
		}
		}
	vConfirmPopup.document.close();	
}
// Caller function for confirmPopup. Use this function to call the confirmPopup:
// imagedir = Imagedir Verzeichnis
// style = CSS Tamplate Pfad
// Titel = Titel und ueberschrift des Popups
// Frage = Fragetext
// buttonAction1 /...2 = Beim Click auf den Button auszufuehrende Action
// buttonValue1 /...2 = Button Value (Text)
// wenn buttonAction1 oder buttonValue1 nicht mitgegeben oder leer sind, wird kein button1 angezeigt, das gleiche gilt f. Button2
// 22122004 pr jetzt auch mit 3 Buttons
function confirmPopup(imagedir,style,titel,frage,buttonAction1,buttonValue1,buttonAction2,buttonValue2,buttonAction3,buttonValue3){
	if(style.indexOf("~") != -1){
		vConfirmPopup = window.open("leer.htm", "confirmPopup", "width=600,height=400,status=no,resizable=no,top=200,left=200");
	}
	else{
		if(style.indexOf("clm_demo") == -1){
			vConfirmPopup = window.open("leer.htm", "confirmPopup", "width=300,height=350,status=no,resizable=no,top=200,left=200");
		}
		else{
			vConfirmPopup = window.open("leer.htm", "confirmPopup", "width=300,height=200,status=no,resizable=no,top=200,left=200");
		}
	}
	vConfirmPopup.opener = self;	
	buildConfirmPopup(imagedir,style,titel,frage,buttonAction1,buttonValue1,buttonAction2,buttonValue2,buttonAction3,buttonValue3);
	vConfirmPopup.focus(); 
	return vConfirmPopup;
}

// Markierte Werte von einer Selectbox in eine andere uebernehmen
function move_select(from,to){
	// Array fuer geloeschte Eintraege anlegen
	var zu_loeschen = new Array();

	// From-Box untersuchen, selektierte Eintraege in To-Box, selektierten Eintrag im Array speichern
	for(i=0;i<document.forms[0][from].length;i++){
		if (document.forms[0][from].options[i].selected){
			NeuerEintrag = new Option(document.forms[0][from].options[i].text,document.forms[0][from].options[i].value);
			document.forms[0][to].options[document.forms[0][to].length] = NeuerEintrag;
			zu_loeschen=zu_loeschen.concat(i);
		}
	}
	// Nummern absteigend sortieren wegen korrekter Loeschung
	zu_loeschen.reverse();
	
	// uebertragene Eintraege loeschen
	for(i=0;i<zu_loeschen.length;i++){
		document.forms[0][from].options[zu_loeschen[i]] = null;
	}
}

// Alle Werte in einer Selectbox markieren
function select_all(box){
	for(i=0;i<document.forms[0][box].length;i++){
		document.forms[0][box].options[i].selected = true;
	}
	return true;
}
// Alle Werte in einer Selectbox loeschen
function deselect_all(box){
	for(i=0;i<document.forms[0][box].length;i++){
		document.forms[0][box].options[i].selected = false;
	}
	return true;
}
// --------------- Nachfolgende Funktionen fuer Showlist: ----------------
//Fehlerhandling
function SymError()
{
  	return true;
}

function PostAction(ActionString,formName)
{
	if(formName == null) formName = 'showlist';
	document.forms[formName].actionstring.value=ActionString;
	document.forms[formName].submit();
}
// aus show_list_buttons: markiert und loescht Markierungen 
function select_all_showlist(status,formName){
	if(formName == null) formName = 'showlist';
	var maxV=document.forms[formName].elements.length-1;
	
	for(var i=0;i<=maxV;i++){
		if (document.forms[formName].elements[i].type=='checkbox'){
			if (status){
				if (document.forms[formName].elements[i].name != "all_select"){
					document.forms[formName].elements[i].checked = true;
				}
			}
			else { 
				if (document.forms[formName].elements[i].name != "all_select"){
					document.forms[formName].elements[i].checked = false;
				}
			}
		}
	}
}
// markiert und loescht Markierungen pro Spalte in sortable
function select_all_rows(status,formName,all_name,row_name){
	var maxV=document.forms[formName].elements.length-1;
	
	for(var i=0;i<=maxV;i++){
		if (document.forms[formName].elements[i].type=='checkbox'){
			if (status){
				if (document.forms[formName].elements[i].name != all_name && document.forms[formName].elements[i].name.indexOf(row_name) != -1){
					document.forms[formName].elements[i].checked = true;
				}
			}
			else { 
				if (document.forms[formName].elements[i].name != all_name && document.forms[formName].elements[i].name.indexOf(row_name) != -1){
					document.forms[formName].elements[i].checked = false;
				}
			}
		}
	}
}
// prueft eine Spalte nach angehakten Checkboxen und gibt die Anzahl der gecheckten Elemente zurueck:
function checkSelected2(col_name,formName){
	if(formName == null) formName = 'showlist'; 
	var maxV=document.forms[formName].elements.length-1; //Anzahl Elemente in FOrm
	var cn_l = col_name.length; // Laenge von col_name
	var checkedFound = 0;// Initialisieren: gecheckt gefunden 
	if(cn_l > 0){
		for(var i=0;i<=maxV;i++){
			var elem=document.forms[formName].elements[i];
			if (( elem.name.length > cn_l && elem.name.substr(0,cn_l) == col_name && elem.type=='checkbox' && elem.checked ) || ( elem.name.length == cn_l && elem.name.substr(0,cn_l) == col_name && elem.type=='radio' && elem.checked)){
				checkedFound += 1;
				}
			}	
		}	
	return checkedFound;	
}
<!--- // Ruft confirmPopup auf und fordert eine Bestaetigung an fuer die ausgewaehlten Elemente --->
function confirmSelected(imagedir,cssTemplatePath,res_systemHint,res_button1,res_button2,buttonName,col_name,res_confirmText,formName,stil){
	if(formName == null) formName = 'showlist'; 
	if(stil == null) stil = ''; // 14062005 pr stil ergaenzt
	var checkedCount = checkSelected2(col_name,formName); //Anzahl gecheckter Elemente
	//<!--- // Da der Name des geclickten Buttons beim SUbmit nicht uebermittelt wird muss ein Hiddenfeld herhalten, das dann den Namen des Buttonsbekommt. --->
	//<!--- 16062005 pr entfernt und unten weiter unterschieden: var actionString = 'self.opener.document.forms[\''+formName+'\'].elements[0].name=\''+buttonName+'\';this.opener.document.forms[\''+formName+'\'].submit();'; --->
	//14062005 pr start COBA wuenscht einheitliche Popups 
		if(stil == "coba"){
			var actionString = 'self.opener.document.forms[\"'+formName+'\"].elements[0].name=\"'+buttonName+'\";self.opener.document.forms[\"'+formName+'\"].submit();self.close();';
			res_confirmText += "<form><div align=right class=pad10><input type=button class=button value=\'"+ res_button1 +"\' onclick=\'"+actionString+"\'>&nbsp;<input type=button class=button value=\'"+ res_button2 +"\' onclick=\'self.close();\'></div></form>";
			infoPopup(imagedir,cssTemplatePath,res_systemHint,res_confirmText,stil)
			}
		else {	
			var actionString = 'self.opener.document.forms[\''+formName+'\'].elements[0].name=\''+buttonName+'\';self.opener.document.forms[\''+formName+'\'].submit();';
	//14062005 pr end
			confirmPopup(imagedir,cssTemplatePath,res_systemHint,res_confirmText,actionString,res_button1,';',res_button2)
			}
}

<!--- // buttonName : der Name des Buttons, der diese Funktion anfordert,
// checkbox Kontrollaufruf: col_name ist der Name der Checkbox Spalte, 
// action ist optional: wenn check dann wird nur auf vorhandene Auswahl gechecked 
// wenn confirm dann nur bestaetigung eingeholt
// wenn nichts bei action dann beides  --->
function checkboxCtrl(imagedir,cssTemplatePath,res_systemHint,res_confirm,res_cancel,res_closeWindow,res_noCheckboxChecked,buttonName,col_name,res_confirmText,action,formName,stil){
	if(formName == null) formName = 'showlist'; 
	if(stil == null) stil = ''; // 14062005 pr stil ergaenzt
	var bCheck=true;
	var bConfirm=true;
	if(action==null) action='';
	if(action.toLowerCase() == 'check' )
		bConfirm=false;
	if(action.toLowerCase() == 'confirm' )
		bCheck=false;
	
	if(bCheck && checkSelected2(col_name,formName) > 0)
		if (bConfirm) {
			// 14062005 pr confirmSelected(imagedir,cssTemplatePath,res_systemHint,res_confirm,res_cancel,buttonName,col_name,res_confirmText,formName);
			confirmSelected(imagedir,cssTemplatePath,res_systemHint,res_confirm,res_cancel,buttonName,col_name,res_confirmText,formName,stil);
			return false;
			}
		else {
			return true;
			}
	else {
		//14062005 pr start COBA wuenscht einheitliche Popups 
		if(stil == "coba"){
			infoPopup(imagedir,cssTemplatePath,res_systemHint,res_noCheckboxChecked,stil)
			}
		else {
		//14062005 pr end
			confirmPopup(imagedir,cssTemplatePath,res_systemHint,res_noCheckboxChecked,';',res_closeWindow)	
			}
		return false;	
		}
}
// fuer die Scrolling FUnktion:
// 15032004 pr auch elemName uebergeben
function scroll(type,formName,elemName){
	if(elemName == null) elemName = 'scroll'; 
	if(formName == null) formName = 'showlist'; 
	document.forms[formName][elemName].value=type;
	document.forms[formName].submit();
}
// aus mdw1_show_list_grouped:
function SelectGroup(GroupCheckbox,lCheckboxes,formName)
{	if(formName == null) formName = 'showlist';
	var aCheckboxes=new Array;	
	aCheckboxes=lCheckboxes.split(",");
	for(i=0;i<aCheckboxes.length;i++)
	{
	document.forms[formName][aCheckboxes[i]].checked=GroupCheckbox.checked;
	}
}

// ausgelagert aus tab.cfm:
var actVis='';
var what='1';
var lastactivetab='';
var lastsetactivetab='';
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck();
function EinAus(what,act){
	var bw=new lib_bwcheck();
	this.css=bw.dom? document.getElementById(what).style:bw.ie4?document.all[what].style:bw.ns4?document.layers[what]:0;	
	this.writeref=bw.dom? document.getElementById(what):bw.ie4?document.all[what]:bw.ns4?document.layers[what].document:0;	
	this.obj = what + "Object"; 	
	eval(this.obj + "=this");
	if(act=='ein') {
		eval(this.obj+".css.visibility = 'visible'");
	} else {
		eval(this.obj+".css.visibility = 'hidden'"); 
	}
}
function goToTab(pos,act){
	lastactivetab='';
	if(lastsetactivetab !=''){
		if (lastsetactivetab != pos){
			EinAus(lastsetactivetab+'ein','aus');
			EinAus(lastsetactivetab,'ein');
		}
	}
	whatein=pos+'ein';
	EinAus(whatein,'ein');
	EinAus(pos,'aus');
	bodyTab(pos,'ein');
	if (pos!='tab1'){
		if (document.getElementById("OnlineDauerFlexibel")!=null){
			document.getElementById("OnlineDauerFlexibel").style.visibility="hidden";	
			document.getElementById("OnlineDauer").style.visibility="hidden";	
		}	
	}else{
		if (document.getElementById("OnlineDauerFlexibel")!=null){
			checkFlexibelStart();
		}	
	}	
	lastsetactivetab=pos;
}
function overTab(pos,act){}

function outTab(pos,act){}
function bodyTab(pos,act){
	if(lastsetactivetab !=''){
		EinAus(lastsetactivetab+'body','aus');
	}
	EinAus(pos+'body','ein');
	
}
function locator(id,url,type) {
//	alert(url.indexOf("clicnetclm/"));
	//13022006 pr fuer Popup notwendig:
	if(!top.main)
		obj=self;
	else
		obj=top.main;	
	// und nachfolgend ersetzt: top.main durch obj:
	if(type=="K"){
		obj.location.href="handler.cfm?actdo=hole_inhalt.cfm&from_locator=1&kat_id="+id;
		return;
	}
	if(url==""){
		obj.location.href="handler.cfm?actdo=show_locator_only.cfm&kat_id="+id;
		return;
	}
	if(url.indexOf("/clicnetclm/") >= 0){
		//alert(url);
		top.location.href="/clicnetclm/iFrame.do?kat_id="+id;
		return;
	}
	if(url.indexOf("?") == -1){
		obj.location.href="handler.cfm?actdo=" + url+ "&kat_id="+id;
		return;
	}
	
	if(url.indexOf("handler.cfm") == -1){
		obj.location.href="handler.cfm?actdo=" + url+ "&kat_id="+id;
		return;
	}
	else{
		obj.location.href=url+ "&kat_id="+id;
		return;
	}
}
function show_menu3rdlevel() {
	/*if(document.getElementById)
		document.getElementById("menu3rdlevel").style.visibility = "visible";
		if(document.getElementById("sortselect"))
			document.getElementById("sortselect").style.visibility = "hidden";
		if(document.getElementById("addcontent"))
		document.getElementById("addcontent").style.visibility = "hidden";*/
	return;
}
function hide_menu3rdlevel() {
	if(document.getElementById)
		document.getElementById("menu3rdlevel").style.visibility = "hidden";
		if(document.getElementById("sortselect"))
			document.getElementById("sortselect").style.visibility = "visible";
		if(document.getElementById("addcontent"))
			document.getElementById("addcontent").style.visibility = "visible";
}


// Coba Qualifizierungsoffensive 2
function imgChangeOn(name) {
    img = eval('document.images.'+name);
    imgsrc = img.src.replace('_a.gif','.gif');
    img.src = imgsrc.replace('.gif','_a.gif');
}
function imgChangeOff(name) {
    img = eval('document.images.'+name);
    img.src = img.src.replace('_a.gif','.gif');
}

function spacer(flag){
	if (document.layers || flag=="all") {
		document.write ('<font size=1>');
		for (n=0;n<30;n++) {
		document.write ('&nbsp;&nbsp; ');
		}
		document.write ('</font>');
	}
}

function showPosLeft(elementname) {
	left = 0;
	pos=document.getElementById(elementname);
	while (pos.offsetParent!=null) {
		pos=pos.offsetParent;
		left= left + pos.offsetLeft;
	}
	return left
}

function showPosTop(elementname) {

	y = 0;
	pos=document.getElementById(elementname);;
	while (pos.offsetParent!=null) {
		pos=pos.offsetParent;
		y= y + pos.offsetTop;
	}
	return y
}

//global
var optionname='';
function setOptionname(name) {
	optionname=name;
}

function hideOption(pos) {
	
	if (optionname && document.getElementById('optioncontent'+optionname).style.visibility=='visible') {
		showOption(optionname,0,0)	
	}
}

function showOption(name,difx,dify) {
	if (name!=optionname) {
		hideOption();
	}
	optionname='';
	
	x=showPosLeft('option'+name);
	document.getElementById('optioncontent'+name).style.left=(x+difx);
	//document.getElementById('optioncontent'+name).style.setAttribute('left',x+difx);
	
	y=showPosTop('option'+name);
	// alert(x),alert(y)

	//document.getElementById('optioncontent'+name).style.setAttribute('top',y+dify);
	document.getElementById('optioncontent'+name).style.top=y+dify;


	if (document.getElementById('optioncontent'+name).style.visibility!='visible') {
		document.getElementById('optioncontent'+name).style.visibility='visible';
	} else {
		document.getElementById('optioncontent'+name).style.visibility='hidden';
	}
	setTimeout('setOptionname(\''+ name +'\')',300);
}
function showSort(divName,art) {
    //tausch bei nur text
    //document.getElementById('chg_sort').childNodes[0].nodeValue=art;
    
    //1. Kindelement, egal ob Text, Bild...
    var Knoten=document.getElementById(divName).childNodes[1];
    //1. Kindelement loeschen
    verschwunden = document.getElementById(divName).removeChild(Knoten);
    //1. Kindelement mit neuem Inhalt fuellen
    document.getElementById(divName).appendChild(document.createTextNode(art));
    hideOption();   
  }  
  
// Builds the confirm Popup:
function buildInfoPopup(imagedir,style,titel,text,type){
	vInfoPopup.document.open();
	
	// Setup the page...
	with (vInfoPopup.document) {
		writeln("<html>");
		writeln("<head><title>"+titel+"</title>");
		writeln("<link rel='STYLESHEET' type='text/css' href='"+style+"'>");
		writeln("<script type=\"text/javascript\">");
		writeln("function confirmPopupAction(myAction){");
		writeln("	if(myAction == null || myAction.length <= 1)");
		writeln("		;");
		writeln("	else {");	
		writeln("		eval(myAction)");
		writeln("	}");
		writeln("	window.setTimeout('this.close()',100);");	
		writeln("}");
		writeln("</script>");
		writeln("</head>");
		}
	
	if(type == 'coba' || type == 'demo'){
		with (vInfoPopup.document) {	
			writeln("<body>");
			writeln("<table border='0' cellspacing='0' cellpadding='0' width='100%' height='20'>"	
					+"<tr>"
						+"<td width='65%' class='bgcolor_dunkelgelb'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0' /></td>"
						+"<td width='10%' class='bgcolor_f3'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0' /></td>"
						+"<td width='25%' class='bgcolor_hellgelb2'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0' /></td>"								
					+"</tr>"	
				+"</table>");
			writeln("<table border='0' cellspacing='0' cellpadding='0' width='100%'>"
				  +"<tr>"
				    +"<td height='9'><img src='"+imagedir+"system/leer.gif' width='11' height='1' alt='' border='0'></td>"
				    +"<td><img src='"+imagedir+"system/leer.gif' width='6' height='1' alt='' border='0'></td>"
				    +"<td width='100%'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0'></td>"
				    +"<td width='10'><img src='"+imagedir+"system/leer.gif' width='10' height='1' alt='' border='0'></td>"
				  +"</tr>"
				  +"<tr>"
				    +"<td height='350'></td>"
				    +"<td><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0'></td>"
				    +"<td class='popuptext' valign='top'>");	
			writeln("<table border='0' cellpadding='0' cellspacing='0' width='95%'>"  
          	+"<tr valign='top'>"
          	+"<td class='txt_sm_bg' height='19'><img src='"+imagedir+"system/leer.gif' width='1' height='7' alt='' border='0' /><br/>"+titel+"</td>"
          	+"</tr>"
          	+"</table>"
          	+"<table border='0' cellpadding='0' cellspacing='0'>  "
        	+"<tr valign='top'>"
          	+"<td height='3'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0' /></td>"
        	+"</tr> "
      	+"</table>"
        	+"<table border='0' cellpadding='0' cellspacing='0' width='95%'  class='bgcolor_dunkelgelb'>  "
          	+"<tr valign='top'>"
            +"<td height='1'><img src='"+imagedir+"system/leer.gif'  height='1' alt='' border='0' /></td>"
          	+"</tr>"
        	+"</table>"
        	+"<table border='0' cellpadding='0' cellspacing='0'>  "
         	+"<tr valign='top'>"
          	+"<td height='12'><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0' /></td>"
         	+"</tr> "
        	+"</table>")	    
				    
			writeln(text);
			writeln("</td><td><img src='"+imagedir+"system/leer.gif' width='1' height='1' alt='' border='0'></td></tr></table>"
				+"<table border='0' cellspacing='0' cellpadding='0' height='20' width='100%'>"	
					+"<tr>"
						+"<td align='right' bgcolor='#E5E5E5' width='100%'><a href='#' onclick='parent.close();'><img src='"+imagedir+"/system/button_close_popup.gif' width='132' height='20' alt='' border='0' /></a></td>"
					+"</tr>"	
				+"</table>");
			writeln("</body>");
			writeln("</html>");
			}
		}
	else 	{
		with (vInfoPopup.document) {	
			writeln("<body><center><br>");
			writeln("<div class='mainbold'>"+titel+"</div>");
			writeln("<br><br>");
			writeln("<div class='main'>"+text+"</div>");
			writeln("<br><br><div class='pad5'>");
			writeln("</div>");
			writeln("</center>");
			writeln("</body>");
			writeln("</html>");
			}
		}
	vInfoPopup.document.close();	
}
// Caller function for infoPopup. Use this function to call the infoPopup:
// imagedir = Imagedir Verzeichnis
// style = CSS Tamplate Pfad
// Titel = Titel und ueberschrift des Popups
// Text = Anzeigetext
// type = Es gibt verschiedene Designs je nach Mandant, Bsp. coba
function infoPopup(imagedir,style,titel,text,type,breite){
	if(!breite)
		vInfoPopup = window.open("leer.htm","infoPopup","scrollbars=no,width=420,height=401,status=no,resizable=no,top=200,left=200");
	else
		vInfoPopup = window.open("leer.htm","infoPopup","scrollbars=no,width="+breite+",height=401,status=no,resizable=no,top=200,left=200");	
	vInfoPopup.opener = self;	
	buildInfoPopup(imagedir,style,titel,text,type);
	vInfoPopup.focus(); 
	return vInfoPopup;
}  
// Funktionen fuer Webtricks-Kalender
   // Function to set focus back to a cfform field when there was a validation error 
   function SetFocus(thisForm, thisField, thisFieldValue, thisMessage) {
      // Display the error message
      alert(thisMessage);
      // Set focus back on the field
      thisField.focus();
      // The function needs to return false
      return false;
   }
   
   // Function to confirm delete. 
   function ConfirmDelete(Message) {
      if(confirm(Message)) {
        //document.DeleteForm.submit();
      }
   }
   
   // Function to valide a file upload field.
   function ValidateFileInput(fieldName, isRequired, fileTypeList) {
      // Set the pass variable
      var Passed = true;
      // Test the field
      while (Passed == true) {
         // If the field is required and it has no value, return false
         if (isRequired == 1 && !fieldName.value) {
            // Set Passed to false;
            Passed = false;
            // Break out of the loop - no sense continuing.
            break;
         }
         // If there are exentions, does the file match?
         if (fileTypeList.length != 0) {
            // Get the file extension of the selected file
            var FileExt = fieldName.value.substring((fieldName.value.length-3), fieldName.value.length);
            // break the extensio list into an array
            var extArray = fileTypeList.split(",");
            // Set the test var
            var goodExt = false;
            // Loop through the array and see if the extension is valid
            for (i=0; i<extArray.length; i++) {
               if (FileExt.toLowerCase() == extArray[i].toLowerCase()) {
                  // Extensions matched, set goodExt to true and break out of loop
                  goodExt = true;
                  break;
               }
            }
            // Set Passed to goodText
            Passed = goodExt;
         }
         // Add a break so the loop isn't endless if everything passed.
         break;
      }
      // Return the value of Passed back to the calling function
      return Passed;
   }
   
   //Function to validate a drop-down box.
   function ValidateDropDown(fieldName) {
      // If the first option is selected, fails.
      if (fieldName.selectedIndex == 0) {
         return false;
      } else {
         return true;
      }
   }
   
   // Function to create a date object from a value
   function CreateDateObject(dateValue) {
      //var dateArray = dateValue.split("/");
      //var thisMonth = dateArray[0];
      //var thisDay = dateArray[1];
      //var thisYear = dateArray[2];
      //var thisHour = dateArray[3];
      //var thisMinute = dateArray[4];
      var dateArray = dateValue.split(".");
      var thisDay = dateArray[0];
      var thisMonth = dateArray[1];
      var thisYear = dateArray[2];
      var thisHour = dateArray[3];
      var thisMinute = dateArray[4];
      var dateObject = new Date(thisYear, thisMonth, thisDay, thisHour, thisMinute, 0);
      return dateObject;
   }

	function MM_openBrWindow(theURL,winName,features) { //v2.0
		window.open(theURL,winName,features);
	}

   // Calls the CF-Backend for Ajax-Calls
   function jsmx_Request(req)
		{ 
			pos=req.indexOf(":");
			if(pos == -1){
				// There are no parameters, the only parameter for the jsmx_request.cfm is the name of the CustomTag to be called
				cf_request="jsmx_request.cfm?req=" + req;
			}
			else{
				// There are parameters, that have to be passed to the CustomTag by jsmx_request.cfm
				ct=req.substr(0,pos);
				cf_request="jsmx_request.cfm?req=" + ct;
				aParams=req.substr(pos+1).split("|");
				for (i=0;i<aParams.length;i++){
					aPair=aParams[i].split("=");
					cf_request=cf_request + "&" + aPair[0] + "=" + aPair[1];
				}
			}
			// Invoke the server-request now... when finished the result will be delivered to JS-Function jsmx_Response()
			http( "GET"  , cf_request , jsmx_Response );
			//var request = YAHOO.util.Connect.asyncRequest("GET", cf_request, yui_Response);
		}

	// Handle the result of Ajax-Calls to the server
	function jsmx_Response(obj){ 
		// this is the name of the CustomTag, that was called on the server
		myFunction=obj.my_response;

		if(obj.my_type != "unknown" && myFunction != "cfcatch"){
			myFunction=myFunction + "_" + obj.my_type;
		}
		
		// this is the result, delivered from the server
		myObject=obj.my_result;
		//try{		
			eval(myFunction)(myObject);
		//}
		//catch (e){
	    //	alert('Die function "' + myFunction + '(obj)" ist nicht definiert.');
		//}
	}

	var yui_Response =   
	 {   
	   success:responseSuccess,   
	   failure:responseFailure   
	 }; 
	 
	// Handle the result of Ajax-Calls to the server
	function responseSuccess(obj){ 
		// this is the name of the CustomTag, that was called on the server
		eval(obj.responseText);
		myFunction=dummy.my_response;

		if(dummy.my_type != "unknown" && myFunction != "cfcatch"){
			myFunction=myFunction + "_" + dummy.my_type;
		}
		
		// this is the result, delivered from the server
		myObject=dummy.my_result;
		//try{		
			eval(myFunction)(myObject);
		//}
		//catch (e){
	    //	alert('Die function "' + myFunction + '(obj)" ist nicht definiert.');
		//}
	}

	// Handle the result of Ajax-Calls to the server
	function responseFailure(obj){ 
		alert('Connection-Fehler!');
	}

	//Display CF-Error as a result of Ajax-Calls on the server
	function cfcatch(obj){
		str="";
		for (x in myObject){
			if(typeof myObject[x] == "string"){
				str=str + x + ": " + myObject[x] + "\n\n";
			}
			else{
				str=str + x + ": " + "\n\n";
				for (y in myObject[x]){
					if(typeof myObject[x][y] == "string"){
						str=str + y + ": " + myObject[x][y] + "\n\n";
					}
					else{
						str=str + y + ": " + "\n\n";
						for (z in myObject[x][y]){
							str=str + z + ": " + myObject[x][y][z] + " | ";
						}
						str=str + "\n\n";
					}
				}
			}
		}
		alert(str);
	}
   
