/* ### Cabacos Default JS ### */

/* ### Glossar Funktionen ### */
var lastSelected;
var cab_lastGlossaryGUID;

function cab_gloss_delete(thisGUID) {
	if (thisGUID == undefined) { thisGUID = cab_lastGlossaryGUID; }
	window.open('/app/glossary/delGlossary.asp?guid=' + thisGUID, 'delGlossary', 'width=450,height=150,resizable=no,scrollbars=no,status=no');
}

function cab_gloss_edit(thisGUID) {
	if( thisGUID == undefined) { thisGUID = cab_lastGlossaryGUID; }
	window.open('/app/glossary/addGlossary.asp?guid=' + thisGUID, 'addGlossary', 'width=500,height=600,resizable=no,scrollbars=no,status=no');
}

function cab_isValidEmail(thisMailAddress) {
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(thisMailAddress)) { return true; } else { return false; }
}

function newGlossary() {
	window.open('/app/glossary/addGlossary.asp?addText=', 'addGlossary', 'width=500,height=600,resizable=no,scrollbars=no,status=no');
}

function checkGlossary() {
	try {
		aktSel = window.getSelection ? window.getSelection() : window.document.selection;
			
		try {
			if(aktSel.createRange().text.length > 0) {
				lastSelected = aktSel.createRange().text;
			} else {
				lastSelected = '';
			}
		} catch(e) {
			if(aktSel.toString().length > 0) {
				lastSelected = aktSel.toString()
			} else {
				lastSelected = '';
			}
		}
	} catch(ex) {  }
}

function resetAdminRights() {
	window.open('/admin/resetAdmin.asp', 'resetAdmin', 'width=450,height=180,resizable=no,scrollbars=no');
}

function openHelp(helpID) {
	if ((helpID != 0) && (helpID != "0")) { helpID = "?" + helpID; } else { helpID = ""; }
	window.open('/admin/Docs_Online/docs_de/index.html' + helpID, 'helpWindow', 'width=820,height=550,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=no');
}

function openAbout() {
	window.open('/admin/about.asp', 'aboutWindow', 'width=550,height=380,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=no');
}

function checkWindow (Redakansicht) {
	var windowName = window.name;
	if (Redakansicht == 'false' && windowName.indexOf('RedakWindow') != -1) { OpenUserMode(-1); }
}

function OpenRedakMode(editor,newWindow) {
	if (newWindow == -1) {
		var windowName = window.name;
		if (windowName.indexOf('RedakWindow') == -1) {
			win1 = window.open(global_SessionMe + '?redak=1&editor=' + editor ,'RedakWindow' + global_SessionID,'width='+ (screen.availWidth-200) +',height=' + (screen.availheight - 200) + ',status=yes,resizable=yes');
			win1.moveTo(0,0);
			win1.resizeTo(screen.availWidth, screen.availheight);
			window.opener = null;
			window.close();
		} else {
			try {
				document.location.href = global_SessionMe + '?redak=1&editor=' + editor ;
			} catch(e) {  }
		}
	} else {
		try {
			document.location.href = global_SessionMe + '?redak=1&editor=' + editor ;
		} catch(e) {  }
	}
}

function OpenUserMode(newWindow) {
	if (newWindow == -1) {		
		win1 = window.open(global_SessionMe + '?redak=0','Userwindow' + global_SessionID,'');
		win1.moveTo(0,0);
		win1.resizeTo(screen.availWidth, screen.availheight);
		window.opener = null;
		top.frames.close();
	} else {
		try {
			document.location.href = global_SessionMe + '?redak=0';
		} catch(e) {  }
	}
}

function printMe(printType,link) {
	if (printType == 'app') {
		if (link == 'pdf') {
			document.getElementById('out_Content_pdf').value = document.getElementById('appContent').innerHTML;
			document.getElementById('out_Title_pdf').value = document.title;
			try { document.getElementById('out_add_Content_pdf').value = document.getElementById('add_appContent').innerHTML; }
			catch(e) {  }
			try { document.getElementById('out_Site_Content_pdf').value = document.getElementById('add_SiteContent').innerHTML; }
			catch(e) {  }
			document.getElementById('pdf_submit').submit();
		}
		
		if (link == 'print') {
			window.open('','PrinterWindow','width=780,height=700,left=0,top=0,resizable=yes,scrollbars=yes');
			document.getElementById('out_Content_print').value = document.getElementById('appContent').innerHTML;
			document.getElementById('out_Title_print').value = document.title;
			try { document.getElementById('out_Site_Content_print').value = document.getElementById('add_SiteContent').innerHTML; }
			catch(e) {  }
			try { document.getElementById('out_add_Content_print').value = document.getElementById('add_appContent').innerHTML; }
			catch(e) {  }
			document.getElementById('print_submit').target = 'PrinterWindow';
			document.getElementById('print_submit').submit();
		}
	} else {
		window.open(link,'PrinterWindow','width=780,height=700,left=0,top=0,resizable=yes,scrollbars=yes');
	}
}

