	function hideInputBg(field)
	{
		ipField = document.getElementById(field);
		ipField.style.background = "#fff";
	}
	
	
	function IE_Refresh(){
		if (document.all) location.reload();
	}
	window.onresize = IE_Refresh;
	
	LL_Logger = {
		loggingPane: null,
		llog: function(){
			var logStr = '';
			for (var i = 0; i < arguments.length; ++i){
				var arg = arguments[i];
				logStr += arg + ' ';
			}
			var item = DIV({'style': {'border-bottom': '1px solid #e1e1e1', 'padding': '3px 0'}}, repr(logStr));
			if (!$('logging_pane')) this.makeLoggingPane();
			setTimeout(
				function(){
					$('logging_pane').appendChild(item);
				},
				500
			);
		},
		makeLoggingPane: function(){
			if (!this.loggingPane){
				var b = getElementsByTagAndClassName('body', null)[0];
				var content = DIV({'style': {'border': '1px solid #999'}});
				var inner = DIV(
					{
						'style': {
							'background-color': '#e1e1e1',
							'padding': '2px 10px',
							'border-bottom': '1px solid #999',
							'color': '#356798',
							'font-weight': 'bold',
							'font-size': '15px'
						}
					},
					"LIVINGLOGIC LOG"
				);
				var scroller = DIV(
					{
						'style': {
							'background-color': '#fff',
							'padding': '10px',
							'height': '180px',
							'overflow': 'auto'
						},
						'id': 'logging_pane'
					}
				);
				content.appendChild(inner);
				content.appendChild(scroller);
				setTimeout(function(){b.appendChild(content)}, 500);
				this.loggingPane = content;
			}
		}
	}
	
	llog = function(){
		LL_Logger.llog.apply(LL_Logger, arguments);
	}


/* >> globals */
	downloadFormFirstInit = true;
/* << */


/* >> Xist Pixel (required MochiKit 1.4+) Version: rel-1-0-0 */
	function makeXistPixel(color, h, w){
		var name = color ? color + '.gif': 'spc.gif';
		var imgAttrs = {'src': '../px/' + name, 'alt': '', 'height': 1, 'width': 1};
		if (h) imgAttrs.height = h;
		if (w) imgAttrs.width = w;
		return IMG(imgAttrs);
	}
/* << */
	
/* >> Standard Popup functions */
	function StandardPopup(Attrs){
		// @params IE and Gecko-Browser compatible window parameter attributes.
		this.params = ['left', 'top', 'location', 'menubar', 'resizable', 'scrollbars', 'status', 'toolbar', 'height', 'width'];
		this.href = Attrs.href ? Attrs.href : 'http://www.google.de'; // url to the popup content
		this.name = Attrs.name ? Attrs.name : 'standardPopup'; // standard window name
		this.height = Attrs.height ? Attrs.height : '550'; // standard height opened window
		this.width = Attrs.width ? Attrs.width : '650'; // standard width opened window
		this.left = Attrs.left ? Attrs.left : null; // window left position from the upper left corner of the client screen
		this.top = Attrs.top ? Attrs.top : null; // window top position from the top of the client screen
		this.locationbar = Attrs.location ? Attrs.location : 'no'; // ['yes', 'no'] display the locationbar
		this.menubar = Attrs.menubar ? Attrs.menubar : 'no'; // ['yes', 'no'] display the menubar
		this.resizable = Attrs.resizable ? Attrs.resizable : 'yes'; // ['yes', 'no'] allows the user to change the window size
		this.scrollbars = Attrs.scrollbars ? Attrs.scrollbars : 'yes'; // ['yes', 'no'] show scrollbars if necessary
		this.status = Attrs.status ? Attrs.status : 'no'; // ['yes', 'no'] show statusbar
		this.toolbar = Attrs.toolbar ? Attrs.toolbar : 'no'; // ['yes', 'no'] show toolbar
		this.blank = Attrs.blank ? Attrs.blank : 'false'; // ['true', 'false'] show window as popup or blank window
		this.wRef = null // window reference to make changes on the opened windowe
	}
	
	StandardPopup.prototype._formatParams = function()
	{
		var str = '\'';
		var objParam;
		for (var i = 0; i < this.params.length; ++i){
			objParam = this.params[i] == 'location' ? 'locationbar' : this.params[i];
			p = eval("this." + objParam);
			if (p){
				str += this.params[i] + '=' + p + ',';
			}
		}
		str = str.substring(0, str.length -1);
		str += '\'';
		return str;
	}
	
	StandardPopup.prototype.open = function(){
		if (this.blank){
			this.wRef = window.open(this.href);
		}else{
			var paraStr = this._formatParams();
			this.wRef = window.open(this.href, this.name, paraStr);
		}
		if (this.wRef)
			this.wRef.focus();
		return false;
	}
/* << */


