if((parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")+8)) < 4)){
	Element.addMethods(['TEXTAREA'],{maxLength:function(element,max){var limit=max;element=$(element);function counter(){if(element.value.length>limit){element.value=element.value.substring(0,limit);element.scrollTop=element.scrollHeight;}};element.observe('change',function(){counter();});element.observe('keyup',function(){counter();});element.observe('keypress',function(){counter();});element.observe('blur',function(){counter();});counter();return element;}});
}
function initMandantEvents(){ppInit.topnavi().startStyle();ppInit.roundedCorners().startStyle();ppInit.subnavi();ppInit.moreLink();if($('userNoteText')!=null)$('userNoteText').maxLength(2000);}
ppInit={topnavi:function(){if($('topnavi')){this.config=function(){this.totalAvailWidth=$('topnavi').getStyle('width');return this;}
this.getEntryCount=function(){var entryCount=$$('#topnavi li').length;return entryCount;}
this.getEntriesWidth=function(){widthComplete=-1;var list2=new Array();totalAvailWidth=ppInit.topnavi().config().totalAvailWidth;allListElements=$$('#topnavi li');allListElements.each(function(ele){widthComplete+=parseInt(ele.getStyle('width'))+greyTabMargin;if(parseInt(ele.identify())>='10'){list2[list2.length]=ele;}})
this.widthComplete=widthComplete;this.list2=list2;return this;}
this.startStyle=function(){if(!$("extraRow")){$$("#topnavi ul")[0].insert({before:new Element('ul',{'id':'extraRow'})});}

if($$('#topnavi ul li')[0]){if(ppInit.topnavi().getEntriesWidth().widthComplete>parseInt(ppInit.topnavi().config().totalAvailWidth)){extraListLength=ppInit.topnavi().getEntriesWidth().list2.length;allListElements=$$('#topnavi li');standardRow=$A(allListElements).length-extraListLength;allListElements.each(function(ele,index){if(index>=standardRow){try{$('extraRow').insert({bottom:ele});}
catch(e){alert(e);};}})}}}

return this;}},roundedCorners:function(){bodyIdWrap="";if($('bsNeuesProdukt')){$('content').addClassName('corners');}
if($('detailseite')&&$('pageContent')){$('pageContent').addClassName('corners');}
if($('detailseite')&&$('recommendation')){$('recommendation').addClassName('corners');}
if($('warenkorb')){if($('intro'))$('intro').addClassName('corners');}
if($('bsPruefen')){if($('intro'))$('intro').addClassName('corners');}
if(ele=$$('.corners')){this.config=function(){return this;}
this.startStyle=function(){ele.each(function(elem){if($('bsNeuesProdukt')&&elem==$('content')){bodyIdWrap="bsNeuesProduktRounded";}
if($('bsNeuesProdukt')&&elem==$('recommendation')){bodyIdWrap="recommendationRounded";}
if(elem==$('pageContent')){bodyIdWrap="pageContentRounded";}
if($('detailseite')&&elem==$('recommendation')){bodyIdWrap="recommendationRounded";}
if(($('warenkorb')||$('bsPruefen'))&&elem==$('intro')){bodyIdWrap="introRounded";}
if(($('kontakt'))&&elem==$('kunde')){bodyIdWrap="introRounded";}
elem.wrap('div',{'class':bodyIdWrap+' roundedCorners'})
elem.wrap('div',{'class':'topLeft'})
elem.up('.topLeft').insert({top:'<div class="topRight"></div>'});elem.wrap('div',{'class':'bottomLeft'})
elem.up('.bottomLeft').insert({top:'<div class="bottomRight"></div>'});elem.wrap('div',{'class':'borderLeft'});elem.wrap('div',{'class':'borderRight'});elem.up('.borderRight').insert({bottom:'<div class="clearMe"></div>'});elem.removeClassName('corners');})}
return this;}},moreLink:function(){if(ele=$$('.moreLink')[0]){Event.observe(ele,'click',function(){if($$('.artikeltext'))$$('.artikeltext span')[0].setStyle('height: auto;');ele.addClassName('inv');})
XPLAIN.core.disableHref(ele,true);}},subnavi:function(){try{if(ele=$('subnavi')){if(ele.select('li').length>0){var allLis=$$("#subnavi>ul>li");allLis[allLis.length-1].addClassName("last");return this;}}}catch(ex){}},accordion:function(accordionID){var options={resizeSpeed:8,classNames:{toggle:'accordionToggle',toggleActive:'accordionToggleActive',content:'accordionContent'},defaultSize:{height:'auto',width:'width'},direction:'vertical',onEvent:'click'}
try{new Accordion(accordionID,options);}catch(e){}}}
function checkIKnow(thisObj){if(thisObj.checked){document.getElementById("submitForward").removeAttribute("disabled");document.getElementById("submitForward").style.display="block";}else{document.getElementById("submitForward").setAttribute("disabled","disabled");document.getElementById("submitForward").style.display="none";}}
var Treadmill=Class.create();Treadmill.prototype={container:null,viewPortItems:6,itemWidth:110,items:null,effMove:null,counter:0,isStopped:false,direction:1,initialize:function(container,content){if(!$(container)){throw(container+" doesn't exist!");}else{this.container=$(container);}
this.items=content;this.contentBox=this.container.select(".treadmillContent")[0];this.container.observe('mouseover',this._stop.bindAsEventListener());this._fill(content);},_fill:function(content){var contentString="";var $this=this;content.each(function(item){contentString+='<li><a href="'+item.ahref+'"><img src="'+item.image+'" alt="" /><span class="details">'+item.name+'<br /><span class="price">'+item.price+'</span></span></a></li>';})
this.contentBox.update(contentString);},_start:function(direction){this.isStopped=false;var $this=this;var dur=1;var moveLength=-1*direction*this.itemWidth;this.effMove=new Effect.Move(this.contentBox,{x:moveLength,y:0,duration:dur,afterFinish:$this._next.bind(null,$this,direction)});},_stop:function(){var $this=arguments[0];$this._start($this.direction);},_mouseOut:function(){var $this=arguments[0];console.debug($this);$this._start();},_getMaxCount:function(){return this.items.length-this.viewPortItems;},_next:function(){var $this=arguments[0];$this.counter++;var direction=arguments[1];if($this.counter>=$this._getMaxCount()){$this.counter=0;direction=direction*-1;}
$this._sleep(2000);if(!$this.isStopped){$this.direction=direction;$this._start(direction);}},_sleep:function(ms){var now=(new Date()).getTime();var end=now+ms;while((new Date()).getTime()<end){};}}
hasCheckWarenkorbWAError=false;function checkWarenkorbWA(thisObj,minAmount,url){var inp=$(thisObj).ancestors()[2].select('.anzahlCol input')[0];if(inp.value<minAmount){var p=new Element("p",{"style":"font-weight:bold;color:red;padding-top: 10px;"}).update(locations.errorWAMinAmount.replace(/###value###/,minAmount));if(!hasCheckWarenkorbWAError){$('warenkorbform').insert({before:p});hasCheckWarenkorbWAError=!hasCheckWarenkorbWAError;}}else{document.location=url;}}