function bookmarkMe(_el) {
	var _el = $(_el);
	
	if (window.sidebar) {
		window.sidebar.addPanel(_el.readAttribute("title"), _el.readAttribute("href"), "");
	} else if (Prototype.Browser.IE) {
		window.external.AddFavorite(_el.readAttribute("href"), _el.readAttribute("title"));
	} else {
		alert(cls_14765);
	}
	return false;
}

function forwardMe(_el, _opt) { return tellAFriend(_el, _opt); }

function tellAFriend(_el, _opt) {
	var _el = $(_el);
	if ((_opt.toLowerCase()).indexOf("width=") == -1) { _opt += ", width=550"; }
	if ((_opt.toLowerCase()).indexOf("height=") == -1) { _opt += ", height=450"; }
	if ((_opt.toLowerCase()).indexOf("resizable=") == -1) { _opt += ", resizable=no"; }
	if ((_opt.toLowerCase()).indexOf("scrollbars=") == -1) { _opt += ", scrollbars=no"; }
	if ((_opt.toLowerCase()).indexOf("status=") == -1) { _opt += ", status=no"; }
	if ((_opt.toLowerCase()).indexOf("location=") == -1) { _opt += ", location=no"; }
	if ((_opt.toLowerCase()).indexOf("menubar=") == -1) { _opt += ", menubar=no"; }
	if (_opt.indexOf(", ") == 0) { _opt = _opt.sub(", ", "", 1); }
	var __win_taf = window.open(_el.readAttribute("href"), "tell_a_friend", _opt);
	__win_taf.focus();
	return false;
}


var cab_TAFHandles = [];
var cab_TAFTimeOuts = [];

function _hideTellAFriendBox(_i) {
	if (_i != -1) {
		cab_TAFHandles[_i].down(".cab_tellAFriendBoxContentsContainer").hide();
		cab_TAFTimeOuts[_i] = null;
	}
}

function handleTellAFriend(_el) {
	var _el = $(_el);
	if (cab_TAFHandles.indexOf(_el) == -1) {
		_el.observe("mouseover", function(_ev) {
			var this_i = cab_TAFHandles.indexOf(this);
			if (cab_TAFTimeOuts[this_i] == null) {
				this.down(".cab_tellAFriendBoxContentsContainer").show();
			} else {
				clearTimeout(cab_TAFTimeOuts[this_i]);
			}
		}).observe("mouseout", function(_ev) {
			var this_i = cab_TAFHandles.indexOf(this);
			cab_TAFTimeOuts[this_i] = setTimeout(("_hideTellAFriendBox(" + this_i + ")"), 500);
		});
		cab_TAFHandles.push(_el);
		cab_TAFTimeOuts[cab_TAFHandles.indexOf(_el)] = null;
		_el.down(".cab_tellAFriendBoxContentsContainer").show();
	}
}

function findAndReplace(myText, find, replace) {
    var result = myText.split(find).join(replace);
    return result;
}

function setIFrameHeight(thisIFrame) { 
   thisIFrame.style.height = thisIFrame.document.body.scrollHeight;
}

function setIFrameWidth(thisIFrame) { 
   thisIFrame.style.width = thisIFrame.document.body.scrollWidth;
}

/* Image PopUp */
// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = false;
// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
	var isIE=(navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}
var optWindow='resizable=yes,scrollbars=no,width=700,height=700,left=100,top=100';

