String.extend({stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"");},stripScripts:function(){return this.replace(/<script[^>]*?>.*?<\/script>/img,"");},evalScripts:function(){var scripts=this.match(/<script[^>]*?>.*?<\/script>/g);if(scripts){scripts.each(function(script){eval(script.replace(/^<script[^>]*?>/,"").replace(/<\/script>$/,""));});}},replaceAll:function(C,A,B){return this.replace(new RegExp(C,$pick(B,"gi")),A);},urlEncode:function(){return(this.test("%"))?this:escape(this);},parseQuery:function(C,A){C=$pick(C,true);A=$pick(A,true);var D=this.split(/[&;]/);var B={};if(D.length){D.each(function(F){var E=F.split("=");if(E.length&&E.length==2){B[(C)?encodeURIComponent(E[0]):E[0]]=(A)?encodeURIComponent(E[1]):E[1];}});}return B;},tidy:function(){var A=this.toString();$each({"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"},function(C,B){A=A.replace(new RegExp(B,"g"),C);});return A;}});$native(Date);Date.extend({clone:function(){return new Date(this.getTime());},increment:function(A,B){return this.multiply(A,B);},decrement:function(A,B){return this.multiply(A,B,false);},multiply:function(B,G,A){B=B||"day";G=$pick(G,1);A=$pick(A,true);var H=A?1:-1;var E=this.format("%m").toInt()-1;var C=this.format("%Y").toInt();var D=this.getTime();var F=0;switch(B){case"year":G.times(function(I){if(Date.isLeapYear(C+I)&&E>1&&H>0){I++;}if(Date.isLeapYear(C+I)&&E<=1&&H<0){I--;}F+=Date.$units.year(C+I);});break;case"month":G.times(function(K){var J=E+(K*H);var I=C;if(J<0){I--;J=12+J;}if(J>11||J<0){I+=(J/12).toInt()*H;J=J%12;}F+=Date.$units.month(J,I);});break;default:F=Date.$units[B]()*G;break;}this.setTime(D+(F*H));return this;},isLeapYear:function(){return Date.isLeapYear(this.getYear());},clearTime:function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;},diff:function(D,B){B=B||"day";if($type(D)=="string"){D=Date.parse(D);}switch(B){case"year":return D.format("%Y").toInt()-this.format("%Y").toInt();break;case"month":var A=(D.format("%Y").toInt()-this.format("%Y").toInt())*12;return A+D.format("%m").toInt()-this.format("%m").toInt();break;default:var C=D.getTime()-this.getTime();if(C<0&&Date.$units[B]()>(-1*(C))){return 0;}else{if(C>=0&&C<Date.$units[B]()){return 0;}}return((D.getTime()-this.getTime())/Date.$units[B]()).round();}},getTimezone:function(){return this.toString().replace(/^.*? ([A-Z]{3}).[0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");},getGMTOffset:function(){var A=this.getTimezoneOffset();return((A>0)?"-":"+")+Math.floor(Math.abs(A)/60).zeroise(2)+(A%60).zeroise(2);},parse:function(A){this.setTime(Date.parse(A));return this;},format:function(A){A=A||"%x %X";if(!this.valueOf()){return"invalid date";}if(Date.$formats[A.toLowerCase()]){A=Date.$formats[A.toLowerCase()];}var B=this;return A.replace(/\%([aAbBcdHIjmMpSUWwxXyYTZ])/g,function(C,D){switch(D){case"a":return Date.$days[B.getDay()].substr(0,3);case"A":return Date.$days[B.getDay()];case"b":return Date.$months[B.getMonth()].substr(0,3);case"B":return Date.$months[B.getMonth()];case"c":return B.toString();case"d":return B.getDate().zeroise(2);case"H":return B.getHours().zeroise(2);case"I":return((B.getHours()%12)||12).zeroise(2);case"j":return B.getDayOfYear().zeroise(3);case"m":return(B.getMonth()+1).zeroise(2);case"M":return B.getMinutes().zeroise(2);case"p":return B.getHours()<12?"AM":"PM";case"S":return B.getSeconds().zeroise(2);case"U":return B.getWeek().zeroise(2);case"W":throw new Error("%W is not supported yet");case"w":return B.getDay();case"x":return B.format("%m/%d/%Y");case"X":return B.format("%I:%M%p");case"y":return B.getFullYear().toString().substr(2);case"Y":return B.getFullYear();case"T":return B.getGMTOffset();case"Z":return B.getTimezone();case"%":return"%";}return D;});},setAMPM:function(A){A=A.toUpperCase();if(this.format("%H").toInt()>11&&A=="AM"){return this.decrement("hour",12);}else{if(this.format("%H").toInt()<12&&A=="PM"){return this.increment("hour",12);}}return this;}});Date.prototype.compare=Date.prototype.diff;Date.prototype.strftime=Date.prototype.format;Date.$nativeParse=Date.parse;$extend(Date,{$months:["January","February","March","April","May","June","July","August","September","October","November","December"],$days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],$daysInMonth:function(B,A){if(Date.isLeapYear(A.toInt())&&B===1){return 29;}return[31,28,31,30,31,30,31,31,30,31,30,31][B];},$epoch:-1,$era:-2,$units:{ms:function(){return 1;},second:function(){return 1000;},minute:function(){return 60000;},hour:function(){return 3600000;},day:function(){return 86400000;},week:function(){return 608400000;},month:function(C,A){var B=new Date();return Date.$daysInMonth($pick(C,B.format("%m").toInt()),$pick(A,B.format("%Y").toInt()))*86400000;},year:function(A){A=A||new Date().format("%Y").toInt();return Date.isLeapYear(A.toInt())?31622400000:31536000000;}},$formats:{db:"%Y-%m-%d %H:%M:%S",iso8601:"%Y-%m-%dT%H:%M:%S%T",rfc822:"%a, %d %b %Y %H:%M:%S %Z","short":"%d %b %H:%M","long":"%B %d, %Y %H:%M"},isLeapYear:function(A){return(((A%4)===0)&&((A%1000)!==0)||((A%4000)===0));},parseUTC:function(B){var A=new Date(B);var C=Date.UTC(A.getFullYear(),A.getMonth(),A.getDate(),A.getHours(),A.getMinutes(),A.getSeconds());return new Date(C);},parse:function(F){var C=$type(F);if(C=="number"){return new Date(str);}if(C!="string"){return F;}if(!F.length){return null;}for(var B=0,A=Date.$parsePatterns.length;B<A;B++){var D=Date.$parsePatterns[B].re.exec(F);if(D){try{return Date.$parsePatterns[B].handler(D);}catch(E){dbug.log("date parse error: ",E);return null;}}}return new Date(Date.$nativeParse(F));},parseMonth:function(D,C){var B=-1;switch($type(D)){case"object":B=Date.$months[D.getMonth()];break;case"number":B=Date.$months[D-1]||false;if(!B){throw new Error("Invalid month index value must be between 1 and 12:"+index);}break;case"string":var A=Date.$months.filter(function(E){return this.test(E);},new RegExp("^"+D,"i"));if(!A.length){throw new Error("Invalid month string");}if(A.length>1){throw new Error("Ambiguous month");}B=A[0];}return(C)?Date.$months.indexOf(B):B;},parseDay:function(A,D){var C=-1;switch($type(A)){case"number":C=Date.$days[A-1]||false;if(!C){throw new Error("Invalid day index value must be between 1 and 7");}break;case"string":var B=Date.$days.filter(function(E){return this.test(E);},new RegExp("^"+A,"i"));if(!B.length){throw new Error("Invalid day string");}if(B.length>1){throw new Error("Ambiguous day");}C=B[0];}return(D)?Date.$days.indexOf(C):C;},fixY2K:function(B){if(!isNaN(B)){var A=new Date(B);if(A.getFullYear()<2000&&B.toString().indexOf(A.getFullYear())<0){A.increment("year",100);}return A;}else{return B;}},$parsePatterns:[{re:/^(\d{1,2})[\.\-\/](\d{1,2})[\.\-\/](\d{2,4})$/,handler:function(A){var B=new Date();B.setYear(A[3]);B.setMonth(A[1].toInt()-1,A[2].toInt());return Date.fixY2K(B);}},{re:/^(\d{1,2})[\.\-\/](\d{1,2})[\.\-\/](\d{2,4})\s(\d{1,2}):(\d{1,2})(\w{2})$/,handler:function(A){var B=new Date();B.setYear(A[3]);B.setMonth(A[1]-1);B.setDate(A[2]);B.setHours(A[4]);B.setMinutes(A[5]);B.setAMPM(A[6]);return Date.fixY2K(B);}}]});Number.extend({zeroise:function(A){return String(this).zeroise(A);}});String.extend({repeat:function(C){var A=[];for(var B=0;B<C;B++){A.push(this);}return A.join("");},zeroise:function(A){return"0".repeat(A-this.length)+this;}});Date.extend({timeAgoInWords:function(){var A=(arguments.length>0)?arguments[1]:new Date();return Date.distanceOfTimeInWords(this,A,arguments[2]);},getOrdinal:function(){var A=this.toString();var B=A.substr(-(Math.min(A.length,2)));return(B>3&&B<21)?"th":["th","st","nd","rd","th"][Math.min(this%10,4)];},getDayOfYear:function(){return((Date.UTC(this.getFullYear(),this.getMonth(),this.getDate()+1,0,0,0)-Date.UTC(this.getFullYear(),0,1,0,0,0))/Date.$units.day());},getLastDayOfMonth:function(){var A=this.clone();A.setMonth(A.getMonth()+1,0);return A.getDate();},getWeek:function(){var A=(new Date(this.getFullYear(),0,1)).getDate();return Math.round((this.getDayOfYear()+(A>3?A-4:A+3))/7);}});$extend(Date,{distanceOfTimeInWords:function(D,B,C){var F=parseInt((B.getTime()-D.getTime())/1000);if(F<60){return"less than a minute ago";}else{if(F<120){return"about a minute ago";}else{if(F<(45*60)){return(parseInt(F/60)).toString()+" minutes ago";}else{if(F<(90*60)){return"about an hour ago";}else{if(F<(24*60*60)){return"about "+(parseInt(F/3600)).toString()+" hours ago";}else{if(F<(48*60*60)){return"1 day ago";}else{var E=(parseInt(F/86400)).toString();if(E>30){var A="%B %d";if(B.getYear()!=D.getYear()){A+=", %Y";}if(C){A+=" %I:%M %p";}return D.strftime(A);}else{return E+" days ago";}}}}}}}}});Date.$parsePatterns.extend([{re:/^(\d{4})(?:-?(\d{2})(?:-?(\d{2})(?:[T ](\d{2})(?::?(\d{2})(?::?(\d{2})(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d{2})(?::?(\d{2}))?)?)?)?)?)?$/,handler:function(A){var C=0;var B=new Date(A[1],0,1);if(A[2]){B.setMonth(A[2]-1);}if(A[3]){B.setDate(A[3]);}if(A[4]){B.setHours(A[4]);}if(A[5]){B.setMinutes(A[5]);}if(A[6]){B.setSeconds(A[6]);}if(A[7]){B.setMilliseconds(("0."+A[7]).toInt()*1000);}if(A[9]){C=(A[9].toInt()*60)+A[10].toInt();C*=((A[8]=="-")?1:-1);}C-=B.getTimezoneOffset();B.setTime((B*1)+(C*60*1000).toInt());return B;}},{re:/^tod/i,handler:function(){return new Date();}},{re:/^tom/i,handler:function(){return new Date().increment();}},{re:/^yes/i,handler:function(){return new Date().decrement();}},{re:/^(\d{1,2})(st|nd|rd|th)?$/i,handler:function(A){var B=new Date();B.setDate(A[1].toInt());return B;}},{re:/^(\d{1,2})(?:st|nd|rd|th)? (\w+)$/i,handler:function(A){var B=new Date();B.setMonth(Date.parseMonth(A[2],true),A[1].toInt());return B;}},{re:/^(\d{1,2})(?:st|nd|rd|th)? (\w+),? (\d{4})$/i,handler:function(A){var B=new Date();B.setMonth(Date.parseMonth(A[2],true),A[1].toInt());B.setYear(A[3]);return B;}},{re:/^(\w+) (\d{1,2})(?:st|nd|rd|th)?,? (\d{4})$/i,handler:function(A){var B=new Date();B.setMonth(Date.parseMonth(A[1],true),A[2].toInt());B.setYear(A[3]);return B;}},{re:/^next (\w+)$/i,handler:function(D){var E=new Date();var B=E.getDay();var C=Date.parseDay(D[1],true);var A=C-B;if(C<=B){A+=7;}E.setDate(E.getDate()+A);return E;}}]);window.extend({isLoaded:window.loaded,getHost:function(A){A=$pick(A,window.location.href);var B=A;if(A.test("http://")){A=A.substring(A.indexOf("http://")+7,A.length);if(A.test(":")){A=A.substring(0,A.indexOf(":"));}if(A.test("/")){return A.substring(0,A.indexOf("/"));}return A;}return false;},getQueryStringValue:function(B,A){try{return window.getQueryStringValues(A)[B];}catch(C){return null;}},getQueryStringValues:function(B){var A=$pick(B,$pick(window.location.search,"")).split("?")[1];if(A){return A.parseQuery();}return{};},getPort:function(C){C=$pick(C,window.location.href);var D=new RegExp(":([0-9]{4})");var A=D.exec(C);if(A==null){return false;}else{var B=false;A.each(function(E){if($chk(parseInt(E))){B=E;}});}return B;},qs:{}});window.qs=window.getQueryStringValues();window.popup=new Class({options:{width:500,height:300,x:50,y:50,toolbar:0,location:0,directories:0,status:0,scrollbars:"auto",resizable:1,name:"popup",onBlock:Class.empty},initialize:function(B,A){this.url=B||false;this.setOptions(A);if(this.url){this.openWin();}return this;},openWin:function(B){B=B||this.url;var A="toolbar="+this.options.toolbar+",location="+this.options.location+",directories="+this.options.directories+",status="+this.options.status+",scrollbars="+this.options.scrollbars+",resizable="+this.options.resizable+",width="+this.options.width+",height="+this.options.height+",top="+this.options.y+",left="+this.options.x;this.popupWindow=window.open(B,this.options.name,A);this.focus.delay(100,this);return this.popupWindow;},focus:function(){if(this.popupWindow){this.popupWindow.focus();}else{if(this.focusTries<10){this.focus.delay(100,this);}else{this.blocked=true;this.fireEvent("onBlock");}}return this;},focusTries:0,blocked:null,close:function(){this.popupWindow.close();}});window.popup.implement(new Options);window.popup.implement(new Events);var legacyPopup=window.popup.extend({setOptions:function(){this.parent();this.options=Object.extend({width:516,height:350},this.options);}});function openPop(A){return new legacyPopup(A);}var GetValue=window.getQueryStringValue;Element.extend({isVisible:function(){return this.getStyle("display")!="none";},toggle:function(){return this[this.isVisible()?"hide":"show"]();},hide:function(){this.originalDisplay=this.getStyle("display");this.setStyle("display","none");return this;},show:function(A){this.originalDisplay=(this.originalDisplay=="none")?"block":this.originalDisplay;this.setStyle("display",(A||this.originalDisplay||"block"));return this;},tidy:function(){try{if(this.getValue().tidy()){this.value=this.getValue().tidy();}}catch(A){dbug.log("element.tidy error: %o",A);}},findParent:function(A){return $$(A).filter(function(B){return B.hasChild(this);},this)[0];},fxOpacityOk:function(){if(!window.ie6){return true;}var A=false;try{if(new Color(this.getStyle("backgroundColor"))){A=true;}}catch(B){}return A;}});Element.visible=Element.isVisible;if(!Element.empty){Element.extend({empty:function(){return this.setHTML("");}});}var $S=$$;Element.extend({getDimensions:function(A){A=$merge({computeSize:false},A);var E={};function D(G,F){if(F.computeSize){E=G.getComputedSize(F);}else{E.width=G.getSize().size.x;E.height=G.getSize().size.y;}return E;}try{E=D(this,A);}catch(C){}if(this.getStyle("display")=="none"){var B={};["visibility","display","position"].each(function(F){B[F]=this.style[F]||"";},this);this.setStyles({visibility:"hidden",display:"block",position:"absolute"});E=D(this,A);this.setStyles(B);}return $merge(E,{x:E.width,y:E.height});},getComputedSize:function(A){A=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},A);var C={width:0,height:0};switch(A.mode){case"vertical":delete C.width;delete A.plains.width;break;case"horizontal":delete C.height;delete A.plains.height;break;}var B=[];$each(A.plains,function(G,F){G.each(function(H){A.styles.each(function(I){B.push((I=="border")?I+"-"+H+"-width":I+"-"+H);});});});var E=this.getStyles.apply(this,B);var D=[];$each(A.plains,function(G,F){C["total"+F.capitalize()]=0;C["computed"+F.capitalize()]=0;G.each(function(H){C["computed"+H.capitalize()]=0;B.each(function(J,I){if(J.test(H)){E[J]=E[J].toInt();if(isNaN(E[J])){E[J]=0;}C["total"+F.capitalize()]=C["total"+F.capitalize()]+E[J];C["computed"+H.capitalize()]=C["computed"+H.capitalize()]+E[J];}if(J.test(H)&&F!=J&&(J.test("border")||J.test("padding"))&&!D.test(J)){D.push(J);C["computed"+F.capitalize()]=C["computed"+F.capitalize()]-E[J];}});});});if($chk(C.width)){C.width=C.width+this.offsetWidth+C.computedWidth;C.totalWidth=C.width+C.totalWidth;delete C.computedWidth;}if($chk(C.height)){C.height=C.height+this.offsetHeight+C.computedHeight;C.totalHeight=C.height+C.totalHeight;delete C.computedHeight;}return $merge(E,C);}});Element.extend({getTextInRange:function(B,A){return this.getValue().substring(B,A);},getSelectedText:function(){if(window.ie){return document.selection.createRange().text;}return this.getValue().substring(this.getSelectionStart(),this.getSelectionEnd());},getSelectionStart:function(){if(window.ie){this.focus();var A=document.selection.createRange();if(A.compareEndPoints("StartToEnd",A)!=0){A.collapse(true);}return A.getBookmark().charCodeAt(2)-2;}return this.selectionStart;},getSelectionEnd:function(){if(window.ie){var A=document.selection.createRange();if(A.compareEndPoints("StartToEnd",A)!=0){A.collapse(false);}return A.getBookmark().charCodeAt(2)-2;}return this.selectionEnd;},getSelectedRange:function(){return{start:this.getSelectionStart(),end:this.getSelectionEnd()};},setCaretPosition:function(A){if(A=="end"){A=this.getValue().length;}this.selectRange(A,A);return this;},getCaretPosition:function(){return this.getSelectedRange().start;},selectRange:function(C,A){this.focus();if(window.ie){var B=this.createTextRange();B.collapse(true);B.moveStart("character",C);B.moveEnd("character",A-C);B.select();return this;}this.setSelectionRange(C,A);return this;},insertAtCursor:function(C,A){var D=this.getSelectionStart();var B=this.getSelectionEnd();this.value=this.getValue().substring(0,D)+C+this.getValue().substring(B,this.getValue().length);if($pick(A,true)){this.selectRange(D,D+C.length);}else{this.setCaretPosition(D+C.length);}return this;},insertAroundCursor:function(C,A){C=$merge({before:"",defaultMiddle:"SOMETHING HERE",after:""},C);value=this.getSelectedText()||C.defaultMiddle;var F=this.getSelectionStart();var B=this.getSelectionEnd();if(F==B){var E=this.getValue();this.value=E.substring(0,F)+C.before+value+C.after+E.substring(B,E.length);this.selectRange(F+C.before.length,B+C.before.length+value.length);E=null;}else{E=this.getValue().substring(F,B);this.value=this.getValue().substring(0,F)+C.before+E+C.after+this.getValue().substring(B,this.getValue().length);var D=F+C.before.length;if($pick(A,true)){this.selectRange(D,D+E.length);}else{this.setCaretPosition(D+E.length);}}return this;}});window.extend({supportsPositionFixed:function(){if(!window.loaded){return null;}var B=new Element("div").setStyles({position:"fixed",top:"0px",right:"0px"}).injectInside(document.body);var A=(B.offsetTop===0);B.remove();return A;}});Element.extend({pin:function(B){var C=this.getPosition();if(B!==false){if(!this.pinned){var D={top:(C.y-window.getScrollTop())+"px",left:(C.x-window.getScrollLeft())+"px"};if(window.supportsPositionFixed()){this.setStyle("position","fixed").setStyles(D);}else{this.setStyles({position:"absolute",top:C.y+"px",left:C.x+"px"});window.addEvent("scroll",function(){if(this.pinned){var E={top:(D.top.toInt()+window.getScrollTop())+"px",left:(D.left.toInt()+window.getScrollLeft())+"px"};this.setStyles(E);}}.bind(this));}this.pinned=true;}}else{this.pinned=false;var A=(window.supportsPositionFixed())?{top:(C.y+window.getScrollTop())+"px",left:(C.x+window.getScrollLeft())+"px"}:{top:(C.y)+"px",left:(C.x)+"px"};this.setStyles($merge(A,{position:"absolute"}));}return this;},unpin:function(){return this.pin(false);},togglepin:function(){this.pin(!this.pinned);}});Element.extend({setPosition:function(M){M=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,overflown:[]},M);var A={x:0,y:0};var E=false;if(this.getParent()!=document.body){var J=this.getParent();while(J!=document.body&&J.getStyle("position")=="static"){J=J.getParent();}if(J!=document.body){A=J.getPosition();E=true;}M.offset.x=M.offset.x-A.x;M.offset.y=M.offset.y-A.y;}function L(N){if($type(N)!="string"){return N;}N=N.toLowerCase();var O={};if(N.test("left")){O.x="left";}else{if(N.test("right")){O.x="right";}else{O.x="center";}}if(N.test("upper")||N.test("top")){O.y="top";}else{if(N.test("bottom")){O.y="bottom";}else{O.y="center";}}return O;}M.edge=L(M.edge);M.position=L(M.position);if(!M.edge){if(M.position.x=="center"&&M.position.y=="center"){M.edge={x:"center",y:"center"};}else{M.edge={x:"left",y:"top"};}}this.setStyle("position","absolute");var K=$(M.relativeTo)||document.body;if(window.opera){var I=(K==document.body)?window.getScrollTop():K.getTop();var D=(K==document.body)?window.getScrollLeft():K.getLeft();}else{var I=(K==document.body)?window.getScrollTop():K.getTop(M.overflown);var D=(K==document.body)?window.getScrollLeft():K.getLeft(M.overflown);}if(I<0){I=0;}if(D<0){D=0;}var F=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});if(M.ignoreMargins){M.offset.x+=((M.edge&&M.edge.x=="right")?F["margin-right"]:-F["margin-left"]);M.offset.y+=((M.edge&&M.edge.y=="bottom")?F["margin-bottom"]:-F["margin-top"]);}var H={};var B=M.offset.y.toInt();var C=M.offset.x.toInt();switch(M.position.x){case"left":H.x=D+C;break;case"right":H.x=D+C+K.offsetWidth;break;default:H.x=D+(((K==document.body)?window.getWidth():K.offsetWidth)/2)+C;break;}switch(M.position.y){case"top":H.y=I+B;break;case"bottom":H.y=I+B+K.offsetHeight;break;default:H.y=I+(((K==document.body)?window.getHeight():K.offsetHeight)/2)+B;break;}if(M.edge){var G={};switch(M.edge.x){case"left":G.x=0;break;case"right":G.x=-F.x-F.computedRight-F.computedLeft;break;default:G.x=-(F.x/2);break;}switch(M.edge.y){case"top":G.y=0;break;case"bottom":G.y=-F.y-F.computedTop-F.computedBottom;break;default:G.y=-(F.y/2);break;}H.x=H.x+G.x;H.y=H.y+G.y;}H={left:((H.x>=0||E)?H.x:0).toInt()+"px",top:((H.y>=0||E)?H.y:0).toInt()+"px"};if(K.getStyle("position")=="fixed"||M.relFixedPosition){H.top=H.top.toInt()+window.getScrollTop()+"px";H.left=H.left.toInt()+window.getScrollLeft()+"px";}if(M.returnPos){return H;}if(M.smoothMove){new Fx.SmoothMove(this,M).start();}else{this.setStyles(H);}return this;}});Fx.Marquee=Fx.Styles.extend({options:{mode:"horizontal",message:"",revert:true,delay:5000,cssClass:"msg",showEffect:{opacity:1},hideEffect:{opacity:0},revertEffect:{opacity:[0,1]},currentMessage:null,onRevert:Class.empty,onMessage:Class.empty},initialize:function(A,B){A=$(A);var C=this.options.currentMessage||(A.getChildren().length==1)?A.getFirst():"";var D=new Element("div",{styles:{position:"relative"},"class":"fxMarqueeWrapper"}).injectInside(A);this.parent(D,B);this.current=this.wrapMessage(C);},wrapMessage:function(A){if($(A)&&$(A).hasClass("fxMarquee")){var B=$(A);}else{var B=new Element("span",{"class":"fxMarquee",styles:{position:"relative"}});if($(A)){B.adopt($(A));}else{if($type(A)=="string"){B.setHTML(A);}}}return B.injectInside(this.element);},announce:function(A){this.setOptions(A).showMessage();return this;},showMessage:function(A){(function(){var B=this.chains?this.chains.copy():[];this.clearChain();this.element=$(this.element);this.current=$(this.current);this.message=$(this.message);this.start(this.options.hideEffect).chain(function(){if(A){this.message.hide();if(this.current){this.current.show();}}else{if(this.message){this.message.remove();}this.message=this.wrapMessage(this.options.message);if(this.current){this.current.hide();}}this.start((A)?this.options.revertEffect:this.options.showEffect).chain(function(){this.chains.merge(B);this.fireEvent((A)?"onRevert":"onMessage");if(!A&&this.options.revert){this.showMessage(true);}else{this.callChain.delay(this.options.delay,this);}}.bind(this));}.bind(this));}).delay((A)?this.options.delay:10,this);return this;}});Fx.SmoothShow=Fx.Styles.extend({options:{styles:["padding","border","margin"],transitionOpacity:true,mode:"vertical",heightOverride:null,widthOverride:null},fixStyle:function(C,B){if(!$type(C)=="number"){return C;}var A=["margin","padding","width","height"].some(function(D){return B.test(D,"i");});return(A)?C+"px":C;},hide:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;this.showing=false;this.hidden=true;var C=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});if(this.element.fxOpacityOk()&&this.options.transitionOpacity){C.opacity=1;}var A={};$each(C,function(E,D){A[D]=this.fixStyle(0,D);},this);this.chain(function(){if(this.hidden){this.hiding=false;$each(C,function(E,D){C[D]=this.fixStyle(E,D);},this);this.element.setStyles(C).setStyle("display","none");}this.callChain();}.bind(this));this.start(A);}else{this.callChain.delay(10,this);this.fireEvent("onComplete",this.element);}}}catch(B){this.element.hide();this.callChain.delay(10,this);this.fireEvent("onComplete",this.element);}return this;},show:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.showing=true;this.hiding=false;this.hidden=false;var B=this.element.getStyles("visibility","display","position");this.element.setStyles({visibility:"hidden",display:"block",position:"absolute"});if(this.element.fxOpacityOk()&&this.options.transitionOpacity){this.element.setStyle("opacity",0);}var D=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});this.element.setStyles(B);$each(D,function(F,E){D[E]=this.fixStyle(F,E);},this);if($chk(this.options.heightOverride)){D.height=this.options.heightOverride.toInt()+"px";}else{D.height;}if($chk(this.options.widthOverride)){D.width=this.options.widthOverride.toInt()+"px";}if(this.element.fxOpacityOk()&&this.options.transitionOpacity){D.opacity=1;}var A={height:"0px",display:"block"};$each(D,function(F,E){A[E]=this.fixStyle(0,E);},this);this.element.setStyles(A);this.start(D);this.chain(function(){if(!this.options.heightOverride){this.element.setStyle("height","auto");}if(!this.hidden){this.showing=false;}this.callChain();}.bind(this));}else{this.callChain();this.fireEvent("onComplete",this.element);}}}catch(C){this.element.setStyles({display:"block",visiblity:"visible",opacity:1});this.callChain.delay(10,this);this.fireEvent("onComplete",this.element);}return this;},toggle:function(){try{if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.show();}else{this.hide();}}catch(A){this.show();}return this;}});Fx.SmoothShow.implement(new Options);Fx.SmoothShow.implement(new Events);Element.extend({smoothShow:function(A){if(arguments[1]){A.heightOverride=arguments[1];}return new Fx.SmoothShow(this,A).show();},smoothHide:function(A){if(arguments[1]){A.heightOverride=arguments[1];}return new Fx.SmoothShow(this,A).hide();}});Fx.SmoothMove=Fx.Styles.extend({options:{relativeTo:document.body,position:"center",edge:false,offset:{x:0,y:0}},start:function(A){return this.parent(this.element.setPosition($merge(this.options,A,{returnPos:true})));}});Element.extend({smoothMove:function(A){return new Fx.SmoothMove(this,A).start();}});Fx.Sort=Fx.Elements.extend({options:{mode:"vertical"},initialize:function(B,A){this.parent(B,A);this.elements.each(function(C){if(C.getStyle("position")=="static"){C.setStyle("position","relative");}});this.setDefaultOrder();},setDefaultOrder:function(){this.currentOrder=this.elements.map(function(B,A){return A;});},sort:function(E){if($type(E)!="array"){return false;}var I=0;var A=0;var H={};var D=this.options.mode=="vertical";var F=this.elements.map(function(M,J){var L=M.getComputedSize({styles:["border","padding","margin"]});var N;if(D){N={top:I,margin:L["margin-top"],height:L.totalHeight};I+=N.height-L["margin-top"];}else{N={left:A,margin:L["margin-left"],width:L.totalWidth};A+=N.width;}var K=D?"top":"left";H[J]={};var O=M.getStyle(K).toInt();H[J][K]=($chk(O))?O:0;return N;},this);this.set(H);E=E.map(function(J){return J.toInt();});if(E.length!=this.elements.length){this.currentOrder.each(function(J){if(!E.contains(J)){E.push(J);}});if(E.length>this.elements.length){E.splice(this.elements.length-1,E.length-this.elements.length);}}var I=0;var A=0;var B=0;var C={};E.each(function(L,J){var K={};if(D){K.top=I-F[L].top-B;I+=F[L].height;}else{K.left=A-F[L].left;A+=F[L].width;}B=B+F[L].margin;C[L]=K;},this);var G={};E.copy().sort().each(function(J){G[J]=C[J];});this.start(G);this.currentOrder=E;return this;},rearrangeDOM:function(A){A=A||this.currentOrder;var B=this.elements[0].getParent();var C=[];this.elements.setStyle("opacity",0);A.each(function(D){C.push(this.elements[D].injectInside(B).setStyles({top:0,left:0}));},this);this.elements.setStyle("opacity",1);this.elements=$$(C);this.setDefaultOrder();return this;},getDefaultOrder:function(){return this.elements.map(function(B,A){return A;});},forward:function(){return this.sort(this.getDefaultOrder());},backward:function(){return this.sort(this.getDefaultOrder().reverse());},reverse:function(){return this.sort(this.currentOrder.reverse());},sortByElements:function(A){return this.sort(A.map(function(B){return this.elements.indexOf(B);}));},swap:function(E,D){if($type(E)=="element"){E=this.elements.indexOf(E);D=this.elements.indexOf(D);}var C=this.currentOrder.indexOf(E);var B=this.currentOrder.indexOf(D);var A=this.currentOrder.copy();A[C]=D;A[B]=E;this.sort(A);}});