(function(){if(typeof(Bajoodoo)=="undefined"){Bajoodoo={};}
Bajoodoo.utils={init:function()
{Bajoodoo.utils.fontSize.init(false);Bajoodoo.utils.loadPanel.init();Bajoodoo.utils.toggle.init();Bajoodoo.utils.cookietest();Bajoodoo.utils.ie6events();},toggle:{COOKIE_NAME_SHOW:"show",COOKIE_NAME_HIDE:"hide",_showIds:[],_hideIds:[],init:function(){var showIds=$.cookie(this.COOKIE_NAME_SHOW);showIds=!showIds?[]:showIds.split(",");for(var i=0,x=showIds.length;i<x;++i){if(showIds[i].length>0){this._showIds.push(showIds[i]);}}
var hideIds=$.cookie(this.COOKIE_NAME_HIDE);hideIds=!hideIds?[]:hideIds.split(",");for(var i=0,x=hideIds.length;i<x;++i){if(hideIds[i].length>0&&!Bajoodoo.utils.phpjs.in_array(hideIds[i],this._showIds)){this._hideIds.push(hideIds[i]);}}},show:function(a,id,callback){if(callback!==null){callback(a,id);}
$('#'+id).animate({height:'show'});$(a).hide().prev().show();this._showIds.push(id);this._updateCookies(true);return false;},hide:function(a,id,callback){if(callback!==null){callback(a,id);}
$('#'+id).animate({height:'hide'});$(a).hide().next().show();this._hideIds.push(id);this._updateCookies(false);return false;},_updateCookies:function(preferShow){if(preferShow){this._updateCookieShow(true);this._updateCookieHide(false);}else{this._updateCookieHide(true);this._updateCookieShow(false);}},_updateCookieShow:function(noCheck){var showIds;if(noCheck){showIds=this._showIds;}else{showIds=[];for(var i=0,x=this._showIds.length;i<x;++i){if(!Bajoodoo.utils.phpjs.in_array(this._showIds[i],this._hideIds)){showIds.push(this._showIds[i]);}}
this._showIds=showIds;}
$.cookie(this.COOKIE_NAME_SHOW,showIds.join(","),this._cookieOptions);},_updateCookieHide:function(noCheck){var hideIds;if(noCheck){hideIds=this._hideIds;}else{hideIds=[];for(var i=0,x=this._hideIds.length;i<x;++i){if(!Bajoodoo.utils.phpjs.in_array(this._hideIds[i],this._showIds)){hideIds.push(this._hideIds[i]);}}
this._hideIds=hideIds;}
$.cookie(this.COOKIE_NAME_HIDE,hideIds.join(","),this._cookieOptions);}},trim:function(string)
{if(typeof string!='string'){return string;}
if(string.length<1){return string;}
var trimmedText=YAHOO.lang.trim(string);trimmedText=trimmedText.replace(/( |\f|\t|\v|\x00|\0){1,}/g,' ');trimmedText=trimmedText.replace(/( )? ( )?/g,' ');trimmedText=trimmedText.replace(/ \n( )?|( )?\n /g,"\n");trimmedText=trimmedText.replace(/ \r( )?|( )?\r /g,"\r");return trimmedText;},highlight:function(elem)
{YAHOO.util.Dom.addClass(elem,'highlightBorder');YAHOO.util.Dom.addClass(elem,'highlightBackground');elem.onfocus=function()
{YAHOO.util.Dom.removeClass(this,'highlightBackground');}
elem.onchange=function()
{YAHOO.util.Dom.removeClass(this,'highlightBorder');}},log:function()
{if(typeof window.console=='object'&&typeof window.console.log=='function'){window.console.log(arguments);}else{return false;}},counter:function(duration)
{$('#cnt').html(duration);if(typeof duration=='number'&&duration>0){setTimeout("Bajoodoo.utils.counter("+(duration-1)+")",1000);}},_getCookieExpires:function(){var date=new Date();date.setTime(date.getTime()+(365*24*60*60*1000));return date;},phpjs:{strip_tags:function strip_tags(str,allowed_tags){var key='',allowed=false;var matches=[];var allowed_array=[];var allowed_tag='';var i=0;var k='';var html='';var replacer=function(search,replace,str){return str.split(search).join(replace);};if(allowed_tags){allowed_array=allowed_tags.match(/([a-zA-Z0-9]+)/gi);}
str+='';matches=str.match(/(<\/?[\S][^>]*>)/gi);for(key in matches){if(isNaN(key)){continue;}
html=matches[key].toString();allowed=false;for(k in allowed_array){allowed_tag=allowed_array[k];i=-1;if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+'>');}
if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+' ');}
if(i!=0){i=html.toLowerCase().indexOf('</'+allowed_tag);}
if(i==0){allowed=true;break;}}
if(!allowed){str=replacer(html,"",str);}}
return str;},array_search:function(needle,haystack,argStrict){var strict=!!argStrict;var key='';for(key in haystack){if((strict&&haystack[key]===needle)||(!strict&&haystack[key]==needle)){return key;}}
return false;},array_slice:function(arr,offst,lgth,preserve_keys){var key='';if(!(arr instanceof Array)||(preserve_keys&&offst!==0)){var lgt=0,newAssoc={};for(key in arr){lgt+=1;newAssoc[key]=arr[key];}
arr=newAssoc;offst=(offst<0)?lgt+offst:offst;lgth=lgth===undefined?lgt:(lgth<0)?lgt+lgth-offst:lgth;var assoc={};var start=false,it=-1,arrlgth=0,no_pk_idx=0;for(key in arr){++it;if(arrlgth>=lgth){break;}
if(it==offst){start=true;}
if(!start){continue;}
++arrlgth;if(this.is_int(key)&&!preserve_keys){assoc[no_pk_idx++]=arr[key];}else{assoc[key]=arr[key];}}
return assoc;}
if(lgth===undefined){return arr.slice(offst);}else if(lgth>=0){return arr.slice(offst,offst+lgth);}else{return arr.slice(offst,lgth);}},in_array:function(needle,haystack,argStrict){var key='',strict=!!argStrict;if(strict){for(key in haystack){if(haystack[key]===needle){return true;}}}else{for(key in haystack){if(haystack[key]==needle){return true;}}}
return false;}},cookietest:function()
{$.cookie('cookietest',null);$.cookie('cookietest',1);if($.cookie('cookietest')===null){$('body').append('<div class="siteWarning"><div id="cookieWarning"><img style="text-align: left;" src="'+_IMG+'xshared/icons/exclamation.png" title="" alt="" class="icon"></div></div>');Bajoodoo.utils.translate('COMMON_COOKIES_DISABLED','#cookieWarning')
$('body').css('padding-top',30);}},fontSize:{_cookieName:"fontSize",_jSelector:"body",_jNav:"#nav",_increaseFactor:12/11,_decreaseFactor:11/12,_stepCount:0,init:function(invert){this._loadStepCount();if(this._stepCount>1){$('#font-increase').fadeTo('slow',0.3);}
else if(this._stepCount<1){$('#font-decrease').fadeTo('slow',0.3);};var factor=(this._stepCount==0)?1:((this._stepCount<0)?this._decreaseFactor:this._increaseFactor);for(var i=Math.abs(this._stepCount);i>0;--i){var curFontSize=$(this._jSelector).css("font-size");var newFontSize=this._getNewFontSize(curFontSize,factor);$(this._jSelector).css("font-size",newFontSize);}},increase:function(){if(this._stepCount>1){return;}
else if(this._stepCount==1){$('#font-increase').fadeTo('slow',0.3);}
$('#font-decrease').fadeTo('slow',1);var curFontSize=$(this._jSelector).css("font-size");var newFontSize=this._getNewFontSize(curFontSize,this._increaseFactor);$(this._jSelector).css("font-size",newFontSize);$.cookie(this._cookieName,++this._stepCount,{path:'/'});return false;},decrease:function(){if(this._stepCount<1){return;}
else if(this._stepCount==1){$('#font-decrease').fadeTo('slow',0.3);}
$('#font-increase').fadeTo('slow',1);var curFontSize=$(this._jSelector).css("font-size");var newFontSize=this._getNewFontSize(curFontSize,this._decreaseFactor);$(this._jSelector).css("font-size",newFontSize);$.cookie(this._cookieName,--this._stepCount,{path:'/'});return false;},reset:function(){$.cookie(this._cookieName,null,{path:'/'});$('#font-increase').fadeTo('slow',1);$('#font-decrease').fadeTo('slow',0.3);$(this._jSelector).css("font-size",null);this._stepCount=0;return false;},_getNewFontSize:function(fontSize,factor){var curFontSizeNum=parseFloat(fontSize,10);var curFontSizeUnit=fontSize.replace(/[0-9\.\-]+/g,"");var newFontSizeNum=Math.round(curFontSizeNum*factor,1);var newFontSize=""+newFontSizeNum+curFontSizeUnit;return newFontSize;},_loadStepCount:function(){this._stepCount=parseInt($.cookie(this._cookieName),10)*1;this._stepCount=isNaN(this._stepCount)?0:this._stepCount;this._stepCount=this._stepCount<-5?-5:(this._stepCount>5?5:this._stepCount);}},loadPanel:{_panelStack:[],_disabled:false,_flag:null,_jSelector:"#simplemodal-container",_isOpen:null,_html:null,_timeout:null,_options:{opacity:80,overlayCss:{backgroundColor:"#000"},containerCss:{},position:[null,null],escClose:true},init:function(){if(this._disabled){return false;}
window.onbeforeunload=function(){Bajoodoo.utils.loadPanel.show();};var html='<div id="loadPanel" style="padding:1em 2em;border:1px solid black;font-weight:bold;background-color:#FEFECC;text-align:center;display:none">'+'Bitte warten...<br />'+'<img alt="Bitte warten..." title="Bitte warten..." src="'+_IMG+'xshared/assets/loadBar.gif" width="220" height="19" />'+'<br />'+'<div style="text-align:center;" id="loadPanel-close"><a href="#" onclick="$.modal.close();return false">schließen</a></div>'+'</div>';$("body").append(html);},show:function(){if(this._disabled){return false;}
var loadPanelClose=$('#loadPanel-close');loadPanelClose.hide();var options=this._options;this._isOpen=true;$.modal($("#loadPanel"),this._options);this._timeout=setTimeout(function(){loadPanelClose.show();$.modal.impl.setContainerDimensions();},5000);},hide:function(){$.modal.close();this._isOpen=false;},disableLink:function(anchor){var restoreDisabled=this._disabled;this._disabled=true;setTimeout(function(){location.href=anchor.href;},1);setTimeout(function(){Bajoodoo.utils.loadPanel._disabled=restoreDisabled;},250);return false;}},panelShader:{show:function()
{var div='<div style="position: absolute; background-color: white; width: 100%; height: 100%; opacity: .6; filter: alpha(opacity=80);right: 0; bottom: 0; left: 0; top: 0; z-index:998" onclick="return false;"></div>';$('.simplemodal-wrap').append(div);}},translate:function(label)
{var location=arguments[1];$.post(_WWW+'index/translate',{label:label},function(response,success,type){if(location==null){return response;}else{$(location).append(response);}});},ie6events:function()
{if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<7){$('.hlist ul.navigation li').each(function(){if(this.parentNode.className=='navigation'){this.onmouseover=function(){this.className+=' over';}
this.onmouseout=function(){this.className=this.className.replace(' over','');}}});if(_WWW.toLowerCase().indexOf('https://')==0){$('.page_margins').before('<div class="disablePage"><div id="simplemodal-overlay" class="simplemodal-overlay siteOverlay">&nbsp;</div></div>');}
$('.page_margins').before('<div class="siteWarning"><div id="ie6Warning"><img style="text-align: left;" src="'+_IMG+'xshared/icons/exclamation.png" title="" alt="" class="icon"></div></div>');Bajoodoo.utils.translate('COMMON_DONT_USE_IE6','#ie6Warning');$('body').css('padding',0);if(_WWW.toLowerCase().indexOf('https://')==0){$('.siteWarning').css('position','absolute');}}}};$(document).ready(Bajoodoo.utils.init);}());