function popImage(imageURL, imageTitle) {
	imgWin = window.open('about:blank','popup',optWindow);
	with (imgWin.document){
		writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">')
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
		writeln('var isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){');
		
		writeln('width=(document.images[0].width );');
		writeln('height=(document.images[0].height);');
		
		writeln('if (isIE){');
		writeln('window.resizeTo(100,100)')
		writeln('window.resizeTo(width+ 10,height+100-document.documentElement.clientHeight);}');
		writeln('else{');       
		writeln('window.innerWidth=width;');
		writeln('window.innerHeight=height;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
		writeln('<div id="imgContainer" style="height:auto;"><img name="George" src='+imageURL+' style="display:block"></div></body></html>');
		close();		
	}
}

function encode(input) {
    hexOutput = "";
    for (i=0; i<input.length; i++) {
        hexOutput = hexOutput + Dec2Hex(input.charCodeAt(i));
    }
    return hexOutput;
}

function decode(input) {
    hexOutput = "";
    for (i=0; i<input.length; i=i+2) {
        hexOutput = hexOutput + String.fromCharCode(parseInt(input.slice(i,i+2),16));
    }
    return hexOutput;
}

function Dec2Hex(Decimal) {
    var hexChars = "0123456789ABCDEF";
    var a = Decimal % 16;
    var b = (Decimal - a)/16;
    hex = "" + hexChars.charAt(b) + hexChars.charAt(a);
    return hex;
}

//Funktionen fuer die Cabacos-Selectboxen Kategorien und Rubriken
var CabSelect_disMe;
function CabSelect_selectCats(myDiv) {
	if ($(myDiv).getStyle("visibility") == "visible") { CabSelect_hideMeReal(myDiv); } else {
		$(myDiv).setStyle({visibility: "visible", width: ($(myDiv.slice(0,myDiv.length-4) + "_Text").offsetWidth + "px")});
	}
	/*if(document.getElementById(myDiv).style.visibility == 'visible') {
		CabSelect_hideMeReal(myDiv);
	} else {
		document.getElementById(myDiv).style.visibility = 'visible';
		document.getElementById(myDiv).style.width = document.getElementById(myDiv.slice(0,myDiv.length-4) + '_Text').offsetWidth + 'px';
	}*/
}

function CabSelect_hideMe(myDiv) {
	CabSelect_disMe = window.setTimeout("CabSelect_hideMeReal('"+myDiv+"');",300);
}

function CabSelect_transferLangs(transferFrom) {
	transferFrom = transferFrom.slice(0,transferFrom.length-4)

	var CabSelect_inputStringRubs = new String;
	var CabSelect_inputStringRubsLong = new String;
	
	var cab_isHiddenField = '';
	try { cab_isHiddenField = document.getElementsByName(transferFrom)[0].type.toLowerCase(); }
	catch(e) { cab_isHiddenField = ''; }
	
	if (cab_isHiddenField == "hidden") {
		//wenn cab_selectbox_selectOnlyOne ausgewaehlt dann ist es ein hiddenfield und keine checkbox
		CabSelect_inputStringRubs = ',' + document.getElementsByName(transferFrom)[0].value;
		CabSelect_inputStringRubsLong = ', ' + document.getElementsByName(transferFrom)[0].title;
	} else {
		for (var i=0;i<document.getElementsByName(transferFrom).length;i++) {
			if (document.getElementsByName(transferFrom)[i].checked == true) {
				CabSelect_inputStringRubs = CabSelect_inputStringRubs + ',' + document.getElementsByName(transferFrom)[i].value;
				CabSelect_inputStringRubsLong = CabSelect_inputStringRubsLong + ', ' + document.getElementsByName(transferFrom)[i].title;
			}
		}
	}
    
	try {
		CabSelect_inputStringRubs = CabSelect_inputStringRubs.substring(1);
		CabSelect_inputStringRubsLong = CabSelect_inputStringRubsLong.substring(2);
	} catch(e) {  }
	/*document.getElementById(transferFrom + '_Text').value = CabSelect_inputStringRubsLong;
	document.getElementById(transferFrom + '_Value').value = CabSelect_inputStringRubs;*/
	$(transferFrom + "_Text").value = CabSelect_inputStringRubsLong;
	$(transferFrom + "_Value").value = CabSelect_inputStringRubs;
}

function CabSelect_hideMeReal(myDiv) {
	CabSelect_transferLangs(myDiv);
	/*document.getElementById(myDiv).style.visibility = 'hidden';*/
	$(myDiv).setStyle({visibility: "hidden"});
}

function getWindowWidth() { 
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	} else {
		return 0;
	}
}

function getWindowHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}

function cab_selectUsers(initUsers, selectionType, targetField, sql, group_sql) {
	var group_sql_query = "";
	if(group_sql != undefined ){
		if(group_sql.length > 0){
			group_sql_query = "&group_sql=" + encode(group_sql);
		}
	}
	window.open("/app/incs/dialogs/userlist/userlist.asp?sql=" + encode(sql) + "&ul=" + encode(selectionType) + "&target=" + encode(targetField) + "&init=" + encode(initUsers) + group_sql_query, "Cab_UserSelect","height=270,width=400,resizable=no,scrollbars=no,menubar=no,location=no,dependent=no");
}

