/* ### Cabacos Default JS ### */
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, createnew) {
	createnew = (createnew === true) ? "&id=-1" : "";
	var path = (global_SessionMe || "/") + ((global_SessionMe || "").indexOf("?") == -1 ? "?" : "&") + "redak=1&editor=" + editor + createnew;
	if (newWindow == -1) {
		var windowName = window.name;
		if (windowName.indexOf('RedakWindow') == -1) {
			win1 = window.open(path, '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();
			return;
		}
	}
	window.location.href = path;
}
function OpenUserMode(newWindow, unused, altLink) {
	var path = (global_SessionMe || "/") + ((global_SessionMe || "").indexOf("?") == -1 ? "?" : "&") + "redak=0";
	if (newWindow == -1) {
		win1 = window.open(path, 'Userwindow' + global_SessionID, '');
		win1.moveTo(0, 0);
		win1.resizeTo(screen.availWidth, screen.availheight);
		window.opener = null;
		top.frames.close();
		return;
	}
	path = (((!global_SessionMe || global_SessionMe.split("/").last().toLowerCase() == "e-1.htm") ? altLink : global_SessionMe) || window.location.href.split("?")[0] || "/");
	window.location.href = path + (path.indexOf("?") == -1 ? "?" : "&") + "redak=0";
}
function resetAdminRights() { window.open("/admin/resetAdmin.asp", "resetAdmin", "width=450,height=180,resizable=no,scrollbars=no"); }
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 ### */
function popImage(imageURL, imageTitle) {
	imgWin = window.open('about:blank', 'popup', 'resizable=yes,scrollbars=no,width=700,height=700,left=100,top=100');
	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; if(parseInt(navigator.appVersion.charAt(0))>=4){isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(){width=(document.images[0].width); height=(document.images[0].height);');
		writeln('if(isIE){window.resizeTo(100,100); window.resizeTo(width+10,height+100-document.documentElement.clientHeight);}else{window.innerWidth=width; window.innerHeight=height;}}');
		writeln('function doTitle(){document.title="' + imageTitle + '";}');
		writeln('</sc' + 'ript>');
		writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()"><div id="imgContainer" style="height:auto;"><img name="George" src=' + imageURL + ' style="display:block"></div></body></html>');
		close();
	}
}

function encode(input) { var hexOutput = ""; for (i = 0; i < input.length; i++) { hexOutput = hexOutput + Dec2Hex(input.charCodeAt(i)); } return hexOutput; }
function decode(input) { var 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") });
	}
}
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) { }
	$(transferFrom + "_Text").value = CabSelect_inputStringRubsLong;
	$(transferFrom + "_Value").value = CabSelect_inputStringRubs;
}
function CabSelect_hideMeReal(myDiv) {
	CabSelect_transferLangs(myDiv);
	$(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, options) {
	options = options || {};
	window.open("/app/incs/dialogs/userlist/userlist.asp?sql=" + encode(sql) +
		"&ul=" + encode(selectionType) + "&target=" + encode(targetField) +
		"&init=" + encode(initUsers) + (!!group_sql ? ("&group_sql=" + encode(group_sql)) : "") +
		(!!options.guest ? "&select_guest=true" : "") + "&cb=" + ("" + Math.random()).slice(2),
		"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;
	} 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").setStyle({ visibility: "hidden" }); try { Cab_LeftCorner.hideSubMenus(); } catch (e) { } }
function showLcMenu() { $("Cab_leftCornerDiv").setStyle({ visibility: "visible" }); }

/* ### 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 cab_showGlossary(glossGUID, thisPos, offX, offY) {
	var tempX = Position.cumulativeOffset(thisPos)[0] + offX;
	var tempY = Position.cumulativeOffset(thisPos)[1] + offY;
	var tempZ = thisPos.offsetHeight;
	var bad_browser = (Prototype.Browser.IE && (parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5)) == 6 || parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5)) == 7));
	if(bad_browser){
		tempX = event.clientX + document.viewport.getScrollOffsets().left - 10;
		tempY = event.clientY + document.viewport.getScrollOffsets().top - 20;
	}
	if (tempX < 0) { tempX = 0; }
	if (tempY < 0) { tempY = 0; }
	try { window.clearTimeout(cab_showGlossaryEvent); } catch (e) { }
	try { window.clearTimeout(cab_hideGlossaryEvent); } catch (e) { }
	var myUrl = "";
	try {
		var tmp = cab_glossary_IndivUrl.length;
		myUrl = cab_glossary_IndivUrl;
	} catch (e) { myUrl = ''; }
	cab_showGlossaryEvent = window.setTimeout("cab_showGlossaryExecute('" + myUrl + "','" + glossGUID + "'," + tempX + "," + tempY + "," + tempZ + ");", 1000);
}
function cab_setGlossaries() { }
function cab_showGlossaryExecute(glossUrl, glossGUID, thisLeft, thisTop, thisHeight) {
	if (glossUrl == '') { glossUrl = 'app'; }
	$("cab_glossaryInfo").hide();
	$("cab_glossaryInfo_editButton").hide();
	$("cab_glossaryInfo_delButton").hide();
	$("cab_glossaryContent").update('<img src="/app/skins/default/images/Glossary_loading.gif" style="padding-left:105px; padding-top:40px;"/>');
	$("cab_glossaryInfo").show();
	$("cab_glossaryInfo").style.top = thisHeight + thisTop + 'px';
	$("cab_glossaryInfo").style.left = thisLeft + 'px';
	new Effect.Move($("cab_glossaryInfo"), { x: 0, y: 7, duration: 0.2, mode: 'relative' });
	cab_lastGlossaryGUID = glossGUID;
	var url = "/" + glossUrl + "/glossary/getGlossary.asp?gid=" + glossGUID;
	new Ajax.Request(url, { method: 'get', onSuccess: function (transport) {
		var backText = transport.responseText;
		try {
			if (backText.slice(0, 2) == '1#') { $("cab_glossaryInfo_editButton").show(); $("cab_glossaryInfo_delButton").show(); }
			$("cab_glossaryContent").update(backText.slice(2));
		} catch (e) { } 
	} 
	});
}
function cab_hideGlossary(thisSpan) {
	try { window.clearTimeout(cab_showGlossaryEvent); } catch (e) { }
	cab_hideGlossaryEvent = window.setTimeout("$('cab_glossaryInfo').hide();", 1000);
}

/* ### handleforms ### */
function handleForms_secureSerialize(element) {
	element = $(element);
	var h = $H(element.serialize(true)), a = [];
	h.each(function (n) { a.push(n.key + "=" + encode(n.value)); });
	a.push("cab_encoded=1");
	return a.join("&");
}

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) {
		if (!param_element.readAttribute("name"))
			return;
		var splitted_name = param_element.readAttribute("name").split("_"),
			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 "datetimep": if (!handleForms_isValidDateTime(elements_value)) { form_ok = false; } break;
				case "datetime": if ((elements_value != "") && (!handleForms_isValidDateTime(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":
				case "emailcopyp": if (!isValidEmailAddress(elements_value)) { form_ok = false; } break;
				case "email":
				case "emailcopy": 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() == "" && ["text", "datep", "datetimep", "intp", "emailp", "emailcopyp"].indexOf((element_to_check.readAttribute("name") || "").split("_").last()) != -1)
					|| (element_to_check.tagName == "INPUT" && (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; } }
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) {
	if (dateStr.length == 7) { dateStr = '01.' + dateStr; }
	var datePat = /^(\d{1,2})(\/|.)(\d{1,2})\2(\d{4})$/;
	var matchArray = dateStr.match(datePat);
	if (matchArray == null) { alert(cls_138); return false; }
	day = matchArray[1];
	month = matchArray[3];
	year = matchArray[4];
	if (month < 1 || month > 12) { alert(cls_139); return false; }
	if (day < 1 || day > 31) { alert(cls_140); return false; }
	if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) { alert(cls_141 + " " + month + " " + cls_142); return false; }
	if (month == 2) {
		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); return false; }
	}
	return true;
}
function handleForms_isValidTime(timeStr) {
	if (!/^(\d{1,2}):(\d{1,2})(:(\d{1,2})){0,1}/.test(timeStr)) {
		alert(cls_34725);
		return false;
	}
	var t = timeStr.split(":"),
		l = t.length,
		p;
	while (l--) {
		p = parseInt(t[l]);
		if (p == NaN || p < 0 || (l == 0 && p > 23) || (l > 0 && p > 59)) {
			alert(cls_34715);
			return false;
		}
	}
	return true;
}
function handleForms_isValidDateTime(dateTimeStr) {
	var dt = dateTimeStr.replace(/([0-9]{1,2}).([0-9]{1,2}).(([0-9]{1,2}){1,2})(\s([0-9]{1,2}):([0-9]{1,2})(:([0-9]{1,2})){0,1}){0,1}/, "year=$3&month=$2&day=$1&hour=$6&minute=$7&second=$9").toQueryParams(),
		d = (!!dt.day ? (dt.day + ".") : "") + dt.month + "." + dt.year,
		t = (!!dt.hour && !!dt.minute) ? (dt.hour + ":" + dt.minute + (!!dt.second ? (":" + dt.second) : "")) : "";
	if (dateTimeStr != (d + " " + t).strip()) {
		alert(cls_34705);
		return false;
	}
	if (!handleForms_isValidDate(d))
		return false;
	if (t != "" && !handleForms_isValidTime(t))
		return false;
	return true;
}

