/**
 * Copyright 2010 Tim Down.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Hashtable=(function(){var p="function";var n=(typeof Array.prototype.splice==p)?function(s,r){s.splice(r,1)}:function(u,t){var s,v,r;if(t===u.length-1){u.length=t}else{s=u.slice(t+1);u.length=t;for(v=0,r=s.length;v<r;++v){u[t+v]=s[v]}}};function a(t){var r;if(typeof t=="string"){return t}else{if(typeof t.hashCode==p){r=t.hashCode();return(typeof r=="string")?r:a(r)}else{if(typeof t.toString==p){return t.toString()}else{try{return String(t)}catch(s){return Object.prototype.toString.call(t)}}}}}function g(r,s){return r.equals(s)}function e(r,s){return(typeof s.equals==p)?s.equals(r):(r===s)}function c(r){return function(s){if(s===null){throw new Error("null is not a valid "+r)}else{if(typeof s=="undefined"){throw new Error(r+" must not be undefined")}}}}var q=c("key"),l=c("value");function d(u,s,t,r){this[0]=u;this.entries=[];this.addEntry(s,t);if(r!==null){this.getEqualityFunction=function(){return r}}}var h=0,j=1,f=2;function o(r){return function(t){var s=this.entries.length,v,u=this.getEqualityFunction(t);while(s--){v=this.entries[s];if(u(t,v[0])){switch(r){case h:return true;case j:return v;case f:return[s,v[1]]}}}return false}}function k(r){return function(u){var v=u.length;for(var t=0,s=this.entries.length;t<s;++t){u[v+t]=this.entries[t][r]}}}d.prototype={getEqualityFunction:function(r){return(typeof r.equals==p)?g:e},getEntryForKey:o(j),getEntryAndIndexForKey:o(f),removeEntryForKey:function(s){var r=this.getEntryAndIndexForKey(s);if(r){n(this.entries,r[0]);return r[1]}return null},addEntry:function(r,s){this.entries[this.entries.length]=[r,s]},keys:k(0),values:k(1),getEntries:function(s){var u=s.length;for(var t=0,r=this.entries.length;t<r;++t){s[u+t]=this.entries[t].slice(0)}},containsKey:o(h),containsValue:function(s){var r=this.entries.length;while(r--){if(s===this.entries[r][1]){return true}}return false}};function m(s,t){var r=s.length,u;while(r--){u=s[r];if(t===u[0]){return r}}return null}function i(r,s){var t=r[s];return(t&&(t instanceof d))?t:null}function b(t,r){var w=this;var v=[];var u={};var x=(typeof t==p)?t:a;var s=(typeof r==p)?r:null;this.put=function(B,C){q(B);l(C);var D=x(B),E,A,z=null;E=i(u,D);if(E){A=E.getEntryForKey(B);if(A){z=A[1];A[1]=C}else{E.addEntry(B,C)}}else{E=new d(D,B,C,s);v[v.length]=E;u[D]=E}return z};this.get=function(A){q(A);var B=x(A);var C=i(u,B);if(C){var z=C.getEntryForKey(A);if(z){return z[1]}}return null};this.containsKey=function(A){q(A);var z=x(A);var B=i(u,z);return B?B.containsKey(A):false};this.containsValue=function(A){l(A);var z=v.length;while(z--){if(v[z].containsValue(A)){return true}}return false};this.clear=function(){v.length=0;u={}};this.isEmpty=function(){return !v.length};var y=function(z){return function(){var A=[],B=v.length;while(B--){v[B][z](A)}return A}};this.keys=y("keys");this.values=y("values");this.entries=y("getEntries");this.remove=function(B){q(B);var C=x(B),z,A=null;var D=i(u,C);if(D){A=D.removeEntryForKey(B);if(A!==null){if(!D.entries.length){z=m(v,C);n(v,z);delete u[C]}}}return A};this.size=function(){var A=0,z=v.length;while(z--){A+=v[z].entries.length}return A};this.each=function(C){var z=w.entries(),A=z.length,B;while(A--){B=z[A];C(B[0],B[1])}};this.putAll=function(H,C){var B=H.entries();var E,F,D,z,A=B.length;var G=(typeof C==p);while(A--){E=B[A];F=E[0];D=E[1];if(G&&(z=w.get(F))){D=C(F,z,D)}w.put(F,D)}};this.clone=function(){var z=new b(t,r);z.putAll(w);return z}}return b})();

(function(k){var a=new Hashtable();var f=["ae","au","ca","cn","eg","gb","hk","il","in","jp","sk","th","tw","us"];var b=["at","br","de","dk","es","gr","it","nl","pt","tr","vn"];var i=["cz","fi","fr","ru","se","pl"];var d=["ch"];var g=[[".",","],[",","."],[","," "],[".","'"]];var c=[f,b,i,d];function j(n,l,m){this.dec=n;this.group=l;this.neg=m}function h(){for(var l=0;l<c.length;l++){localeGroup=c[l];for(var m=0;m<localeGroup.length;m++){a.put(localeGroup[m],l)}}}function e(l){if(a.size()==0){h()}var q=".";var o=",";var p="-";var n=a.get(l);if(n){var m=g[n];if(m){q=m[0];o=m[1]}}return new j(q,o,p)}k.fn.formatNumber=function(l,m,n){return this.each(function(){if(m==null){m=true}if(n==null){n=true}var p;if(k(this).is(":input")){p=new String(k(this).val())}else{p=new String(k(this).text())}var o=k.formatNumber(p,l);if(m){if(k(this).is(":input")){k(this).val(o)}else{k(this).text(o)}}if(n){return o}})};k.formatNumber=function(q,w){var w=k.extend({},k.fn.formatNumber.defaults,w);var l=e(w.locale.toLowerCase());var n=l.dec;var u=l.group;var o=l.neg;var m="0#-,.";var t="";var s=false;for(var r=0;r<w.format.length;r++){if(m.indexOf(w.format.charAt(r))==-1){t=t+w.format.charAt(r)}else{if(r==0&&w.format.charAt(r)=="-"){s=true;continue}else{break}}}var v="";for(var r=w.format.length-1;r>=0;r--){if(m.indexOf(w.format.charAt(r))==-1){v=w.format.charAt(r)+v}else{break}}w.format=w.format.substring(t.length);w.format=w.format.substring(0,w.format.length-v.length);var p=new Number(q);return k._formatNumber(p,w,v,t,s)};k._formatNumber=function(m,q,n,G,s){var q=k.extend({},k.fn.formatNumber.defaults,q);var E=e(q.locale.toLowerCase());var D=E.dec;var v=E.group;var l=E.neg;var x=false;if(isNaN(m)){if(q.nanForceZero==true){m=0;x=true}else{return null}}if(n=="%"){m=m*100}var z="";if(q.format.indexOf(".")>-1){var F=D;var t=q.format.substring(q.format.lastIndexOf(".")+1);if(q.round==true){m=new Number(m.toFixed(t.length))}else{var K=m.toString();K=K.substring(0,K.lastIndexOf(".")+t.length+1);m=new Number(K)}var y=m%1;var A=new String(y.toFixed(t.length));A=A.substring(A.lastIndexOf(".")+1);for(var H=0;H<t.length;H++){if(t.charAt(H)=="#"&&A.charAt(H)!="0"){F+=A.charAt(H);continue}else{if(t.charAt(H)=="#"&&A.charAt(H)=="0"){var r=A.substring(H);if(r.match("[1-9]")){F+=A.charAt(H);continue}else{break}}else{if(t.charAt(H)=="0"){F+=A.charAt(H)}}}}z+=F}else{m=Math.round(m)}var u=Math.floor(m);if(m<0){u=Math.ceil(m)}var C="";if(q.format.indexOf(".")==-1){C=q.format}else{C=q.format.substring(0,q.format.indexOf("."))}var J="";if(!(u==0&&C.substr(C.length-1)=="#")||x){var w=new String(Math.abs(u));var p=9999;if(C.lastIndexOf(",")!=-1){p=C.length-C.lastIndexOf(",")-1}var o=0;for(var H=w.length-1;H>-1;H--){J=w.charAt(H)+J;o++;if(o==p&&H!=0){J=v+J;o=0}}if(C.length>J.length){var I=C.indexOf("0");if(I!=-1){var B=C.length-I;while(J.length<B){J="0"+J}}}}if(!J&&C.indexOf("0",C.length-1)!==-1){J="0"}z=J+z;if(m<0&&s&&G.length>0){G=l+G}else{if(m<0){z=l+z}}if(!q.decimalSeparatorAlwaysShown){if(z.lastIndexOf(D)==z.length-1){z=z.substring(0,z.length-1)}}z=G+z+n;return z};k.fn.parseNumber=function(l,m,o){if(m==null){m=true}if(o==null){o=true}var p;if(k(this).is(":input")){p=new String(k(this).val())}else{p=new String(k(this).text())}var n=k.parseNumber(p,l);if(n){if(m){if(k(this).is(":input")){k(this).val(n.toString())}else{k(this).text(n.toString())}}if(o){return n}}};k.parseNumber=function(r,v){var v=k.extend({},k.fn.parseNumber.defaults,v);var m=e(v.locale.toLowerCase());var o=m.dec;var t=m.group;var p=m.neg;var l="1234567890.-";while(r.indexOf(t)>-1){r=r.replace(t,"")}r=r.replace(o,".").replace(p,"-");var u="";var n=false;if(r.charAt(r.length-1)=="%"){n=true}for(var s=0;s<r.length;s++){if(l.indexOf(r.charAt(s))>-1){u=u+r.charAt(s)}}var q=new Number(u);if(n){q=q/100;q=q.toFixed(u.length-1)}return q};k.fn.parseNumber.defaults={locale:"us",decimalSeparatorAlwaysShown:false};k.fn.formatNumber.defaults={format:"#,###.00",locale:"us",decimalSeparatorAlwaysShown:false,nanForceZero:true,round:true};Number.prototype.toFixed=function(l){return $._roundNumber(this,l)};k._roundNumber=function(n,m){var l=Math.pow(10,m||0);var o=String(Math.round(n*l)/l);if(m>0){var p=o.indexOf(".");if(p==-1){o+=".";p=0}else{p=o.length-(p+1)}while(p<m){o+="0";p++}}return o}})(jQuery);

// >> i18n
	$.lang('moreText', {
			'de': 'mehr',
			'en': 'more',
			'fr': 'plus',
			'es': 'más',
			'it': 'di più',
			'da': 'mere',
			'hu': 'Tovább',
			'nl': 'meer',
			'zh': '更多',
			'cs': 'více',
			'hr': 'više',
			'pl': 'więcej',
			'pt': 'more',
			'ptbr': 'more',
			'ro': 'more',
			'ru': 'Больше',
			'sk': 'Viac',
			'sr': 'more',
			'sv': 'more',
			'tr': 'Daha fazla'
	});
	$.lang('fewerText', {
			'de': 'weniger',
			'en': 'less',
			'fr': 'moins',
			'es': 'menos',
			'it': 'meno',
			'da': 'mindre',
			'hu': 'Vissza',
			'nl': 'minder',
			'zh': 'fewer',
			'cs': 'méně',
			'hr': 'manje',
			'pl': 'mniej',
			'pt': 'less',
			'ptbr': 'less',
			'ro': 'mai putin',
			'ru': 'Меньше',
			'sk': 'Menej',
			'sr': 'less',
			'sv': 'less',
			'tr': 'Kısalt'
	});
	$.lang('printTeaser', {
			'de': 'Rechter Seitenrand',
			'en': 'Right margin',
			'fr': 'Right margin',
			'es': 'Right margin',
			'it': 'Right margin',
			'da': 'Højre margen',
			'hu': 'Jobb margó',
			'nl': 'rechter marge',
			'zh': '内容摘要',
			'cs': 'Pravý okraj strany',
			'hr': 'Desna margina',
			'pl': 'Prawy margines',
			'pt': 'Right margin',
			'ptbr': 'Right margin',
			'ro': 'Marginea din dreapta',
			'ru': 'Правый край',
			'sk': 'Pravý okraj strany',
			'sr': 'Right margin',
			'sv': 'Right margin',
			'tr': 'Sağa yasla'
	});
	$.lang('printImages', {
			'de': 'Bilder',
			'en': 'Images',
			'fr': 'Images',
			'es': 'Images',
			'it': 'Images',
			'da': 'Billeder',
			'hu': 'Képek',
			'nl': 'afbeeldingen',
			'zh': '图片',
			'cs': 'Fotografie',
			'hr': 'Slike',
			'pl': 'Zdjęcia',
			'pt': 'Images',
			'ptbr': 'Images',
			'ro': 'Imagini',
			'ru': 'Изображения',
			'sk': 'Snímky',
			'sr': 'Images',
			'sv': 'Images',
			'tr': 'Resimler'
	});
	$.lang('printPrint', {
			'de': 'Drucken',
			'en': 'Print',
			'fr': 'Print',
			'es': 'Print',
			'it': 'Print',
			'da': 'Print',
			'hu': 'Nyomtatás',
			'nl': 'afdrukken',
			'zh': '打印',
			'cs': 'Tisk',
			'hr': 'Ispiši',
			'pl': 'Drukuj',
			'pt': 'Print',
			'ptbr': 'Print',
			'ro': 'Print',
			'ru': 'Печать',
			'sk': 'Tlač',
			'sr': 'Print',
			'sv': 'Print',
			'tr': 'Yazdır'
	});
	$.lang('printItemOn', {
			'de': 'mit',
			'en': 'with',
			'fr': 'with',
			'es': 'with',
			'it': 'with',
			'da': 'med',
			'hu': 'igen',
			'nl': 'met',
			'zh': '包括',
			'cs': 's',
			'hr': 's',
			'pl': 'z',
			'pt': 'with',
			'ptbr': 'with',
			'ro': 'cu',
			'ru': 'с',
			'sk': 's',
			'sr': 'with',
			'sv': 'with',
			'tr': 'ile'
	});
	$.lang('printItemOff', {
			'de': 'ohne',
			'en': 'without',
			'fr': 'without',
			'es': 'without',
			'it': 'without',
			'da': 'uden',
			'hu': 'nem',
			'nl': 'zonder',
			'zh': '不包括',
			'cs': 'bez',
			'hr': 'bez',
			'pl': 'bez',
			'pt': 'without',
			'ptbr': 'without',
			'ro': 'fara',
			'ru': 'без',
			'sk': 'bez',
			'sr': 'without',
			'sv': 'without',
			'tr': 'hariç'
	});
	$.lang('logout', {
			'de': 'Logout',
			'en': 'Logout',
			'fr': 'Logout',
			'es': 'Logout',
			'it': 'Logout',
			'da': 'Logout',
			'hu': 'Logout',
			'nl': 'Logout',
			'zh': 'Logout',
			'cs': 'Logout',
			'hr': 'Logout',
			'pl': 'Logout',
			'pt': 'Logout',
			'ptbr': 'Logout',
			'ro': 'Logout',
			'ru': 'Logout',
			'sk': 'Logout',
			'sr': 'Logout',
			'sv': 'Logout',
			'tr': 'Logout'
	});
// <<


// >> Special scripts registration for the frontend editor
	$(function(){
		if (typeof FrontendEditor === 'object'){
			FrontendEditor.CustomerLayoutPreparer.add('bannercorrection', function(){
				$('.headerImg .hImg img').css({
					top: 237
				});
			});
			FrontendEditor.CustomerLayoutPreparer.run();
		}
	});
// <<


// >> Input Button Hover/Focus Effect (Background switcher for image and submit/reset buttons)
	InputButtonHoverEffect = $.extend(
		$.clone(LLObject),
		{
			create: function (inputs) {
				var o = LLObject.create.call(this);
				o.inputs = inputs;
				o.handleType();
				return o;
			},
			handleType: function(){
				var self = this;
				this.inputs.each(
					function (i) {
						if ($(this).attr('type') === "image"){
							self.addEffect($(this), 'button');
						}
						else if ($(this).attr('type') === "submit") {
							self.addEffect($(this), 'subButton');
						}
						else if ($(this).attr('type') === "reset") {
							self.addEffect($(this), 'resButton');
						}
					}
				);
			},
			addEffect: function (elm, className) {
				elm.hover(
					function(){elm.addClass(className + 'Hover').removeClass(className + 'Focus');},
					function(){elm.removeClass(className + 'Hover').removeClass(className + 'Focus');}
				).focus(
					function() {elm.removeClass(className + 'Hover').addClass(className + 'Focus');}
				);
			}
		}
	);
// <<


// >> Simple Flyout Handler
	//triggerEl = element that activates the flyout by hover
	//flyoutEl = element which flies out
	//used by: standalone, QuickLoginLogoutHandler

	SimpleFlyout = $.extend(
		$.clone(LLObject),
		{
			create: function (triggerEl, flyoutEl) {
				var o = LLObject.create.call(this);
				o.handleFlyout(triggerEl, flyoutEl);
				return o;
			},
			handleFlyout: function (triggerEl, flyoutEl) {
				triggerEl.each(
					function (i) {
						var flyout = $(this).find(flyoutEl);
						$(this).hover(
							function () {
								flyout.show();
							},
							function () {
								flyout.hide();
							}
						);
					}
				);
			}
		}
	);
//<<


// >>  Flyoutnavi (for first level nav to work with IE)
	FlyoutNavi = $.extend(
		$.clone(LLObject),
		{
			create: function () {
				var o = LLObject.create.call(this);
				o.handleHover();
				return o;
			},
			handleHover: function () {
				var self = this;
				$('div.flOuterShell_slide div.flNavEl_1_normal')
				.add('div.flOuterShell_slide div.flNavEl_1_inPath')
				.add('div.flOuterShell_slide div.flNavEl_1_here').each(
					function (i) {
						var shell = $(this).find('div.flNavNS_2');
						$(this).hover(
							function () {
								shell.show();
							},
							function () {
								shell.hide();
							}
						);
					}
				)

				$('div.flOuterShell_slide div.flNavEl_2_normal')
				.add('div.flOuterShell_slide div.flNavEl_2_inPath')
				.add('div.flOuterShell_slide div.flNavEl_2_here').each(
					function (i) {
						var shell = $(this).find('div.flNavNS_3');
						$(this).hover(
							function () {
								shell.show();
							},
							function () {
								shell.hide();
							}
						);
					}
				);
			}
		}
	);
// <<


// >>  Selectbox to FlyoutList
	//el = element which contains the selectbox and is used for flyout handler

	SelectboxSpecLayout = $.extend(
		$.clone(LLObject),
		{
			create: function (el, title) {
				var o = LLObject.create.call(this);
				o.selectBoxOuter = $(el);
				o.itemsMax = 11;
				o.itemsAll = null;
				o.currScrollItem = 0;
				o.title = title || null;
				o.editSelectboxLayout();
				return o;
			},
			editSelectboxLayout: function () {
				if (this.selectBoxOuter.find('select').length > 0) {
					this.setLayout();
					this.getSelectboxItemsAndTitle();
					this.setPager();
					this.selectBoxOuter.hover(
						function() {$(this).find('div.selectBoxList').addClass('selectBoxList_hover');},
						function() {$(this).find('div.selectBoxList').removeClass('selectBoxList_hover');}
					);
				}
			},
			layoutOuter: function () {
				var sty = '';
				if (this.title) {
					sty = " selectBoxHeaderWithText"
				}

				var layOuter = $(
					'<div class="selectBoxHeader' + sty + '">' +
						'<div class="sbhDes1"></div>' +
					'</div>' +
					'<div class="selectBoxList">' +
						'<div class="sblDes1">' +
							'<div class="scroller scrollerTop"><img alt="up" src="/xist4c/px/spc.gif" width="1" height="1" /></div>' +
							'<div class="inner"></div>' +
							'<div class="scroller scrollerBottom"><img alt="down" src="/xist4c/px/spc.gif" width="1" height="1" /></div>' +
						'</div>' +
					'</div>'
				);
				return layOuter;
			},
			layoutItem: function (mode, prompt, url) {
				var inner, layItem;

				if (mode === "here") {
					inner = '<div class="noLink"><span>' + prompt + '</span></div>';
				} else {
					inner = '<a href="' + url + '" target="_self"><span>' + prompt + '</span></a>';
				}

				layItem = $('<div class="item">' + inner + '</div>');
				return layItem;
			},
			getSelectboxItemsAndTitle: function () {
				var url, prompt, mode, options, self=this, title;
				title = this.title;
				options = this.selectBoxOuter.find('select option');

				this.itemsAll = options.length;

				options.each(function (i) {
					url = $(this).val();
					prompt = $(this).text();
					if ($(this).attr('selected') === true) {
						mode = "here"
						title = $(this).text();
					} else {
						mode = "standard"
					}
					self.selectBoxOuter.find('div.selectBoxList div.inner').append(self.layoutItem(mode, prompt, url));
				});
				if (title) {
					this.selectBoxOuter.find('div.selectBoxHeader div.sbhDes1').text(title);
				}
			},
			setLayout: function () {
				this.selectBoxOuter.wrap('<div class="selectBoxOuterShell"></div>');
				this.selectBoxOuter.append(this.layoutOuter());
			},
			setPager: function () {
				if (this.itemsAll > this.itemsMax) {
					var itemHeight, scrollContHeight, self=this;
					this.selectBoxOuter.find('div.scroller img').addClass('scrollArrow');
					itemHeight = this.selectBoxOuter.find('div.selectBoxList div.item').outerHeight();
					scrollContHeight = itemHeight * this.itemsMax;
					this.selectBoxOuter.find('div.selectBoxList div.inner').eq(0).css({'height': scrollContHeight + 'px', 'overflow': 'hidden'});
					this.selectBoxOuter.find('div.scroller').bind('click', function (e) {self.scrollItems(this);}).css({'cursor': 'pointer'});
				}
			},
			scrollItems: function (el) {
				var direction, itemList;
				direction = String($(el).attr('class').split(/\s+/)[1]); // scrollerTop/scrollerBottom
				itemList = this.selectBoxOuter.find('div.selectBoxList div.item');

				if (direction === "scrollerTop") {
					if (this.currScrollItem - this.itemsMax >= 0) {
						this.currScrollItem = this.currScrollItem - this.itemsMax;
					} else {
						this.currScrollItem = 0;
					}
					this.selectBoxOuter.find('div.selectBoxList div.inner').eq(0).scrollTo(itemList[this.currScrollItem], 600, {'axis': 'vertical', 'offset': {'left': -35, 'top': 0}})
				} else {
					if (this.currScrollItem + this.itemsMax < itemList.length) {
						this.currScrollItem = this.currScrollItem + this.itemsMax;
					} else {
						this.currScrollItem = itemList.length-1;
					}
					this.selectBoxOuter.find('div.selectBoxList div.inner').eq(0).scrollTo(itemList[this.currScrollItem], 600, {'axis': 'vertical', 'offset': {'left': -35, 'top': 0}})
				}
			}
		}
	);
// <<


//>> Quicksearch Flyout
	//overwrites the standard handleFieldPrompt to work with specials input backgrounds
	function handleFieldPrompt(fieldList){
		$(function(){
			for (var i = 0; i < fieldList.length; ++i){
				function x(f){
					var elm = $('#' + f);
					if (f !== 'c_qSearch') {
						if (elm.length === 0) {
							elm = $(f);
						}
						elm.focus(
							function(e){hidePrompt($(this), e)}
						).blur(
							function(e){
								if ($(this).val() == ''){
									showPrompt($(this), e)
								}
							}
						)
						if (elm.val() != '') hidePrompt(elm);
					}
				}
				x(fieldList[i]);
			}
		});
	}

	//add special class for focused input fields to work with IE
	function handleInputFocus(el) {
		var searchPhrase = $('input:text, input:password');
		var searchPhraseTextarea = $('textarea');
		if (el) {
			searchPhrase = el.find('input:text, input:password');
			searchPhraseTextarea = el.find('textarea');
		}

		searchPhrase.wrap('<div class="specialInputField"><div class="sif_des1"><div class="sif_des2"></div></div></div>'
		).focus(
			function(e){$(this).parents('div.specialInputField').addClass('specialInputField_focus');}
		).blur(
			function(e){$(this).parents('div.specialInputField').removeClass('specialInputField_focus');}
			).parents('div.specialInputField').parent().find('img').css({'display': 'block'});

		searchPhraseTextarea.wrap('<div class="specialTextareaField"><div class="sif_des1"><div class="sif_des2"></div></div></div>'
		).focus(
			function(e){$(this).parents('div.specialTextareaField').addClass('specialTextareaField_focus');}
		).blur(
			function(e){$(this).parents('div.specialTextareaField').removeClass('specialTextareaField_focus');}
		).parents('div.specialInputField').parent().find('img').css({'display': 'block'});
	}

	//move quicksearch element to flNav flyout
	//When there's already a subnav (e.g. english sites), replace it by the special flyout elements.
	QuicksearchFlyoutHandler = $.extend(
		$.clone(LLObject),
		{
			create: function (url, extAppID) {
				var o = LLObject.create.call(this);
				if ($('div.flOuterShell_slide div.co_specSearch').length){
					o.navItem = $('div.flOuterShell_slide div.co_specSearch div.outer').eq(0);
				}else{
					o.navItem = $('div.flOuterShell_slide div.co_search div.outer').eq(0);
				}
				o.searchUrl = url || null;
				o.extAppID = extAppID || null;
				o.quickSearchCont = null;
				o.createSpecialSearchShell();
				return o;
			},
			createSpecialSearchShell: function () {
				this.quickSearchCont = $('<div class="qSearchCont staticQuickSearch">' +
					'<form action="/' + this.searchUrl + '.htm' + Utils.getUrlSession(';jsessionid=') +'" target="_top" method="post">' +
						'<input type="hidden" value="true" name="com.livinglogic.cms.apps.search.model.SearchState.search_submit"/>' +
						'<input type="hidden" value="510-' + this.extAppID + '" name="app"/>' +
						'<table width="100%" cellspacing="0" summary="Search element" class="qSearch" cellpadding="0" border="0">' +
							'<tr>' +
								'<td width="100%" align="left">' +
									'<input name="searchDescription" value="" class="text" type="text" id="c_qSearch" size="14" />' +
									'<script type="text/javascript" language="javascript">handleFieldPrompt(["c_qSearch"]);</script>' +
								'</td>' +
								'<td class="qsSpacer" width="3"><img width="3" alt="" height="1" src="/xist4c/px/spc.gif" /></td>' +
								'<td align="left" abbr="A search field for the quick search">' +
									'<input class="button" type="image" src="/xist4c/px/spc.gif" />' +
								'</td>' +
							'</tr>' +
						'</table>' +
					'</form>' +
				'</div>');
				this.makeFlyout();
			},
			makeFlyout: function () {
				if (this.quickSearchCont.find('input').length > 0){
					this.setNewLayout();
				} else if (this.navItem.find('div.flNavCHS_2').length > 0) {
					this.navItem.find('div.flNavCHS_2').remove();
					this.navItem.append('<div class="floatTerm"></div>');
				} else {
					this.navItem.append('<div class="floatTerm"></div>');
				}
			},
			flyoutLayout: function () {
				var layout = '<div class="flNavCHS_2">'+
					'<div class="flNavNS_2">'+
						'<div class="nav">'+
							'<div class="navItem">' +
								'<div id="qSearchFlyoutNavItem"></div>'+
							'</div>' +
						'</div>'+
					'</div>'+
					'<div class="floatTerm"></div>' +
				'</div>';
				return layout;
			},
			setNewLayout: function () {
				if (this.navItem.find('div.flNavCHS_2').length == 0) {
					this.navItem.append(this.flyoutLayout);
				} else {
					this.navItem.find('div.flNavCHS_2').eq(0).replaceWith(this.flyoutLayout);
				}
				$('#qSearchFlyoutNavItem').append(this.quickSearchCont);
			}
		}
	);
//<<


//>> Print link for footer nav
	//Adds the standard print link to the footer navigation
	//When there's no print link on the page (e.g. contact page) no link will be constructed for the footer nav, too
	FooterPrintLinkHandler = $.extend(
		$.clone(LLObject),
		{
			create: function () {
				var o = LLObject.create.call(this);
				o.topAddControlShell = $('td.contentMainColumn div.topAddContrContainer');
				o.footerNaviPrintItem = $('#footerPrint');
				o.handlePrintInfo();
				return o;
			},
			handlePrintInfo: function () {
				if (this.topAddControlShell.find('td.printButton a').length > 0) {
					var printLink, printURL, height, frm = null;
					printLink = this.topAddControlShell.find('td.printButton a');
					printLink.removeAttr('onclick');
					printURL = printLink.attr('href');
					height = $(window).height()-120;
					printLink.bind('click', function(e){
						e.preventDefault();
						e.stopPropagation();
						if (RcpOvHnl.recipeObjs.length){
							Utils.busyWait(
								function(intervalObj){
									var i;
									for (i = 0; i < window.frames.length; i+=1){
										frm = window.frames[i];
										if (frm.location.href.search(/print/) > -1 && (frm.$ && frm.$.find('.moreText').length)){
											return true;
										}
									}
									return false;
								},
								200,
								100,
								function(intervalObj){
									var moreElms = frm.$.find('.moreText'), recipeItems = RcpOvHnl.recipeObjs, item, cnt = 0;
									for (i = 0; i < recipeItems.length; i+=1){
										item = recipeItems[i];
										if (item.hasMore && item.showData){
											frm.$(moreElms[cnt]).trigger('click');
											cnt++;
										}else if (item.hasMore){
											cnt++;
										}
									}
								}
							);
						}
					});
					LL_XPopup.registerPopup(
						printLink,
						'click',
						'WEBPAGE',
						'p_c',
						'c',
						0,
						0,
						{
							'fixedPosition': 'true',
							'height': height,
							'width': '857',
							'background':{
								'r': 0,
								'g': 0,
								'b': 0,
								'opacity': 0.5
							},
							'url': printURL
						}
					);
					this.footerNaviPrintItem.append(printLink);
				} else {
					this.footerNaviPrintItem.remove();
				}
			}
		}
	);

	//Adaptes the print view control links to work with xpopup
	PrintViewHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (textTeaser, textImages, textPrint) {
				var o = LLObject.create.call(this);
				o.printAddControlShell = $('div.printButtonShell');
				o.adaptPrintView();
				return o;
			},
			adaptPrintView: function () {
				var textPrompts;
				this.printAddControlShell.remove();
				$('td.msCont').prepend(this.printAddControlShell);
				this.printAddControlShell.find('td:last').remove();
				this.printAddControlShell.find('a').attr('target', '_self');
				textPrompts = this.printAddControlShell.find('td span');

				textPrompts.eq(0).text($.lang("printTeaser"));
				textPrompts.eq(1).text($.lang("printImages"));
				textPrompts.eq(2).text($.lang("printPrint"));

				this.reorderImgText();
				this.addIconPrompts();
				this.printAddControlShell.css('display', 'block');
			},
			reorderImgText: function () {
				var links = this.printAddControlShell.find('table td a');
				links.each(
					function (i) {
						var text = $(this).find('span');
						text.remove();
						$(this).prepend(text);
					}
				);
			},
			addIconPrompts: function () {
				var printIcons, prePrompt, postPrompt;
				printIcons = this.printAddControlShell.find('td.printViewTeaser a img, td.printViewImages a img');
				prePrompt = '<span class="iconPmt iconPmtOn">' + $.lang("printItemOn") + '</span>';
				postPrompt = '<span class="iconPmt iconPmtOff">' + $.lang("printItemOff") + '</span>';
				printIcons.each(
					function (i) {
						$(this).before(prePrompt);
						$(this).after(postPrompt);
					}
				);
			}
		}
	);
//<<


//>> AJAX Login Handler (get login page elements by ajax and add it to the actually page)
	//el = outer element for appending login content
	//options = optional setting for request
	//callback = for request storage
	//test = "test" for static test mode
	//used for: RecipesOverviewHandler, QuickLoginLogoutHandler
	AjaxLoginHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (el, options, callback, test) {
				var o = LLObject.create.call(this);
				o.ajaxOuterShellClass = 'div.twoCol_login' //outer shell of the requested elements
				o.testMode = test || null; //activates test mode for static sites (special static login url and handling)
				o.ajaxLoginCont = null; //storage for the ajax request result shell
				o.initComplete = callback || null; //for storage the requested shell in the specific handler
				o.defaults = {
					requestURL: "/login.htm",
					target: null
					//requestProps: {'linkItem': 'ClickedRecipeLinkItem', 'ajaxCont': 'AlreadyGotLoginContent'}
				};
				if (options) $.extend(o.defaults, options);
				for (var k in o.defaults) o[k] = o.defaults[k];
				o.handleLoginRequest(el);
				return o;
			},
			handleLoginRequest: function (outerShell) {
				var requestURL, self=this, linkItemPrompt=null;
				requestURL = this.defaults.requestURL;
				if (this.testMode) {
					requestURL = "ireks_de_login.html";
				}

				if (this.defaults.requestProps.linkItem) {
					linkItemPrompt = this.defaults.requestProps.linkItem.find('span').text();
				}

				if (this.defaults.requestProps.ajaxCont) {
					this.ajaxLoginCont = this.defaults.requestProps.ajaxLoginCont;
					self.placeLoginContent(outerShell, this.defaults.requestProps.ajaxCont, linkItemPrompt);
				} else {
					$.ajax({
						url: requestURL,
						dataType: "html",
						success: function (data, msg) {
							self.placeLoginContent(outerShell, $(data).find(self.ajaxOuterShellClass).eq(0), linkItemPrompt);
							if (typeof self.initComplete === "function") {
								self.initComplete.call(self);
							}
						},
						error: function (req, status, error) {}
					});
				}
			},
			placeLoginContent: function (el, loginCont, linkItemPrompt) {
				//places the login shell content
				//For Recipes: adapted headline in that content: set item prompt at the start of the headline
				var loginInfoTitle, target = this.defaults.target;
				$(this.ajaxOuterShellClass).remove();
				if (target){
					target.empty().append(loginCont.clone());
				}else{
					el.append(loginCont.clone());
				}

				if (!this.ajaxLoginCont) {
					this.ajaxLoginCont = loginCont;
				}
				handleInputFocus($(this.ajaxOuterShellClass));
				InputButtonHoverEffect.create($(this.ajaxOuterShellClass).find('input'));

				if (linkItemPrompt) {
					loginInfoTitle = $(this.ajaxOuterShellClass).find('td.l h3').eq(0);
					loginInfoTitle.text(linkItemPrompt + ' / ' + loginInfoTitle.text());
				}
			}
		}
	);
//<<


//>> Recipes ov handler (handles mass date recipe items)
	RecipesOverviewHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (test) {
				var o = LLObject.create.call(this);
				o.recipeItems = $('td.massDataItem div.recipeItem');
				o.recipeObjs = [];
				o.ajaxLoginContent = null; //storage for the ajax request result shell
				o.testMode = test || null; //activates test mode for static sites (special static login url and handling)
				o.adaptItems();
				return o;
			},
			adaptItems: function () {
				var self = this;
				//set highlight
				this.recipeItems.hover(
					function () {$(this).addClass("recipeItem_highlight");},
					function () {$(this).removeClass("recipeItem_highlight");}
				);
				this.recipeItems.each(function(i){
					//clip text
					var img = null;
					if ($(this).find('td.image').length > 0) {
						img = $(this).find('td.image').eq(0);
					}
					// Record recipe overview data items and prepare item.
					self.recipeObjs.push(RecipeOverviewItem.create($(this), self, i));
					self.recipeObjs[i].prepareItemDomel();
					self.handleTextWidth($(this).find('div.desc1').eq(0), img, self.recipeObjs[i]);
					//handle link list items (when user isn't logged in)
					if (!(XIST4C_GLOBALS && XIST4C_GLOBALS.login && XIST4C_GLOBALS.login.userID) || self.testMode) {
						self.handleLinkListItems($(this), self.recipeObjs[i]);
					}
				});
			},
			handleTextWidth: function (el,img, RecipeItemObj) {
				//clips long descriptions (and additional infos).
				//Cropped text is set to "display: none" to allow the user to fade the offcut in.
				var moreText, fewerText, maxTextLength, maxTextLengthWithImage, elmText, textLength, shortText,
				addOnText, decorator, addInfo;
				moreText = $.lang("moreText");
				fewerText = $.lang("fewerText");
				maxTextLength = 304 - 7 - moreText.length; //"-7" = "... >> ";
				maxTextLengthWithImage = 220 - 7 - moreText.length; //"-7" = "... >> ";
				elmText = el.text();
				textLength = elmText.length;
				decorator='<span class="decorator">' +
					'<span class="pre">... </span>' +
					'<span class="more moreText">&gt;&gt;&nbsp;' + moreText + '</span>' +
					'<span class="addOn" style="display: none;"></span>' +
					'<span class="decorator fewerDecorator" style="display: none;">' +
						'<span class="more fewerText">&nbsp;&lt;&lt;&nbsp;' + fewerText + '</span>' +
					'</span>' +
				'</span>';
				addInfo = el.siblings('div.desc3');

				if (img !== null) {
					maxTextLength = maxTextLengthWithImage;
				}

				if ((elmText.length > maxTextLength) || (addInfo.text().length > 0)) {
					shortText = elmText.substring(0, maxTextLength);
					addOnText = elmText.substring(maxTextLength, textLength);
					RecipeItemObj.hasMore = true;
					el.text(shortText);
					el.append(decorator);
					el.find('span.addOn').eq(0).html(addOnText);
					el.find('span.moreText, span.fewerText').click(function(e){
						el.find('span.pre, span.moreText, .addOn, .fewerDecorator').add(addInfo).toggle(0, function(){
							if ($(this).hasClass('fewerDecorator')){
								if ($(this).css('display') !== 'none'){
									RecipeItemObj.showData = 1;
									$(this).css({
										display: 'inline'
									});
								}else{
									RecipeItemObj.showData = 0;
								}
							}else if ($(this).css('display') !== 'none'){
								$(this).css({
									display: 'inline'
								});
							}
						});
					});
				}
			},
			handleLinkListItems: function (el, RecipeItemObj) {
				//adaptes link list items: set/remove style class and start request
				var self = this, items;
				items = el.find('div.recipeLinkShell td.item');
				el.find('div.recipeLinkShell td.item').each(function(i){
					if ($(this).find('a').length == 0) {
						$(this).click(function(e){
							e.preventDefault();
							if (RecipeItemObj.showLogin){
								RecipeItemObj.handleSlider(0);
								items.removeClass('item_here');
							}else{
								items.removeClass('item_here');
								$(this).addClass('item_here');
								if (self.ajaxLoginContent) {
									AjaxLoginHandler.init(
										el.parents('div.des1').eq(0),
										{
											requestProps:{
												linkItem: $(this),
												ajaxCont: self.ajaxLoginContent
											},
											target: RecipeItemObj.sliderDomel
										},
										null,
										self.testMode
									);
									RecipeItemObj.handleSlider(1);
									RecipeItemObj.correctLoginLeftColumn();
								} else {
									AjaxLoginHandler.init(
										el.parents('div.des1').eq(0),
										{
											requestProps:{
												linkItem: $(this),
												ajaxCont: null
											},
											target: RecipeItemObj.sliderDomel
										},
										function(){
											self.ajaxLoginContent = this.ajaxLoginCont;
											RecipeItemObj.handleSlider(1);
											RecipeItemObj.correctLoginLeftColumn();
										},
										self.testMode
									);
								}
							}
						});
					}
				});
			}
		}
	);
//<<


// >> Recipes overview items
	RecipeOverviewItem = $.extend(
		$.clone(LLObject),
		{
			create: function(domel, parent, id){
				var o = LLObject.create.call(this);
				o.domel = domel || null;
				o.sliderDomel = null;
				o.showLogin = 0;
				o.showData = 0;
				o.hasMore = false;
				o.id = 'recipeItemSliderContainer_' + (id || '0');
				o.parent = parent || null;
				return o;
			},
			prepareItemDomel: function(){
				var lay = $('<div id="' + this.id + '" class="recipeItemSliderContainer"></div>').hide();
				this.sliderDomel = lay;
				this.domel.parents('.des1').append(lay);
			},
			handleSlider: function(opt){
				if (opt){
					this.showLogin = 1;
				}else{
					this.showLogin = 0;
				}
				this.sliderDomel.slideToggle();
			},
			correctLoginLeftColumn: function(){
				this.domel.parents('.des2').next().find('.l').css({
					paddingLeft: 20
				});
			}
		}
	);
// <<


//>> Recipes detail handling
	LLcmsRecipeCalculator = $.extend(
		$.clone(LLObject),
		{
			create: function(opts){
				var o = LLObject.create.call(this);
				o.targetClass = '.recipeDetailOuterShell';
				o.ov_suffs_idx = 0;
				o.ov_suffs = ['l', 'g', 'kg'];
				o.langMap = {
					"da": "dk",
					"ptbr": "br",
					"cs": "cz"
				};
				return o;
			},
			round: function(f){
				var newF;
				newF = Math.round(f * 1000) / 1000;
				return newF.toFixed(3) + '';
			},
			stringToFloat: function(str){
				/* >> todo
					complete the code...
				<< */
				var lang = $.lang();
				return parseFloat(str.replace(/,/, '.'), 10);
			},
			floatToString: function(num){
				return num.replace(/\./, ',');
			},
			setOverallSuffixIndexByString: function(str){
				var idx = $.inArray(str.toLowerCase(), this.ov_suffs);
				if (idx > this.ov_suffs_idx){
					this.ov_suffs_idx = idx;
				}
				return idx;
			},
			prepareNumberByUnitIndex: function(num, unit){
				var unitFacts = [1000, 1, 1000], unitIdx = this.setOverallSuffixIndexByString(unit);
				return num * unitFacts[unitIdx];
			},
			calculateIngrediansTable: function(factor){
				var ingrediansTable = $('.ingredients'), superOv_amR = 0 , ov_amR = 0, ov_amB = 0,
				self = this, prevRowUnit, currRowUnit;
				ingrediansTable.find('tr').each(function(i){
					var colVal, colValFac, screenColVal, unit, tr = $(this);
					if (!tr.hasClass('asHeadline')){
						tr.find('td').each(function(i){
							var col = $(this), colData = tr.find('.amR').data('amRData'), format = '#,##0',
							lang = self.langMap[$.lang()] || $.lang();
							if (col.hasClass('amR') &&  colData && colData.amount){
								colVal = colData.amount;
								ov_amR += colVal;
								screenColVal = colVal;
								if (colData.unitIdx != 1){
									format = '#,##0.000';
									screenColVal = screenColVal / 1000;
								}
								col.text($.formatNumber(screenColVal, {format: format, locale: lang}));
							}
							if (!isNaN(colVal)){
								if (col.hasClass('amB') && factor){
									col.addClass('amB-withValue');
									colValFac = colVal * factor;
									ov_amB += colValFac;
									if (colData.unitIdx != 1){
										format = '#,##0.000';
										colValFac = colValFac / 1000;
									}
									col.text($.formatNumber(colValFac, {format:format, locale:lang}));
								}else if (col.hasClass('amB')){
									col.html('&ndash;')
								}
							}
							if (col.hasClass('overall') || col.hasClass('busiOverall')){
								var colClass = '.resSuff', colOvVal = ov_amR;
								if (col.hasClass('busiOverall')){
									colClass = '.resBSuff';
									colOvVal = ov_amB;
								}
								if (self.ov_suffs_idx != 1){
									format = '#,##0.000';
									colOvVal = colOvVal / 1000;
								}
								col.text($.formatNumber(colOvVal, {format:format, locale:lang}));
								col.parent().find(colClass).text(self.ov_suffs[self.ov_suffs_idx]);
								superOv_amR += ov_amR;
								ov_amR = 0;
								if (col.hasClass('busiOverall')){
									ov_amB = 0;
								}
							}
						});
					}
				});
			},
			prepareComponents: function(){
				var tc = this.targetClass, calcForm = $('.recipeRecalcForm', tc),
				ingrediansTable = $('.ingredients'), self = this;
				ingrediansTable.find('tr').each(function(i){
					var tr = $(this);
					if (!tr.hasClass('asHeadline')){
						$(this).find('td.amR').each(function(i){
							var col = $(this), lang = self.langMap[$.lang()] || $.lang(),
							amount = $.parseNumber(col.text(), {format: '#,##0.00', locale: lang }),
							unit = col.next('.suff').text().toLowerCase(),
							unitIdx = $.inArray(unit, self.ov_suffs);
							col.data('amRData', {
								amount: self.prepareNumberByUnitIndex(amount, unit),
								unit: unit,
								unitIdx: unitIdx
							});
						});
					}
				});
				calcForm.bind('submit.recipeCalculator', function(e){
					var xVal = $('#xmenge').val(), lang = self.langMap[$.lang()] || $.lang(),
					kgVal = $.parseNumber($('#gesgew').val(), {format: '#,##0.00', locale: lang}),
					ovVal, factor;
					e.preventDefault();
					e.stopPropagation();
					xVal = !isNaN(parseInt(xVal, 10)) ? parseInt(xVal, 10) : null;
					kgVal = isNaN(kgVal) ? 0 : kgVal;
					if (xVal || kgVal){
						if (xVal){
							self.calculateIngrediansTable(xVal);
						}else{
							ovVal = $('.ingredients tr:last-child').find('.overall').text();
							ovVal = self.stringToFloat(ovVal) || 1;
							factor = kgVal / ovVal;
							self.calculateIngrediansTable(factor);
						}
					}
				});
			},
			make: function(){
				var p = window.parent, factor, weight;
				this.prepareComponents();
				this.calculateIngrediansTable(1);
				if (p.length){
					$('#xmenge').val(p.$('#xmenge').val());
					$('#gesgew').val(p.$('#gesgew').val());
					$('.recipeRecalcForm').trigger('submit.recipeCalculator');
					return;
				}
			}
		}
	);
	$(function(){
		LLcmsRecipeCalculator.create().make();
	})