function itd_getFrame(FrameName) {
	function getSubFrames(Frame) {
		for (var i=0;Frame.frames.length;i++) {
			if (Frame.frames[i].name.toLowerCase() == FrameName.toLowerCase()) {
				return Frame.frames[i];
			} else if (Frame.frames[i].frames.length > 0) { 
				subFrame = getSubFrames(Frame.frames[i])
				if (subFrame) { return subFrame; }
			}
		}
	}
	
	theFrame = getSubFrames(top);
	if (theFrame) {
		return theFrame;
		//wenn man Frames per Document.getElementById nen IFrame holt dann kann man bei FF mit 
		//document.getElementById(FrameName).contentDocument
	} else {
		return undefined;
	}
}

//left corner wieder verschwinden lassen... notwendig wenn custom menus da sind
var lcHide; //Variable muss f. LeftCorner Definiert werden
function clearLcMenu() {
	window.clearTimeout(lcHide);
}
function hideLcMenu() {
	window.clearTimeout(lcHide);
	lcHide = window.setTimeout('doHideLcMenu()',500);
}
function doHideLcMenu() {
	/*$('Cab_leftCornerDiv').style.visibility = "hidden";*/
	$("Cab_leftCornerDiv").setStyle({visibility: "hidden"});
	try {
		//wenn keine Submenus wirft es Fehler 
		Cab_LeftCorner.hideSubMenus(); //die submenus
	} catch(e) {  }
}

function showLcMenu() {
	/*$('Cab_leftCornerDiv').style.visibility = "visible"*/
	$("Cab_leftCornerDiv").setStyle({visibility: "visible"});
}

/* ### handleforms ### */
function handleForms_setSelectValue(theForm, theFieldName, theValue) {
	for (i=0;i < document.forms[theForm].elements[theFieldName].length;i++) {
		if (document.forms[theForm].elements[theFieldName].options[i].value == theValue) {
			document.forms[theForm].elements[theFieldName].options[i].selected = true;
		}
	}
}

function isValidEmailAddress(param_address) {
	var acceptableChars = "abcdefghijklmnopqrstuvwxyz.-_@";
	
	if (param_address.length == 0) { return false; }
	
	emailParts = param_address.split("@");
	if (emailParts.length != 2) {
		return false;
	} else {
		if ((emailParts[0].length < 1) || (emailParts[1].length < 4)) { return false; }
		if (emailParts[0].charAt(0) == ".") { return false; }
		if (emailParts[1].indexOf(".") == -1) { return false; }

		var last2Chars = emailParts[1].substr((emailParts[1].length - 2), 2);
		if (last2Chars.indexOf(".") != -1) { return false; }
		if (emailParts[1].indexOf("_") != -1) { return false; }
	}
	
	for (var iLoopCounter = 0; iLoopCounter < param_address.length; iLoopCounter++) {
		var emailChar = (param_address.charAt(iLoopCounter)).toLowerCase();
		if ((acceptableChars.indexOf(emailChar) == -1) && isNaN(emailChar)) { return false; }
	}
	
	if (param_address.indexOf("..") != -1) { return false; }
	if (param_address.indexOf("@.") != -1) { return false; }
	
	return true;
}

function handleForms_refreshCaptcha(param_element) {
	var element = $(param_element);
	if (element == undefined) { return; }
	var now = new Date();
	var element_src = element.readAttribute("src");
	if (element_src.indexOf("?") == -1) { element_src = element_src + "?"; } else { element_src = element_src + "&"; }
	element.writeAttribute("src", (element_src + "x=" + now.toUTCString()));
}