/* >> rss publisher, requires Mochikit 1.4+*/
	RSSPublisher = {
		publishers: false,
		register: function(args){
			this.append(args);
		},
		append: function(args){
			var RSSObj = new RSS();
			RSSObj.target = args.target;
			RSSObj.source = args.source;
			RSSObj.tags = args.tags;
			RSSObj.descLength = args.descLength;
			RSSObj.descLengthEnding = args.descLengthEnding
			RSSObj.pubDateFormat = args.pubDateFormat;
			RSSObj.refresh = args.refresh;
			RSSObj.itemsCount = args.itemsCount ? args.itemsCount : 5;
			RSSObj.staticTest = args.staticTest;
			if (args.acceptMimeTypes && typeof args.acceptMimeTypes == 'object'){
				RSSObj.acceptMimeTypesCgiStr = this.createMimeTypeCgiStr(args.acceptMimeTypes);
			}
			if (typeof this.publishers != 'boolean'){
				this.publishers.push(RSSObj);
			}else{
				this.publishers = [RSSObj];
			}
			RSSObj.getSource();
		},
		createMimeTypeCgiStr: function(mtList){
			var str = '&mimetypes=';
			for (var i = 0; i < mtList.length; ++i){
				str += encodeURIComponent(this.strTrim(mtList[i])) + ',';
			}
			return str.substring(0, str.length -1);
		},
		strTrim: function(str){
			var ccSpace = 32;
			var ps = 0;
			var pe = 0;
			var psLock = false;
			var peLock = false;
			for (var i = 0; i < str.length; ++i){
				if (str.charCodeAt(i) == ccSpace){
					if (! psLock) ps++;
					if (str.charCodeAt(str.length - 1 - i) == ccSpace){
						if (! peLock) pe++;
					}else{
						peLock = true;
					}
				}else{
					psLock = true;
					if (str.charCodeAt(str.length - 1 - i) == ccSpace){
						if (! peLock) pe++;
					}else{
						peLock = true;
					}
				}
			}
			var string = str.substring(ps, str.length);
			return string.substring(0, str.length - pe - ps);
		}
	}


	function RSS(){
		this.root = DIV(null);
		this.target = null;
		this.source = null;
		this.tags = ['title', 'description'];
		this.descLength = null;
		this.descLengthEnding = 32;
		this.pubDateFormat = 2;
		this.refresh = null;
		this.itemsCount = null;
		this.staticTest = false;
		this.acceptMimeTypesCgiStr = null;
		this.charCount = 0;
		this.stop = false;
	}
	
	RSS.prototype.getSource = function(){
		this.charCount = 0;
		this.stop = false;
		this.root.innerHTML = '';
		if (this.staticTest){
			var url = this.source;
		}else{
			var url = '/urlfetcher/?url=' + encodeURIComponent(this.source);
		}
		if (this.acceptMimeTypesCgiStr && ! this.staticTest) url += this.acceptMimeTypesCgiStr;
		var def = doSimpleXMLHttpRequest(url);
		def.addCallbacks(bind('handleSource', this), bind('handleSourceError', this));
		if (this.refresh) callLater(this.refresh, bind('getSource', this));
	}
	
	RSS.prototype.handleSource = function(def){
		var xmlElements = def.responseXML.documentElement;
		var items = xmlElements.getElementsByTagName('item');
		var count = items.length;
		if (this.itemsCount <= items.length) count = this.itemsCount;
		var tags = this.tags;
		for (var i = 0; i < count; ++i){
			var href = this.getLink(items[i]);
			this.appendElement(this.getItem(items[i], tags, href, i), this.root);
		}
		this.publish();
	}
	
	RSS.prototype.handleSourceError = function(def){
		log(def.message);
		this.target.appendChild(DIV(null, 'Service ist voruebergehend nicht verfuegbar.'));
	}
	
	RSS.prototype.appendElement = function(elm, root){
		if (elm){
			root.appendChild(elm);
			return true;
		}
		return false;
	}

	RSS.prototype.cloneXML2DOM = function(src, tar, igRoot, len, correctHyphen){
		for (var i = 0; i < src.childNodes.length; i++){
			var node = src.childNodes[i];
			switch (node.nodeType){
				case 1:
					if (! igRoot){
						var newNode = tar.appendChild(document.createElement(node.nodeName));
						for (var j = 0; j < node.attributes.length; j++){
							newNode.setAttribute(node.attributes[j].nodeName, node.attributes[j].nodeValue);
						}
						this.cloneXML2DOM(node, newNode, false, correctHyphen);
						break;
					}else{
						this.cloneXML2DOM(node, tar, false, correctHyphen);
						break;
					}
				case 3:
					if (len){
						var text = node.nodeValue;
						if (this.charCount + text.length < len){
							this.charCount += text.length;
						}else{
							var pos = 0;
							var t = '';
							while(1){
								t += text.substr(pos, 1);
								if (t.length + this.charCount >= len){
									var cCode = t.charCodeAt(t.length -1);
									if (cCode == this.descLengthEnding || pos == t.length){
										this.charCount += t.length;
										if (cCode == this.descLengthEnding){
											t += cCode == 32 ? '....' : ' ....';
											this.stop = true;
										}else{
											this.stop = false;
										}
										text = t;
										break;
									}
								}else if(text.length + this.charCount < len){
									var cCode = text.charCodeAt(text.length -1);
									this.charCount += text.length;
									text += cCode == 32 ? '....' : ' ....';
									this.stop = true;
									break;
								}
								pos++;
							}
						}
					}else{
						text = node.nodeValue;
					}
					if (correctHyphen) text = this.correctHyphenatedText(text);
					subNode = document.createTextNode(text);
				tar.appendChild(subNode);
			}
			if (this.stop){
				this.charCount = 0;
				break;
			}
		}
	}
	
	RSS.prototype.correctHyphenatedText = function(text){
		return text.replace(/-/g, '- ');
	}
	
	RSS.prototype.cloneContent = function(src, len, correctHyphen){
		var root = DIV(null);
		if (len){
			this.charCount = 0;
			this.stop = false;
		}
		this.cloneXML2DOM(src, root, false, len, correctHyphen);
		return root.childNodes;
	}

	RSS.prototype.getFirstNodeMatch = function(nName, parent, type){
		var n = parent.childNodes;
		var nName = nName.toLowerCase();
		type = type ? type : 1;
		for (var i = 0; i < n.length; ++i){
			if (n[i].nodeType == type && n[i].nodeName.toLowerCase() == nName){
				return n[i];
			}
		}
		return false;
	}
	
	RSS.prototype.getLink = function(item){
		var link = this.getFirstNodeMatch('link', item);
		if (link && link.childNodes.length > 0) return link.childNodes[0].nodeValue;
		return false;
	}
	
	RSS.prototype.getItem = function(item, tags, href, count){
		var sty = count % 2 == 0 ? 'item' : 'item odd';
		var itemShell = DIV({'class': sty});
		for (var j = 0; j < tags.length; ++j){
			switch (tags[j]){
				case 'title':
					this.appendElement(this.getTitle(item, href), itemShell);
					break;
				case 'description':
					this.appendElement(this.getDescription(item), itemShell);
					break;
				case 'pubDate':
					this.appendElement(this.getPubDate(item), itemShell);
					break;
			}
		}
		return itemShell;
	}

	RSS.prototype.getTitle = function(item, href){
		var title = this.getFirstNodeMatch('title', item);
		if (title && title.childNodes.length > 0){
			return Layout.getTitle(this.cloneContent(title, false, true), href);
		}
		return false;
	}
	
	RSS.prototype.getDescription = function(item){
		var description = this.getFirstNodeMatch('description', item);
		if (description && description.childNodes.length > 0) {
			return Layout.getDescription(this.cloneContent(description, this.descLength, true));
		}
		return false;
	}
	
	RSS.prototype.getPubDate = function(item){
		var pubDate = this.getFirstNodeMatch('pubDate', item);
		if (pubDate && pubDate.childNodes.length > 0) {
			var dateGMT = pubDate.childNodes[0].nodeValue;
			pubDate.childNodes[0].nodeValue = this.formatDate(dateGMT);
			return Layout.getPubDate(this.cloneContent(pubDate, false, false));
		}
		return false;
	}
	
	RSS.prototype.formatDate = function(dateStr){
		var date = toISODate(new Date(dateStr));
		var time = toISOTime(new Date(dateStr));
		date = date.split('-');
		if (this.pubDateFormat == 1 || this.pubDateFormat == 4){
			var y = (date[0] % 1000);
			date[0] = y < 10 ? '0' + y : y;
			date[1] = Math.abs(date[1]);
			date[2] = Math.abs(date[2]);
			if (this.pubDateFormat == 4) return date[1] + '/' + date[2] + '/' + date[0];
			return date[2] + '.' + date[1] + '.' + date[0];
		}else if(this.pubDateFormat == 2 || this.pubDateFormat == 5){
			if (this.pubDateFormat == 5) return date[1] + '/' + date[2] + '/' + date[0];
			return date[2] + '.' + date[1] + '.' + date[0];
		}else if(this.pubDateFormat == 3 || this.pubDateFormat == 6){
			if (this.pubDateFormat == 6) return date[1] + '/' + date[2] + '/' + date[0] + ' ' + time;
			return date[2] + '.' + date[1] + '.' + date[0] + ' ' + time;
		}else{
			if (this.pubDateFormat == 5) return date[1] + '/' + date[2] + '/' + date[0];
			return date[2] + '.' + date[1] + '.' + date[0];
		}
	}
	
	RSS.prototype.publish = function(){
		$(this.target).innerHTML ='';
		$(this.target).innerHTML = this.root.innerHTML;
	}
	
	Layout = {
		getTitle: function(t, href){
			if (href) t = A({'href': href, 'target': '_blank'}, t);
			return DIV(
				{'class': 'rssElementTitle'},
				H3(null, SPAN(null, t))
			);
		},
		getDescription: function(desc){
			return DIV(
				{'class': 'rssElementDesc'},
				DIV({'class': 'inner'}, desc)
			);
		},
		getPubDate: function(d){
			return DIV(
				{'class': 'rssElementPubDate'},
				SPAN(null, d)
			);
		}
	}
/* << */

/* >> Generic Multimedia CMS tool, requires Mochikit 1.4+*/
	function GenericMultimedia(args){
		this.lang = this.getLang();
		this.altText = args.altText;
		this.altImg = args.altImg;
		this.data = args.data;
		if ($(args.target)) this.target = $(args.target);
		this.htmlSrcDom = this.getHtmlSrcDom(args.htmlSrc);
		this.javaApplet = this.isJavaApplet();
		this.modifyAndWriteDocumentElements();
	}
	
	GenericMultimedia.prototype.getLang = function(){
		var htmlEl = document.getElementsByTagName('html')[0];
		if (getNodeAttribute(htmlEl, 'lang')){
			return this.formatLang(getNodeAttribute(htmlEl, 'lang'));
		}else if(getNodeAttribute(htmlEl, 'xml:lang')){
			return this.formatLang(getNodeAttribute(htmlEl, 'xml:lang'));
		}
		return 'en';
	}
	
	GenericMultimedia.prototype.formatLang = function (lang){
		if (lang.search(/-/) > -1) return lang.substring(0, lang.search(/-/));
		return lang;
	}
	
	GenericMultimedia.prototype.getHtmlSrcDom = function(htmlSrc){
		if (typeof htmlSrc == 'string' && htmlSrc.length > 0){
			var outer = DIV(null);
			outer.innerHTML = '<xml>' + htmlSrc + '</xml>';
			return outer;
		}
		return null;
	}
	
	GenericMultimedia.prototype.isJavaApplet = function(){
		var elms = this.htmlSrcDom.childNodes[0].childNodes;
		if (elms.length > 0){
			for (var i = 0; i < elms.length; ++i){
				var elm = elms[i];
				if (elm.nodeType == 1 && elm.nodeName.toLowerCase() == 'object'){
					var classidAttr = getNodeAttribute(elm, 'classid');
					if (classidAttr){
						if (classidAttr.search('java:') > -1) return true;
					}
				}
			}
		}
		return false;
	}
	
	GenericMultimedia.prototype.modifyAndWriteDocumentElements = function(){
		var output = '';
		var elms = this.htmlSrcDom.childNodes[0].childNodes;
		var onlyEmbed = false;
		var model;
		if (elms.length > 0){
			for (var i = 0; i < elms.length; ++i){
				var node = elms[i];
				var name = elms[i].nodeName.toLowerCase();
				var type = elms[i].nodeType;
				if (this.javaApplet || (! this.useEmbed() && ! this.javaApplet)){
					if (type == 1 && name == 'object'){
						model = false;
						output += this.startElement('object', this.getNodeAttributes(node), model);
						var objChilds = node.childNodes;
						for (var j = 0; j < objChilds.length; ++j){
							node = objChilds[j];
							name = objChilds[j].nodeName.toLowerCase();
							type = objChilds[j].nodeType;
							if (type == 1 && name == 'param'){
								model = true;
								output += this.startElement('param', this.getNodeAttributes(node), model);
							}
							if (type == 1 && name == 'embed'){
								model = true;
								output += this.startElement('embed', this.getNodeAttributes(node), model);
							}
						}
					}
				}else{
					onlyEmbed = true;
					var objChilds = node.childNodes;
					for (var j = 0; j < objChilds.length; ++j){
						node = objChilds[j];
						name = objChilds[j].nodeName.toLowerCase();
						type = objChilds[j].nodeType;
						if (type == 1 && name == 'embed'){
							model = true;
							output += this.startElement('embed', this.getNodeAttributes(node), model);
						}
					}
				}
			}
			if (this.altText || this.altImg){
				if (this.altText) var text = '<p>' + this.altText + '</p>';
				if (this.altImg) var img = '<img src="' + this.altImg + '" alt="" title="" />';
				if (this.useEmbed() && ! this.javaApplet){
					output += '<noembed>' + text + img + '</noembed>';
				}else{
					output += text + img;
				}
			}
			if (! onlyEmbed) output += this.endElement('object');
		}
		document.write(output);
	}
	
	GenericMultimedia.prototype.useEmbed = function(){
		var agent = navigator.userAgent;
		if (agent.search(/MSIE | Safari/) > -1) return false;
		return true;
	}
	
	GenericMultimedia.prototype.getNodeAttributes = function(node){
		var name = node.nodeName.toLowerCase();
		var codebase = false;
		if (node.attributes.length > 0){
			var attrs = {};
			var attrValue = '';
			for (var i = 0; i < node.attributes.length; ++i){
				var attrName = node.attributes[i].nodeName.toLowerCase();
				var attrValue = node.attributes[i].nodeValue;
				if (name == 'object' && (attrName == 'classid' || attrName == 'movie' || attrName == 'data')){
					if (attrName == 'classid'){
						attrs[attrName] = this.makeClassidAttribute(attrValue);
					}else if (this.javaApplet && attrName == 'codebase'){
						codebase = true;
						attrs[attrName] = this. makeJavaAppletCodebaseAttribute();
					}else{
						if (attrName == 'codebase') codebase = true;
						attrs[attrName] = this.data + this.copyCgiArgs(attrValue);
					}
				}else if (name == 'embed' && attrName == 'src'){
					attrs[attrName] = this.data + this.copyCgiArgs(attrValue);
				}else{
					attrs[attrName] = attrValue;
				}
			}
			if (this.javaApplet && ! codebase){
						codebase = true;
						attrs['codebase'] = this. makeJavaAppletCodebaseAttribute();
			}
			if (name == 'param'){
				attrNameValue = attrs.name.toLowerCase();
				attrValueValue = attrs.value;
				if (attrNameValue == 'filename' || attrNameValue == 'movie' || attrNameValue == 'src'){
					attrs.value = this.data + this.copyCgiArgs(attrValueValue);
				}
			}
			return attrs;
		}
		return null;
	}
	
	GenericMultimedia.prototype.copyCgiArgs = function(value){
		if (value.lastIndexOf('?') > -1){
			return value.substring(value.lastIndexOf('?'), value.length);
		}
		return '';
	}
	
	GenericMultimedia.prototype.startElement = function(name, attrs, single){
		var element = '<' + name;
		for (var attrName in attrs){
			element += ' ' + attrName + '="' + attrs[attrName] + '"';
		}
		if (single){
			element += '/>';
		}else{
			element += '>';
		}
		return element;
	}

	GenericMultimedia.prototype.endElement = function(name){
		return '</' + name + '>';
	}

	GenericMultimedia.prototype.makeClassidAttribute = function(value){
		var data = this.data;
		if (value.search('java:') > -1){
			return 'java:' + data.substring(data.lastIndexOf('/') +1, data.length) + this.copyCgiArgs(value);
		}
		return value;
	}
	
	GenericMultimedia.prototype.makeJavaAppletCodebaseAttribute = function(){
		var data = this.data;
		return data.substring(0, data.lastIndexOf('/') +1);
	}