//<<


//>> Quicklogin/Logout Handler
	//Adds a mouseover bubble with info text for login/logout
	//Login: Disabled login-button-link and activates a lightbox with the login element within (ajax Request)
	//textLogin: text of the login mouseover bubble
	//textLogout: text of the logout mouseover bubble
	//test: set "test" for the static sites
	QuickLoginLogoutHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (textLogin, textLogout, test) {
				var o = LLObject.create.call(this);
				o.outerShell = $('div.quickLogKontainer');
				o.textLogin = textLogin || 'Rezepte einloggen';
				o.textLogout = textLogout || 'Rezepte ausloggen';
				o.ajaxLoginContent = null; //storage for the ajax request result shell
				o.testMode = test || null; //activates test mode for static sites (special static login url and handling)
				o.getMode();
				return o;
			},
			getMode: function () {
				if (this.outerShell.find('form').length > 0) {
					this.handleLoginMode();
				} else {
					this.handleLogoutMode();
				}
			},
			handleLoginMode: function () {
				var loginURL, loginButton, self=this;
				this.setMouseOver(this.textLogin);
				loginURL = this.outerShell.find('form.quicklogin').eq(0).attr('action');
				loginButton = this.outerShell.find('td.qlButton input');
				self.setXpopup(loginButton);
				loginButton.bind('click', function (e) {
					e.preventDefault();
					if (self.ajaxLoginContent) {
						AjaxLoginHandler.init(
							$('#loginXpopupTarget'),
							{
								'requestURL': loginURL,
								'requestProps': {'ajaxCont': self.ajaxLoginContent}
							},
							null,
							self.testMode
						);
					} else {
						AjaxLoginHandler.init(
							$('#loginXpopupTarget'),
							{
								'requestURL': loginURL,
								'requestProps': {'ajaxCont': null}
							},
							function(){
								self.ajaxLoginContent = this.ajaxLoginCont;
							},
							self.testMode
						);
					}
				});
			},
			handleLogoutMode: function () {
				this.setMouseOver(this.textLogout);
			},
			setMouseOver: function (text) {
				var layout;
				layout = '<div class="flyout">' +
					'<div class="inner">' + text + '</div>' +
				'</div>';

				this.outerShell.prepend(layout);
				SimpleFlyout.create(this.outerShell, 'div.flyout');
			},
			setXpopup: function (el, cont) {
				LL_XPopup.registerPopup(el, 'click','HTMLSRC','p_c','c',0,0,{'fixedPosition':'true','height':'230','width':'717','background':{'r': 0, 'g': 0, 'b': 0, 'opacity': 0.5}, 'cont':'<div id="loginXpopupTarget"></div>'});
			}
		}
	);

	FooterLoginLogoutHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (logoutText, test) {
				var o = LLObject.create.call(this);
				o.ajaxLoginContent = null; //storage for the ajax request result shell
				o.testMode = test || null; //activates test mode for static sites (special static login url and handling)
				o.outerShell = $('div.quickLogKontainer');
				o.footerItem = $('#footerLogin');
				o.footerLogoutItem = $('#footerLogout');
				o.logoutText = logoutText || 'Logout'; //deprecated. Use lang('logout')!
				o.getMode();
				return o;
			},
			getMode: function () {
				if (this.outerShell.find('form').length > 0) {
					this.handleLoginMode();
				} else {
					this.handleLogoutMode();
				}
			},
			handleLoginMode: function () {
				var loginURL, loginLinkItem, self = this;
				loginURL = this.outerShell.find('form.quicklogin').eq(0).attr('action');
				loginLinkItem = this.footerItem.find('a');
				self.setXpopup(loginLinkItem);
				loginLinkItem.bind('click', function (e) {
					e.preventDefault();
					if (self.ajaxLoginContent) {
						AjaxLoginHandler.init(
							$('#loginXpopupTarget'),
							{
								'requestURL': loginURL,
								'requestProps': {'ajaxCont': self.ajaxLoginContent}
							},
							null,
							self.testMode
						);
					} else {
						AjaxLoginHandler.init(
							$('#loginXpopupTarget'),
							{
								'requestURL': loginURL,
								'requestProps': {'ajaxCont': null}
							},
							function () {
								self.ajaxLoginContent = this.ajaxLoginCont;
							},
							self.testMode
						);
					}
				});
			},
			handleLogoutMode: function () {
				if ((this.outerShell.find('table td a').length > 0) && ((this.footerItem.find('a').length > 0 || this.footerLogoutItem.length > 0))) {
					var logoutLink, footerEl;
					logoutLink = this.outerShell.find('table td a').attr('href');
					if (this.footerLogoutItem.length > 0) {
						footerEl = this.footerLogoutItem.append('<a href="#" target="_self"></a>');
					} else {
						footerEl = this.footerItem;
					}
					footerEl.find('a').attr('href', logoutLink).text($.lang('logout'));
				}
			},
			setXpopup: function (el, cont) {
				LL_XPopup.registerPopup(el, 'click','HTMLSRC','p_c','c',0,0,{'fixedPosition':'true','height':'230','width':'717','background':{'r': 0, 'g': 0, 'b': 0, 'opacity': 0.5}, 'cont':'<div id="loginXpopupTarget"></div>'});
			}
		}
	);
