if(typeof (dojo)!="undefined"){
dojo.provide("MochiKit.Base");
}
if(typeof (MochiKit)=="undefined"){
MochiKit={};
}
if(typeof (MochiKit.Base)=="undefined"){
MochiKit.Base={};
}
if(typeof (MochiKit.__export__)=="undefined"){
MochiKit.__export__=(MochiKit.__compat__||(typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined"));
}
MochiKit.Base.VERSION="1.4";
MochiKit.Base.NAME="MochiKit.Base";
MochiKit.Base.update=function(_1,_2){
if(_1===null){
_1={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="undefined"&&o!==null){
for(var k in o){
_1[k]=o[k];
}
}
}
return _1;
};
MochiKit.Base.update(MochiKit.Base,{__repr__:function(){
return "["+this.NAME+" "+this.VERSION+"]";
},toString:function(){
return this.__repr__();
},camelize:function(_6){
var _7=_6.split("-");
var cc=_7[0];
for(var i=1;i<_7.length;i++){
cc+=_7[i].charAt(0).toUpperCase()+_7[i].substring(1);
}
return cc;
},counter:function(n){
if(arguments.length===0){
n=1;
}
return function(){
return n++;
};
},clone:function(_b){
var me=arguments.callee;
if(arguments.length==1){
me.prototype=_b;
return new me();
}
},_flattenArray:function(_d,_e){
for(var i=0;i<_e.length;i++){
var o=_e[i];
if(o instanceof Array){
arguments.callee(_d,o);
}else{
_d.push(o);
}
}
return _d;
},flattenArray:function(lst){
return MochiKit.Base._flattenArray([],lst);
},flattenArguments:function(lst){
var res=[];
var m=MochiKit.Base;
var _15=m.extend(null,arguments);
while(_15.length){
var o=_15.shift();
if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
for(var i=o.length-1;i>=0;i--){
_15.unshift(o[i]);
}
}else{
res.push(o);
}
}
return res;
},extend:function(_18,obj,_1a){
if(!_1a){
_1a=0;
}
if(obj){
var l=obj.length;
if(typeof (l)!="number"){
if(typeof (MochiKit.Iter)!="undefined"){
obj=MochiKit.Iter.list(obj);
l=obj.length;
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(!_18){
_18=[];
}
for(var i=_1a;i<l;i++){
_18.push(obj[i]);
}
}
return _18;
},updatetree:function(_1d,obj){
if(_1d===null){
_1d={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="undefined"&&o!==null){
for(var k in o){
var v=o[k];
if(typeof (_1d[k])=="object"&&typeof (v)=="object"){
arguments.callee(_1d[k],v);
}else{
_1d[k]=v;
}
}
}
}
return _1d;
},setdefault:function(_23,obj){
if(_23===null){
_23={};
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
for(var k in o){
if(!(k in _23)){
_23[k]=o[k];
}
}
}
return _23;
},keys:function(obj){
var _29=[];
for(var _2a in obj){
_29.push(_2a);
}
return _29;
},values:function(obj){
var _2c=[];
for(var _2d in obj){
_2c.push(obj[_2d]);
}
return _2c;
},items:function(obj){
var _2f=[];
var e;
for(var _31 in obj){
var v;
try{
v=obj[_31];
}
catch(e){
continue;
}
_2f.push([_31,v]);
}
return _2f;
},_newNamedError:function(_33,_34,_35){
_35.prototype=new MochiKit.Base.NamedError(_33.NAME+"."+_34);
_33[_34]=_35;
},operator:{truth:function(a){
return !!a;
},lognot:function(a){
return !a;
},identity:function(a){
return a;
},not:function(a){
return ~a;
},neg:function(a){
return -a;
},add:function(a,b){
return a+b;
},sub:function(a,b){
return a-b;
},div:function(a,b){
return a/b;
},mod:function(a,b){
return a%b;
},mul:function(a,b){
return a*b;
},and:function(a,b){
return a&b;
},or:function(a,b){
return a|b;
},xor:function(a,b){
return a^b;
},lshift:function(a,b){
return a<<b;
},rshift:function(a,b){
return a>>b;
},zrshift:function(a,b){
return a>>>b;
},eq:function(a,b){
return a==b;
},ne:function(a,b){
return a!=b;
},gt:function(a,b){
return a>b;
},ge:function(a,b){
return a>=b;
},lt:function(a,b){
return a<b;
},le:function(a,b){
return a<=b;
},seq:function(a,b){
return a===b;
},sne:function(a,b){
return a!==b;
},ceq:function(a,b){
return MochiKit.Base.compare(a,b)===0;
},cne:function(a,b){
return MochiKit.Base.compare(a,b)!==0;
},cgt:function(a,b){
return MochiKit.Base.compare(a,b)==1;
},cge:function(a,b){
return MochiKit.Base.compare(a,b)!=-1;
},clt:function(a,b){
return MochiKit.Base.compare(a,b)==-1;
},cle:function(a,b){
return MochiKit.Base.compare(a,b)!=1;
},logand:function(a,b){
return a&&b;
},logor:function(a,b){
return a||b;
},contains:function(a,b){
return b in a;
}},forwardCall:function(_73){
return function(){
return this[_73].apply(this,arguments);
};
},itemgetter:function(_74){
return function(arg){
return arg[_74];
};
},typeMatcher:function(){
var _76={};
for(var i=0;i<arguments.length;i++){
var typ=arguments[i];
_76[typ]=typ;
}
return function(){
for(var i=0;i<arguments.length;i++){
if(!(typeof (arguments[i]) in _76)){
return false;
}
}
return true;
};
},isNull:function(){
for(var i=0;i<arguments.length;i++){
if(arguments[i]!==null){
return false;
}
}
return true;
},isUndefinedOrNull:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(!(typeof (o)=="undefined"||o===null)){
return false;
}
}
return true;
},isEmpty:function(obj){
return !MochiKit.Base.isNotEmpty.apply(this,arguments);
},isNotEmpty:function(obj){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(!(o&&o.length)){
return false;
}
}
return true;
},isArrayLike:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
var typ=typeof (o);
if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3){
return false;
}
}
return true;
},isDateLike:function(){
for(var i=0;i<arguments.length;i++){
var o=arguments[i];
if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){
return false;
}
}
return true;
},xmap:function(fn){
if(fn===null){
return MochiKit.Base.extend(null,arguments,1);
}
var _87=[];
for(var i=1;i<arguments.length;i++){
_87.push(fn(arguments[i]));
}
return _87;
},map:function(fn,lst){
var m=MochiKit.Base;
var itr=MochiKit.Iter;
var _8d=m.isArrayLike;
if(arguments.length<=2){
if(!_8d(lst)){
if(itr){
lst=itr.list(lst);
if(fn===null){
return lst;
}
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(fn===null){
return m.extend(null,lst);
}
var _8e=[];
for(var i=0;i<lst.length;i++){
_8e.push(fn(lst[i]));
}
return _8e;
}else{
if(fn===null){
fn=Array;
}
var _90=null;
for(i=1;i<arguments.length;i++){
if(!_8d(arguments[i])){
if(itr){
return itr.list(itr.imap.apply(null,arguments));
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
var l=arguments[i].length;
if(_90===null||_90>l){
_90=l;
}
}
_8e=[];
for(i=0;i<_90;i++){
var _92=[];
for(var j=1;j<arguments.length;j++){
_92.push(arguments[j][i]);
}
_8e.push(fn.apply(this,_92));
}
return _8e;
}
},xfilter:function(fn){
var _95=[];
if(fn===null){
fn=MochiKit.Base.operator.truth;
}
for(var i=1;i<arguments.length;i++){
var o=arguments[i];
if(fn(o)){
_95.push(o);
}
}
return _95;
},filter:function(fn,lst,_9a){
var _9b=[];
var m=MochiKit.Base;
if(!m.isArrayLike(lst)){
if(MochiKit.Iter){
lst=MochiKit.Iter.list(lst);
}else{
throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
}
}
if(fn===null){
fn=m.operator.truth;
}
if(typeof (Array.prototype.filter)=="function"){
return Array.prototype.filter.call(lst,fn,_9a);
}else{
if(typeof (_9a)=="undefined"||_9a===null){
for(var i=0;i<lst.length;i++){
var o=lst[i];
if(fn(o)){
_9b.push(o);
}
}
}else{
for(i=0;i<lst.length;i++){
o=lst[i];
if(fn.call(_9a,o)){
_9b.push(o);
}
}
}
}
return _9b;
},_wrapDumbFunction:function(_9f){
return function(){
switch(arguments.length){
case 0:
return _9f();
case 1:
return _9f(arguments[0]);
case 2:
return _9f(arguments[0],arguments[1]);
case 3:
return _9f(arguments[0],arguments[1],arguments[2]);
}
var _a0=[];
for(var i=0;i<arguments.length;i++){
_a0.push("arguments["+i+"]");
}
return eval("(func("+_a0.join(",")+"))");
};
},methodcaller:function(_a2){
var _a3=MochiKit.Base.extend(null,arguments,1);
if(typeof (_a2)=="function"){
return function(obj){
return _a2.apply(obj,_a3);
};
}else{
return function(obj){
return obj[_a2].apply(obj,_a3);
};
}
},method:function(_a6,_a7){
var m=MochiKit.Base;
return m.bind.apply(this,m.extend([_a7,_a6],arguments,2));
},compose:function(f1,f2){
var _ab=[];
var m=MochiKit.Base;
if(arguments.length===0){
throw new TypeError("compose() requires at least one argument");
}
for(var i=0;i<arguments.length;i++){
var fn=arguments[i];
if(typeof (fn)!="function"){
throw new TypeError(m.repr(fn)+" is not a function");
}
_ab.push(fn);
}
return function(){
var _af=arguments;
for(var i=_ab.length-1;i>=0;i--){
_af=[_ab[i].apply(this,_af)];
}
return _af[0];
};
},bind:function(_b1,_b2){
if(typeof (_b1)=="string"){
_b1=_b2[_b1];
}
var _b3=_b1.im_func;
var _b4=_b1.im_preargs;
var _b5=_b1.im_self;
var m=MochiKit.Base;
if(typeof (_b1)=="function"&&typeof (_b1.apply)=="undefined"){
_b1=m._wrapDumbFunction(_b1);
}
if(typeof (_b3)!="function"){
_b3=_b1;
}
if(typeof (_b2)!="undefined"){
_b5=_b2;
}
if(typeof (_b4)=="undefined"){
_b4=[];
}else{
_b4=_b4.slice();
}
m.extend(_b4,arguments,2);
var _b7=function(){
var _b8=arguments;
var me=arguments.callee;
if(me.im_preargs.length>0){
_b8=m.concat(me.im_preargs,_b8);
}
var _ba=me.im_self;
if(!_ba){
_ba=this;
}
return me.im_func.apply(_ba,_b8);
};
_b7.im_self=_b5;
_b7.im_func=_b3;
_b7.im_preargs=_b4;
return _b7;
},bindMethods:function(_bb){
var _bc=MochiKit.Base.bind;
for(var k in _bb){
var _be=_bb[k];
if(typeof (_be)=="function"){
_bb[k]=_bc(_be,_bb);
}
}
},registerComparator:function(_bf,_c0,_c1,_c2){
MochiKit.Base.comparatorRegistry.register(_bf,_c0,_c1,_c2);
},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){
if(a==b){
return 0;
}
var _c5=(typeof (a)=="undefined"||a===null);
var _c6=(typeof (b)=="undefined"||b===null);
if(_c5&&_c6){
return 0;
}else{
if(_c5){
return -1;
}else{
if(_c6){
return 1;
}
}
}
var m=MochiKit.Base;
var _c8=m._primitives;
if(!(typeof (a) in _c8&&typeof (b) in _c8)){
try{
return m.comparatorRegistry.match(a,b);
}
catch(e){
if(e!=m.NotFound){
throw e;
}
}
}
if(a<b){
return -1;
}else{
if(a>b){
return 1;
}
}
var _c9=m.repr;
throw new TypeError(_c9(a)+" and "+_c9(b)+" can not be compared");
},compareDateLike:function(a,b){
return MochiKit.Base.compare(a.getTime(),b.getTime());
},compareArrayLike:function(a,b){
var _ce=MochiKit.Base.compare;
var _cf=a.length;
var _d0=0;
if(_cf>b.length){
_d0=1;
_cf=b.length;
}else{
if(_cf<b.length){
_d0=-1;
}
}
for(var i=0;i<_cf;i++){
var cmp=_ce(a[i],b[i]);
if(cmp){
return cmp;
}
}
return _d0;
},registerRepr:function(_d3,_d4,_d5,_d6){
MochiKit.Base.reprRegistry.register(_d3,_d4,_d5,_d6);
},repr:function(o){
if(typeof (o)=="undefined"){
return "undefined";
}else{
if(o===null){
return "null";
}
}
try{
if(typeof (o.__repr__)=="function"){
return o.__repr__();
}else{
if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){
return o.repr();
}
}
return MochiKit.Base.reprRegistry.match(o);
}
catch(e){
if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){
return o.NAME;
}
}
try{
var _d8=(o+"");
}
catch(e){
return "["+typeof (o)+"]";
}
if(typeof (o)=="function"){
o=_d8.replace(/^\s+/,"");
var idx=o.indexOf("{");
if(idx!=-1){
o=o.substr(0,idx)+"{...}";
}
}
return _d8;
},reprArrayLike:function(o){
var m=MochiKit.Base;
return "["+m.map(m.repr,o).join(", ")+"]";
},reprString:function(o){
return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r");
},reprNumber:function(o){
return o+"";
},registerJSON:function(_de,_df,_e0,_e1){
MochiKit.Base.jsonRegistry.register(_de,_df,_e0,_e1);
},evalJSON:function(){
return eval("("+MochiKit.Base._filterJSON(arguments[0])+")");
},_filterJSON:function(s){
var m=s.match(/^\s*\/\*(.*)\*\/\s*$/);
if(m){
return m[1];
}
return s;
},serializeJSON:function(o){
var _e5=typeof (o);
if(_e5=="number"||_e5=="boolean"){
return o+"";
}else{
if(o===null){
return "null";
}
}
var m=MochiKit.Base;
var _e7=m.reprString;
if(_e5=="string"){
return _e7(o);
}
var me=arguments.callee;
var _e9;
if(typeof (o.__json__)=="function"){
_e9=o.__json__();
if(o!==_e9){
return me(_e9);
}
}
if(typeof (o.json)=="function"){
_e9=o.json();
if(o!==_e9){
return me(_e9);
}
}
if(_e5!="function"&&typeof (o.length)=="number"){
var res=[];
for(var i=0;i<o.length;i++){
var val=me(o[i]);
if(typeof (val)!="string"){
val="undefined";
}
res.push(val);
}
return "["+res.join(", ")+"]";
}
try{
_e9=m.jsonRegistry.match(o);
if(o!==_e9){
return me(_e9);
}
}
catch(e){
if(e!=m.NotFound){
throw e;
}
}
if(_e5=="undefined"){
throw new TypeError("undefined can not be serialized as JSON");
}
if(_e5=="function"){
return null;
}
res=[];
for(var k in o){
var _ee;
if(typeof (k)=="number"){
_ee="\""+k+"\"";
}else{
if(typeof (k)=="string"){
_ee=_e7(k);
}else{
continue;
}
}
val=me(o[k]);
if(typeof (val)!="string"){
continue;
}
res.push(_ee+":"+val);
}
return "{"+res.join(", ")+"}";
},objEqual:function(a,b){
return (MochiKit.Base.compare(a,b)===0);
},arrayEqual:function(_f1,arr){
if(_f1.length!=arr.length){
return false;
}
return (MochiKit.Base.compare(_f1,arr)===0);
},concat:function(){
var _f3=[];
var _f4=MochiKit.Base.extend;
for(var i=0;i<arguments.length;i++){
_f4(_f3,arguments[i]);
}
return _f3;
},keyComparator:function(key){
var m=MochiKit.Base;
var _f8=m.compare;
if(arguments.length==1){
return function(a,b){
return _f8(a[key],b[key]);
};
}
var _fb=m.extend(null,arguments);
return function(a,b){
var _fe=0;
for(var i=0;(_fe===0)&&(i<_fb.length);i++){
var key=_fb[i];
_fe=_f8(a[key],b[key]);
}
return _fe;
};
},reverseKeyComparator:function(key){
var _102=MochiKit.Base.keyComparator.apply(this,arguments);
return function(a,b){
return _102(b,a);
};
},partial:function(func){
var m=MochiKit.Base;
return m.bind.apply(this,m.extend([func,undefined],arguments,1));
},listMinMax:function(_107,lst){
if(lst.length===0){
return null;
}
var cur=lst[0];
var _10a=MochiKit.Base.compare;
for(var i=1;i<lst.length;i++){
var o=lst[i];
if(_10a(o,cur)==_107){
cur=o;
}
}
return cur;
},objMax:function(){
return MochiKit.Base.listMinMax(1,arguments);
},objMin:function(){
return MochiKit.Base.listMinMax(-1,arguments);
},findIdentical:function(lst,_10e,_10f,end){
if(typeof (end)=="undefined"||end===null){
end=lst.length;
}
if(typeof (_10f)=="undefined"||_10f===null){
_10f=0;
}
for(var i=_10f;i<end;i++){
if(lst[i]===_10e){
return i;
}
}
return -1;
},mean:function(){
var sum=0;
var m=MochiKit.Base;
var args=m.extend(null,arguments);
var _115=args.length;
while(args.length){
var o=args.shift();
if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
_115+=o.length-1;
for(var i=o.length-1;i>=0;i--){
sum+=o[i];
}
}else{
sum+=o;
}
}
if(_115<=0){
throw new TypeError("mean() requires at least one argument");
}
return sum/_115;
},median:function(){
var data=MochiKit.Base.flattenArguments(arguments);
if(data.length===0){
throw new TypeError("median() requires at least one argument");
}
data.sort(compare);
if(data.length%2==0){
var _119=data.length/2;
return (data[_119]+data[_119-1])/2;
}else{
return data[(data.length-1)/2];
}
},findValue:function(lst,_11b,_11c,end){
if(typeof (end)=="undefined"||end===null){
end=lst.length;
}
if(typeof (_11c)=="undefined"||_11c===null){
_11c=0;
}
var cmp=MochiKit.Base.compare;
for(var i=_11c;i<end;i++){
if(cmp(lst[i],_11b)===0){
return i;
}
}
return -1;
},nodeWalk:function(node,_121){
var _122=[node];
var _123=MochiKit.Base.extend;
while(_122.length){
var res=_121(_122.shift());
if(res){
_123(_122,res);
}
}
},nameFunctions:function(_125){
var base=_125.NAME;
if(typeof (base)=="undefined"){
base="";
}else{
base=base+".";
}
for(var name in _125){
var o=_125[name];
if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){
try{
o.NAME=base+name;
}
catch(e){
}
}
}
},queryString:function(_129,_12a){
if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_129)=="string"||(typeof (_129.nodeType)!="undefined"&&_129.nodeType>0))){
var kv=MochiKit.DOM.formContents(_129);
_129=kv[0];
_12a=kv[1];
}else{
if(arguments.length==1){
if(typeof (_129.length)=="number"&&_129.length==2){
return arguments.callee(_129[0],_129[1]);
}
var o=_129;
_129=[];
_12a=[];
for(var k in o){
var v=o[k];
if(typeof (v)=="function"){
continue;
}else{
if(typeof (v)!="string"&&typeof (v.length)=="number"){
for(var i=0;i<v.length;i++){
_129.push(k);
_12a.push(v[i]);
}
}else{
_129.push(k);
_12a.push(v);
}
}
}
}
}
var rval=[];
var len=Math.min(_129.length,_12a.length);
var _132=MochiKit.Base.urlEncode;
for(var i=0;i<len;i++){
v=_12a[i];
if(typeof (v)!="undefined"&&v!==null){
rval.push(_132(_129[i])+"="+_132(v));
}
}
return rval.join("&");
},parseQueryString:function(_133,_134){
var qstr=(_133.charAt(0)=="?")?_133.substring(1):_133;
var _136=qstr.replace(/\+/g,"%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
var o={};
var _138;
if(typeof (decodeURIComponent)!="undefined"){
_138=decodeURIComponent;
}else{
_138=unescape;
}
if(_134){
for(var i=0;i<_136.length;i++){
var pair=_136[i].split("=");
var name=_138(pair.shift());
if(!name){
continue;
}
var arr=o[name];
if(!(arr instanceof Array)){
arr=[];
o[name]=arr;
}
arr.push(_138(pair.join("=")));
}
}else{
for(i=0;i<_136.length;i++){
pair=_136[i].split("=");
var name=pair.shift();
if(!name){
continue;
}
o[_138(name)]=_138(pair.join("="));
}
}
return o;
}});
MochiKit.Base.AdapterRegistry=function(){
this.pairs=[];
};
MochiKit.Base.AdapterRegistry.prototype={register:function(name,_13e,wrap,_140){
if(_140){
this.pairs.unshift([name,_13e,wrap]);
}else{
this.pairs.push([name,_13e,wrap]);
}
},match:function(){
for(var i=0;i<this.pairs.length;i++){
var pair=this.pairs[i];
if(pair[1].apply(this,arguments)){
return pair[2].apply(this,arguments);
}
}
throw MochiKit.Base.NotFound;
},unregister:function(name){
for(var i=0;i<this.pairs.length;i++){
var pair=this.pairs[i];
if(pair[0]==name){
this.pairs.splice(i,1);
return true;
}
}
return false;
}};
MochiKit.Base.EXPORT=["flattenArray","noop","camelize","counter","clone","extend","update","updatetree","setdefault","keys","values","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","methodcaller","compose","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","findValue","findIdentical","flattenArguments","method","average","mean","median"];
MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];
MochiKit.Base._exportSymbols=function(_146,_147){
if(!MochiKit.__export__){
return;
}
var all=_147.EXPORT_TAGS[":all"];
for(var i=0;i<all.length;i++){
_146[all[i]]=_147[all[i]];
}
};
MochiKit.Base.__new__=function(){
var m=this;
m.noop=m.operator.identity;
m.forward=m.forwardCall;
m.find=m.findValue;
if(typeof (encodeURIComponent)!="undefined"){
m.urlEncode=function(_14b){
return encodeURIComponent(_14b).replace(/\'/g,"%27");
};
}else{
m.urlEncode=function(_14c){
return escape(_14c).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27");
};
}
m.NamedError=function(name){
this.message=name;
this.name=name;
};
m.NamedError.prototype=new Error();
m.update(m.NamedError.prototype,{repr:function(){
if(this.message&&this.message!=this.name){
return this.name+"("+m.repr(this.message)+")";
}else{
return this.name+"()";
}
},toString:m.forwardCall("repr")});
m.NotFound=new m.NamedError("MochiKit.Base.NotFound");
m.listMax=m.partial(m.listMinMax,1);
m.listMin=m.partial(m.listMinMax,-1);
m.isCallable=m.typeMatcher("function");
m.isUndefined=m.typeMatcher("undefined");
m.merge=m.partial(m.update,null);
m.zip=m.partial(m.map,null);
m.average=m.mean;
m.comparatorRegistry=new m.AdapterRegistry();
m.registerComparator("dateLike",m.isDateLike,m.compareDateLike);
m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike);
m.reprRegistry=new m.AdapterRegistry();
m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike);
m.registerRepr("string",m.typeMatcher("string"),m.reprString);
m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber);
m.jsonRegistry=new m.AdapterRegistry();
var all=m.concat(m.EXPORT,m.EXPORT_OK);
m.EXPORT_TAGS={":common":m.concat(m.EXPORT_OK),":all":all};
m.nameFunctions(this);
};
MochiKit.Base.__new__();
if(MochiKit.__export__){
compare=MochiKit.Base.compare;
compose=MochiKit.Base.compose;
serializeJSON=MochiKit.Base.serializeJSON;
}
MochiKit.Base._exportSymbols(this,MochiKit.Base);
if(typeof (dojo)!="undefined"){
dojo.provide("MochiKit.Async");
dojo.require("MochiKit.Base");
}
if(typeof (JSAN)!="undefined"){
JSAN.use("MochiKit.Base",[]);
}
try{
if(typeof (MochiKit.Base)=="undefined"){
throw "";
}
}
catch(e){
throw "MochiKit.Async depends on MochiKit.Base!";
}
if(typeof (MochiKit.Async)=="undefined"){
MochiKit.Async={};
}
MochiKit.Async.NAME="MochiKit.Async";
MochiKit.Async.VERSION="1.4";
MochiKit.Async.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
MochiKit.Async.toString=function(){
return this.__repr__();
};
MochiKit.Async.Deferred=function(_14f){
this.chain=[];
this.id=this._nextId();
this.fired=-1;
this.paused=0;
this.results=[null,null];
this.canceller=_14f;
this.silentlyCancelled=false;
this.chained=false;
};
MochiKit.Async.Deferred.prototype={repr:function(){
var _150;
if(this.fired==-1){
_150="unfired";
}else{
if(this.fired===0){
_150="success";
}else{
_150="error";
}
}
return "Deferred("+this.id+", "+_150+")";
},toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){
var self=MochiKit.Async;
if(this.fired==-1){
if(this.canceller){
this.canceller(this);
}else{
this.silentlyCancelled=true;
}
if(this.fired==-1){
this.errback(new self.CancelledError(this));
}
}else{
if((this.fired===0)&&(this.results[0] instanceof self.Deferred)){
this.results[0].cancel();
}
}
},_resback:function(res){
this.fired=((res instanceof Error)?1:0);
this.results[this.fired]=res;
this._fire();
},_check:function(){
if(this.fired!=-1){
if(!this.silentlyCancelled){
throw new MochiKit.Async.AlreadyCalledError(this);
}
this.silentlyCancelled=false;
return;
}
},callback:function(res){
this._check();
if(res instanceof MochiKit.Async.Deferred){
throw new Error("Deferred instances can only be chained if they are the result of a callback");
}
this._resback(res);
},errback:function(res){
this._check();
var self=MochiKit.Async;
if(res instanceof self.Deferred){
throw new Error("Deferred instances can only be chained if they are the result of a callback");
}
if(!(res instanceof Error)){
res=new self.GenericError(res);
}
this._resback(res);
},addBoth:function(fn){
if(arguments.length>1){
fn=MochiKit.Base.partial.apply(null,arguments);
}
return this.addCallbacks(fn,fn);
},addCallback:function(fn){
if(arguments.length>1){
fn=MochiKit.Base.partial.apply(null,arguments);
}
return this.addCallbacks(fn,null);
},addErrback:function(fn){
if(arguments.length>1){
fn=MochiKit.Base.partial.apply(null,arguments);
}
return this.addCallbacks(null,fn);
},addCallbacks:function(cb,eb){
if(this.chained){
throw new Error("Chained Deferreds can not be re-used");
}
this.chain.push([cb,eb]);
if(this.fired>=0){
this._fire();
}
return this;
},_fire:function(){
var _15b=this.chain;
var _15c=this.fired;
var res=this.results[_15c];
var self=this;
var cb=null;
while(_15b.length>0&&this.paused===0){
var pair=_15b.shift();
var f=pair[_15c];
if(f===null){
continue;
}
try{
res=f(res);
_15c=((res instanceof Error)?1:0);
if(res instanceof MochiKit.Async.Deferred){
cb=function(res){
self._resback(res);
self.paused--;
if((self.paused===0)&&(self.fired>=0)){
self._fire();
}
};
this.paused++;
}
}
catch(err){
_15c=1;
if(!(err instanceof Error)){
err=new MochiKit.Async.GenericError(err);
}
res=err;
}
}
this.fired=_15c;
this.results[_15c]=res;
if(cb&&this.paused){
res.addBoth(cb);
res.chained=true;
}
}};
MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(req){
return MochiKit.Base.evalJSON(req.responseText);
},succeed:function(_164){
var d=new MochiKit.Async.Deferred();
d.callback.apply(d,arguments);
return d;
},fail:function(_166){
var d=new MochiKit.Async.Deferred();
d.errback.apply(d,arguments);
return d;
},getXMLHttpRequest:function(){
var self=arguments.callee;
if(!self.XMLHttpRequest){
var _169=[function(){
return new XMLHttpRequest();
},function(){
return new ActiveXObject("Msxml2.XMLHTTP");
},function(){
return new ActiveXObject("Microsoft.XMLHTTP");
},function(){
return new ActiveXObject("Msxml2.XMLHTTP.4.0");
},function(){
throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest");
}];
for(var i=0;i<_169.length;i++){
var func=_169[i];
try{
self.XMLHttpRequest=func;
return func();
}
catch(e){
}
}
}
return self.XMLHttpRequest();
},_xhr_onreadystatechange:function(d){
var m=MochiKit.Base;
if(this.readyState==4){
try{
this.onreadystatechange=null;
}
catch(e){
try{
this.onreadystatechange=m.noop;
}
catch(e){
}
}
var _16e=null;
try{
_16e=this.status;
if(!_16e&&m.isNotEmpty(this.responseText)){
_16e=304;
}
}
catch(e){
}
if(_16e==200||_16e==201||_16e==204||_16e==304||_16e==1223){
d.callback(this);
}else{
var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed");
if(err.number){
d.errback(err);
}else{
d.errback(err);
}
}
}
},_xhr_canceller:function(req){
try{
req.onreadystatechange=null;
}
catch(e){
try{
req.onreadystatechange=MochiKit.Base.noop;
}
catch(e){
}
}
req.abort();
},sendXMLHttpRequest:function(req,_172){
if(typeof (_172)=="undefined"||_172===null){
_172="";
}
var m=MochiKit.Base;
var self=MochiKit.Async;
var d=new self.Deferred(m.partial(self._xhr_canceller,req));
try{
req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d);
req.send(_172);
}
catch(e){
try{
req.onreadystatechange=null;
}
catch(ignore){
}
d.errback(e);
}
return d;
},doXHR:function(url,opts){
var self=MochiKit.Async;
return self.callLater(0,self._doXHR,url,opts);
},_doXHR:function(url,opts){
var m=MochiKit.Base;
opts=m.update({method:"GET",sendContent:""},opts);
var self=MochiKit.Async;
var req=self.getXMLHttpRequest();
if(opts.queryString){
var qs=m.queryString(opts.queryString);
if(qs){
url+="?"+qs;
}
}
if("username" in opts){
req.open(opts.method,url,true,opts.username,opts.password);
}else{
req.open(opts.method,url,true);
}
if(req.overrideMimeType&&opts.mimeType){
req.overrideMimeType(opts.mimeType);
}
if(opts.headers){
var _17f=opts.headers;
if(!m.isArrayLike(_17f)){
_17f=m.items(_17f);
}
for(var i=0;i<_17f.length;i++){
var _181=_17f[i];
var name=_181[0];
var _183=_181[1];
req.setRequestHeader(name,_183);
}
}
return self.sendXMLHttpRequest(req,opts.sendContent);
},_buildURL:function(url){
if(arguments.length>1){
var m=MochiKit.Base;
var qs=m.queryString.apply(null,m.extend(null,arguments,1));
if(qs){
return url+"?"+qs;
}
}
return url;
},doSimpleXMLHttpRequest:function(url){
var self=MochiKit.Async;
url=self._buildURL.apply(self,arguments);
return self.doXHR(url);
},loadJSONDoc:function(url){
var self=MochiKit.Async;
url=self._buildURL.apply(self,arguments);
var d=self.doXHR(url,{"mimeType":"text/plain","headers":[["Accept","application/json"]]});
d=d.addCallback(self.evalJSONRequest);
return d;
},wait:function(_18c,_18d){
var d=new MochiKit.Async.Deferred();
var m=MochiKit.Base;
if(typeof (_18d)!="undefined"){
d.addCallback(function(){
return _18d;
});
}
var _190=setTimeout(m.bind("callback",d),Math.floor(_18c*1000));
d.canceller=function(){
try{
clearTimeout(_190);
}
catch(e){
}
};
return d;
},callLater:function(_191,func){
var m=MochiKit.Base;
var _194=m.partial.apply(m,m.extend(null,arguments,1));
return MochiKit.Async.wait(_191).addCallback(function(res){
return _194();
});
}});
MochiKit.Async.DeferredLock=function(){
this.waiting=[];
this.locked=false;
this.id=this._nextId();
};
MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){
var d=new MochiKit.Async.Deferred();
if(this.locked){
this.waiting.push(d);
}else{
this.locked=true;
d.callback(this);
}
return d;
},release:function(){
if(!this.locked){
throw TypeError("Tried to release an unlocked DeferredLock");
}
this.locked=false;
if(this.waiting.length>0){
this.locked=true;
this.waiting.shift().callback(this);
}
},_nextId:MochiKit.Base.counter(),repr:function(){
var _197;
if(this.locked){
_197="locked, "+this.waiting.length+" waiting";
}else{
_197="unlocked";
}
return "DeferredLock("+this.id+", "+_197+")";
},toString:MochiKit.Base.forwardCall("repr")};
MochiKit.Async.DeferredList=function(list,_199,_19a,_19b,_19c){
MochiKit.Async.Deferred.apply(this,[_19c]);
this.list=list;
var _19d=[];
this.resultList=_19d;
this.finishedCount=0;
this.fireOnOneCallback=_199;
this.fireOnOneErrback=_19a;
this.consumeErrors=_19b;
var cb=MochiKit.Base.bind(this._cbDeferred,this);
for(var i=0;i<list.length;i++){
var d=list[i];
_19d.push(undefined);
d.addCallback(cb,i,true);
d.addErrback(cb,i,false);
}
if(list.length===0&&!_199){
this.callback(this.resultList);
}
};
MochiKit.Async.DeferredList.prototype=new MochiKit.Async.Deferred();
MochiKit.Async.DeferredList.prototype._cbDeferred=function(_1a1,_1a2,_1a3){
this.resultList[_1a1]=[_1a2,_1a3];
this.finishedCount+=1;
if(this.fired==-1){
if(_1a2&&this.fireOnOneCallback){
this.callback([_1a1,_1a3]);
}else{
if(!_1a2&&this.fireOnOneErrback){
this.errback(_1a3);
}else{
if(this.finishedCount==this.list.length){
this.callback(this.resultList);
}
}
}
}
if(!_1a2&&this.consumeErrors){
_1a3=null;
}
return _1a3;
};
MochiKit.Async.gatherResults=function(_1a4){
var d=new MochiKit.Async.DeferredList(_1a4,false,true,false);
d.addCallback(function(_1a6){
var ret=[];
for(var i=0;i<_1a6.length;i++){
ret.push(_1a6[i][1]);
}
return ret;
});
return d;
};
MochiKit.Async.maybeDeferred=function(func){
var self=MochiKit.Async;
var _1ab;
try{
var r=func.apply(null,MochiKit.Base.extend([],arguments,1));
if(r instanceof self.Deferred){
_1ab=r;
}else{
if(r instanceof Error){
_1ab=self.fail(r);
}else{
_1ab=self.succeed(r);
}
}
}
catch(e){
_1ab=self.fail(e);
}
return _1ab;
};
MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred","doXHR"];
MochiKit.Async.EXPORT_OK=["evalJSONRequest"];
MochiKit.Async.__new__=function(){
var m=MochiKit.Base;
var ne=m.partial(m._newNamedError,this);
ne("AlreadyCalledError",function(_1af){
this.deferred=_1af;
});
ne("CancelledError",function(_1b0){
this.deferred=_1b0;
});
ne("BrowserComplianceError",function(msg){
this.message=msg;
});
ne("GenericError",function(msg){
this.message=msg;
});
ne("XMLHttpRequestError",function(req,msg){
this.req=req;
this.message=msg;
try{
this.number=req.status;
}
catch(e){
}
});
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
m.nameFunctions(this);
};
MochiKit.Async.__new__();
MochiKit.Base._exportSymbols(this,MochiKit.Async);
var Base=function(){
if(arguments.length){
if(this==window){
Base.prototype.extend.call(arguments[0],arguments.callee.prototype);
}else{
this.extend(arguments[0]);
}
}
};
Base.version="1.0.2";
Base.prototype={extend:function(_1b5,_1b6){
var _1b7=Base.prototype.extend;
if(arguments.length==2){
var _1b8=this[_1b5];
if((_1b8 instanceof Function)&&(_1b6 instanceof Function)&&_1b8.valueOf()!=_1b6.valueOf()&&/\bbase\b/.test(_1b6)){
var _1b9=_1b6;
_1b6=function(){
var _1ba=this.base;
this.base=_1b8;
var _1bb=_1b9.apply(this,arguments);
this.base=_1ba;
return _1bb;
};
_1b6.valueOf=function(){
return _1b9;
};
_1b6.toString=function(){
return String(_1b9);
};
}
if(_1b6 instanceof Function){
_1b6.NAME=_1b5;
}
return this[_1b5]=_1b6;
}else{
if(_1b5){
var _1bc={toSource:null};
var _1bd=["toString","valueOf"];
if(Base._prototyping){
_1bd[2]="constructor";
}
for(var i=0;(name=_1bd[i]);i++){
if(_1b5[name]!=_1bc[name]){
_1b7.call(this,name,_1b5[name]);
}
}
for(var name in _1b5){
if(!_1bc[name]){
_1b7.call(this,name,_1b5[name]);
}
}
}
}
return this;
},base:function(){
}};
Base.extend=function(_1c0,_1c1){
var _1c2=Base.prototype.extend;
if(!_1c0){
_1c0={};
}
Base._prototyping=true;
var _1c3=new this;
_1c2.call(_1c3,_1c0);
var _1c4=_1c3.constructor;
_1c3.constructor=this;
delete Base._prototyping;
var _1c5=function(){
if(!Base._prototyping){
_1c4.apply(this,arguments);
}
this.constructor=_1c5;
};
_1c5.prototype=_1c3;
_1c5.extend=this.extend;
_1c5.implement=this.implement;
_1c5.toString=function(){
return String(_1c4);
};
_1c2.call(_1c5,_1c1);
var _1c6=_1c4?_1c5:_1c3;
if(_1c6.init instanceof Function){
_1c6.init();
}
return _1c6;
};
Base.implement=function(_1c7){
if(_1c7 instanceof Function){
_1c7=_1c7.prototype;
}
this.prototype.extend(_1c7);
};
var mcd={};
mcd.getStyle=function(el,_1c9){
if(el.currentStyle){
var _1ca="";
for(var i=0;i<_1c9.length;i++){
if(_1c9.charAt(i)=="-"){
_1ca+=_1c9.charAt(i+1).toUpperCase();
i++;
}else{
_1ca=_1ca+_1c9.charAt(i);
}
}
return el.currentStyle[_1ca];
}else{
var _1cc=document.defaultView.getComputedStyle(el,null);
if(_1cc){
return _1cc.getPropertyValue(_1c9);
}else{
return null;
}
}
};
mcd.getElementsByTagAndClassName=function(_1cd,_1ce,_1cf){
if(typeof (_1cd)=="undefined"||_1cd===null){
_1cd="*";
}
if(typeof (_1cf)=="undefined"||_1cf===null){
_1cf=document;
}
_1cf=$(_1cf);
var _1d0=(_1cf.getElementsByTagName(_1cd)||document.all);
if(typeof (_1ce)=="undefined"||_1ce===null){
extend(null,_1d0);
}
var _1d1=[];
for(var i=0;i<_1d0.length;i++){
var _1d3=_1d0[i];
var cls=_1d3.className;
if(!cls){
continue;
}
var _1d5=cls.split(" ");
for(var j=0;j<_1d5.length;j++){
if(_1d5[j]==_1ce){
_1d1.push(_1d3);
break;
}
}
}
return _1d1;
};
mcd.Deferred=Base.extend({constructor:Deferred});
mcd.Deferred.implement(Deferred.prototype);
mcd.Timer=Base.extend({constructor:function(_1d7,time,_1d9){
this.timeoutid=-1;
if(_1d7){
if(_1d9){
this.start(_1d7,time);
}else{
this.set(_1d7,time);
}
}
},set:function(_1da,time){
this.call=_1da;
this.settime=time;
},start:function(_1dc,time){
if(this.timeoutid!=-1){
this.stop();
}
if(_1dc){
this.set(_1dc,time);
}
var _1de=this;
this.timeoutid=window.setTimeout(function(){
_1de.clk();
},this.settime);
},reset:function(){
if(this.timeoutid!=-1){
window.clearTimeout(this.timeoutid);
this.timeoutid=-1;
var _1df=this;
this.timeoutid=window.setTimeout(function(){
_1df.clk();
},this.settime);
}
},stop:function(){
if(this.timeoutid!=-1){
window.clearTimeout(this.timeoutid);
this.timeoutid=-1;
}
},toggle:function(){
if(this.timeout==-1){
this.start();
}else{
this.stop();
}
},retrigger:function(){
if(this.timeoutid==-1){
var _1e0=this;
this.timeoutid=window.setTimeout(function(){
_1e0.clk();
},this.settime);
}
},clk:function(){
if(this.timeoutid!=-1){
this.timeoutid=-1;
this.call();
}
}});
mcd.setOpacitySingle=function(elem,o){
if(o==1){
var _1e3=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));
elem.style["opacity"]=_1e3?0.999999:1;
if(/MSIE/.test(navigator.userAgent)){
elem.style["filter"]=mcd.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"");
}
}else{
if(o<0.00001){
o=0;
}
elem.style["opacity"]=o;
if(/MSIE/.test(navigator.userAgent)){
elem.style["filter"]=mcd.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")";
}
}
};
mcd.setOpacity=setOpacity=function(elem,o){
elem=$(elem);
mcd.setOpacitySingle(elem,o);
if(/MSIE/.test(navigator.userAgent)){
nodeWalk(elem,function(node){
if(node.nodeType==1){
mcd.setOpacitySingle(node,o);
return node.childNodes;
}
return null;
});
}
};
function setStyle(elem,_1e8){
elem=$(elem);
for(name in _1e8){
if(name=="opacity"){
mcd.setOpacity(elem,_1e8[name]);
}else{
elem.style[camelize(name)]=_1e8[name];
}
}
}
mcd.anim={};
mcd.anim.adjusters={easeboth:function(time){
if(time<0.5){
return 2*time*time;
}else{
return -2*(time-1)*(time-1)+1;
}
},easein:function(time){
return time*time;
},easeout:function(time){
return -((time-1)*(time-1))+1;
},linear:function(time){
return time;
}};
mcd.anim.attributes={regular:Base.extend({constructor:function(at){
this.at=at;
},get:function(el){
return parseInt(getStyle(el,this.at));
},set:function(el,x){
var obj={};
obj[this.at]=(x=="auto")?x:x+"px";
if(x=="auto"){
setStyle(el,obj);
}else{
setStyle(el,obj);
}
},interpolate:function(from,to,off){
return from*(1-off)+to*off;
}}),binary:Base.extend({constructor:function(at){
this.at=at;
},get:function(el){
el.style[this.at];
},set:function(el,x){
el.style[this.at]=x;
},interpolate:function(from,to,x){
return to;
}}),colour:Base.extend({constructor:function(at){
this.at=at;
},get:function(el){
Color.fromComputedStyle(el,this.at);
},set:function(el,x){
var _200={};
if(x instanceof Color){
_200[this.at]=x.toHexString();
}else{
_200[this.at]=x;
}
setStyle(el,_200);
},interpolate:function(from,to,off){
if(!(from instanceof Color)){
from=Color.fromString(from);
}
if(!(to instanceof Color)){
to=Color.fromString(to);
}
return from.blendedColor(to,off);
}})};
update(mcd.anim.attributes,{height:mcd.anim.attributes.regular.extend({constructor:function(){
this.base("height");
},get:function(el){
var _205=parseInt(mcd.getStyle(el,"padding-top"))+parseInt(mcd.getStyle(el,"padding-bottom"));
return getElementDimensions(el).h-_205;
}}),display:mcd.anim.attributes.binary.extend({constructor:function(){
this.base("display");
}}),visibility:mcd.anim.attributes.binary.extend({constructor:function(){
this.base("visibility");
}}),opacity:mcd.anim.attributes.regular.extend({set:function(el,x){
mcd.setOpacity(el,x);
}}),"color":mcd.anim.attributes.colour,"background-color":mcd.anim.attributes.colour,"border-color":mcd.anim.attributes.colour,"frame":Base.extend({constructor:function(at,anim){
this.at=at;
this.framewidth=-anim.getProperty("framewidth",1);
},get:function(el){
var pos=getStyle(el,"background-position");
if(!pos){
return 0;
}else{
return parseInt(pos.split(" ")[0]);
}
},set:function(el,x){
setStyle(el,{"background-position":(Math.floor(x)*this.framewidth)+"px 0px"});
},interpolate:function(from,to,off){
return from*(1-off)+to*off;
}}),"class":mcd.anim.attributes.binary.extend({get:function(el){
return null;
},set:function(el,x){
setElementClass(el,x);
}})});
mcd.anim.base=mcd.Deferred.extend({constructor:function(opts){
this.base();
this.opts=opts;
},setParent:function(_215){
this.parent=_215;
},go:function(){
this.start();
this.starttime=(new Date).getTime();
this.timer=new mcd.Timer(bind(this.tick,this),mcd.anim.base.msperclock,true);
return this;
},cancel:function(){
this.timer.stop();
if(this.fired==-1){
this.errback();
}
return this;
},stop:function(){
this.timer.stop();
if(this.fired==-1){
this.callback();
}
return this;
},tick:function(){
if(this.step()){
this.timer.retrigger();
}else{
this.callback();
}
},getProperty:function(prop,def){
if(this.opts.hasOwnProperty(prop)){
return this.opts[prop];
}else{
if(this.parent){
return this.parent.getProperty(prop,def);
}else{
return def;
}
}
},getDuration:function(){
return this.getProperty("duration");
},getTarget:function(){
return $(this.getProperty("target"));
}},{msperclock:40});
mcd.anim.simultaneous=mcd.anim.base.extend({constructor:function(opts,_219){
this.base(opts);
if(_219){
this.anims=_219;
for(var i=0;i<this.anims.length;i++){
this.anims[i].setParent(this);
}
}else{
this.anims=[];
}
},add:function(){
for(var i=0;i<arguments.length;i++){
arguments[i].setParent(this);
this.anims.push(arguments[i]);
}
return this;
},start:function(){
this.loopcount=this.opts.loop||1;
this.runninganims=extend([],this.anims);
for(var i=0;i<this.runninganims.length;i++){
this.runninganims[i].start();
}
},step:function(){
this.runninganims=filter(function(anim){
return anim.step();
},this.runninganims);
if(this.runninganims.length>0){
return true;
}else{
this.loopcount--;
if(this.loopcount!=0){
this.runninganims=extend([],this.anims);
for(var i=0;i<this.runninganims.length;i++){
this.runninganims[i].start();
}
return true;
}
return false;
}
}});
mcd.anim.sequential=mcd.anim.base.extend({constructor:function(opts,_220){
this.base(opts);
if(_220){
this.anims=_220;
for(var i=0;i<this.anims.length;i++){
this.anims[i].setParent(this);
}
}else{
this.anims=[];
}
},add:function(){
for(var i=0;i<arguments.length;i++){
arguments[i].setParent(this);
this.anims.push(arguments[i]);
}
return this;
},start:function(){
this.idx=0;
this.loopcount=this.opts.loop||1;
this.anims[this.idx].start();
},step:function(){
if(!this.anims[this.idx].step()){
this.idx+=1;
if(this.idx>=this.anims.length){
this.loopcount--;
if(this.loopcount>0){
this.idx=0;
}
}
if(this.idx<this.anims.length){
this.anims[this.idx].start();
return this.step();
}else{
return false;
}
}
return true;
}});
mcd.anim.anim=mcd.anim.base.extend({constructor:function(opts,_224,to){
this.base(opts);
this.attribute=_224;
if(!mcd.anim.attributes[_224]){
this.athelper=new mcd.anim.attributes.regular(_224);
}else{
this.athelper=new mcd.anim.attributes[_224](_224,this);
}
this.to=to;
},adjust:function(time){
return this.getProperty("motion",mcd.anim.adjusters.easeboth)(time);
},getOffset:function(){
return this.adjust(this.time/this.getDuration());
},start:function(){
this.starttime=this.time=(new Date).getTime();
if(this.to=="auto"){
this.auto=true;
var copy=this.getTarget().cloneNode(true);
update(copy.style,{visibility:"hidden",position:"absolute",left:"0px",top:"0px"});
this.athelper.set(copy,"auto");
document.body.appendChild(copy);
this.to=this.athelper.get(copy);
logDebug("Got ",this.to);
document.body.removeChild(copy);
}else{
this.auto=false;
}
this.from=this.getProperty("from",null);
if(this.from==null){
this.from=this.athelper.get(this.getTarget());
}else{
this.athelper.set(this.getTarget(),this.from);
}
},step:function(){
this.time=(new Date).getTime()-this.starttime;
if(this.getDuration()==0){
this.athelper.set(this.getTarget(),this.to);
return false;
}
if(this.time>=this.getDuration()){
var off=1;
}else{
var off=this.getOffset();
}
if(this.athelper.interpolate){
this.athelper.set(this.getTarget(),this.athelper.interpolate(this.from,this.to,off));
}else{
this.athelper.set(this.getTarget(),(this.from*(1-off)+this.to*off));
}
if(off<1){
return true;
}else{
if(this.auto){
this.athelper.set(this.getTarget(),"auto");
}else{
this.athelper.set(this.getTarget(),this.to);
}
return false;
}
}});
mcd.anim.funcanim=mcd.anim.base.extend({constructor:function(opts,func){
this.base(opts);
this.func=func;
},adjust:function(time){
return this.getProperty("motion",mcd.anim.adjusters.easeboth)(time);
},getOffset:function(){
return this.adjust(this.time/this.getDuration());
},start:function(){
this.starttime=this.time=(new Date).getTime();
},step:function(){
this.time=(new Date).getTime()-this.starttime;
if(this.getDuration()==0){
this.func(0);
return false;
}
if(this.time>=this.getDuration()){
var off=1;
}else{
var off=this.getOffset();
}
this.func(off);
return (off<1);
}});
function simultaneous(opts){
var _22e=extend(null,arguments,1);
return new mcd.anim.simultaneous(opts,_22e);
}
function sequential(opts){
var _230=extend(null,arguments,1);
return new mcd.anim.sequential(opts,_230);
}
function animator(opts,_232,to){
return new mcd.anim.anim(opts,_232,to);
}
function funcanimator(opts,func){
return new mcd.anim.funcanim(opts,func);
}