/* << */

/* >> bookmarking tool (require mochikit 1.4 and ll StandardPopup) */
	function BookmarkStoreAt(args){
		this.targetName = null;
		this.container = null;
		this.titleHTML = null;
		this.textHTML = null;
		this.descSliceStandard = ' ...';
		this.imgPath = null;
		this.bmItems = ['delicious', 'mrwong', 'blinklist', 'yahoo', 'yigg', 'furl', 'oneview', 'folkd', 'linkarena', 'google', 'webnews'];
		this.bmURL = null;
		this.bmTitle = null;
		this.bmTargets = {};
		this.init(args);
	}
	
	BookmarkStoreAt.prototype.init = function(args){
		this.targetName = args.targetName;
		if (document.getElementById(args.targetName)){
			this.container = document.getElementById(args.targetName);
		}
		if (args.bmItems){
			this.bmItems = args.bmItems;
		}
		this.imgPath = args.imgPath;
		this.titleHTML = args.titleHTML;
		this.textHTML = args.textHTML;
		this.bmURL = encodeURIComponent(location.href);
		this.bmTitle = encodeURIComponent(document.title);
		this.bmTargets['delicious'] = {'title': 'del.icio.us', 'desc': 'del.icio.us', 'url': 'http://del.icio.us/post?url=' + this.bmURL + '&title=' + this.bmTitle};
		this.bmTargets['mrwong'] = {'title': 'Mister Wong', 'desc': 'Mister Wong', 'url': 'http://www.mister-wong.de/index.php?action=addurl&bm_url=' + this.bmURL + '&bm_description=' + this.bmTitle};
		this.bmTargets['blinklist'] = {'title': 'BlinkList', 'desc': 'BlinkList', 'url': 'http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url=' + this.bmURL + '&Title=' + this.bmTitle};
		this.bmTargets['yahoo'] = {'title': 'Yahoo MyWeb', 'desc': 'Yahoo MyWeb', 'url': 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + this.bmURL + '&t=' + this.bmTitle};
		this.bmTargets['yigg'] = {'title': 'YiGG', 'desc': 'YiGG', 'url': 'http://yigg.de/neu?exturl=' + this.bmURL + '&exttitle=' + this.bmTitle};
		this.bmTargets['furl'] = {'title': 'Furl', 'desc': 'Furl', 'url': 'http://www.furl.net/storeIt.jsp?u=' + this.bmURL + '&t=' + this.bmTitle};
		this.bmTargets['oneview'] = {'title': 'OneView', 'desc': 'OneView', 'url': 'http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL=' + this.bmURL + '&title=' + this.bmTitle};
		this.bmTargets['folkd'] = {'title': 'Folkd', 'desc': 'Folkd', 'url': 'http://www.folkd.com/submit/page/' + this.bmURL};
		this.bmTargets['linkarena'] = {'title': 'Linkarena', 'desc': 'Linkarena', 'url': 'http://linkarena.com/bookmarks/addlink/?url=' + this.bmURL + '&title=' + this.bmTitle + '&desc=&tags='};
		this.bmTargets['google'] = {'title': 'Google', 'desc': 'Google', 'url': 'http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk=' + this.bmURL + '&title=' + this.bmTitle};
		this.bmTargets['webnews'] = {'title': 'Webnews', 'desc': 'Webnews', 'url': 'http://www.webnews.de/einstellen?url=' + this.bmURL + '&title=' + this.bmTitle};
		this._createLayout();
	}

	BookmarkStoreAt.prototype.store = function(target){
		this.open(this.bmTargets[target].url);
	}
	
	BookmarkStoreAt.prototype.open = function(url){
		if (typeof StandardPopup == 'function'){
			var p = new StandardPopup({'href': url, 'blank': true})
			p.open();
		}else{
			window.open(url);
		}
	}
	
	BookmarkStoreAt.prototype.changeDescSlice = function(key){
		var el = 'bmDescSlice_' + this.targetName;
		if (key){
			$(el).innerHTML = '<span>' + this.bmTargets[key].desc + '</span>';
		}else{
			$(el).innerHTML = this.descSliceStandard;
		}
	}
	
	BookmarkStoreAt.prototype._getTitle = function(){
		var t = DIV({'class': 'bookmarkTitleOuter'});
		var th = H3(null, this.titleHTML);
		t.appendChild(th);
		return t
	}

	BookmarkStoreAt.prototype._getText = function(){
		var t = DIV({'class': 'bookmarkTextOuter'});
		var p = P(null, this.textHTML);
		var s = SPAN({'id': 'bmDescSlice_' + this.targetName, 'class': 'bmDescSlice'}, this.descSliceStandard);
		p.appendChild(s);
		t.appendChild(p);
		return t;
	}

	BookmarkStoreAt.prototype._getImageItems = function(){
		var bmi = this.bmItems;
		var imgOuter = DIV({'class': 'imgOuter'});
		var img;
		for (var i = 0; i < bmi.length; ++i){
			img = IMG({'src': this.imgPath + '/' + bmi[i] + '.gif', 'alt': this.bmTargets[bmi[i]].title, 'title': this.bmTargets[bmi[i]].title});
			connect(img, 'onclick', bind('store', this, bmi[i]));
			if (this.textHTML.length > 0){
				connect(img, 'onmouseover', bind('changeDescSlice', this, bmi[i]));
				connect(img, 'onmouseout', bind('changeDescSlice', this, false));
			}
			imgOuter.appendChild(img);
		}
		return imgOuter;
	}

	BookmarkStoreAt.prototype._createLayout = function(){
		var outer = DIV({'id': 'bookmarksOuter'});
		if (this.titleHTML.length > 0) outer.appendChild(this._getTitle());
		if (this.textHTML.length > 0) outer.appendChild(this._getText());
		outer.appendChild(this._getImageItems());
		this.container.appendChild(outer);
	}
/* << */