//<<


//>> Slideshow (Images and text fade in)
	//To handle the loop every last but two element is set to "hide"
	//Standard Text-Banner for head image is set to "hide"
	SlideshowHandler = $.extend(
		$.clone(LLObject),
		{
			init: function () {
				var o = LLObject.create.call(this);
				o.outerShell = $('div.slideshow ul');
				o.items = null;
				o.startSlider();
				return o;
			},
			startSlider: function () {
				$('div.headImgText').hide();
				this.items = this.outerShell.find('li');
				$(this.items[0]).show();
				this.run();
			},
			run: function(){
				var self = this, maxItems, currItem;
				maxItems = this.items.length -1;
				currItem = 0;
				index = 100;
				Utils.busyWait(
					function(){
						if (currItem == maxItems) {
							currItem = 0;
						} else {
							currItem++
						}
						index++;
						$(self.items[currItem]).fadeIn(2000).css("z-index", index);
						// Negative number combined with "mod" results negative number.
						// Workaround: Handle the special items yourself...
						if ((currItem - 2) >= 0 ) {
							$(self.items[currItem - 2]).hide();
						} else {
							$(self.items[self.items.length + currItem - 2]).hide();
						}
						return false;
					},
					4000,
					100,
					function(){
					}
				);
			}
		}
	);
