	function hideInputBg(field)
	{
		ipField = document.getElementById(field);
		ipField.style.background = "#fff";
	}
	
	
	function IE_Refresh(){
		if (document.all) location.reload();
	}
	window.onresize = IE_Refresh;
	
// >> Helpers 
	var Base64 = {
		// private property
		_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
		
		// public method for encoding
		encode : function (input) {
			var output = "";
			var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
			var i = 0;
		
			input = Base64._utf8_encode(input);
		
			while (i < input.length) {
		
				chr1 = input.charCodeAt(i++);
				chr2 = input.charCodeAt(i++);
				chr3 = input.charCodeAt(i++);
		
				enc1 = chr1 >> 2;
				enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
				enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
				enc4 = chr3 & 63;
		
				if (isNaN(chr2)) {
					enc3 = enc4 = 64;
				} else if (isNaN(chr3)) {
					enc4 = 64;
				}
		
				output = output +
				this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
				this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
		
			}
		
			return output;
		},
		// public method for decoding
		decode : function (input) {
			var output = "";
			var chr1, chr2, chr3;
			var enc1, enc2, enc3, enc4;
			var i = 0;
		
			input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		
			while (i < input.length) {
		
				enc1 = this._keyStr.indexOf(input.charAt(i++));
				enc2 = this._keyStr.indexOf(input.charAt(i++));
				enc3 = this._keyStr.indexOf(input.charAt(i++));
				enc4 = this._keyStr.indexOf(input.charAt(i++));
		
				chr1 = (enc1 << 2) | (enc2 >> 4);
				chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
				chr3 = ((enc3 & 3) << 6) | enc4;
		
				output = output + String.fromCharCode(chr1);
		
				if (enc3 != 64) {
					output = output + String.fromCharCode(chr2);
				}
				if (enc4 != 64) {
					output = output + String.fromCharCode(chr3);
				}
		
			}
			output = Base64._utf8_decode(output);
			return output;
		},
		// private method for UTF-8 encoding
		_utf8_encode : function (string) {
			string = string.replace(/\r\n/g,"\n");
			var utftext = "";
			for (var n = 0; n < string.length; n++) {
				var c = string.charCodeAt(n);
				if (c < 128) {
					utftext += String.fromCharCode(c);
				}
				else if((c > 127) && (c < 2048)) {
					utftext += String.fromCharCode((c >> 6) | 192);
					utftext += String.fromCharCode((c & 63) | 128);
				}
				else {
					utftext += String.fromCharCode((c >> 12) | 224);
					utftext += String.fromCharCode(((c >> 6) & 63) | 128);
					utftext += String.fromCharCode((c & 63) | 128);
				}
			}
			return utftext;
		},
		// private method for UTF-8 decoding
		_utf8_decode : function (utftext) {
			var string = "";
			var i = 0;
			var c = c1 = c2 = 0;
			while ( i < utftext.length ) {
				c = utftext.charCodeAt(i);
				if (c < 128) {
					string += String.fromCharCode(c);
					i++;
				}
				else if((c > 191) && (c < 224)) {
					c2 = utftext.charCodeAt(i+1);
					string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
					i += 2;
				}
				else {
					c2 = utftext.charCodeAt(i+1);
					c3 = utftext.charCodeAt(i+2);
					string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
					i += 3;
				}
			}
			return string;
		}
	}
// << 


// >> 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.wRef = null; // window reference to make changes on the opened window
	}
	
	StandardPopup.prototype._formatParams = function()
	{
		var str = '\'';
		var objParam;
		for (var param in this.params){
			objParam = this.params[param] == 'location' ? 'locationbar' : this.params[param];
			if (eval("this." + objParam)){
				str += this.params[param] + '=' + eval("this." + objParam) + ',';
			}
		}
		str = str.substring(0, str.length -1);
		str += '\'';
		return str;
	}
	
	StandardPopup.prototype.open = function(){
		var paraStr = this._formatParams();
		this.wRef = window.open(this.href, this.name, paraStr);
		if (this.wRef) this.wRef.focus();
		return false;
	}


// >> popups 
	function openZoomImage(url, height, width, e){
		var pup = new StandardPopup({'href': url, 'height': height, 'width': width});
		pup.open();
		var wRef = pup.wRef;
	}
// << 


// >> client current date (require mochikit 1.4)
	function getCurrentDate(id){
		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();
		$(id).appendChild(DIV(null, d + ', den ' + dom + ' ' + m + ' ' + y));
	}
// << 


// >> 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){
		
	}
// << 