/* >> login teaser require mochikit 1.4*/
	function handleFieldPrompt(fieldList){
		for (var i = 0; i < fieldList.length; ++i){
			connect(fieldList[i], 'onfocus', partial(hidePrompt, fieldList[i]));
			connect(fieldList[i], 'onblur', partial(showPrompt, fieldList[i]));
			if ($(fieldList[i]).value != '') hidePrompt(fieldList[i]);
		}
	}
	
	function hidePrompt(field, e){
		setNodeAttribute(field, 'style', {'background-image': 'none'});
	}

	function showPrompt(field, e){
		setNodeAttribute(field, 'style', null);
	}
/* << */

/* >> client current date (require mochikit 1.4) */
	function getCurrentDate(id){
		$(id).innerHTML = '';
		var week = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
		var month = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
		var date = new Date();
		var d = week[date.getDay()];
		var dom = date.getDate();
		var m = month[date.getMonth()];
		var y = date.getFullYear();
		var std = date.getHours();
		var min = date.getMinutes();
		if (dom < 10) dom = "0" + dom;
		if (min < 10) min = "0" + min;
		var t = DIV(null, d + ', ' + dom + '. ' + m + ' ' + y + ', ' + std + ':' + min);
		t.appendChild(SPAN({'class': 'clock'}, 'Uhr'));
		$(id).appendChild(t);
		callLater(1, function(){getCurrentDate(id)});
	}
/* << */


/* >> startpage shortnav (require mochikit 1.4) Version: rel-1-1-0 */
	SimplePanelSlider = {
		eventEls: null,
		targetEls: null,
		targetElsArea: [],
		duration: 0.1,
		hereEventEl: null,
		hereTargetEl: null,
		init: function(ArgsObj){
			this.eventEls = ArgsObj.eventElements;
			this.targetEls = ArgsObj.targetElements;
			this.duration = ArgsObj.duration;
			this.connectElements();
		},
		connectElements: function(){
			for (var i = 0; i < this.eventEls.length; ++i){
				var eel = this.eventEls[i];
				var tel = this.targetEls[i];
				slideUp(tel, {'duration': 0.01});
				connect(eel, 'onmouseenter', bind('showPanel', this, tel, eel));
				connect(eel, 'onmouseleave', bind('hidePanel', this, tel, eel));
			}
		},
		getTargetElArea: function(tel, viewport){
			var viewport = viewport == false ? viewport : true;
			if (tel){
				var pos = getElementPosition(tel);
				var dim = getElementDimensions(tel);
				if (viewport){
					var x1 = pos.x;
					var x2 = pos.x + dim.w;
					var y1 = pos.y;
					var y2 = pos.y + dim.h;
				}else{
					var x1 = 0;
					var x2 = dim.w;
					var y1 = 0;
					var y2 = dim.h;
				}
				return {'x1': x1, 'y1': y1, 'x2': x2, 'y2': y2};
			}
			return null;
		},
		checkElementMouseCrossDirection: function(position, area, top, right, bottom, left){
			var x1 = area.x1;
			var x2 = area.x2;
			var y1 = area.y1;
			var y2 = area.y2;
			var px = position.x;
			var py = position.y;
			if (px < x1 && left) return false;
			if (py < y1 && top) return false;
			if (px > x2 && right) return false;
			if (py > y2 && bottom) return false;
			return true;
		},
		showPanel: function(tel, eel, e){
			var self = this;
			if (this.hereEventEl && eel !== this.hereEventEl){
				slideDown(
					tel,
					{
						'duration': this.duration,
						'beforeStart': function(){
							self.hidePanel(self.hereTargetEl, null);
							self.hereEventEl = eel;
							self.hereTargetEl = tel;
						}
					}
				);
				return;
			}
			this.hereEventEl = eel;
			this.hereTargetEl = tel;
			slideDown(tel, {'duration': this.duration});
		},
		hidePanel: function(elm, eel, e){
			this.hereEventEl = null;
			slideUp(
				elm,
				{
					'duration': this.duration,
					'afterFinish': function(){elm.style.height = null;}
				}
			);
		},
		hideLastPanelComplete: function(e){
			var elm = this.hereTargetEl;
			var area = this.getTargetElArea(elm);
			var slide = true;
			if(slide){
				slideUp(
					elm,
					{
						'duration': this.duration,
						'afterFinish': function(){elm.style.height = null;}
					}
				);
				this.hereEventEl = null;
				this.hereTargetEl = null;
			}
		}
	}
/* << */


/* >> LL_SimpleWizard (require mochikit 1.4) Version: rel-1-0-0 */
	function LL_SimpleWizard(id){
		this.steps = [];
		this.currStep = -1;
		this.mShell = null;
		this.makeMainShell(id);
	}
	
	LL_SimpleWizard.prototype.makeMainShell = function(id){
		var mShell = $(id);
		setNodeAttribute(mShell, 'class', 'simpleWizardShell');
		this.mShell = mShell;
	}
	
	LL_SimpleWizard.prototype.appendStep = function(s){
		if (s instanceof Step){
			this.steps.push(s);
			s.stepCnt = this.steps.length -1;
			s.makeStepElementReal(this.mShell);
			return true;
		}
		return false;
	}

	LL_SimpleWizard.prototype.makeNextStep = function(stepCnt, e){
		var step = this.steps[stepCnt];
		this.currStep = step.stepCnt;
		if(e){
			if (e.src().value == -1) this.currStep--;
		}
		for (var i = 0; i < this.steps.length; ++i){
			var s = this.steps[i];
			if (s.stepCnt < this.currStep){
				s.makeStepPassive();
			}else if (s.stepCnt > this.currStep){
				if(s.display) s.hide();
			}else if(s.stepCnt == this.currStep){
				s.init(this.currStep, e);
				s.makeStepActive();
			}
		}
	}
	
	// abstract step
	function Step(){
		this.url = 'solutionFinderStep_test.text'; // static test
		this.def = null;
		this.stepCnt = 0;
		this.elm = null;
		this.display = false;
	}
	
	Step.prototype.init = function(stepId, e){
		if (e && e.src().value < 0) return false;
		this.def = doSimpleXMLHttpRequest(this.url); // static test
		this.def.addCallbacks(bind('makeStep', this), bind('__repr__', this));
		return true;
	}
	
	Step.prototype.makeStep = function(def){
		var obj = evalJSONRequest(def);
		this.show();
	}
	
	Step.prototype.makeStepLayout = function(){
		var id = this.stepCnt;
		return DIV(
			{'id': 'simpleWizardStep_' + id, 'class': 'simpleWizardStep', 'style': {'display': 'none'}}
		);
	}
	
	Step.prototype.makeStepElementReal = function(container){
		this.elm = this.makeStepLayout();
		container.appendChild(this.elm);
	}
	
	Step.prototype.makeStepPassive = function(){}
	Step.prototype.makeStepActive = function(){}
	
	Step.prototype.show = function(){
		appear(this.elm, {'duration': 1});
		this.display = true;
	}
	
	Step.prototype.hide = function(){
		slideUp(this.elm, {'duration': 0.8});
		this.display = false;
	}
	
	Step.prototype.__repr__ = function(e){
		log(
			'Simple wizard step object->',
			' Element:', this.elm,
			' StepCount:', this.stepCnt,
			' Select Element Id:', this.selectElmIdPrefix + this.stepCnt
		);
	}
	
	// Solution finder step
	SolutionFinderStep = function(){
		this.url = '/loesungsfinder/';
		this.deferredSelect = null;
		this.headerElmIdPrefix = 'solutionFinderBarContentHeader_';
		this.selectElmIdPrefix = 'solutionFinderBarContentSelect_';
		this.selectContainerPrefix = 'selectContainer_';
		this.listContainerPrefix = 'listContainer_';
		this.stepGFXElmPrefix = 'solutionFinderBarStep_';
		this.stepCSSActiveStrPrefix = 'barStep barStep_here_';
		this.stepCSSPassiveStrPrefix = 'barStep barStep_normal_';
	}
	SolutionFinderStep.prototype = new Step();

	SolutionFinderStep.prototype.init = function(stepId, e){
		var priKey = '';
		if (e) priKey = e.src().value;
		this.def = doSimpleXMLHttpRequest(this.url + priKey);
		this.def.addCallbacks(bind('makeStep', this), bind('__repr__', this));
	}

	SolutionFinderStep.prototype.makeStep = function(def){
		var obj = evalJSONRequest(def);
		this.createStepTitle(obj);
		this.createSelectboxWithOptionsFromObject(obj);
		this.createLinklistFromObject(obj);
		this.show();
	}
	
	SolutionFinderStep.prototype.makeStepLayout = function(){
		var id = this.stepCnt;
		return DIV(
			{'id': 'solutionFinderBar_' + id, 'class': 'bar', 'style': {'display': 'none'}},
			DIV(
				null,
				DIV(
					{'id': this.stepGFXElmPrefix + id, 'class': this.stepCSSActiveStrPrefix + id},
					makeXistPixel()
				),
				DIV(
					{'class': 'barContentContainer'},
					H3({'id': this.headerElmIdPrefix + id}),
					DIV(
						{'class': 'selectOuter'},
						DIV({'id': this.selectContainerPrefix + id}),
						DIV({'id': this.listContainerPrefix + id})
					)
				),
				DIV({'class': 'floatTerm'})
			)
		);
		
	}
	
	SolutionFinderStep.prototype.makeStepPassive = function(){
		var numGfx = this.stepGFXElmPrefix + this.stepCnt;
		setNodeAttribute(numGfx, 'class', this.stepCSSPassiveStrPrefix + this.stepCnt);
	}
	
	SolutionFinderStep.prototype.makeStepActive = function(){
		var numGfx = this.stepGFXElmPrefix + this.stepCnt;
		setNodeAttribute(numGfx, 'class', this.stepCSSActiveStrPrefix + this.stepCnt);
	}
	
	SolutionFinderStep.prototype.createStepTitle = function(obj){
		if (obj.title){
			var title = $(this.headerElmIdPrefix + this.stepCnt);
			title.innerHTML = '';
			var t = SPAN(null, obj.title);
			title.appendChild(t);
		}
	}
	
	SolutionFinderStep.prototype.createSelectboxWithOptionsFromObject = function(obj){
		var container = $(this.selectContainerPrefix + this.stepCnt);
		container.innerHTML = '';
		if (obj.options.length > 0){
			var select = SELECT({'name': 'solutionFinderStep_' + this.stepCnt, 'id': this.selectElmIdPrefix + this.stepCnt, 'class': 'barContentSelect'}, null);
			select.options[0] = new Option('Treffen Sie eine Auswahl...', -1, false, false);
			for (var i = 0; i < obj.options.length; ++i){
				var opt = obj.options[i];
				select.options[i+1] = new Option(opt.label, opt.value, false, false);
			}
			container.appendChild(select);
			this.connectSelect(SolFinder);
		}
	}
	
	SolutionFinderStep.prototype.connectSelect = function(parentObj){
		return connect(this.selectElmIdPrefix + this.stepCnt, 'onchange', bind('makeNextStep', parentObj, this.stepCnt + 1));
	}

	SolutionFinderStep.prototype.createLinklistFromObject = function(obj){
		var container = $(this.listContainerPrefix + this.stepCnt);
		container.innerHTML = '';
		if (obj.list.length > 0){
			var outer = DIV({'class': 'barLinklistShell'}, null);
			for (var i = 0; i < obj.list.length; ++i){
				var l = obj.list[i];
				outer.appendChild(A({'href': l.href}, l.label));
			}
			container.appendChild(outer);
		}
	}