function handleForms_checkForm(param_form) {
	var form_ok = true;

	$(param_form).getElements().each(function(param_element) {
				var splitted_name = param_element.readAttribute("name").split("_");
				var elements_value = param_element.getValue();
				if ((splitted_name.last()) && (splitted_name.first().toLowerCase() != "cabformcheck") && (splitted_name.first().toLowerCase() != "cabformorder")) {
					switch (splitted_name.last().toLowerCase()) {
						case "text":	if (elements_value == "") { form_ok = false; } break;
						case "datep":	if (!handleForms_isValidDate(elements_value)) { form_ok = false; } break;
						case "date":	if ((elements_value != "") && (!handleForms_isValidDate(elements_value))) { form_ok = false; } break;
						case "intp":	if ((elements_value == "") || isNaN(elements_value)) { form_ok = false; } break;
						case "int":		if ((elements_value != "") && (isNaN(elements_value))) { form_ok = false; } break;
						case "checked":	if (!param_element.checked) { form_ok = false; } break;
						case "emailp":	if (!isValidEmailAddress(elements_value)) { form_ok = false; } break;
						case "email":	if ((elements_value != "") && (!isValidEmailAddress(elements_value))) { form_ok = false; } break;
					}
					if (!form_ok) {
						var error_text = param_element.readAttribute("errortext");
						var error_element = $("CabFormCheck_" + param_element.identify());
						if (error_element) { error_text = error_element.getValue(); }
						if (error_text && (error_text != "")) { alert(error_text); }
						param_element.focus();
						param_element.select();
						throw $break;
					}
				} else if ((splitted_name.last()) && (splitted_name.first().toLowerCase() == "cabformcheck")) {
					var element_to_check = $(param_element.readAttribute("name").substring(13));
					if (element_to_check) {
						if ((element_to_check.getValue() == "") || ((element_to_check.readAttribute("type").toLowerCase() == "checkbox") && !element_to_check.checked)) {
							form_ok = false;
							if (param_element.getValue() != "") { alert(param_element.getValue()); }
							element_to_check.focus();
							element_to_check.select();
							throw $break;
						}
					}
				}
		  });
	
	return form_ok;
}

function handleForms_delFormfield(toDel) {
	$(toDel).value = '';
}
function HandleForms_leaveIt() {
	if(ChangeContent == true && justSaving == false) {
		event.returnValue = cls_166; //Achtung, ungespeicherte Änderungen gehen verloren!
	}
}

function handleForms_checkCheckbox(which, whichID) {
	try {
		if (which[whichID].disabled != true) {
			which[whichID].checked ? which[whichID].checked = false : which[whichID].checked = true;
		}
	} catch (e) {
		if (which[whichID].disabled != true) {
			which.checked ? which.checked = false : which.checked = true;
		}
	}
}

function handleForms_setReadOnly(whichForm) {
	for (i = 0; i < document.forms[whichForm].elements.length; i++) {
		if (document.forms[whichForm].elements[i].type == "text" || document.forms[whichForm].elements[i].type == "textarea") {
			document.forms[whichForm].elements[i].readonly = true;
		} else {
			document.forms[whichForm].elements[i].disabled = true;
		}
	}
}

function handleForms_isValidDate(dateStr) {
	
	//01. davorsetzen falls nur 5 Stellen (mm.jj) angegeben wurden
	if (dateStr.length == 7) { dateStr = '01.' + dateStr; }
	
	// Checks for the following valid date formats:
	// MM/YY
	// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
	// Also separates date into month, day, and year variables
	var datePat = /^(\d{1,2})(\/|.)(\d{1,2})\2(\d{4})$/;
	
	// To require a 4 digit year entry, use this line instead:
	// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?
	if (matchArray == null) {
		alert(cls_138); //Das Datum liegt nicht im Format tt.mm.jjjj vor
		return false;
	}
	day = matchArray[1]; // parse date into variables
	month = matchArray[3];
	year = matchArray[4];
	if (month < 1 || month > 12) { // check month range
		alert(cls_139); //Der Monat muß zwischen 1 und 12 liegen.
		return false;
	}
	if (day < 1 || day > 31) {
		alert(cls_140); //Der Tag muß zwischen 1 und 31 liegen.
		return false;
	}
	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert( cls_141 + " " + month+" " + cls_142); //Der Monat xy hat keine 31 Tage!
		return false;
	}
	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day>29 || (day==29 && !isleap)) {
			alert(cls_143 + " " + year + " " + cls_144 + " " + day + " " + cls_145); //februar im Jahr xy hat keine 29 Tage
			return false;
		}
	}
	return true;  // date is valid
}

