/** * RightJS, http://rightjs.org * Released under the MIT license * * Copyright (C) 2008-2010 Nikolay Nemshilov */ var RightJS=function(u,l,s,O,w,X,da,q){function E(a){return J(a)?a:[a]}function wa(a,b){var c=a[0],d=P.call(a,1),e=b,f;if(typeof c==="string"){f=c;c=b.length!==0&&typeof b[0][f]==="function"?function(g){return g[f].apply(g,d)}:function(g){return g[f]}}else e=d[0];return[c,e]}function ea(){}function F(a,b,c){try{return a.apply(b,wa(c,b))}catch(d){if(!(d instanceof ea))throw d;}}function xa(a){return!!a}function ya(a,b){return a>b?1:a"+a+""+d[1];e-- >0;)c=c.firstChild;a=c.childNodes}b=0;for(c=a.length;bd)a.finish();else{a.render(b(e/d));e++}},c)}function C(a,b,c){c=i(c).compact();var d=r(c.last())?c.pop():{};b=new (p[b.capitalize()])(a,d);b.start.apply(b,c);return a}function gb(a){function b(){for(var g in f)e[g]=f[g]}var c=this.options,d=this.element,e=d._.style,f=s.only(d.computedStyles(),oa,Pa,Qa);this.onFinish(b).onCancel(function(){e[oa]="none";setTimeout(b,1)});e[oa]="all";e[Pa]=(p.Durations[c.duration]|| c.duration)+"ms";e[Qa]=hb[c.transition]||c.transition;setTimeout(function(){d.setStyle(a)},0)}function ib(a){var b=[],c=["Style","Color","Width"],d,e,f;for(d in a)if(d.startsWith("border"))for(e=0;e<3;e++)for(f=0;f<4;f++)b.push("border"+S[f]+c[e]);else if(d==="margin"||d==="padding"){e=b;f=d;for(var g=S,o=0;o-1;c--)if(a.call(b,this[c],c,this))return this[c]};ea.prototype=Error.prototype;O.include({indexOf:v.indexOf||function(a,b){for(var c=b<0?q.max(0,this.length+b):b||0;c-1;b--)if(this[b]===a)return b;return-1},first:function(){return arguments.length?F(tb,this,arguments):this[0]},last:function(){return arguments.length?F(ub,this,arguments):this[this.length-1]},random:function(){return this.length===0?undefined:this[q.random(this.length-1)]},size:function(){return this.length},clean:function(){this.length=0;return this},empty:function(){return this.length===0},clone:function(){return this.slice(0)},each:function(){F(Xa,this,arguments); return this},forEach:Xa,map:function(){return F(qb,this,arguments)},filter:function(){return F(ob,this,arguments)},reject:function(){return F(pb,this,arguments)},some:function(a){return F(rb,this,a?arguments:[xa])},every:function(a){return F(sb,this,a?arguments:[xa])},walk:function(){this.map.apply(this,arguments).forEach(function(a,b){this[b]=a},this);return this},merge:function(){for(var a=this.clone(),b,c=0;c 0;b=q.random(d-1),c=a[--d],a[d]=a[b],a[b]=c);return a},sort:function(a){return nb.apply(this,a||!Va(this[0])?arguments:[ya])},sortBy:function(){var a=wa(arguments,this);return this.sort(function(b,c){return ya(a[0].call(a[1],b),a[0].call(a[1],c))})},min:function(){return q.min.apply(q,this)},max:function(){return q.max.apply(q,this)},sum:function(){for(var a=0,b=0;b]+>/ig,"")},stripScripts:function(a){var b="",c=this.replace(/]*>([\s\S]*?)<\/script>/img,function(d,e){b+=e+"\n";return""});if(a===true)Ua(b);else V(a)&&a(b,c);return c},extractScripts:function(){var a="";this.stripScripts(function(b){a=b});return a},evalScripts:function(){this.stripScripts(true);return this}, camelize:function(){return this.replace(/(\-|_)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})},underscored:function(){return this.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-/g,"_").toLowerCase()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},includes:function(a){return this.indexOf(a)!=-1},startsWith:function(a,b){return(b!==true?this.indexOf(a):this.toLowerCase().indexOf(a.toLowerCase()))===0},endsWith:function(a,b){return this.length-(b!== true?this.lastIndexOf(a):this.toLowerCase().lastIndexOf(a.toLowerCase()))===a.length},toInt:function(a){return parseInt(this,a===undefined?10:a)},toFloat:function(a){return parseFloat(a===true?this:this.replace(",",".").replace(/(\d)-(\d)/g,"$1.$2"))}});w.prototype.include=w.prototype.includes;X.include({bind:function(){var a=i(arguments),b=a.shift(),c=this;return function(){return c.apply(b,a.length||arguments.length?a.concat(i(arguments)):a)}},bindAsEventListener:function(){var a=i(arguments),b= a.shift(),c=this;return function(d){return c.apply(b,[d].concat(a).concat(i(arguments)))}},curry:function(){return this.bind.apply(this,[this].concat(i(arguments)))},rcurry:function(){var a=i(arguments),b=this;return function(){return b.apply(b,i(arguments).concat(a))}},delay:function(){var a=i(arguments),b=a.shift();a=new da(setTimeout(this.bind.apply(this,[this].concat(a)),b));a.cancel=function(){clearTimeout(this)};return a},periodical:function(){var a=i(arguments),b=a.shift();a=new da(setInterval(this.bind.apply(this, [this].concat(a)),b));a.stop=function(){clearInterval(this)};return a},chain:function(){var a=i(arguments),b=a.shift(),c=this;return function(){var d=c.apply(c,arguments);b.apply(b,a);return d}}});da.include({times:function(a,b){for(var c=0;c=a;d--)b.call(c,d);return this},abs:function(){return q.abs(this)},round:function(a){return a?parseFloat(this.toFixed(a)): q.round(this)},ceil:function(){return q.ceil(this)},floor:function(){return q.floor(this)},min:function(a){return thisa?a:this+0}});RegExp.escape=function(a){return(""+a).replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1")};var j=h.Class=function(){var a=i(arguments).slice(0,2),b=a.pop()||{},c=a.pop(),d=arguments[2],e=function(){};if(!a.length&&!r(b)){c=b;b={}}if(!d&&c&&(c===z||c.ancestors.include(z)))d=bb();d=m(d||function(){Ba(this);return"initialize"in this? this.initialize.apply(this,arguments):this},Ya);c=c||j;e.prototype=c.prototype;d.prototype=new e;d.parent=c;d.prototype.constructor=d;for(d.ancestors=[];c;){d.ancestors.push(c);c=c.parent}["extend","include"].each(function(f){f in b&&d[f].apply(d,E(b[f]))});return d.include(b)},Ya={extend:function(){i(arguments).filter(r).each(function(a){m(this,za(a,true));Aa(this,a,true)},this);return this},include:function(){var a=[this].concat(this.ancestors);i(arguments).filter(r).each(function(b){s.each(za(b, false),function(c,d){for(var e,f=0;f");ca.OLD=true;Ga=function(a,b){if(a==="input"&&b!==undefined)a='',"after");D(this.id).on("load",this.onLoad.bind(this))},send:function(){this.form.set("target",this.id).submit()},onLoad:function(){this.status= 200;this.readyState=4;this.form.set("target","");try{this.responseText=u[this.id].document.documentElement.innerHTML}catch(a){}this.onreadystatechange()}});k.JSONP=new j({include:k.Dummy,prefix:"jsonp",initialize:function(a){this.xhr=a;this.name=this.prefix+(new Date).getTime();this.param=(B(a.jsonp)?a.jsonp:"callback")+"="+this.name;this.script=Ta("script",{charset:a.encoding,async:a.async})},open:function(a,b){this.url=b;this.method=a},send:function(a){u[this.name]=this.finish.bind(this);this.script.set("src", this.url+(this.url.include("?")?"&":"?")+this.param+"&"+a).insertTo(ma("script").last(),"after")},finish:function(a){this.status=200;this.readyState=4;this.xhr.json=this.xhr.responseJSON=a;this.onreadystatechange()}});var p=h.Fx=new j(W,{extend:{EVENTS:G("start finish cancel"),Durations:{"short":200,normal:400,"long":800},Options:{fps:y?40:60,duration:"normal",transition:"Sin",queue:true},Transitions:{Sin:function(a){return-(q.cos(q.PI*a)-1)/2},Cos:function(a){return q.asin((a-0.5)*2)/q.PI+0.5},Exp:function(a){return q.pow(2, 8*(a-1))},Log:function(a){return 1-q.pow(2,-8*a)},Lin:function(a){return a}}},initialize:function(a,b){this.$super(b);this.element=D(a);var c=aa((this.element||{})._||{});this.ch=ta[c]=ta[c]||[];this.cr=ua[c]=ua[c]||[]},start:function(){var a;a=arguments;var b=this.ch,c=this.options.queue;if(!b||this.$ch)a=this.$ch=false;else{c&&b.push([a,this]);a=c&&b[0][1]!==this}if(a)return this;b=this.options;a=p.Transitions[b.transition]||b.transition;b=((p.Durations[b.duration]||b.duration)/1E3*this.options.fps).ceil(); c=(1E3/this.options.fps).round();this.cr&&this.cr.push(this);this.prepare.apply(this,arguments);fb(this,a,c,b);return this.fire("start",this)},finish:function(){this._timer&&clearInterval(this._timer);Oa(this);this.fire("finish");var a=this.ch,b=a.shift();if(b=a[0]){b[1].$ch=true;b[1].start.apply(b[1],b[0])}return this},cancel:function(){this._timer&&clearInterval(this._timer);Oa(this);return this.fire("cancel")},prepare:function(){},render:function(){}}),ta=[],ua=[];w.COLORS={maroon:"#800000",red:"#ff0000", orange:"#ffA500",yellow:"#ffff00",olive:"#808000",purple:"#800080",fuchsia:"#ff00ff",white:"#ffffff",lime:"#00ff00",green:"#008000",navy:"#000080",blue:"#0000ff",aqua:"#00ffff",teal:"#008080",black:"#000000",silver:"#c0c0c0",gray:"#808080",brown:"#a52a2a"};w.include({toHex:function(){var a=/^#(\w)(\w)(\w)$/.exec(this);return a=a?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:(a=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(this))?"#"+a.slice(1).map(function(b){b=(b-0).toString(16);return b.length==1?"0"+b:b}).join(""): w.COLORS[this]||this},toRgb:function(a){var b=/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(this.toHex()||"");if(b){b=b.slice(1).map("toInt",16);b=a?b:"rgb("+b+")"}return b}});n.include({stop:function(){var a=aa(this._);(ua[a]||[]).each("cancel");(ta[a]||[]).splice(0);return this},hide:function(a,b){return a&&this.visible()?C(this,a,["out",b]):this.$super()},show:function(a,b){return a&&!this.visible()?C(this,a,["in",b]):this.$super()},toggle:function(a,b){return a?C(this,a,["toggle",b]):this.$super()}, remove:function(a,b){return a&&this.visible()?C(this,a,["out",m(b||{},{onFinish:this.$super.bind(this)})]):this.$super()},morph:function(a,b){return C(this,"morph",[a,b||{}])},highlight:function(){return C(this,"highlight",arguments)},fade:function(){return C(this,"fade",arguments)},slide:function(){return C(this,"slide",arguments)},scroll:function(a,b){return C(this,"scroll",[a,b||{}])},scrollTo:function(a,b){return r(b)?this.scroll(a,b):this.$super.apply(this,arguments)}});var va=["WebkitT","OT", "MozT","MsT","t"].first(function(a){return a+"ransition"in qa.style});U=va+"ransition";var oa=U+"Property",Pa=U+"Duration",Qa=U+"TimingFunction",hb={Sin:"cubic-bezier(.3,0,.6,1)",Cos:"cubic-bezier(0,.3,.6,0)",Log:"cubic-bezier(0.6,.3,.8)",Exp:"cubic-bezier(.6,0,.8,.3)",Lin:"cubic-bezier(0,0,1,1)"};p.Options.engine=va===undefined||Q?"javascript":"native";p.Morph=new j(p,{prepare:function(a){if(this.options.engine==="native"&&va!==undefined){this.render=this.transition=function(){};gb.call(this,a)}else{var b= ib(a),c=Sa(this.element,b);a=kb(this.element,a,b);jb(this.element,c,a);this.before=Ra(c);this.after=Ra(a)}},render:function(a){var b,c,d,e=this.element._.style,f,g,o;for(f in this.after){b=this.before[f];c=this.after[f];g=0;for(o=c.length;g