//<<


//>> Photogallery Hover effect
	PhotogalleryHoverEffect = $.extend(
		$.clone(LLObject),
		{
			init: function () {
				var o = LLObject.create.call(this);
				o.setHover();
				return o;
			},
			setHover: function () {
				$('div.mds_detailItems div.des1').each(
					function (i) {
						if ($(this).find('img.dummySpacer').length == 0) {
							$(this).mouseover(function(){$(this).addClass('des1JsHover')});
							$(this).mouseout(function(){$(this).removeClass('des1JsHover')});
						}
					}
				);
			}
		}
	);
	$(function() {PhotogalleryHoverEffect.init();});
//<<


//>> Faked upload fields (creates styled upload inputs)
	// Pre-Condition: all upload fields needs a corresponding text input field (faked field name = upload field name + '_fake').
	// The script wraps the faked field in special shells which are adapted/designed by the css.
	// By css the faked field is placed under the upload field and the upload field's
	// opacity is set to zero. That effects by clicking in the visible field (faked field)
	// the user actually clicks in the hidden upload field and so the upload works as normal.
	// By setting the addFields variable, these addFields shows more upload fields after
	// filling one by one of the stored upload field. These fields have to placed in the
	// form's html code and set to 'display: none' to work with the database form's restore mode!
	// When there is a file for an upload selected a remove icon is faded in and
	// allows the user to remove the uploaded file of the form.

	FakedUploadFields = $.extend(
		$.clone(LLObject),
		{
			init: function (el, addFields) {
				var o = LLObject.create.call(this);
				o.inputs = $('input.fileInput:file');
				o.addFields = addFields || null;
				o.handleElms(el);
				return o;
			},
			handleElms: function (el) {
				var self = this;
				this.handleContentNavItems();//handles content navigation to work with forms
				this.disableBewerbungAls();//handles job overview requests
				if (el) {
					el.find('input.fileInput:file').each(function (i) {
						self.fakeUploads($(this));
					});
				} else {
					this.inputs.each(function (i) {
						self.fakeUploads($(this));
					});
				}
				this.handleAddFields();
			},
			handleContentNavItems: function () {
				var contentNavItems = $('div.contNavShell_jobApplication td.contNavItem');
				var form = $('td.contentColumn form');
				var pageInput = $('td.contentColumn input[name="seite"]');
				var hereIndex = -1;
				contentNavItems.each(function (i) {
					if ($(this).hasClass('cni_normal') && (hereIndex !== -1)) {
						$(this).find('a').bind('click', function (e) {
							e.preventDefault();
						});
						$(this).find('a').addClass('specialHandling');
					} else if ($(this).hasClass('cni_normal')) {
						$(this).find('a').bind('click', function (e) {
							e.preventDefault();
							pageInput.val(i+1);
							form.submit();
						});
					} else {
						hereIndex = i;
					}
				});
			},
			disableBewerbungAls: function () {
				var ovId = $('input[name=sta_id]');
				if (ovId.val()) {
					$('input[name=bewerbungals]').attr('readonly', 'readonly');
				}
			},
			fakeUploads: function (upload) {
				var inputName = upload.attr('name');
				var fakedInput = $('input[name=' + inputName + '_fake]');
				this.createLayout(upload, inputName);
				this.handleFakedInput(upload, fakedInput);
				//handleInputFocus(upload.parent('div.uploadDes1'));
				this.handleDeleteButton(upload, fakedInput);
				InputButtonHoverEffect.create(upload.parent('div.uploadDes1').find('td.button input'));
			},
			createLayout: function (upload, inputName) {
				var visible = 1;
				if (upload.css('display') === 'none') {
					visible = 0;
				}
				upload.wrap(this.setOuterLayout(inputName, visible));
				upload.parent('div.uploadDes1').append(this.setInnerLayout(inputName));
				upload.parent('div.uploadDes1').find('td.field').append($('input[name=' + inputName + '_fake]:text').parents('div.specialInputField')[0]);
			},
			setInnerLayout: function (inputName) {
				var layout = '<table width="100%" cellspacing="0" cellpadding="0" border="0" class="fakedFieldTable">' +
					'<tr>' +
						'<td class="field">' +
							'<img width="1" height="1" src="/xist4c/px/spc.gif" class="normal" alt="">' +
						'</td>' +
						'<td class="button">' +
							'<input type="image" src="/xist4c/px/spc.gif" value="Durchsuchen" alt="Durchsuchen" />' +
						'</td>' +
					'</tr>' +
				'</table>';
				return layout;
			},
			setOuterLayout: function (inputName, visible) {
				var sty = null;
				if (!visible) {
					sty = ' style="display: none;"';
				}
				var layout = '<div class="uploadOuter uploadOuter_' + inputName + ' viewport"' + sty + '><div class="uploadDes1"></div></div>';
				return layout;
			},
			handleFakedInput: function (upload, fakedInput) {
				var self = this;
				var bindings = 'mouseenter mouseleave';
				if (window.navigator.platform === "Win32" && $.browser.mozilla) {
					upload.attr('size', '57');
				}
				upload.bind(bindings, function (e) {
					fakedInput.trigger(e.type);
					upload.parent('div.uploadDes1').find('td.button input').trigger(e.type);
				});
				//fakedInput.val(upload.val());
				upload.bind('change', function (e) {
					fakedInput.val($(this).val());
					self.handleDeleteButton($(this), fakedInput);
					self.handleAddFields();
				});
			},
			handleDeleteButton: function (upload, fakedInput) {
				var img = upload.parent('div.uploadDes1').find('td.field img').eq(0);
				var self = this;
				if (fakedInput.val() !== '') {
					img.unbind('click.deleteButtonHandler');
					img.bind('click.deleteButtonHandler', function () {
						var newUpload = upload.clone().val('');
						upload.replaceWith(newUpload);
						self.handleFakedInput(newUpload, fakedInput);
						fakedInput.val('');
						$(this).removeClass('delete');
					});
					img.addClass('delete');
				}
			},
			handleAddFields: function () {
				if (this.addFields) {
					for (var i = 0; i < this.addFields.length; ++i) {
						for (var j = 0; j < this.addFields[i].length; ++j) {
							var upload = $('input.fileInput[name=' + this.addFields[i][j] + ']:file');
							var fakedInput = $('input[name=' + this.addFields[i][j] + '_fake]')
							if ((upload.length > 0 && upload.val() !== '') || (fakedInput.length > 0 && fakedInput.val() !== '')) {
								upload.show();
								upload.parents('div.uploadOuter').show();
								if (j+1 < this.addFields[i].length) {
									var nextEl = $('input.fileInput[name=' + this.addFields[i][j+1] + ']:file');
									nextEl.show();
									nextEl.parents('div.uploadOuter').show();
								}
							}
						}
					}
				}
			}
		}
	);