/* << */


/* >> LL_RelationshipManager (require mochikit 1.4) Version: rel-1-2-0 */
	LL_RelationshipManager = function(){
		this.relHandler = [];
	}
	
	LL_RelationshipManager.prototype.addRelHandler = function(Handler){
		if (Handler instanceof DefaultRelationHandler){
			this.relHandler.push(Handler);
			if (Handler.elms.length > 0 && Handler.autoAction) Handler.action();
		}
	}


	// abstract relation handler
	DefaultRelationHandler = function(){
		this.name = 'testDefaultHandler';
		this.links = document.links;
		this.autoAction = false;
		this.filter(this.name);
		this.elms = []; // holds the elements and the rel attrs as a json object
	}
	
	// filter links wih rels with a given name and allocates the attributes.
	DefaultRelationHandler.prototype.filter = function(name){
		var links = this.links;
		for (var i = 0; i < links.length; ++i){
			this.addElementAndGetRelAttrs(links[i]);
		}
	}
	
	DefaultRelationHandler.prototype.addElementAndGetRelAttrs = function(elm){
		var attr = getNodeAttribute(elm, 'rel');
		if (attr){
			if (attr == this.name || attr.substring(0, attr.indexOf('[')) == this.name){
				var relAttrs = null;
				if (attr.search(/\[/) > -1 && attr.search(/\]/) > -1){
					relAttrs = attr.substring(attr.indexOf('[') + 1, attr.lastIndexOf(']'));
				}
				var obj = {'elm': elm, 'relAttrs': relAttrs.split(',')};
				this.elms.push(obj);
				return obj;
			}
		}
		return null;
	}
	
	DefaultRelationHandler.prototype.action = function(){} // do something with the rels


	// Register shown company search Entries
	RegisterShownCompanySearchEntries = function(){
		this.url = '/countcompanyentries';
		this.name = 'registerCompanySearchEntries';
		this.autoAction = true;
		this.filter(this.name);
		this.deferred = null;
	}
	RegisterShownCompanySearchEntries.prototype = new DefaultRelationHandler();
	
	RegisterShownCompanySearchEntries.prototype.makeCompanyIdStr = function(){
		var compStr = '';
		for (var i = 0; i < this.elms.length; ++i){
			compStr += this.elms[i].relAttrs[2];
			if ((i + 1) < this.elms.length) compStr += ',';
		}
		return compStr;
	}
	
	RegisterShownCompanySearchEntries.prototype.getSearchPhrase = function(){
		var selm = document.getElementsByName('search_string');
		if (selm.length > 0){
			return selm[0].value;
		}
		return '';
	}
	
	RegisterShownCompanySearchEntries.prototype.action = function(){
		var wsid = this.elms.length > 0 ? this.elms[0].relAttrs[0] : '';
		var catid = this.elms.length > 0 ? this.elms[0].relAttrs[1] : '';
		var qParts = {
			'wsid': wsid,
			'catid': catid,
			'phrase': this.getSearchPhrase(),
			'companies': this.makeCompanyIdStr()
		}
		this.deferred = doXHR(
			this.url,
			{
				'method': 'POST',
				'sendContent': queryString(qParts),
				'headers': {'Content-Type': 'application/x-www-form-urlencoded'}
			}
		);
		this.deferred.addCallbacks(bind('actionSuccess', this), bind('actionError', this, qParts));
	}
	
	RegisterShownCompanySearchEntries.prototype.actionSuccess = function(e){
		log('Success');
	}

	RegisterShownCompanySearchEntries.prototype.actionError = function(qParts, e){
		logFatal('wsid =',qParts.wsid, ', phrase =', qParts.phrase, ', companies =', qParts.companies, ',', e);
	}


	// Use the xpopup functionality to display detail information
	XPopupHandler = function(){
		this.name = 'xpopup';
		this.autoAction = true;
		this.filter(this.name);
	}
	XPopupHandler.prototype = new DefaultRelationHandler();
	
	XPopupHandler.prototype.action = function(){
		var self = this;
		setTimeout(
			function(){
				for (var i = 0; i < self.elms.length; ++i){
					var TAttrs = {};
					var TAttrsArr = [];
					var elm = self.elms[i].elm;
					var eAttrs = self.elms[i].relAttrs;
					if (eAttrs.length == 6){
						TAttrs.url = elm.href;
						TAttrs.height = 'auto';
						TAttrs.width = 'auto';
					}else{
						var TAttrsRaw = eAttrs.slice(6);
						for (var j = 0; j < TAttrsRaw.length; ++j){
							var TAttrRawSplitted = TAttrsRaw[j].split(',');
							for (var k = 0; k < TAttrRawSplitted.length; ++k){
								var tAttrRaw = TAttrRawSplitted[k];
								var key = tAttrRaw.substring(0, tAttrRaw.indexOf(':'));
								var value = tAttrRaw.substring(tAttrRaw.indexOf(':') + 1, tAttrRaw.length);
								TAttrs[key] = value;
							}
						}
						if (! TAttrs.url) TAttrs.url = elm.href;
					}
					LL_XPopup.registerPopup(
						elm,
						eAttrs[0],
						eAttrs[1],
						eAttrs[2],
						eAttrs[3],
						eAttrs[4],
						eAttrs[5],
						TAttrs
					);
				}
			},
			10
		);
	}
/* << */


