/**************** MooTools 1.2.4.2 More ****************/
MooTools.More={version:"1.2.4.2",build:"bd5a93c0913cce25917c48cbdacde568e15e02ef"};(function(){var c=this;var b=function(){if(c.console&&console.log){try{console.log.apply(console,arguments);
}catch(d){console.log(Array.slice(arguments));}}else{Log.logged.push(arguments);}return this;};var a=function(){this.logged.push(arguments);return this;
};this.Log=new Class({logged:[],log:a,resetLog:function(){this.logged.empty();return this;},enableLog:function(){this.log=b;this.logged.each(function(d){this.log.apply(this,d);
},this);return this.resetLog();},disableLog:function(){this.log=a;return this;}});Log.extend(new Log).enableLog();Log.logger=function(){return this.log.apply(this,arguments);
};})();Class.refactor=function(b,a){$each(a,function(e,d){var c=b.prototype[d];if(c&&(c=c._origin)&&typeof e=="function"){b.implement(d,function(){var f=this.previous;
this.previous=c;var g=e.apply(this,arguments);this.previous=f;return g;});}else{b.implement(d,e);}});return b;};Class.Mutators.Binds=function(a){return a;
};Class.Mutators.initialize=function(a){return function(){$splat(this.Binds).each(function(b){var c=this[b];if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);
};};Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);var a=b.retrieve(c||this.property);if(a&&!$defined(this.occluded)){return this.occluded=a;
}this.occluded=false;b.store(c||this.property,this);return this.occluded;}});Array.implement({min:function(){return Math.min.apply(null,this);},max:function(){return Math.max.apply(null,this);
},average:function(){return this.length?this.sum()/this.length:0;},sum:function(){var a=0,b=this.length;if(b){do{a+=this[--b];}while(b);}return a;},unique:function(){return[].combine(this);
}});Hash.implement({getFromPath:function(a){var b=this.getClean();a.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(c){if(!b){return null;}var d=arguments[2]||arguments[1]||arguments[0];
b=(d in b)?b[d]:null;return c;});return b;},cleanValues:function(a){a=a||$defined;this.each(function(c,b){if(!a(c)){this.erase(b);}},this);return this;
},run:function(){var a=arguments;this.each(function(c,b){if($type(c)=="function"){c.run(a);}});}});String.implement({parseQueryString:function(){var b=this.split(/[&;]/),a={};
if(b.length){b.each(function(g){var c=g.indexOf("="),d=c<0?[""]:g.substr(0,c).match(/[^\]\[]+/g),e=decodeURIComponent(g.substr(c+1)),f=a;d.each(function(j,h){var k=f[j];
if(h<d.length-1){f=f[j]=k||{};}else{if($type(k)=="array"){k.push(e);}else{f[j]=$defined(k)?[k,e]:e;}}});});}return a;},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1);
return a?a.run([c,d]):$chk(d);}).join("&");}});var URI=new Class({Implements:Options,options:{},regex:/^(?:(\w+):)?(?:\/\/(?:(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)?(\.\.?$|(?:[^?#\/]*\/)*)([^?#]*)(?:\?([^#]*))?(?:#(.*))?/,parts:["scheme","user","password","host","port","directory","file","query","fragment"],schemes:{http:80,https:443,ftp:21,rtsp:554,mms:1755,file:0},initialize:function(b,a){this.setOptions(a);
var c=this.options.base||URI.base;if(!b){b=c;}if(b&&b.parsed){this.parsed=$unlink(b.parsed);}else{this.set("value",b.href||b.toString(),c?new URI(c):false);
}},parse:function(c,b){var a=c.match(this.regex);if(!a){return false;}a.shift();return this.merge(a.associate(this.parts),b);},merge:function(b,a){if((!b||!b.scheme)&&(!a||!a.scheme)){return false;
}if(a){this.parts.every(function(c){if(b[c]){return false;}b[c]=a[c]||"";return true;});}b.port=b.port||this.schemes[b.scheme.toLowerCase()];b.directory=b.directory?this.parseDirectory(b.directory,a?a.directory:""):"/";
return b;},parseDirectory:function(b,c){b=(b.substr(0,1)=="/"?"":(c||"/"))+b;if(!b.test(URI.regs.directoryDot)){return b;}var a=[];b.replace(URI.regs.endSlash,"").split("/").each(function(d){if(d==".."&&a.length>0){a.pop();
}else{if(d!="."){a.push(d);}}});return a.join("/")+"/";},combine:function(a){return a.value||a.scheme+"://"+(a.user?a.user+(a.password?":"+a.password:"")+"@":"")+(a.host||"")+(a.port&&a.port!=this.schemes[a.scheme]?":"+a.port:"")+(a.directory||"/")+(a.file||"")+(a.query?"?"+a.query:"")+(a.fragment?"#"+a.fragment:"");
},set:function(b,d,c){if(b=="value"){var a=d.match(URI.regs.scheme);if(a){a=a[1];}if(a&&!$defined(this.schemes[a.toLowerCase()])){this.parsed={scheme:a,value:d};
}else{this.parsed=this.parse(d,(c||this).parsed)||(a?{scheme:a,value:d}:{value:d});}}else{if(b=="data"){this.setData(d);}else{this.parsed[b]=d;}}return this;
},get:function(a,b){switch(a){case"value":return this.combine(this.parsed,b?b.parsed:false);case"data":return this.getData();}return this.parsed[a]||"";
},go:function(){document.location.href=this.toString();},toURI:function(){return this;},getData:function(c,b){var a=this.get(b||"query");if(!$chk(a)){return c?null:{};
}var d=a.parseQueryString();return c?d[c]:d;},setData:function(a,c,b){if(typeof a=="string"){a=this.getData();a[arguments[0]]=arguments[1];}else{if(c){a=$merge(this.getData(),a);
}}return this.set(b||"query",Hash.toQueryString(a));},clearData:function(a){return this.set(a||"query","");}});URI.prototype.toString=URI.prototype.valueOf=function(){return this.get("value");
};URI.regs={endSlash:/\/$/,scheme:/^(\w+):/,directoryDot:/\.\/|\.$/};URI.base=new URI(document.getElements("base[href]",true).getLast(),{base:document.location});
String.implement({toURI:function(a){return new URI(this,a);}});URI=Class.refactor(URI,{combine:function(f,e){if(!e||f.scheme!=e.scheme||f.host!=e.host||f.port!=e.port){return this.previous.apply(this,arguments);
}var a=f.file+(f.query?"?"+f.query:"")+(f.fragment?"#"+f.fragment:"");if(!e.directory){return(f.directory||(f.file?"":"./"))+a;}var d=e.directory.split("/"),c=f.directory.split("/"),g="",h;
var b=0;for(h=0;h<d.length&&h<c.length&&d[h]==c[h];h++){}for(b=0;b<d.length-h-1;b++){g+="../";}for(b=h;b<c.length-1;b++){g+=c[b]+"/";}return(g||(f.file?"":"./"))+a;
},toAbsolute:function(a){a=new URI(a);if(a){a.set("directory","").set("file","");}return this.toRelative(a);},toRelative:function(a){return this.get("value",new URI(a));
}});Element.implement({measure:function(e){var g=function(h){return !!(!h||h.offsetHeight||h.offsetWidth);};if(g(this)){return e.apply(this);}var d=this.getParent(),f=[],b=[];
while(!g(d)&&d!=document.body){b.push(d.expose());d=d.getParent();}var c=this.expose();var a=e.apply(this);c();b.each(function(h){h();});return a;},expose:function(){if(this.getStyle("display")!="none"){return $empty;
}var a=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=a;}.bind(this);
},getDimensions:function(a){a=$merge({computeSize:false},a);var f={};var d=function(g,e){return(e.computeSize)?g.getComputedSize(e):g.getSize();};var b=this.getParent("body");
if(b&&this.getStyle("display")=="none"){f=this.measure(function(){return d(this,a);});}else{if(b){try{f=d(this,a);}catch(c){}}else{f={x:0,y:0};}}return $chk(f.x)?$extend(f,{width:f.x,height:f.y}):$extend(f,{x:f.width,y:f.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={};b.each(function(f){e[f]=this.getComputedStyle(f);},this);var d=[];$each(a.plains,function(g,f){var h=f.capitalize();c["total"+h]=c["computed"+h]=0;
g.each(function(i){c["computed"+i.capitalize()]=0;b.each(function(k,j){if(k.test(i)){e[k]=e[k].toInt()||0;c["total"+h]=c["total"+h]+e[k];c["computed"+i.capitalize()]=c["computed"+i.capitalize()]+e[k];
}if(k.test(i)&&f!=k&&(k.test("border")||k.test("padding"))&&!d.contains(k)){d.push(k);c["computed"+h]=c["computed"+h]-e[k];}});});});["Width","Height"].each(function(g){var f=g.toLowerCase();
if(!$chk(c[f])){return;}c[f]=c[f]+this["offset"+g]+c["computed"+g];c["total"+g]=c[f]+c["total"+g];delete c["computed"+g];},this);return $extend(e,c);}});
(function(){var a=Element.prototype.position;Element.implement({position:function(h){if(h&&($defined(h.x)||$defined(h.y))){return a?a.apply(this,arguments):this;
}$each(h||{},function(w,u){if(!$defined(w)){delete h[u];}});h=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,ignoreScroll:false,allowNegative:false},h);
var s={x:0,y:0},f=false;var c=this.measure(function(){return document.id(this.getOffsetParent());});if(c&&c!=this.getDocument().body){s=c.measure(function(){return this.getPosition();
});f=c!=document.id(h.relativeTo);h.offset.x=h.offset.x-s.x;h.offset.y=h.offset.y-s.y;}var t=function(u){if($type(u)!="string"){return u;}u=u.toLowerCase();
var v={};if(u.test("left")){v.x="left";}else{if(u.test("right")){v.x="right";}else{v.x="center";}}if(u.test("upper")||u.test("top")){v.y="top";}else{if(u.test("bottom")){v.y="bottom";
}else{v.y="center";}}return v;};h.edge=t(h.edge);h.position=t(h.position);if(!h.edge){if(h.position.x=="center"&&h.position.y=="center"){h.edge={x:"center",y:"center"};
}else{h.edge={x:"left",y:"top"};}}this.setStyle("position","absolute");var g=document.id(h.relativeTo)||document.body,d=g==document.body?window.getScroll():g.getPosition(),n=d.y,i=d.x;
var e=g.getScrolls();n+=e.y;i+=e.x;var o=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});var k={},p=h.offset.y,r=h.offset.x,l=window.getSize();
switch(h.position.x){case"left":k.x=i+r;break;case"right":k.x=i+r+g.offsetWidth;break;default:k.x=i+((g==document.body?l.x:g.offsetWidth)/2)+r;break;}switch(h.position.y){case"top":k.y=n+p;
break;case"bottom":k.y=n+p+g.offsetHeight;break;default:k.y=n+((g==document.body?l.y:g.offsetHeight)/2)+p;break;}if(h.edge){var b={};switch(h.edge.x){case"left":b.x=0;
break;case"right":b.x=-o.x-o.computedRight-o.computedLeft;break;default:b.x=-(o.totalWidth/2);break;}switch(h.edge.y){case"top":b.y=0;break;case"bottom":b.y=-o.y-o.computedTop-o.computedBottom;
break;default:b.y=-(o.totalHeight/2);break;}k.x+=b.x;k.y+=b.y;}k={left:((k.x>=0||f||h.allowNegative)?k.x:0).toInt(),top:((k.y>=0||f||h.allowNegative)?k.y:0).toInt()};
var j={left:"x",top:"y"};["minimum","maximum"].each(function(u){["left","top"].each(function(v){var w=h[u]?h[u][j[v]]:null;if(w!=null&&k[v]<w){k[v]=w;}});
});if(g.getStyle("position")=="fixed"||h.relFixedPosition){var m=window.getScroll();k.top+=m.y;k.left+=m.x;}if(h.ignoreScroll){var q=g.getScroll();k.top-=q.y;
k.left-=q.x;}if(h.ignoreMargins){k.left+=(h.edge.x=="right"?o["margin-right"]:h.edge.x=="center"?-o["margin-left"]+((o["margin-right"]+o["margin-left"])/2):-o["margin-left"]);
k.top+=(h.edge.y=="bottom"?o["margin-bottom"]:h.edge.y=="center"?-o["margin-top"]+((o["margin-bottom"]+o["margin-top"])/2):-o["margin-top"]);}k.left=Math.ceil(k.left);
k.top=Math.ceil(k.top);if(h.returnPos){return k;}else{this.setStyles(k);}return this;}});})();Fx.Elements=new Class({Extends:Fx.CSS,initialize:function(b,a){this.elements=this.subject=$$(b);
this.parent(a);},compute:function(g,h,j){var c={};for(var d in g){var a=g[d],e=h[d],f=c[d]={};for(var b in a){f[b]=this.parent(a[b],e[b],j);}}return c;
},set:function(b){for(var c in b){var a=b[c];for(var d in a){this.render(this.elements[c],d,a[d],this.options.unit);}}return this;},start:function(c){if(!this.check(c)){return this;
}var h={},j={};for(var d in c){var f=c[d],a=h[d]={},g=j[d]={};for(var b in f){var e=this.prepare(this.elements[d],b,f[b]);a[b]=e.from;g[b]=e.to;}}return this.parent(h,j);
}});var Accordion=Fx.Accordion=new Class({Extends:Fx.Elements,options:{display:0,show:false,height:true,width:false,opacity:true,alwaysHide:false,trigger:"click",initialDisplayFx:true,returnHeightToAuto:true},initialize:function(){var c=Array.link(arguments,{container:Element.type,options:Object.type,togglers:$defined,elements:$defined});
this.parent(c.elements,c.options);this.togglers=$$(c.togglers);this.container=document.id(c.container);this.previous=-1;this.internalChain=new Chain();
if(this.options.alwaysHide){this.options.wait=true;}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show;}if(this.options.start){this.options.display=false;
this.options.show=false;}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity";}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth";
}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight";}for(var b=0,a=this.togglers.length;b<a;b++){this.addSection(this.togglers[b],this.elements[b]);
}this.elements.each(function(e,d){if(this.options.show===d){this.fireEvent("active",[this.togglers[d],e]);}else{for(var f in this.effects){e.setStyle(f,0);
}}},this);if($chk(this.options.display)){this.display(this.options.display,this.options.initialDisplayFx);}this.addEvent("complete",this.internalChain.callChain.bind(this.internalChain));
},addSection:function(e,c){e=document.id(e);c=document.id(c);var f=this.togglers.contains(e);this.togglers.include(e);this.elements.include(c);var a=this.togglers.indexOf(e);
var b=this.display.bind(this,a);e.store("accordion:display",b);e.addEvent(this.options.trigger,b);if(this.options.height){c.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"});
}if(this.options.width){c.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"});}c.fullOpacity=1;if(this.options.fixedWidth){c.fullWidth=this.options.fixedWidth;
}if(this.options.fixedHeight){c.fullHeight=this.options.fixedHeight;}c.setStyle("overflow","hidden");if(!f){for(var d in this.effects){c.setStyle(d,0);
}}return this;},detach:function(){this.togglers.each(function(a){a.removeEvent(this.options.trigger,a.retrieve("accordion:display"));},this);},display:function(a,b){if(!this.check(a,b)){return this;
}b=$pick(b,true);if(this.options.returnHeightToAuto){var d=this.elements[this.previous];if(d&&!this.selfHidden){for(var c in this.effects){d.setStyle(c,d[this.effects[c]]);
}}}a=($type(a)=="element")?this.elements.indexOf(a):a;if((this.timer&&this.options.wait)||(a===this.previous&&!this.options.alwaysHide)){return this;}this.previous=a;
var e={};this.elements.each(function(h,g){e[g]={};var f;if(g!=a){f=true;}else{if(this.options.alwaysHide&&((h.offsetHeight>0&&this.options.height)||h.offsetWidth>0&&this.options.width)){f=true;
this.selfHidden=true;}}this.fireEvent(f?"background":"active",[this.togglers[g],h]);for(var j in this.effects){e[g][j]=f?0:h[this.effects[j]];}},this);
this.internalChain.chain(function(){if(this.options.returnHeightToAuto&&!this.selfHidden){var f=this.elements[a];if(f){f.setStyle("height","auto");}}}.bind(this));
return b?this.start(e):this.set(e);}});Fx.Scroll=new Class({Extends:Fx,options:{offset:{x:0,y:0},wheelStops:true},initialize:function(b,a){this.element=this.subject=document.id(b);
this.parent(a);var d=this.cancel.bind(this,false);if($type(this.element)!="element"){this.element=document.id(this.element.getDocument().body);}var c=this.element;
if(this.options.wheelStops){this.addEvent("start",function(){c.addEvent("mousewheel",d);},true);this.addEvent("complete",function(){c.removeEvent("mousewheel",d);
},true);}},set:function(){var a=Array.flatten(arguments);if(Browser.Engine.gecko){a=[Math.round(a[0]),Math.round(a[1])];}this.element.scrollTo(a[0],a[1]);
},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(c,g){if(!this.check(c,g)){return this;}var e=this.element.getScrollSize(),b=this.element.getScroll(),d={x:c,y:g};
for(var f in d){var a=e[f];if($chk(d[f])){d[f]=($type(d[f])=="number")?d[f]:a;}else{d[f]=b[f];}d[f]+=this.options.offset[f];}return this.parent([b.x,b.y],[d.x,d.y]);
},toTop:function(){return this.start(false,0);},toLeft:function(){return this.start(0,false);},toRight:function(){return this.start("right",false);},toBottom:function(){return this.start(false,"bottom");
},toElement:function(b){var a=document.id(b).getPosition(this.element);return this.start(a.x,a.y);},scrollIntoView:function(c,e,d){e=e?$splat(e):["x","y"];
var h={};c=document.id(c);var f=c.getPosition(this.element);var i=c.getSize();var g=this.element.getScroll();var a=this.element.getSize();var b={x:f.x+i.x,y:f.y+i.y};
["x","y"].each(function(j){if(e.contains(j)){if(b[j]>g[j]+a[j]){h[j]=b[j]-a[j];}if(f[j]<g[j]){h[j]=f[j];}}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];
}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);}return this;},scrollToCenter:function(c,e,d){e=e?$splat(e):["x","y"];c=$(c);var h={},f=c.getPosition(this.element),i=c.getSize(),g=this.element.getScroll(),a=this.element.getSize(),b={x:f.x+i.x,y:f.y+i.y};
["x","y"].each(function(j){if(e.contains(j)){h[j]=f[j]-(a[j]-i[j])/2;}if(h[j]==null){h[j]=g[j];}if(d&&d[j]){h[j]=h[j]+d[j];}},this);if(h.x!=g.x||h.y!=g.y){this.start(h.x,h.y);
}return this;}});Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical",hideOverflow:true},initialize:function(b,a){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);
if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=document.id(b);this.parent(a);var d=this.element.retrieve("wrapper");
var c=this.element.getStyles("margin","position","overflow");if(this.options.hideOverflow){c=$extend(c,{overflow:"hidden"});}this.wrapper=d||new Element("div",{styles:c}).wraps(this.element);
this.element.store("wrapper",this.wrapper).setStyle("margin",0);this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";
this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth;},set:function(a){this.element.setStyle(this.margin,a[0]);
this.wrapper.setStyle(this.layout,a[1]);return this;},compute:function(c,b,a){return[0,1].map(function(d){return Fx.compute(c[d],b[d],a);});},start:function(b,e){if(!this.check(b,e)){return this;
}this[e||this.options.mode]();var d=this.element.getStyle(this.margin).toInt();var c=this.wrapper.getStyle(this.layout).toInt();var a=[[d,c],[0,this.offset]];
var g=[[d,c],[-this.offset,0]];var f;switch(b){case"in":f=a;break;case"out":f=g;break;case"toggle":f=(c==0)?a:g;}return this.parent(f[0],f[1]);},slideIn:function(a){return this.start("in",a);
},slideOut:function(a){return this.start("out",a);},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0]);},show:function(a){this[a||this.options.mode]();
this.open=true;return this.set([0,this.offset]);},toggle:function(a){return this.start("toggle",a);}});Element.Properties.slide={set:function(b){var a=this.retrieve("slide");
if(a){a.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},b));},get:function(a){if(a||!this.retrieve("slide")){if(a||!this.retrieve("slide:options")){this.set("slide",a);
}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));}return this.retrieve("slide");}};Element.implement({slide:function(d,e){d=d||"toggle";
var b=this.get("slide"),a;switch(d){case"hide":b.hide(e);break;case"show":b.show(e);break;case"toggle":var c=this.retrieve("slide:flag",b.open);b[c?"slideOut":"slideIn"](e);
this.store("slide:flag",!c);a=true;break;default:b.start(d,e);}if(!a){this.eliminate("slide:flag");}return this;}});var SmoothScroll=Fx.SmoothScroll=new Class({Extends:Fx.Scroll,initialize:function(b,c){c=c||document;
this.doc=c.getDocument();var d=c.getWindow();this.parent(this.doc,b);this.links=$$(this.options.links||this.doc.links);var a=d.location.href.match(/^[^#]*/)[0]+"#";
this.links.each(function(f){if(f.href.indexOf(a)!=0){return;}var e=f.href.substr(a.length);if(e){this.useLink(f,e);}},this);if(!Browser.Engine.webkit419){this.addEvent("complete",function(){d.location.hash=this.anchor;
},true);}},useLink:function(c,a){var b;c.addEvent("click",function(d){if(b!==false&&!b){b=document.id(a)||this.doc.getElement("a[name="+a+"]");}if(b){d.preventDefault();
this.anchor=a;this.toElement(b).chain(function(){this.fireEvent("scrolledTo",[c,b]);}.bind(this));c.blur();}}.bind(this));}});var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});
this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;
this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};
this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);
return this;},start:function(c){if(c.rightClick){return;}if(this.options.preventDefault){c.preventDefault();}if(this.options.stopPropagation){c.stopPropagation();
}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;
}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();}else{this.value.now[d]=this.element[this.options.modifiers[d]];
}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();
}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});
this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));
if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);
}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;
}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;}if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];
}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];}}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);
}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);}else{this.element[this.options.modifiers[b]]=this.value.now[b];
}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);
if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);
this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(a){this.fireEvent("complete",[this.element,a]);
}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);
}.bind(this));}});Request.JSONP=new Class({Implements:[Chain,Events,Options,Log],options:{url:"",data:{},retries:0,timeout:0,link:"ignore",callbackKey:"callback",injectScript:document.head},initialize:function(a){this.setOptions(a);
if(this.options.log){this.enableLog();}this.running=false;this.requests=0;this.triesRemaining=[];},check:function(){if(!this.running){return true;}switch(this.options.link){case"cancel":this.cancel();
return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(c){if(!$chk(arguments[1])&&!this.check(c)){return this;
}var e=$type(c),a=this.options,b=$chk(arguments[1])?arguments[1]:this.requests++;if(e=="string"||e=="element"){c={data:c};}c=$extend({data:a.data,url:a.url},c);
if(!$chk(this.triesRemaining[b])){this.triesRemaining[b]=this.options.retries;}var d=this.triesRemaining[b];(function(){var f=this.getScript(c);this.log("JSONP retrieving script with url: "+f.get("src"));
this.fireEvent("request",f);this.running=true;(function(){if(d){this.triesRemaining[b]=d-1;if(f){f.destroy();this.send(c,b).fireEvent("retry",this.triesRemaining[b]);
}}else{if(f&&this.options.timeout){f.destroy();this.cancel().fireEvent("failure");}}}).delay(this.options.timeout,this);}).delay(Browser.Engine.trident?50:0,this);
return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.fireEvent("cancel");return this;},getScript:function(c){var b=Request.JSONP.counter,d;
Request.JSONP.counter++;switch($type(c.data)){case"element":d=document.id(c.data).toQueryString();break;case"object":case"hash":d=Hash.toQueryString(c.data);
}var e=c.url+(c.url.test("\\?")?"&":"?")+(c.callbackKey||this.options.callbackKey)+"=Request.JSONP.request_map.request_"+b+(d?"&"+d:"");if(e.length>2083){this.log("JSONP "+e+" will fail in Internet Explorer, which enforces a 2083 bytes length limit on URIs");
}var a=new Element("script",{type:"text/javascript",src:e});Request.JSONP.request_map["request_"+b]=function(f){this.success(f,a);}.bind(this);return a.inject(this.options.injectScript);
},success:function(b,a){if(a){a.destroy();}this.running=false;this.log("JSONP successfully retrieved: ",b);this.fireEvent("complete",[b]).fireEvent("success",[b]).callChain();
}});Request.JSONP.counter=0;Request.JSONP.request_map={};Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(b){var a=function(){if(!this.running){this.send({data:b});
}};this.timer=a.delay(this.options.initialDelay,this);this.lastDelay=this.options.initialDelay;this.completeCheck=function(c){$clear(this.timer);this.lastDelay=(c)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit);
this.timer=a.delay(this.lastDelay,this);};return this.addEvent("complete",this.completeCheck);},stopTimer:function(){$clear(this.timer);return this.removeEvent("complete",this.completeCheck);
}});var Asset={javascript:function(f,d){d=$extend({onload:$empty,document:document,check:$lambda(true)},d);var b=new Element("script",{src:f,type:"text/javascript"});
var e=d.onload.bind(b),a=d.check,g=d.document;delete d.onload;delete d.check;delete d.document;b.addEvents({load:e,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){e();
}}}).set(d);if(Browser.Engine.webkit419){var c=(function(){if(!$try(a)){return;}$clear(c);e();}).periodical(50);}return b.inject(g.head);},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head);
},image:function(c,b){b=$merge({onload:$empty,onabort:$empty,onerror:$empty},b);var d=new Image();var a=document.id(d)||new Element("img");["load","abort","error"].each(function(e){var f="on"+e;
var g=b[f];delete b[f];d[f]=function(){if(!d){return;}if(!a.parentNode){a.width=d.width;a.height=d.height;}d=d.onload=d.onabort=d.onerror=null;g.delay(1,a,a);
a.fireEvent(e,a,1);};});d.src=a.src=c;if(d&&d.complete){d.onload.delay(1);}return a.set(b);},images:function(d,c){c=$merge({onComplete:$empty,onProgress:$empty,onError:$empty,properties:{}},c);
d=$splat(d);var a=[];var b=0;return new Elements(d.map(function(e){return Asset.image(e,$extend(c.properties,{onload:function(){c.onProgress.call(this,b,d.indexOf(e));
b++;if(b==d.length){c.onComplete();}},onerror:function(){c.onError.call(this,b,d.indexOf(e));b++;if(b==d.length){c.onComplete();}}}));}));}};(function(){var a=function(c,b){return(c)?($type(c)=="function"?c(b):b.get(c)):"";
};this.Tips=new Class({Implements:[Events,Options],options:{onShow:function(){this.tip.setStyle("display","block");},onHide:function(){this.tip.setStyle("display","none");
},title:"title",text:function(b){return b.get("rel")||b.get("href");},showDelay:100,hideDelay:100,className:"tip-wrap",offset:{x:16,y:16},fixed:false},initialize:function(){var b=Array.link(arguments,{options:Object.type,elements:$defined});
this.setOptions(b.options);document.id(this);if(b.elements){this.attach(b.elements);}},toElement:function(){if(this.tip){return this.tip;}this.container=new Element("div",{"class":"tip"});
return this.tip=new Element("div",{"class":this.options.className,styles:{position:"absolute",top:0,left:0}}).adopt(new Element("div",{"class":"tip-top"}),this.container,new Element("div",{"class":"tip-bottom"})).inject(document.body);
},attach:function(b){$$(b).each(function(d){var f=a(this.options.title,d),e=a(this.options.text,d);d.erase("title").store("tip:native",f).retrieve("tip:title",f);
d.retrieve("tip:text",e);this.fireEvent("attach",[d]);var c=["enter","leave"];if(!this.options.fixed){c.push("move");}c.each(function(h){var g=d.retrieve("tip:"+h);
if(!g){g=this["element"+h.capitalize()].bindWithEvent(this,d);}d.store("tip:"+h,g).addEvent("mouse"+h,g);},this);},this);return this;},detach:function(b){$$(b).each(function(d){["enter","leave","move"].each(function(e){d.removeEvent("mouse"+e,d.retrieve("tip:"+e)).eliminate("tip:"+e);
});this.fireEvent("detach",[d]);if(this.options.title=="title"){var c=d.retrieve("tip:native");if(c){d.set("title",c);}}},this);return this;},elementEnter:function(c,b){this.container.empty();
["title","text"].each(function(e){var d=b.retrieve("tip:"+e);if(d){this.fill(new Element("div",{"class":"tip-"+e}).inject(this.container),d);}},this);$clear(this.timer);
this.timer=this.show.delay(this.options.showDelay,this,b);this.position((this.options.fixed)?{page:b.getPosition()}:c);},elementLeave:function(c,b){$clear(this.timer);
this.timer=this.hide.delay(this.options.hideDelay,this,b);this.fireForParent(c,b);},fireForParent:function(c,b){if(!b){return;}parentNode=b.getParent();
if(parentNode==document.body){return;}if(parentNode.retrieve("tip:enter")){parentNode.fireEvent("mouseenter",c);}else{this.fireForParent(parentNode,c);
}},elementMove:function(c,b){this.position(c);},position:function(e){var c=window.getSize(),b=window.getScroll(),f={x:this.tip.offsetWidth,y:this.tip.offsetHeight},d={x:"left",y:"top"},g={};
for(var h in d){g[d[h]]=e.page[h]+this.options.offset[h];if((g[d[h]]+f[h]-b[h])>c[h]){g[d[h]]=e.page[h]-this.options.offset[h]-f[h];}}this.tip.setStyles(g);
},fill:function(b,c){if(typeof c=="string"){b.set("html",c);}else{b.adopt(c);}},show:function(b){this.fireEvent("show",[this.tip,b]);},hide:function(b){this.fireEvent("hide",[this.tip,b]);
}});})();
var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Object.type,element:$defined});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=$type(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection=(Browser.Engine.trident)?"selectstart":"mousedown";this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:$lambda(false)};this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start);return this;},start:function(c){if(c.rightClick){return;}if(this.options.preventDefault){c.preventDefault();}if(this.options.stopPropagation){c.stopPropagation();}this.mouse.start=c.page;this.fireEvent("beforeStart",this.element);var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue;}if(this.options.style){this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();}else{this.value.now[d]=this.element[this.options.modifiers[d]];}if(this.options.invert){this.value.now[d]*=-1;}this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=2;b--;b){if($chk(a[d][b])){this.limit[d][b]=$lambda(a[d][b])();}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid};}this.document.addEvents({mousemove:this.bound.check,mouseup:this.bound.cancel});this.document.addEvent(this.selection,this.bound.eventStop);},check:function(a){if(this.options.preventDefault){a.preventDefault();}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop});this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(a){if(this.options.preventDefault){a.preventDefault();}this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue;}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.options.invert){this.value.now[b]*=-1;}if(this.options.limit&&this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];}}}if(this.options.grid[b]){this.value.now[b]-=((this.value.now[b]-(this.limit[b][0]||0))%this.options.grid[b]);}if(this.options.style){this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit);}else{this.element[this.options.modifiers[b]]=this.value.now[b];}}this.fireEvent("drag",[this.element,a]);},cancel:function(a){this.document.removeEvent("mousemove",this.bound.check);this.document.removeEvent("mouseup",this.bound.cancel);if(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.fireEvent("cancel",this.element);}},stop:function(a){this.document.removeEvent(this.selection,this.bound.eventStop);this.document.removeEvent("mousemove",this.bound.drag);this.document.removeEvent("mouseup",this.bound.stop);if(a){this.fireEvent("complete",[this.element,a]);}}});Element.implement({makeResizable:function(a){var b=new Drag(this,$merge({modifiers:{x:"width",y:"height"}},a));this.store("resizer",b);return b.addEvent("drag",function(){this.fireEvent("resize",b);}.bind(this));}});var Slider=new Class({Implements:[Events,Options],Binds:["clickedElement","draggedKnob","scrolledElement"],options:{onTick:function(a){if(this.options.snap){a=this.toPosition(this.step);}this.knob.setStyle(this.property,a);},initialStep:0,snap:false,offset:0,range:false,wheel:false,steps:100,mode:"horizontal"},initialize:function(f,a,e){this.setOptions(e);this.element=document.id(f);this.knob=document.id(a);this.previousChange=this.previousEnd=this.step=-1;var g,b={},d={x:false,y:false};switch(this.options.mode){case"vertical":this.axis="y";this.property="top";g="offsetHeight";break;case"horizontal":this.axis="x";this.property="left";g="offsetWidth";}this.full=this.element.measure(function(){this.half=this.knob[g]/2;return this.element[g]-this.knob[g]+(this.options.offset*2);}.bind(this));this.min=$chk(this.options.range[0])?this.options.range[0]:0;this.max=$chk(this.options.range[1])?this.options.range[1]:this.options.steps;this.range=this.max-this.min;this.steps=this.options.steps||this.full;this.stepSize=Math.abs(this.range)/this.steps;this.stepWidth=this.stepSize*this.full/Math.abs(this.range);this.knob.setStyle("position","relative").setStyle(this.property,this.options.initialStep?this.toPosition(this.options.initialStep):-this.options.offset);d[this.axis]=this.property;b[this.axis]=[-this.options.offset,this.full-this.options.offset];var c={snap:0,limit:b,modifiers:d,onDrag:this.draggedKnob,onStart:this.draggedKnob,onBeforeStart:(function(){this.isDragging=true;}).bind(this),onCancel:function(){this.isDragging=false;}.bind(this),onComplete:function(){this.isDragging=false;this.draggedKnob();this.end();}.bind(this)};if(this.options.snap){c.grid=Math.ceil(this.stepWidth);c.limit[this.axis][1]=this.full;}this.drag=new Drag(this.knob,c);this.attach();},attach:function(){this.element.addEvent("mousedown",this.clickedElement);if(this.options.wheel){this.element.addEvent("mousewheel",this.scrolledElement);}this.drag.attach();return this;},detach:function(){this.element.removeEvent("mousedown",this.clickedElement);this.element.removeEvent("mousewheel",this.scrolledElement);this.drag.detach();return this;},set:function(a){if(!((this.range>0)^(a<this.min))){a=this.min;}if(!((this.range>0)^(a>this.max))){a=this.max;}this.step=Math.round(a);this.checkStep();this.fireEvent("tick",this.toPosition(this.step));this.end();return this;},clickedElement:function(c){if(this.isDragging||c.target==this.knob){return;}var b=this.range<0?-1:1;var a=c.page[this.axis]-this.element.getPosition()[this.axis]-this.half;a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();this.fireEvent("tick",a);this.end();},scrolledElement:function(a){var b=(this.options.mode=="horizontal")?(a.wheel<0):(a.wheel>0);this.set(b?this.step-this.stepSize:this.step+this.stepSize);a.stop();},draggedKnob:function(){var b=this.range<0?-1:1;var a=this.drag.value.now[this.axis];a=a.limit(-this.options.offset,this.full-this.options.offset);this.step=Math.round(this.min+b*this.toStep(a));this.checkStep();},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("change",this.step);}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("complete",this.step+"");}},toStep:function(a){var b=(a+this.options.offset)*this.stepSize/this.full*this.steps;return this.options.steps?Math.round(b-=b%this.stepSize):b;},toPosition:function(a){return(this.full*Math.abs(this.min-a))/(this.steps*this.stepSize)-this.options.offset;}});