//<<


//>> Handle standard error shell for forms
	// Handle the combination of standard error list and errorblocks in the form content.
	// Compares the error messages and remove duplicates in the standard list.
	// When a target container is set the error list shell will be appended to that container.
	// If there are no standard error items left the whole element will be removed.
	// errorList = standard error list (on top of the content)
	// errorBlocks = error messages in the form content
	FormErrorShellHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (targetCont) {
				var o = LLObject.create.call(this);
				o.targetCont = targetCont || null;
				o.handleErrors();
				return o;
			},
			handleErrors: function () {
				var errorList = $('td.contentColumn').find('form').eq(0).prev('td.contentColumn ul').addClass('defaultErrorList');
				var errorBlocks = $('td.contentColumn form div.formError span');
				$('td.contentColumn form input:text').eq(0).focus();//to fix an IE bug (missplaced required arrows)
				if ((errorList.length > 0) && (errorBlocks.length > 0)) {
					errorList.hide();
					this.removeDuplicates(errorList, errorBlocks);
					if (errorList.children().length > 0) {
						if (this.targetCont && (this.targetCont.length > 0)) {
							this.targetCont.append(errorList);
						}
						errorList.show();
					} else {
						errorList.remove();
					}
				} else if (errorList.length > 0){
					errorList.hide();
					if (this.targetCont && (this.targetCont.length > 0)) {
						this.targetCont.append(errorList);
					}
					errorList.show();
				}
				$('td.contentColumn form input:text').eq(0).blur();//to fix an IE bug (missplaced required arrows)
			},
			removeDuplicates: function (errorList, errorBlocks) {
				var errors, errorBlocksMsgs, errorBlocksList;
				errorBlocksMsgs = [];
				errors = errorList.find('li');

				errorBlocks.each(function () {
					errorBlocksMsgs.push($(this).text());
				});

				errors.each(function () {
					var errorText = $(this).text();
					if ($.inArray(errorText, errorBlocksMsgs) > -1) {
						//$(this).addClass('forRemove');
						$(this).remove();
					}
				});
			}
		}
	);
//<<


//>> Partner search prev text handling
	// Cuts off all 'cutOffForSearchResults' paragraphs right before partner search element.
	PartnerSearchPrevTextHandler = $.extend(
		$.clone(LLObject),
		{
			init: function () {
				var o = LLObject.create.call(this);
				o.text = $('div.co_cutOffForSearchResults');
				o.partnerItems = $('div.partnerItem');
				o.removeText();
				return o;
			},
			removeText: function () {
				if (this.text.length > 0 && this.partnerItems.length > 0) {
					this.text.hide();
				}
			}
		}
	);
//<<


//>> GlowHandler (standard)
	GlowHandler = $.extend(
		$.clone(LLObject),
		{
			init: function (itemClass) {
				var o = LLObject.create.call(this);
				o.itemClass = itemClass || null;
				o.adaptItems();
				return o;
			},
			adaptItems: function () {
				var self = this, items;
				if (this.itemClass) {
					items = $('td.massDataItem div.' + this.itemClass)
					//set highlight
					items.hover(
						function () {$(this).addClass(self.itemClass + "_highlight");},
						function () {$(this).removeClass(self.itemClass + "_highlight");}
					);
				}
			}
		}
	);
//<<