/* >> LL_XPopup (require MochiKit 1.4 and LL_RelationshipManager with XPopupHandler) Version: rel-1-1-0 */
	/*
		Possible positions for the source and popup element:
		LEFT_TOP,
		LEFT_CENTER,
		LEFT_BOTTOM,
		CENTER_TOP,
		CENTER,
		CENTER_BOTTOM,
		RIGHT_TOP,
		RIGHT_CENTER,
		RIGHT_BOTTOM
		CURSOR (only for the source element)
		
		possible types: IMAGE, WEBPAGE, AJAX
		
		Example for rel-Attributes: xpopup[onmouseenter,WEBPAGE,RIGHT_TOP,LEFT_TOP,10,10]
			identfier[event, type, source position, popup position, popup margin width, popup margin height]
			All these attributes are required!
	*/
	LL_XPopup = {
		xpopups: [],
		popup: null,
		closeDeferred: null,
		popupDeferred: null,
		registerPopup: function(elm, event, type, spos, ppos, margin_w, margin_h, TypeAttrs){
			//type = 'AJAX';
			var self = this;
			setTimeout(function(){self.makePopup()}, 1);
			switch (type){
				case 'IMAGE':
					this.xpopups.push(new ImageXPopup(elm, event, spos, ppos, margin_w, margin_h, TypeAttrs));
					break;
				case 'WEBPAGE':
					this.xpopups.push(new WebpageXPopup(elm, event, spos, ppos, margin_w, margin_h, TypeAttrs));
					break;
				case 'AJAX':
					this.xpopups.push(new AjaxXPopup(elm, event, spos, ppos, margin_w, margin_h, TypeAttrs));
					break;
			}
		},
		makePopup: function(){
			if (! this.popup){
				this.popup = DIV(
					{'id': 'xpopup', 'class': 'xpopup', 'style': {'display': 'none'}},
					this.makeCloseButton(),
					DIV({'id': 'xpopupContent'})
				);
				var b = getElementsByTagAndClassName('body', null)[0];
				b.appendChild(this.popup);
			}
			return this.popup;
		},
		makeCloseButton: function(){
			var closeImg = '';
			closeImg = IMG({'src': '../px/spc.gif', 'alt': '', 'id': 'xpopupCloseGfx'});
			if (this.closeDeferred) disconnect(this.closeDeferred);
			this.closeDeferred = connect(closeImg, 'onclick', bind('destruct', this));
			connect(document, 'onkeydown', bind('destruct', this));
			return DIV(
				{'id': 'xpopupCloseButton'},
				DIV(
					{'class': 'inner'},
					closeImg
				)
			);
		},
		destruct: function(e){
			if (this.popup){
				if(e){
					if (e.type() == 'keydown'){
						if (e.key().code == 27 && e.key().string == 'KEY_ESCAPE'){
							fade(this.popup, {'duration': 0.3});
						}
					}else if (e.type() == 'click' || e.type() == 'mouseleave' || e.type() == 'mouseout'){
						if (e.type() == 'click'){
							fade(this.popup, {'duration': 0.3});
						}else{
							hideElement(this.popup);
						}
					}
				}else{
					fade(this.popup, {'duration': 0.3});
				}
			}
		}
	}
	
	DefaultXPopup = function(src, event, spos, ppos, margin_w, margin_h, TypeAttrs){
		this.src = src;
		this.event = event;
		this.spos = spos; // layer position on the connected source element
		this.ppos = ppos; // position of the popup layer relative to the layer position of the source element
		this.mw = margin_w; // margin width of the popup from the connected source element (negative integer values allowed)
		this.mh = margin_h; // margin height of the popup from the connected source element (negative integer values allowed)
		this.Attrs = TypeAttrs;
		this.srcDeferred = null;
		this.srcOutDeferred = null;
		if (arguments.length >= 6){
			this.connectSrcElement();
		}
	}
	
	DefaultXPopup.prototype.connectSrcElement = function(){
		if (this.srcDeferred) disconnect(this.srcDeferred);
		this.srcDeferred = connect(this.src, this.event, bind('show', this));
	}
	
	DefaultXPopup.prototype.pushContentIntoPopup = function(){
		var target = $('xpopupContent');
		target.innerHTML = '';
		var self = this;
		setTimeout(
			function(){
				target.appendChild(self.getContent());
			},
			1
		);
	}
	
	DefaultXPopup.prototype.getContent = function(){
		return SPAN(null, "Test Content of the default xpopup!");
	}

	DefaultXPopup.prototype.setPopupPosition = function(src, mousePos){
		//var src = e.src(); // the triggering element
		var p = LL_XPopup.popup;
		var srcDims = getElementDimensions(src);
		var srcPos = getElementPosition(src);
		var mCords = mousePos;
		var pDims = getElementDimensions(p);
		var vpDims = getViewportDimensions();
		var vpPos = getViewportPosition();
		var pWidth = pDims.w;
		var pHeight = pDims.h;
		var buffer = 30;
		var xPos, yPos, x, y;
		//this.spos = 'LEFT_CENTER';
		if (this.spos == 'LEFT_TOP' || this.spos == 'LEFT_CENTER' || this.spos == 'LEFT_BOTTOM'){
			x = srcPos.x;
		}else if (this.spos == 'CENTER_TOP' || this.spos == 'CENTER' || this.spos == 'CENTER_BOTTOM'){
			x = srcPos.x + (srcDims.w / 2);
		}else if (this.spos == 'RIGHT_TOP' || this.spos == 'RIGHT_CENTER' || this.spos == 'RIGHT_BOTTOM'){
			x = srcPos.x + srcDims.w;
		}else if (this.spos == 'CURSOR'){
			x = mCords.x;
		}
		
		if (this.spos == 'LEFT_TOP' || this.spos == 'CENTER_TOP' || this.spos == 'RIGHT_TOP'){
			y = srcPos.y;
		}else if (this.spos == 'LEFT_CENTER' || this.spos == 'CENTER' || this.spos == 'RIGHT_CENTER'){
			y = srcPos.y + (srcDims.h / 2);
		}else if (this.spos == 'LEFT_BOTTOM' || this.spos == 'CENTER_BOTTOM' || this.spos == 'RIGHT_BOTTOM'){
			y = srcPos.y + srcDims.h;
		}else if (this.spos == 'CURSOR'){
			y = mCords.y;
		}
		
		relPopPos = this.getRelativePopupPosition(x, y, srcDims, pDims, this.ppos);
		xPos = relPopPos.x;
		yPos = relPopPos.y;
		if (xPos + pWidth > vpDims.w + vpPos.x) xPos = vpDims.w + vpPos.x - (pWidth + buffer);
		if (yPos + pHeight > vpDims.h + vpPos.y) yPos = vpDims.h + vpPos.y - (pHeight + buffer);
		if (xPos <= vpPos.x) xPos = vpPos.x + buffer;
		if (yPos <= vpPos.y) yPos = vpPos.y + buffer;
		Move(LL_XPopup.popup, {'x': xPos, 'y': yPos, 'mode': 'absolute', 'duration': 0.2});
	}
	
	DefaultXPopup.prototype.getRelativePopupPosition = function(xPos, yPos, srcDims, pDims, ppos){
		//var ppos = 'LEFT_CENTER';
		xPos += this.mw / 1;
		yPos += this.mh / 1;
		if (ppos == 'LEFT_TOP'){
			return {'x': xPos, 'y': yPos};
		}else if(ppos == 'LEFT_CENTER'){
			return {'x': xPos, 'y': yPos - (pDims.h / 2)};
		}else if(ppos == 'LEFT_BOTTOM'){
			return {'x': xPos, 'y': yPos - pDims.h};
		}else if(ppos == 'CENTER_TOP'){
			return {'x': xPos - (pDims.w / 2), 'y': yPos};
		}else if(ppos == 'CENTER'){
			return {'x': xPos - (pDims.w / 2), 'y': yPos - (pDims.h / 2)};
		}else if(ppos == 'CENTER_BOTTOM'){
			return {'x': xPos - (pDims.w / 2), 'y': yPos - pDims.h};
		}else if(ppos == 'RIGHT_TOP'){
			return {'x': xPos - pDims.w, 'y': yPos};
		}else if(ppos == 'RIGHT_CENTER'){
			return {'x': xPos - pDims.w, 'y': yPos - (pDims.h / 2)};
		}else if(ppos == 'RIGHT_BOTTOM'){
			return {'x': xPos - pDims.w, 'y': yPos - pDims.h};
		}
	}
	
	
	DefaultXPopup.prototype.handleSrcAndPopupConnect = function(){
		if (this.event != 'onclick' && this.spos != this.ppos){
			if (LL_XPopup.popupDeferred) disconnect(LL_XPopup.popupDeferred);
			this.srcOutDeferred = connect(this.src, 'onmouseleave', bind('destruct', LL_XPopup));
		}else if (this.event != 'onclick' && this.spos == this.ppos){
			if (this.srcOutDeferred) disconnect(this.srcOutDeferred);
			LL_XPopup.popupDeferred = connect(LL_XPopup.popup, 'onmouseleave', bind('destruct', LL_XPopup));
		}
	}
	
	DefaultXPopup.prototype.show = function(e){
		e.stop();
		var mousePos = e.mouse().page;
		var src = e.src();
		this.pushContentIntoPopup();
		this.handleSrcAndPopupConnect();
		var self = this;
		setTimeout(
			function(){
				self.setPopupPosition(src, mousePos);
				appear(LL_XPopup.popup, {'duration': 0.8});
			},
			1
		);
	}

	// Image xpopup
	ImageXPopup = function(src, event, spos, ppos, margin_w, margin_h, TypeAttrs){
		// TypeAttrs: url, href, jsFunc, height, width
		// url: Source of the image to display.
		// href: Link reference for the image.
		// jsFunc: mochikit bind or partial functions.
		this.constructor(src, event, spos, ppos, margin_w, margin_h, TypeAttrs);
	}
	ImageXPopup.prototype = new DefaultXPopup();
	
	ImageXPopup.prototype.getContent = function(){
		var img = null;
		var height = 'auto';
		var width = 'auto';
		var href, jsFunc;
		if (this.Attrs){
			var Attrs = this.Attrs
			img = IMG({'src': this.Attrs.url, 'alt': '', 'border': 0});
			height = Attrs.height == 'auto'? '' : Attrs.height + 'px';
			width = Attrs.width == 'auto'? '' : Attrs.width + 'px';
			if (Attrs.href && ! Attrs.jsFunc){
				href = Attrs.href;
				img = A({'href': Attrs.href}, img);
			}
			if (Attrs.jsFunc){
				connect(img, 'onclick', Attrs.jsFunc);
				setNodeAttribute(img, 'style', {'cursor': 'pointer'});
			}
		}
		return DIV(
			{
				'style': {
				'height': height,
				'width': width,
				'overflow': 'auto',
				'text-align': 'center'
				}
			},
			img
		);
	}

	// Webpage xpopup
	WebpageXPopup = function(src, event, spos, ppos, margin_w, margin_h, TypeAttrs){
		// TypeAttrs: url, height, width
		this.constructor(src, event, spos, ppos, margin_w, margin_h, TypeAttrs);
	}
	WebpageXPopup.prototype = new DefaultXPopup();

	WebpageXPopup.prototype.getContent = function(){
		var height = getViewportDimensions().h / 3;
		var width = getViewportDimensions().w / 2;
		var url = 'http://www.example.com';
		if (this.Attrs){
			height = this.Attrs.height == 'auto'? height : this.Attrs.height;
			width = this.Attrs.width == 'auto'? width : this.Attrs.width;
			url = this.Attrs.url ? this.Attrs.url : url;
		}
		return createDOM('iframe', {'src': url, 'frameborder': 0, 'border': 0, 'height': height, 'width': width});
	}

	// Ajax xpopup
	AjaxXPopup = function(src, event, spos, ppos, margin_w, margin_h, TypeAttrs){
		// TypeAttrs: url, height, width
		this.constructor(src, event, spos, ppos, margin_w, margin_h, TypeAttrs);
		this.def = null;
	}
	AjaxXPopup.prototype = new DefaultXPopup();

	AjaxXPopup.prototype.getContent = function(){
		var height = getViewportDimensions().h / 3;
		var width = getViewportDimensions().w / 2;
		var url = '/';
		height = this.Attrs.height == 'auto'? height : this.Attrs.height + 'px';
		width = this.Attrs.width == 'auto'? width : this.Attrs.width + 'px';
		url = this.Attrs.url ? this.Attrs.url : url;
		var container = DIV({'style':{ 'height': height, 'width': width, 'overflow': 'auto'}});
		this.def = doSimpleXMLHttpRequest(url);
		this.def.addCallbacks(bind('loadContent', this, container), bind('loadContentError', this));
		return container;
	}
	
	AjaxXPopup.prototype.loadContent = function(container, def){
		container.innerHTML = def.responseText;
	}

	AjaxXPopup.prototype.loadContentError = function(def){
		logFatal('Fehler beim Abruf von AJAX content:', def.message);
	}
