var Roar=new Class({Implements:[Options,Events,Chain],options:{duration:4000,position:"upperLeft",container:null,bodyFx:null,itemFx:null,margin:{x:10,y:10},offset:5,className:"roar",onShow:$empty,onHide:$empty,onRender:$empty,style:"notice"},initialize:function(options){this.setOptions(options);this.items=[];this.container=$(this.options.container)||document},alert:function(title,message,options){var params=Array.link(arguments,{title:String.type,message:String.type,options:Object.type});var items=[new Element("h3",{html:$pick(params.title,"")})];if(params.message){items.push(new Element("p",{html:params.message}))}return this.inject(items,params.options)},inject:function(elements,options){if(!this.body){this.render()}options=options||{};var offset=[-this.options.offset,0];var last=this.items.getLast();if(last){offset[0]=last.retrieve("roar:offset");offset[1]=offset[0]+last.offsetHeight+this.options.offset}var to={opacity:1};to[this.align.y]=offset;var item=new Element("div",{"class":this.options.className,opacity:0}).adopt(new Element("div",{"class":this.options.className+"-bg",opacity:0.7}),elements);item.setStyle(this.align.x,0).store("roar:offset",offset[1]).set("morph",$merge({unit:"px",link:"cancel",onStart:Chain.prototype.clearChain,transition:Fx.Transitions.Back.easeOut},this.options.itemFx));var remove=this.remove.create({bind:this,arguments:[item],delay:10});this.items.push(item.addEvent("click",remove));if(this.options.duration){var over=false;var trigger=(function(){trigger=null;if(!over){remove()}}).delay(this.options.duration);item.addEvents({mouseover:function(){over=true},mouseout:function(){over=false;if(!trigger){remove()}}})}item.inject(this.body).morph(to);return this.fireEvent("onShow",[item,this.items.length])},remove:function(item){var index=this.items.indexOf(item);if(index==-1){return this}this.items.splice(index,1);item.removeEvents();var to={opacity:0};to[this.align.y]=item.getStyle(this.align.y).toInt()-item.offsetHeight-this.options.offset;item.morph(to).get("morph").chain(item.destroy.bind(item));return this.fireEvent("onHide",[item,this.items.length]).callChain(item)},empty:function(){while(this.items.length){this.remove(this.items[0])}return this},render:function(){this.position=this.options.position;if($type(this.position)=="string"){var position={x:"center",y:"center"};this.align={x:"left",y:"top"};if((/left|west/i).test(this.position)){position.x="left"}else{if((/right|east/i).test(this.position)){this.align.x=position.x="right"}}if((/upper|top|north/i).test(this.position)){position.y="top"}else{if((/bottom|lower|south/i).test(this.position)){this.align.y=position.y="bottom"}}this.position=position}this.body=new Element("div",{"class":this.options.className+"-body"}).inject(document.body);if(Browser.Engine.trident4){this.body.addClass(this.options.className+"-body-ugly")}this.moveTo=this.body.setStyles.bind(this.body);this.reposition();if(this.options.bodyFx){var morph=new Fx.Morph(this.body,$merge({unit:"px",chain:"cancel",transition:Fx.Transitions.Circ.easeOut},this.options.bodyFx));this.moveTo=morph.start.bind(morph)}var repos=this.reposition.bind(this);window.addEvents({scroll:repos,resize:repos});this.fireEvent("onRender",this.body)},reposition:function(){var max=document.getCoordinates(),scroll=document.getScroll(),margin=this.options.margin;max.left+=scroll.x;max.right+=scroll.x;max.top+=scroll.y;max.bottom+=scroll.y;var rel=($type(this.container)=="element")?this.container.getCoordinates():max;this.moveTo({left:(this.position.x=="right")?(Math.min(rel.right,max.right)-margin.x):(Math.max(rel.left,max.left)+margin.x),top:(this.position.y=="bottom")?(Math.min(rel.bottom,max.bottom)-margin.y):(Math.max(rel.top,max.top)+margin.y)})}});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))};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.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.get("text");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 PieChart=new Class({options:{pieChartRadius:60,td_label_index:0,td_index:1,index:1},initialize:function(elData,el,options){this.setOptions(options);this.pieChartRadius=this.options.pieChartRadius;this.pieChartDiameter=this.pieChartRadius*2;this.pieVertices=12;this.arcIncrementMultiplier=1/this.pieVertices;this.index=0;this.tableIndex=this.options.index;this.areaIndex=1;this.canvas="";this.container="";this.data_table="";this.insertElements(el);aData=this.makeData(elData);this.makePieChart(aData);this.addToolTips()},insertElements:function(el){this.container=new Element("div",{id:"pieChartContainer"+this.tableIndex}).injectBefore($(el)).addClass("pieChartContainer");this.data_table=el.clone().injectBottom(this.container);el.dispose();new Element("div",{id:"pieChartWrapper"+this.tableIndex}).injectTop(this.container).addClass("pieChartWrapper");this.canvas=new Element("canvas",{id:"canvas"+this.tableIndex,width:this.pieChartDiameter,height:this.pieChartDiameter}).injectInside(this.container.getElement(".pieChartWrapper")).addClass("pieChartCanvas");new Element("map",{id:"pieChartMap"+this.tableIndex,name:"pieChartMap"+this.tableIndex}).injectBottom(this.container).addClass("pieChartMap");new Asset.image(DIR_STATIC_SKIN+"/images/spacer.gif",{alt:"",usemap:"#pieChartMap"+this.tableIndex,width:this.pieChartDiameter,height:this.pieChartDiameter}).injectInside(this.container.getElement(".pieChartWrapper")).setStyles({width:this.pieChartDiameter,height:this.pieChartDiameter});new Element("div").injectBottom(this.container).addClass("clear")},makeData:function(elData){var aData=[];elData.getChildren().each(function(el){var data=el.getChildren();if($(data[0])){var color=data[0].getStyle("background").match(/#\w+/i);aData.extend([{label:el.get("text"),value:data[1].get("text"),color:data[0].getStyle("background").match(/#\w+/i)[0]}])}});return aData},makePieChart:function(aData){var data=[],color,colors=[],labels=[],values=[],total=0,value=0;aData.each(function(item,index){labels[colors.length]=item.label;value=parseFloat(item.value);values[colors.length]=value;total+=value;colors[colors.length]=item.color.hexToRgb()},this);var ctx=this.canvas.getContext("2d");var tableLength=colors.length;for(piece=0;piece<tableLength;piece++){var thisvalue=values[piece]/total;var arcStartAngle=Math.PI*(-0.5+2*this.index);var arcEndAngle=Math.PI*(-0.5+2*(this.index+thisvalue));ctx.beginPath();ctx.moveTo(this.pieChartRadius,this.pieChartRadius);ctx.arc(this.pieChartRadius,this.pieChartRadius,this.pieChartRadius,arcStartAngle,arcEndAngle,false);ctx.closePath();ctx.fillStyle=colors[piece];ctx.fill();ctx.lineWidth=1;ctx.beginPath();ctx.moveTo(this.pieChartRadius,this.pieChartRadius);ctx.arc(this.pieChartRadius,this.pieChartRadius,this.pieChartRadius,arcStartAngle,arcEndAngle,false);ctx.closePath();ctx.strokeStyle="#FFF";ctx.stroke();var arcIncrement=(arcEndAngle-arcStartAngle)*this.arcIncrementMultiplier;var xx=this.pieChartRadius+Math.round(Math.cos(arcStartAngle)*this.pieChartRadius);var yy=this.pieChartRadius+Math.round(Math.sin(arcStartAngle)*this.pieChartRadius);var coord=[];var coordIndex=1;for(i=0;i<((this.pieVertices*2)-2);i=i+2){var arcAngle=arcStartAngle+arcIncrement*coordIndex;coord[i]=this.pieChartRadius+Math.round(Math.cos(arcAngle)*this.pieChartRadius);coord[i+1]=this.pieChartRadius+Math.round(Math.sin(arcAngle)*this.pieChartRadius);coordIndex++}var xxEnd=this.pieChartRadius+Math.round(Math.cos(arcEndAngle)*this.pieChartRadius);var yyEnd=this.pieChartRadius+Math.round(Math.sin(arcEndAngle)*this.pieChartRadius);var myArea="area"+this.tableIndex+"-"+piece;new Element("area",{id:myArea,shape:"poly",coords:this.pieChartRadius+","+this.pieChartRadius+","+xx+","+yy+","+coord.join(",")+","+xxEnd+","+yyEnd,title:labels[piece]}).injectInside(this.container.getElement(".pieChartMap"));this.index+=thisvalue}this.tableIndex++},addToolTips:function(){new Tips($$(document.getElementsByTagName("area")),{showDelay:10,hideDelay:10})},getColor:function(i,totalSteps){var colori=i*100/totalSteps;var frequency=Math.PI*2/totalSteps;var center=190;var amplitude=60;var rgb=[];rgb[0]=Math.round(Math.sin(frequency*i+0)*amplitude+center);rgb[1]=Math.round(Math.sin(frequency*i+2)*amplitude+center);rgb[2]=Math.round(Math.sin(frequency*i+4)*amplitude+center);return"rgb("+rgb.join(",")+")"}});PieChart.implement(new Options);var vlaCalendar=new Class({slideDuration:500,fadeDuration:500,transition:Fx.Transitions.Quart.easeOut,startMonday:false,filePath:"inc/",defaultView:"month",style:"",initialize:function(_container,_options){if(_options){$extend(this,_options)}this.loading=false;this.container=_container=$(_container);var _class=this;var pars="defaultView="+this.defaultView;if(this.picker){if($type(this.prefillDate)=="object"&&this.getInputDate(this.prefillDate)){pars+="&pickedDate="+this.getInputDate(this.prefillDate)}if(this.linkWithInput){pars+="&gotoPickedDate=1"}}this.u("base",pars,function(){_class.mainLoader=_container.getElement("div[class=loaderA]");_class.tempLoader=_container.getElement("div[class=loaderB]");_class.label=_container.getElement("span[class=label]");_class.arrowLeft=_container.getElement("div[class=arrowLeft]");_class.arrowRight=_container.getElement("div[class=arrowRight]");_class.initializeCalendarFunctions();if(_class.picker){if($type(_class.prefillDate)=="object"&&_class.getInputDate(_class.prefillDate)){_class.pick(_class.prefillDate)}else{if(_class.prefillDate==true){_class.pick(JSON.decode(_class.label.getProperty("date")))}}}},_container)},initializeCalendarFunctions:function(){this.resetArrows();var vars=JSON.decode(this.mainLoader.getElement("table").getProperty("summary"));var _class=this;this.label.removeClass("noHover").set("html",vars.label).onclick=vars.parent?function(){_class.u(vars.parent,"ts="+vars.ts+"&parent="+vars.current,function(){_class.fade()})}:null;if(vars.hide_left_arrow){this.hideLeftArrow()}else{if(vars.hide_right_arrow){this.hideRightArrow()}}this.arrowLeft.onclick=function(){_class.u(vars.current,"ts="+vars.pr_ts,function(){_class.slideLeft()})};this.arrowRight.onclick=function(){_class.u(vars.current,"ts="+vars.nx_ts,function(){_class.slideRight()})};var clickables=this.mainLoader.getElements("td");switch(vars.current){case"month":if(this.picker){clickables.each(function(_clickable){_clickable.onclick=function(){_class.pick(JSON.decode(_clickable.getProperty("date")));_class.mainLoader.getElements("td").each(function(_clickable){_clickable.removeClass("selected")});this.addClass("selected")}})}break;case"year":clickables.each(function(_clickable){_clickable.onclick=function(){_class.u("month","ts="+_clickable.getProperty("ts"),function(){_class.fade()})}});break;case"decade":this.label.addClass("noHover");clickables.each(function(_clickable){_clickable.onclick=function(){_class.u("year","ts="+_clickable.getProperty("ts")+"&m_ts="+_clickable.getProperty("m_ts"),function(){_class.fade()})}});break}},u:function(_url,_pars,_onComplete,_id){if(!this.loading&&!this.transitioning){var _class=this;this.loading=true;var element=$(_id?_id:this.tempLoader);_pars+="&picker="+(this.picker?1:0)+"&startMonday="+(this.startMonday?1:0)+"&style="+this.style;if(this.picker&&this.getInputDate()){_pars+="&pickedDate="+this.getInputDate()}new Request({method:"post",url:this.filePath+_url+".php",onComplete:function(data){element.set("html",data);_onComplete();_class.loading=false}}).send(_pars)}},slideLeft:function(){var _class=this;this.transitioning=true;this.tempLoader.setStyle("opacity",1).set("tween",{duration:this.slideDuration,transition:this.transition}).tween("margin-left",[-164,0]);this.mainLoader.setStyle("opacity",1).set("tween",{duration:this.slideDuration,transition:this.transition,onComplete:function(){_class.transitioning=false}}).tween("margin-left",[0,164]);this.switchLoaders()},slideRight:function(){var _class=this;this.transitioning=true;this.mainLoader.setStyle("opacity",1).set("tween",{duration:this.slideDuration,transition:this.transition}).tween("margin-left",[0,-164]);this.tempLoader.setStyle("opacity",1).set("tween",{duration:this.slideDuration,transition:this.transition,onComplete:function(){_class.transitioning=false}}).tween("margin-left",[164,0]);this.switchLoaders()},fade:function(overRuleTrans){var _class=this;this.transitioning=overRuleTrans?false:true;this.tempLoader.setStyles({opacity:0,"margin-left":0});this.mainLoader.set("tween",{duration:this.fadeDuration,transition:this.transition}).fade("out");this.tempLoader.set("tween",{duration:this.fadeDuration,transition:this.transition,onComplete:function(){_class.tempLoader.setStyles({opacity:1,"margin-left":-999});_class.transitioning=false}}).fade("in");this.switchLoaders()},switchLoaders:function(){this.mainLoader=this.mainLoader.className=="loaderA"?this.container.getElement("div[class=loaderB]"):this.container.getElement("div[class=loaderA]");this.tempLoader=this.tempLoader.className=="loaderA"?this.container.getElement("div[class=loaderB]"):this.container.getElement("div[class=loaderA]");this.initializeCalendarFunctions()},resetArrows:function(){this.arrowLeft.setStyle("visibility","visible");this.arrowRight.setStyle("visibility","visible")},hideLeftArrow:function(){this.arrowLeft.setStyle("visibility","hidden")},hideRightArrow:function(){this.arrowRight.setStyle("visibility","hidden")}});var vlaDatePicker=new Class({Extends:vlaCalendar,separateInput:false,prefillDate:true,linkWithInput:true,leadingZero:true,twoDigitYear:false,separator:"/",format:"d/m/y",openWith:null,alignX:"right",alignY:"inputTop",offset:{x:0,y:0},style:"",ieTransitionColor:"#ffffff",toggleDuration:350,initialize:function(_element,_options){if(_options){$extend(this,_options)}this.element=$(_element);if(!this.element){throw"No (existing) element to create a datepicker for specified: new vlaDatePicker(ELEMENT, [options])"}if(this.separateInput){this.element.day=this.element.getElement("input[name="+this.separateInput.day+"]");this.element.month=this.element.getElement("input[name="+this.separateInput.month+"]");this.element.year=this.element.getElement("input[name="+this.separateInput.year+"]")}this.picker=new Element("div",{"class":"vlaCalendarPicker"+(this.style!=""?" "+this.style:"")}).injectTop($(document.body));this.pickerContent=new Element("div",{"class":"pickerBackground"}).injectTop(this.picker);this.parent(this.pickerContent);var _class=this;(this.openWith?$(this.openWith):this.element).addEvent("focus",function(){_class.show()}).addEvent("click",function(){_class.openWith?_class.toggle():_class.show()}).addEvent("change",function(){_class.hide()});document.addEvent("mousedown",function(e){if(_class.outsideHide&&_class.outsideClick(e,_class.picker)){_class.hide()}});if(this.linkWithInput){if(this.separateInput){this.element.day.addEvent("keyup",function(){_class.linkedUpdate()});this.element.month.addEvent("keyup",function(){_class.linkedUpdate()});this.element.year.addEvent("keyup",function(){_class.linkedUpdate()})}else{this.element.addEvent("keyup",function(){_class.linkedUpdate()})}}this.visible=false;this.outsideHide=false},position:function(){var top,left;switch(this.alignX){case"left":left=this.element.getLeft();break;case"center":var pickerMiddle=this.pickerContent.getStyle("width").toInt()/2;if(pickerMiddle==0){pickerMiddle=83}left=this.element.getLeft()+(this.element.getSize().x/2)-pickerMiddle-((parseInt(this.pickerContent.getStyle("padding-left"))+parseInt(this.pickerContent.getStyle("padding-right")))/2);break;case"right":default:left=this.element.getLeft()+this.element.getSize().x;break}switch(this.alignY){case"bottom":top=this.getPos(this.element).y+this.element.getSize().y;break;case"top":top=this.getPos(this.element).y-parseInt(this.pickerContent.getStyle("height"))-(parseInt(this.pickerContent.getStyle("padding-top"))+parseInt(this.pickerContent.getStyle("padding-bottom")));break;case"inputTop":default:top=this.getPos(this.element).y}if(this.isNumber(this.offset.x)){left+=this.offset.x}if(this.isNumber(this.offset.y)){top+=this.offset.y}this.picker.setStyles({top:top,left:left})},show:function(){this.position();if(!this.visible){this.visible=true;var _class=this;this.picker.setStyles({opacity:0,display:"inline"});if(Browser.Engine.trident5){this.picker.setStyle("background-color",this.ieTransitionColor)}this.picker.set("tween",{onComplete:function(){if(Browser.Engine.trident5){_class.picker.setStyle("background-color","transparent")}_class.outsideHide=true},duration:this.toggleDuration}).fade("in")}},hide:function(){if(this.visible){this.visible=false;var _class=this;if(Browser.Engine.trident5){this.picker.setStyle("background-color",this.ieTransitionColor)}this.picker.set("tween",{onComplete:function(){_class.picker.setStyle("display","none");_class.outsideHide=false},duration:this.toggleDuration}).fade("out")}},toggle:function(){if(this.visible){this.hide()}else{this.show()}},pick:function(_date){if(this.leadingZero){if(_date.day<10){_date.day="0"+_date.day}if(_date.month<10){_date.month="0"+_date.month}}if(this.twoDigitYear){_date.year=_date.year.toString().substring(2,4)}if(this.separateInput){if(this.element.day){this.element.day.set("value",_date.day)}if(this.element.month){this.element.month.set("value",_date.month)}if(this.element.year){this.element.year.set("value",_date.year)}this.hide()}else{switch(this.format){case"m/d/y":this.element.set("value",_date.month+this.separator+_date.day+this.separator+_date.year);break;case"y/m/d":this.element.set("value",_date.year+this.separator+_date.month+this.separator+_date.day);break;case"y/d/m":this.element.set("value",_date.year+this.separator+_date.day+this.separator+_date.month);break;case"d/m/y":default:this.element.set("value",_date.day+this.separator+_date.month+this.separator+_date.year)}this.hide()}},getInputDate:function(_date){var day,month,year;if(_date){day=_date.day;month=_date.month;year=_date.year}else{if(this.separateInput){day=this.element.day.get("value").toInt();month=this.element.month.get("value").toInt();year=this.element.year.get("value").toInt()}else{var date=this.element.get("value").split(this.separator);if(date.length!=3){return null}switch(this.format){case"m/d/y":day=date[1];month=date[0];year=date[2];break;case"y/m/d":day=date[2];month=date[1];year=date[0];break;case"y/d/m":day=date[1];month=date[2];year=date[0];break;case"d/m/y":default:day=date[0];month=date[1];year=date[2]}}}if(!this.isNumber(day)||!this.isNumber(month)||!this.isNumber(year)||day==0||month==0||year=="0"||(this.twoDigitYear&&year>99)||(!this.twoDigitYear&&year<1979)||(!this.twoDigitYear&&year>2030)||month>12||day>31){return null}if(this.twoDigitYear&&this.isNumber(year)&&year<100){year=year.toInt();if(year<10){year="200"+year}else{if(year<70){year="20"+year}else{if(year>69){year="19"+year}else{year=new Date().getFullYear()}}}}return day+"/"+month+"/"+year},linkedUpdate:function(){var _class=this;var date=this.getInputDate();if(date&&this.pickedDate!=date){this.u("month","gotoPickedDate=1",function(){_class.fade(true)});this.pickedDate=date}},outsideClick:function(_event,_element){var mousePos=this.getMousePos(_event);var elementData=_element.getCoordinates();return(mousePos.x>elementData.left&&mousePos.x<(elementData.left+elementData.width))&&(mousePos.y>elementData.top&&mousePos.y<(elementData.top+elementData.height))?false:true},getMousePos:function(_event){if(document.all){return{x:window.event.clientX+window.getScrollLeft(),y:window.event.clientY+window.getScrollTop()}}else{return{x:_event.page.x,y:_event.page.y}}},isNumber:function(_number){if(_number==""){return false}return(_number>=0)||(_number<0)?true:false},getPos:function(_element){var x,y=0;if(_element.offsetParent){do{x+=_element.offsetLeft;y+=_element.offsetTop}while(_element=_element.offsetParent)}else{if(_element.x){x+=_element.x;y+=_element.y}}return{x:x,y:y}}});function H(){var x=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);H=function(){return x};return x}(function(){function x(b){b=b.split(/ /g);var a={};for(var c=b.length;--c>=0;){var d=b[c];if(d){a[d]=null}}return a}var y="break continue do else for if return while ",U=y+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile ",D=U+"catch class delete false import new operator private protected public this throw true try ",I=D+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",J=D+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",V=J+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ",K=D+"debugger eval export function get null set undefined var with Infinity NaN ",L="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",M=y+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",N=y+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",O=y+"case done elif esac eval fi function in local set then until ",W=I+V+K+L+M+N+O;function X(b){return b>="a"&&b<="z"||b>="A"&&b<="Z"}function u(b,a,c,d){b.unshift(c,d||0);try{a.splice.apply(a,b)}finally{b.splice(0,2)}}var Y=(function(){var b=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],a="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)";for(var c=0;c<b.length;++c){var d=b[c];a+=X(d.charAt(0))?"|\\b"+d:"|"+d.replace(/([^=<>:&])/g,"\\$1")}a+="|^)\\s*$";return new RegExp(a)})(),P=/&/g,Q=/</g,R=/>/g,Z=/\"/g;function $(b){return b.replace(P,"&amp;").replace(Q,"&lt;").replace(R,"&gt;").replace(Z,"&quot;")}function E(b){return b.replace(P,"&amp;").replace(Q,"&lt;").replace(R,"&gt;")}var aa=/&lt;/g,ba=/&gt;/g,ca=/&apos;/g,da=/&quot;/g,ea=/&amp;/g,fa=/&nbsp;/g;function ga(b){var a=b.indexOf("&");if(a<0){return b}for(--a;(a=b.indexOf("&#",a+1))>=0;){var c=b.indexOf(";",a);if(c>=0){var d=b.substring(a+3,c),g=10;if(d&&d.charAt(0)==="x"){d=d.substring(1);g=16}var e=parseInt(d,g);if(!isNaN(e)){b=b.substring(0,a)+String.fromCharCode(e)+b.substring(c+1)}}}return b.replace(aa,"<").replace(ba,">").replace(ca,"'").replace(da,'"').replace(ea,"&").replace(fa," ")}function S(b){return"XMP"===b.tagName}function z(b,a){switch(b.nodeType){case 1:var c=b.tagName.toLowerCase();a.push("<",c);for(var d=0;d<b.attributes.length;++d){var g=b.attributes[d];if(!g.specified){continue}a.push(" ");z(g,a)}a.push(">");for(var e=b.firstChild;e;e=e.nextSibling){z(e,a)}if(b.firstChild||!/^(?:br|link|img)$/.test(c)){a.push("</",c,">")}break;case 2:a.push(b.name.toLowerCase(),'="',$(b.value),'"');break;case 3:case 4:a.push(E(b.nodeValue));break}}var F=null;function ha(b){if(null===F){var a=document.createElement("PRE");a.appendChild(document.createTextNode('<!DOCTYPE foo PUBLIC "foo bar">\n<foo />'));F=!/</.test(a.innerHTML)}if(F){var c=b.innerHTML;if(S(b)){c=E(c)}return c}var d=[];for(var g=b.firstChild;g;g=g.nextSibling){z(g,d)}return d.join("")}function ia(b){var a=0;return function(c){var d=null,g=0;for(var e=0,h=c.length;e<h;++e){var f=c.charAt(e);switch(f){case"\t":if(!d){d=[]}d.push(c.substring(g,e));var i=b-a%b;a+=i;for(;i>=0;i-="                ".length){d.push("                ".substring(0,i))}g=e+1;break;case"\n":a=0;break;default:++a}}if(!d){return c}d.push(c.substring(g));return d.join("")}}var ja=/(?:[^<]+|<!--[\s\S]*?--\>|<!\[CDATA\[([\s\S]*?)\]\]>|<\/?[a-zA-Z][^>]*>|<)/g,ka=/^<!--/,la=/^<\[CDATA\[/,ma=/^<br\b/i;function na(b){var a=b.match(ja),c=[],d=0,g=[];if(a){for(var e=0,h=a.length;e<h;++e){var f=a[e];if(f.length>1&&f.charAt(0)==="<"){if(ka.test(f)){continue}if(la.test(f)){c.push(f.substring(9,f.length-3));d+=f.length-12}else{if(ma.test(f)){c.push("\n");++d}else{g.push(d,f)}}}else{var i=ga(f);c.push(i);d+=i.length}}}return{source:c.join(""),tags:g}}function v(b,a){var c={};(function(){var g=b.concat(a);for(var e=g.length;--e>=0;){var h=g[e],f=h[3];if(f){for(var i=f.length;--i>=0;){c[f.charAt(i)]=h}}}})();var d=a.length;return function(g,e){e=e||0;var h=[e,"pln"],f="",i=0,j=g;while(j.length){var o,m=null,k,l=c[j.charAt(0)];if(l){k=j.match(l[1]);m=k[0];o=l[0]}else{for(var n=0;n<d;++n){l=a[n];var p=l[2];if(p&&!p.test(f)){continue}k=j.match(l[1]);if(k){m=k[0];o=l[0];break}}if(!m){o="pln";m=j.substring(0,1)}}h.push(e+i,o);i+=m.length;j=j.substring(m.length);if(o!=="com"&&/\S/.test(m)){f=m}}return h}}var oa=v([],[["pln",/^[^<]+/,null],["dec",/^<!\w[^>]*(?:>|$)/,null],["com",/^<!--[\s\S]*?(?:--\>|$)/,null],["src",/^<\?[\s\S]*?(?:\?>|$)/,null],["src",/^<%[\s\S]*?(?:%>|$)/,null],["src",/^<(script|style|xmp)\b[^>]*>[\s\S]*?<\/\1\b[^>]*>/i,null],["tag",/^<\/?\w[^<>]*>/,null]]);function pa(b){var a=oa(b);for(var c=0;c<a.length;c+=2){if(a[c+1]==="src"){var d,g;d=a[c];g=c+2<a.length?a[c+2]:b.length;var e=b.substring(d,g),h=e.match(/^(<[^>]*>)([\s\S]*)(<\/[^>]*>)$/);if(h){a.splice(c,2,d,"tag",d+h[1].length,"src",d+h[1].length+(h[2]||"").length,"tag")}}}return a}var qa=v([["atv",/^\'[^\']*(?:\'|$)/,null,"'"],["atv",/^\"[^\"]*(?:\"|$)/,null,'"'],["pun",/^[<>\/=]+/,null,"<>/="]],[["tag",/^[\w:\-]+/,/^</],["atv",/^[\w\-]+/,/^=/],["atn",/^[\w:\-]+/,null],["pln",/^\s+/,null," \t\r\n"]]);function ra(b,a){for(var c=0;c<a.length;c+=2){var d=a[c+1];if(d==="tag"){var g,e;g=a[c];e=c+2<a.length?a[c+2]:b.length;var h=b.substring(g,e),f=qa(h,g);u(f,a,c,2);c+=f.length-2}}return a}function r(b){var a=[],c=[];if(b.tripleQuotedStrings){a.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(b.multiLineStrings){a.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{a.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}c.push(["pln",/^(?:[^\'\"\`\/\#]+)/,null," \r\n"]);if(b.hashComments){a.push(["com",/^#[^\r\n]*/,null,"#"])}if(b.cStyleComments){c.push(["com",/^\/\/[^\r\n]*/,null])}if(b.regexLiterals){c.push(["str",/^\/(?:[^\\\*\/\[]|\\[\s\S]|\[(?:[^\]\\]|\\.)*(?:\]|$))+(?:\/|$)/,Y])}if(b.cStyleComments){c.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null])}var d=x(b.keywords);b=null;var g=v(a,c),e=v([],[["pln",/^\s+/,null," \r\n"],["pln",/^[a-z_$@][a-z_$@0-9]*/i,null],["lit",/^0x[a-f0-9]+[a-z]/i,null],["lit",/^(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d+)(?:e[+\-]?\d+)?[a-z]*/i,null,"123456789"],["pun",/^[^\s\w\.$@]+/,null]]);function h(f,i){for(var j=0;j<i.length;j+=2){var o=i[j+1];if(o==="pln"){var m,k,l,n;m=i[j];k=j+2<i.length?i[j+2]:f.length;l=f.substring(m,k);n=e(l,m);for(var p=0,t=n.length;p<t;p+=2){var w=n[p+1];if(w==="pln"){var A=n[p],B=p+2<t?n[p+2]:l.length,s=f.substring(A,B);if(s==="."){n[p+1]="pun"}else{if(s in d){n[p+1]="kwd"}else{if(/^@?[A-Z][A-Z$]*[a-z][A-Za-z$]*$/.test(s)){n[p+1]=s.charAt(0)==="@"?"lit":"typ"}}}}}u(n,i,j,2);j+=n.length-2}}return i}return function(f){var i=g(f);i=h(f,i);return i}}var G=r({keywords:W,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function sa(b,a){for(var c=0;c<a.length;c+=2){var d=a[c+1];if(d==="src"){var g,e;g=a[c];e=c+2<a.length?a[c+2]:b.length;var h=G(b.substring(g,e));for(var f=0,i=h.length;f<i;f+=2){h[f]+=g}u(h,a,c,2);c+=h.length-2}}return a}function ta(b,a){var c=false;for(var d=0;d<a.length;d+=2){var g=a[d+1],e,h;if(g==="atn"){e=a[d];h=d+2<a.length?a[d+2]:b.length;c=/^on|^style$/i.test(b.substring(e,h))}else{if(g==="atv"){if(c){e=a[d];h=d+2<a.length?a[d+2]:b.length;var f=b.substring(e,h),i=f.length,j=i>=2&&/^[\"\']/.test(f)&&f.charAt(0)===f.charAt(i-1),o,m,k;if(j){m=e+1;k=h-1;o=f}else{m=e+1;k=h-1;o=f.substring(1,f.length-1)}var l=G(o);for(var n=0,p=l.length;n<p;n+=2){l[n]+=m}if(j){l.push(k,"atv");u(l,a,d+2,0)}else{u(l,a,d,2)}}c=false}}}return a}function ua(b){var a=pa(b);a=ra(b,a);a=sa(b,a);a=ta(b,a);return a}function va(b,a,c){var d=[],g=0,e=null,h=null,f=0,i=0,j=ia(8);function o(k){if(k>g){if(e&&e!==h){d.push("</span>");e=null}if(!e&&h){e=h;d.push('<span class="',e,'">')}var l=E(j(b.substring(g,k))).replace(/(\r\n?|\n| ) /g,"$1&nbsp;").replace(/\r\n?|\n/g,"<br />");d.push(l);g=k}}while(true){var m;m=f<a.length?(i<c.length?a[f]<=c[i]:true):false;if(m){o(a[f]);if(e){d.push("</span>");e=null}d.push(a[f+1]);f+=2}else{if(i<c.length){o(c[i]);h=c[i+1];i+=2}else{break}}}o(b.length);if(e){d.push("</span>")}return d.join("")}var C={};function q(b,a){for(var c=a.length;--c>=0;){var d=a[c];if(!C.hasOwnProperty(d)){C[d]=b}else{if("console" in window){console.log("cannot override language handler %s",d)}}}}q(G,["default-code"]);q(ua,["default-markup","html","htm","xhtml","xml","xsl"]);q(r({keywords:I,hashComments:true,cStyleComments:true}),["c","cc","cpp","cs","cxx","cyc"]);q(r({keywords:J,cStyleComments:true}),["java"]);q(r({keywords:O,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);q(r({keywords:M,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);q(r({keywords:L,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);q(r({keywords:N,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);q(r({keywords:K,cStyleComments:true,regexLiterals:true}),["js"]);function T(b,a){try{var c=na(b),d=c.source,g=c.tags;if(!C.hasOwnProperty(a)){a=/^\s*</.test(d)?"default-markup":"default-code"}var e=C[a].call({},d);return va(d,g,e)}catch(h){if("console" in window){console.log(h);console.trace()}return b}}function wa(b){var a=H(),c=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],d=[];for(var g=0;g<c.length;++g){for(var e=0;e<c[g].length;++e){d.push(c[g][e])}}c=null;var h=0;function f(){var i=(new Date).getTime()+250;for(;h<d.length&&(new Date).getTime()<i;h++){var j=d[h];if(j.className&&j.className.indexOf("prettyprint")>=0){var o=j.className.match(/\blang-(\w+)\b/);if(o){o=o[1]}var m=false;for(var k=j.parentNode;k;k=k.parentNode){if((k.tagName==="pre"||k.tagName==="code"||k.tagName==="xmp")&&k.className&&k.className.indexOf("prettyprint")>=0){m=true;break}}if(!m){var l=ha(j);l=l.replace(/(?:\r\n?|\n)$/,"");var n=T(l,o);if(!S(j)){j.innerHTML=n}else{var p=document.createElement("PRE");for(var t=0;t<j.attributes.length;++t){var w=j.attributes[t];if(w.specified){p.setAttribute(w.name,w.value)}}p.innerHTML=n;j.parentNode.replaceChild(p,j);p=j}if(a&&j.tagName==="PRE"){var A=j.getElementsByTagName("br");for(var B=A.length;--B>=0;){var s=A[B];s.parentNode.replaceChild(document.createTextNode("\r\n"),s)}}}}}if(h<d.length){setTimeout(f,250)}else{if(b){b()}}}f()}window.PR_normalizedHtml=z;window.prettyPrintOne=T;window.prettyPrint=wa;window.PR={createSimpleLexer:v,registerLangHandler:q,sourceDecorator:r,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();var lsVote;var lsVoteClass=new Class({Implements:Options,options:{classes_action:{voted:"voted",plus:"plus",minus:"minus",positive:"positive",negative:"negative",quest:"quest"},classes_element:{voting:"voting",count:"count",total:"total",plus:"plus",minus:"minus"}},typeVote:{comment:{url:DIR_WEB_ROOT+"/include/ajax/voteComment.php",targetName:"idComment"},topic:{url:DIR_WEB_ROOT+"/include/ajax/voteTopic.php",targetName:"idTopic"},blog:{url:DIR_WEB_ROOT+"/include/ajax/voteBlog.php",targetName:"idBlog"},user:{url:DIR_WEB_ROOT+"/include/ajax/voteUser.php",targetName:"idUser"}},initialize:function(options){this.setOptions(options)},vote:function(idTarget,objVote,value,type){if(!this.typeVote[type]){return false}this.idTarget=idTarget;this.objVote=$(objVote);this.value=value;this.type=type;thisObj=this;var params=new Hash();params.value=value;params[this.typeVote[type].targetName]=idTarget;params.security_ls_key=LIVESTREET_SECURITY_KEY;JsHttpRequest.query("POST "+this.typeVote[type].url,params,function(result,errors){thisObj.onVote(result,errors,thisObj)},true)},onVote:function(result,errors,thisObj){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg)}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);var divVoting=thisObj.objVote.getParent("."+thisObj.options.classes_element.voting);divVoting.addClass(thisObj.options.classes_action.voted);if(this.value>0){divVoting.addClass(thisObj.options.classes_action.plus)}if(this.value<0){divVoting.addClass(thisObj.options.classes_action.minus)}var divCount=divVoting.getChildren("."+thisObj.options.classes_element.count);if(divCount&&divCount[0]){divCount.set("text",result.iCountVote)}var divTotal=divVoting.getChildren("."+thisObj.options.classes_element.total);result.iRating=parseFloat(result.iRating);divVoting.removeClass(thisObj.options.classes_action.negative);divVoting.removeClass(thisObj.options.classes_action.positive);if(result.iRating>0){divVoting.addClass(thisObj.options.classes_action.positive);divTotal.set("text","+"+result.iRating)}if(result.iRating<0){divVoting.addClass(thisObj.options.classes_action.negative);divTotal.set("text",result.iRating)}if(result.iRating==0){divTotal.set("text","0")}if(thisObj.type=="user"&&$("user_skill_"+thisObj.idTarget)){$("user_skill_"+thisObj.idTarget).set("text",result.iSkill)}}}});window.addEvent("domready",function(){lsVote=new lsVoteClass()});var lsFavourite;var lsFavouriteClass=new Class({Implements:Options,options:{classes_action:{active:"active",quest:"quest"},classes_element:{favorite:"favorite"}},typeFavourite:{topic:{url:DIR_WEB_ROOT+"/include/ajax/topicFavourite.php",targetName:"idTopic"},comment:{url:DIR_WEB_ROOT+"/include/ajax/commentFavourite.php",targetName:"idComment"},talk:{url:DIR_WEB_ROOT+"/include/ajax/talkFavourite.php",targetName:"idTalk"}},initialize:function(options){this.setOptions(options)},toggle:function(idTarget,objFavourite,type){if(!this.typeFavourite[type]){return false}this.idTarget=idTarget;this.objFavourite=$(objFavourite);this.value=value;this.type=type;thisObj=this;var value=1;if(this.objFavourite.getParent("."+this.options.classes_element.favorite).hasClass(this.options.classes_action.active)){value=0}var params=new Hash();params.type=value;params[this.typeFavourite[type].targetName]=idTarget;params.security_ls_key=LIVESTREET_SECURITY_KEY;JsHttpRequest.query("POST "+this.typeFavourite[type].url,params,function(result,errors){thisObj.onToggle(result,errors,thisObj)},true)},onToggle:function(result,errors,thisObj){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg)}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);var divFavourite=thisObj.objFavourite.getParent("."+thisObj.options.classes_element.favorite);divFavourite.removeClass(thisObj.options.classes_action.active);if(result.bState){divFavourite.addClass(thisObj.options.classes_action.active)}}}});window.addEvent("domready",function(){lsFavourite=new lsFavouriteClass()});function ajaxQuestionVote(idTopic,idAnswer){JsHttpRequest.query("POST "+DIR_WEB_ROOT+"/include/ajax/questionVote.php",{idTopic:idTopic,idAnswer:idAnswer,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg)}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);if($("topic_question_area_"+idTopic)){$("topic_question_area_"+idTopic).set("html",result.sText)}}},true)}var lsBlockLoaderClass=new Class({Implements:Options,options:{classes_nav:{nav:"block-nav",content:"block-content",active:"active"}},type:{comment_stream:{url:DIR_WEB_ROOT+"/include/ajax/stream_comment.php"},topic_stream:{url:DIR_WEB_ROOT+"/include/ajax/stream_topic.php"},blogs_top:{url:DIR_WEB_ROOT+"/include/ajax/blogs_top.php"},blogs_join:{url:DIR_WEB_ROOT+"/include/ajax/blogs_join.php"},blogs_self:{url:DIR_WEB_ROOT+"/include/ajax/blogs_self.php"}},initialize:function(options){this.setOptions(options)},toggle:function(obj,type,params){if(!this.type[type]){return false}thisObj=this;this.obj=$(obj);var liCurrent=thisObj.obj.getParent("li");var blockNav=liCurrent.getParent("ul."+thisObj.options.classes_nav.nav);var liList=blockNav.getChildren("li");liList.each(function(li,index){li.removeClass(thisObj.options.classes_nav.active)});liCurrent.addClass(this.options.classes_nav.active);var blockContent=blockNav.getParent("div").getChildren("div."+this.options.classes_nav.content)[0].set("html","");this.showStatus(blockContent);if(!params){params={security_ls_key:LIVESTREET_SECURITY_KEY}}else{params.security_ls_key=LIVESTREET_SECURITY_KEY}JsHttpRequest.query("POST "+this.type[type].url,params,function(result,errors){thisObj.onLoad(result,errors,blockContent)},true)},onLoad:function(result,errors,blockContent){blockContent.set("html","");if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){}else{blockContent.set("html",result.sText)}},showStatus:function(obj){var newDiv=new Element("div");newDiv.setStyle("text-align","center");newDiv.set("html",'<img src="'+DIR_STATIC_SKIN+'/images/loader.gif" >');newDiv.inject(obj)}});function toogleFriendForm(obj){var friendForm=$("add_friend_form");var slideForm=new Fx.Slide("add_friend_form");friendForm.getElements("textarea").set("value","");if(friendForm.getStyle("display")=="none"){friendForm.setStyle("display","block");slideForm.hide()}slideForm.toggle();slideForm.addEvent("complete",function(){friendForm.getElement("textarea").focus()})}function ajaxAddUserFriend(obj,idUser,sAction){obj=$(obj).getParent("li");if(sAction!="link"&&sAction!="accept"){sText=obj.getElement("form textarea").get("value");obj.getElement("form").getChildren().each(function(item){item.setProperty("disabled","disabled")})}else{sText=""}if(sAction=="accept"){sPath=aRouter.profile+"ajaxfriendaccept/"}else{sPath=aRouter.profile+"ajaxfriendadd/"}JsHttpRequest.query("POST "+sPath,{idUser:idUser,userText:sText,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later");obj.getElement("form").getChildren().each(function(item){item.removeProperty("disabled")})}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg);obj.getElement("form").getChildren().each(function(item){item.removeProperty("disabled")})}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);if(obj){item=new Element("li",{html:result.sToggleText});item.getElement("li").inject(obj.getParent("ul"),"top");obj.dispose()}}},true)}function ajaxDeleteUserFriend(obj,idUser,sAction){obj=$(obj).getParent("li");JsHttpRequest.query("POST "+aRouter.profile+"ajaxfrienddelete/",{idUser:idUser,sAction:sAction,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg)}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);if(obj){item=new Element("li",{html:result.sToggleText});item.getElement("li").inject(obj.getParent("ul"),"top");obj.dispose()}}},true)}function ajaxJoinLeaveBlog(obj,idBlog){obj=$(obj);JsHttpRequest.query("POST "+DIR_WEB_ROOT+"/include/ajax/joinLeaveBlog.php",{idBlog:idBlog,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert(result.sMsgTitle,result.sMsg)}else{msgNoticeBox.alert(result.sMsgTitle,result.sMsg);if(obj){obj.getParent().removeClass("active");if(result.bState){obj.getParent().addClass("active")}divCount=$("blog_user_count_"+idBlog);if(divCount){divCount.set("text",result.iCountUser)}}}},true)}function ajaxBlogInfo(idBlog){JsHttpRequest.query("POST "+DIR_WEB_ROOT+"/include/ajax/blogInfo.php",{idBlog:idBlog,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){}else{if($("block_blog_info")){$("block_blog_info").set("html",result.sText)}}},true)}function ajaxTextPreview(textId,save,divPreview){var text;if(BLOG_USE_TINYMCE&&tinyMCE&&(ed=tinyMCE.get(textId))){text=ed.getContent()}else{text=$(textId).value}JsHttpRequest.query("POST "+DIR_WEB_ROOT+"/include/ajax/textPreview.php",{text:text,save:save,security_ls_key:LIVESTREET_SECURITY_KEY},function(result,errors){if(!result){msgErrorBox.alert("Error","Please try again later")}if(result.bStateError){msgErrorBox.alert("Error","Please try again later")}else{if(!divPreview){divPreview="text_preview"}if($(divPreview)){$(divPreview).set("html",result.sText).setStyle("display","block")}}},true)}function addField(btn){tr=btn;while(tr.tagName!="TR"){tr=tr.parentNode}var newTr=tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);checkFieldForLast()}function checkFieldForLast(){btns=document.getElementsByName("drop_answer");for(i=0;i<btns.length;i++){btns[i].disabled=false}if(btns.length<=2){btns[0].disabled=true;btns[1].disabled=true}}function dropField(btn){tr=btn;while(tr.tagName!="TR"){tr=tr.parentNode}tr.parentNode.removeChild(tr);checkFieldForLast()}function checkAllTalk(checkbox){$$(".form_talks_checkbox").each(function(chk){if(checkbox.checked){chk.checked=true}else{chk.checked=false}})}function checkAllReport(checkbox){$$(".form_reports_checkbox").each(function(chk){if(checkbox.checked){chk.checked=true}else{chk.checked=false}})}function checkAllPlugins(checkbox){$$(".form_plugins_checkbox").each(function(chk){if(checkbox.checked){chk.checked=true}else{chk.checked=false}})}function showImgUploadForm(){if(Browser.Engine.trident){}if(!winFormImgUpload){winFormImgUpload=new StickyWin.Modal({content:$("window_load_img"),closeClassName:"close-block",useIframeShim:false,modalOptions:{modalStyle:{"z-index":900}}})}winFormImgUpload.show();winFormImgUpload.pin(true);$$("input[name=img_file]").set("value","");$$("input[name=img_url]").set("value","http://");return false}function hideImgUploadForm(){winFormImgUpload.hide()}var winFormImgUpload;function ajaxUploadImg(value,sToLoad){var req=new JsHttpRequest();req.onreadystatechange=function(){if(req.readyState==4){if(req.responseJS.bStateError){msgErrorBox.alert(req.responseJS.sMsgTitle,req.responseJS.sMsg)}else{lsPanel.putText(sToLoad,req.responseJS.sText);hideImgUploadForm()}}};req.open(null,DIR_WEB_ROOT+"/include/ajax/uploadImg.php",true);req.send({value:value,security_ls_key:LIVESTREET_SECURITY_KEY})}function showLoginForm(){if(Browser.Engine.trident){return true}if(!winFormLogin){winFormLogin=new StickyWin.Modal({content:$("login-form"),closeClassName:"close-block",useIframeShim:false})}winFormLogin.show();winFormLogin.pin(true);return false}function hideLoginForm(){winFormLogin.hide()}var winFormLogin=false;var lsPanelClass=new Class({initialize:function(){},putText:function(obj,text){obj=$(obj);var scrollLeft=obj.scrollLeft;var scrollTop=obj.scrollTop;if(Browser.Engine.trident&&document.selection){obj.focus();sel=document.selection.createRange();sel.text=text}else{obj.insertAtCursor(text)}obj.scrollLeft=scrollLeft;obj.scrollTop=scrollTop},putTag:function(obj,tag){this.putText(obj,"<"+tag+"/>")},putTextAround:function(obj,textStart,textEnd){obj=$(obj);var scrollLeft=obj.scrollLeft;var scrollTop=obj.scrollTop;if(Browser.Engine.trident&&document.selection){obj.focus();sel=document.selection.createRange();sel.text=textStart+sel.text+textEnd}else{obj.insertAroundCursor({before:textStart,defaultMiddle:"",after:textEnd})}obj.scrollLeft=scrollLeft;obj.scrollTop=scrollTop},putTagAround:function(obj,tagStart,tagEnd){if(!tagEnd){tagEnd=tagStart}this.putTextAround(obj,"<"+tagStart+">","</"+tagEnd+">")},putTagUrl:function(obj,sPromt){obj=$(obj);if(url=prompt(sPromt,"http://")){var sel=obj.getSelectedText();this.putText(obj,'<a href="'+url+'">'+sel+"</a>")}},putQuote:function(obj){obj=$(obj);if(selText=this.getSelectedText()){this.putText(obj,"<blockquote>"+selText+"</blockquote>")}else{this.putTagAround(obj,"blockquote")}},getSelectedText:function(){if(Browser.Engine.trident){return document.selection.createRange().text}return document.getSelection()},putList:function(obj,select){obj=$(obj);typeList=select.value;if(selText=obj.getSelectedText()){selText=selText.replace("/\r/g","");selText=selText!=""?selText:" ";selText=selText.replace(new RegExp("^(.+)","gm"),"\t<li>$1</li>");this.putText(obj,"<"+typeList+">\n"+selText+"\n</"+typeList+">")}else{this.putTextAround(obj,"<"+typeList+">\n\t<li>","</li>\n</"+typeList+">")}select.selectedIndex=0}});var lsPanel;window.addEvent("domready",function(){lsPanel=new lsPanelClass()});