// >> diashow (require mochikit 1.4)
	function Diashow(url, tplPrefix){
		this.diashow = null;
		this.current = 0;
		this.overall = 0;
		this.url = url;
		this.imgPath = null;
		this.tplPrefix = tplPrefix;
	}
	
	Diashow.prototype.connect = function(id, detailId){
		if ($(id + '_link')){
			connect($(id + '_link'), 'onclick', bind('openDetail', this, detailId));
			if ($(id + '_img')){
				var images = $(id + '_img').getElementsByTagName('img');
				for (var i = 0; i < images.length; ++i){
					connect(images[i], 'onclick', bind('openDetail', this, detailId));
					setNodeAttribute(images[i], 'class', 'connected');
				}
			}
		}else{
			var prefixes = ['i_', 'z_'];
			for (var i = 0; i < prefixes.length; ++i){
				connect($(prefixes[i] + id), 'onclick', bind('openDetail', this, detailId));
				if (prefixes[i] == 'i_') setNodeAttribute($(prefixes[i] + id), 'class', 'linkedImage');
			}
		}
	}

	Diashow.prototype.openDetail = function(id, e){
		e.stop();
		var url = "/" + this.tplPrefix + "_de_diashowDetail.html?id=" + id;
		var pup = new StandardPopup({'href': url, 'height': 715, 'width': 788});
		pup.open();
	}

	Diashow.prototype.init = function(){
		var def = doSimpleXMLHttpRequest(this.url);
		def.addCallbacks(bind('handleData', this), bind('handleDataError', this));
	}
	
	Diashow.prototype.handleData = function(def){
		this.diashow = evalJSONRequest(def);
		this.overall = this.diashow.images.length;
		//this.fillTitle();
		this.fillText();
		this.fillImageWithPager();
	}

	Diashow.prototype.handleDataError = function(def){
		log(def.message);
	}
	
	Diashow.prototype.fillTitle = function(){
		var title = H3({'class': 'title'}, this.diashow.title);
		$('banner').innerHTML = '';
		$('banner').appendChild(title);
	}

	Diashow.prototype.fillText = function(){
		if (! $('textInner')){
			$('textOuter').appendChild(DIV({'id': 'textInner'}, null));
		}
		$('textInner').innerHTML = '';
		if (this.diashow.images[this.current].text){
			var text = DIV({'class': 'text'}, this.diashow.images[this.current].text);
			$('textInner').appendChild(text);
		}else{
			removeElement($('textInner'));
		}
	}
	
	Diashow.prototype.page = function(p, e){
		e.stop();
		if (p == 'prev'){
			this.current = this.current > 0 ? this.current -1 : this.overall -1;
		}else{
			this.current = this.current < this.overall -1 ? this.current +1 : 0;
		}
		this.fillText();
		this.fillImageWithPager();
	}
	
	Diashow.prototype.getPager = function(){
		p = DIV(null);
		if (this.overall > 0){ // the pager is always present if also only one image is available
			var leftLink = A({'class': 'previous', 'href': '#'}, 'Zurück');
			var rightLink = A({'class': 'next', 'href': '#'}, 'Weiter');
			connect(leftLink, 'onclick', bind('page', this, 'prev'));
			connect(rightLink, 'onclick', bind('page', this, 'next'));
			p = DIV(
				{'id': 'pager'},
				TABLE(
					{'cellpadding': 0, 'cellspacing': 0, 'border': 0},
					TBODY(
						null,
						TR(
							null,
							TD({'class': 'left'}, leftLink),
							TD({'class': 'center'}, 'Bild ', SPAN({'class': 'current'}, this.current + 1), SPAN({'class': 'pmt'}, ' von '), SPAN({'class': 'overall'}, this.overall)),
							TD({'class': 'right'}, rightLink)
						)
					)
				)
			);
		}
		return p;
	}

	Diashow.prototype.fillImageWithPager = function(){
		var img = this.diashow.images[this.current];
		var image = DIV({'id': 'image'}, IMG({'src': img.src, 'alt': '', 'height': img.height, 'width': img.width}));
		$('pagerOuter').innerHTML = '';
		$('imgOuter').innerHTML = '';
		$('pagerOuter').appendChild(this.getPager());
		$('imgOuter').appendChild(image);
	}
// << 


// >> Enhanced search teaser (require mochikit 1.4)
	function EnhancedSearch(optList, url){
		this.url = url;
		this.optList = optList;
	}
	
	EnhancedSearch.prototype.connectOptions = function(){
		for (var i = 0; i < this.optList.length; ++i){
			this.checkOption(this.optList[i]),
			connect($(this.optList[i]), 'onclick', bind('prepareAction', this, this.optList[i]));
		}
	}

	EnhancedSearch.prototype.checkOption = function(id){
		// abstract method
		;
	}
	
	EnhancedSearch.prototype.prepareAction = function(optId, e){
		if (optId == 'optNumber'){
			this.getOptions();
		}else{
			blindUp($('magazineSelect'), {'duration': 0.5});
		}
	}
	
	EnhancedSearch.prototype.getOptions = function(){
		var def = doSimpleXMLHttpRequest(this.url);
		def.addCallbacks(bind('createSelectBox', this), bind('createSelectBoxError', this));
	}
	
	EnhancedSearch.prototype.createSelectBox = function(def){
		var selectShell = $('magazineSelect');
		var s = SELECT({'name': 'searchIssue', 'class': 'magazines'});
		var opts = evalJSONRequest(def);
		selectShell.innerHTML = '';
		s.options[0] = new Option('--- Nichts ausgewählt ---', -1, false);
		for (var n = 0; n < opts.length; ++n){
			s.options[n+1] = new Option('Ausgabe: ' + opts[n].content, opts[n].value, opts[n].selected);
		}
		selectShell.appendChild(s);
		appear(selectShell, {'from': 0, 'to': 1});
	}

	EnhancedSearch.prototype.createSelectBoxError = function(def){
		logFatal('selectbox creation failed', def.message);
	}
// << 