/* << */


/* >> LL_TableColumnEnhancer (require MochiKit 1.4) Version: rel-1-1-0 */
	LL_TableColumnEnhancer = function(){
		this.table = null;
		this.colConfig = [0,1,2,-3,-2,-1];
		this.tableFullWidth = 0;
		this.tableFullHeight = 0;
		this.tableCurrentWidth = 0;
		this.tableCurrentHeight = 0;
		this.variantsWidth = 0;
		this.variantsHeight = 0;
		this.moved = false;
		this.columns = []; // holds to hide columns with there cells
		this.idOuter = null;
		hideElement('variants');
	}
	
	LL_TableColumnEnhancer.prototype.setColumnConfig = function(){
		if (arguments.length > 0){
			var conf = [];
			for (var i = 0; i < arguments.length; ++i){
				if (! isNaN(parseInt(arguments[i]))) conf.push(arguments[i]);
			}
			if (conf.length > 0) this.colConfig = conf;
			return this.colConfig;
		}
		return null;
	}
	
	LL_TableColumnEnhancer.prototype.init = function(id, idOuter, display){
		var t = $(id);
		this.idOuter = idOuter;
		var columnsIndex = [];
		if (t.nodeName.toLowerCase() == 'table'){
			this.table = t;
			this.tableFullWidth = t.offsetWidth;
			this.tableFullHeight = t.offsetHeight;
			var tbody = this.getElementChildNodeWithName(t, 'tbody', null);
			for (var i = 0; i < this.getElementChildNodesCount(tbody, 1); ++i){
				var row = this.getElementChildNodeWithName(tbody, 'tr', i);
				for (var j = 0; j < this.getElementChildNodesCount(row, 1); ++j){
					columnsIndex = this.getColumnsIndex(this.getElementChildNodesCount(row, 1), this.colConfig);
					var cell = this.getElementChildNodeWithName(row, 'td', j);
					if (! this._inArray(j, columnsIndex)){
						if (this.columns[j] instanceof DefaultTableColumn){
							this.columns[j].addCell(cell);
						}else{
							this.columns[j] = new DefaultTableColumn(j);
							this.columns[j].addCell(cell);
						}
					}
				}
			}
		}
		showElement($('variantsButtons'));
		this.updateDisplay(display);
		connect($('variantsViewAllButton'), 'onclick', bind('openInlinePopup', this));
		connect($('variantsViewLessButton'), 'onclick', bind('closeInlinePopup', this));
		showElement('variants');
		this.tableCurrentWidth = this.getContentAreaDimensions().w; //t.offsetWidth; 
		this.tableCurrentHeight = t.offsetHeight;
		this.variantsWidth = $(this.idOuter).offsetWidth;
		this.variantsHeight = $(this.idOuter).offsetHeight;
	}

	LL_TableColumnEnhancer.prototype.getContentAreaDimensions = function(){
		var ca, dims;
		ca = getElementsByTagAndClassName('td', 'contentColumn')[0];
		return getElementDimensions(ca);
	}
	
	LL_TableColumnEnhancer.prototype.openInlinePopup = function(e){
		var contOrig = $('variantsOuterShell');
		var cont = $('variantsPopupContainer');
		var elm = $(this.idOuter);
		if (elm){
			cont.innerHTML = '';
			cont.appendChild(elm);
			contOrig.innerHTML = '';
			contOrig.appendChild(IMG({'src': '../px/spc.gif', 'height': this.variantsHeight + 32, 'width': 1, 'class': 'variantsDvShellDummy'}, null));
			this.updateDisplay(true);
			var popup = $('variantsInlinePopupOuter');
			var popupShell = $('variantsPopupShell');
			showElement(popup); //appear(popup, {'duration': 0.3});
			this.tableFullWidth = this.table.offsetWidth;
			if (this.tableFullWidth <= this.tableCurrentWidth){
				this.tableFullWidth = this.tableCurrentWidth;
				setNodeAttribute(this.table, 'style', {'width': this.tableCurrentWidth + 'px'});
			}
			var distance = ((this.tableFullWidth - this.tableCurrentWidth) / 2) + 12;
			setNodeAttribute(popupShell, 'style', {'left': '-' + distance + 'px'});
			this.moved = true;
		}
	}
	
	LL_TableColumnEnhancer.prototype.closeInlinePopup = function(e){
		var popup = $('variantsInlinePopupOuter');
		var cont = $('variantsOuterShell');
		hideElement(popup);
		var elm = $(this.idOuter);
		if (elm){
			this.updateDisplay(false);
			cont.replaceChild(elm, this.getElementChildNodeWithName(cont, 'img', null));
		}
	}

	LL_TableColumnEnhancer.prototype.updateDisplay = function(display, e){
		if (e) e.stop();
		this.hidden = true;
		if (display) this.hidden = false;
		for (var i = 0; i < this.columns.length; ++i){
			var col = this.columns[i];
			if (col instanceof DefaultTableColumn) col.setDisplay(display);
		}
		if (this.hidden){
			setNodeAttribute($('variantsViewAllButton'), 'style', {'display': 'inline'})
			setNodeAttribute($('variantsViewLessButton'), 'style', {'display': 'none'})
		}else{
			setNodeAttribute($('variantsViewAllButton'), 'style', {'display': 'none'})
			setNodeAttribute($('variantsViewLessButton'), 'style', {'display': 'inline'})
		}
	}
	
	LL_TableColumnEnhancer.prototype._inArray = function(needle, arr){
		for (var i = 0; i < arr.length; ++i){
			if (needle == arr[i]) return true;
		}
		return false;
	}
	
	LL_TableColumnEnhancer.prototype.getElementChildNodeWithName = function(parent, name, pos){
		var pos = pos ? pos : 0;
		var count = 0;
		var childs = parent.childNodes;
		if (childs){
			for (var i = 0; i < childs.length; ++i){
				var c = childs[i];
				if (c.nodeType == 1){
					var nname = c.nodeName.toLowerCase();
					var n = name.toLowerCase();
					if (n = nname && count == pos) return c;
					++count;
				}
			}
		}
		return null;
	}
	
	LL_TableColumnEnhancer.prototype.getElementChildNodesCount = function(parent, type){
		var childs = parent.childNodes;
		var count = 0;
		if (childs){
			for (var i = 0; i < childs.length; ++i){
				var c = childs[i];
				if (c.nodeType == type) ++count;
			}
		}
		return count;
	}

	LL_TableColumnEnhancer.prototype.getColumnsIndex = function(colCount, permCols){
		for (var i = 0; i < permCols.length; ++i){
			if (permCols[i] < 0) permCols[i] += colCount;
		}
		return permCols;
	}


	DefaultTableColumn = function(cid){
		this.cid = cid;
		this.cells = [];
		this.hidden = false;
	}
	
	DefaultTableColumn.prototype.addCell = function(Cell){
		if (Cell.nodeName.toLowerCase() == 'td' || Cell.nodeName.toLowerCase() == 'th'){
			this.cells.push(new DefaultTableCell(Cell));
		}
	}
	
	DefaultTableColumn.prototype.setDisplay = function(display){
		this.hidden = true;
		if (display) this.hidden = false;
		for (var i = 0; i < this.cells.length; ++i){
			this.cells[i].setDisplay(display);
		}
	}


	DefaultTableCell = function(domel){
		this.domel = domel;
		this.hidden = false;
		this.attrs = {};
		this.children = null;
		this.content = null;
		this._backupAttrsAndChildren();
		this._backupContent();
	}
	
	DefaultTableCell.prototype._backupAttrsAndChildren = function(){
		var elm = this.domel;
		this.children = elm.childNodes;
		for (var i = 0; i < elm.attributes.length; ++i){
			var attr = elm.attributes[i];
			var name = attr.nodeName;
			var value = attr.nodeValue;
			this.attrs[name] = value;
		}
	}
	
	DefaultTableCell.prototype._backupContent = function(){
		var node = this.domel;
		while (node.nodeType == 1){
			node = node.childNodes[0];
			if (node && node.nodeType == 3){
				this.content = node.nodeValue;
				break;
			}else{
				if (! node) break;
			}
		}
	}
	
	DefaultTableCell.prototype.setDisplay = function(display){
		if (display){
			this.hidden = false;
			setNodeAttribute(this.domel, 'style', {'display': ''});
			return true;
		}
		this.hidden = true;
		setNodeAttribute(this.domel, 'style', {'display': 'none'});
		return true;
	}