/*	SWFObject v2.2 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

/*
* Oeffnet Uploaddialog und liefert ein Array welches an der Position 0 den Pfad hat, unter welchem die Dateien abgespeichert wurden,
* und in den restlichen Positionen die GUIDs der Dateien.
* @param int maxFiles		maximale Anzahl von hochzuladenen Dateien
* @param string	destination Pfad, in welchem die Dateien gespeichert werden (falls leer dann const_MediaPfadAbsolut)
* @param boolean isRelative true falls relative Pfadangabe (nur relevant falls destination <> leer)
* @param boolean saveToDB	true falls Dateieninfos in Datenbank gespeichert werden sollen
* @param boolean doZipDialog true falls gefragt werden soll ob zip-dateien automatisch entpackt werden sollen
* @param string fileTypes	"|"-getrennte Dateiendungen, die zugelassen werden sollen
* @param int height			Fensterhoehe
* @param int width			Fensterbreite
* @param bool closeWindow	wenn true dann wird fenster nach upload geschlossen
* @return Array welches an der Position 0 den Pfad hat, unter welchem die Dateien abgespeichert wurden,
*		  und in den restlichen die Dateinamen (also GUIDs)
* @author -
*/
function cab_open_CabUploadDialog(maxFiles, destination, isRelative, saveToDB, doZipDialog, fileTypes, height, width, closeWindow) {
	//defaults setzen
	var local_maxFiles = 1;
	var local_destination = "";
	var local_isRelative = 0;
	var local_saveToDB = 0;
	var local_doZipDialog = 0;
	var local_fileTypes = "";
	var local_height = 250;
	var local_width = 450;
	var local_closeWindow = 0;
	//parameter checken
	if (maxFiles != undefined && maxFiles != "") {
		local_maxFiles = maxFiles;
	}
	if (destination != undefined && destination != "") {
		local_destination = destination;
	}
	if (isRelative != undefined && isRelative != "") {
		if (isRelative) { local_isRelative = 1 }
	}
	if (saveToDB != undefined && saveToDB != "") {
		local_saveToDB = saveToDB;
	}
	if (doZipDialog != undefined && doZipDialog != "") {
		if (doZipDialog) { local_doZipDialog = 1 }
	}
	if (fileTypes != undefined && fileTypes != "") {
		local_fileTypes = fileTypes;
	}
	if (height != undefined && height != "" && !isNaN(height)) {
		local_height = height;
	}
	if (width != undefined && width != "" && !isNaN(width)) {
		local_width = width;
	}
	if (closeWindow != undefined && closeWindow != "") {
		if (closeWindow) { local_closeWindow = 1 }
	}
	//window oeffnen
	var returnValue = eval(openDialog('/app/incs/dialogs/upload/default.asp?maxFile=' + local_maxFiles +
		'&dest=' + encode(local_destination) +
		'&isrel=' + local_isRelative +
		'&toDB=' + encode(local_saveToDB) +
		'&zip=' + local_doZipDialog +
		'&closeWindow=' + local_closeWindow +
		'&types=' + encode(local_fileTypes), local_width, local_height, '', '', cls_48654));
		
	//returnValue validieren
	if (typeof (returnValue) == typeof (Array())) {//geht bei ie - nich bei ff also try/catch
		try {
			returnValue.length;
		}
		catch (istWohlDochKeinArrayException) {
			return new Array();
		}
		return returnValue;
	}
	else {
		return new Array();
	}
}

function openDialog(URL, width, height,param1,param2,ModalTitle) {
        var t = this, ua = navigator.userAgent, i, nl, n, base;

		// Browser checks
		t.isOpera = window.opera && opera.buildNumber;
		t.isWebKit = /WebKit/.test(ua);
		t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt;
		t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName);
		t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
		t.isGecko = !t.isWebKit && /Gecko/.test(ua);
		t.isMac = ua.indexOf('Mac') != -1;
		t.win = window
		if (t.isIE6)
		{
			height = height + 40
			width = width + 5
		}
		return window.showModalDialog("/app/incs/modal/modal.asp?ModalTitle=" + ModalTitle + "&URL=" + encode(URL) ,window,"dialogHeight: " + height + "px; dialogWidth: " + width + "px; help: No; resizable:yes; scroll:yes; status: No;");		
}

function openDialogNoResize(URL, width, height,param1,param2,ModalTitle) {
	return showModalDialog("/app/incs/modal/modal.asp?ModalTitle=" + ModalTitle + "&URL=" + encode(URL) ,window,"dialogHeight: " + height + "px; dialogWidth: " + width + "px; dialogTop: ; dialogLeft: px; center: Yes; help: No; resizable:no; scroll:no; status: No;");
}

function cab_HTMLEncode(cab_tmpstr) {
	var cab_result = cab_sub_htmlEncode(cab_tmpstr,false,0);
	return cab_result;
}