/* Ein zufaelliges, dadaistisches Gedicht: */
function generateDadaLyrics() {
	alert($A($R(1, 490)).reject(function (n) { return Math.random() < 1 / 3 || Math.random() > 2 / 3; }).sortBy(function (n) { return Math.random(); }).map(function (n) { var r = window["cls_" + n]; return (!r ? "" : (r + (/([.!?])$/g.test(r) ? "\n" : " "))); }).join(""));
}

/*	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 } } } } ();

/* Simple AJAX Code-Kit (SACK) v1.6.1 - (c) 2005 Gregory Wild-Smith www.twilightuniverse.com - Software licenced under a modified X11 licence, see documentation or authors website for more details */
function sack(file) { this.xmlhttp = null; this.resetData = function () { this.method = "POST"; this.queryStringSeparator = "?"; this.argumentSeparator = "&"; this.URLString = ""; this.encodeURIString = true; this.execute = false; this.element = null; this.elementObj = null; this.requestFile = file; this.vars = new Object(); this.responseStatus = new Array(2); }; this.resetFunctions = function () { this.onLoading = function () { }; this.onLoaded = function () { }; this.onInteractive = function () { }; this.onCompletion = function () { }; this.onError = function () { }; this.onFail = function () { }; }; this.reset = function () { this.resetFunctions(); this.resetData(); }; this.createAJAX = function () { try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { this.xmlhttp = null; } } if (!this.xmlhttp) { if (typeof XMLHttpRequest != "undefined") { this.xmlhttp = new XMLHttpRequest(); } else { this.failed = true; } } }; this.setVar = function (name, value) { this.vars[name] = Array(value, false); }; this.encVar = function (name, value, returnvars) { if (true == returnvars) { return Array(encodeURIComponent(name), encodeURIComponent(value)); } else { this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true); } }; this.processURLString = function (string, encode) { encoded = encodeURIComponent(this.argumentSeparator); regexp = new RegExp(this.argumentSeparator + "|" + encoded); varArray = string.split(regexp); for (i = 0; i < varArray.length; i++) { urlVars = varArray[i].split("="); if (true == encode) { this.encVar(urlVars[0], urlVars[1]); } else { this.setVar(urlVars[0], urlVars[1]); } } }; this.createURLString = function (urlstring) { if (this.encodeURIString && this.URLString.length) { this.processURLString(this.URLString, true); } if (urlstring) { if (this.URLString.length) { this.URLString += this.argumentSeparator + urlstring; } else { this.URLString = urlstring; } } this.setVar("rndval", new Date().getTime()); urlstringtemp = new Array(); for (key in this.vars) { if (false == this.vars[key][1] && true == this.encodeURIString) { encoded = this.encVar(key, this.vars[key][0], true); delete this.vars[key]; this.vars[encoded[0]] = Array(encoded[1], true); key = encoded[0]; } urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0]; } if (urlstring) { this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator); } else { this.URLString += urlstringtemp.join(this.argumentSeparator); } }; this.runResponse = function () { eval(this.response); }; this.runAJAX = function (urlstring) { if (this.failed) { this.onFail(); } else { this.createURLString(urlstring); if (this.element) { this.elementObj = document.getElementById(this.element); } if (this.xmlhttp) { var self = this; if (this.method == "GET") { totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString; this.xmlhttp.open(this.method, totalurlstring, true); } else { this.xmlhttp.open(this.method, this.requestFile, true); try { this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } catch (e) { } } this.xmlhttp.onreadystatechange = function () { switch (self.xmlhttp.readyState) { case 1: self.onLoading(); break; case 2: self.onLoaded(); break; case 3: self.onInteractive(); break; case 4: self.response = self.xmlhttp.responseText; self.responseXML = self.xmlhttp.responseXML; self.responseStatus[0] = self.xmlhttp.status; self.responseStatus[1] = self.xmlhttp.statusText; if (self.execute) { self.runResponse(); } if (self.elementObj) { elemNodeName = self.elementObj.nodeName; elemNodeName.toLowerCase(); if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea") { self.elementObj.value = self.response; } else { self.elementObj.innerHTML = self.response; } } if (self.responseStatus[0] == "200") { self.onCompletion(); } else { self.onError(); } self.URLString = ""; break; } }; this.xmlhttp.send(this.URLString); } } }; this.reset(); this.createAJAX(); }

/*
* 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=" + encode(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=" + encode(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 ### */
function cab_smartSearchEmbed(options) {
	if (typeof Event == "undefined" || typeof Prototype == "undefined")
		return;
	this.options = Object.extend({
		suggestions: true,		// use suggestion box and autocompletition for search box
		autosubmit: true,		// auto submit instantly after selecting a suggestion
		inline_search: false	// enable search for selection of inline content,
	}, options || {});
	// STRONGLY REQUIRES PATCH OF SCRIPTACULOUS' AUTOCOMPLETER TO ALWAYS TRIGGER THE ONSHOW CALLBACK
	// REGARDLESS OF THE UPDATE-ELEMENT's DISPLAY PROPERTY!!! (Autocompleter.Base.show())
	if (this.options.suggestions)
		new Event.observe(document, "dom:loaded", (function () {
			var element = (options || {}).searchbox || $("cab_searchbox") || $$(".cab_smartSearchBox")[0],
				update = $("cab_smartSearchContainer");
			if (!element)
				return;
			if (!update)
				Element.insert(document.body, { bottom: (update = new Element("div", { id: "cab_smartSearchContainer" })) });
			function repositionContainer(param_element, param_update) {
				param_element = param_element || element;
				param_update = param_update || update;
				param_update.clonePosition(param_element, { setWidth: false, setHeight: false, offsetTop: param_element.offsetHeight })
							.setStyle({ minWidth: param_element.offsetWidth + "px" });
				var viewport_x = document.viewport.getScrollOffsets().left,
					viewport_w = document.viewport.getWidth(),
					update_x = parseInt(param_update.style.left);
				if (update_x + param_update.getWidth() > viewport_x + viewport_w)
					param_update.style.left = (update_x + param_element.offsetWidth - param_update.getWidth()) + "px";
			}
			new Ajax.Autocompleter(element, update, "/app/incs/elements/smartSearch.ajax.asp",
				{ minChars: 3, paramName: "keyword", instantSubmit: this.options.autosubmit,
					callback: function (element, entry) { return entry + "&cache_buster=" + ("" + Math.random()).slice(2); },
					updateElement: function (selectedElement, scope) {
						var value = '';
						if (scope.options.select) {
							var nodes = $(selectedElement).select('.' + scope.options.select) || [];
							if (nodes.length > 0) value = Element.collectTextNodes(nodes[0], scope.options.select);
						} else
							value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');

						scope.element.value = value;
						scope.oldElementValue = scope.element.value;
						scope.element.focus();
					},
					onShow: function (element, update) {
						repositionContainer(element, update);
						if (update.getStyle("display") == "none")
							update.appear({ duration: 0.15 });
					},
					onHide: function (element, update) { update.fade({ duration: 0.15 }); }
				}
			);
			repositionContainer(element, update);
			Event.observe(document.onresize ? document : window, "resize", function () {
				repositionContainer();
			});
		}).bind(this));
	if (this.options.inline_search)
		new Event.observe(document, "dom:loaded", function () {
			var helper = $("cab_smartSearchInlineHelper");
			if (!!helper)
				return;
			// instantiate helper form
			helper = (new Element("div", { id: "cab_smartSearchInlineHelper" }))
				.insert({ top: (new Element("form", { action: "/app/read/suchergebnisse.asp", method: "post" }))
				.insert({ top: new Element("input", { name: "suchtext", type: "hidden", value: "" }), bottom: (new Element("button", { type: "submit" })).update(cls_35055) })
				});
			Element.insert(document.body, { bottom: helper });
			helper.setStyle({ position: "absolute", display: "none" });
			function getCurrentSelection() {
				return window.getSelection ? window.getSelection() : (document.getSelection ? document.getSelection() : (document.selection ? document.selection.createRange().text : null));
			}
			function repositionHelper(param_helper, param_pos) {
				param_helper = param_helper || helper;
				param_pos = param_pos || {};
				param_helper.setStyle({ left: ((param_pos.left || (-200)) + "px"), top: ((param_pos.top || (-200)) + "px") });
			}
			function handleHelper(event) {
				var text = getCurrentSelection(),
				position = !!event ? { left: (Event.pointerX(event) - 10), top: (Event.pointerY(event) - helper.getHeight() - 10)} : null;
				if (!text || text == "") {
					if (helper.visible())
						helper.fade({ duration: 0.25 });
					return;
				}
				if (event.element(event).up("#cab_smartSearchInlineHelper"))
					return;
				repositionHelper(null, position);
				helper.appear({ duration: 0.5 });
			}
			repositionHelper();
			new Event.observe(document, "mouseup", handleHelper);
			helper.down("form").observe("submit", function (event) {
				var text = getCurrentSelection() || "";
				helper.down("input").value = text;
				if (text == "")
					event.stop();
				else
					Event.stopObserving(document, "mouseup", handleHelper);
			});
		});
}

var InlinePane = function (element, options) {

	//
	// private properties
	//

	element = $(element) || element || ("inlinepane-" + ("" + Math.random()).slice(2));
	options = Object.extend({
		"class": null,
		title: "Inline Pane",
		content: "",
		width: 400,
		height: "auto",
		modal: false,
		visible: false
	}, options || {});
	options.buttons = options.buttons || [{ label: "apply", type: "submit" }, { label: "cancel", type: "reset"}];
	var content,
		form,
		that;


	//
	// private methods
	//

	function onButtonHandling(event) {
		var button = options.buttons.find(function (n) { return n.__element == Event.element(event); });
		if (!button)
			return;
		if (typeof button.callback == "function")
			button.callback(form.serialize(true), that);
		if (button.type != "reset")
			event.stop();
		if (["submit", "reset"].indexOf(button.type) != -1)
			doHide();
	}

	function doRepositioning(fade, duration) {
		var vd = document.viewport.getDimensions(),
			vso = document.viewport.getScrollOffsets(),
			pd = element.getDimensions(),
			po = element.viewportOffset(),
			no = {
				left: vso.left + (vd.width - pd.width) / 2,
				top: vso.top + (vd.height - pd.height) / 2
			};
		if (fade === false)
			element.setStyle({ left: (no.left + "px"), top: (no.top + "px") });
		else
			new Effect.Move(element, { x: no.left, y: no.top, mode: "absolute", duration: ((duration || 0.5) / 2) });
	}

	function doShow(fade, duration) {
		doRepositioning(fade, duration);
		if (fade === false)
			element.show();
		else
			element.appear({ duration: duration || 0.5 });
	}

	function doHide(fade, duration) {
		if (fade === false)
			element.hide();
		else
			element.fade({ duration: duration || 0.5 });
	}


	//
	// constructor
	//

	(function () {
		// check element for already injected inline pane
		if (typeof element == "object" && element.hasClassName("cab_inlinepane"))
			element = element.down(".cab_inlinepane_content").writeAttribute("id", element.remove().identify());

		// setup pane's frame, header and footer bar
		var dummy = (new Element("div")).addClassName("cab_inlinepane").setStyle({ display: "none" }),
			temp;
		Element.insert(document.body, { bottom: dummy });
		form = (new Element("form")).insert({
			top: (new Element("div")).addClassName("cab_inlinepane_header").update(options.title),
			bottom: (new Element("div")).addClassName("cab_inlinepane_footer")
		});
		dummy.insert({ top: form.observe("submit", function (event) { event.stop(); }) })

		// setup content
		content = (new Element("div")).addClassName("cab_inlinepane_content").setStyle({
			width: (options.width + (typeof options.width == "number" ? "px" : "")),
			height: (options.height + (typeof options.height == "number" ? "px" : ""))
		});
		dummy.down(".cab_inlinepane_header").insert({ after: content });
		content.update((typeof element == "object") ? element.innerHTML : (typeof options.content == "string" ? options.content : ""))
		// special case - load content per ajax request
		if (typeof options.content == "object" && typeof options.content.source == "string") {
			temp = options.content.parameters || "";
			if (typeof temp == "object")
				temp = $H(temp).toQueryString();
			if (!!temp)
				temp += "&";
			new Ajax.Request(options.content.source, {
				method: options.content.method || "post",
				parameters: (temp + "cache_buster=" + ("" + Math.random()).slice(2)),
				onFailure: (function (transport) {
					if (typeof options.content.onFailure == "function")
						options.content.onFailure(transport.status, that);
				}).bind(this),
				onSuccess: (function (transport) {
					that.update(transport.responseText || "");
					if (typeof options.content.onSuccess == "function")
						options.content.onSuccess(transport.responseText, that);
					if (!that.visible())
						that.show();
				}).bind(this)
			});
		}

		if (typeof element == "string")
			dummy.writeAttribute("id", element);
		else if (typeof element == "object")
			dummy.writeAttribute("id", $(element).remove().identify());
		element = dummy;
		if (typeof options["class"] == "string")
			element.addClassName(options["class"]);

		// setup buttons
		temp = options.buttons.length;
		while (temp--) {
			dummy = new Element("button", { type: (options.buttons[temp].type || "button").toLowerCase() });
			element.down(".cab_inlinepane_footer").insert({ top: dummy.update(options.buttons[temp].label || "button") });
			options.buttons[temp].__element = dummy.observe("click", onButtonHandling.bind(this));
		}

		// setup pane's dragging
		new Draggable(element, {
			handle: element.down(".cab_inlinepane_header"),
			onStart: function (drgobj) { drgobj.element.style.zIndex = 20000; }
		});

		// finally, setup initial display
		if (options.visible) {
			doRepositioning(false);
			doShow();
		}
	})();


	that = {

		//
		// public methods
		//

		// show(fade, duration)
		// displays the pane,
		// depending on the value of *fade* appears with a smooth fadein effect (true)
		// or just a sudden display (false) - default is true
		// opt. *duration* is for the smooth fadein, in seconds - default is 0.5
		show: function (fade, duration) {
			doShow(fade, duration);
			return this;
		},

		// hide(fade, duration)
		// hides the pane,
		// see "show()" for details on the args
		hide: function (fade, duration) {
			doHide(fade, duration);
			return this;
		},

		// visible()
		// returns whether the pane is visible (true) or not (false
		visible: function () {
			return element.visible();
		},

		// update(text)
		// updates the inline pane's content with *text* (String / Element(s))
		update: function (text) {
			content.update(text);
			return this;
		},

		// insert(insertion)
		// inserts Prototypish *insertion* into content (i.e. { after: new Element("div") } etc.)
		insert: function (insertion) {
			content.insert(insertion);
			return this;
		},

		// serializeForm()
		// serializes the inline pane's form elements
		serializeForm: function () {
			return form.serialize(true);
		},

		// quit()
		// quits the inline pane and calls function *onfinish* afterwards
		quit: function (onfinish) {
			element.remove();
			if (typeof onfinish == "function")
				onfinish(this);
		}
	};

	return that;
};