/**************** external classes ****************/
/* Lighter.js */
(function(){Lighter=new Class({Implements:[Options],name:"Lighter",options:{altLines:"",clipboard:null,container:null,editable:false,flame:"standard",fuel:"standard",id:null,indent:-1,matchType:"standard",mode:"pre",path:null,strict:false},initialize:function(d,c){this.setOptions(c);this.id=this.options.id||this.name+"_"+$time();this.codeblock=$(d);this.container=$(this.options.container);this.code=a(this.codeblock.get("html")).replace(/&lt;/gim,"<").replace(/&gt;/gim,">").replace(/&amp;/gim,"&");if(this.options.indent>-1){this.code=b(this.code,this.options.indent)}this.getPath();this.getClass();this.builder=new Hash({inline:this.createLighter.pass("code",this),pre:this.createLighter.pass("pre",this),ol:this.createLighterWithLines.pass([["ol"],["li"]],this),div:this.createLighterWithLines.pass([["div"],["div","span"],true,"span"],this),table:this.createLighterWithLines.pass([["table","tbody"],["tr","td"],true,"td"],this)});Lighter.scripts=Lighter.scripts||{};Lighter.stylesheets=Lighter.stylesheets||{};/* this.loadStylesheet(this.options.flame,"Flame."+this.options.flame+".css");*/this.loadFuel()},loadFuel:function(){try{this.fuel=new Fuel[this.options.fuel](this.code,{matchType:this.options.matchType,strict:this.options.strict});this.light()}catch(c){this.loadScript(this.options.fuel,"Fuel."+this.options.fuel+".js",{load:this.loadFuel.bind(this),error:function(){this.options.fuel="standard";this.loadFuel()}.bind(this)})}},light:function(){this.element=this.toElement();if(this.container){this.container.empty();this.element.inject(this.container)}else{this.codeblock.setStyle("display","none");this.element.inject(this.codeblock,"after");if(this.options.clipboard){this.loadClipboard()}}},unlight:function(){$(this).setStyle("display","none");this.codeblock.setStyle("display","inherit")},loadClipboard:function(){try{var c=new ZeroClipboard.Client();c.setPath(this.options.path);c.glue($(this.options.clipboard));c.setText(this.code);c.addEventListener("complete",function(e,f){alert("Copied text to clipboard:\n"+f)})}catch(d){this.loadScript("clipboard","ZeroClipboard.js",{load:this.loadClipboard.bind(this),error:$empty});return false}},getPath:function(){if(!$chk(Lighter.path)){$$("head script").each(function(d){var c=d.src.split("?",1),e=/Lighter(\.full|\.lite)?\.js$/gi;if(c[0].match(e)){Lighter.path=c[0].replace(e,"")}})}if(!this.options.path){this.options.path=Lighter.path}},getClass:function(){var d=this.codeblock.get("class").split(" "),c=[null,null];switch(d.length){case 0:break;case 1:c=d[0].split(":");break;default:c=d[0].split(":")}if(c[0]){this.options.fuel=c[0]}if(c[1]){this.options.flame=c[1]}},loadScript:function(d,e,c){if($chk(Lighter.scripts[d])){Lighter.scripts[d].addEvents({load:c.load,error:c.error,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){c.load()}}})}else{Lighter.scripts[d]=new Element("script",{src:this.options.path+e+"?"+$time(),type:"text/javascript",events:{load:c.load,error:c.error,readystatechange:function(){if(["loaded","complete"].contains(this.readyState)){c.load()}}}}).inject(document.head)}},loadStylesheet:function(c,d){if(!$chk(Lighter.stylesheets[c])){Lighter.stylesheets[c]=new Element("link",{rel:"stylesheet",type:"text/css",media:"screen",href:this.options.path+d+"?"+$time()}).inject(document.head)}},createLighter:function(d){var c=new Element(d,{"class":this.options.flame+this.name}),e=0;if(!$defined(this.fuel.wicks[0])){c.appendText(this.code)}else{this.fuel.wicks.each(function(f){c.appendText(this.code.substring(e,f.index));this.insertAndKeepEl(c,f.text,f.type);e=f.index+f.text.length},this);if(e<this.code.length){c.appendText(this.code.substring(e,this.code.length))}}return c},createLighterWithLines:function(k,d,f,e){var m=new Element(k[0],{"class":this.options.flame+this.name,id:this.id}),j=new Element(d[0]),h=1,c=0,l=null;if(k[0]=="table"){m.set("cellpadding",0).set("cellspacing",0).set("border",0)}if(k[1]){m=new Element(k[1]).inject(m)}if(d[1]){j=new Element(d[1]).inject(j)}j.addClass(this.options.flame+"line");if(f){h=this.insertLineNum(j,h,e)}this.fuel.wicks.each(function(n){if(c!=n.index){l=this.code.substring(c,n.index).split("\n");for(var o=0;o<l.length;o++){if(o<l.length-1){if(l[o]===""){l[o]=" "}j=this.insertAndMakeEl(j,m,l[o],d);if(f){h=this.insertLineNum(j,h,e)}}else{this.insertAndKeepEl(j,l[o])}}}l=n.text.split("\n");for(var o=0;o<l.length;o++){if(o<l.length-1){j=this.insertAndMakeEl(j,m,l[o],d,n.type);if(f){h=this.insertLineNum(j,h,e)}}else{this.insertAndKeepEl(j,l[o],n.type)}}c=n.end},this);if(c<=this.code.length){l=this.code.substring(c,this.code.length).split("\n");for(var g=0;g<l.length;g++){j=this.insertAndMakeEl(j,m,l[g],d);if(f){h=this.insertLineNum(j,h,e)}}}if(this.options.altLines!==""){if(this.options.altLines=="hover"){m.getElements("."+this.options.flame+"line").addEvents({mouseover:function(){this.toggleClass("alt")},mouseout:function(){this.toggleClass("alt")}})}else{if(d[1]){m.getChildren(":"+this.options.altLines).getElement("."+this.options.flame+"line").addClass("alt")}else{m.getChildren(":"+this.options.altLines).addClass("alt")}}}if(d[1]){m.getFirst().getChildren().addClass(this.options.flame+"first");m.getLast().getChildren().addClass(this.options.flame+"last")}else{m.getFirst().addClass(this.options.flame+"first");m.getLast().addClass(this.options.flame+"last")}if(k[1]){m=m.getParent()}return m},insertAndKeepEl:function(e,f,c){if(f.length>0){var d=new Element("span",{text:f});if(c){d.addClass(this.fuel.aliases[c]||c)}d.inject(e)}},insertAndMakeEl:function(d,e,f,h,c){this.insertAndKeepEl(d,f,c);if(h[1]){d=d.getParent()}d.inject(e);var g=new Element(h[0]);if(h[1]){g=new Element(h[1]).inject(g)}g.addClass(this.options.flame+"line");return g},insertLineNum:function(d,f,c){var e=new Element(c,{text:f++,"class":this.options.flame+"num"});e.inject(d.getParent(),"top");return f},toElement:function(){if(!this.element){this.element=this.builder[this.options.mode]();if(this.options.editable){this.element.set("contenteditable","true")}}return this.element}});Element.implement({light:function(c){return new Lighter(this,c)}});function a(c){return c.replace(/(^\s*\n|\n\s*$)/gi,"")}function b(f,d){for(var e=0,c="";e<d;e++){c+=" "}return f.replace(/\t/g,c)}})();var Fuel=new Class({Implements:[Options],options:{matchType:"standard",strict:false},language:"",patterns:new Hash(),keywords:new Hash(),delimiters:new Hash({start:null,end:null}),common:{slashComments:/(?:^|[^\\])\/\/.*$/gm,poundComments:/#.*$/gm,multiComments:/\/\*[\s\S]*?\*\//gm,aposStrings:/'[^'\\]*(?:\\.[^'\\]*)*'/gm,quotedStrings:/"[^"\\]*(?:\\.[^"\\]*)*"/gm,multiLineSingleQuotedStrings:/'[^'\\]*(?:\\.[^'\\]*)*'/gm,multiLineDoubleQuotedStrings:/"[^"\\]*(?:\\.[^"\\]*)*"/gm,multiLineStrings:/'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"/gm,singleQuotedString:/'[^'\\\r\n]*(?:\\.[^'\\\r\n]*)*'/gm,doubleQuotedString:/"[^"\\\r\n]*(?:\\.[^"\\\r\n]*)*"/gm,strings:/'[^'\\\r\n]*(?:\\.[^'\\\r\n]*)*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*)*"/gm,properties:/\.([\w]+)\s*/gi,methodCalls:/\.([\w]+)\s*\(/gm,functionCalls:/\b([\w]+)\s*\(/gm,brackets:/\{|\}|\(|\)|\[|\]/g,numbers:/\b((?:(\d+)?\.)?[0-9]+|0x[0-9A-F]+)\b/gi},initialize:function(a,j,i){this.setOptions(j);this.wicks=i||[];this.code=a;this.aliases=$H();this.rules=$H();this.builder=new Hash({standard:this.findMatches,lazy:this.findMatchesLazy});if(!j.strict){if(this.delimiters.start){this.addFuel("delimBeg",this.delimiters.start,"de1")}if(this.delimiters.end){this.addFuel("delimEnd",this.delimiters.end,"de2")}}this.keywords.each(function(l,k){if(l.csv!=""){this.addFuel(k,this.csvToRegExp(l.csv,l.mod||"g"),l.alias)}},this);this.patterns.each(function(k,l){this.addFuel(l,k.pattern,k.alias)},this);var h=0,b=this.code.length,d="",c=this.delimiters,g=[],f=null,e=null;if(!j.strict){g.extend(this.builder[j.matchType].pass(this.code,this)())}else{if(c.start&&c.end){while((f=c.start.exec(this.code))!=null){c.end.lastIndex=c.start.lastIndex;if((e=c.end.exec(this.code))!=null){g.push(new Wick(f[0],"de1",f.index));h=c.start.lastIndex;b=e.index-1;d=this.code.substring(h,b);g.extend(this.builder[j.matchType].pass([d,h],this)());g.push(new Wick(e[0],"de2",e.index))}}}}this.wicks=g},addFuel:function(c,a,b){this.rules[c]=a;this.addAlias(c,b)},addAlias:function(b,a){this.aliases[b]=a||b},csvToRegExp:function(a,b){return new RegExp("\\b("+a.replace(/,\s*/g,"|")+")\\b",b)},delimToRegExp:function(d,b,a,e,f){d=d.escapeRegExp();if(b){b=b.escapeRegExp()}a=(a)?a.escapeRegExp():d;var c=(b)?d+"[^"+a+b+"\\n]*(?:"+b+".[^"+a+b+"\\n]*)*"+a:d+"[^"+a+"\\n]*"+a;return new RegExp(c+(f||""),e||"")},strictRegExp:function(){var b="(";for(var a=0;a<arguments.length;a++){b+=arguments[a].escapeRegExp();b+=(a<arguments.length-1)?"|":""}b+=")";return new RegExp(b,"gim")},findMatches:function(d,f){var b=[],e=0,a=d.length;insertIndex=0,match=null,type=null,newWick=null,rule=null,rules={},currentMatch=null,futureMatch=null;f=f||0;this.rules.each(function(g,h){rules[h]={pattern:g,nextIndex:0}},this);while(e<d.length){a=d.length;match=null;for(rule in rules){rules[rule].pattern.lastIndex=e;currentMatch=rules[rule].pattern.exec(d);if(currentMatch===null){delete rules[rule]}else{if(currentMatch.index<a||(currentMatch.index==a&&match[0].length<currentMatch[0].length)){match=currentMatch;type=rule;a=currentMatch.index}rules[rule].nextIndex=rules[rule].pattern.lastIndex-currentMatch[0].length}}if(match!=null){index=(match[1]&&match[0].contains(match[1]))?match.index+match[0].indexOf(match[1]):match.index;newWick=new Wick(match[1]||match[0],type,index+f);b.push(newWick);futureMatch=rules[type].pattern.exec(d);if(!futureMatch){rules[type].nextIndex=d.length}else{rules[type].nextIndex=rules[type].pattern.lastIndex-futureMatch[0].length}var c=d.length;for(rule in rules){if(rules[rule].nextIndex<c){c=rules[rule].nextIndex}}e=Math.max(c,newWick.end-f)}else{break}}return b},findMatchesLazy:function(c,d){var a=this.wicks,b=null;index=0;d=d||0;this.rules.each(function(e,f){while((b=e.exec(c))!=null){index=(b[1]&&b[0].contains(b[1]))?b.index+b[0].indexOf(b[1]):b.index;a.push(new Wick(b[1]||b[0],f,index+d))}},this);return this.purgeWicks(a)},purgeWicks:function(a){a=a.sort(this.compareWicks);for(var c=0,b=0;c<a.length;c++){if(a[c]==null){continue}for(b=c+1;b<a.length&&a[c]!=null;b++){if(a[b]==null){continue}else{if(a[b].isBeyond(a[c])){break}else{if(a[b].overlaps(a[c])){a[c]=null}else{if(a[c].contains(a[b])){a[b]=null}}}}}}return a.clean()},compareWicks:function(b,a){return b.index-a.index}});Fuel.standard=new Class({Extends:Fuel,initialize:function(c,b,a){this.parent(c,b,a)}});var Wick=new Class({initialize:function(b,c,a){this.text=b;this.type=c;this.index=a;this.length=this.text.length;this.end=this.index+this.length},contains:function(a){return(a.index>=this.index&&a.index<this.end)},isBeyond:function(a){return(this.index>=a.end)},overlaps:function(a){return(this.index==a.index&&this.length>a.length)},toString:function(){return this.index+" - "+this.text+" - "+this.end}});
Fuel.js=new Class({Extends:Fuel,language:"js",initialize:function(b,a){this.keywords=new Hash({commonKeywords:{csv:"as, break, case, catch, continue, delete, do, else, eval, finally, for, if, in, is, item, instanceof, return, switch, this, throw, try, typeof, void, while, write, with",alias:"kw1"},langKeywords:{csv:"class, const, default, debugger, export, extends, false, function, import, namespace, new, null, package, private, protected, public, super, true, use, var",alias:"kw2"},windowKeywords:{csv:"alert, back, blur, close, confirm, focus, forward, home, navigate, onblur, onerror, onfocus, onload, onmove, onresize, onunload, open, print, prompt, scroll, status, stop",alias:"kw3"}});this.patterns=new Hash({slashComments:{pattern:this.common.slashComments,alias:"co1"},multiComments:{pattern:this.common.multiComments,alias:"co2"},strings:{pattern:this.common.strings,alias:"st0"},methodCalls:{pattern:this.common.properties,alias:"me0"},brackets:{pattern:this.common.brackets,alias:"br0"},numbers:{pattern:/\b((([0-9]+)?\.)?[0-9_]+([e][-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi,alias:"nu0"},regex:{pattern:this.delimToRegExp("/","\\","/","g","[gimy]*"),alias:"re0"},symbols:{pattern:/\+|-|\*|\/|%|!|@|&|\||\^|\<|\>|=|,|\.|;|\?|:/g,alias:"sy0"}});this.delimiters=new Hash({start:this.strictRegExp('<script type="text/javascript">','<script language="javascript">'),end:this.strictRegExp("<\/script>")});this.parent(b,a)}});
Fuel.css=new Class({Extends:Fuel,language:"css",initialize:function(b,a){this.keywords=new Hash({css1:{csv:"background-attachment, background-color, background-image, background-position, background-repeat, background, border-bottom, border-bottom-width, border-color, border-left, border-left-width, border-right, border-right-width, border-style, border-top, border-top-width, border-width, border, clear, color, display, float, font-family, font-size, font-style, font-variant, font-weight, font, height, letter-spacing, line-height, list-style-image, list-style-position, list-style-type, list-style, margin-bottom, margin-left, margin-right, margin-top, margin, padding-bottom, padding-left, padding-right, padding-top, padding, text-align, text-decoration, text-indent, text-transform, vertical-align, white-space, width, word-spacing",alias:"kw1"},css2:{csv:"azimuth, border-bottom-color, border-bottom-style, border-collapse, border-left-color, border-left-style, border-right-color, border-right-style, border-spacing, border-top-color, border-top-style, bottom, caption-side, clip, content, counter-increment, counter-reset, cue, cue-after, cue-before, cursor, direction, elevation, empty-cells, left, max-height, max-width, min-height, min-width, orphans, outline, outline-color, outline-style, outline-width, overflow, page-break-after, page-break-before, page-break-inside, pause, pause-after, pause-before, pitch, pitch-range, play-during, position, quotes, richness, right, speak, speak-header, speak-numeral, speak-punctuation, speech-rate, stress, table-layout, top, unicode-bidi, visibility, voice-family, volume, widows, z-index",alias:"kw1"},css3:{csv:"alignment-adjust, alignment-baseline, appearance, background-break, background-clip, background-origin, background-size, baseline-shift, binding, bookmark-label, bookmark-level, bookmark-target, border-bottom-left-radius, border-bottom-right-radius, border-break, border-image, border-length, border-radius, border-top-left-radius, border-top-right-radius, box-align, box-direction, box-flex, box-flex-group, box-lines, box-orient, box-pack, box-shadow, box-sizing, color-profile, column-break-after, column-break-before, column-count, column-fill, column-gap, column-rule, column-rule-color, column-rule-style, column-rule-width, column-span, column-width, columns, crop, display-model, display-role, dominant-baseline, drop-initial-after-adjust, drop-initial-after-align, drop-initial-before-adjust, drop-initial-before-align, drop-initial-size, drop-initial-value, fit, fit-position, float-offset, font-effect, font-emphasize, font-emphasize-position, font-emphasize-style, font-size-adjust, font-smooth, font-stretch, grid-columns, grid-rows, hanging-punctuation, hyphenate-after, hyphenate-before, hyphenate-character, hyphenate-lines, hyphenate-resource, hyphens, icon, image-orientation, image-resolution, inline-box-align, line-stacking, line-stacking-ruby, line-stacking-shift, line-stacking-strategy, mark, mark-after, mark-before, marker-offset, marks, marquee-direction, marquee-play-count, marquee-speed, marquee-style, move-to, nav-down, nav-index, nav-left, nav-right, nav-up, opacity, outline-offset, overflow-style, overflow-x, overflow-y, page, page-policy, phonemes, presentation-level, punctuation-trim, rendering-intent, resize, rest, rest-after, rest-before, rotation, rotation-point, ruby-align, ruby-overhang, ruby-position, ruby-span, size, string-set, tab-side, target, target-name, target-new, target-position, text-align-last, text-emphasis, text-height, text-justify, text-outline, text-replace, text-shadow, text-wrap, voice-balance, voice-duration, voice-pitch, voice-pitch-range, voice-rate, voice-stress, voice-volume, white-space-collapse, word-break, word-wrap",alias:"kw2"},values:{csv:"100, 200, 300, 400, 500, 600, 700, 800, 900, above, absolute, always, aqua, armenian, auto, avoid, baseline, below, bidi-override, black, blink, block, blue, bold, bolder, both, bottom, break-all, break-strict, break-word, break, capitalize, caption, center, circle, cjk-ideographic, close-quote, collapse, compact, condensed, crop, cross, crosshair, dashed, decimal-leading-zero, decimal, default, disc, dotted, double, e-resize, embed, expanded, extra-condensed, extra-expanded, fixed, fuchsia, georgian, gray, green, groove, hand, hebrew, help, hidden, hide, higher, hiragana-iroha, hiragana, icon, inherit, inline-table, inline, inset, inside, invert, italic, justify, katakana-iroha, katakana, keep-all, konq-center, landscape, large, larger, left, level, light, lighter, lime, line-through, list-item, loose, loud, lower-alpha, lower-greek, lower-latin, lower-roman, lowercase, lower, ltr, marker, maroon, medium, menu, message-box, middle, mix, move, n-resize, narrower, navy, ne-resize, never, no-close-quote, no-open-quote, no-repeat, none, normal, nowrap, nw-resize, oblique, olive, open-quote, outset, outside, overline, pointer, portrait, pre-wrap, pre, purple, red, relative, repeat, repeat-x, repeat-y, ridge, right, rtl, run-in, s-resize, scroll, se-resize, semi-condensed, semi-expanded, separate, show, silver, small-caps, small-caption, smaller, small, solid, square, static-position, static, status-bar, sub, super, sw-resize, table-caption, table-cell, table-column-group, table-column, table-footer-group, table-header-group, table-row, table-row-group, table, teal, text-bottom, text-top, text, thick, thin, top, transparent, ultra-condensed, ultra-expanded, underline, upper-alpha, upper-latin, upper-roman, uppercase, visible, w-resize, wait, white, wider, x-large, x-small, xx-large, xx-small, yellow",alias:"kw3"}});this.patterns=new Hash({multiComments:{pattern:this.common.multiComments,alias:"co1"},strings:{pattern:this.common.strings,alias:"st0"},selectors:{pattern:/([^\}\n]+)\{/gi,alias:"se0"},uri:{pattern:/url\s*\([^\)]*\)/gi,alias:"kw4"},units:{pattern:/\b(\d+[\.\d+]?\s*(px|pt|em|ex|cm|in|mm|pc|%)?)/gi,alias:"nu0"},hexColors:{pattern:/(#[A-F0-9]{3}([A-F0-9]{3})?)\b/gi,alias:"kw3"},rgbColors:{pattern:/(rgb\s*\(([1-2]?[0-9]{2}(\,\s*)?){3}\))/g,alias:"kw3"}});this.delimiters=new Hash({start:this.strictRegExp('<style type="text/css">'),end:this.strictRegExp("</style>")});this.parent(b,a)}});
Fuel.html=new Class({Extends:Fuel,language:"html",initialize:function(g,d){d.matchType="lazy";this.patterns=new Hash({comments:{pattern:/(?:\&lt;|<)!--[\s\S]*?--(?:\&gt;|>)/gim,alias:"co1"},cdata:{pattern:/(?:\&lt;|<)!\[CDATA\[[\s\S]*?\]\](?:\&gt;|>)/gim,alias:"st1"},closingTags:{pattern:/(?:\&lt;|<)\/[A-Z][A-Z0-9]*?(?:\&gt;|>)/gi,alias:"kw1"},doctype:{pattern:/(?:\&lt;|<)!DOCTYPE[\s\S]+?(?:\&gt;|>)/gim,alias:"st2"}});var e=/((?:\&lt;|<)[A-Z][A-Z0-9]*)(.*?)(\/?(?:\&gt;|>))/gi,f=/\b([\w-]+)([ \t]*)(=)([ \t]*)(['"][^'"]+['"]|[^'" \t]+)/gi,h=[],c=null,a=null,b=0;while((c=e.exec(g))!=null){h.push(new Wick(c[1],"kw1",c.index));while((a=f.exec(c[2]))!=null){b=c.index+c[1].length+a.index;h.push(new Wick(a[1],"kw2",b));b+=a[1].length+a[2].length;h.push(new Wick(a[3],"kw1",b));b+=a[3].length+a[4].length;h.push(new Wick(a[5],"kw3",b))}h.push(new Wick(c[3],"kw1",c.index+c[1].length+c[2].length))}this.parent(g,d,h)}});
Fuel.php=new Class({Extends:Fuel,language:"php",initialize:function(c,b,a){this.keywords=new Hash({keywords:{csv:"abstract, and, as, break, case, catch, cfunction, class, clone, const, continue, declare, default, do, else, elseif, enddeclare, endfor, endforeach, endif, endswitch, endwhile, extends, final, for, foreach, function, global, goto, if, implements, interface, instanceof, namespace, new, old_function, or, private, protected, public, static, switch, throw, try, use, var, while, xor",alias:"kw1"},langConstants:{csv:"__CLASS__, __DIR__, __FILE__, __FUNCTION__, __METHOD__, __NAMESPACE__, DEFAULT_INCLUDE_PATH, E_ALL, E_COMPILE_ERROR, E_COMPILE_WARNING, E_CORE_ERROR, E_CORE_WARNING, E_ERROR, E_NOTICE, E_PARSE, E_STRICT, E_USER_ERROR, E_USER_NOTICE, E_USER_WARNING, E_WARNING, PEAR_EXTENSION_DIR, PEAR_INSTALL_DIR, PHP_BINDIR, PHP_CONFIG_FILE_PATH, PHP_DATADIR, PHP_EXTENSION_DIR, PHP_LIBDIR, PHP_LOCALSTATEDIR, PHP_OS, PHP_OUTPUT_HANDLER_CONT, PHP_OUTPUT_HANDLER_END, PHP_OUTPUT_HANDLER_START, PHP_SYSCONFDIR, PHP_VERSION",alias:"kw1"},constructs:{csv:"array, die, echo, empty, exit, eval, include, include_once, isset, list, require, require_once, return, print, unset",alias:"kw1"},commonFuncs:{csv:"abs, addcslashes, addslashes, aggregate, apache_child_terminate, apache_get_version, apache_lookup_uri, apache_note, apache_request_headers, apache_response_headers, apache_setenv, array_change_key_case, array_chunk, array_count_values, array_diff, array_diff_assoc, array_fill, array_filter, array_flip, array_intersect, array_intersect_assoc, array_key_exists, array_keys, array_map, array_merge, array_merge_recursive, array_multisort, array_pad, array_pop, array_push, array_rand, array_reduce, array_reverse, array_search, array_shift, array_slice, array_splice, array_sum, array_unique, array_unshift, array_values, array_walk, arsort, asort, assert, assert_options, base64_decode, base64_encode, base_convert, basename, bin2hex, bindec, ceil, chdir, checkdate, chop, chown, chunk_split, clearstatcache, closedir, compact, connection_aborted, connection_status, constant, copy, count, count_chars, crc32, crypt, ctype_alnum, ctype_alpha, ctype_cntrl, ctype_digit, ctype_graph, ctype_lower, ctype_print, ctype_punct, ctype_space, ctype_upper, ctype_xdigit, current, date, debug_backtrace, debug_zval_dump, decbin, dechex, decoct, define, defined, dir, dirname, dl, doubleval, each, end, ereg, ereg_replace, eregi, eregi_replace, error_log, error_reporting, escapeshellarg, escapeshellcmd, exec, explode, extension_loaded, extract, fclose, feof, fflush, fgetc, fgetcsv, fgets, fgetss, file, file_exists, file_get_contents, fileatime, filectime, filegroup, fileinode, filemtime, fileowner, fileperms, filesize, filetype, floatval, flock, floor, flush, fmod, fnmatch, fopen, fpassthru, fputs, fread, fscanf, fseek, fsockopen, fstat, ftell, ftok, ftruncate, func_get_arg, func_get_args, func_num_args, fwrite, get_browser, get_cfg_var, get_declared_classes, get_extension_funcs, get_include_path, get_loaded_extensions, get_magic_quotes_gpc, get_magic_quotes_runtime, get_meta_tags, getallheaders, getcwd, getdate, getenv, getimagesize, getopt, getrandmax, getrusage, gettimeofday, gettype, glob, global, gmdate, gmmktime, gmstrftime, header, headers_sent, hebrev, hebrevc, hexdec, highlight_file, highlight_string, html_entity_decode, htmlentities, htmlspecialchars, ignore_user_abort, image_type_to_mime_type, implode, import_request_variables, in_array, ini_alter, ini_get, ini_get_all, ini_restore, ini_set, intval, ip2long, is_array, is_bool, is_dir, is_double, is_executable, is_file, is_finite, is_float, is_infinite, is_int, is_integer, is_link, is_long, is_nan, is_null, is_numeric, is_object, is_readable, is_real, is_resource, is_scalar, is_string, is_uploaded_file, is_writable, is_writeable, join, key, key_exists, krsort, ksort, link, linkinfo, localeconv, localtime, long2ip, lstat, ltrim, magic_quotes_runtime, mail, max, md5, md5_file, memory_get_usage, microtime, min, mkdir, mktime, move_uploaded_file, mt_getrandmax, mt_rand, mt_srand, natcasesort, natsort, next, nl2br, number_format, ob_clean, ob_end_clean, ob_end_flush, ob_flush, ob_get_clean, ob_get_contents, ob_get_flush, ob_get_length, ob_get_level, ob_get_status, ob_implicit_flush, ob_list_handlers, ob_start, octdec, opendir, overload, pack, parse_ini_file, parse_str, parse_url, passthru, pathinfo, pclose, pfsockopen, pg_affected_rows, pg_cancel_query, pg_client_encoding, pg_close, pg_cmdtuples, pg_connect, pg_connection_busy, pg_connection_reset, pg_connection_status, pg_convert, pg_copy_from, pg_copy_to, pg_dbname, pg_delete, pg_end_copy, pg_errormessage, pg_escape_bytea, pg_escape_string, pg_exec, pg_fetch_all, pg_fetch_array, pg_fetch_assoc, pg_fetch_object, pg_fetch_result, pg_fetch_row, pg_field_is_null, pg_field_name, pg_field_num, pg_field_prtlen, pg_field_size, pg_field_type, pg_fieldisnull, pg_fieldname, pg_fieldnum, pg_fieldprtlen, pg_fieldsize, pg_fieldtype, pg_free_result, pg_freeresult, pg_get_notify, pg_get_pid, pg_get_result, pg_getlastoid, pg_host, pg_insert, pg_last_error, pg_last_notice, pg_last_oid, pg_lo_close, pg_lo_create, pg_lo_export, pg_lo_import, pg_lo_open, pg_lo_read, pg_lo_read_all, pg_lo_seek, pg_lo_tell, pg_lo_unlink, pg_lo_write, pg_loclose, pg_locreate, pg_loexport, pg_loimport, pg_loopen, pg_loread, pg_loreadall, pg_lounlink, pg_lowrite, pg_meta_data, pg_num_fields, pg_num_rows, pg_numfields, pg_numrows, pg_options, pg_pconnect, pg_ping, pg_port, pg_put_line, pg_query, pg_result, pg_result_error, pg_result_seek, pg_result_status, pg_select, pg_send_query, pg_set_client_encoding, pg_trace, pg_tty, pg_unescape_bytea, pg_untrace, pg_update, phpcredits, phpinfo, phpversion, popen, pos, preg_grep, preg_match, preg_match_all, preg_quote, preg_replace, preg_replace_callback, preg_split, prev, print_r, printf, proc_close, proc_open, putenv, quoted_printable_decode, quotemeta, rand, range, rawurldecode, rawurlencode, readdir, readfile, readlink, realpath, rename, reset, restore_error_handler, restore_include_path, rewind, rewinddir, rmdir, round, rsort, rtrim, serialize, session_cache_expire, session_cache_limiter, session_decode, session_destroy, session_encode, session_get_cookie_params, session_id, session_is_registered, session_module_name, session_name, session_regenerate_id, session_register, session_save_path, session_set_cookie_params, session_set_save_handler, session_start, session_unregister, session_unset, session_write_close, set_error_handler, set_file_buffer, set_include_path, set_magic_quotes_runtime, set_socket_blocking, set_time_limit, setcookie, setlocale, settype, shell_exec, show_source, shuffle, similar_text, sizeof, sleep, socket_get_status, socket_set_blocking, socket_set_timeout, sort, split, spliti, sprintf, sql_regcase, srand, sscanf, stat, static, str_pad, str_repeat, str_replace, str_rot13, str_shuffle, str_word_count, strcasecmp, strchr, strcmp, strcoll, strcspn, stream_context_create, stream_context_get_options, stream_context_set_option, stream_context_set_params, stream_filter_append, stream_filter_prepend, stream_get_meta_data, stream_register_wrapper, stream_select, stream_set_blocking, stream_set_timeout, stream_set_write_buffer, stream_wrapper_register, strftime, strip_tags, stripcslashes, stripslashes, stristr, strlen, strnatcasecmp, strnatcmp, strncasecmp, strncmp, strpos, strrchr, strrev, strrpos, strspn, strstr, strtok, strtolower, strtotime, strtoupper, strtr, strval, substr, substr_count, substr_replace, system, tempnam, time, tmpfile, touch, trigger_error, trim, uasort, ucfirst, ucwords, uksort, umask, uniqid, unlink, unpack, unserialize, urldecode, urlencode, user_error, usleep, usort, var_dump, var_export, version_compare, virtual, vprintf, vsprintf, wordwrap",alias:"kw2"},database:{csv:"mysql, mysql_affected_rows, mysql_client_encoding, mysql_close, mysql_connect, mysql_create_db, mysql_createdb, mysql_data_seek, mysql_db_name, mysql_db_query, mysql_dbname, mysql_drop_db, mysql_dropdb, mysql_errno, mysql_error, mysql_escape_string, mysql_fetch_array, mysql_fetch_assoc, mysql_fetch_field, mysql_fetch_lengths, mysql_fetch_object, mysql_fetch_row, mysql_field_flags, mysql_field_len, mysql_field_name, mysql_field_seek, mysql_field_table, mysql_field_type, mysql_fieldflags, mysql_fieldlen, mysql_fieldname, mysql_fieldtable, mysql_fieldtype, mysql_free_result, mysql_freeresult, mysql_get_client_info, mysql_get_host_info, mysql_get_proto_info, mysql_get_server_info, mysql_info, mysql_insert_id, mysql_list_dbs, mysql_list_fields, mysql_list_processes, mysql_list_tables, mysql_listdbs, mysql_listfields, mysql_listtables, mysql_num_fields, mysql_num_rows, mysql_numfields, mysql_numrows, mysql_pconnect, mysql_query, mysql_real_escape_string, mysql_result, mysql_select_db, mysql_selectdb, mysql_stat, mysql_table_name, mysql_tablename, mysql_thread_id, mysql_unbuffered_query, mysqli, mysqli_affected_rows, mysqli_autocommit, mysqli_bind_param, mysqli_bind_result, mysqli_change_user, mysqli_character_set_name, mysqli_client_encoding, mysqli_close, mysqli_commit, mysqli_connect, mysqli_data_seek, mysqli_debug, mysqli_disable_reads_from_master, mysqli_disable_rpl_parse, mysqli_dump_debug_info, mysqli_enable_reads_from_master, mysqli_enable_rpl_parse, mysqli_errno, mysqli_error, mysqli_escape_string, mysqli_execute, mysqli_fetch, mysqli_fetch_array, mysqli_fetch_assoc, mysqli_fetch_field, mysqli_fetch_field_direct, mysqli_fetch_fields, mysqli_fetch_lengths, mysqli_fetch_object, mysqli_fetch_row, mysqli_field_count, mysqli_field_seek, mysqli_field_tell, mysqli_free_result, mysqli_get_client_info, mysqli_get_host_info, mysqli_get_proto_info, mysqli_get_server_info, mysqli_get_server_version, mysqli_info, mysqli_init, mysqli_insert_id, mysqli_kill, mysqli_master_query, mysqli_num_fields, mysqli_num_rows, mysqli_options, mysqli_param_count, mysqli_ping, mysqli_prepare, mysqli_prepare_result, mysqli_profiler, mysqli_query, mysqli_read_query_result, mysqli_real_connect, mysqli_real_escape_string, mysqli_real_query, mysqli_reload, mysqli_rollback, mysqli_rpl_parse_enabled, mysqli_rpl_probe, mysqli_rpl_query_type, mysqli_select_db, mysqli_send_long_data, mysqli_send_query, mysqli_set_opt, mysqli_slave_query, mysqli_ssl_set, mysqli_stat, mysqli_stmt_affected_rows, mysqli_stmt_close, mysqli_stmt_errno, mysqli_stmt_error, mysqli_stmt_store_result, mysqli_store_result, mysqli_thread_id, mysqli_thread_safe, mysqli_use_result, mysqli_warning_count",alias:"kw2"}});this.patterns=new Hash({slashComments:{pattern:this.common.slashComments,alias:"co1"},multiComments:{pattern:this.common.multiComments,alias:"co2"},strings:{pattern:this.common.strings,alias:"st0"},heredocs:{pattern:/(<<<\s*?(\'?)([A-Z0-9]+)\2[^\n]*?\n[\s\S]*?\n\3(?![A-Z0-9\s]))/gim,alias:"st1"},numbers:{pattern:/\b((([0-9]+)?\.)?[0-9_]+([e][\-+]?[0-9]+)?|0x[A-F0-9]+)\b/gi,alias:"nu0"},variables:{pattern:/[\$]{1,2}[A-Z_][\w]*/gim,alias:"kw3"},functions:{pattern:this.common.functionCalls,alias:"me1"},constants:{pattern:/\b[A-Za-z_][\w]*\b/g,alias:"kw4"},methods:{pattern:/->([\w]+)/gim,alias:"kw3"},brackets:{pattern:this.common.brackets,alias:"br0"}});this.delimiters=new Hash({start:this.strictRegExp("<?php","<?=","<%",'<script language="php">'),end:this.strictRegExp("?>","%>","<\/script>")});this.parent(c,b,a)}});
Fuel.shell=new Class({Extends:Fuel,language:"shell",initialize:function(a,b){this.keywords=new Hash({keywords:{csv:"if, fi, then, elif, else, for, do, done, until, while, break, continue, case, function, return, in, eq, ne, gt, lt, ge, le",alias:"kw0"},commands:{csv:"alias, apropos, awk, bash, bc, bg, builtin, bzip2, cal, cat, cd, cfdisk, chgrp, chmod, chown, chrootcksum, clear, cmp, comm, command, cp, cron, crontab, csplit, cut, date, dc, dd, ddrescue, declare, df, diff, diff3, dig, dir, dircolors, dirname, dirs, du, echo, egrep, eject, enable, env, ethtool, eval, exec, exit, expand, export, expr, false, fdformat, fdisk, fg, fgrep, file, find, fmt, fold, format, free, fsck, ftp, gawk, getopts, grep, groups, gzip, hash, head, history, hostname, id, ifconfig, import, install, join, kill, less, let, ln, local, locate, logname, logout, look, lpc, lpr, lprint, lprintd, lprintq, lprm, ls, lsof, make, man, mkdir, mkfifo, mkisofs, mknod, more, mount, mtools, mv, netstat, nice, nl, nohup, nslookup, open, op, passwd, paste, pathchk, ping, popd, pr, printcap, printenv, printf, ps, pushd, pwd, quota, quotacheck, quotactl, ram, rcp, read, readonly, renice, remsync, rm, rmdir, rsync, screen, scp, sdiff, sed, select, seq, set, sftp, shift, shopt, shutdown, sleep, sort, source, split, ssh, strace, su, sudo, sum, symlink, sync, tail, tar, tee, test, time, times, touch, top, traceroute, trap, tr, true, tsort, tty, type, ulimit, umask, umount, unalias, uname, unexpand, uniq, units, unset, unshar, useradd, usermod, users, uuencode, uudecode, v, vdir, vi, watch, wc, whereis, which, who, whoami, wget, xargs, yes",alias:"kw1"}}),this.patterns=new Hash({poundComments:{pattern:this.common.poundComments,alias:"co0"},strings:{pattern:this.common.strings,alias:"st0"}});this.parent(a,b)}});
Fuel.sql=new Class({Extends:Fuel,language:"sql",initialize:function(a,b){this.keywords=new Hash({keywords:{csv:"absolute, action, add, after, alter, as, asc, at, authorization, begin, bigint, binary, bit, by, cascade, char, character, check, checkpoint, close, collate, column, commit, committed, connect, connection, constraint, contains, continue, create, cube, current, current_date, current_time, cursor, database, date, deallocate, dec, decimal, declare, default, delete, desc, distinct, double, drop, dynamic, else, end, end-exec, escape, except, exec, execute, false, fetch, first, float, for, force, foreign, forward, free, from, full, function, global, goto, grant, group, grouping, having, hour, ignore, index, inner, insensitive, insert, instead, int, integer, intersect, into, is, isolation, key, last, level, load, local, max, min, minute, modify, move, name, national, nchar, next, no, numeric, of, off, on, only, open, option, order, out, output, partial, password, precision, prepare, primary, prior, privileges, procedure, public, read, real, references, relative, repeatable, restrict, return, returns, revoke, rollback, rollup, rows, rule, schema, scroll, second, section, select, sequence, serializable, set, size, smallint, static, statistics, table, temp, temporary, then, time, timestamp, to, top, transaction, translation, trigger, true, truncate, uncommitted, union, unique, update, values, varchar, varying, view, when, where, with, work",alias:"kw1",mod:"gi"},functions:{csv:"abs, avg, case, cast, coalesce, convert, count, current_timestamp, current_user, day, isnull, left, lower, month, nullif, replace, right, session_user, space, substring, sum, system_user, upper, user, year",alias:"kw2",mod:"gi"},operators:{csv:"all, and, any, between, cross, in, join, like, not, null, or, outer, some",alias:"kw3",mod:"gi"}}),this.patterns=new Hash({singleLineComments:{pattern:/--(.*)$/gm,alias:"co0"},multiLineComments:{pattern:this.common.multiComments,alias:"co1"},multiLineStrings:{pattern:this.common.multiLineStrings,alias:"st0"}});this.parent(a,b)}});

/* AutoComplete */
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(b,a){this.element=$(b);this.setOptions(a);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 c=this.options.selectMode;this.typeAhead=(c=="type-ahead");this.selectMode=(c===true)?"selection":c;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(a){this.focussed=a;if(!a){this.hideChoices(true);}this.fireEvent((a)?"onFocus":"onBlur",[this.element]);},onCommand:function(b){if(!b&&this.focussed){return this.prefetch();}if(b&&b.key&&!b.shift){switch(b.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 a=(b.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((a)?"getPrevious":"getNext"):((a)?"getLast":"getFirst")](this.options.choicesMatch),true);}return false;case"esc":case"tab":this.hideChoices(true);break;}}return true;},setSelection:function(f){var g=this.selected.inputValue,h=g;var a=this.queryValue.length,c=g.length;if(g.substr(0,a).toLowerCase()!=this.queryValue.toLowerCase()){a=0;}if(this.options.multiple){var e=this.options.separatorSplit;h=this.element.value;a+=this.queryIndex;c+=this.queryIndex;var b=h.substr(this.queryIndex).split(e,1)[0];h=h.substr(0,this.queryIndex)+g+h.substr(this.queryIndex+b.length);if(f){var d=h.split(this.options.separatorSplit).filter(function(j){return this.test(j);},/[^\s,]+/);if(!this.options.allowDupes){d=[].combine(d);}var i=this.options.separator;h=d.join(i)+i;c=h.length;}}this.observer.setValue(h);this.opted=h;if(f||this.selectMode=="pick"){a=c;}this.element.selectRange(a,c);this.fireEvent("onSelection",[this.element,this.selected,h,g]);},showChoices:function(){var c=this.options.choicesMatch,b=this.choices.getFirst(c);this.selected=this.selectedValue=null;if(this.fix){var e=this.element.getCoordinates(this.relative),a=this.options.width||"auto";this.choices.setStyles({left:e.left,top:e.bottom,width:(a===true||a=="inherit")?e.width:a});}if(!b){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||b.inputValue==this.queryValue){this.choiceOver(b,this.typeAhead);}var d=this.choices.getChildren(c),f=this.options.maxChoices;var i={overflowY:"hidden",height:""};this.overflown=false;if(d.length>f){var j=d[f-1];i.overflowY="scroll";i.height=j.getCoordinates(this.choices).bottom;this.overflown=true;}this.choices.setStyles(i);this.fix.show();if(this.options.visibleChoices){var h=document.getScroll(),k=document.getSize(),g=this.choices.getCoordinates();if(g.right>h.x+k.x){h.x=g.right-k.x;}if(g.bottom>h.y+k.y){h.y=g.bottom-k.y;}window.scrollTo(Math.min(h.x,g.left),Math.min(h.y,g.top));}},hideChoices:function(a){if(a){var c=this.element.value;if(this.options.forceSelect){c=this.opted;}if(this.options.autoTrim){c=c.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}this.observer.setValue(c);}if(!this.visible){return;}this.visible=false;if(this.selected){this.selected.removeClass("autocompleter-selected");}this.observer.clear();var b=function(){this.choices.setStyle("display","none");this.fix.hide();}.bind(this);if(this.fx){this.fx.start(0).chain(b);}else{b();}this.fireEvent("onHide",[this.element,this.choices]);},prefetch:function(){var f=this.element.value,e=f;if(this.options.multiple){var c=this.options.separatorSplit;var a=f.split(c);var b=this.element.getSelectedRange().start;var g=f.substr(0,b).split(c);var d=g.length-1;b-=g[d].length;e=a[d];}if(e.length<this.options.minLength){this.hideChoices();}else{if(e===this.queryValue||(this.visible&&e==this.selectedValue)){if(this.visible){return false;}this.showChoices();}else{this.queryValue=e;this.queryIndex=b;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(b){this.choices.empty();this.cached=b;var a=b&&$type(b);if(!a||(a=="array"&&!b.length)||(a=="hash"&&!b.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<b.length&&!this.options.overflow){b.length=this.options.maxChoices;}b.each(this.options.injectChoice||function(d){var c=new Element("li",{html:this.markQueryValue(d)});c.inputValue=d;this.addChoiceEvents(c).inject(this.choices);},this);this.showChoices();}},choiceOver:function(c,d){if(!c||c==this.selected){return;}if(this.selected){this.selected.removeClass("autocompleter-selected");}this.selected=c.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,d]);if(!this.selectMode){this.opted=this.element.value;}if(!d){return;}this.selectedValue=this.selected.inputValue;if(this.overflown){var f=this.selected.getCoordinates(this.choices),e=this.options.overflowMargin,g=this.choices.scrollTop,a=this.choices.offsetHeight,b=g+a;if(f.top-e<g&&g){this.choices.scrollTop=Math.max(f.top-e,0);}else{if(f.bottom+e>b){this.choices.scrollTop=Math.min(f.bottom-a+e,b);}}}if(this.selectMode){this.setSelection();}},choiceSelect:function(a){if(a){this.choiceOver(a);}this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(a){return(a||this.tokens).filter(function(b){return this.test(b);},new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i"));},markQueryValue:function(a){return(!this.options.markQuery||!this.queryValue)?a:a.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",(this.options.filterCase)?"":"i"),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(a){return a.addEvents({mouseover:this.choiceOver.bind(this,[a]),click:this.choiceSelect.bind(this,[a])});}});var OverlayFix=new Class({initialize:function(a){if(Browser.Engine.trident){this.element=$(a);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 a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles($extend(a,{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 e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e;}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length;}else{var b=this.value;var d=b.length-b.match(/[\n\r]*$/)[0].length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length;}return e;},selectRange:function(d,a){if(Browser.Engine.trident){var c=this.value.substr(d,a-d).replace(/\r/g,"").length;d=this.value.substr(0,d).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);b.moveEnd("character",d+c);b.moveStart("character",d);b.select();}else{this.focus();this.setSelectionRange(d,a);}return this;}});Autocompleter.Base=Autocompleter;Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:"value"},query:function(){var c=$unlink(this.options.postData)||{};c[this.options.postVar]=this.queryValue;var b=$(this.options.indicator);if(b){b.setStyle("display","");}var a=this.options.indicatorClass;if(a){this.element.addClass(a);}this.fireEvent("onRequest",[this.element,this.request,c,this.queryValue]);this.request.send({data:c});},queryResponse:function(){var b=$(this.options.indicator);if(b){b.setStyle("display","none");}var a=this.options.indicatorClass;if(a){this.element.removeClass(a);}return this.fireEvent("onComplete",[this.element,this.request]);}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.JSON($merge({url:b,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this));},queryResponse:function(a){this.parent();this.update(a);}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.HTML($merge({url:b,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this));},queryResponse:function(a,b){this.parent();if(!b||!b.length){this.hideChoices();}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(c){var d=c.innerHTML;c.inputValue=d;this.addChoiceEvents(c.set("html",this.markQueryValue(d)));},this);this.showChoices();}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(c,a,b){this.element=$(c)||$$(c);this.addEvent("onFired",a);this.setOptions(b);this.bound=this.changed.bind(this);this.resume();},changed:function(){var a=this.element.get("value");if($equals(this.value,a)){return;}this.clear();this.value=a;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(a){this.value=a;this.element.set("value",a);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(b,a){return(b==a||JSON.encode(b)==JSON.encode(a));};

/* uuid */
function randomUUID() {
  var s = [], itoh = '0123456789ABCDEF';
  for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10);
  s[14] = 4; s[19] = (s[19] & 0x3) | 0x8;
  for (var i = 0; i <36; i++) s[i] = itoh[s[i]];
  s[8] = s[13] = s[18] = s[23] = '-';
  return s.join('');
}

/* autocompleter */
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(b,a){this.element=$(b);this.setOptions(a);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 c=this.options.selectMode;this.typeAhead=(c=="type-ahead");this.selectMode=(c===true)?"selection":c;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(a){this.focussed=a;if(!a){this.hideChoices(true);}this.fireEvent((a)?"onFocus":"onBlur",[this.element]);},onCommand:function(b){if(!b&&this.focussed){return this.prefetch();}if(b&&b.key&&!b.shift){switch(b.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 a=(b.key=="up");this.choiceOver((this.selected||this.choices)[(this.selected)?((a)?"getPrevious":"getNext"):((a)?"getLast":"getFirst")](this.options.choicesMatch),true);}return false;case"esc":case"tab":this.hideChoices(true);break;}}return true;},setSelection:function(f){var g=this.selected.inputValue,h=g;var a=this.queryValue.length,c=g.length;if(g.substr(0,a).toLowerCase()!=this.queryValue.toLowerCase()){a=0;}if(this.options.multiple){var e=this.options.separatorSplit;h=this.element.value;a+=this.queryIndex;c+=this.queryIndex;var b=h.substr(this.queryIndex).split(e,1)[0];h=h.substr(0,this.queryIndex)+g+h.substr(this.queryIndex+b.length);if(f){var d=h.split(this.options.separatorSplit).filter(function(j){return this.test(j);},/[^\s,]+/);if(!this.options.allowDupes){d=[].combine(d);}var i=this.options.separator;h=d.join(i)+i;c=h.length;}}this.observer.setValue(h);this.opted=h;if(f||this.selectMode=="pick"){a=c;}this.element.selectRange(a,c);this.fireEvent("onSelection",[this.element,this.selected,h,g]);},showChoices:function(){var c=this.options.choicesMatch,b=this.choices.getFirst(c);this.selected=this.selectedValue=null;if(this.fix){var e=this.element.getCoordinates(this.relative),a=this.options.width||"auto";this.choices.setStyles({left:e.left,top:e.bottom,width:(a===true||a=="inherit")?e.width:a});}if(!b){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||b.inputValue==this.queryValue){this.choiceOver(b,this.typeAhead);}var d=this.choices.getChildren(c),f=this.options.maxChoices;var i={overflowY:"hidden",height:""};this.overflown=false;if(d.length>f){var j=d[f-1];i.overflowY="scroll";i.height=j.getCoordinates(this.choices).bottom;this.overflown=true;}this.choices.setStyles(i);this.fix.show();if(this.options.visibleChoices){var h=document.getScroll(),k=document.getSize(),g=this.choices.getCoordinates();if(g.right>h.x+k.x){h.x=g.right-k.x;}if(g.bottom>h.y+k.y){h.y=g.bottom-k.y;}window.scrollTo(Math.min(h.x,g.left),Math.min(h.y,g.top));}},hideChoices:function(a){if(a){var c=this.element.value;if(this.options.forceSelect){c=this.opted;}if(this.options.autoTrim){c=c.split(this.options.separatorSplit).filter($arguments(0)).join(this.options.separator);}this.observer.setValue(c);}if(!this.visible){return;}this.visible=false;if(this.selected){this.selected.removeClass("autocompleter-selected");}this.observer.clear();var b=function(){this.choices.setStyle("display","none");this.fix.hide();}.bind(this);if(this.fx){this.fx.start(0).chain(b);}else{b();}this.fireEvent("onHide",[this.element,this.choices]);},prefetch:function(){var f=this.element.value,e=f;if(this.options.multiple){var c=this.options.separatorSplit;var a=f.split(c);var b=this.element.getSelectedRange().start;var g=f.substr(0,b).split(c);var d=g.length-1;b-=g[d].length;e=a[d];}if(e.length<this.options.minLength){this.hideChoices();}else{if(e===this.queryValue||(this.visible&&e==this.selectedValue)){if(this.visible){return false;}this.showChoices();}else{this.queryValue=e;this.queryIndex=b;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(b){this.choices.empty();this.cached=b;var a=b&&$type(b);if(!a||(a=="array"&&!b.length)||(a=="hash"&&!b.getLength())){(this.options.emptyChoices||this.hideChoices).call(this);}else{if(this.options.maxChoices<b.length&&!this.options.overflow){b.length=this.options.maxChoices;}b.each(this.options.injectChoice||function(d){var c=new Element("li",{html:this.markQueryValue(d)});c.inputValue=d;this.addChoiceEvents(c).inject(this.choices);},this);this.showChoices();}},choiceOver:function(c,d){if(!c||c==this.selected){return;}if(this.selected){this.selected.removeClass("autocompleter-selected");}this.selected=c.addClass("autocompleter-selected");this.fireEvent("onSelect",[this.element,this.selected,d]);if(!this.selectMode){this.opted=this.element.value;}if(!d){return;}this.selectedValue=this.selected.inputValue;if(this.overflown){var f=this.selected.getCoordinates(this.choices),e=this.options.overflowMargin,g=this.choices.scrollTop,a=this.choices.offsetHeight,b=g+a;if(f.top-e<g&&g){this.choices.scrollTop=Math.max(f.top-e,0);}else{if(f.bottom+e>b){this.choices.scrollTop=Math.min(f.bottom-a+e,b);}}}if(this.selectMode){this.setSelection();}},choiceSelect:function(a){if(a){this.choiceOver(a);}this.setSelection(true);this.queryValue=false;this.hideChoices();},filter:function(a){return(a||this.tokens).filter(function(b){return this.test(b);},new RegExp(((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp(),(this.options.filterCase)?"":"i"));},markQueryValue:function(a){return(!this.options.markQuery||!this.queryValue)?a:a.replace(new RegExp("("+((this.options.filterSubset)?"":"^")+this.queryValue.escapeRegExp()+")",(this.options.filterCase)?"":"i"),'<span class="autocompleter-queried">$1</span>');},addChoiceEvents:function(a){return a.addEvents({mouseover:this.choiceOver.bind(this,[a]),click:this.choiceSelect.bind(this,[a])});}});var OverlayFix=new Class({initialize:function(a){if(Browser.Engine.trident){this.element=$(a);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 a=this.element.getCoordinates(this.relative);delete a.right;delete a.bottom;this.fix.setStyles($extend(a,{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 e={start:0,end:0};var a=this.getDocument().selection.createRange();if(!a||a.parentElement()!=this){return e;}var c=a.duplicate();if(this.type=="text"){e.start=0-c.moveStart("character",-100000);e.end=e.start+a.text.length;}else{var b=this.value;var d=b.length-b.match(/[\n\r]*$/)[0].length;c.moveToElementText(this);c.setEndPoint("StartToEnd",a);e.end=d-c.text.length;c.setEndPoint("StartToStart",a);e.start=d-c.text.length;}return e;},selectRange:function(d,a){if(Browser.Engine.trident){var c=this.value.substr(d,a-d).replace(/\r/g,"").length;d=this.value.substr(0,d).replace(/\r/g,"").length;var b=this.createTextRange();b.collapse(true);b.moveEnd("character",d+c);b.moveStart("character",d);b.select();}else{this.focus();this.setSelectionRange(d,a);}return this;}});Autocompleter.Base=Autocompleter;Autocompleter.Request=new Class({Extends:Autocompleter,options:{postData:{},ajaxOptions:{},postVar:"value"},query:function(){var c=$unlink(this.options.postData)||{};c[this.options.postVar]=this.queryValue;var b=$(this.options.indicator);if(b){b.setStyle("display","");}var a=this.options.indicatorClass;if(a){this.element.addClass(a);}this.fireEvent("onRequest",[this.element,this.request,c,this.queryValue]);this.request.send({data:c});},queryResponse:function(){var b=$(this.options.indicator);if(b){b.setStyle("display","none");}var a=this.options.indicatorClass;if(a){this.element.removeClass(a);}return this.fireEvent("onComplete",[this.element,this.request]);}});Autocompleter.Request.JSON=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.JSON($merge({url:b,link:"cancel"},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this));},queryResponse:function(a){this.parent();this.update(a);}});Autocompleter.Request.HTML=new Class({Extends:Autocompleter.Request,initialize:function(c,b,a){this.parent(c,a);this.request=new Request.HTML($merge({url:b,link:"cancel",update:this.choices},this.options.ajaxOptions)).addEvent("onComplete",this.queryResponse.bind(this));},queryResponse:function(a,b){this.parent();if(!b||!b.length){this.hideChoices();}else{this.choices.getChildren(this.options.choicesMatch).each(this.options.injectChoice||function(c){var d=c.innerHTML;c.inputValue=d;this.addChoiceEvents(c.set("html",this.markQueryValue(d)));},this);this.showChoices();}}});Autocompleter.Ajax={Base:Autocompleter.Request,Json:Autocompleter.Request.JSON,Xhtml:Autocompleter.Request.HTML};var Observer=new Class({Implements:[Options,Events],options:{periodical:false,delay:1000},initialize:function(c,a,b){this.element=$(c)||$$(c);this.addEvent("onFired",a);this.setOptions(b);this.bound=this.changed.bind(this);this.resume();},changed:function(){var a=this.element.get("value");if($equals(this.value,a)){return;}this.clear();this.value=a;this.timeout=this.onFired.delay(this.options.delay,this);},setValue:function(a){this.value=a;this.element.set("value",a);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(b,a){return(b==a||JSON.encode(b)==JSON.encode(a));};

/* zero clipboard */
var ZeroClipboard={version:"1.0.4",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(a){if(typeof(a)=="string"){a=document.getElementById(a);}if(!a.addClass){a.hide=function(){this.style.display="none";};a.show=function(){this.style.display="";};a.addClass=function(b){this.removeClass(b);this.className+=" "+b;};a.removeClass=function(b){this.className=this.className.replace(new RegExp("\\s*"+b+"\\s*")," ").replace(/^\s+/,"").replace(/\s+$/,"");};a.hasClass=function(b){return !!this.className.match(new RegExp("\\s*"+b+"\\s*"));};}return a;},setMoviePath:function(a){this.moviePath=a;},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c);}},register:function(b,a){this.clients[b]=a;},getDOMObjectPosition:function(b){var a={left:0,top:0,width:b.width?b.width:b.offsetWidth,height:b.height?b.height:b.offsetHeight};while(b){a.left+=b.offsetLeft;a.top+=b.offsetTop;b=b.offsetParent;}return a;},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a);}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:true,handlers:null,glue:function(d){this.domElement=ZeroClipboard.$(d);var e=99;if(this.domElement.style.zIndex){e=parseInt(this.domElement.style.zIndex)+1;}var c=ZeroClipboard.getDOMObjectPosition(this.domElement);this.div=document.createElement("div");var b=this.div.style;b.position="absolute";b.left=""+c.left+"px";b.top=""+c.top+"px";b.width=""+c.width+"px";b.height=""+c.height+"px";b.zIndex=e;var a=document.getElementsByTagName("body")[0];a.appendChild(this.div);this.div.innerHTML=this.getHTML(c.width,c.height);},getHTML:function(d,a){var c="";var b="id="+this.id+"&width="+d+"&height="+a;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>';}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />';}return c;},hide:function(){if(this.div){this.div.style.left="-2000px";}},show:function(){this.reposition();},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div);}catch(b){}this.domElement=null;this.div=null;}},reposition:function(c){if(c){this.domElement=ZeroClipboard.$(c);if(!this.domElement){this.hide();}}if(this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement);var a=this.div.style;a.left=""+b.left+"px";a.top=""+b.top+"px";}},setText:function(a){this.clipText=a;if(this.ready){this.movie.setText(a);}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[];}this.handlers[a].push(b);},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a);}},setCSSEffects:function(a){this.cssEffects=!!a;},receiveEvent:function(d,e){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null);},1);return;}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null);},100);this.ready=true;return;}this.ready=true;this.movie.setText(this.clipText);this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":if(this.domElement&&this.cssEffects){this.domElement.addClass("hover");if(this.recoverActive){this.domElement.addClass("active");}}break;case"mouseout":if(this.domElement&&this.cssEffects){this.recoverActive=false;if(this.domElement.hasClass("active")){this.domElement.removeClass("active");this.recoverActive=true;}this.domElement.removeClass("hover");}break;case"mousedown":if(this.domElement&&this.cssEffects){this.domElement.addClass("active");}break;case"mouseup":if(this.domElement&&this.cssEffects){this.domElement.removeClass("active");this.recoverActive=false;}break;}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var f=this.handlers[d][b];if(typeof(f)=="function"){f(this,e);}else{if((typeof(f)=="object")&&(f.length==2)){f[0][f[1]](this,e);}else{if(typeof(f)=="string"){window[f](this,e);}}}}}}};

/* supporting plugins */
/* clickables */
(function(a){this.Clickables=new Class({Implements:[Options],options:{elements:"li",selectClass:"",anchorToSpan:false},initialize:function(b){this.setOptions(b);this.elements=$$(this.options.elements);this.doClickables();},doClickables:function(){this.elements.each(function(d){var b=d.getElements("a"+(this.options.selectClass?"."+this.options.selectClass:""))[0];if($defined(b)){this.setClick(d,b.get("href"));if(this.options.anchorToSpan){var c=new Element("span",{text:b.get("text")}).replaces(b);}}},this);},setClick:function(c,b){c.addEvent("click",function(){window.location=b;});}});})(document.id);
/* dotter */
(function(a){this.Dotter=new Class({Implements:[Options,Events],options:{delay:1000,dot:".",message:"Loading",numDots:3,property:"text",reset:false},initialize:function(b,c){this.setOptions(c);this.container=a(b);this.dots=0;this.running=false;},dot:function(){if(this.running){var b=this.container.get(this.options.property);this.dots++;this.container.set(this.options.property,(this.dots%this.options.numDots!=0?b:this.options.message)+""+this.options.dot);}return this;},load:function(){this.loaded=true;this.dots=0;this.dotter=function(){this.dot();this.fireEvent("dot");}.bind(this);this.periodical=this.dotter.periodical(this.options.delay);this.container.set(this.options.property,this.options.message+""+this.options.dot);return this;},start:function(){if(!this.loaded||this.options.reset){this.load();}this.running=true;this.fireEvent("start");return this;},stop:function(){this.running=this.loaded=false;$clear(this.periodical);this.fireEvent("stop");return this;}});})($);
/* lazyload */
(function(a){this.LazyLoad=new Class({Implements:[Options,Events],options:{range:200,image:"blank.gif",resetDimensions:true,elements:"img",container:window},initialize:function(b){this.setOptions(b);this.container=a(this.options.container);this.elements=$$(this.options.elements);this.containerHeight=this.container.getSize().y;this.start=0;this.elements=this.elements.filter(function(d){if(d.getPosition(this.container).y>this.containerHeight+this.options.range){d.store("oSRC",d.get("src")).set("src",this.options.image);if(this.options.resetDimensions){d.store("oWidth",d.get("width")).store("oHeight",d.get("height")).set({width:"",height:""});}return true;}},this);var c=function(){var d=this.container.getScroll().y;if(d>this.start){this.elements=this.elements.filter(function(e){if((this.container.getScroll().y+this.options.range+this.containerHeight)>=e.getPosition(this.container).y){if(e.retrieve("oSRC")){e.set("src",e.retrieve("oSRC"));}if(this.options.resetDimensions){e.set({width:e.retrieve("oWidth"),height:e.retrieve("oHeight")});}this.fireEvent("load",[e]);return false;}return true;},this);this.start=d;}this.fireEvent("scroll");if(!this.elements.length){this.container.removeEvent("scroll",c);this.fireEvent("complete");}}.bind(this);this.container.addEvent("scroll",c);}});})($);
/* scrollspy */
(function(a){this.ScrollSpy=new Class({Implements:[Options,Events],options:{min:0,mode:"vertical",max:0,container:window,onEnter:$empty,onLeave:$empty,onTick:$empty},initialize:function(b){this.setOptions(b);this.container=a(this.options.container);this.enters=this.leaves=0;this.max=this.options.max;if(this.max==0){var c=this.container.getScrollSize();this.max=this.options.mode=="vertical"?c.y:c.x;}this.addListener();},addListener:function(){this.inside=false;this.container.addEvent("scroll",function(){var b=this.container.getScroll();var c=this.options.mode=="vertical"?b.y:b.x;if(c>=this.options.min&&c<=this.max){if(!this.inside){this.inside=true;this.enters++;this.fireEvent("enter",[b,this.enters]);}this.fireEvent("tick",[b,this.inside,this.enters,this.leaves]);}else{if(this.inside){this.inside=false;this.leaves++;this.fireEvent("leave",[b,this.leaves]);}}}.bind(this));}});})($);
/* zebratable */
(function(a){this.ZebraTable=new Class({Implements:[Options],options:{elements:"table.list-table",cssEven:"even",cssOdd:"odd",cssHighlight:"highlight",cssMouseEnter:"mo"},initialize:function(b){this.setOptions(b);$$(this.options.elements).each(function(c){this.zebraize(c);},this);},zebraize:function(b){b.getElements("tr").each(function(f,e){if(f.getFirst().get("tag")!="th"){var d=this,c=e%2?d.options.even:d.options.odd;f.addClass(c).addEvents({mouseenter:function(){if(!f.hasClass(d.options.cssHighlight)){f.addClass(d.options.cssMouseEnter).removeClass(c);}},mouseleave:function(){if(!f.hasClass(d.options.cssHighlight)){f.removeClass(d.options.cssMouseEnter).addClass(c);}},click:function(){f.toggleClass(d.options.cssMouseEnter).toggleClass(d.options.cssHighlight);if(!f.hasClass(d.options.cssHighlight)){f.removeClass(d.options.cssMouseEnter);}}});}},this);}});})($);

/**************** site-specific ****************/
(function($,$$,settings) {
	
	/** vars / code shortening **/
	var o = 'opacity';
	ZeroClipboard.setMoviePath('http://davidwalsh.name/wp-content/themes/walshbook3/ZeroClipboard.swf');
	
	/** lighter / syntax **/
	(function() {
		var pres = $$('pre');
		pres.each(function(pre) { if(!Fuel[pre.get('class')]) { pre.set('class','js'); } });
		pres.light({ altLines: 'hover', mode: 'div', indent:2, flame:'standard' });
	})();
	
	
	/** header opacity **/
	(function() {
		var topbar = $('topbar').set('tween',{ duration: 200 }), bt = $('button-top'), bb = $('button-bottom'), db = 'disabled-button';
		var topbarME = function() { topbar.tween(o,1); }, topbarML = function() { topbar.tween(o,0.5); }, ws = window.getScrollSize().y;
		var ss = new ScrollSpy({
			min: 30,
			max: ws-30,
			onLeave: function(pos) {
				topbar.tween(o,1).removeEvents('mouseenter',topbarME).removeEvents('mouseleave',topbarML);
				if(pos.y < 10) { bt.addClass(db); }	
				else if(pos.y > ws - 30) { bb.addClass(db); }
			},
			onEnter: function() {
				topbar.tween(o,0.5).addEvent('mouseenter',topbarME).addEvent('mouseleave',topbarML);
			},
			onTick: function(pos) {
				if(pos.y > 10 && bt.hasClass(db)) { bt.removeClass(db); }
				if(pos.y < ws && bb.hasClass(db)) { bb.removeClass(db); }
			}
		});
	})();
	
	/** tabs **/
	$$('ul.tabs').each(function(tabList) {
		var tabContentList = tabList.getNext('ul.tabs-content'), 
			cookie = tabList.get('title'),
			startIndex = Cookie.read(cookie) || 0,
			tabs = tabList.set('title','').getElements('li'), 	
			activeTab = tabs[startIndex].addClass('active'), 
			activeContent = tabContentList.getElements('li')[startIndex].setStyle('height','auto');
		tabs.each(function(tab,i) {
			var content = tabContentList.getElements('li')[i], contentHeight = content.getScrollSize().y;
			tab.addEvent('click',function() {
				if(tab != activeTab) {
					activeTab.removeClass('active');
					(activeTab = tab).addClass('active');
					activeContent.set('tween',{
						onComplete:function() {
							activeContent = content.fade('in').set('tween',{ onComplete: $empty }).tween('height',contentHeight);
						}
					}).setStyles({
						height: contentHeight,
						overflow: 'hidden'
					}).fade('out').tween('height','0');
					Cookie.write(cookie,i);
				}
			});
		});
		activeTab.fireEvent('click');
	});	
	
	/** top bar **/
	(function() {
		var activeTab, fadeShow = 0.85;
		$$('#topbar-network, #topbar-popular').each(function(button) {
			//button swapping
			var content = $(button.get('id') + '-content'), indexed = false;
			content.setStyles({opacity:0,display:'block'});
			button.addEvent('mouseenter',function(e) {
				e.stop();
				if(activeTab && activeTab != content) { activeTab.fade(0); }
				activeTab = content.fade(fadeShow);
				if(!indexed) {
					indexed = true;
					//content "accordion"
					var items = content.getElements('li');
					items.each(function(li) {
						li.store('oWidth',li.getStyle('width').toInt()).addEvents({
							mouseenter:function() {
								li.tween('width',190);
							},
							mouseleave:function() {
								li.tween('width',li.retrieve('oWidth'));
							}
						});
					});
				}
			});
		});
		//hiders
		$$('a.menu').addEvent('mouseenter',function() { if(!this.get('id') && activeTab) { activeTab.fade(0); } });
		$(document.body).addEvent('click',function() { if(activeTab) { activeTab.fade(0); } });
		$(window).addEvent('scroll',function() { if(activeTab) { activeTab.fade(0); } });
	})();
	
	/** lazy loading **/
	var lazyloader = new LazyLoad({
		range: 500,
		image: '/wp-content/themes/walshbook3/images/blank.gif',
		elements: 'img'
	});
	window.fireEvent('scroll');
	
	/** comments count **/
	(function() {
		var cc = $('comment-count');
		if(cc) {
			var len = $$('.comment').length;
			cc.set('text',(len || 'No') + ' ' + cc.get('text'));
		}
	})();
	
	/** search **/
	(function() {
		var searchBox = $('s'), originalSearch = searchBox.value;
		searchBox.addEvents({
			blur: function() {
				if(this.value == '') {
					this.addClass('i').value = originalSearch;
				}
			},
			focus: function() {
				if(this.value == originalSearch) {
					this.removeClass('i').value = '';
				}
			}
		});
	})();
	
	/** smoothscroll **/
	new Fx.SmoothScroll();
	
	/** link nudge **/
	$$('#topics1 a, #topics2 a').addEvents({
		mouseenter: function() {
			if(!this.retrieve('oPad')) { this.store('oPad',this.getStyle('padding-left')); }
			this.tween('padding-left',30);
		},
		mouseleave: function() {
			this.tween('padding-left',this.retrieve('oPad'));
		}
	});
	
	/* autocomplete */
	window.addEvent('load',function(){
		new Autocompleter.Request.HTML('s', '/wp-content/themes/walshbook3/autocomplete.php?s', {
			'postVar': 'search'
		});
	});
	
	/* lighter buttons */
	(function() {
		/* textmate */
		var label, request = new Request({
			url: '/wp-content/themes/walshbook3/make-snippet.php',
			method: 'post',
			onSuccess: function(url) {
				window.location = '/wp-content/themes/walshbook3/make-snippet.php?file=' + url + '&label=' + label;
			}
		});
		/* lighter */
		var pres = $$('pre');
		if(pres.length) {
			var flasher = new Element('div',{
				text: 'Copied!',
				'class': 'copied'
			}).inject(document.body,'top');
		}
		$$('.standardLighter').each(function(pre,i) {
			var link = new Element('a',{
				text: 'Get the raw code',
				title:  'Get the raw code',
				'class': 'raw',
				href: '#',
				opacity: 0.5,
				events: {
					click: function(e) {
						if(e) { e.stop(); }
						var ta = new Element('textarea',{
							value: pres[i].get('html').trim().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&'),
							'class': 'rawta'
						}).inject(pre,'after');
						ta.select();
						new Fx.Scroll(window).toElement(ta);
						this.fade('out');
					}
				}
			}).inject(pre,'top');
			var textmateicon = new Element('a',{
				text: 'Click here to add this snippet to TextMate',
				href: '#',
				title: 'Click here to add this snippet to TextMate',
				'class': 'tmbundle',
				opacity: 0.5,
				events: {
					click: function(e) {
						e.stop();
						var name = prompt('What would you like this snippet to be named?');
						if(name) {
							label = name;
							request.send('code=' + pres[i].get('html') + '&label=' + name + '&uid=' + randomUUID());
						}
					}
				}
			}).inject(pre,'top');
			var codaicon = new Element('a',{
				text: 'Click here to add this snippet to Coda',
				href: '#',
				opacity: 0.5,
				title: 'Click here to add this snippet to Coda',
				'class': 'coda',
				events: {
					click: function(e) {
						e.stop();
						var name = prompt('What would you like this snippet to be named?');
						if(name) {
							var html = pres[i].get('html').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
							window.location = 'codaclips://<<**Title:' + name + '**>>' + html;
						}
					}
				}
			}).inject(pre,'top');
			var cid = 'copy' + i;
			var copyicon = new Element('a',{
				text: 'Click here to copy this code to the clipboard',
				title: 'Click here to copy this code to the clipboard',
				href: 'javascript:;',
				'class': 'copy',
				opacity: 0.5,
				events: {
					//click: function() { alert('woot'); }
				},
				id: cid
			}).inject(pre,'top');
			//copy
			var clip = new ZeroClipboard.Client();
			clip.setText(pres[i].get('html') + 'woot');
			clip.addEventListener('mousedown',function() { clip.setText(pres[i].get('html').replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&')); });
			clip.addEventListener('complete',function(client,text) { flasher.setStyles({display:'block',opacity:1}).fade(0); });
			clip.glue(cid);
		});	
	}).delay(1000);	
			
	/* comments magic! */
	(function() {
		/* form movement - reply and form movement  */
		var comments = $$('.comment'), formDiv = $('comment-form'), commentBox = $('comment');
		var validatePost = function() {
			if(($('author') && !$('author').value) || ($('email') && !$('email').value) || !$('comment').value) {
				$('form-error-message').set('html','Your comment is missing information -- please complete it!').setStyle('display','block');
				return 0;
			}
			else {
				$('form-error-message').setStyle('display','none'); return 1;
			}
		};
		
		if(comments.length) {
			comments.each(function(comment) {
				//add the "reply" link
				var el = new Element('a',{
					text: 'Reply',
					'class': 'reply',
					href:'#',
					events: {
						click: function(e) {
							//form movement
							e.stop();
							formDiv.inject(el,'after')
							var currentValue = commentBox.get('value');
							commentBox.set('value',(currentValue ? currentValue + '\n\n' : '') + '@' + comment.get('rel') + ':  ').focus();
						}
					}
				}).inject(comment);
			});
			//validation, ajax submission and build
			/*
			var submit = $('submit'), form = $('share-comment');
			var dotter = new Dotter(submit,{
				delay: 200,
				message: 'Submitting',
				property: 'value'
			});
			form.addEvent('submit',function(e) {
				e.stop();
				if(validatePost()) {
					var request = new Request({
						url: form.get('action'),
						method: form.get('method'),
						link: 'ignore',
						onRequest: function() {
							dotter.start();
						},
						onSuccess: function() {
							var comment = $('comment'), newComment = new Element('div',{
								html: '<div class="comment-content"><div class="comment-says"><span class="author">You </span> said:</div><p>' + comment.value.replace(/\n/g,'<br />') + '</p></div><div class="clear"></div>',
								'class': 'comment'
							}).inject('comments-box','bottom');
							formDiv.inject('comment-form-original','bottom');
							new Fx.Scroll(window).toElement(newComment);
							comment.set({value:'',html:''});
							dotter.stop();
							submit.set('value','Submit');
						}
					}).send($('share-comment').toQueryString());
					//put the form back!
				}
			});
			*/
		}
		
		/* nytimes */
		(function() { if(true/*!Browser.Engine.trident*/) {
			//gets the selected text
			var getSelection = function() {
				return $try(
					function() { return window.getSelection(); },
					function() { return document.getSelection(); },
					function() { 
				        var selection = document.selection && document.selection.createRange();
						if(selection.text) { return selection.text; }
						return false;
				      }
				) || false;
			};
			//vars 
			var url = 'http://davidwalsh.name/?s={term}', selectionImage = new Element('a',{
				href: url,
				styles: {
					opacity:0
				},
				id: 'selection-image',
				title: 'Click here to learn more about this term',
				target: '_blank'
			}).inject(document.body,'top');
			//event to listen
			$('left').addEvent('mouseup',function(e) {
				var selection = getSelection();
				if(selection && (selection = new String(selection).replace(/^\s+|\s+$/g,''))) {
					//handle the every-time event
					selectionImage.set('href',url.replace('{term}',encodeURI(selection))).setStyles({
						top: e.page.y - 50,	//offsets
						left: e.page.x - 13, //offsets
						display: 'block'
					}).tween(o,1);
				}
			});
			//hider
			$(document.body).addEvent('mousedown',function() { selectionImage.tween(o,0); });
		} })();
		
		/**  settings:  
		(function() {
			//fontsize
			var start = Cookie.read('font-size') || '62.5';
			//$('font-label').set('text','Font: ' + start + '%');
			var fx = new Fx.Slide('font-update', { mode: 'horizontal' }).hide();
			var changed = 0, mySlide = new Slider($('font-area'), $('font-slider'), {  
				steps: 9,
				range: [62.5,200],
				wheel: 1,
				snap: 1,
				onChange: function(size){
					$('font-label').set('text','Font: ' + size);
					if(size == '63') { size = '62.5'; }
					Cookie.write('font-size',size,{ duration: 100, path: '/' });
					$(document.body).setStyle('font-size',size + '%'); //set the document font size
					/*
					if(changed) {
						fx.slideIn();
						(function() { fx.slideOut(); }).delay(2000);
					}
					*//*
					changed = 1;
				}
			}).set(start);
		})();
		**/
	})();
	
	/* cdn 
	(function() {
		var interval, img = '/wp-content/themes/walshbook3/images/maxcdn.png', id='bsap_1236348';
		var placeImage = function() {
			if($(id).getElements('a')) {
				$clear(interval);
				var a = new Element('a',{
					href: 'http://maxcdn.com',
					title: 'content delivery network',
					styles: {
						display: 'block',
						width: 125,
						height: 125
					},
					target: '_blank'
				}).inject($(id).getLast('a'),'before');
				var image = new Element('img',{
					src: img,
					alt: 'content delivery network'
				}).inject(a);
			}
		};
		interval = placeImage.periodical(50);
	})(); */
	
	/* delicious */
	if(document.getElementById('delic')) {
		window.addEvent('load',function() {
			(function() {
				new Element('script',{
					src: 'http://badges.del.icio.us/feeds/json/url/data?url=' + window.location.href + '&amp;callback=delic',
					type: 'text/javascript'
				}).inject(document.body);
			}).delay(5000); //5 seconds
		});
	}
	
			
})(document.id,$$);