function cab_sub_htmlEncode(source, display, tabs) {
	function special(source) 	{
		var result = '';
		for (var i = 0; i < source.length; i++) {
			var c = source.charAt(i);
			if (c < ' ' || c > '~') {
				c = '&#' + c.charCodeAt() + ';';
			}
			result += c;
		}
		return result;
	}
	
	function format(source) {
		// Use only integer part of tabs, and default to 4
		tabs = (tabs >= 0) ? Math.floor(tabs) : 4;
		
		// split along line breaks
		var lines = source.split(/\r\n|\r|\n/);
		
		// expand tabs
		for (var i = 0; i < lines.length; i++) {
			var line = lines[i];
			var newLine = '';
			for (var p = 0; p < line.length; p++) {
				var c = line.charAt(p);
				if (c === '\t') {
					var spaces = tabs - (newLine.length % tabs);
					for (var s = 0; s < spaces; s++) {
						newLine += ' ';
					}
				} else {
					newLine += c;
				}
			}
			// If a line starts or ends with a space, it evaporates in html
			// unless it's an nbsp.
			newLine = newLine.replace(/(^ )|( $)/g, '&nbsp;');
			lines[i] = newLine;
		}
		
		// re-join lines
		var result = lines.join('<br />');
		
		// break up contiguous blocks of spaces with non-breaking spaces
		result = result.replace(/  /g, ' &nbsp;');
		
		// tada!
		return result;
	}

	var result = source;
	// ampersands (&)
	result = result.replace(/\&/g,'&amp;');
	// less-thans (<)
	result = result.replace(/\</g,'&lt;');
	// greater-thans (>)
	result = result.replace(/\>/g,'&gt;');
	
	if (display) {
		// format for display
		result = format(result);
	} else {
		// Replace quotes if it isn't for display,
		// since it's probably going in an html attribute.
		result = result.replace(new RegExp('"','g'), '&quot;');
	}
	// special characters
	result = special(result);
	// tada!
	return result;
}
function openObjectCatalog_noInsert()
{
	var returnVal = openDialog("/app/incs/dialogs/document/insertDocument.asp?ai=2&noInsertOptions=1", 800, 700, "", "", cls_28323)
}