// >> Enhanced standard search (require mochikit 1.4)
	function EnhancedStdSearch(optList, url){
		this.constructor(optList, url);
	}
	EnhancedStdSearch.prototype = new EnhancedSearch();
	
	EnhancedStdSearch.prototype.checkOption = function(id){
		var checked = getNodeAttribute(id, 'checked');
		if (checked && id == 'i_610'){
			this.showSelectBox();
		}
	}

	EnhancedStdSearch.prototype.prepareAction = function(optId, e){
		if (optId == 'i_610'){
			this.showSelectBox();
		}else{
			blindUp($('kennziffer_select_outer'), {'duration': 0.5});
		}
	}

	EnhancedStdSearch.prototype.showSelectBox = function(){
		var selectShell = $('kennziffer_select_outer');
		appear(selectShell, {'from': 0, 'to': 1});
	}
// << 


// >> Enhanced product search (require mochikit 1.4)
	function EnhancedProductSearch(optList){
		this.constructor(optList, null);
	}
	EnhancedProductSearch.prototype = new EnhancedSearch();
	
	EnhancedProductSearch.prototype.connectOptions = function(hiddenFieldId){
		for (var i = 0; i < this.optList.length; ++i){
			connect($(this.optList[i]), 'onclick', bind('prepareAction', this, this.optList[i]));
		}
	}
	
	EnhancedProductSearch.prototype.prepareAction = function(optId, e){
		var node, optVal;
		node = optVal = $(optId);
		optVal = getNodeAttribute(optVal, 'value');
		while(node.nodeName.toLowerCase() != 'form'){
			node = node.parentNode;
		}
		var act = getNodeAttribute(node, 'action');
		act = act.substring(0, act.lastIndexOf('id_') + 3) + optVal + '_.htm';
		setNodeAttribute(node, 'action', act);
	}
// << 


// >> Zoom images (require mochikit 1.4)
	function connectZoomImage(url, id, height, width){
		var connectId = connect($(id), 'onclick', partial(openZoomImage, url, height, width));
	}
// << 


// >> toggle container (require mochikit 1.4)
	var ToggleContainer = {
		container: [],
		addToggle: function(id){
			var t = new ToggleObj();
			t.id = id,
			t.status = 1;
			t.elm = $(id);
			t.img = $(id + '_img');
			t.conId = connect(t.img, 'onclick', bind('toggle', this, id));
			this.container.push(t);
			log(this.container[0].id);
		},
		toggle: function(id, e){
			e.stop();
			var c = this.container;
			for (var i = 0; i < c.length; ++i){
				if (c[i].id == id) c[i].toggle();
			}
		}
	}

	function ToggleObj(){
		this.id = null,
		this.status = 0,
		this.elm = null,
		this.img = null,
		this.conId = null,
		this.toggle = function(){
			if (this.status == 1){
				updateNodeAttributes(this.img, {'class': 'closed'});
				fade(this.elm, {'from': 1, 'to': 0, 'duration': 0.4});
				this.status = 0;
			}else{
				updateNodeAttributes(this.img, {'class': 'open'});
				appear(this.elm, {'from': 0, 'to': 1, 'duration': 0.4});
				this.status = 1;
			}
		}
	}
// << 


// >> 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);
	}
// << 


// >> form submit trigger (require mochikit 1.4)
	function connectFormSubmitTrigger(){
		var links = document.links;
		for (var i = 0; i < links.length; ++i){
			if (getNodeAttribute(links[i], 'rel') == 'formSubmitTrigger'){
				connect(links[i], 'onclick', partial(submitSimpleForm, links[i]));
			}
		}
	}
	
	function getTriggerForm(node){
		while (node){
			var node = node.parentNode;
			if(node.nodeName.toLowerCase() == 'form') return node;
			return false;
		}
	}
	
	function submitSimpleForm(trigger, e){
		e.stop();
		var form = getTriggerForm(trigger);
		if (form) form.submit();
	}
// << 


