var Autocompleter=new Class({Implements:[Options,Events],options:{minLength:1,markQuery:true,width:"inherit",maxChoices:10,injectChoice:null,customChoices:null,emptyChoices:null,visibleChoices:true,className:"autocompleter-choices",zIndex:42,delay:400,observerOptions:{},fxOptions:{},autoSubmit:false,overflow:false,overflowMargin:25,selectFirst:false,filter:null,filterCase:false,filterSubset:false,forceSelect:false,selectMode:true,choicesMatch:null,multiple:false,separator:", ",separatorSplit:/\s*[,;]\s*/,autoTrim:false,allowDupes:false,cache:true,relative:false},initialize:function(element,options){this.element=$(element);this.setOptions(options);this.build();this.observer=new Observer(this.element,this.prefetch.bind(this),$merge({delay:this.options.delay},this.options.observerOptions));this.queryValue=null;if(this.options.filter){this.filter=this.options.filter.bind(this)}var mode=this.options.selectMode;this.typeAhead=(mode=="type-ahead");this.selectMode=(mode===true)?"selection":mode;this.cached=[]},build:function(){if($(this.options.customChoices)){this.choices=this.options.customChoices
}else{this.choices=new Element("ul",{"class":this.options.className,styles:{zIndex:this.options.zIndex}}).inject(document.body);this.relative=false;if(this.options.relative){this.choices.inject(this.element,"after");this.relative=this.element.getOffsetParent()}this.fix=new OverlayFix(this.choices)}if(!this.options.separator.test(this.options.separatorSplit)){this.options.separatorSplit=this.options.separator}this.fx=(!this.options.fxOptions)?null:new Fx.Tween(this.choices,$merge({property:"opacity",link:"cancel",duration:200},this.options.fxOptions)).addEvent("onStart",Chain.prototype.clearChain).set(0);this.element.setProperty("autocomplete","off").addEvent((Browser.Engine.trident||Browser.Engine.webkit)?"keydown":"keypress",this.onCommand.bind(this)).addEvent("click",this.onCommand.bind(this,[false])).addEvent("focus",this.toggleFocus.create({bind:this,arguments:true,delay:100})).addEvent("blur",this.toggleFocus.create({bind:this,arguments:false,delay:100}))},destroy:function(){if(this.fix){this.fix.destroy()
}this.choices=this.selected=this.choices.destroy()},toggleFocus:function(state){this.focussed=state;if(!state){this.hideChoices(true)}this.fireEvent((state)?"onFocus":"onBlur",[this.element])},onCommand:function(e){if(!e&&this.focussed){return this.prefetch()}if(e&&e.key&&!e.shift){switch(e.key){case"enter":if(this.element.value!=this.opted){return true}if(this.selected&&this.visible){this.choiceSelect(this.selected);return !!(this.options.autoSubmit)}break;case"up":case"down":if(!this.prefetch()&&this.queryValue!==null){var up=(e.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((up)?"getPrevious":"getNext"):((up)?"getLast":"getFirst")](this.options.choicesMatch),true)}return false;case"esc":case"tab":this.hideChoices(true);break}}return true},setSelection:function(finish){var input=this.selected.inputValue,value=input;var start=this.queryValue.length,end=input.length;if(input.substr(0,start).toLowerCase()!=this.queryValue.toLowerCase()){start=0}if(this.options.multiple){var split=this.options.separatorSplit;
value=this.element.value;start+=this.queryIndex;end+=this.queryIndex;var old=value.substr(this.queryIndex).split(split,1)[0];value=value.substr(0,this.queryIndex)+input+value.substr(this.queryIndex+old.length);if(finish){var tokens=value.split(this.options.separatorSplit).filter(function(entry){return this.test(entry)},/[^\s,]+/);if(!this.options.allowDupes){tokens=[].combine(tokens)}var sep=this.options.separator;value=tokens.join(sep)+sep;end=value.length}}this.observer.setValue(value);this.opted=value;if(finish||this.selectMode=="pick"){start=end}this.element.selectRange(start,end);this.fireEvent("onSelection",[this.element,this.selected,value,input])},showChoices:function(){var match=this.options.choicesMatch,first=this.choices.getFirst(match);this.selected=this.selectedValue=null;if(this.fix){var pos=this.element.getCoordinates(this.relative),width=this.options.width||"auto";this.choices.setStyles({left:pos.left,top:pos.bottom,width:(width===true||width=="inherit")?pos.width:width})}if(!first){return}if(!this.visible){this.visible=true;
this.choices.setStyle("display","");if(this.fx){this.fx.start(1)}this.fireEvent("onShow",[this.element,this.choices])}if(this.options.selectFirst||this.typeAhead||first.inputValue==this.queryValue){this.choiceOver(first,this.typeAhead)}var items=this.choices.getChildren(match),max=this.options.maxChoices;var styles={overflowY:"hidden",height:""};this.overflown=false;if(items.length>max){var item=items[max-1];styles.overflowY="scroll";styles.height=item.getCoordinates(this.choices).bottom;this.overflown=true}this.choices.setStyles(styles);this.fix.show();if(this.options.visibleChoices){var scroll=document.getScroll(),size=document.getSize(),coords=this.choices.getCoordinates();if(coords.right>scroll.x+size.x){scroll.x=coords.right-size.x}if(coords.bottom>scroll.y+size.y){scroll.y=coords.bottom-size.y}window.scrollTo(Math.min(scroll.x,coords.left),Math.min(scroll.y,coords.top))}},hideChoices:function(clear){if(clear){var value=this.element.value;if(this.options.forceSelect){value=this.opted}if(this.options.autoTrim){value=value.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator)
}this.observer.setValue(value)}if(!this.visible){return}this.visible=false;if(this.selected){this.selected.removeClass("autocompleter-selected")}this.observer.clear();var hide=function(){this.choices.setStyle("display","none");this.fix.hide()}.bind(this);if(this.fx){this.fx.start(0).chain(hide)}else{hide()}this.fireEvent("onHide",[this.element,this.choices])},prefetch:function(){var value=this.element.value,query=value;if(this.options.multiple){var split=this.options.separatorSplit;var values=value.split(split);var index=this.element.getSelectedRange().start;var toIndex=value.substr(0,index).split(split);var last=toIndex.length-1;index-=toIndex[last].length;query=values[last]}if(query.length<this.options.minLength){this.hideChoices()}else{if(query===this.queryValue||(this.visible&&query==this.selectedValue)){if(this.visible){return false}this.showChoices()}else{this.queryValue=query;this.queryIndex=index;if(!this.fetchCached()){this.query()}}}return true},fetchCached:function(){return false;if(!this.options.cache||!this.cached||!this.cached.length||this.cached.length>=this.options.maxChoices||this.queryValue){return false
}this.update(this.filter(this.cached));return true},update:function(tokens){this.choices.empty();this.cached=tokens;var type=tokens&&$type(tokens);if(!type||(type=="array"&&!tokens.length)||(type=="hash"&&!tokens.getLength())){(this.options.emptyChoices||this.hideChoices).call(this)}else{if(this.options.maxChoices<tokens.length&&!this.options.overflow){tokens.length=this.options.maxChoices}tokens.each(this.options.injectChoice||function(token){var choice=new Element("li",{html:this.markQueryValue(token)});choice.inputValue=token;this.addChoiceEvents(choice).inject(this.choices)},this);this.showChoices()}},choiceOver:function(choice,selection){if(!choice||choice==this.selected){return}if(this.selected){this.selected.removeClass("autocompleter-selected")}this.selected=choice.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,selection]);if(!this.selectMode){this.opted=this.element.value}if(!selection){return}this.selectedValue=this.selected.inputValue;if(this.overflown){var coords=this.selected.getCoordinates(this.choices),margin=this.options.overflowMargin,top=this.choices.scrollTop,height=this.choices.offsetHeight,bottom=top+height;
if(coords.top-margin<top&&top){this.choices.scrollTop=Math.max(coords.top-margin,0)}else{if(coords.bottom+margin>bottom){this.choices.scrollTop=Math.min(coords.bottom-height+margin,bottom)}}}if(this.selectMode){this.setSelection()}},choiceSelect:function(choice){if(choice){this.choiceOver(choice)}this.setSelection(true);this.queryValue=false;this.hideChoices()},filter:function(tokens){return(tokens||this.tokens).filter(function(token){return this.test(token)},new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i"))},markQueryValue:function(str){return(!this.options.markQuery||!this.queryValue)?str:str.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",(this.options.filterCase)?"":"i"),'<span class="autocompleter-queried">$1</span>')},addChoiceEvents:function(el){return el.addEvents({mouseover:this.choiceOver.bind(this,[el]),click:this.choiceSelect.bind(this,[el])})}});var OverlayFix=new Class({initialize:function(el){if(Browser.Engine.trident){this.element=$(el);
this.relative=this.element.getOffsetParent();this.fix=new Element("iframe",{frameborder:"0",scrolling:"no",src:"javascript:false;",styles:{position:"absolute",border:"none",display:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}}).inject(this.element,"after")}},show:function(){if(this.fix){var coords=this.element.getCoordinates(this.relative);delete coords.right;delete coords.bottom;this.fix.setStyles($extend(coords,{display:"",zIndex:(this.element.getStyle("zIndex")||1)-1}))}return this},hide:function(){if(this.fix){this.fix.setStyle("display","none")}return this},destroy:function(){if(this.fix){this.fix=this.fix.destroy()}}});Element.implement({getSelectedRange:function(){if(!Browser.Engine.trident){return{start:this.selectionStart,end:this.selectionEnd}}var pos={start:0,end:0};var range=this.getDocument().selection.createRange();if(!range||range.parentElement()!=this){return pos}var dup=range.duplicate();if(this.type=="text"){pos.start=0-dup.moveStart("character",-100000);pos.end=pos.start+range.text.length
}else{var value=this.value;var offset=value.length-value.match(/[\n\r]*$/)[0].length;dup.moveToElementText(this);dup.setEndPoint("StartToEnd",range);pos.end=offset-dup.text.length;dup.setEndPoint("StartToStart",range);pos.start=offset-dup.text.length}return pos},selectRange:function(start,end){if(Browser.Engine.trident){var diff=this.value.substr(start,end-start).replace(/\r/g,"").length;start=this.value.substr(0,start).replace(/\r/g,"").length;var range=this.createTextRange();range.collapse(true);range.moveEnd("character",start+diff);range.moveStart("character",start);range.select()}else{this.focus();this.setSelectionRange(start,end)}return this}});Autocompleter.Base=Autocompleter;Autocompleter.Local=new Class({Extends:Autocompleter,options:{minLength:0,delay:200},initialize:function(element,tokens,options){this.parent(element,options);this.tokens=tokens},query:function(){this.update(this.filter())}});Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:"value"},query:function(){var data=$unlink(this.options.postData)||{};
data[this.options.postVar]=this.queryValue;var indicator=$(this.options.indicator);if(indicator){indicator.setStyle("display","")}var cls=this.options.indicatorClass;if(cls){this.element.addClass(cls)}this.fireEvent("onRequest",[this.element,this.request,data,this.queryValue]);this.request.send({data:data})},queryResponse:function(){var indicator=$(this.options.indicator);if(indicator){indicator.setStyle("display","none")}var cls=this.options.indicatorClass;if(cls){this.element.removeClass(cls)}return this.fireEvent("onComplete",[this.element,this.request])}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);this.request=new Request.JSON($merge({url:url,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(response){this.parent();this.update(response)}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(el,url,options){this.parent(el,options);
this.request=new Request.HTML($merge({url:url,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this))},queryResponse:function(tree,elements){this.parent();if(!elements||!elements.length){this.hideChoices()}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(choice){var value=choice.innerHTML;choice.inputValue=value;this.addChoiceEvents(choice.set("html",this.markQueryValue(value)))},this);this.showChoices()}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(el,onFired,options){this.element=$(el)||$$(el);this.addEvent("onFired",onFired);this.setOptions(options);this.bound=this.changed.bind(this);this.resume()},changed:function(){var value=this.element.get("value");if($equals(this.value,value)){return}this.clear();this.value=value;this.timeout=this.onFired.delay(this.options.delay,this)
},setValue:function(value){this.value=value;this.element.set("value",value);return this.clear()},onFired:function(){this.fireEvent("onFired",[this.value,this.element])},clear:function(){$clear(this.timeout||null);return this},pause:function(){if(this.timer){$clear(this.timer)}else{this.element.removeEvent("keyup",this.bound)}return this.clear()},resume:function(){this.value=this.element.get("value");if(this.options.periodical){this.timer=this.changed.periodical(this.options.periodical,this)}else{this.element.addEvent("keyup",this.bound)}return this}});var $equals=function(obj1,obj2){return(obj1==obj2||JSON.encode(obj1)==JSON.encode(obj2))};Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(elements,options){this.elements=this.subject=$$(elements);this.parent(options)},compute:function(from,to,delta){var now={};for(var i in from){var iFrom=from[i],iTo=to[i],iNow=now[i]={};for(var p in iFrom){iNow[p]=this.parent(iFrom[p],iTo[p],delta)}}return now},set:function(now){for(var i in now){var iNow=now[i];for(var p in iNow){this.render(this.elements[i],p,iNow[p],this.options.unit)
}}return this},start:function(obj){if(!this.check(arguments.callee,obj)){return this}var from={},to={};for(var i in obj){var iProps=obj[i],iFrom=from[i]={},iTo=to[i]={};for(var p in iProps){var parsed=this.prepare(this.elements[i],p,iProps[p]);iFrom[p]=parsed.from;iTo[p]=parsed.to}}return this.parent(from,to)}});var IframeShim=new Class({Implements:[Options,Events],options:{name:"",className:"iframeShim",display:false,zindex:null,margin:0,offset:{x:0,y:0},browsers:(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},initialize:function(element,options){this.setOptions(options);if(this.options.offset&&this.options.offset.top){this.options.offset.y=this.options.offset.top}if(this.options.offset&&this.options.offset.left){this.options.offset.x=this.options.offset.left}this.element=$(element);this.makeShim();return},makeShim:function(){this.shim=new Element("iframe");this.id=this.options.name||new Date().getTime()+"_shim";if(this.element.getStyle("z-Index").toInt()<1||isNaN(this.element.getStyle("z-Index").toInt())){this.element.setStyle("z-Index",5)
}var z=this.element.getStyle("z-Index")-1;if($chk(this.options.zindex)&&this.element.getStyle("z-Index").toInt()>this.options.zindex){z=this.options.zindex}this.shim.setStyles({position:"absolute",zIndex:z,border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"}).setProperties({src:"javascript:void(0);",frameborder:"0",scrolling:"no",id:this.id}).addClass(this.options.className);this.element.store("shim",this);var inject=function(){this.shim.inject(this.element,"after");if(this.options.display){this.show()}else{this.hide()}this.fireEvent("onInject")};if(this.options.browsers){if(Browser.Engine.trident&&!IframeShim.ready){window.addEvent("load",inject.bind(this))}else{inject.run(null,this)}}},position:function(shim){if(!this.options.browsers||!IframeShim.ready){return this}var before=this.element.getStyles("display","visibility","position");this.element.setStyles({display:"block",position:"absolute",visibility:"hidden"});var size=this.element.getSize();this.element.setStyles(before);if($type(this.options.margin)){size.x=size.x-(this.options.margin*2);
size.y=size.y-(this.options.margin*2);this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin}this.shim.setStyles({width:size.x,height:size.y}).setPosition({relativeTo:this.element,offset:this.options.offset});return this},hide:function(){if(this.options.browsers){this.shim.setStyle("display","none")}return this},show:function(){if(!this.options.browsers){return this}this.shim.setStyle("display","block");return this.position()},dispose:function(){if(this.options.browsers){this.shim.dispose()}return this}});window.addEvent("load",function(){IframeShim.ready=true});Hash.implement({getFromPath:function(notation){var source=this.getClean();notation.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(match){if(!source){return}var prop=arguments[2]||arguments[1]||arguments[0];source=(prop in source)?source[prop]:null;return match});return source},cleanValues:function(method){method=method||$defined;this.each(function(v,k){if(!method(v)){this.erase(k)}},this);return this}});String.implement({stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")
},parseQuery:function(encodeKeys,encodeValues){encodeKeys=$pick(encodeKeys,true);encodeValues=$pick(encodeValues,true);var vars=this.split(/[&;]/);var rs={};if(vars.length){vars.each(function(val){var keys=val.split("=");if(keys.length&&keys.length==2){rs[(encodeKeys)?encodeURIComponent(keys[0]):keys[0]]=(encodeValues)?encodeURIComponent(keys[1]):keys[1]}})}return rs},tidy:function(){var txt=this.toString();$each({"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"},function(value,key){txt=txt.replace(new RegExp(key,"g"),value)});return txt},cleanQueryString:function(method){return this.split("&").filter(method||function(set){return $chk(set.split("=")[1])}).join("&")}});Element.implement({expose:function(){if(this.getStyle("display")!="none"){return $empty}var before={};var styles={visibility:"hidden",display:"block",position:"absolute"};$each(styles,function(value,style){before[style]=this.style[style]||""},this);this.setStyles(styles);
return(function(){this.setStyles(before)}).bind(this)},getDimensions:function(options){options=$merge({computeSize:false},options);var dim={};function getSize(el,options){return(options.computeSize)?el.getComputedSize(options):el.getSize()}if(this.getStyle("display")=="none"){var restore=this.expose();dim=getSize(this,options);restore()}else{try{dim=getSize(this,options)}catch(e){}}return $chk(dim.x)?$extend(dim,{width:dim.x,height:dim.y}):$extend(dim,{x:dim.width,y:dim.height})},getComputedSize:function(options){options=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},options);var size={width:0,height:0};switch(options.mode){case"vertical":delete size.width;delete options.plains.width;break;case"horizontal":delete size.height;delete options.plains.height;break}var getStyles=[];$each(options.plains,function(plain,key){plain.each(function(edge){options.styles.each(function(style){getStyles.push((style=="border")?style+"-"+edge+"-width":style+"-"+edge)})})});
var styles=this.getStyles.apply(this,getStyles);var subtracted=[];$each(options.plains,function(plain,key){size["total"+key.capitalize()]=0;size["computed"+key.capitalize()]=0;plain.each(function(edge){size["computed"+edge.capitalize()]=0;getStyles.each(function(style,i){if(style.test(edge)){styles[style]=styles[style].toInt();if(isNaN(styles[style])){styles[style]=0}size["total"+key.capitalize()]=size["total"+key.capitalize()]+styles[style];size["computed"+edge.capitalize()]=size["computed"+edge.capitalize()]+styles[style]}if(style.test(edge)&&key!=style&&(style.test("border")||style.test("padding"))&&!subtracted.contains(style)){subtracted.push(style);size["computed"+key.capitalize()]=size["computed"+key.capitalize()]-styles[style]}})})});if($chk(size.width)){size.width=size.width+this.offsetWidth+size.computedWidth;size.totalWidth=size.width+size.totalWidth;delete size.computedWidth}if($chk(size.height)){size.height=size.height+this.offsetHeight+size.computedHeight;size.totalHeight=size.height+size.totalHeight;
delete size.computedHeight}return $extend(styles,size)}});window.addEvent("domready",function(){var test=new Element("div").setStyles({position:"fixed",top:0,right:0}).inject(document.body);var supported=(test.offsetTop===0);test.dispose();Browser.supportsPositionFixed=supported});Element.implement({pin:function(enable){if(!Browser.loaded){dbug.log("cannot pin "+this+" natively because the dom is not ready")}if(this.getStyle("display")=="none"){dbug.log("cannot pin "+this+" because it is hidden");return}if(enable!==false){var p=this.getPosition();if(!this.retrieve("pinned")){var pos={top:(p.y-window.getScroll().y),left:(p.x-window.getScroll().x)};if(Browser.supportsPositionFixed){this.setStyle("position","fixed").setStyles(pos)}else{this.store("pinnedByJS",true);this.setStyles({position:"absolute",top:p.y,left:p.x});this.store("scrollFixer",function(){if(this.retrieve("pinned")){var to={top:(pos.top.toInt()+window.getScroll().y),left:(pos.left.toInt()+window.getScroll().x)};this.setStyles(to)}}.bind(this));window.addEvent("scroll",this.retrieve("scrollFixer"))
}this.store("pinned",true)}}else{var op;if(!Browser.Engine.trident){if(this.getParent().getComputedStyle("position")!="static"){op=this.getParent()}else{op=this.getParent().getOffsetParent()}}var p=this.getPosition(op);this.store("pinned",false);var reposition;if(Browser.supportsPositionFixed&&!this.retrieve("pinnedByJS")){reposition={top:(p.y+window.getScroll().y),left:(p.x+window.getScroll().x)}}else{this.store("pinnedByJS",false);window.removeEvent("scroll",this.retrieve("scrollFixer"));reposition={top:(p.y),left:(p.x)}}this.setStyles($merge(reposition,{position:"absolute"}))}return this.addClass("isPinned")},unpin:function(){return this.pin(false).removeClass("isPinned")},togglepin:function(){this.pin(!this.retrieve("pinned"))}});Element.implement({setPosition:function(options){$each(options||{},function(v,k){if(!$defined(v)){delete options[k]}});options=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false},options);
var parentOffset={x:0,y:0};var parentPositioned=false;var putItBack=this.expose();var offsetParent=$(this.getOffsetParent());putItBack();if(offsetParent&&offsetParent!=this.getDocument().body){var putItBack=offsetParent.expose();parentOffset=offsetParent.getPosition();putItBack();parentPositioned=true;options.offset.x=options.offset.x-parentOffset.x;options.offset.y=options.offset.y-parentOffset.y}function fixValue(option){if($type(option)!="string"){return option}option=option.toLowerCase();var val={};if(option.test("left")){val.x="left"}else{if(option.test("right")){val.x="right"}else{val.x="center"}}if(option.test("upper")||option.test("top")){val.y="top"}else{if(option.test("bottom")){val.y="bottom"}else{val.y="center"}}return val}options.edge=fixValue(options.edge);options.position=fixValue(options.position);if(!options.edge){if(options.position.x=="center"&&options.position.y=="center"){options.edge={x:"center",y:"center"}}else{options.edge={x:"left",y:"top"}}}this.setStyle("position","absolute");var rel=$(options.relativeTo)||document.body;
var top=(rel==document.body)?window.getScroll().y:rel.getPosition().y;var left=(rel==document.body)?window.getScroll().x:rel.getPosition().x;if(top<0){top=0}if(left<0){left=0}var dim=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});if(options.ignoreMargins){options.offset.x=options.offset.x-dim["margin-left"];options.offset.y=options.offset.y-dim["margin-top"]}var pos={};var prefY=options.offset.y.toInt();var prefX=options.offset.x.toInt();switch(options.position.x){case"left":pos.x=left+prefX;break;case"right":pos.x=left+prefX+rel.offsetWidth;break;default:pos.x=left+(((rel==document.body)?window.getSize().x:rel.offsetWidth)/2)+prefX;break}switch(options.position.y){case"top":pos.y=top+prefY;break;case"bottom":pos.y=top+prefY+rel.offsetHeight;break;default:pos.y=top+(((rel==document.body)?window.getSize().y:rel.offsetHeight)/2)+prefY;break}if(options.edge){var edgeOffset={};switch(options.edge.x){case"left":edgeOffset.x=0;break;case"right":edgeOffset.x=-dim.x-dim.computedRight-dim.computedLeft;
break;default:edgeOffset.x=-(dim.x/2);break}switch(options.edge.y){case"top":edgeOffset.y=0;break;case"bottom":edgeOffset.y=-dim.y-dim.computedTop-dim.computedBottom;break;default:edgeOffset.y=-(dim.y/2);break}pos.x=pos.x+edgeOffset.x;pos.y=pos.y+edgeOffset.y}pos={left:((pos.x>=0||parentPositioned)?pos.x:0).toInt(),top:((pos.y>=0||parentPositioned)?pos.y:0).toInt()};if(rel.getStyle("position")=="fixed"||options.relFixedPosition){pos.top=pos.top.toInt()+window.getScroll().y;pos.left=pos.left.toInt()+window.getScroll().x}if(options.returnPos){return pos}else{this.setStyles(pos)}return this}});Element.implement({isVisible:function(){return this.getStyle("display")!="none"},toggle:function(){return this[this.isVisible()?"hide":"show"]()},hide:function(){var d;try{if("none"!=this.getStyle("display")){d=this.getStyle("display")}}catch(e){}this.store("originalDisplay",d||"block");this.setStyle("display","none");return this},show:function(display){original=this.retrieve("originalDisplay")?this.retrieve("originalDisplay"):this.get("originalDisplay");
this.setStyle("display",(display||original||"block"));return this},swapClass:function(remove,add){return this.removeClass(remove).addClass(add)},fxOpacityOk:function(){return !Browser.Engine.trident4}});var Modalizer=new Class({defaultModalStyle:{display:"block",position:"fixed",top:0,left:0,"z-index":5000,"background-color":"#333",opacity:0.8},setModalOptions:function(options){this.modalOptions=$merge({width:(window.getScrollSize().x+300),height:(window.getScrollSize().y+300),elementsToHide:"select",hideOnClick:true,modalStyle:{},updateOnResize:true,layerId:"modalOverlay",onModalHide:$empty,onModalShow:$empty},this.modalOptions,options);return this},toElement:function(){if(!this.modalOptions.layerId){this.setModalOptions()}return $(this.modalOptions.layerId)||new Element("div",{id:this.modalOptions.layerId}).inject(document.body)},resize:function(){if($(this)){$(this).setStyles({width:(window.getScrollSize().x+300),height:(window.getScrollSize().y+300)})}},setModalStyle:function(styleObject){this.modalOptions.modalStyle=styleObject;
this.modalStyle=$merge(this.defaultModalStyle,{width:this.modalOptions.width,height:this.modalOptions.height},styleObject);if($(this)){$(this).setStyles(this.modalStyle)}return(this.modalStyle)},modalShow:function(options){this.setModalOptions(options);$(this).setStyles(this.setModalStyle(this.modalOptions.modalStyle));if(Browser.Engine.trident4){$(this).setStyle("position","absolute")}$(this).removeEvents("click").addEvent("click",function(){this.modalHide(this.modalOptions.hideOnClick)}.bind(this));this.bound=this.bound||{};if(!this.bound.resize&&this.modalOptions.updateOnResize){this.bound.resize=this.resize.bind(this);window.addEvent("resize",this.bound.resize)}if($type(this.modalOptions.onModalShow)=="function"){this.modalOptions.onModalShow()}this.togglePopThroughElements(0);$(this).setStyle("display","block");return this},modalHide:function(override,force){if(override===false){return false}this.togglePopThroughElements(1);if($type(this.modalOptions.onModalHide)=="function"){this.modalOptions.onModalHide()
}$(this).setStyle("display","none");if(this.modalOptions.updateOnResize){this.bound=this.bound||{};if(!this.bound.resize){this.bound.resize=this.resize.bind(this)}window.removeEvent("resize",this.bound.resize)}return this},togglePopThroughElements:function(opacity){if(Browser.Engine.trident4||(Browser.Engine.gecko&&Browser.Platform.mac)){$$(this.modalOptions.elementsToHide).each(function(sel){sel.setStyle("opacity",opacity)})}}});var StyleWriter=new Class({createStyle:function(css,id){window.addEvent("domready",function(){try{if($(id)&&id){return}var style=new Element("style",{id:id||""}).inject($$("head")[0]);if(Browser.Engine.trident){style.styleSheet.cssText=css}else{style.set("text",css)}}catch(e){dbug.log("error: %s",e)}}.bind(this))}});var StickyWin=new Class({Implements:[Options,Events,StyleWriter],options:{closeClassName:"closeSticky",pinClassName:"pinSticky",content:"",zIndex:10000,className:"",width:false,height:false,timeout:-1,allowMultipleByClass:false,allowMultiple:true,showNow:true,useIframeShim:true,iframeShimSelector:""},css:'.SWclearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}.SWclearfix {display: inline-table;}* html .SWclearfix {height: 1%;}.SWclearfix {display: block;}',initialize:function(options){this.options.inject={target:document.body,where:"bottom"};
this.setOptions(options);this.id=this.options.id||"StickyWin_"+new Date().getTime();this.makeWindow();if(this.options.content){this.setContent(this.options.content)}if(this.options.timeout>0){this.addEvent("onDisplay",function(){this.hide.delay(this.options.timeout,this)}.bind(this))}if(this.options.showNow){this.show()}this.createStyle(this.css,"StickyWinClearFix")},toElement:function(){return this.win},makeWindow:function(){this.destroyOthers();if(!$(this.id)){this.win=new Element("div",{id:this.id}).addClass(this.options.className).addClass("StickyWinInstance").addClass("SWclearfix").setStyles({display:"none",position:"absolute",zIndex:this.options.zIndex}).inject(this.options.inject.target,this.options.inject.where).store("StickyWin",this)}else{this.win=$(this.id)}if(this.options.width&&$type(this.options.width.toInt())=="number"){this.win.setStyle("width",this.options.width.toInt())}if(this.options.height&&$type(this.options.height.toInt())=="number"){this.win.setStyle("height",this.options.height.toInt())
}return this},show:function(){this.fireEvent("onDisplay");this.showWin();if(this.options.useIframeShim){this.showIframeShim()}this.visible=true;return this},showWin:function(){this.win.setStyle("display","block");if(!this.positioned){this.position()}},hide:function(suppressEvent){if(!suppressEvent){this.fireEvent("onClose")}this.hideWin();if(this.options.useIframeShim){this.hideIframeShim()}this.visible=false;return this},hideWin:function(){this.win.setStyle("display","none")},destroyOthers:function(){if(!this.options.allowMultipleByClass||!this.options.allowMultiple){$$("div.StickyWinInstance").each(function(sw){if(!this.options.allowMultiple||(!this.options.allowMultipleByClass&&sw.hasClass(this.options.className))){sw.retrieve("StickyWin").destroy()}},this)}},setContent:function(html){if(this.win.getChildren().length>0){this.win.empty()}if($type(html)=="string"){this.win.set("html",html)}else{if($(html)){this.win.adopt(html)}}this.win.getElements("."+this.options.closeClassName).each(function(el){el.addEvent("click",this.hide.bind(this))
},this);this.win.getElements("."+this.options.pinClassName).each(function(el){el.addEvent("click",this.togglepin.bind(this))},this);return this},position:function(){this.positioned=true;this.win.setPosition({relativeTo:this.options.relativeTo,position:this.options.position,offset:this.options.offset,edge:this.options.edge});if(this.shim){this.shim.position()}return this},pin:function(pin){if(!this.win.pin){dbug.log("you must include element.pin.js!");return this}this.pinned=$pick(pin,true);this.win.pin(pin);return this},unpin:function(){return this.pin(false)},togglepin:function(){return this.pin(!this.pinned)},makeIframeShim:function(){if(!this.shim){var el=(this.options.iframeShimSelector)?this.win.getElement(this.options.iframeShimSelector):this.win;this.shim=new IframeShim(el,{display:false,name:"StickyWinShim"})}},showIframeShim:function(){if(this.options.useIframeShim){this.makeIframeShim();this.shim.show()}},hideIframeShim:function(){if(this.shim){this.shim.hide()}},destroy:function(){if(this.win){this.win.dispose()
}if(this.options.useIframeShim&&this.shim){this.shim.dispose()}if($("modalOverlay")){$("modalOverlay").dispose()}}});StickyWin.Fx=new Class({Extends:StickyWin,options:{fade:true,fadeDuration:150,draggable:false,dragOptions:{},dragHandleSelector:".dragHandle",resizable:false,resizeOptions:{},resizeHandleSelector:""},setContent:function(html){this.parent(html);if(this.options.draggable){this.makeDraggable()}if(this.options.resizable){this.makeResizable()}return this},hideWin:function(){if(this.options.fade){this.fade(0)}else{this.parent()}},showWin:function(){if(this.options.fade){this.fade(1)}else{this.parent()}},fade:function(to){if(!this.fadeFx){this.win.setStyles({opacity:0,display:"block"});var opts={property:"opacity",duration:this.options.fadeDuration};if(this.options.fadeTransition){opts.transition=this.options.fadeTransition}this.fadeFx=new Fx.Tween(this.win,opts)}if(to>0){this.win.setStyle("display","block");this.position()}this.fadeFx.clearChain();this.fadeFx.start(to).chain(function(){if(to==0){this.win.setStyle("display","none")
}}.bind(this));return this},makeDraggable:function(){dbug.log("you must include Drag.js, cannot make draggable")},makeResizable:function(){dbug.log("you must include Drag.js, cannot make resizable")}});var StickyWinFx=StickyWin.Fx;if(typeof Drag!="undefined"){StickyWin.Fx.implement({makeDraggable:function(){var toggled=this.toggleVisible(true);if(this.options.useIframeShim){this.makeIframeShim();var onComplete=(this.options.dragOptions.onComplete||$empty);this.options.dragOptions.onComplete=function(){onComplete();this.shim.position()}.bind(this)}if(this.options.dragHandleSelector){var handle=this.win.getElement(this.options.dragHandleSelector);if(handle){handle.setStyle("cursor","move");this.options.dragOptions.handle=handle}}this.win.makeDraggable(this.options.dragOptions);if(toggled){this.toggleVisible(false)}},makeResizable:function(){var toggled=this.toggleVisible(true);if(this.options.useIframeShim){this.makeIframeShim();var onComplete=(this.options.resizeOptions.onComplete||$empty);this.options.resizeOptions.onComplete=function(){onComplete();
this.shim.position()}.bind(this)}if(this.options.resizeHandleSelector){var handle=this.win.getElement(this.options.resizeHandleSelector);if(handle){this.options.resizeOptions.handle=this.win.getElement(this.options.resizeHandleSelector)}}this.win.makeResizable(this.options.resizeOptions);if(toggled){this.toggleVisible(false)}},toggleVisible:function(show){if(!this.visible&&Browser.Engine.webkit&&$pick(show,true)){this.win.setStyles({display:"block",opacity:0});return true}else{if(!$pick(show,false)){this.win.setStyles({display:"none",opacity:1});return false}}return false}})}(function(){var modalWinBase=function(extend){return{Extends:extend,initialize:function(options){options=options||{};this.setModalOptions($merge(options.modalOptions||{},{onModalHide:function(){this.hide(false)}.bind(this)}));this.parent(options)},show:function(showModal){if($pick(showModal,true)){this.modalShow();this.win.getElements(this.modalOptions.elementsToHide).setStyle("opacity",1)}this.parent()},hide:function(hideModal){if($pick(hideModal,true)){this.modalHide()
}this.parent($pick(hideModal,true))}}};StickyWin.Modal=new Class(modalWinBase(StickyWin));StickyWin.Modal.implement(new Modalizer);if(StickyWin.Fx){StickyWin.Fx.Modal=new Class(modalWinBase(StickyWin.Fx))}try{StickyWin.Fx.Modal.implement(new Modalizer())}catch(e){}})();var StickyWinModal=StickyWin.Modal;if(StickyWin.Fx){var StickyWinFxModal=StickyWin.Fx.Modal}(function(){var SWA=function(extend){return{Extends:extend,options:{url:"",showNow:false,requestOptions:{method:"get"},wrapWithUi:false,caption:"",uiOptions:{},handleResponse:function(response){var responseScript="";this.Request.response.text.stripScripts(function(script){responseScript+=script});if(this.options.wrapWithUi){response=StickyWin.ui(this.options.caption,response,this.options.uiOptions)}this.setContent(response);this.show();if(this.evalScripts){$exec(responseScript)}}},initialize:function(options){this.parent(options);this.evalScripts=this.options.requestOptions.evalScripts;this.options.requestOptions.evalScripts=false;this.createRequest()},createRequest:function(){this.Request=new Request(this.options.requestOptions).addEvent("onSuccess",this.options.handleResponse.bind(this))
},update:function(url,options){this.Request.setOptions(options).send({url:url||this.options.url});return this}}};try{StickyWin.Ajax=new Class(SWA(StickyWin))}catch(e){}try{StickyWin.Fx.Ajax=new Class(SWA(StickyWin.Fx))}catch(e){}try{StickyWin.Modal.Ajax=new Class(SWA(StickyWin.Modal))}catch(e){}try{StickyWin.Fx.Modal.Ajax=new Class(SWA(StickyWin.Fx.Modal))}catch(e){}})();if(window.StickyWinModal){StickyWinModal.Ajax=StickyWin.Modal.Ajax}if(StickyWin.Fx){StickyWinFx.Ajax=StickyWin.Fx.Ajax;StickyWinFxModal.Ajax=StickyWin.Fx.Modal.Ajax}StickyWin.alert=function(msghdr,msg,baseHref){baseHref=baseHref||"http://www.cnet.com/html/rb/assets/global/simple.error.popup";msg='<p class="errorMsg SWclearfix" style="margin: 0px;"><img src="'+baseHref+'/icon_problems_sm.gif" class="bang clearfix" style="float: left; width: 30px; height: 30px; margin: 3px 5px 5px 0px;">'+msg+"</p>";var body=StickyWin.ui(msghdr,msg,{width:250});return new StickyWin.Modal({modalOptions:{modalStyle:{zIndex:11000}},zIndex:110001,content:body,position:"center"})
};StickyWin.ui=function(caption,body,options){options=$extend({width:300,css:"div.DefaultStickyWin div.body{font-family:verdana; font-size:11px; line-height: 13px;}div.DefaultStickyWin div.top_ul{background:url({%baseHref%}full.png) top left no-repeat; height:30px; width:15px; float:left}div.DefaultStickyWin div.top_ur{position:relative; left:0px !important; left:-4px; background:url({%baseHref%}full.png) top right !important; height:30px; margin:0px 0px 0px 15px !important; margin-right:-4px; padding:0px}div.DefaultStickyWin h1.caption{clear: none !important; margin:0px 5px 0px 0px !important; overflow: hidden; padding:0 !important; font-weight:bold; color:#555; font-size:14px !important; position:relative; top:8px !important; left:5px !important; float: left; height: 22px !important;}div.DefaultStickyWin div.middle, div.DefaultStickyWin div.closeBody {background:url({%baseHref%}body.png) top left repeat-y; margin:0px 20px 0px 0px !important;	margin-bottom: -3px; position: relative;	top: 0px !important; top: -3px;}div.DefaultStickyWin div.body{background:url({%baseHref%}body.png) top right repeat-y; padding:8px 30px 8px 0px !important; margin-left:5px !important; position:relative; right:-20px !important;}div.DefaultStickyWin div.bottom{clear:both}div.DefaultStickyWin div.bottom_ll{background:url({%baseHref%}full.png) bottom left no-repeat; width:15px; height:15px; float:left}div.DefaultStickyWin div.bottom_lr{background:url({%baseHref%}full.png) bottom right; position:relative; left:0px !important; left:-4px; margin:0px 0px 0px 15px !important; margin-right:-4px; height:15px}div.DefaultStickyWin div.closeButtons{text-align: center; background:url({%baseHref%}body.png) top right repeat-y; padding: 0px 30px 8px 0px; margin-left:5px; position:relative; right:-20px}div.DefaultStickyWin a.button:hover{background:url({%baseHref%}big_button_over.gif) repeat-x}div.DefaultStickyWin a.button {background:url({%baseHref%}big_button.gif) repeat-x; margin: 2px 8px 2px 8px; padding: 2px 12px; cursor:pointer; border: 1px solid #999 !important; text-decoration:none; color: #000 !important;}div.DefaultStickyWin div.closeButton{width:13px; height:13px; background:url({%baseHref%}closebtn.gif) no-repeat; position: absolute; right: 0px; margin:10px 15px 0px 0px !important; cursor:pointer}div.DefaultStickyWin div.dragHandle {	width: 11px;	height: 25px;	position: relative;	top: 5px;	left: -3px;	cursor: move;	background: url({%baseHref%}drag_corner.gif); float: left;}",cornerHandle:false,cssClass:"",baseHref:"http://www.cnet.com/html/rb/assets/global/stickyWinHTML/",buttons:[]},options);
if(options.confirmTxt){options.buttons.push({text:options.confirmTxt,onClick:options.onConfirm||$empty})}if(options.closeTxt){options.buttons.push({text:options.closeTxt,onClick:options.onClose||$empty})}new StyleWriter().createStyle(options.css.substitute({baseHref:options.baseHref},/\\?\{%([^}]+)%\}/g),"defaultStickyWinStyle");caption=$pick(caption,"%caption%");body=$pick(body,"%body%");var container=new Element("div").setStyle("width",options.width).addClass("DefaultStickyWin");if(options.cssClass){container.addClass(options.cssClass)}var h1Caption=new Element("h1").addClass("caption").setStyle("width",(options.width.toInt()-(options.cornerHandle?70:60)));if($(caption)){h1Caption.adopt(caption)}else{h1Caption.set("html",caption)}var bodyDiv=new Element("div").addClass("body");if($(body)){bodyDiv.adopt(body)}else{bodyDiv.set("html",body)}var top_ur=new Element("div").addClass("top_ur").adopt(new Element("div").addClass("closeButton").addClass("closeSticky")).adopt(h1Caption);if(options.cornerHandle){new Element("div").addClass("dragHandle").inject(top_ur,"top")
}else{h1Caption.addClass("dragHandle")}container.adopt(new Element("div").addClass("top").adopt(new Element("div").addClass("top_ul")).adopt(top_ur));container.adopt(new Element("div").addClass("middle").adopt(bodyDiv));if(options.buttons.length>0){var closeButtons=new Element("div").addClass("closeButtons");options.buttons.each(function(button){if(button.properties&&button.properties.className){button.properties["class"]=button.properties.className;delete button.properties.className}var properties=$merge({"class":"closeSticky"},button.properties);new Element("a").addEvent("click",button.onClick||$empty).appendText(button.text).inject(closeButtons).setProperties(properties).addClass("button")});container.adopt(new Element("div").addClass("closeBody").adopt(closeButtons))}container.adopt(new Element("div").addClass("bottom").adopt(new Element("div").addClass("bottom_ll")).adopt(new Element("div").addClass("bottom_lr")));return container};var Waiter=new Class({Implements:[Options,Events,Chain],options:{baseHref:"http://www.cnet.com/html/rb/assets/global/waiter/",containerProps:{styles:{position:"absolute","text-align":"center"},"class":"waiterContainer"},containerPosition:{},msg:false,msgProps:{styles:{"text-align":"center",fontWeight:"bold"},"class":"waiterMsg"},img:{src:"waiter.gif",styles:{width:24,height:24},"class":"waiterImg"},layer:{styles:{width:0,height:0,position:"absolute",zIndex:999,display:"none",opacity:0.9,background:"#fff"},"class":"waitingDiv"},useIframeShim:true,fxOptions:{}},initialize:function(target,options){this.target=$(target)||$(document.body);
this.setOptions(options);this.waiterContainer=new Element("div",this.options.containerProps).inject(document.body);if(this.options.msg){this.msgContainer=new Element("div",this.options.msgProps);this.waiterContainer.adopt(this.msgContainer);if(!$(this.options.msg)){this.msg=new Element("p").appendText(this.options.msg)}else{this.msg=$(this.options.msg)}this.msgContainer.adopt(this.msg)}if(this.options.img){this.waiterImg=$(this.options.img.id)||new Element("img").injectInside(this.waiterContainer)}this.waiterOverlay=$(this.options.layer.id)||new Element("div").injectInside(document.body).adopt(this.waiterContainer);this.waiterOverlay.set(this.options.layer);try{if(this.options.useIframeShim){this.shim=new IframeShim(this.waiterOverlay,this.options.iframeShimOptions)}}catch(e){dbug.log("Waiter attempting to use IframeShim but failed; did you include IframeShim? Error: ",e);this.options.useIframeShim=false}this.waiterFx=this.waiterFx||new Fx.Elements($$(this.waiterContainer,this.waiterOverlay),this.options.fxOptions)
},toggle:function(element,show){element=$(element)||$(this.active)||$(this.target);if(!$(element)){return this}if(this.active&&element!=this.active){return this.stop(this.start.bind(this,element))}if((!this.active||show)&&show!==false){this.start(element)}else{if(this.active&&!show){this.stop()}}return this},reset:function(){this.waiterFx.cancel().set({0:{opacity:[0]},1:{opacity:[0]}})},start:function(element){this.reset();element=$(element)||$(this.target);if(this.options.img){this.waiterImg.set($merge(this.options.img,{src:this.options.baseHref+this.options.img.src}))}var start=function(){var dim=element.getComputedSize();this.active=element;this.waiterOverlay.setStyles({width:this.options.layer.width||dim.totalWidth,height:this.options.layer.height||dim.totalHeight,display:"block"}).setPosition({relativeTo:element,position:"upperLeft"});this.waiterContainer.setPosition({relativeTo:this.waiterOverlay});if(this.options.useIframeShim){this.shim.show()}this.waiterFx.start({0:{opacity:[1]},1:{opacity:[this.options.layer.styles.opacity]}}).chain(function(){if(this.active==element){this.fireEvent("onShow",element)
}this.callChain()}.bind(this))}.bind(this);if(this.active&&this.active!=element){this.stop(start)}else{start()}return this},stop:function(callback){if(!this.active){if($type(callback)=="function"){callback.attempt()}return this}this.waiterFx.cancel();this.waiterFx.clearChain();this.waiterFx.start({0:{opacity:[0]},1:{opacity:[0]}}).chain(function(){this.active=null;this.waiterOverlay.hide();if(this.options.useIframeShim){this.shim.hide()}this.fireEvent("onHide",this.active);this.callChain();this.clearChain();if($type(callback)=="function"){callback.attempt()}}.bind(this));return this}});if(typeof Request!="undefined"&&Request.HTML){Request.HTML=new Class({Extends:Request.HTML,options:{useWaiter:false,waiterOptions:{},waiterTarget:false},initialize:function(options){this._send=this.send;this.send=function(options){if(this.waiter){this.waiter.start().chain(this._send.bind(this,options))}else{this._send(options)}return this};this.parent(options);if(this.options.useWaiter&&($(this.options.update)||$(this.options.waiterTarget))){this.waiter=new Waiter(this.options.waiterTarget||this.options.update,this.options.waiterOptions);
["onComplete","onException","onCancel"].each(function(event){this.addEvent(event,this.waiter.stop.bind(this.waiter))},this)}}})}var autocompleter={init:function(){var searchboxes=$$("#search input.searchbox, input.tx-indexedsearch-searchbox-sword");searchboxes.each(function(element){var indicator=new Element("div",{"class":"autocompleter-loading",styles:{display:"none"}}).set("html","").injectInside($$("body")[0]);var completer=new Autocompleter.Ajax.Json(element,par.searchurl,{onRequest:function(el){var posleft=element.getPosition().x+element.getSize().x-23;var postop=element.getPosition().y+4;indicator.setStyle("display","");indicator.setStyle("top",postop);indicator.setStyle("left",posleft)},onComplete:function(el){indicator.setStyle("display","none")},minLength:2,zIndex:990})})}};window.addEvent("domready",function(){autocompleter.init();$$("input.searchbox").addEvents({focus:function(){if(this.value=="Was suchen Sie?"){this.value=""}},blur:function(){if(this.value==""){this.value="Was suchen Sie?"}}})});var par={searchurl:"index.php?id=5430&type=86"};
var initializerStickyWin={initStickyWins:function(){var selfObj=this;var elements=[];var links=$$("a");links.each(function(link){var linkhref=link.get("href");if(linkhref&&(linkhref.contains("tipUrl")||link.hasClass("inStickyWin"))){elements.include(link)}});elements.each(function(element){element.addEvent("click",function(event){event.preventDefault();var actionUrl=element.get("href");var StickyWindow=new StickyWin.Modal.Ajax({url:actionUrl,allowMultiple:false,modalOptions:{modalStyle:{"background-color":"#000",opacity:0.9}}});StickyWindow.update(false,{onComplete:function(){selfObj.initAjaxForms.delay(1000,selfObj,[selfObj,StickyWindow])}})})})},initAjaxForms:function(obj,winObj){var ajaxForms=$$(".withAjaxRequest");ajaxForms.each(function(element){if(element.hasClass("initialized")){return false}element.addEvent("submit",function(event){event.preventDefault();var windowContent=new Request.HTML({url:element.get("action"),method:"post",data:element.toQueryString(),update:winObj.id,evalScripts:"true",useWaiter:true,waiterOptions:{baseHref:"/fileadmin/template/licht2008/images/",img:{src:"ajax-loader.gif",styles:{width:24,height:24},"class":"waiterImg"},layer:{styles:{zIndex:10000,opacity:0.8,background:"#ffffff"},"class":"waitingDiv"},fxOptions:{duration:100}},onComplete:(function(e){obj.initAjaxForms(obj,winObj);
winObj.win.getElements("."+winObj.options.closeClassName).each(function(el){el.addEvent("click",winObj.hide.bind(winObj))},winObj)})}).send()})})}};window.addEvent("domready",function(){initializerStickyWin.initStickyWins()});window.addEvent("domready",function(){if(window.ie6){var elements=$$("#nav-main ul li a","#tools ul li.bookmark a")}else{var elements=$$("#nav-main ul li","#tools ul li.bookmark")}elements.each(function(element){element.addEvent("mouseenter",function(e){var elparent=element.getParent();var hoverelements=elparent.getElements(".hover");hoverelements.each(function(element){element.removeClass("hover")});element.addClass("hover")})});var topelements=$$("li.nav-main-lvl1-li","li.nav-main-lvl1-li-last","li.bookmark");topelements.each(function(topel){topel.addEvent("mouseleave",function(e){var hoverelements=$$("#nav-main .hover","#tools .hover");(function(){hoverelements.each(function(element){element.removeClass("hover")})}).delay(2000)})});$$("a.glossary-tooltip","a.newsfileTip").each(function(element,index){var content=element.get("title").split("::");
element.store("tip:title",content[0]);element.store("tip:text",content[1])});function d(name){console.debug(name)}var currentGlossaryLinkYPosition;$$("a.glossary-tooltip","a.newsfileTip").addEvent("mouseover",function(){var pos=this.getPosition();currentGlossaryLinkYPosition=pos.y;$$(".tipz",".newsTipz").setStyle("visibility","hidden")});if($$("a.glossary-tooltip","a.newsfileTip").length>0){$("ft").setStyle("height","250px")}var tipz=new Tips(".glossary-tooltip",{className:"tipz",fixed:true,hideDelay:50,showDelay:50,onShow:function(tip){tip.setStyle("visibility","hidden");tip.setStyle("top",currentGlossaryLinkYPosition-10);tip.setStyle("visibility","visible")},onHide:function(tip){tip.setStyle("top",currentGlossaryLinkYPosition);tip.setStyle("visibility","hidden")},offsets:{x:-240,y:-10}});var newsTipz=new Tips(".newsfileTip",{className:"newsTipz",fixed:true,hideDelay:50,showDelay:50,onShow:function(tip){tip.setStyle("visibility","hidden");tip.setStyle("top",currentGlossaryLinkYPosition-10);tip.setStyle("visibility","visible")
},onHide:function(tip){tip.setStyle("top",currentGlossaryLinkYPosition);tip.setStyle("visibility","hidden")},offsets:{x:-240,y:-10}});$$("a.goToTop").addEvent("click",function(){$$("body").scrollTo(0,0);return false})});function switchTextSize(mode,fileName){var i,a,buttonEl;var stylePath="fileadmin/template/licht2008/css/";var fileNameFromCooky=Cookie.read("Stylesheet");if(fileNameFromCooky==false){for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("media").indexOf("screen")!=-1&&a.getAttribute("title")){fileNameFromCooky=a.getAttribute("title");Cookie.write("Stylesheet",cookstyle,{duration:365,path:"/"})}}}switch(mode){case"set":new Asset.css(stylePath+fileName+".css",{id:fileName});Cookie.write("Stylesheet",fileName,{duration:365,path:"/"});break;default:new Asset.css(stylePath+fileNameFromCooky+".css",{id:fileName});break}if(fileName){var cmp=fileName}else{var cmp=fileNameFromCooky}if(cmp=="content_big"){for(i=0;(buttonEl=document.getElementsByTagName("button")[i]);
i++){if(buttonEl.getAttribute("name").indexOf("order")!=-1&&buttonEl.getAttribute("value").indexOf("in den Warenkorb")!=-1){buttonEl.innerHTML="in den <br />Warenkorb"}}}else{for(i=0;(buttonEl=document.getElementsByTagName("button")[i]);i++){if(buttonEl.getAttribute("name").indexOf("order")!=-1&&buttonEl.getAttribute("value").indexOf("in den")!=-1){buttonEl.innerHTML="in den Warenkorb"}}}return null}window.addEvent("domready",switchTextSize);