/* ### Smart-Search ### */

	var __cab_smartSearch = null;
	var __cab_smartSearchResults = null;
	var __cab_smartSearchHideTO = null;
	var __cab_smartSearchValue = "";
	
	function smartSearch_show() {
		smartSearch_reposition();
		if (!__cab_smartSearchHideTO) {
			Effect.Appear("cab_smartSearchContainer", { duration: 0.2, queue: "end" });
		} else {
			window.clearTimeout(__cab_smartSearchHideTO);
			__cab_smartSearchHideTO = null;
		}
	}
	
	function smartSearch_reposition() {
		var __e = $("cab_smartSearchContainer");
		var __w = $("cab_smartSearchResult").getDimensions().width;
		if ((__e.getStyle("display") == "none") && (__w == 0)) {
			__e.setStyle({ display: "block", visibility: "hidden" });
			__w = $("cab_smartSearchResult").getDimensions().width;
			__e.setStyle({ display: "none", visibility: "visible" });
		}
		var __repo = document.viewport.getScrollOffsets().left + document.viewport.getWidth() - (parseInt(__e.getStyle("left")) + __w);
		
		if (__repo <= 0) {
			__e.setStyle({ marginLeft: (($("cab_searchbox").getWidth() - __w) + "px") });
		} else {
			__e.setStyle({ marginLeft: "0px" });
		}
		
	}
	
	function smartSearch_hideNow() {
		Effect.Fade("cab_smartSearchContainer", { duration: 0.2, queue: "end", afterFinish: function(_eff) { $("cab_smartSearchContainer").setStyle({ marginLeft: "0px" }); } });
		__cab_smartSearchHideTO = null;
		if (__cab_smartSearchValue != "") {
			$("cab_searchbox").value = __cab_smartSearchValue;
			__cab_smartSearchValue = "";
		}
	}
	
	function smartSearch_hide() {
		if (__cab_smartSearchHideTO) { window.clearTimeout(__cab_smartSearchHideTO); }
		__cab_smartSearchHideTO = window.setTimeout("smartSearch_hideNow()", 1000);
	}
	
	function smartSearch_selectKeyword( param_element ) {
		
		var p_type = typeof(param_element);
		if (p_type == "object") {
			__cab_smartSearchResults.select(".cab_smartSearch_KeywordSelected").each(function(_e) { _e.removeClassName("cab_smartSearch_KeywordSelected"); });
			$(param_element).addClassName("cab_smartSearch_KeywordSelected");
			return;
		}
		if (p_type == "string") {
			
			if (__cab_smartSearchValue == "") { __cab_smartSearchValue = $("cab_searchbox").value; }
				
			var _current = __cab_smartSearchResults.select(".cab_smartSearch_KeywordSelected")[0];
			
			if (_current) { _current.removeClassName("cab_smartSearch_KeywordSelected"); }
			
			if (param_element.toLowerCase() == "next") {
				if (!_current || !_current.next(".cab_smartSearch_KeywordItem")) {
					_current = __cab_smartSearchResults.select(".cab_smartSearch_KeywordItem")[0];
				} else {
					_current = _current.next(".cab_smartSearch_KeywordItem");
				}
			}
			if (param_element.toLowerCase() == "previous") {
				if (!_current || !_current.previous(".cab_smartSearch_KeywordItem")) {
					var _temp = __cab_smartSearchResults.select(".cab_smartSearch_KeywordItem");
					_current = _temp[_temp.length-1];
				} else {
					_current = _current.previous(".cab_smartSearch_KeywordItem");
				}
			}
			
			if (_current) {
				_current.addClassName("cab_smartSearch_KeywordSelected");
				if (__cab_smartSearchValue != _current.innerHTML) { $("cab_searchbox").value = _current.innerHTML; }
			}
		}
	}
	
	function smartSearch_setValue( param_submit ) {
		var _current = __cab_smartSearchResults.select(".cab_smartSearch_KeywordSelected")[0];
		if (_current) {
			__cab_smartSearchValue = _current.innerHTML;
			$("cab_searchbox").value = _current.innerHTML;
		}
		if ((typeof(param_submit) == "boolean") && param_submit) {
			smartSearch_hideNow();
			$("cab_searchbox").up("form").submit();
		}
	}
	
	function smartSearch_handleCursor( param_event ) {
		
		var _k = param_event.keyCode;
		if (!_k || isNaN(_k)) { return false; }
		
		if (_k == 40) { // DN
			smartSearch_selectKeyword("next");
			return true;
		}
		if (_k == 38) { // UP
			smartSearch_selectKeyword("previous");
			return true;
		}
		if ((_k == 37) || (_k == 39)) { return true; } // LE + RI
		if (_k == 13) { // ENTER
			smartSearch_setValue(true);
			return true;
		}
		if (_k == 27) { // ESC
			smartSearch_hideNow();
			return true;
		}
	}
	
	function smartSearch_setUp() {
		
		// Pruefung, ob das Smart-Search Modul schon eingebunden wurde
		var __exists_already = $("cab_smartSearchContainer");
		if (__exists_already) { return; }
		
		var _input = $("cab_searchbox");
		if (!_input) {
			// Keine Vorbereitung fuer Smart-Search
			return;
		}
		
		var __cab_smartSearch = new Element("div", { id: "cab_smartSearchContainer" });
		$$("body")[0].insert({bottom: __cab_smartSearch});
		
		if (!__cab_smartSearch) {
			// Fehler beim Einfuegen der Smart-Search Ergebnis-Box
			throw("Cabacos Smart-Search could not be initialised.");
			return;
		}
		
		_input.writeAttribute("autocomplete", "off");
		
		__cab_smartSearchResults = new Element("div", { id: "cab_smartSearchResult" });
		__cab_smartSearch.update(__cab_smartSearchResults)
			.clonePosition(_input, { setWidth: false, setHeight: false, offsetTop: _input.getHeight() }).setStyle({ display: "none", minWidth: (_input.getWidth() + "px") });
		
		$("cab_searchbox").observe("keyup", function(param_event) {
				if (!__cab_smartSearch.visible() && (__cab_smartSearchResults.innerHTML != "")) { smartSearch_show(); }
				if (!smartSearch_handleCursor(param_event) && ($("cab_searchbox").value != "")) {
					new Ajax.Request("/app/incs/elements/smartsearch_ajax.asp?kw=" + encode($("cab_searchbox").value), { evalScripts: true, onSuccess: function(_t) {
							if (_t.responseText != "") {
								__cab_smartSearchResults.update(_t.responseText);
								if (!__cab_smartSearch.visible()) { smartSearch_show(); } else { smartSearch_reposition(); }
							} else {
								__cab_smartSearchResults.update("");
								smartSearch_reposition();
								smartSearch_hideNow();
							}
						}});
				}
				if (($("cab_searchbox").value == "") && __cab_smartSearch.visible()) { smartSearch_hideNow(); }
			}).observe("blur", function(param_event) {
				if (__cab_smartSearch.visible()) { smartSearch_hide(); }
			}).up("form").observe("submit", function(param_event) {
				if (__cab_smartSearch.visible()) { param_event.stop(); }
			});
		
		Event.observe(window, "resize", function(e) {
				var _input = $("cab_searchbox");
				__cab_smartSearch.clonePosition(_input, { setWidth: false, setHeight: false, offsetTop: _input.getHeight() });
				smartSearch_reposition();
			});
	}
	
	function cab_smartSearchEmbed() {
		if ((typeof(Event) == "object") && (typeof(Prototype) == "object")) {
			Event.observe(window, "load", function(e) { smartSearch_setUp(); });
		}
	}