/* << */


/* >> Flash randomizer Version: rel-1-0-0 */
	FlashRandom = {
		urls: [],
		getFlashNumber: function(){
			var overall = this.urls.length;
			var n = parseInt(overall * Math.random());
			if (n > overall) n = overall -1;
			return n;
		},
		appendURLs: function(args){
			for (var i = 0; i < arguments.length; ++i){
				if (typeof arguments[i] == 'string') this.urls[i] = arguments[i];
			}
		},
		getFlashUrl: function(){
			var n = this.getFlashNumber();
			return this.urls[n];
		}
	}
/* << */


// >> Survey teaser (require mochikit 1.4)
	function Survey(args){
		this.surveyId = args.sId;
		this.survey = {'responseText': null};
		this.initUrl = args.initUrl;
		this.voteUrl = args.voteUrl;
		this.resultUrl = args.resultUrl;
		this.oldButtonValue = null;
		this.voteConnect = null;
	}
	
	Survey.prototype._connectButtons = function(){
		if (this.voteConnect)
			disconnect(this.voteConnect);
		this.voteConnect = connect($('surveyVote'), 'onclick', bind('vote', this, $('surveyVote')));
		this.resultConnect = connect($('surveyResult'), 'onclick', bind('getResult', this, $('surveyResult')));
	}
	
	Survey.prototype.getSurvey = function(){
		if (this.survey.responseText){
			this.loadSurvey();
		}else{
			var def = doSimpleXMLHttpRequest(this.initUrl);
			def.addCallbacks(bind('loadSurvey', this), bind('loadSurveyError', this));
		}
	}
	
	Survey.prototype.loadSurvey = function(def){
		if (! def){
			var def = this.survey;
		}else{
			this.survey.responseText = def.responseText;
		}
		Opacity($(this.surveyId), {'from': 1, 'to': 0, 'afterFinish': bind('appearContent', this, def)});
		if (this.oldButtonValue){
			setNodeAttribute($('surveyVote'), 'value', this.oldButtonValue);
			setNodeAttribute($('surveyResult'), 'style', {'display': ''});
		}
		this.oldButtonValue = null;
		this._connectButtons();
	}

	Survey.prototype.loadSurveyError = function(def){
		var elm = DIV(null, DIV({'style': {'color': '#cc0000'}}, "Service nicht verfügbar!"));
		$(this.surveyId).innerHTML = elm.innerHTML;
		logFatal('Survey: Status, ', def.message);
	}
	
	Survey.prototype.vote = function(button, e){
		e.stop();
		var form = button.parentNode.parentNode;
		var qStr = this.preparePost(form.elements);
		if (qStr){
			var def = doXHR(this.voteUrl, {'method': 'POST', 'sendContent': qStr, 'headers': {'Content-Type': 'application/x-www-form-urlencoded'}});
			def.addCallbacks(bind('handleVoting', this), bind('handleVotingError', this));
		}else{
			if ($('voteFirstMsg')){
				removeElement($('voteFirstMsg'));
			}
			$(this.surveyId).appendChild(DIV({'id': 'voteFirstMsg', 'style': {'color': '#cc0000'}}, "Bitte stimmen Sie zuerst ab."));
			callLater(3, function(){fade($('voteFirstMsg'), {'from': 1, 'to': 0, 'duration': 0.4})});
		}
	}
	
	Survey.prototype.handleVoting = function(def){
		pulsate($('surveyResult'), {'duration': 4});
	}
	
	Survey.prototype.handleVotingError = function(def){
		$(this.surveyId).appendChild(DIV({'style': {'color': '#cc0000'}}, "Fehler bei Umfrageeintrag!"));
		log(def.message);
	}
	
	Survey.prototype.preparePost = function(els){
		var k = [];
		var v = [];
		var valid = false;
		var param = {
			push: function(key, value){
				if (key != 'user') valid = true;
				k.push(key);
				v.push(value);
			}
		}
		for (var i = 0; i < els.length; ++i){
			if (els[i].type == 'radio'){
				if (els[i].checked ){
					param.push(els[i].name, els[i].value);
				}
			}else if (els[i].type == 'checkbox'){
				if (els[i].checked ){
					param.push(els[i].name, els[i].value);
				}
			}else if (els[i].type == 'hidden'){
				param.push(els[i].name, els[i].value);
			}
		}
		if (valid) return queryString(k, v);
		return false;
	}

	Survey.prototype.getResult = function(button, e){
		e.stop();
		var def = doSimpleXMLHttpRequest(this.resultUrl);
		def.addCallbacks(bind('switchResult', this), bind('switchResultError', this));
	}
	
	Survey.prototype.switchResult = function(def){
		Opacity($(this.surveyId), {'from': 1, 'to': 0, 'afterFinish': bind('appearContent', this, def)});
		if(! this.oldButtonValue){
			this.oldButtonValue = getNodeAttribute($('surveyVote'), 'value');
		}
		setNodeAttribute($('surveyVote'), 'value', 'Zurück');
		if (this.voteConnect)
			disconnect(this.voteConnect);
		this.voteConnect = connect($('surveyVote'), 'onclick', bind('getSurvey', this, $('surveyVote')));
		hideElement($('surveyResult'));
	}
	
	Survey.prototype.appearContent = function(def){
		$(this.surveyId).innerHTML = '';
		$(this.surveyId).innerHTML = def.responseText;
		appear($(this.surveyId));
	}

	Survey.prototype.switchResultError = function(def){
		
	}
// <<


/* >> LL_Helpers */
	Utils = {
		pixelPath: '/xist4c/px/spc.gif',
		pixelAsString: function(){
			return '<img src="' + this.pixelPath + '" height="1" width="1" border="0" alt=""/>';
		},
		getUrlParamsAsJson: function(url, dontDecode){
			if (!url) var url = window.location.href;
			if (url.search(/\?/) > -1){
				var urlParams = url.substring(url.search(/\?/) + 1 , url.length);
				urlParams = urlParams.split('&');
				jParams = {};
				for (var i=0; i < urlParams.length; ++i){
					var parVal = urlParams[i].split('=');
					if (dontDecode){
						jParams[parVal[0]] = parVal[1];
					}else{
						jParams[decodeURI(parVal[0])] = decodeURI(parVal[1]);
					}
				};
				return jParams;
			}
			return null;
		}
	}
/* << */


/* >> online catalog handler (require MochiKit 1.4) */
	onlineCatalog = {
		init: function(){
			var catalogs = getElementsByTagAndClassName('a', 'onlineCatalogLink');
			for (var i = 0; i < catalogs.length; ++i) {
				var url = getNodeAttribute(catalogs[i], 'href');
				LL_XPopup.registerPopup(catalogs[i], 'onclick', 'WEBPAGE', 'LEFT_BOTTOM', 'LEFT_TOP' ,0,0,{'url':url, 'fixedPosition':false,'height':612,'width':702,'background':true});
			}
		},
		formField: function(){
			var params = Utils.getUrlParamsAsJson();
			if (params && params.catId) {
				var forms = document.getElementsByTagName('form');
				var catName = params.catId;
				getElementsByTagAndClassName('input', 'catalogId')[0].value = catName;
				for (var i = 0; i < forms.length; ++i) {
					setNodeAttribute(forms[i], 'target', '_self');
				}
			}
		},
		show: function(){
			var catName = (document.getElementById('catIdContainer')).innerHTML;
			if (catName != "no") {
				var height = 610;
				var width = 700;
				var shell = $('onlineCatalogSuccess');
				var url = "/Blaetterkataloge/" + catName + "/blaetterkatalog/index.html";
				var cont = createDOM('iframe', {'src': url, 'frameborder': 0, 'border': 0, 'height': height, 'width': width, 'scrolling':'no', 'marginheight':0, 'marginwidth': 0, 'hspace':0, 'vspace':0, 'style': 'border: 0 none; overflow: hidden;'});
				shell.innerHTML = '';
				shell.appendChild(cont);
			}
		}
	}
/* << */
