Array.prototype.indexOf=function(_1,_2,_3){
_2=_2||0;
for(var i=_2;i<this.length;i++){
var _5=this[i];
if(_3?_5===_1:isRegexp(_1)?_1.test(_5):isFunction(_1)?_1(_5):_5==_1){
return i;
}
}
return -1;
};
Array.prototype.find=function(_6,_7,_8){
var i=this.indexOf(_6,_7,_8);
if(i!=-1){
return this[i];
}
return null;
};
Array.prototype.unique=function(b){
var a=[],i,l=this.length;
for(i=0;i<l;i++){
if(a.indexOf(this[i],0,b)<0){
a.push(this[i]);
}
}
return a;
};
Array.prototype.hasDuplicates=function(){
return (!(this.unique().length==this.length));
};
Array.prototype.contains=function(_c,_d){
return this.indexOf(_c,0,_d)!==-1;
};
Array.prototype.has=Array.prototype.contains;
Array.prototype.include=Array.prototype.contains;
Array.prototype.count=function(_e,_f){
var pos,start=0,count=0;
while((pos=this.indexOf(_e,start,_f))!==-1){
start=pos+1;
count++;
}
return count;
};
Array.prototype.remove=function(_11,all,_13){
while(this.contains(_11,_13)){
this.splice(this.indexOf(_11,0,_13),1);
if(!all){
break;
}
}
return this;
};
Array.prototype.merge=function(){
var a=[];
for(var i=0;i<arguments.length;i++){
for(var j=0;j<arguments[i].length;j++){
a.push(arguments[i][j]);
}
}
for(var i=0;i<a.length;i++){
this.push(a[i]);
}
return this;
};
Array.prototype.min=function(){
if(!this.length){
return;
}
var n=this[0];
for(var i=1;i<this.length;i++){
if(n>this[i]){
n=this[i];
}
}
return n;
};
Array.prototype.max=function(){
if(!this.length){
return;
}
var n=this[0];
for(var i=1;i<this.length;i++){
if(n<this[i]){
n=this[i];
}
}
return n;
};
Array.prototype.first=function(){
return this[0];
};
Array.prototype.last=function(){
return this[this.length-1];
};
Array.prototype.sjoin=function(){
return this.join(" ");
};
Array.prototype.njoin=function(){
return this.join("\n");
};
Array.prototype.cjoin=function(){
return this.join(", ");
};
Array.prototype.equals=function(a,_1d){
if(this==a){
return true;
}
if(a.length!=this.length){
return false;
}
return this.map(function(_1e,idx){
return _1d?_1e===a[idx]:_1e==a[idx];
}).all();
};
Array.prototype.all=function(fn){
return filter(this,fn).length==this.length;
};
Array.prototype.any=function(fn){
return filter(this,fn).length>0;
};
Array.prototype.each=function(fn){
return each(this,fn);
};
Array.prototype.map=function(fn){
return map(this,fn);
};
Array.prototype.filter=function(fn){
return filter(this,fn);
};
Array.prototype.select=Array.prototype.filter;
Array.prototype.reduce=function(){
var _25=map(arguments);
fn=_25.pop();
d=_25.pop();
return reduce(this,d,fn);
};
Array.prototype.inject=Array.prototype.reduce;
Array.prototype.reject=function(fn){
if(typeof (fn)=="string"){
fn=__strfn("item,idx,list",fn);
}
var _27=this;
var _28=[];
fn=fn||function(v){
return v;
};
map(_27,function(_2a,idx,_2c){
if(fn(_2a,idx,_2c)){
_28.push(idx);
}
});
_28.reverse().each(function(idx){
_27.splice(idx,1);
});
return _27;
};
function __strfn(_2e,fn){
function quote(s){
return "\""+s.replace(/"/g,"\\\"")+"\"";
}
if(!/\breturn\b/.test(fn)){
fn=fn.replace(/;\s*$/,"");
fn=fn.insert(fn.lastIndexOf(";")+1," return ");
}
return eval("new Function("+map(_2e.split(/\s*,\s*/),quote).join()+","+quote(fn)+")");
}
function each(_31,fn){
if(typeof (fn)=="string"){
return each(_31,__strfn("item,idx,list",fn));
}
for(var i=0;i<_31.length;i++){
fn(_31[i],i,_31);
}
}
function map(_34,fn){
if(typeof (fn)=="string"){
return map(_34,__strfn("item,idx,list",fn));
}
var _36=[];
fn=fn||function(v){
return v;
};
for(var i=0;i<_34.length;i++){
_36.push(fn(_34[i],i,_34));
}
return _36;
}
function combine(){
var _39=map(arguments);
var _3a=map(_39.slice(0,-1),"map(item)");
var fn=_39.last();
var _3c=map(_3a,"item.length").max();
var _3d=[];
if(!fn){
fn=function(){
return map(arguments);
};
}
if(typeof fn=="string"){
if(_3a.length>26){
throw "string functions can take at most 26 lists";
}
var a="a".charCodeAt(0);
fn=__strfn(map(range(a,a+_3a.length),"String.fromCharCode(item)").join(","),fn);
}
map(_3a,function(li){
while(li.length<_3c){
li.push(null);
}
map(li,function(_40,ix){
if(ix<_3d.length){
_3d[ix].push(_40);
}else{
_3d.push([_40]);
}
});
});
return map(_3d,function(val){
return fn.apply(fn,val);
});
}
function filter(_43,fn){
if(typeof (fn)=="string"){
return filter(_43,__strfn("item,idx,list",fn));
}
var _45=[];
fn=fn||function(v){
return v;
};
map(_43,function(_47,idx,_49){
if(fn(_47,idx,_49)){
_45.push(_47);
}
});
return _45;
}
function reduce(_4a,_4b,fn){
if(undef(fn)){
fn=_4b;
_4b=window.undefined;
}
if(typeof (fn)=="string"){
return reduce(_4a,_4b,__strfn("a,b",fn));
}
if(isdef(_4b)){
_4a.splice(0,0,_4b);
}
if(_4a.length===0){
return false;
}
if(_4a.length===1){
return _4a[0];
}
var _4d=_4a[0];
var i=1;
while(i<_4a.length){
_4d=fn(_4d,_4a[i++]);
}
return _4d;
}
function isAlien(a){
return isObject(a)&&typeof a.constructor!="function";
}
function isArray(a){
return isObject(a)&&a.constructor==Array;
}
function isBoolean(a){
return typeof a=="boolean";
}
function isFunction(a){
return typeof a=="function";
}
function isNull(a){
return typeof a=="object"&&!a;
}
function isNumber(a){
return typeof a=="number"&&isFinite(a);
}
function isObject(a){
return (a&&typeof a=="object")||isFunction(a);
}
function isRegexp(a){
return a&&a.constructor==RegExp;
}
function isString(a){
return typeof a=="string";
}
function isUndefined(a){
return typeof a=="undefined";
}
function isEmpty(o){
var i,v;
if(isObject(o)){
for(i in o){
v=o[i];
if(isUndefined(v)&&isFunction(v)){
return false;
}
}
}
return true;
}
if(!Function.prototype.apply){
Function.prototype.apply=function(o,a){
var r,x="____apply";
if(!isObject(o)){
o={};
}
o[x]=this;
switch((a&&a.length)||0){
case 0:
r=o[x]();
break;
case 1:
r=o[x](a[0]);
break;
case 2:
r=o[x](a[0],a[1]);
break;
case 3:
r=o[x](a[0],a[1],a[2]);
break;
case 4:
r=o[x](a[0],a[1],a[2],a[3]);
break;
case 5:
r=o[x](a[0],a[1],a[2],a[3],a[4]);
break;
case 6:
r=o[x](a[0],a[1],a[2],a[3],a[4],a[5]);
break;
default:
alert("Too many arguments to apply.");
}
delete o[x];
return r;
};
}
if(!Array.prototype.pop){
Array.prototype.pop=function(){
return this.splice(this.length-1,1)[0];
};
}
if(!Array.prototype.push){
Array.prototype.push=function(){
for(var i=0;i<arguments.length;i++){
this[this.length]=arguments[i];
}
return this.length;
};
}
if(!Array.prototype.shift){
Array.prototype.shift=function(){
return this.splice(0,1)[0];
};
}
if(!Array.prototype.unshift){
Array.prototype.unshift=function(){
this.reverse();
var a=arguments,i=a.length;
while(i--){
this.push(a[i]);
}
this.reverse();
return this.length;
};
}
if(!Array.prototype.splice){
Array.prototype.splice=function(s,d){
var max=Math.max,min=Math.min,a=[],e,i=max(arguments.length-2,0),k=0,l=this.length,n,v,x;
s=s||0;
if(s<0){
s+=l;
}
s=max(min(s,l),0);
d=max(min(isNumber(d)?d:l,l-s),0);
v=i-d;
n=l+v;
while(k<d){
e=this[s+k];
if(!isUndefined(e)){
a[k]=e;
}
k+=1;
}
x=l-s-d;
if(v<0){
k=s+i;
while(x){
this[k]=this[k-v];
k+=1;
x-=1;
}
this.length=n;
}else{
if(v>0){
k=1;
while(x){
this[n-k]=this[l-k];
k+=1;
x-=1;
}
}
}
for(k=0;k<i;++k){
this[s+k]=arguments[k+2];
}
return a;
};
}
if(!Array.prototype.unshift){
Array.prototype.unshift=function(){
this.splice.apply(this,[0,0].concat(Array.prototype.slice.apply(arguments)));
return this.length;
};
}
if(/^function\s*\(\s*\)\s*\{\s*\}$/.test("a".replace(/a/,function(){
}))){
String.prototype.replace_=String.prototype.replace;
String.prototype.replace=function(rx,rf){
if(isFunction(rf)){
var s=this,r,rfv,replaceList=[];
while((r=rx.exec(s))!==null){
rfv=rf.apply(rf,map(r).concat([r.index,s]));
replaceList.push({start:r.index,length:r[0].length,value:rfv});
if(!rx.global){
break;
}
}
for(var i=replaceList.length-1;i>=0;i--){
var rli=replaceList[i];
s=s.splice(rli.start,rli.length,rli.value);
}
return s;
}else{
return this.replace_(rx,rf);
}
};
}
String.prototype.trimLeft=function(){
return this.replace(/^\s+/,"");
};
String.prototype.trimRight=function(){
return this.replace(/\s+$/,"");
};
String.prototype.trim=function(){
return this.replace(/^\s+|\s+$/g,"");
};
String.prototype.insert=function(idx,_69){
return this.slice(0,idx)+_69+this.slice(idx);
};
String.prototype.strip=function(_6a,_6b){
if(arguments.length==1){
_6b=this.length;
}
return this.slice(0,_6a)+this.slice(_6b);
};
String.prototype.splice=function(idx,_6d,_6e){
return this.strip(idx,idx+_6d).insert(idx,_6e);
};
String.prototype.subArgs=function(){
return this.subDict(map(arguments));
};
String.prototype.subDict=function(_6f){
var _70=this.split("{"),r=_70[0],part,ci,k,v;
for(var i=1;i<_70.length;i++){
part=_70[i];
ci=part.indexOf("}");
k=part.substring(0,ci);
v=_6f[k];
r+=isdef(v)?v+part.substring(ci+1):"{"+part;
}
return r;
};
String.prototype.subn=function(d){
if(arguments.length>1||!isObject(arguments[0])){
d=map(arguments);
}
return this.subDict(d);
};
String.prototype.wrap=function(_73,_74){
if(undef(_73)){
throw "S.wrap takes 1 argument (none given)";
}
if(undef(_74)){
_74=_73;
}
return _73+this+_74;
};
String.prototype.quote=function(){
return this.wrap("\"");
};
String.prototype.squote=function(){
return this.wrap("'");
};
String.prototype.pad=function(_75,len,chr){
if(undef(chr)){
chr=" ";
}
var s=this;
var _79=_75.toLowerCase()=="left";
while(s.length<len){
s=_79?chr+s:s+chr;
}
return s;
};
String.prototype.padLeft=function(len,chr){
return this.pad("left",len,chr);
};
String.prototype.padRight=function(len,chr){
return this.pad("right",len,chr);
};
String.prototype.zerofill=function(len){
var s=this;
var ix=/^[+-]/.test(s)?1:0;
while(s.length<len){
s=s.insert(ix,"0");
}
return s;
};
String.prototype.isEmpty=function(_81){
return !(_81?this:this.trim()).length;
};
function undef(v){
return isUndefined(v);
}
function isdef(v){
return !isUndefined(v);
}
function cmp(a,b){
return a<b?-1:a==b?0:1;
}
function list(s,sep){
if(!isString(sep)&&!isRegexp(sep)){
sep=sep?",":/\s*,\s*/;
}
return s.split(sep);
}
function range(_88,_89,_8a){
if(isUndefined(_89)){
return range(0,_88,_8a);
}
if(isUndefined(_8a)){
_8a=1;
}
var ss=(_8a/Math.abs(_8a));
var r=[];
for(i=_88;i*ss<_89*ss;i=i+_8a){
r.push(i);
}
return r;
}
function maprange(_8d,_8e,fn){
if(arguments.length==2){
return maprange(0,_8d,_8e);
}
if(arguments.length!=3){
throw "maprange takes 2 or 3 arguments";
}
return map(range(_8d,_8e),fn);
}
function isList(o){
return o&&isObject(o)&&(isArray(o)||o.item);
}
function isElement(o,_92){
return o&&isObject(o)&&((!_92&&(o==window||o==document))||o.nodeType==1);
}
function getElem(el){
var ge=(document.getElementById&&function(id){
return document.getElementById(id);
})||(document.all&&function(id){
return document.all[id];
})||function(){
return null;
};
return isElement(el)?el:isString(el)?ge(el):null;
}
function getElemList(el){
if(isElement(el)){
return [el];
}else{
if(isString(el)){
return getElemList(el.split(/\s+/g));
}else{
if(isList(el)){
var r=map(el,getElem);
return filter(r,isElement).length==r.length?r:null;
}else{
return null;
}
}
}
}
function filterElementNodes(_99,_9a){
return filter(_99,function(n){
return n.nodeType==1&&n.nodeName!="!"&&(undef(_9a)||_9a=="*"||n.nodeName.toUpperCase()==_9a.toUpperCase());
});
}
function getAll(_9c,_9d){
_9d=isdef(_9d)?getElem(_9d):document;
if(undef(_9c)){
_9c="*";
}
var r=_9d.getElementsByTagName(_9c);
return r.length||_9c!="*"?map(r):reduce(filterElementNodes(_9d.childNodes),[],function(l,c){
return l.merge([c],getAll(_9c,c));
});
}
function getElementsByClass(_a1,_a2,_a3){
var _a4=list("#comment,BASE,BASEFONT,HEAD,HTML,META,PARAM,SCRIPT,STYLE,TITLE");
return filter(getAll(_a2,_a3),function(_a5){
return !_a4.include(_a5.nodeName)&&hasClass(_a5,_a1);
});
}
getElementsByClassName=getElementsByClass;
function hasClass(_a6,_a7){
return getElem(_a6).className.split(" ").count(_a7);
}
function remClass(_a8,_a9,all){
_a8=getElem(_a8);
_a8.className=_a8.className.split(" ").remove(_a9,all).join(" ");
}
function addClass(_ab,_ac,_ad){
_ab=getElem(_ab);
if(!_ad&&_ab.className.split(" ").contains(_ac)){
return;
}
_ab.className+=(_ab.className.length?" ":"")+_ac;
}
function swapClass(e,c){
if(hasClass(e,c)){
remClass(e,c);
}else{
addClass(e,c);
}
return !!hasClass(e,c);
}
function condClass(e,c,_b2){
(_b2?addClass:remClass)(e,c);
}
function insertBefore(_b3,_b4){
return _b4.parentNode.insertBefore(_b3,_b4);
}
function insertAfter(_b5,_b6){
if(_b6.nextSibling){
insertBefore(_b5,_b6.nextSibling);
}else{
_b6.parentNode.appendChild(_b5);
}
return _b5;
}
var ALLOW_LEGACY_EVENTS=true;
function getEventModel(){
var d=document;
return d.addEventListener?"DOM":d.attachEvent?"IE":"legacy";
}
function IE_Event(_b8){
this.currentTarget=_b8;
this.preventDefault=function(){
window.event.returnValue=false;
};
this.stopPropagation=function(){
window.event.cancelBubble=true;
};
this.target=window.event.srcElement;
var _b9=this;
list("altKey,ctrlKey,shiftKey,clientX,clientY").map(function(p){
_b9[p]=event[p];
});
return this;
}
function Legacy_Event(_bb){
this.currentTarget=_bb;
return this;
}
function addEvent(els,ev,fn,_bf){
if(!ALLOW_LEGACY_EVENTS&&getEventModel()=="legacy"){
return false;
}
if(undef(_bf)){
_bf=true;
}
function DOM_addEvent(el,ev,fn,_c3){
el.addEventListener(ev,fn,_c3);
}
function legacy_addEvent(el,ev,fn){
var evn="on"+ev;
if(!el[evn]||undef(el[evn].handlers)){
el[evn]=function(){
map(el[evn].handlers,function(h){
h(new (el.attachEvent?IE_Event:Legacy_Event)(el));
});
};
el[evn].handlers=[];
}
el[evn].handlers.push(fn);
}
var _c9=getEventModel()=="DOM"?DOM_addEvent:legacy_addEvent;
map(getElemList(els),function(el){
_c9(el,ev,fn,_bf);
});
}
function remEvent(els,ev,fn,_ce){
if(!ALLOW_LEGACY_EVENTS&&getEventModel()=="legacy"){
return false;
}
if(undef(_ce)){
_ce=true;
}
map(getElemList(els),function(el){
if(getEventModel()=="DOM"){
el.removeEventListener(ev,fn,_ce);
}else{
el["on"+ev].handlers.remove(fn);
}
});
}
function addEventDict(els,_d1,_d2){
for(ev in _d1){
addEvent(els,ev,_d1[ev],_d2);
}
}
function addLoadEvent(fn){
var w=getEventModel()=="DOM"&&!window.addEventListener?document:window;
return addEvent(w,"load",fn,true);
}