// >> ad manager (require mochikit 1.4) version: rel-1-0-0
	AdManager = {
		log: false,
		adManagers: [],
		adList: [],
		stdSkyLeft: 840,
		stdSkyTop: 0,
		wallpaperSkyLeft: 840,
		wallpaperSkyTop: -90,
		wallpaperVariant: function(v){
			if (v == 1){
				var boxTop = $('box_top');
				var sky = $('skyscraper');
				setStyle(boxTop, {
					'height': '90px',
					'left': '173px',
					'top': '0px',
					'margin-left': '-5px',
					'margin-right': '-5px',
					'margin-top': '4px',
					'position': 'relative',
					'width': '845px',
					'z-index': 200,
					'text-align': 'right'
				});
				if (sky) setStyle(sky, {
					'left': '834px',
					'position': 'absolute',
					'top': '0px',
					'z-index': 100
				});
			}else{
				if (this.log) log('ValueError: Wallpaper variant is not defined, variant info: ' + v);
			}
		},
		_inArray: function(str, arr){
			for (var i = 0; i < arr.length; ++i){
				if (str == arr[i]) return {'value': str, 'index': i};
			}
			return false;
		},
		logging: function(on){
			this.log = false;
			if (on) this.log = true;
			for (var i = 0; i < this.adManagers.length; ++i){
				this.adManagers[i].logging(this.log);
			}
		},
		getLoggingLine: function(msg){
			log();
			var line = '';
			var len = 170;
			var msg = ' >> ' + msg + ' << ';
			for (var i = 0; i < len - msg.length; ++i){
				line += '-';
			}
			return msg + line;
		},
		makeAdManager: function(adManager){
			this.adManagers.push(adManager);
			return adManager;
		},
		init: function(spcId){
			for (var i = 0; i < this.adManagers.length; ++i){
				var baseScriptStr = this.adManagers[i].writeBaseScript(spcId);
				if (this.log){
					log(this.getLoggingLine('Ad manager base scripts'));
					log(this.adManagers[i].name, 'base script written:', baseScriptStr);
				}
			}
			if (this.log) log(AdManager.getLoggingLine('Temporarily banner code written'));
		},
		activateAds: function(){
			for (var i = 0; i < this.adManagers.length; ++i){
				var amb = this.adManagers[i].banner;
				if (this.log) log(this.getLoggingLine(this.adManagers[i].name + ' ads are pushed into ad list'));
				for (var j = 0; j < amb.length; ++j){
					this.adList.push(amb[j]);
					if (this.log){
						log(amb[j].__repr__());
					}
				}
			}
			if (this.log) log(this.getLoggingLine('Move banner to there targets'));
			for (var i = 0; i < this.adList.length; ++i){
				if ($(this.adList[i].type + '_temp')){
					this.placeBanner(this.adList[i]);
				}
			}
		},
		getAdShell: function(attrs, content){
			return DIV(attrs, content);
		},
		placeBanner: function(banner){
			var n = banner.type;
			var area = $(banner.target);
			var attrs = {'align': 'center'};
			if (n == 'start_skyscraper' || n == 'skyscraper' || n == 'wallpaper_sky'){
				attrs = {'style': {'position': 'absolute', 'z-index': 100, 'left': this.stdSkyLeft + 'px', 'top': this.stdSkyTop + 'px'}, 'id': 'skyscraper'};
			}else if (n == 'wallpaper_top'){
				attrs = {'align': 'right'};
			}else if (n == 'box_left' || n == 'box_right'){
				setNodeAttribute(area, 'style', 'margin-bottom: 10px;');
			}else if (n == 'medium_rectangle'){
				setNodeAttribute(area, 'style', 'margin-bottom: 12px;');
			}else if (n == 'layer_ad'){
				attrs = {'style': {'position': 'absolute', 'z-index': 1000, 'left': 184 + 'px', 'top': 367 + 'px'}};
			}
			if (area){
				var cont = $(n + '_temp');
				if (this.log){
					log('Moved', banner.type, 'to element', repr(area), 'with id:', area.id);
				}
				var frag = DIV(null);
				cNodes = cont.childNodes;
				var inner = this.getAdShell(attrs, cNodes);
				if (inner.childNodes.length > 0) removeElement(inner.childNodes[inner.childNodes.length -1]);
				var root = DIV(null, inner);
				if (n == 'start_skyscraper' || n == 'skyscraper' || n == 'layer_ad' || n == 'wallpaper_sky'){
					area.appendChild(root.childNodes[0]);
					showElement(area);
				}else{
					//area.innerHTML = '';
					//area.innerHTML = root.innerHTML;
					showElement(area);
					area.appendChild(root.childNodes[0]);
					
				}
				if (typeof wallpaperVariant != 'undefined'){
					this.wallpaperVariant(wallpaperVariant);
				}
			}else{
				if (this.log){
					logFatal('*** CANCELED MOVE ***', banner.type, '. Element', banner.target, 'not present!');
				}
			}
		}
	}
	
	//>> Abstract AdManager
		function Abstract_AdManager(url){
			this.name = 'AbstractAdManager';
			this.log = false;
			this.url = url;
			this.banner = [];
			this.lastStartBanner = null;
		}
		
		Abstract_AdManager.prototype.logging = function(on){
			this.log = false;
			if (on) this.log = true;
			for (var i = 0; i < this.banner.length; ++i){
				this.banner[i].log = this.log;
			}
		}
	
		Abstract_AdManager.prototype.getCurrentCoId = function(){
			var loc = window.location.href;
			return loc.substring(loc.search(/_id_/) + 4, loc.search(/_.htm/));
		}
	
		Abstract_AdManager.prototype._inArray = function(num, arr){
			for (var i = 0; i < arr.length; ++i){
				if (num == arr[i]) return true;
			}
			return false;
		}
		
		Abstract_AdManager.prototype.addBanner = function(bannerType, coInfo, bannerData, url){}
		Abstract_AdManager.prototype.writeBaseScript = function(){}
		Abstract_AdManager.prototype.startBanner = function(type){}
		Abstract_AdManager.prototype.endBanner = function(){}
	//<<


	//>> Abstract Banner
		function Abstract_Banner(url, type, coInfo){
			this.log = false;
			this.type = type;
			this.coInfo = coInfo;
			this.adServer = url;
		}
		
		Abstract_Banner.prototype.startBanner = function(){}
		Abstract_Banner.prototype.endBanner= function(){}
		Abstract_Banner.prototype.getAdSrc = function(layerAd){}
		Abstract_Banner.prototype.__repr__ = function(){}
	//<<


	//>> OpenAd ad manager implementation
		function OpenAd_AdManager(url){
			this.constructor(url);
			this.name = 'OpenAd';
		}
		OpenAd_AdManager.prototype = new Abstract_AdManager();
	
		OpenAd_AdManager.prototype.addBanner = function(bannerType, coInfo, bannerData, url){
			var url = url ? url : this.url;
			this.banner.push(new OpenAd_Banner(url, bannerType, coInfo, bannerData));
		}
	
		OpenAd_AdManager.prototype.writeBaseScript = function(spcId){
			var str = '<script language="JavaScript" type="text/javascript" src="' + this.url + 'ad/adx.js"></script>';
			document.write(str);
			return str;
		}
		
		OpenAd_AdManager.prototype.startBanner = function(type){
			var published = false;
			var coId = this.getCurrentCoId();
			for (var i = 0; i < this.banner.length; ++i){
				var banner = this.banner[i];
				if (banner.type == type){
					published = true;
					if (banner.coInfo && banner.coInfo.flip){
						if (! this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else if(banner.coInfo){
						if (this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else{
						banner.startBanner();
						if (this.log){
							log(banner.__repr__());
						}
						this.lastStartBanner = banner;
					}
				}
			}
			if (! published){
				if (this.log){
					logFatal('***Banner type', type, 'is not defined!***');
				}
			}
		}
	
		OpenAd_AdManager.prototype.endBanner = function(){
			if (this.lastStartBanner){
				this.lastStartBanner.endBanner();
				this.lastStartBanner = null;
			}
		}
	//<<


	//>> OpenAd banner implementation
		function OpenAd_Banner(url, type, coInfo, data){
			this.constructor(url, type, coInfo);
			this.zone = data[0];
			this.id = data[1];
			this.target = data[2];
		}
		
		OpenAd_Banner.prototype = new Abstract_Banner();
		
		OpenAd_Banner.prototype.startBanner = function(){
			document.write('<div id="' + this.type + '_temp" style="display: none;">');
			document.write('<script type="text/javascript" src="' + this.getAdSrc() + '"></script>');
			if (this.type != 'layer_ad'){
				document.write('<noscript>');
				document.write('<a href="' + this.adServer + 'ad/adclick.php?n=' + this.id + '" target="_blank">');
				document.write('<img src="' + this.adServer + 'ad/adview.php?what=zone:' + this.zone + '&amp;n=' + this.id + '" border="0" alt="" />');
				document.write('</a>');
				document.write('</noscript>');
			}
		}
			
		OpenAd_Banner.prototype.endBanner= function(){
			document.write('</div>');
		}
		
		OpenAd_Banner.prototype.getAdSrc = function(layerAd){
			if (this.type == 'layer_ad'){
				return this.adServer + 'ad/adlayer.php?what=zone:' + this.zone + '&amp;layerstyle=geocities&amp;align=right&amp;padding=2&amp;closetext=%5BSchlie%DFen%5D';
			}else{
				if (!document.phpAds_used) document.phpAds_used = ',';
				phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
				src = this.adServer + 'ad/adjs.php?n=' + phpAds_random;
				src += '&amp;what=zone:' + this.zone;
				src += '&amp;exclude=' + document.phpAds_used;
				if (document.referrer) src += '&amp;referer=' + escape(document.referrer);
			}
			return src;
		}
		
		OpenAd_Banner.prototype.__repr__ = function(){
			var str = '';
			str += 'type: ' + this.type + ', ';
			if (this.coInfo){
				str += 'shown on: ' + this.coInfo.coIds + ', use invert list: ' + this.coInfo.flip + ', ';
			}else{
				str += 'shown on: all, ';
			}
			str += 'zone: ' + this.zone + ', ';
			str += 'id: ' + this.id + ', ';
			str += 'target: ' + this.target + ', ';
			str += 'ad server: ' + this.adServer + ', ';
			return str;
		}
	//<<


	//>> OpenX ad manager implementation
		function OpenX_AdManager(url){
			this.constructor(url);
			this.name = 'OpenX';
		}
		OpenX_AdManager.prototype = new Abstract_AdManager();
	
		OpenX_AdManager.prototype.addBanner = function(bannerType, coInfo, bannerData, url){
			var url = url ? url : this.url;
			this.banner.push(new OpenX_Banner(url, bannerType, coInfo, bannerData));
		}

		OpenX_AdManager.prototype.writeBaseScript = function(spcId){
			// openX needs no base library to include.
			return null;
		}
		
		OpenX_AdManager.prototype.startBanner = function(type){
			var published = false;
			var coId = this.getCurrentCoId();
			for (var i = 0; i < this.banner.length; ++i){
				var banner = this.banner[i];
				if (banner.type == type){
					published = true;
					if (banner.coInfo && banner.coInfo.flip){
						if (! this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else if(banner.coInfo){
						if (this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else{
						banner.startBanner();
						if (this.log){
							log(banner.__repr__());
						}
						this.lastStartBanner = banner;
					}
				}
			}
			if (! published){
				if (this.log){
					logFatal('***Banner type', type, 'is not defined!***');
				}
			}
		}
	
		OpenX_AdManager.prototype.endBanner = function(){
			if (this.lastStartBanner){
				this.lastStartBanner.endBanner();
				this.lastStartBanner = null;
			}
		}
	//<<


	//>> OpenX banner implementation
		function OpenX_Banner(url, type, coInfo, data){
			this.constructor(url, type, coInfo);
			this.zone = data[0];
			this.id = data[1];
			this.target = data[2];
		}
		
		OpenX_Banner.prototype = new Abstract_Banner();


		OpenX_Banner.prototype.startBanner = function(){
			var url = this.adServer;
			var adPhpFile = 'ad_new/www/delivery/ajs.php';
			var ckPhpFile = 'ad_new/www/delivery/ck.php';
			var avwPhpFile = 'ad_new/www/delivery/avw.php';
			var m3_u = url + adPhpFile;
			if (location.protocol=='https:'){
				url = url.replace(/http:/, 'https:');
				m3_u = url + adPhpFile;
			}
			var m3_r = Math.floor(Math.random()*99999999999);
			var str = '';
			str += '<div id="' + this.type + '_temp" style="display: none;">';
			str += '<scr' + 'ipt type="text/javascript" src="' + this.getAdSrc(m3_u, m3_r) + '"><\/scr' + 'ipt>';
			if (this.type != 'layer_ad'){
				/*str += '<noscript>';
				str += '<a href="' + url + ckPhpFile + '?n=' + this.id + '&amp;cb=' + m3_r + '" target="_blank">';
				str += '<img src="' + url + avwPhpFile +'?zoneid=' + this.zone + '&amp;cb=' + m3_r + '&amp;n=' + this.id + '" border="0" alt="" />';
				str += '</a>';
				str += '</noscript>';*/
			}
			document.write(str);
		}

		OpenX_Banner.prototype.endBanner= function(){
			document.write('</div>');
		}
		
		OpenX_Banner.prototype.getAdSrc = function(m3_u, m3_r){
			if (!document.MAX_used) document.MAX_used = ',';
			var str = m3_u;
			str += '?zoneid=' + this.zone;
			str += '&amp;cb=' + m3_r;
			if (document.MAX_used != ',') str += '&amp;exclude=' + document.MAX_used;
			if (document.charset){
				str += '&amp;charset='+document.charset;
			}else if (document.characterSet){
				str += '&amp;charset='+document.characterSet;
			}
			str += '&amp;loc=' + escape(window.location);
			if (document.referrer) str += '&amp;referer=' + escape(document.referrer);
			//if (document.context) str += '&context=' + escape(document.context);
			if (document.mmm_fo) str += '&amp;mmm_fo=1';
			return str;
		}
		
		OpenX_Banner.prototype.__repr__ = function(){
			var str = '';
			str += 'type: ' + this.type + ', ';
			if (this.coInfo){
				str += 'shown on: ' + this.coInfo.coIds + ', use invert list: ' + this.coInfo.flip + ', ';
			}else{
				str += 'shown on: all, ';
			}
			str += 'zone: ' + this.zone + ', ';
			str += 'id: ' + this.id + ', ';
			str += 'target: ' + this.target + ', ';
			str += 'ad server: ' + this.adServer + ', ';
			return str;
		}
	//<<


	//>> OpenXSPC ad manager implementation
		function OpenXSPC_AdManager(url){
			this.constructor(url);
			this.name = 'OpenXSPC';
		}
		OpenXSPC_AdManager.prototype = new Abstract_AdManager();
		
		
		//Adm.addBanner('wallpaper_top', null, [11, 'a0cabf0f', 'box_top'], null);

		OpenXSPC_AdManager.prototype.addBanner = function(bannerType, coInfo, bannerData, url){
			if ($(bannerData[1])){
				var url = url ? url : this.url;
				if (typeof OA_zones == 'undefined') window.OA_zones = {};
				OA_zones[bannerType] = bannerData[0];
				this.banner.push(new OpenXSPC_Banner(url, bannerType, coInfo, bannerData));
			}
		}

		OpenXSPC_AdManager.prototype.writeBaseScript = function(spcId){
			if (spcId){
				var str = '<script type="text/javascript" src="' + this.url + 'ad/www/delivery/spcjs.php?id=' + spcId + '"></script>';
				document.write(str);
				return str;
			}
			var str = '<script type="text/javascript" src="' + this.url + 'ad/www/delivery/spcjs.php?id=1"></script>';
			document.write(str);
			return str;
		}
		
		OpenXSPC_AdManager.prototype.startBanner = function(type){
			var published = false;
			var coId = this.getCurrentCoId();
			for (var i = 0; i < this.banner.length; ++i){
				var banner = this.banner[i];
				if (banner.type == type){
					published = true;
					if (banner.coInfo && banner.coInfo.flip){
						if (! this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else if(banner.coInfo){
						if (this._inArray(coId, banner.coInfo.coIds)){
							banner.startBanner();
							if (this.log){
								log(banner.__repr__());
							}
							this.lastStartBanner = banner;
						}
					}else{
						banner.startBanner();
						if (this.log){
							log(banner.__repr__());
						}
						this.lastStartBanner = banner;
					}
				}
			}
			if (! published){
				if (this.log){
					logFatal('***Banner type', type, 'is not defined!***');
				}
			}
		}
	
		OpenXSPC_AdManager.prototype.endBanner = function(){
			if (this.lastStartBanner){
				this.lastStartBanner.endBanner();
				this.lastStartBanner = null;
			}
		}
	//<<


	//>> OpenXSPC banner implementation
		function OpenXSPC_Banner(url, type, coInfo, data){
			this.constructor(url, type, coInfo);
			this.target = data[1];
		}
		OpenXSPC_Banner.prototype = new Abstract_Banner();


		OpenXSPC_Banner.prototype.startBanner = function(){
			var url = this.adServer;
			var str = '';
			str += '<div id="' + this.type + '_temp" style="display: block;">';
			//str += '<scr' + 'ipt type="text/javascript">setTimeout(function(){' + this.getAdSrc() + '}, 3000);><\/scr' + 'ipt>';
			str += OA_output[this.type];
			document.write(str);
		}

		OpenXSPC_Banner.prototype.endBanner= function(){
			document.write('</div>');
		}
		
		OpenXSPC_Banner.prototype.getAdSrc = function(){
			return 'OA_show("' + this.type + '");';
		}
		
		OpenXSPC_Banner.prototype.__repr__ = function(){
			var str = '';
			str += 'type: ' + this.type + ', ';
			if (this.coInfo){
				str += 'shown on: ' + this.coInfo.coIds + ', use invert list: ' + this.coInfo.flip + ', ';
			}else{
				str += 'shown on: all, ';
			}
			str += 'zone: ' + this.zone + ', ';
			str += 'id: ' + this.id + ', ';
			str += 'target: ' + this.target + ', ';
			str += 'ad server: ' + this.adServer + ', ';
			return str;
		}
	//<<
// <<


// >> Special Search Banner (require mochikit 1.4)
	SpecialSearchBanner = {
		chpyId: '/banner',
		phrase: null,
		targetEl: null,
		init: function(searchFieldId, target, phrase){
			this.targetEl = $(target);
			this.phrase = $(searchFieldId) ? $(searchFieldId).value: searchFieldId;
			this.getBannerContent();
		},
		getBannerContent: function(){
			var url = this.chpyId + '/' + encodeURI(this.phrase);
			//var url = 'specialSearchBannerTest.text';
			var def = doSimpleXMLHttpRequest(url);
			def.addCallbacks(bind('changeTargetContent', this), bind('changeTargetContentError', this));
		},
		changeTargetContent: function(def){
			var adOuterStart = '<table cellpadding="0" cellspacing="0" class="specialSearchBanner"><tr><td class="adOuter"><span class="adPmt">Anzeige</span><br/>';
			var adOuterEnd = '</td></tr></table>';
			if (def.responseText.length > 1){
				this.targetEl.innerHTML = adOuterStart + def.responseText + adOuterEnd;
			}
		},
		changeTargetContentError: function(def){
			logFatal('SpecialSearchBanner.getBannerContent', def.message);
		}
	}
// << 


// >> Editorial office commendation (require mochikit 1.4) version: rel-1-0-0
	EditorialOfficeCommendation = {
		chpyId: '/commendation',
		phrase: null,
		targetEl: null,
		holderElm: null,
		init: function(searchFieldId, target, holderElmClassName, phrase){
			this.targetEl = $(target);
			this.phrase = $(searchFieldId) ? $(searchFieldId).value: searchFieldId;
			this.holderElm = getElementsByTagAndClassName('div', holderElmClassName);
			if (this.holderElm && this.holderElm.length > 0) this.holderElm = this.holderElm[0];
			this.getCommendationContent();
		},
		getCommendationContent: function(){
			var url = this.chpyId + '/' + encodeURI(this.phrase);
			//var url = 'specialSearchCommendationTest.text';
			var def = doSimpleXMLHttpRequest(url);
			def.addCallbacks(bind('changeTargetContent', this), bind('changeTargetContentError', this));
		},
		changeTargetContent: function(def){
			var adOuterStart = '<div class="commendationShell">';
			var adOuterEnd = '</div>';
			if (def.responseText.length > 1){
				this.targetEl.innerHTML = adOuterStart + def.responseText + adOuterEnd;
				appear(this.holderElm, {'duration': 2});
			}
		},
		changeTargetContentError: function(def){
			logFatal('EditorialOfficeCommendation.getCommendationContent', def.message);
		}
	}
// <<


// >> LL_CookieTool Version: rel-1-0-0 
	LL_CookieTool = {
		setCookies: function(cObjs){
			for (var i = 0; i < arguments.length; ++i){
				var c = arguments[i];
				c.setCookie();
			}
		},
		getCookie: function(name){
			var cstr = document.cookie;
			if (cstr.length > 0){
				cookies = cstr.split('; ');
				for (var i = 0; i < cookies.length; ++i){
					var cook = cookies[i];
					if (cook.substring(0, cook.lastIndexOf('=')) == name){
						return cook.substring(cook.lastIndexOf('=') + 1 , cook.length);
					}
				}
			}
			return null;
		},
		eraseCookie: function(name, domain, path){
			var c = new CookieData(name, null, domain, path, null, null);
			c.eraseCookie();
		}
	}
	
	CookieData = function(name, value, domain, path, expires, secure){
		this.name = name;
		this.value = value;
		this.domain = domain;
		this.path = path;
		this.expires = expires;
		this.secure = secure;
	}
	
	CookieData.prototype.setCookie = function(){
		var cook = this.name + '=' + unescape(this.value);
		cook += this.domain ? '; domain=' + this.domain : '';
		cook += this.expires ? '; expires=' + this.expires : '';
		cook += this.path ? '; path=' + this.path : '/';
		cook += this.secure ? '; secure' : '';
		document.cookie = cook;
	}
	
	CookieData.prototype.eraseCookie = function(){
		var cook = this.name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT';
		cook += this.domain ? '; domain=' + this.domain : '';
		cook += this.path ? '; path=' + this.path : '/';
		document.cookie = cook;
	}
// << 


// >> event calendar rubric banner switcher (require mochikit 1.4 and LL_CookieTool) Version: rel-1-0-0 
	CalRubricSwitcher = {
		adOuter: 'eventCalendarRubricAdOuter',
		ad: 'eventCalendarRubricAd',
		paramName: 'category',
		getUrlParam: function(name){
			var params = parseQueryString(window.location.href);
			if (params[name]) return params[name];
			return null;
		},
		createBanner: function(config){
			var param = this.getUrlParam(this.paramName);
			if (param && typeof config[param] == 'string'){
				if (document.cookie){
					LL_CookieTool.setCookies(
						new CookieData('eventCalendarAdId', config[param], document.domain, '/', null, null)
					);
				}
				this.createBannerLayout(config[param], config);
			}else if (param && typeof config[param] == 'undefined'){
				LL_CookieTool.eraseCookie('eventCalendarAdId', document.domain, '/');
			}else if (! param){
				var cookieValue = LL_CookieTool.getCookie('eventCalendarAdId');
				if (cookieValue){
					this.createBannerLayout(cookieValue, config);
				}
			}
		},
		createBannerLayout: function(cookieValue, config){
			for (var i = 0; i < config.length; ++i){
				if (typeof config[i] == 'string'){
					elm = getElementsByTagAndClassName('div', config[i])[0];
					if (cookieValue == config[i]){
						showElement(elm);
					}else{
						hideElement(elm);
					}
				}
			}
		}
	}
// <<
			

// >> media variants panel (require mochikit 1.4) Version: rel-1-0-0
	MediaVariantsSwitcher = function(){
		this.buttons = [];
	}
	
	MediaVariantsSwitcher.prototype.addButton = function(button){
		if (button instanceof MvMenuButton){
			connect(button.domel, 'onclick', bind('switchLayout', this, null));
			this.buttons.push(button);
			return button;
		}
		return null;
	}
	
	MediaVariantsSwitcher.prototype.activate = function(index){
		for (var i = 0; i < this.buttons.length; ++i){
			var b = this.buttons[i];
			if (i == index){
				b.toogle(1);
			}else{
				b.toggle(0);
			}
		}
	}
	
	MediaVariantsSwitcher.prototype.switchLayout = function(index, e){
		for (var i = 0; i < this.buttons.length; ++i){
			var b = this.buttons[i];
			if (index > -1 && i == index){
				b.toggle(1);
			}else{
				if (e && b.domel == e.src()){
					b.toggle(1);
				}else{
					b.toggle(0);
				}
			}
		}
	}


	// standard menu button
	MvMenuButton = function(id, linkedelm){
		this.id = id;
		this.domel = $(id);
		this.heresuffix = '_here';
		this.linkedelm = $(linkedelm);
	}

	MvMenuButton.prototype.toggle = function(mode){
		if (mode == 1){
			this.domel.id = this.id + this.heresuffix;
			showElement(this.linkedelm);
			return mode;
		}
		this.domel.id = this.id;
		hideElement(this.linkedelm);
		return mode;
	}


	// Abstract media
	MediaVariant = function(href){
		this.href = href;
	}
	
	MediaVariant.prototype.get = function(){}//writes the special media code


	MediaVariantAudio = function(href){
		this.constructor(href);
	}
	MediaVariantAudio.prototype = new MediaVariant();
	
	MediaVariantAudio.prototype.get = function(){
		var so = new SWFObject('../web/MediaPlayer/mediaplayer.swf','mediaplayer','240','20','9');
		so.addParam('allowfullscreen','false');
		so.addVariable('width','240');
		so.addVariable('height','20');
		so.addVariable('type','mp3');
		so.addVariable('file', this.href);
		so.addVariable('bufferlength','10');
		so.write("audiocontent");
	}



	MediaVariantVideo = function(href){
		this.constructor(href);
	}
	MediaVariantVideo.prototype = new MediaVariant();
	
	MediaVariantVideo.prototype.get = function(){
		var so = new SWFObject('../web/MediaPlayer/mediaplayer.swf','mediaplayer','240','198','7', '#336699');
		so.addParam('allowfullscreen','true');
		so.addVariable('width','240');
		so.addVariable('height','198');
		so.addVariable('file', this.href);
		//so.addVariable("image","video.jpg");
		so.write("videocontent");
	}

// <<


// >> LL_RelationshipManager (require mochikit 1.4) Version: rel-1-0-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.elms = []; // holds the elements and the rel attrs as a json object
		this.links = document.links;
		this.autoAction = false;
		this.filter(this.name);
	}
	
	// filter links wih rel's 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 rel's


	// 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);
	}
// <<
