if(typeof(dojo)!='undefined'){dojo.provide("MochiKit.Base");}
if(typeof(MochiKit)=='undefined'){MochiKit={};}
if(typeof(MochiKit.Base)=='undefined'){MochiKit.Base={};}
MochiKit.Base.VERSION="1.3.1";MochiKit.Base.NAME="MochiKit.Base";MochiKit.Base.update=function(self,obj){if(self===null){self={};}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(typeof(o)!='undefined'&&o!==null){for(var k in o){self[k]=o[k];}}}
return self;};MochiKit.Base.update(MochiKit.Base,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]";},toString:function(){return this.__repr__();},counter:function(n){if(arguments.length===0){n=1;}
return function(){return n++;};},clone:function(obj){var me=arguments.callee;if(arguments.length==1){me.prototype=obj;return new me();}},flattenArguments:function(lst){var res=[];var m=MochiKit.Base;var args=m.extend(null,arguments);while(args.length){var o=args.shift();if(o&&typeof(o)=="object"&&typeof(o.length)=="number"){for(var i=o.length-1;i>=0;i--){args.unshift(o[i]);}}else{res.push(o);}}
return res;},extend:function(self,obj,skip){if(!skip){skip=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(!self){self=[];}
for(var i=skip;i<l;i++){self.push(obj[i]);}}
return self;},updatetree:function(self,obj){if(self===null){self={};}
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(self[k])=='object'&&typeof(v)=='object'){arguments.callee(self[k],v);}else{self[k]=v;}}}}
return self;},setdefault:function(self,obj){if(self===null){self={};}
for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var k in o){if(!(k in self)){self[k]=o[k];}}}
return self;},keys:function(obj){var rval=[];for(var prop in obj){rval.push(prop);}
return rval;},items:function(obj){var rval=[];var e;for(var prop in obj){var v;try{v=obj[prop];}catch(e){continue;}
rval.push([prop,v]);}
return rval;},_newNamedError:function(module,name,func){func.prototype=new MochiKit.Base.NamedError(module.NAME+"."+name);module[name]=func;},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;},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(func){return function(){return this[func].apply(this,arguments);};},itemgetter:function(func){return function(arg){return arg[func];};},typeMatcher:function(){var types={};for(var i=0;i<arguments.length;i++){var typ=arguments[i];types[typ]=typ;}
return function(){for(var i=0;i<arguments.length;i++){if(!(typeof(arguments[i])in types)){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'){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 rval=[];for(var i=1;i<arguments.length;i++){rval.push(fn(arguments[i]));}
return rval;},map:function(fn,lst){var m=MochiKit.Base;var itr=MochiKit.Iter;var isArrayLike=m.isArrayLike;if(arguments.length<=2){if(!isArrayLike(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 rval=[];for(var i=0;i<lst.length;i++){rval.push(fn(lst[i]));}
return rval;}else{if(fn===null){fn=Array;}
var length=null;for(i=1;i<arguments.length;i++){if(!isArrayLike(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(length===null||length>l){length=l;}}
rval=[];for(i=0;i<length;i++){var args=[];for(var j=1;j<arguments.length;j++){args.push(arguments[j][i]);}
rval.push(fn.apply(this,args));}
return rval;}},xfilter:function(fn){var rval=[];if(fn===null){fn=MochiKit.Base.operator.truth;}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(fn(o)){rval.push(o);}}
return rval;},filter:function(fn,lst,self){var rval=[];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,self);}else if(typeof(self)=='undefined'||self===null){for(var i=0;i<lst.length;i++){var o=lst[i];if(fn(o)){rval.push(o);}}}else{for(i=0;i<lst.length;i++){o=lst[i];if(fn.call(self,o)){rval.push(o);}}}
return rval;},_wrapDumbFunction:function(func){return function(){switch(arguments.length){case 0:return func();case 1:return func(arguments[0]);case 2:return func(arguments[0],arguments[1]);case 3:return func(arguments[0],arguments[1],arguments[2]);}
var args=[];for(var i=0;i<arguments.length;i++){args.push("arguments["+i+"]");}
return eval("(func("+args.join(",")+"))");};},method:function(self,func){var m=MochiKit.Base;return m.bind.apply(this,m.extend([func,self],arguments,2));},bind:function(func,self){if(typeof(func)=="string"){func=self[func];}
var im_func=func.im_func;var im_preargs=func.im_preargs;var im_self=func.im_self;var m=MochiKit.Base;if(typeof(func)=="function"&&typeof(func.apply)=="undefined"){func=m._wrapDumbFunction(func);}
if(typeof(im_func)!='function'){im_func=func;}
if(typeof(self)!='undefined'){im_self=self;}
if(typeof(im_preargs)=='undefined'){im_preargs=[];}else{im_preargs=im_preargs.slice();}
m.extend(im_preargs,arguments,2);var newfunc=function(){var args=arguments;var me=arguments.callee;if(me.im_preargs.length>0){args=m.concat(me.im_preargs,args);}
var self=me.im_self;if(!self){self=this;}
return me.im_func.apply(self,args);};newfunc.im_self=im_self;newfunc.im_func=im_func;newfunc.im_preargs=im_preargs;return newfunc;},bindMethods:function(self){var bind=MochiKit.Base.bind;for(var k in self){var func=self[k];if(typeof(func)=='function'){self[k]=bind(func,self);}}},registerComparator:function(name,check,comparator,override){MochiKit.Base.comparatorRegistry.register(name,check,comparator,override);},_primitives:{'boolean':true,'string':true,'number':true},compare:function(a,b){if(a==b){return 0;}
var aIsNull=(typeof(a)=='undefined'||a===null);var bIsNull=(typeof(b)=='undefined'||b===null);if(aIsNull&&bIsNull){return 0;}else if(aIsNull){return-1;}else if(bIsNull){return 1;}
var m=MochiKit.Base;var prim=m._primitives;if(!(typeof(a)in prim&&typeof(b)in prim)){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 repr=m.repr;throw new TypeError(repr(a)+" and "+repr(b)+" can not be compared");},compareDateLike:function(a,b){return MochiKit.Base.compare(a.getTime(),b.getTime());},compareArrayLike:function(a,b){var compare=MochiKit.Base.compare;var count=a.length;var rval=0;if(count>b.length){rval=1;count=b.length;}else if(count<b.length){rval=-1;}
for(var i=0;i<count;i++){var cmp=compare(a[i],b[i]);if(cmp){return cmp;}}
return rval;},registerRepr:function(name,check,wrap,override){MochiKit.Base.reprRegistry.register(name,check,wrap,override);},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 ostring=(o+"");}catch(e){return"["+typeof(o)+"]";}
if(typeof(o)=="function"){o=ostring.replace(/^\s+/,"");var idx=o.indexOf("{");if(idx!=-1){o=o.substr(0,idx)+"{...}";}}
return ostring;},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(name,check,wrap,override){MochiKit.Base.jsonRegistry.register(name,check,wrap,override);},evalJSON:function(){return eval("("+arguments[0]+")");},serializeJSON:function(o){var objtype=typeof(o);if(objtype=="undefined"){return"undefined";}else if(objtype=="number"||objtype=="boolean"){return o+"";}else if(o===null){return"null";}
var m=MochiKit.Base;var reprString=m.reprString;if(objtype=="string"){return reprString(o);}
var me=arguments.callee;var newObj;if(typeof(o.__json__)=="function"){newObj=o.__json__();if(o!==newObj){return me(newObj);}}
if(typeof(o.json)=="function"){newObj=o.json();if(o!==newObj){return me(newObj);}}
if(objtype!="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{newObj=m.jsonRegistry.match(o);return me(newObj);}catch(e){if(e!=m.NotFound){throw e;}}
if(objtype=="function"){return null;}
res=[];for(var k in o){var useKey;if(typeof(k)=="number"){useKey='"'+k+'"';}else if(typeof(k)=="string"){useKey=reprString(k);}else{continue;}
val=me(o[k]);if(typeof(val)!="string"){continue;}
res.push(useKey+":"+val);}
return"{"+res.join(", ")+"}";},objEqual:function(a,b){return(MochiKit.Base.compare(a,b)===0);},arrayEqual:function(self,arr){if(self.length!=arr.length){return false;}
return(MochiKit.Base.compare(self,arr)===0);},concat:function(){var rval=[];var extend=MochiKit.Base.extend;for(var i=0;i<arguments.length;i++){extend(rval,arguments[i]);}
return rval;},keyComparator:function(key){var m=MochiKit.Base;var compare=m.compare;if(arguments.length==1){return function(a,b){return compare(a[key],b[key]);};}
var compareKeys=m.extend(null,arguments);return function(a,b){var rval=0;for(var i=0;(rval===0)&&(i<compareKeys.length);i++){var key=compareKeys[i];rval=compare(a[key],b[key]);}
return rval;};},reverseKeyComparator:function(key){var comparator=MochiKit.Base.keyComparator.apply(this,arguments);return function(a,b){return comparator(b,a);};},partial:function(func){var m=MochiKit.Base;return m.bind.apply(this,m.extend([func,undefined],arguments,1));},listMinMax:function(which,lst){if(lst.length===0){return null;}
var cur=lst[0];var compare=MochiKit.Base.compare;for(var i=1;i<lst.length;i++){var o=lst[i];if(compare(o,cur)==which){cur=o;}}
return cur;},objMax:function(){return MochiKit.Base.listMinMax(1,arguments);},objMin:function(){return MochiKit.Base.listMinMax(-1,arguments);},findIdentical:function(lst,value,start,end){if(typeof(end)=="undefined"||end===null){end=lst.length;}
for(var i=(start||0);i<end;i++){if(lst[i]===value){return i;}}
return-1;},findValue:function(lst,value,start,end){if(typeof(end)=="undefined"||end===null){end=lst.length;}
var cmp=MochiKit.Base.compare;for(var i=(start||0);i<end;i++){if(cmp(lst[i],value)===0){return i;}}
return-1;},nodeWalk:function(node,visitor){var nodes=[node];var extend=MochiKit.Base.extend;while(nodes.length){var res=visitor(nodes.shift());if(res){extend(nodes,res);}}},nameFunctions:function(namespace){var base=namespace.NAME;if(typeof(base)=='undefined'){base='';}else{base=base+'.';}
for(var name in namespace){var o=namespace[name];if(typeof(o)=='function'&&typeof(o.NAME)=='undefined'){try{o.NAME=base+name;}catch(e){}}}},queryString:function(names,values){if(typeof(MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof(names)=="string"||(typeof(names.nodeType)!="undefined"&&names.nodeType>0))){var kv=MochiKit.DOM.formContents(names);names=kv[0];values=kv[1];}else if(arguments.length==1){var o=names;names=[];values=[];for(var k in o){var v=o[k];if(typeof(v)!="function"){names.push(k);values.push(v);}}}
var rval=[];var len=Math.min(names.length,values.length);var urlEncode=MochiKit.Base.urlEncode;for(var i=0;i<len;i++){v=values[i];if(typeof(v)!='undefined'&&v!==null){rval.push(urlEncode(names[i])+"="+urlEncode(v));}}
return rval.join("&");},parseQueryString:function(encodedString,useArrays){var pairs=encodedString.replace(/\+/g,"%20").split("&");var o={};var decode;if(typeof(decodeURIComponent)!="undefined"){decode=decodeURIComponent;}else{decode=unescape;}
if(useArrays){for(var i=0;i<pairs.length;i++){var pair=pairs[i].split("=");var name=decode(pair[0]);var arr=o[name];if(!(arr instanceof Array)){arr=[];o[name]=arr;}
arr.push(decode(pair[1]));}}else{for(i=0;i<pairs.length;i++){pair=pairs[i].split("=");o[decode(pair[0])]=decode(pair[1]);}}
return o;}});MochiKit.Base.AdapterRegistry=function(){this.pairs=[];};MochiKit.Base.AdapterRegistry.prototype={register:function(name,check,wrap,override){if(override){this.pairs.unshift([name,check,wrap]);}else{this.pairs.push([name,check,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=["counter","clone","extend","update","updatetree","setdefault","keys","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","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"];MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];MochiKit.Base._exportSymbols=function(globals,module){if(typeof(MochiKit.__export__)=="undefined"){MochiKit.__export__=(MochiKit.__compat__||(typeof(JSAN)=='undefined'&&typeof(dojo)=='undefined'));}
if(!MochiKit.__export__){return;}
var all=module.EXPORT_TAGS[":all"];for(var i=0;i<all.length;i++){globals[all[i]]=module[all[i]];}};MochiKit.Base.__new__=function(){var m=this;m.forward=m.forwardCall;m.find=m.findValue;if(typeof(encodeURIComponent)!="undefined"){m.urlEncode=function(unencoded){return encodeURIComponent(unencoded).replace(/\'/g,'%27');};}else{m.urlEncode=function(unencoded){return escape(unencoded).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.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.__compat__){compare=MochiKit.Base.compare;}
MochiKit.Base._exportSymbols(this,MochiKit.Base);if(typeof(dojo)!='undefined'){dojo.provide('MochiKit.Iter');dojo.require('MochiKit.Base');}
if(typeof(JSAN)!='undefined'){JSAN.use("MochiKit.Base",[]);}
try{if(typeof(MochiKit.Base)=='undefined'){throw"";}}catch(e){throw"MochiKit.Iter depends on MochiKit.Base!";}
if(typeof(MochiKit.Iter)=='undefined'){MochiKit.Iter={};}
MochiKit.Iter.NAME="MochiKit.Iter";MochiKit.Iter.VERSION="1.3.1";MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]";},toString:function(){return this.__repr__();},registerIteratorFactory:function(name,check,iterfactory,override){MochiKit.Iter.iteratorRegistry.register(name,check,iterfactory,override);},iter:function(iterable,sentinel){var self=MochiKit.Iter;if(arguments.length==2){return self.takewhile(function(a){return a!=sentinel;},iterable);}
if(typeof(iterable.next)=='function'){return iterable;}else if(typeof(iterable.iter)=='function'){return iterable.iter();}
try{return self.iteratorRegistry.match(iterable);}catch(e){var m=MochiKit.Base;if(e==m.NotFound){e=new TypeError(typeof(iterable)+": "+m.repr(iterable)+" is not iterable");}
throw e;}},count:function(n){if(!n){n=0;}
var m=MochiKit.Base;return{repr:function(){return"count("+n+")";},toString:m.forwardCall("repr"),next:m.counter(n)};},cycle:function(p){var self=MochiKit.Iter;var m=MochiKit.Base;var lst=[];var iterator=self.iter(p);return{repr:function(){return"cycle(...)";},toString:m.forwardCall("repr"),next:function(){try{var rval=iterator.next();lst.push(rval);return rval;}catch(e){if(e!=self.StopIteration){throw e;}
if(lst.length===0){this.next=function(){throw self.StopIteration;};}else{var i=-1;this.next=function(){i=(i+1)%lst.length;return lst[i];};}
return this.next();}}};},repeat:function(elem,n){var m=MochiKit.Base;if(typeof(n)=='undefined'){return{repr:function(){return"repeat("+m.repr(elem)+")";},toString:m.forwardCall("repr"),next:function(){return elem;}};}
return{repr:function(){return"repeat("+m.repr(elem)+", "+n+")";},toString:m.forwardCall("repr"),next:function(){if(n<=0){throw MochiKit.Iter.StopIteration;}
n-=1;return elem;}};},next:function(iterator){return iterator.next();},izip:function(p,q){var m=MochiKit.Base;var next=MochiKit.Iter.next;var iterables=m.map(iter,arguments);return{repr:function(){return"izip(...)";},toString:m.forwardCall("repr"),next:function(){return m.map(next,iterables);}};},ifilter:function(pred,seq){var m=MochiKit.Base;seq=MochiKit.Iter.iter(seq);if(pred===null){pred=m.operator.truth;}
return{repr:function(){return"ifilter(...)";},toString:m.forwardCall("repr"),next:function(){while(true){var rval=seq.next();if(pred(rval)){return rval;}}
return undefined;}};},ifilterfalse:function(pred,seq){var m=MochiKit.Base;seq=MochiKit.Iter.iter(seq);if(pred===null){pred=m.operator.truth;}
return{repr:function(){return"ifilterfalse(...)";},toString:m.forwardCall("repr"),next:function(){while(true){var rval=seq.next();if(!pred(rval)){return rval;}}
return undefined;}};},islice:function(seq){var self=MochiKit.Iter;var m=MochiKit.Base;seq=self.iter(seq);var start=0;var stop=0;var step=1;var i=-1;if(arguments.length==2){stop=arguments[1];}else if(arguments.length==3){start=arguments[1];stop=arguments[2];}else{start=arguments[1];stop=arguments[2];step=arguments[3];}
return{repr:function(){return"islice("+["...",start,stop,step].join(", ")+")";},toString:m.forwardCall("repr"),next:function(){var rval;while(i<start){rval=seq.next();i++;}
if(start>=stop){throw self.StopIteration;}
start+=step;return rval;}};},imap:function(fun,p,q){var m=MochiKit.Base;var self=MochiKit.Iter;var iterables=m.map(self.iter,m.extend(null,arguments,1));var map=m.map;var next=self.next;return{repr:function(){return"imap(...)";},toString:m.forwardCall("repr"),next:function(){return fun.apply(this,map(next,iterables));}};},applymap:function(fun,seq,self){seq=MochiKit.Iter.iter(seq);var m=MochiKit.Base;return{repr:function(){return"applymap(...)";},toString:m.forwardCall("repr"),next:function(){return fun.apply(self,seq.next());}};},chain:function(p,q){var self=MochiKit.Iter;var m=MochiKit.Base;if(arguments.length==1){return self.iter(arguments[0]);}
var argiter=m.map(self.iter,arguments);return{repr:function(){return"chain(...)";},toString:m.forwardCall("repr"),next:function(){while(argiter.length>1){try{return argiter[0].next();}catch(e){if(e!=self.StopIteration){throw e;}
argiter.shift();}}
if(argiter.length==1){var arg=argiter.shift();this.next=m.bind("next",arg);return this.next();}
throw self.StopIteration;}};},takewhile:function(pred,seq){var self=MochiKit.Iter;seq=self.iter(seq);return{repr:function(){return"takewhile(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){var rval=seq.next();if(!pred(rval)){this.next=function(){throw self.StopIteration;};this.next();}
return rval;}};},dropwhile:function(pred,seq){seq=MochiKit.Iter.iter(seq);var m=MochiKit.Base;var bind=m.bind;return{"repr":function(){return"dropwhile(...)";},"toString":m.forwardCall("repr"),"next":function(){while(true){var rval=seq.next();if(!pred(rval)){break;}}
this.next=bind("next",seq);return rval;}};},_tee:function(ident,sync,iterable){sync.pos[ident]=-1;var m=MochiKit.Base;var listMin=m.listMin;return{repr:function(){return"tee("+ident+", ...)";},toString:m.forwardCall("repr"),next:function(){var rval;var i=sync.pos[ident];if(i==sync.max){rval=iterable.next();sync.deque.push(rval);sync.max+=1;sync.pos[ident]+=1;}else{rval=sync.deque[i-sync.min];sync.pos[ident]+=1;if(i==sync.min&&listMin(sync.pos)!=sync.min){sync.min+=1;sync.deque.shift();}}
return rval;}};},tee:function(iterable,n){var rval=[];var sync={"pos":[],"deque":[],"max":-1,"min":-1};if(arguments.length==1){n=2;}
var self=MochiKit.Iter;iterable=self.iter(iterable);var _tee=self._tee;for(var i=0;i<n;i++){rval.push(_tee(i,sync,iterable));}
return rval;},list:function(iterable){var m=MochiKit.Base;if(typeof(iterable.slice)=='function'){return iterable.slice();}else if(m.isArrayLike(iterable)){return m.concat(iterable);}
var self=MochiKit.Iter;iterable=self.iter(iterable);var rval=[];try{while(true){rval.push(iterable.next());}}catch(e){if(e!=self.StopIteration){throw e;}
return rval;}
return undefined;},reduce:function(fn,iterable,initial){var i=0;var x=initial;var self=MochiKit.Iter;iterable=self.iter(iterable);if(arguments.length<3){try{x=iterable.next();}catch(e){if(e==self.StopIteration){e=new TypeError("reduce() of empty sequence with no initial value");}
throw e;}
i++;}
try{while(true){x=fn(x,iterable.next());}}catch(e){if(e!=self.StopIteration){throw e;}}
return x;},range:function(){var start=0;var stop=0;var step=1;if(arguments.length==1){stop=arguments[0];}else if(arguments.length==2){start=arguments[0];stop=arguments[1];}else if(arguments.length==3){start=arguments[0];stop=arguments[1];step=arguments[2];}else{throw new TypeError("range() takes 1, 2, or 3 arguments!");}
if(step===0){throw new TypeError("range() step must not be 0");}
return{next:function(){if((step>0&&start>=stop)||(step<0&&start<=stop)){throw MochiKit.Iter.StopIteration;}
var rval=start;start+=step;return rval;},repr:function(){return"range("+[start,stop,step].join(", ")+")";},toString:MochiKit.Base.forwardCall("repr")};},sum:function(iterable,start){var x=start||0;var self=MochiKit.Iter;iterable=self.iter(iterable);try{while(true){x+=iterable.next();}}catch(e){if(e!=self.StopIteration){throw e;}}
return x;},exhaust:function(iterable){var self=MochiKit.Iter;iterable=self.iter(iterable);try{while(true){iterable.next();}}catch(e){if(e!=self.StopIteration){throw e;}}},forEach:function(iterable,func,self){var m=MochiKit.Base;if(arguments.length>2){func=m.bind(func,self);}
if(m.isArrayLike(iterable)){try{for(var i=0;i<iterable.length;i++){func(iterable[i]);}}catch(e){if(e!=MochiKit.Iter.StopIteration){throw e;}}}else{self=MochiKit.Iter;self.exhaust(self.imap(func,iterable));}},every:function(iterable,func){var self=MochiKit.Iter;try{self.ifilterfalse(func,iterable).next();return false;}catch(e){if(e!=self.StopIteration){throw e;}
return true;}},sorted:function(iterable,cmp){var rval=MochiKit.Iter.list(iterable);if(arguments.length==1){cmp=MochiKit.Base.compare;}
rval.sort(cmp);return rval;},reversed:function(iterable){var rval=MochiKit.Iter.list(iterable);rval.reverse();return rval;},some:function(iterable,func){var self=MochiKit.Iter;try{self.ifilter(func,iterable).next();return true;}catch(e){if(e!=self.StopIteration){throw e;}
return false;}},iextend:function(lst,iterable){if(MochiKit.Base.isArrayLike(iterable)){for(var i=0;i<iterable.length;i++){lst.push(iterable[i]);}}else{var self=MochiKit.Iter;iterable=self.iter(iterable);try{while(true){lst.push(iterable.next());}}catch(e){if(e!=self.StopIteration){throw e;}}}
return lst;},groupby:function(iterable,keyfunc){var m=MochiKit.Base;var self=MochiKit.Iter;if(arguments.length<2){keyfunc=m.operator.identity;}
iterable=self.iter(iterable);var pk=undefined;var k=undefined;var v;function fetch(){v=iterable.next();k=keyfunc(v);};function eat(){var ret=v;v=undefined;return ret;};var first=true;return{repr:function(){return"groupby(...)";},next:function(){while(k==pk){fetch();if(first){first=false;break;}}
pk=k;return[k,{next:function(){if(v==undefined){fetch();}
if(k!=pk){throw self.StopIteration;}
return eat();}}];}};},groupby_as_array:function(iterable,keyfunc){var m=MochiKit.Base;var self=MochiKit.Iter;if(arguments.length<2){keyfunc=m.operator.identity;}
iterable=self.iter(iterable);var result=[];var first=true;var prev_key;while(true){try{var value=iterable.next();var key=keyfunc(value);}catch(e){if(e==self.StopIteration){break;}
throw e;}
if(first||key!=prev_key){var values=[];result.push([key,values]);}
values.push(value);first=false;prev_key=key;}
return result;},arrayLikeIter:function(iterable){var i=0;return{repr:function(){return"arrayLikeIter(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){if(i>=iterable.length){throw MochiKit.Iter.StopIteration;}
return iterable[i++];}};},hasIterateNext:function(iterable){return(iterable&&typeof(iterable.iterateNext)=="function");},iterateNextIter:function(iterable){return{repr:function(){return"iterateNextIter(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){var rval=iterable.iterateNext();if(rval===null||rval===undefined){throw MochiKit.Iter.StopIteration;}
return rval;}};}});MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",];MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"];MochiKit.Iter.__new__=function(){var m=MochiKit.Base;this.StopIteration=new m.NamedError("StopIteration");this.iteratorRegistry=new m.AdapterRegistry();this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter);this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter);this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};m.nameFunctions(this);};MochiKit.Iter.__new__();if(!MochiKit.__compat__){reduce=MochiKit.Iter.reduce;}
MochiKit.Base._exportSymbols(this,MochiKit.Iter);if(typeof(dojo)!='undefined'){dojo.provide("MochiKit.DOM");dojo.require("MochiKit.Iter");}
if(typeof(JSAN)!='undefined'){JSAN.use("MochiKit.Iter",[]);}
try{if(typeof(MochiKit.Iter)=='undefined'){throw"";}}catch(e){throw"MochiKit.DOM depends on MochiKit.Iter!";}
if(typeof(MochiKit.DOM)=='undefined'){MochiKit.DOM={};}
MochiKit.DOM.NAME="MochiKit.DOM";MochiKit.DOM.VERSION="1.3.1";MochiKit.DOM.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]";};MochiKit.DOM.toString=function(){return this.__repr__();};MochiKit.DOM.EXPORT=["formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","getNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","computedStyle","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","setDisplayForElement","hideElement","showElement","scrapeText","elementDimensions","elementPosition","setElementDimensions","setElementPosition","getViewportDimensions","setOpacity"];MochiKit.DOM.EXPORT_OK=["domConverters"];MochiKit.DOM.Dimensions=function(w,h){this.w=w;this.h=h;};MochiKit.DOM.Dimensions.prototype.repr=function(){var repr=MochiKit.Base.repr;return"{w: "+repr(this.w)+", h: "+repr(this.h)+"}";};MochiKit.DOM.Coordinates=function(x,y){this.x=x;this.y=y;};MochiKit.DOM.Coordinates.prototype.repr=function(){var repr=MochiKit.Base.repr;return"{x: "+repr(this.x)+", y: "+repr(this.y)+"}";};MochiKit.DOM.Coordinates.prototype.toString=function(){return this.repr();};MochiKit.Base.update(MochiKit.DOM,{setOpacity:function(elem,o){elem=MochiKit.DOM.getElement(elem);MochiKit.DOM.updateNodeAttributes(elem,{'style':{'opacity':o,'-moz-opacity':o,'-khtml-opacity':o,'filter':' alpha(opacity='+(o*100)+')'}});},getViewportDimensions:function(){var d=new MochiKit.DOM.Dimensions();var w=MochiKit.DOM._window;var b=MochiKit.DOM._document.body;if(w.innerWidth){d.w=w.innerWidth;d.h=w.innerHeight;}else if(b.parentElement.clientWidth){d.w=b.parentElement.clientWidth;d.h=b.parentElement.clientHeight;}else if(b&&b.clientWidth){d.w=b.clientWidth;d.h=b.clientHeight;}
return d;},elementDimensions:function(elem){var self=MochiKit.DOM;if(typeof(elem.w)=='number'||typeof(elem.h)=='number'){return new self.Dimensions(elem.w||0,elem.h||0);}
elem=self.getElement(elem);if(!elem){return undefined;}
if(self.computedStyle(elem,'display')!='none'){return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0);}
var s=elem.style;var originalVisibility=s.visibility;var originalPosition=s.position;s.visibility='hidden';s.position='absolute';s.display='';var originalWidth=elem.offsetWidth;var originalHeight=elem.offsetHeight;s.display='none';s.position=originalPosition;s.visibility=originalVisibility;return new self.Dimensions(originalWidth,originalHeight);},elementPosition:function(elem,relativeTo){var self=MochiKit.DOM;elem=self.getElement(elem);if(!elem){return undefined;}
var c=new self.Coordinates(0,0);if(elem.x&&elem.y){c.x+=elem.x||0;c.y+=elem.y||0;return c;}else if(elem.parentNode===null||self.computedStyle(elem,'display')=='none'){return undefined;}
var box=null;var parent=null;var d=MochiKit.DOM._document;var de=d.documentElement;var b=d.body;if(elem.getBoundingClientRect){box=elem.getBoundingClientRect();c.x+=box.left+
(de.scrollLeft||b.scrollLeft)-
(de.clientLeft||b.clientLeft);c.y+=box.top+
(de.scrollTop||b.scrollTop)-
(de.clientTop||b.clientTop);}else if(d.getBoxObjectFor){box=d.getBoxObjectFor(elem);c.x+=box.x;c.y+=box.y;}else if(elem.offsetParent){c.x+=elem.offsetLeft;c.y+=elem.offsetTop;parent=elem.offsetParent;if(parent!=elem){while(parent){c.x+=parent.offsetLeft;c.y+=parent.offsetTop;parent=parent.offsetParent;}}
var ua=navigator.userAgent.toLowerCase();if((typeof(opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf('safari')!=-1&&self.computedStyle(elem,'position')=='absolute')){c.x-=b.offsetLeft;c.y-=b.offsetTop;}}
if(typeof(relativeTo)!='undefined'){relativeTo=arguments.callee(relativeTo);if(relativeTo){c.x-=(relativeTo.x||0);c.y-=(relativeTo.y||0);}}
if(elem.parentNode){parent=elem.parentNode;}else{parent=null;}
while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){c.x-=parent.scrollLeft;c.y-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}else{parent=null;}}
return c;},setElementDimensions:function(elem,newSize,units){elem=MochiKit.DOM.getElement(elem);if(typeof(units)=='undefined'){units='px';}
MochiKit.DOM.updateNodeAttributes(elem,{'style':{'width':newSize.w+units,'height':newSize.h+units}});},setElementPosition:function(elem,newPos,units){elem=MochiKit.DOM.getElement(elem);if(typeof(units)=='undefined'){units='px';}
MochiKit.DOM.updateNodeAttributes(elem,{'style':{'left':newPos.x+units,'top':newPos.y+units}});},currentWindow:function(){return MochiKit.DOM._window;},currentDocument:function(){return MochiKit.DOM._document;},withWindow:function(win,func){var self=MochiKit.DOM;var oldDoc=self._document;var oldWin=self._win;var rval;try{self._window=win;self._document=win.document;rval=func();}catch(e){self._window=oldWin;self._document=oldDoc;throw e;}
self._window=oldWin;self._document=oldDoc;return rval;},formContents:function(elem){var names=[];var values=[];var m=MochiKit.Base;var self=MochiKit.DOM;if(typeof(elem)=="undefined"||elem===null){elem=self._document;}else{elem=self.getElement(elem);}
m.nodeWalk(elem,function(elem){var name=elem.name;if(m.isNotEmpty(name)){var tagName=elem.nodeName;if(tagName=="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){return null;}
if(tagName=="SELECT"){if(elem.selectedIndex>=0){var opt=elem.options[elem.selectedIndex];names.push(name);values.push((opt.value)?opt.value:opt.text);return null;}
names.push(name);values.push("");return null;}
if(tagName=="FORM"||tagName=="P"||tagName=="SPAN"||tagName=="DIV"){return elem.childNodes;}
names.push(name);values.push(elem.value||'');return null;}
return elem.childNodes;});return[names,values];},withDocument:function(doc,func){var self=MochiKit.DOM;var oldDoc=self._document;var rval;try{self._document=doc;rval=func();}catch(e){self._document=oldDoc;throw e;}
self._document=oldDoc;return rval;},registerDOMConverter:function(name,check,wrap,override){MochiKit.DOM.domConverters.register(name,check,wrap,override);},coerceToDOM:function(node,ctx){var im=MochiKit.Iter;var self=MochiKit.DOM;var iter=im.iter;var repeat=im.repeat;var imap=im.imap;var domConverters=self.domConverters;var coerceToDOM=self.coerceToDOM;var NotFound=MochiKit.Base.NotFound;while(true){if(typeof(node)=='undefined'||node===null){return null;}
if(typeof(node.nodeType)!='undefined'&&node.nodeType>0){return node;}
if(typeof(node)=='number'||typeof(node)=='boolean'){node=node.toString();}
if(typeof(node)=='string'){return self._document.createTextNode(node);}
if(typeof(node.toDOM)=='function'){node=node.toDOM(ctx);continue;}
if(typeof(node)=='function'){node=node(ctx);continue;}
var iterNodes=null;try{iterNodes=iter(node);}catch(e){}
if(iterNodes){return imap(coerceToDOM,iterNodes,repeat(ctx));}
try{node=domConverters.match(node,ctx);continue;}catch(e){if(e!=NotFound){throw e;}}
return self._document.createTextNode(node.toString());}
return undefined;},setNodeAttribute:function(node,attr,value){var o={};o[attr]=value;try{return MochiKit.DOM.updateNodeAttributes(node,o);}catch(e){}
return null;},getNodeAttribute:function(node,attr){var self=MochiKit.DOM;var rename=self.attributeArray.renames[attr];node=self.getElement(node);try{if(rename){return node[rename];}
return node.getAttribute(attr);}catch(e){}
return null;},updateNodeAttributes:function(node,attrs){var elem=node;var self=MochiKit.DOM;if(typeof(node)=='string'){elem=self.getElement(node);}
if(attrs){var updatetree=MochiKit.Base.updatetree;if(self.attributeArray.compliant){for(var k in attrs){var v=attrs[k];if(typeof(v)=='object'&&typeof(elem[k])=='object'){updatetree(elem[k],v);}else if(k.substring(0,2)=="on"){if(typeof(v)=="string"){v=new Function(v);}
elem[k]=v;}else{elem.setAttribute(k,v);}}}else{var renames=self.attributeArray.renames;for(k in attrs){v=attrs[k];var renamed=renames[k];if(k=="style"&&typeof(v)=="string"){elem.style.cssText=v;}else if(typeof(renamed)=="string"){elem[renamed]=v;}else if(typeof(elem[k])=='object'&&typeof(v)=='object'){updatetree(elem[k],v);}else if(k.substring(0,2)=="on"){if(typeof(v)=="string"){v=new Function(v);}
elem[k]=v;}else{elem.setAttribute(k,v);}}}}
return elem;},appendChildNodes:function(node){var elem=node;var self=MochiKit.DOM;if(typeof(node)=='string'){elem=self.getElement(node);}
var nodeStack=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];var concat=MochiKit.Base.concat;while(nodeStack.length){var n=nodeStack.shift();if(typeof(n)=='undefined'||n===null){}else if(typeof(n.nodeType)=='number'){elem.appendChild(n);}else{nodeStack=concat(n,nodeStack);}}
return elem;},replaceChildNodes:function(node){var elem=node;var self=MochiKit.DOM;if(typeof(node)=='string'){elem=self.getElement(node);arguments[0]=elem;}
var child;while((child=elem.firstChild)){elem.removeChild(child);}
if(arguments.length<2){return elem;}else{return self.appendChildNodes.apply(this,arguments);}},createDOM:function(name,attrs){var elem;var self=MochiKit.DOM;var m=MochiKit.Base;if(typeof(attrs)=="string"||typeof(attrs)=="number"){var args=m.extend([name,null],arguments,1);return arguments.callee.apply(this,args);}
if(typeof(name)=='string'){if(attrs&&"name"in attrs&&!self.attributeArray.compliant){name=('<'+name+' name="'+self.escapeHTML(attrs.name)
+'">');}
elem=self._document.createElement(name);}else{elem=name;}
if(attrs){self.updateNodeAttributes(elem,attrs);}
if(arguments.length<=2){return elem;}else{var args=m.extend([elem],arguments,2);return self.appendChildNodes.apply(this,args);}},createDOMFunc:function(){var m=MochiKit.Base;return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments));},swapDOM:function(dest,src){var self=MochiKit.DOM;dest=self.getElement(dest);var parent=dest.parentNode;if(src){src=self.getElement(src);parent.replaceChild(src,dest);}else{parent.removeChild(dest);}
return src;},getElement:function(id){var self=MochiKit.DOM;if(arguments.length==1){return((typeof(id)=="string")?self._document.getElementById(id):id);}else{return MochiKit.Base.map(self.getElement,arguments);}},computedStyle:function(htmlElement,cssProperty,mozillaEquivalentCSS){if(arguments.length==2){mozillaEquivalentCSS=cssProperty;}
var self=MochiKit.DOM;var el=self.getElement(htmlElement);var document=self._document;if(!el||el==document){return undefined;}
if(el.currentStyle){return el.currentStyle[cssProperty];}
if(typeof(document.defaultView)=='undefined'){return undefined;}
if(document.defaultView===null){return undefined;}
var style=document.defaultView.getComputedStyle(el,null);if(typeof(style)=="undefined"||style===null){return undefined;}
return style.getPropertyValue(mozillaEquivalentCSS);},getElementsByTagAndClassName:function(tagName,className,parent){var self=MochiKit.DOM;if(typeof(tagName)=='undefined'||tagName===null){tagName='*';}
if(typeof(parent)=='undefined'||parent===null){parent=self._document;}
parent=self.getElement(parent);var children=(parent.getElementsByTagName(tagName)||self._document.all);if(typeof(className)=='undefined'||className===null){return MochiKit.Base.extend(null,children);}
var elements=[];for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}}
return elements;},_newCallStack:function(path,once){var rval=function(){var callStack=arguments.callee.callStack;for(var i=0;i<callStack.length;i++){if(callStack[i].apply(this,arguments)===false){break;}}
if(once){try{this[path]=null;}catch(e){}}};rval.callStack=[];return rval;},addToCallStack:function(target,path,func,once){var self=MochiKit.DOM;var existing=target[path];var regfunc=existing;if(!(typeof(existing)=='function'&&typeof(existing.callStack)=="object"&&existing.callStack!==null)){regfunc=self._newCallStack(path,once);if(typeof(existing)=='function'){regfunc.callStack.push(existing);}
target[path]=regfunc;}
regfunc.callStack.push(func);},addLoadEvent:function(func){var self=MochiKit.DOM;self.addToCallStack(self._window,"onload",func,true);},focusOnLoad:function(element){var self=MochiKit.DOM;self.addLoadEvent(function(){element=self.getElement(element);if(element){element.focus();}});},setElementClass:function(element,className){var self=MochiKit.DOM;var obj=self.getElement(element);if(self.attributeArray.compliant){obj.setAttribute("class",className);}else{obj.setAttribute("className",className);}},toggleElementClass:function(className){var self=MochiKit.DOM;for(var i=1;i<arguments.length;i++){var obj=self.getElement(arguments[i]);if(!self.addElementClass(obj,className)){self.removeElementClass(obj,className);}}},addElementClass:function(element,className){var self=MochiKit.DOM;var obj=self.getElement(element);var cls=obj.className;if(cls.length===0){self.setElementClass(obj,className);return true;}
if(cls==className){return false;}
var classes=obj.className.split(" ");for(var i=0;i<classes.length;i++){if(classes[i]==className){return false;}}
self.setElementClass(obj,cls+" "+className);return true;},removeElementClass:function(element,className){var self=MochiKit.DOM;var obj=self.getElement(element);var cls=obj.className;if(cls.length===0){return false;}
if(cls==className){self.setElementClass(obj,"");return true;}
var classes=obj.className.split(" ");for(var i=0;i<classes.length;i++){if(classes[i]==className){classes.splice(i,1);self.setElementClass(obj,classes.join(" "));return true;}}
return false;},swapElementClass:function(element,fromClass,toClass){var obj=MochiKit.DOM.getElement(element);var res=MochiKit.DOM.removeElementClass(obj,fromClass);if(res){MochiKit.DOM.addElementClass(obj,toClass);}
return res;},hasElementClass:function(element,className){var obj=MochiKit.DOM.getElement(element);var classes=obj.className.split(" ");for(var i=1;i<arguments.length;i++){var good=false;for(var j=0;j<classes.length;j++){if(classes[j]==arguments[i]){good=true;break;}}
if(!good){return false;}}
return true;},escapeHTML:function(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");},toHTML:function(dom){return MochiKit.DOM.emitHTML(dom).join("");},emitHTML:function(dom,lst){if(typeof(lst)=='undefined'||lst===null){lst=[];}
var queue=[dom];var self=MochiKit.DOM;var escapeHTML=self.escapeHTML;var attributeArray=self.attributeArray;while(queue.length){dom=queue.pop();if(typeof(dom)=='string'){lst.push(dom);}else if(dom.nodeType==1){lst.push('<'+dom.nodeName.toLowerCase());var attributes=[];var domAttr=attributeArray(dom);for(var i=0;i<domAttr.length;i++){var a=domAttr[i];attributes.push([" ",a.name,'="',escapeHTML(a.value),'"']);}
attributes.sort();for(i=0;i<attributes.length;i++){var attrs=attributes[i];for(var j=0;j<attrs.length;j++){lst.push(attrs[j]);}}
if(dom.hasChildNodes()){lst.push(">");queue.push("</"+dom.nodeName.toLowerCase()+">");var cnodes=dom.childNodes;for(i=cnodes.length-1;i>=0;i--){queue.push(cnodes[i]);}}else{lst.push('/>');}}else if(dom.nodeType==3){lst.push(escapeHTML(dom.nodeValue));}}
return lst;},setDisplayForElement:function(display,element){var m=MochiKit.Base;var elements=m.extend(null,arguments,1);MochiKit.Iter.forEach(m.filter(null,m.map(MochiKit.DOM.getElement,elements)),function(element){element.style.display=display;});},scrapeText:function(node,asArray){var rval=[];(function(node){var cn=node.childNodes;if(cn){for(var i=0;i<cn.length;i++){arguments.callee.call(this,cn[i]);}}
var nodeValue=node.nodeValue;if(typeof(nodeValue)=='string'){rval.push(nodeValue);}})(MochiKit.DOM.getElement(node));if(asArray){return rval;}else{return rval.join("");}},__new__:function(win){var m=MochiKit.Base;this._document=document;this._window=win;this.domConverters=new m.AdapterRegistry();var __tmpElement=this._document.createElement("span");var attributeArray;if(__tmpElement&&__tmpElement.attributes&&__tmpElement.attributes.length>0){var filter=m.filter;attributeArray=function(node){return filter(attributeArray.ignoreAttrFilter,node.attributes);};attributeArray.ignoreAttr={};MochiKit.Iter.forEach(__tmpElement.attributes,function(a){attributeArray.ignoreAttr[a.name]=a.value;});attributeArray.ignoreAttrFilter=function(a){return(attributeArray.ignoreAttr[a.name]!=a.value);};attributeArray.compliant=false;attributeArray.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor"};}else{attributeArray=function(node){return node.attributes;};attributeArray.compliant=true;attributeArray.renames={};}
this.attributeArray=attributeArray;var createDOMFunc=this.createDOMFunc;this.UL=createDOMFunc("ul");this.OL=createDOMFunc("ol");this.LI=createDOMFunc("li");this.TD=createDOMFunc("td");this.TR=createDOMFunc("tr");this.TBODY=createDOMFunc("tbody");this.THEAD=createDOMFunc("thead");this.TFOOT=createDOMFunc("tfoot");this.TABLE=createDOMFunc("table");this.TH=createDOMFunc("th");this.INPUT=createDOMFunc("input");this.SPAN=createDOMFunc("span");this.A=createDOMFunc("a");this.DIV=createDOMFunc("div");this.IMG=createDOMFunc("img");this.BUTTON=createDOMFunc("button");this.TT=createDOMFunc("tt");this.PRE=createDOMFunc("pre");this.H1=createDOMFunc("h1");this.H2=createDOMFunc("h2");this.H3=createDOMFunc("h3");this.BR=createDOMFunc("br");this.HR=createDOMFunc("hr");this.LABEL=createDOMFunc("label");this.TEXTAREA=createDOMFunc("textarea");this.FORM=createDOMFunc("form");this.P=createDOMFunc("p");this.SELECT=createDOMFunc("select");this.OPTION=createDOMFunc("option");this.OPTGROUP=createDOMFunc("optgroup");this.LEGEND=createDOMFunc("legend");this.FIELDSET=createDOMFunc("fieldset");this.STRONG=createDOMFunc("strong");this.CANVAS=createDOMFunc("canvas");this.hideElement=m.partial(this.setDisplayForElement,"none");this.showElement=m.partial(this.setDisplayForElement,"block");this.removeElement=this.swapDOM;this.$=this.getElement;this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};m.nameFunctions(this);}});MochiKit.DOM.__new__(((typeof(window)=="undefined")?this:window));if(!MochiKit.__compat__){withWindow=MochiKit.DOM.withWindow;withDocument=MochiKit.DOM.withDocument;}
MochiKit.Base._exportSymbols(this,MochiKit.DOM);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.3.1";MochiKit.Async.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]";};MochiKit.Async.toString=function(){return this.__repr__();};MochiKit.Async.Deferred=function(canceller){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=canceller;this.silentlyCancelled=false;this.chained=false;};MochiKit.Async.Deferred.prototype={repr:function(){var state;if(this.fired==-1){state='unfired';}else if(this.fired===0){state='success';}else{state='error';}
return'Deferred('+this.id+', '+state+')';},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();}},_pause:function(){this.paused++;},_unpause:function(){this.paused--;if((this.paused===0)&&(this.fired>=0)){this._fire();}},_continue:function(res){this._resback(res);this._unpause();},_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 chain=this.chain;var fired=this.fired;var res=this.results[fired];var self=this;var cb=null;while(chain.length>0&&this.paused===0){var pair=chain.shift();var f=pair[fired];if(f===null){continue;}
try{res=f(res);fired=((res instanceof Error)?1:0);if(res instanceof MochiKit.Async.Deferred){cb=function(res){self._continue(res);};this._pause();}}catch(err){fired=1;if(!(err instanceof Error)){err=new MochiKit.Async.GenericError(err);}
res=err;}}
this.fired=fired;this.results[fired]=res;if(cb&&this.paused){res.addBoth(cb);res.chained=true;}}};MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){return eval('('+arguments[0].responseText+')');},succeed:function(result){var d=new MochiKit.Async.Deferred();d.callback.apply(d,arguments);return d;},fail:function(result){var d=new MochiKit.Async.Deferred();d.errback.apply(d,arguments);return d;},getXMLHttpRequest:function(){var self=arguments.callee;if(!self.XMLHttpRequest){var tryThese=[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<tryThese.length;i++){var func=tryThese[i];try{self.XMLHttpRequest=func;return func();}catch(e){}}}
return self.XMLHttpRequest();},_nothing:function(){},_xhr_onreadystatechange:function(d){if(this.readyState==4){try{this.onreadystatechange=null;}catch(e){try{this.onreadystatechange=MochiKit.Async._nothing;}catch(e){}}
var status=null;try{status=this.status;if(!status&&MochiKit.Base.isNotEmpty(this.responseText)){status=304;}}catch(e){}
if(status==200||status==304){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.Async._nothing;}catch(e){}}
req.abort();},sendXMLHttpRequest:function(req,sendContent){if(typeof(sendContent)=="undefined"||sendContent===null){sendContent="";}
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(sendContent);}catch(e){try{req.onreadystatechange=null;}catch(ignore){}
d.errback(e);}
return d;},doSimpleXMLHttpRequest:function(url){var self=MochiKit.Async;var req=self.getXMLHttpRequest();if(arguments.length>1){var m=MochiKit.Base;var qs=m.queryString.apply(null,m.extend(null,arguments,1));if(qs){url+="?"+qs;}}
req.open("GET",url,true);return self.sendXMLHttpRequest(req);},loadJSONDoc:function(url){var self=MochiKit.Async;var d=self.doSimpleXMLHttpRequest.apply(self,arguments);d=d.addCallback(self.evalJSONRequest);return d;},wait:function(seconds,value){var d=new MochiKit.Async.Deferred();var m=MochiKit.Base;if(typeof(value)!='undefined'){d.addCallback(function(){return value;});}
var timeout=setTimeout(m.bind("callback",d),Math.floor(seconds*1000));d.canceller=function(){try{clearTimeout(timeout);}catch(e){}};return d;},callLater:function(seconds,func){var m=MochiKit.Base;var pfunc=m.partial.apply(m,m.extend(null,arguments,1));return MochiKit.Async.wait(seconds).addCallback(function(res){return pfunc();});}});MochiKit.Async.DeferredLock=function(){this.waiting=[];this.locked=false;this.id=this._nextId();};MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){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 state;if(this.locked){state='locked, '+this.waiting.length+' waiting';}else{state='unlocked';}
return'DeferredLock('+this.id+', '+state+')';},toString:MochiKit.Base.forwardCall("repr")};MochiKit.Async.DeferredList=function(list,fireOnOneCallback,fireOnOneErrback,consumeErrors,canceller){this.list=list;this.resultList=new Array(this.list.length);this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=canceller;this.silentlyCancelled=false;if(this.list.length===0&&!fireOnOneCallback){this.callback(this.resultList);}
this.finishedCount=0;this.fireOnOneCallback=fireOnOneCallback;this.fireOnOneErrback=fireOnOneErrback;this.consumeErrors=consumeErrors;var index=0;MochiKit.Base.map(MochiKit.Base.bind(function(d){d.addCallback(MochiKit.Base.bind(this._cbDeferred,this),index,true);d.addErrback(MochiKit.Base.bind(this._cbDeferred,this),index,false);index+=1;},this),this.list);};MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,MochiKit.Async.Deferred.prototype);MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,{_cbDeferred:function(index,succeeded,result){this.resultList[index]=[succeeded,result];this.finishedCount+=1;if(this.fired!==0){if(succeeded&&this.fireOnOneCallback){this.callback([index,result]);}else if(!succeeded&&this.fireOnOneErrback){this.errback(result);}else if(this.finishedCount==this.list.length){this.callback(this.resultList);}}
if(!succeeded&&this.consumeErrors){result=null;}
return result;}});MochiKit.Async.gatherResults=function(deferredList){var d=new MochiKit.Async.DeferredList(deferredList,false,true,false);d.addCallback(function(results){var ret=[];for(var i=0;i<results.length;i++){ret.push(results[i][1]);}
return ret;});return d;};MochiKit.Async.maybeDeferred=function(func){var self=MochiKit.Async;var result;try{var r=func.apply(null,MochiKit.Base.extend([],arguments,1));if(r instanceof self.Deferred){result=r;}else if(r instanceof Error){result=self.fail(r);}else{result=self.succeed(r);}}catch(e){result=self.fail(e);}
return result;};MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred"];MochiKit.Async.EXPORT_OK=["evalJSONRequest"];MochiKit.Async.__new__=function(){var m=MochiKit.Base;var ne=m.partial(m._newNamedError,this);ne("AlreadyCalledError",function(deferred){this.deferred=deferred;});ne("CancelledError",function(deferred){this.deferred=deferred;});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);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Base");}
if(typeof(MochiKit)=="undefined"){MochiKit={};}
if(typeof(MochiKit.Base)=="undefined"){MochiKit.Base={};}
MochiKit.Base.VERSION="1.3.1";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__();},counter:function(n){if(arguments.length===0){n=1;}
return function(){return n++;};},clone:function(_7){var me=arguments.callee;if(arguments.length==1){me.prototype=_7;return new me();}},flattenArguments:function(_9){var _a=[];var m=MochiKit.Base;var _c=m.extend(null,arguments);while(_c.length){var o=_c.shift();if(o&&typeof(o)=="object"&&typeof(o.length)=="number"){for(var i=o.length-1;i>=0;i--){_c.unshift(o[i]);}}else{_a.push(o);}}
return _a;},extend:function(_f,obj,_11){if(!_11){_11=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(!_f){_f=[];}
for(var i=_11;i<l;i++){_f.push(obj[i]);}}
return _f;},updatetree:function(_14,obj){if(_14===null){_14={};}
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(_14[k])=="object"&&typeof(v)=="object"){arguments.callee(_14[k],v);}else{_14[k]=v;}}}}
return _14;},setdefault:function(_1a,obj){if(_1a===null){_1a={};}
for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var k in o){if(!(k in _1a)){_1a[k]=o[k];}}}
return _1a;},keys:function(obj){var _20=[];for(var _21 in obj){_20.push(_21);}
return _20;},items:function(obj){var _23=[];var e;for(var _25 in obj){var v;try{v=obj[_25];}
catch(e){continue;}
_23.push([_25,v]);}
return _23;},_newNamedError:function(_27,_28,_29){_29.prototype=new MochiKit.Base.NamedError(_27.NAME+"."+_28);_27[_28]=_29;},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;},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(_63){return function(){return this[_63].apply(this,arguments);};},itemgetter:function(_64){return function(arg){return arg[_64];};},typeMatcher:function(){var _66={};for(var i=0;i<arguments.length;i++){var typ=arguments[i];_66[typ]=typ;}
return function(){for(var i=0;i<arguments.length;i++){if(!(typeof(arguments[i])in _66)){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"){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 _77=[];for(var i=1;i<arguments.length;i++){_77.push(fn(arguments[i]));}
return _77;},map:function(fn,lst){var m=MochiKit.Base;var itr=MochiKit.Iter;var _7d=m.isArrayLike;if(arguments.length<=2){if(!_7d(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 _7e=[];for(var i=0;i<lst.length;i++){_7e.push(fn(lst[i]));}
return _7e;}else{if(fn===null){fn=Array;}
var _80=null;for(i=1;i<arguments.length;i++){if(!_7d(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(_80===null||_80>l){_80=l;}}
_7e=[];for(i=0;i<_80;i++){var _82=[];for(var j=1;j<arguments.length;j++){_82.push(arguments[j][i]);}
_7e.push(fn.apply(this,_82));}
return _7e;}},xfilter:function(fn){var _85=[];if(fn===null){fn=MochiKit.Base.operator.truth;}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(fn(o)){_85.push(o);}}
return _85;},filter:function(fn,lst,_8a){var _8b=[];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,_8a);}else{if(typeof(_8a)=="undefined"||_8a===null){for(var i=0;i<lst.length;i++){var o=lst[i];if(fn(o)){_8b.push(o);}}}else{for(i=0;i<lst.length;i++){o=lst[i];if(fn.call(_8a,o)){_8b.push(o);}}}}
return _8b;},_wrapDumbFunction:function(_8f){return function(){switch(arguments.length){case 0:return _8f();case 1:return _8f(arguments[0]);case 2:return _8f(arguments[0],arguments[1]);case 3:return _8f(arguments[0],arguments[1],arguments[2]);}
var _90=[];for(var i=0;i<arguments.length;i++){_90.push("arguments["+i+"]");}
return eval("(func("+_90.join(",")+"))");};},method:function(_92,_93){var m=MochiKit.Base;return m.bind.apply(this,m.extend([_93,_92],arguments,2));},bind:function(_95,_96){if(typeof(_95)=="string"){_95=_96[_95];}
var _97=_95.im_func;var _98=_95.im_preargs;var _99=_95.im_self;var m=MochiKit.Base;if(typeof(_95)=="function"&&typeof(_95.apply)=="undefined"){_95=m._wrapDumbFunction(_95);}
if(typeof(_97)!="function"){_97=_95;}
if(typeof(_96)!="undefined"){_99=_96;}
if(typeof(_98)=="undefined"){_98=[];}else{_98=_98.slice();}
m.extend(_98,arguments,2);var _9b=function(){var _9c=arguments;var me=arguments.callee;if(me.im_preargs.length>0){_9c=m.concat(me.im_preargs,_9c);}
var _9e=me.im_self;if(!_9e){_9e=this;}
return me.im_func.apply(_9e,_9c);};_9b.im_self=_99;_9b.im_func=_97;_9b.im_preargs=_98;return _9b;},bindMethods:function(_9f){var _a0=MochiKit.Base.bind;for(var k in _9f){var _a2=_9f[k];if(typeof(_a2)=="function"){_9f[k]=_a0(_a2,_9f);}}},registerComparator:function(_a3,_a4,_a5,_a6){MochiKit.Base.comparatorRegistry.register(_a3,_a4,_a5,_a6);},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){if(a==b){return 0;}
var _a9=(typeof(a)=="undefined"||a===null);var _aa=(typeof(b)=="undefined"||b===null);if(_a9&&_aa){return 0;}else{if(_a9){return-1;}else{if(_aa){return 1;}}}
var m=MochiKit.Base;var _ac=m._primitives;if(!(typeof(a)in _ac&&typeof(b)in _ac)){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 _ad=m.repr;throw new TypeError(_ad(a)+" and "+_ad(b)+" can not be compared");},compareDateLike:function(a,b){return MochiKit.Base.compare(a.getTime(),b.getTime());},compareArrayLike:function(a,b){var _b2=MochiKit.Base.compare;var _b3=a.length;var _b4=0;if(_b3>b.length){_b4=1;_b3=b.length;}else{if(_b3<b.length){_b4=-1;}}
for(var i=0;i<_b3;i++){var cmp=_b2(a[i],b[i]);if(cmp){return cmp;}}
return _b4;},registerRepr:function(_b7,_b8,_b9,_ba){MochiKit.Base.reprRegistry.register(_b7,_b8,_b9,_ba);},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 _bc=(o+"");}
catch(e){return"["+typeof(o)+"]";}
if(typeof(o)=="function"){o=_bc.replace(/^\s+/,"");var idx=o.indexOf("{");if(idx!=-1){o=o.substr(0,idx)+"{...}";}}
return _bc;},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(_c2,_c3,_c4,_c5){MochiKit.Base.jsonRegistry.register(_c2,_c3,_c4,_c5);},evalJSON:function(){return eval("("+arguments[0]+")");},serializeJSON:function(o){var _c7=typeof(o);if(_c7=="undefined"){return"undefined";}else{if(_c7=="number"||_c7=="boolean"){return o+"";}else{if(o===null){return"null";}}}
var m=MochiKit.Base;var _c9=m.reprString;if(_c7=="string"){return _c9(o);}
var me=arguments.callee;var _cb;if(typeof(o.__json__)=="function"){_cb=o.__json__();if(o!==_cb){return me(_cb);}}
if(typeof(o.json)=="function"){_cb=o.json();if(o!==_cb){return me(_cb);}}
if(_c7!="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{_cb=m.jsonRegistry.match(o);return me(_cb);}
catch(e){if(e!=m.NotFound){throw e;}}
if(_c7=="function"){return null;}
res=[];for(var k in o){var _d0;if(typeof(k)=="number"){_d0="\""+k+"\"";}else{if(typeof(k)=="string"){_d0=_c9(k);}else{continue;}}
val=me(o[k]);if(typeof(val)!="string"){continue;}
res.push(_d0+":"+val);}
return"{"+res.join(", ")+"}";},objEqual:function(a,b){return(MochiKit.Base.compare(a,b)===0);},arrayEqual:function(_d3,arr){if(_d3.length!=arr.length){return false;}
return(MochiKit.Base.compare(_d3,arr)===0);},concat:function(){var _d5=[];var _d6=MochiKit.Base.extend;for(var i=0;i<arguments.length;i++){_d6(_d5,arguments[i]);}
return _d5;},keyComparator:function(key){var m=MochiKit.Base;var _da=m.compare;if(arguments.length==1){return function(a,b){return _da(a[key],b[key]);};}
var _dd=m.extend(null,arguments);return function(a,b){var _e0=0;for(var i=0;(_e0===0)&&(i<_dd.length);i++){var key=_dd[i];_e0=_da(a[key],b[key]);}
return _e0;};},reverseKeyComparator:function(key){var _e4=MochiKit.Base.keyComparator.apply(this,arguments);return function(a,b){return _e4(b,a);};},partial:function(_e7){var m=MochiKit.Base;return m.bind.apply(this,m.extend([_e7,undefined],arguments,1));},listMinMax:function(_e9,lst){if(lst.length===0){return null;}
var cur=lst[0];var _ec=MochiKit.Base.compare;for(var i=1;i<lst.length;i++){var o=lst[i];if(_ec(o,cur)==_e9){cur=o;}}
return cur;},objMax:function(){return MochiKit.Base.listMinMax(1,arguments);},objMin:function(){return MochiKit.Base.listMinMax(-1,arguments);},findIdentical:function(lst,_f0,_f1,end){if(typeof(end)=="undefined"||end===null){end=lst.length;}
for(var i=(_f1||0);i<end;i++){if(lst[i]===_f0){return i;}}
return-1;},findValue:function(lst,_f5,_f6,end){if(typeof(end)=="undefined"||end===null){end=lst.length;}
var cmp=MochiKit.Base.compare;for(var i=(_f6||0);i<end;i++){if(cmp(lst[i],_f5)===0){return i;}}
return-1;},nodeWalk:function(_fa,_fb){var _fc=[_fa];var _fd=MochiKit.Base.extend;while(_fc.length){var res=_fb(_fc.shift());if(res){_fd(_fc,res);}}},nameFunctions:function(_ff){var base=_ff.NAME;if(typeof(base)=="undefined"){base="";}else{base=base+".";}
for(var name in _ff){var o=_ff[name];if(typeof(o)=="function"&&typeof(o.NAME)=="undefined"){try{o.NAME=base+name;}
catch(e){}}}},queryString:function(_103,_104){if(typeof(MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof(_103)=="string"||(typeof(_103.nodeType)!="undefined"&&_103.nodeType>0))){var kv=MochiKit.DOM.formContents(_103);_103=kv[0];_104=kv[1];}else{if(arguments.length==1){var o=_103;_103=[];_104=[];for(var k in o){var v=o[k];if(typeof(v)!="function"){_103.push(k);_104.push(v);}}}}
var rval=[];var len=Math.min(_103.length,_104.length);var _10b=MochiKit.Base.urlEncode;for(var i=0;i<len;i++){v=_104[i];if(typeof(v)!="undefined"&&v!==null){rval.push(_10b(_103[i])+"="+_10b(v));}}
return rval.join("&");},parseQueryString:function(_10d,_10e){var _10f=_10d.replace(/\+/g,"%20").split("&");var o={};var _111;if(typeof(decodeURIComponent)!="undefined"){_111=decodeURIComponent;}else{_111=unescape;}
if(_10e){for(var i=0;i<_10f.length;i++){var pair=_10f[i].split("=");var name=_111(pair[0]);var arr=o[name];if(!(arr instanceof Array)){arr=[];o[name]=arr;}
arr.push(_111(pair[1]));}}else{for(i=0;i<_10f.length;i++){pair=_10f[i].split("=");o[_111(pair[0])]=_111(pair[1]);}}
return o;}});MochiKit.Base.AdapterRegistry=function(){this.pairs=[];};MochiKit.Base.AdapterRegistry.prototype={register:function(name,_117,wrap,_119){if(_119){this.pairs.unshift([name,_117,wrap]);}else{this.pairs.push([name,_117,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=["counter","clone","extend","update","updatetree","setdefault","keys","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","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"];MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];MochiKit.Base._exportSymbols=function(_11f,_120){if(typeof(MochiKit.__export__)=="undefined"){MochiKit.__export__=(MochiKit.__compat__||(typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined"));}
if(!MochiKit.__export__){return;}
var all=_120.EXPORT_TAGS[":all"];for(var i=0;i<all.length;i++){_11f[all[i]]=_120[all[i]];}};MochiKit.Base.__new__=function(){var m=this;m.forward=m.forwardCall;m.find=m.findValue;if(typeof(encodeURIComponent)!="undefined"){m.urlEncode=function(_124){return encodeURIComponent(_124).replace(/\'/g,"%27");};}else{m.urlEncode=function(_125){return escape(_125).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.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.__compat__){compare=MochiKit.Base.compare;}
MochiKit.Base._exportSymbols(this,MochiKit.Base);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Iter");dojo.require("MochiKit.Base");}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Base",[]);}
try{if(typeof(MochiKit.Base)=="undefined"){throw"";}}
catch(e){throw"MochiKit.Iter depends on MochiKit.Base!";}
if(typeof(MochiKit.Iter)=="undefined"){MochiKit.Iter={};}
MochiKit.Iter.NAME="MochiKit.Iter";MochiKit.Iter.VERSION="1.3.1";MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]";},toString:function(){return this.__repr__();},registerIteratorFactory:function(_1,_2,_3,_4){MochiKit.Iter.iteratorRegistry.register(_1,_2,_3,_4);},iter:function(_5,_6){var _7=MochiKit.Iter;if(arguments.length==2){return _7.takewhile(function(a){return a!=_6;},_5);}
if(typeof(_5.next)=="function"){return _5;}else{if(typeof(_5.iter)=="function"){return _5.iter();}}
try{return _7.iteratorRegistry.match(_5);}
catch(e){var m=MochiKit.Base;if(e==m.NotFound){e=new TypeError(typeof(_5)+": "+m.repr(_5)+" is not iterable");}
throw e;}},count:function(n){if(!n){n=0;}
var m=MochiKit.Base;return{repr:function(){return"count("+n+")";},toString:m.forwardCall("repr"),next:m.counter(n)};},cycle:function(p){var _d=MochiKit.Iter;var m=MochiKit.Base;var _f=[];var _10=_d.iter(p);return{repr:function(){return"cycle(...)";},toString:m.forwardCall("repr"),next:function(){try{var _11=_10.next();_f.push(_11);return _11;}
catch(e){if(e!=_d.StopIteration){throw e;}
if(_f.length===0){this.next=function(){throw _d.StopIteration;};}else{var i=-1;this.next=function(){i=(i+1)%_f.length;return _f[i];};}
return this.next();}}};},repeat:function(_13,n){var m=MochiKit.Base;if(typeof(n)=="undefined"){return{repr:function(){return"repeat("+m.repr(_13)+")";},toString:m.forwardCall("repr"),next:function(){return _13;}};}
return{repr:function(){return"repeat("+m.repr(_13)+", "+n+")";},toString:m.forwardCall("repr"),next:function(){if(n<=0){throw MochiKit.Iter.StopIteration;}
n-=1;return _13;}};},next:function(_16){return _16.next();},izip:function(p,q){var m=MochiKit.Base;var _1a=MochiKit.Iter.next;var _1b=m.map(iter,arguments);return{repr:function(){return"izip(...)";},toString:m.forwardCall("repr"),next:function(){return m.map(_1a,_1b);}};},ifilter:function(_1c,seq){var m=MochiKit.Base;seq=MochiKit.Iter.iter(seq);if(_1c===null){_1c=m.operator.truth;}
return{repr:function(){return"ifilter(...)";},toString:m.forwardCall("repr"),next:function(){while(true){var _1f=seq.next();if(_1c(_1f)){return _1f;}}
return undefined;}};},ifilterfalse:function(_20,seq){var m=MochiKit.Base;seq=MochiKit.Iter.iter(seq);if(_20===null){_20=m.operator.truth;}
return{repr:function(){return"ifilterfalse(...)";},toString:m.forwardCall("repr"),next:function(){while(true){var _23=seq.next();if(!_20(_23)){return _23;}}
return undefined;}};},islice:function(seq){var _25=MochiKit.Iter;var m=MochiKit.Base;seq=_25.iter(seq);var _27=0;var _28=0;var _29=1;var i=-1;if(arguments.length==2){_28=arguments[1];}else{if(arguments.length==3){_27=arguments[1];_28=arguments[2];}else{_27=arguments[1];_28=arguments[2];_29=arguments[3];}}
return{repr:function(){return"islice("+["...",_27,_28,_29].join(", ")+")";},toString:m.forwardCall("repr"),next:function(){var _2b;while(i<_27){_2b=seq.next();i++;}
if(_27>=_28){throw _25.StopIteration;}
_27+=_29;return _2b;}};},imap:function(fun,p,q){var m=MochiKit.Base;var _30=MochiKit.Iter;var _31=m.map(_30.iter,m.extend(null,arguments,1));var map=m.map;var _33=_30.next;return{repr:function(){return"imap(...)";},toString:m.forwardCall("repr"),next:function(){return fun.apply(this,map(_33,_31));}};},applymap:function(fun,seq,_36){seq=MochiKit.Iter.iter(seq);var m=MochiKit.Base;return{repr:function(){return"applymap(...)";},toString:m.forwardCall("repr"),next:function(){return fun.apply(_36,seq.next());}};},chain:function(p,q){var _3a=MochiKit.Iter;var m=MochiKit.Base;if(arguments.length==1){return _3a.iter(arguments[0]);}
var _3c=m.map(_3a.iter,arguments);return{repr:function(){return"chain(...)";},toString:m.forwardCall("repr"),next:function(){while(_3c.length>1){try{return _3c[0].next();}
catch(e){if(e!=_3a.StopIteration){throw e;}
_3c.shift();}}
if(_3c.length==1){var arg=_3c.shift();this.next=m.bind("next",arg);return this.next();}
throw _3a.StopIteration;}};},takewhile:function(_3e,seq){var _40=MochiKit.Iter;seq=_40.iter(seq);return{repr:function(){return"takewhile(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){var _41=seq.next();if(!_3e(_41)){this.next=function(){throw _40.StopIteration;};this.next();}
return _41;}};},dropwhile:function(_42,seq){seq=MochiKit.Iter.iter(seq);var m=MochiKit.Base;var _45=m.bind;return{"repr":function(){return"dropwhile(...)";},"toString":m.forwardCall("repr"),"next":function(){while(true){var _46=seq.next();if(!_42(_46)){break;}}
this.next=_45("next",seq);return _46;}};},_tee:function(_47,_48,_49){_48.pos[_47]=-1;var m=MochiKit.Base;var _4b=m.listMin;return{repr:function(){return"tee("+_47+", ...)";},toString:m.forwardCall("repr"),next:function(){var _4c;var i=_48.pos[_47];if(i==_48.max){_4c=_49.next();_48.deque.push(_4c);_48.max+=1;_48.pos[_47]+=1;}else{_4c=_48.deque[i-_48.min];_48.pos[_47]+=1;if(i==_48.min&&_4b(_48.pos)!=_48.min){_48.min+=1;_48.deque.shift();}}
return _4c;}};},tee:function(_4e,n){var _50=[];var _51={"pos":[],"deque":[],"max":-1,"min":-1};if(arguments.length==1){n=2;}
var _52=MochiKit.Iter;_4e=_52.iter(_4e);var _53=_52._tee;for(var i=0;i<n;i++){_50.push(_53(i,_51,_4e));}
return _50;},list:function(_55){var m=MochiKit.Base;if(typeof(_55.slice)=="function"){return _55.slice();}else{if(m.isArrayLike(_55)){return m.concat(_55);}}
var _57=MochiKit.Iter;_55=_57.iter(_55);var _58=[];try{while(true){_58.push(_55.next());}}
catch(e){if(e!=_57.StopIteration){throw e;}
return _58;}
return undefined;},reduce:function(fn,_5a,_5b){var i=0;var x=_5b;var _5e=MochiKit.Iter;_5a=_5e.iter(_5a);if(arguments.length<3){try{x=_5a.next();}
catch(e){if(e==_5e.StopIteration){e=new TypeError("reduce() of empty sequence with no initial value");}
throw e;}
i++;}
try{while(true){x=fn(x,_5a.next());}}
catch(e){if(e!=_5e.StopIteration){throw e;}}
return x;},range:function(){var _5f=0;var _60=0;var _61=1;if(arguments.length==1){_60=arguments[0];}else{if(arguments.length==2){_5f=arguments[0];_60=arguments[1];}else{if(arguments.length==3){_5f=arguments[0];_60=arguments[1];_61=arguments[2];}else{throw new TypeError("range() takes 1, 2, or 3 arguments!");}}}
if(_61===0){throw new TypeError("range() step must not be 0");}
return{next:function(){if((_61>0&&_5f>=_60)||(_61<0&&_5f<=_60)){throw MochiKit.Iter.StopIteration;}
var _62=_5f;_5f+=_61;return _62;},repr:function(){return"range("+[_5f,_60,_61].join(", ")+")";},toString:MochiKit.Base.forwardCall("repr")};},sum:function(_63,_64){var x=_64||0;var _66=MochiKit.Iter;_63=_66.iter(_63);try{while(true){x+=_63.next();}}
catch(e){if(e!=_66.StopIteration){throw e;}}
return x;},exhaust:function(_67){var _68=MochiKit.Iter;_67=_68.iter(_67);try{while(true){_67.next();}}
catch(e){if(e!=_68.StopIteration){throw e;}}},forEach:function(_69,_6a,_6b){var m=MochiKit.Base;if(arguments.length>2){_6a=m.bind(_6a,_6b);}
if(m.isArrayLike(_69)){try{for(var i=0;i<_69.length;i++){_6a(_69[i]);}}
catch(e){if(e!=MochiKit.Iter.StopIteration){throw e;}}}else{_6b=MochiKit.Iter;_6b.exhaust(_6b.imap(_6a,_69));}},every:function(_6e,_6f){var _70=MochiKit.Iter;try{_70.ifilterfalse(_6f,_6e).next();return false;}
catch(e){if(e!=_70.StopIteration){throw e;}
return true;}},sorted:function(_71,cmp){var _73=MochiKit.Iter.list(_71);if(arguments.length==1){cmp=MochiKit.Base.compare;}
_73.sort(cmp);return _73;},reversed:function(_74){var _75=MochiKit.Iter.list(_74);_75.reverse();return _75;},some:function(_76,_77){var _78=MochiKit.Iter;try{_78.ifilter(_77,_76).next();return true;}
catch(e){if(e!=_78.StopIteration){throw e;}
return false;}},iextend:function(lst,_7a){if(MochiKit.Base.isArrayLike(_7a)){for(var i=0;i<_7a.length;i++){lst.push(_7a[i]);}}else{var _7c=MochiKit.Iter;_7a=_7c.iter(_7a);try{while(true){lst.push(_7a.next());}}
catch(e){if(e!=_7c.StopIteration){throw e;}}}
return lst;},groupby:function(_7d,_7e){var m=MochiKit.Base;var _80=MochiKit.Iter;if(arguments.length<2){_7e=m.operator.identity;}
_7d=_80.iter(_7d);var pk=undefined;var k=undefined;var v;function fetch(){v=_7d.next();k=_7e(v);}
function eat(){var ret=v;v=undefined;return ret;}
var _85=true;return{repr:function(){return"groupby(...)";},next:function(){while(k==pk){fetch();if(_85){_85=false;break;}}
pk=k;return[k,{next:function(){if(v==undefined){fetch();}
if(k!=pk){throw _80.StopIteration;}
return eat();}}];}};},groupby_as_array:function(_86,_87){var m=MochiKit.Base;var _89=MochiKit.Iter;if(arguments.length<2){_87=m.operator.identity;}
_86=_89.iter(_86);var _8a=[];var _8b=true;var _8c;while(true){try{var _8d=_86.next();var key=_87(_8d);}
catch(e){if(e==_89.StopIteration){break;}
throw e;}
if(_8b||key!=_8c){var _8f=[];_8a.push([key,_8f]);}
_8f.push(_8d);_8b=false;_8c=key;}
return _8a;},arrayLikeIter:function(_90){var i=0;return{repr:function(){return"arrayLikeIter(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){if(i>=_90.length){throw MochiKit.Iter.StopIteration;}
return _90[i++];}};},hasIterateNext:function(_92){return(_92&&typeof(_92.iterateNext)=="function");},iterateNextIter:function(_93){return{repr:function(){return"iterateNextIter(...)";},toString:MochiKit.Base.forwardCall("repr"),next:function(){var _94=_93.iterateNext();if(_94===null||_94===undefined){throw MochiKit.Iter.StopIteration;}
return _94;}};}});MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",];MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"];MochiKit.Iter.__new__=function(){var m=MochiKit.Base;this.StopIteration=new m.NamedError("StopIteration");this.iteratorRegistry=new m.AdapterRegistry();this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter);this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter);this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};m.nameFunctions(this);};MochiKit.Iter.__new__();if(!MochiKit.__compat__){reduce=MochiKit.Iter.reduce;}
MochiKit.Base._exportSymbols(this,MochiKit.Iter);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.DOM");dojo.require("MochiKit.Iter");}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Iter",[]);}
try{if(typeof(MochiKit.Iter)=="undefined"){throw"";}}
catch(e){throw"MochiKit.DOM depends on MochiKit.Iter!";}
if(typeof(MochiKit.DOM)=="undefined"){MochiKit.DOM={};}
MochiKit.DOM.NAME="MochiKit.DOM";MochiKit.DOM.VERSION="1.3.1";MochiKit.DOM.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]";};MochiKit.DOM.toString=function(){return this.__repr__();};MochiKit.DOM.EXPORT=["formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","getNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","computedStyle","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","setDisplayForElement","hideElement","showElement","scrapeText","elementDimensions","elementPosition","setElementDimensions","setElementPosition","getViewportDimensions","setOpacity"];MochiKit.DOM.EXPORT_OK=["domConverters"];MochiKit.DOM.Dimensions=function(w,h){this.w=w;this.h=h;};MochiKit.DOM.Dimensions.prototype.repr=function(){var _3=MochiKit.Base.repr;return"{w: "+_3(this.w)+", h: "+_3(this.h)+"}";};MochiKit.DOM.Coordinates=function(x,y){this.x=x;this.y=y;};MochiKit.DOM.Coordinates.prototype.repr=function(){var _6=MochiKit.Base.repr;return"{x: "+_6(this.x)+", y: "+_6(this.y)+"}";};MochiKit.DOM.Coordinates.prototype.toString=function(){return this.repr();};MochiKit.Base.update(MochiKit.DOM,{setOpacity:function(_7,o){_7=MochiKit.DOM.getElement(_7);MochiKit.DOM.updateNodeAttributes(_7,{"style":{"opacity":o,"-moz-opacity":o,"-khtml-opacity":o,"filter":" alpha(opacity="+(o*100)+")"}});},getViewportDimensions:function(){var d=new MochiKit.DOM.Dimensions();var w=MochiKit.DOM._window;var b=MochiKit.DOM._document.body;if(w.innerWidth){d.w=w.innerWidth;d.h=w.innerHeight;}else{if(b.parentElement.clientWidth){d.w=b.parentElement.clientWidth;d.h=b.parentElement.clientHeight;}else{if(b&&b.clientWidth){d.w=b.clientWidth;d.h=b.clientHeight;}}}
return d;},elementDimensions:function(_c){var _d=MochiKit.DOM;if(typeof(_c.w)=="number"||typeof(_c.h)=="number"){return new _d.Dimensions(_c.w||0,_c.h||0);}
_c=_d.getElement(_c);if(!_c){return undefined;}
if(_d.computedStyle(_c,"display")!="none"){return new _d.Dimensions(_c.offsetWidth||0,_c.offsetHeight||0);}
var s=_c.style;var _f=s.visibility;var _10=s.position;s.visibility="hidden";s.position="absolute";s.display="";var _11=_c.offsetWidth;var _12=_c.offsetHeight;s.display="none";s.position=_10;s.visibility=_f;return new _d.Dimensions(_11,_12);},elementPosition:function(_13,_14){var _15=MochiKit.DOM;_13=_15.getElement(_13);if(!_13){return undefined;}
var c=new _15.Coordinates(0,0);if(_13.x&&_13.y){c.x+=_13.x||0;c.y+=_13.y||0;return c;}else{if(_13.parentNode===null||_15.computedStyle(_13,"display")=="none"){return undefined;}}
var box=null;var _18=null;var d=MochiKit.DOM._document;var de=d.documentElement;var b=d.body;if(_13.getBoundingClientRect){box=_13.getBoundingClientRect();c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||b.clientLeft);c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||b.clientTop);}else{if(d.getBoxObjectFor){box=d.getBoxObjectFor(_13);c.x+=box.x;c.y+=box.y;}else{if(_13.offsetParent){c.x+=_13.offsetLeft;c.y+=_13.offsetTop;_18=_13.offsetParent;if(_18!=_13){while(_18){c.x+=_18.offsetLeft;c.y+=_18.offsetTop;_18=_18.offsetParent;}}
var ua=navigator.userAgent.toLowerCase();if((typeof(opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("safari")!=-1&&_15.computedStyle(_13,"position")=="absolute")){c.x-=b.offsetLeft;c.y-=b.offsetTop;}}}}
if(typeof(_14)!="undefined"){_14=arguments.callee(_14);if(_14){c.x-=(_14.x||0);c.y-=(_14.y||0);}}
if(_13.parentNode){_18=_13.parentNode;}else{_18=null;}
while(_18&&_18.tagName!="BODY"&&_18.tagName!="HTML"){c.x-=_18.scrollLeft;c.y-=_18.scrollTop;if(_18.parentNode){_18=_18.parentNode;}else{_18=null;}}
return c;},setElementDimensions:function(_1d,_1e,_1f){_1d=MochiKit.DOM.getElement(_1d);if(typeof(_1f)=="undefined"){_1f="px";}
MochiKit.DOM.updateNodeAttributes(_1d,{"style":{"width":_1e.w+_1f,"height":_1e.h+_1f}});},setElementPosition:function(_20,_21,_22){_20=MochiKit.DOM.getElement(_20);if(typeof(_22)=="undefined"){_22="px";}
MochiKit.DOM.updateNodeAttributes(_20,{"style":{"left":_21.x+_22,"top":_21.y+_22}});},currentWindow:function(){return MochiKit.DOM._window;},currentDocument:function(){return MochiKit.DOM._document;},withWindow:function(win,_24){var _25=MochiKit.DOM;var _26=_25._document;var _27=_25._win;var _28;try{_25._window=win;_25._document=win.document;_28=_24();}
catch(e){_25._window=_27;_25._document=_26;throw e;}
_25._window=_27;_25._document=_26;return _28;},formContents:function(_29){var _2a=[];var _2b=[];var m=MochiKit.Base;var _2d=MochiKit.DOM;if(typeof(_29)=="undefined"||_29===null){_29=_2d._document;}else{_29=_2d.getElement(_29);}
m.nodeWalk(_29,function(_2e){var _2f=_2e.name;if(m.isNotEmpty(_2f)){var _30=_2e.nodeName;if(_30=="INPUT"&&(_2e.type=="radio"||_2e.type=="checkbox")&&!_2e.checked){return null;}
if(_30=="SELECT"){if(_2e.selectedIndex>=0){var opt=_2e.options[_2e.selectedIndex];_2a.push(_2f);_2b.push((opt.value)?opt.value:opt.text);return null;}
_2a.push(_2f);_2b.push("");return null;}
if(_30=="FORM"||_30=="P"||_30=="SPAN"||_30=="DIV"){return _2e.childNodes;}
_2a.push(_2f);_2b.push(_2e.value||"");return null;}
return _2e.childNodes;});return[_2a,_2b];},withDocument:function(doc,_33){var _34=MochiKit.DOM;var _35=_34._document;var _36;try{_34._document=doc;_36=_33();}
catch(e){_34._document=_35;throw e;}
_34._document=_35;return _36;},registerDOMConverter:function(_37,_38,_39,_3a){MochiKit.DOM.domConverters.register(_37,_38,_39,_3a);},coerceToDOM:function(_3b,ctx){var im=MochiKit.Iter;var _3e=MochiKit.DOM;var _3f=im.iter;var _40=im.repeat;var _41=im.imap;var _42=_3e.domConverters;var _43=_3e.coerceToDOM;var _44=MochiKit.Base.NotFound;while(true){if(typeof(_3b)=="undefined"||_3b===null){return null;}
if(typeof(_3b.nodeType)!="undefined"&&_3b.nodeType>0){return _3b;}
if(typeof(_3b)=="number"||typeof(_3b)=="boolean"){_3b=_3b.toString();}
if(typeof(_3b)=="string"){return _3e._document.createTextNode(_3b);}
if(typeof(_3b.toDOM)=="function"){_3b=_3b.toDOM(ctx);continue;}
if(typeof(_3b)=="function"){_3b=_3b(ctx);continue;}
var _45=null;try{_45=_3f(_3b);}
catch(e){}
if(_45){return _41(_43,_45,_40(ctx));}
try{_3b=_42.match(_3b,ctx);continue;}
catch(e){if(e!=_44){throw e;}}
return _3e._document.createTextNode(_3b.toString());}
return undefined;},setNodeAttribute:function(_46,_47,_48){var o={};o[_47]=_48;try{return MochiKit.DOM.updateNodeAttributes(_46,o);}
catch(e){}
return null;},getNodeAttribute:function(_4a,_4b){var _4c=MochiKit.DOM;var _4d=_4c.attributeArray.renames[_4b];_4a=_4c.getElement(_4a);try{if(_4d){return _4a[_4d];}
return _4a.getAttribute(_4b);}
catch(e){}
return null;},updateNodeAttributes:function(_4e,_4f){var _50=_4e;var _51=MochiKit.DOM;if(typeof(_4e)=="string"){_50=_51.getElement(_4e);}
if(_4f){var _52=MochiKit.Base.updatetree;if(_51.attributeArray.compliant){for(var k in _4f){var v=_4f[k];if(typeof(v)=="object"&&typeof(_50[k])=="object"){_52(_50[k],v);}else{if(k.substring(0,2)=="on"){if(typeof(v)=="string"){v=new Function(v);}
_50[k]=v;}else{_50.setAttribute(k,v);}}}}else{var _55=_51.attributeArray.renames;for(k in _4f){v=_4f[k];var _56=_55[k];if(k=="style"&&typeof(v)=="string"){_50.style.cssText=v;}else{if(typeof(_56)=="string"){_50[_56]=v;}else{if(typeof(_50[k])=="object"&&typeof(v)=="object"){_52(_50[k],v);}else{if(k.substring(0,2)=="on"){if(typeof(v)=="string"){v=new Function(v);}
_50[k]=v;}else{_50.setAttribute(k,v);}}}}}}}
return _50;},appendChildNodes:function(_57){var _58=_57;var _59=MochiKit.DOM;if(typeof(_57)=="string"){_58=_59.getElement(_57);}
var _5a=[_59.coerceToDOM(MochiKit.Base.extend(null,arguments,1),_58)];var _5b=MochiKit.Base.concat;while(_5a.length){var n=_5a.shift();if(typeof(n)=="undefined"||n===null){}else{if(typeof(n.nodeType)=="number"){_58.appendChild(n);}else{_5a=_5b(n,_5a);}}}
return _58;},replaceChildNodes:function(_5d){var _5e=_5d;var _5f=MochiKit.DOM;if(typeof(_5d)=="string"){_5e=_5f.getElement(_5d);arguments[0]=_5e;}
var _60;while((_60=_5e.firstChild)){_5e.removeChild(_60);}
if(arguments.length<2){return _5e;}else{return _5f.appendChildNodes.apply(this,arguments);}},createDOM:function(_61,_62){var _63;var _64=MochiKit.DOM;var m=MochiKit.Base;if(typeof(_62)=="string"||typeof(_62)=="number"){var _66=m.extend([_61,null],arguments,1);return arguments.callee.apply(this,_66);}
if(typeof(_61)=="string"){if(_62&&"name"in _62&&!_64.attributeArray.compliant){_61=("<"+_61+" name=\""+_64.escapeHTML(_62.name)+"\">");}
_63=_64._document.createElement(_61);}else{_63=_61;}
if(_62){_64.updateNodeAttributes(_63,_62);}
if(arguments.length<=2){return _63;}else{var _67=m.extend([_63],arguments,2);return _64.appendChildNodes.apply(this,_67);}},createDOMFunc:function(){var m=MochiKit.Base;return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments));},swapDOM:function(_69,src){var _6b=MochiKit.DOM;_69=_6b.getElement(_69);var _6c=_69.parentNode;if(src){src=_6b.getElement(src);_6c.replaceChild(src,_69);}else{_6c.removeChild(_69);}
return src;},getElement:function(id){var _6e=MochiKit.DOM;if(arguments.length==1){return((typeof(id)=="string")?_6e._document.getElementById(id):id);}else{return MochiKit.Base.map(_6e.getElement,arguments);}},computedStyle:function(_6f,_70,_71){if(arguments.length==2){_71=_70;}
var _72=MochiKit.DOM;var el=_72.getElement(_6f);var _74=_72._document;if(!el||el==_74){return undefined;}
if(el.currentStyle){return el.currentStyle[_70];}
if(typeof(_74.defaultView)=="undefined"){return undefined;}
if(_74.defaultView===null){return undefined;}
var _75=_74.defaultView.getComputedStyle(el,null);if(typeof(_75)=="undefined"||_75===null){return undefined;}
return _75.getPropertyValue(_71);},getElementsByTagAndClassName:function(_76,_77,_78){var _79=MochiKit.DOM;if(typeof(_76)=="undefined"||_76===null){_76="*";}
if(typeof(_78)=="undefined"||_78===null){_78=_79._document;}
_78=_79.getElement(_78);var _7a=(_78.getElementsByTagName(_76)||_79._document.all);if(typeof(_77)=="undefined"||_77===null){return MochiKit.Base.extend(null,_7a);}
var _7b=[];for(var i=0;i<_7a.length;i++){var _7d=_7a[i];var _7e=_7d.className.split(" ");for(var j=0;j<_7e.length;j++){if(_7e[j]==_77){_7b.push(_7d);break;}}}
return _7b;},_newCallStack:function(_80,_81){var _82=function(){var _83=arguments.callee.callStack;for(var i=0;i<_83.length;i++){if(_83[i].apply(this,arguments)===false){break;}}
if(_81){try{this[_80]=null;}
catch(e){}}};_82.callStack=[];return _82;},addToCallStack:function(_85,_86,_87,_88){var _89=MochiKit.DOM;var _8a=_85[_86];var _8b=_8a;if(!(typeof(_8a)=="function"&&typeof(_8a.callStack)=="object"&&_8a.callStack!==null)){_8b=_89._newCallStack(_86,_88);if(typeof(_8a)=="function"){_8b.callStack.push(_8a);}
_85[_86]=_8b;}
_8b.callStack.push(_87);},addLoadEvent:function(_8c){var _8d=MochiKit.DOM;_8d.addToCallStack(_8d._window,"onload",_8c,true);},focusOnLoad:function(_8e){var _8f=MochiKit.DOM;_8f.addLoadEvent(function(){_8e=_8f.getElement(_8e);if(_8e){_8e.focus();}});},setElementClass:function(_90,_91){var _92=MochiKit.DOM;var obj=_92.getElement(_90);if(_92.attributeArray.compliant){obj.setAttribute("class",_91);}else{obj.setAttribute("className",_91);}},toggleElementClass:function(_94){var _95=MochiKit.DOM;for(var i=1;i<arguments.length;i++){var obj=_95.getElement(arguments[i]);if(!_95.addElementClass(obj,_94)){_95.removeElementClass(obj,_94);}}},addElementClass:function(_98,_99){var _9a=MochiKit.DOM;var obj=_9a.getElement(_98);var cls=obj.className;if(cls.length===0){_9a.setElementClass(obj,_99);return true;}
if(cls==_99){return false;}
var _9d=obj.className.split(" ");for(var i=0;i<_9d.length;i++){if(_9d[i]==_99){return false;}}
_9a.setElementClass(obj,cls+" "+_99);return true;},removeElementClass:function(_9f,_a0){var _a1=MochiKit.DOM;var obj=_a1.getElement(_9f);var cls=obj.className;if(cls.length===0){return false;}
if(cls==_a0){_a1.setElementClass(obj,"");return true;}
var _a4=obj.className.split(" ");for(var i=0;i<_a4.length;i++){if(_a4[i]==_a0){_a4.splice(i,1);_a1.setElementClass(obj,_a4.join(" "));return true;}}
return false;},swapElementClass:function(_a6,_a7,_a8){var obj=MochiKit.DOM.getElement(_a6);var res=MochiKit.DOM.removeElementClass(obj,_a7);if(res){MochiKit.DOM.addElementClass(obj,_a8);}
return res;},hasElementClass:function(_ab,_ac){var obj=MochiKit.DOM.getElement(_ab);var _ae=obj.className.split(" ");for(var i=1;i<arguments.length;i++){var _b0=false;for(var j=0;j<_ae.length;j++){if(_ae[j]==arguments[i]){_b0=true;break;}}
if(!_b0){return false;}}
return true;},escapeHTML:function(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");},toHTML:function(dom){return MochiKit.DOM.emitHTML(dom).join("");},emitHTML:function(dom,lst){if(typeof(lst)=="undefined"||lst===null){lst=[];}
var _b6=[dom];var _b7=MochiKit.DOM;var _b8=_b7.escapeHTML;var _b9=_b7.attributeArray;while(_b6.length){dom=_b6.pop();if(typeof(dom)=="string"){lst.push(dom);}else{if(dom.nodeType==1){lst.push("<"+dom.nodeName.toLowerCase());var _ba=[];var _bb=_b9(dom);for(var i=0;i<_bb.length;i++){var a=_bb[i];_ba.push([" ",a.name,"=\"",_b8(a.value),"\""]);}
_ba.sort();for(i=0;i<_ba.length;i++){var _be=_ba[i];for(var j=0;j<_be.length;j++){lst.push(_be[j]);}}
if(dom.hasChildNodes()){lst.push(">");_b6.push("</"+dom.nodeName.toLowerCase()+">");var _c0=dom.childNodes;for(i=_c0.length-1;i>=0;i--){_b6.push(_c0[i]);}}else{lst.push("/>");}}else{if(dom.nodeType==3){lst.push(_b8(dom.nodeValue));}}}}
return lst;},setDisplayForElement:function(_c1,_c2){var m=MochiKit.Base;var _c4=m.extend(null,arguments,1);MochiKit.Iter.forEach(m.filter(null,m.map(MochiKit.DOM.getElement,_c4)),function(_c5){_c5.style.display=_c1;});},scrapeText:function(_c6,_c7){var _c8=[];(function(_c9){var cn=_c9.childNodes;if(cn){for(var i=0;i<cn.length;i++){arguments.callee.call(this,cn[i]);}}
var _cc=_c9.nodeValue;if(typeof(_cc)=="string"){_c8.push(_cc);}})(MochiKit.DOM.getElement(_c6));if(_c7){return _c8;}else{return _c8.join("");}},__new__:function(win){var m=MochiKit.Base;this._document=document;this._window=win;this.domConverters=new m.AdapterRegistry();var _cf=this._document.createElement("span");var _d0;if(_cf&&_cf.attributes&&_cf.attributes.length>0){var _d1=m.filter;_d0=function(_d2){return _d1(_d0.ignoreAttrFilter,_d2.attributes);};_d0.ignoreAttr={};MochiKit.Iter.forEach(_cf.attributes,function(a){_d0.ignoreAttr[a.name]=a.value;});_d0.ignoreAttrFilter=function(a){return(_d0.ignoreAttr[a.name]!=a.value);};_d0.compliant=false;_d0.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor"};}else{_d0=function(_d5){return _d5.attributes;};_d0.compliant=true;_d0.renames={};}
this.attributeArray=_d0;var _d6=this.createDOMFunc;this.UL=_d6("ul");this.OL=_d6("ol");this.LI=_d6("li");this.TD=_d6("td");this.TR=_d6("tr");this.TBODY=_d6("tbody");this.THEAD=_d6("thead");this.TFOOT=_d6("tfoot");this.TABLE=_d6("table");this.TH=_d6("th");this.INPUT=_d6("input");this.SPAN=_d6("span");this.A=_d6("a");this.DIV=_d6("div");this.IMG=_d6("img");this.BUTTON=_d6("button");this.TT=_d6("tt");this.PRE=_d6("pre");this.H1=_d6("h1");this.H2=_d6("h2");this.H3=_d6("h3");this.BR=_d6("br");this.HR=_d6("hr");this.LABEL=_d6("label");this.TEXTAREA=_d6("textarea");this.FORM=_d6("form");this.P=_d6("p");this.SELECT=_d6("select");this.OPTION=_d6("option");this.OPTGROUP=_d6("optgroup");this.LEGEND=_d6("legend");this.FIELDSET=_d6("fieldset");this.STRONG=_d6("strong");this.CANVAS=_d6("canvas");this.hideElement=m.partial(this.setDisplayForElement,"none");this.showElement=m.partial(this.setDisplayForElement,"block");this.removeElement=this.swapDOM;this.$=this.getElement;this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};m.nameFunctions(this);}});MochiKit.DOM.__new__(((typeof(window)=="undefined")?this:window));if(!MochiKit.__compat__){withWindow=MochiKit.DOM.withWindow;withDocument=MochiKit.DOM.withDocument;}
MochiKit.Base._exportSymbols(this,MochiKit.DOM);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.3.1";MochiKit.Async.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]";};MochiKit.Async.toString=function(){return this.__repr__();};MochiKit.Async.Deferred=function(_1){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=_1;this.silentlyCancelled=false;this.chained=false;};MochiKit.Async.Deferred.prototype={repr:function(){var _2;if(this.fired==-1){_2="unfired";}else{if(this.fired===0){_2="success";}else{_2="error";}}
return"Deferred("+this.id+", "+_2+")";},toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){var _3=MochiKit.Async;if(this.fired==-1){if(this.canceller){this.canceller(this);}else{this.silentlyCancelled=true;}
if(this.fired==-1){this.errback(new _3.CancelledError(this));}}else{if((this.fired===0)&&(this.results[0]instanceof _3.Deferred)){this.results[0].cancel();}}},_pause:function(){this.paused++;},_unpause:function(){this.paused--;if((this.paused===0)&&(this.fired>=0)){this._fire();}},_continue:function(_4){this._resback(_4);this._unpause();},_resback:function(_5){this.fired=((_5 instanceof Error)?1:0);this.results[this.fired]=_5;this._fire();},_check:function(){if(this.fired!=-1){if(!this.silentlyCancelled){throw new MochiKit.Async.AlreadyCalledError(this);}
this.silentlyCancelled=false;return;}},callback:function(_6){this._check();if(_6 instanceof MochiKit.Async.Deferred){throw new Error("Deferred instances can only be chained if they are the result of a callback");}
this._resback(_6);},errback:function(_7){this._check();var _8=MochiKit.Async;if(_7 instanceof _8.Deferred){throw new Error("Deferred instances can only be chained if they are the result of a callback");}
if(!(_7 instanceof Error)){_7=new _8.GenericError(_7);}
this._resback(_7);},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 _e=this.chain;var _f=this.fired;var res=this.results[_f];var _11=this;var cb=null;while(_e.length>0&&this.paused===0){var _13=_e.shift();var f=_13[_f];if(f===null){continue;}
try{res=f(res);_f=((res instanceof Error)?1:0);if(res instanceof MochiKit.Async.Deferred){cb=function(res){_11._continue(res);};this._pause();}}
catch(err){_f=1;if(!(err instanceof Error)){err=new MochiKit.Async.GenericError(err);}
res=err;}}
this.fired=_f;this.results[_f]=res;if(cb&&this.paused){res.addBoth(cb);res.chained=true;}}};MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){return eval("("+arguments[0].responseText+")");},succeed:function(_16){var d=new MochiKit.Async.Deferred();d.callback.apply(d,arguments);return d;},fail:function(_18){var d=new MochiKit.Async.Deferred();d.errback.apply(d,arguments);return d;},getXMLHttpRequest:function(){var _1a=arguments.callee;if(!_1a.XMLHttpRequest){var _1b=[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<_1b.length;i++){var _1d=_1b[i];try{_1a.XMLHttpRequest=_1d;return _1d();}
catch(e){}}}
return _1a.XMLHttpRequest();},_nothing:function(){},_xhr_onreadystatechange:function(d){if(this.readyState==4){try{this.onreadystatechange=null;}
catch(e){try{this.onreadystatechange=MochiKit.Async._nothing;}
catch(e){}}
var _1f=null;try{_1f=this.status;if(!_1f&&MochiKit.Base.isNotEmpty(this.responseText)){_1f=304;}}
catch(e){}
if(_1f==200||_1f==304){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.Async._nothing;}
catch(e){}}
req.abort();},sendXMLHttpRequest:function(req,_23){if(typeof(_23)=="undefined"||_23===null){_23="";}
var m=MochiKit.Base;var _25=MochiKit.Async;var d=new _25.Deferred(m.partial(_25._xhr_canceller,req));try{req.onreadystatechange=m.bind(_25._xhr_onreadystatechange,req,d);req.send(_23);}
catch(e){try{req.onreadystatechange=null;}
catch(ignore){}
d.errback(e);}
return d;},doSimpleXMLHttpRequest:function(url){var _28=MochiKit.Async;var req=_28.getXMLHttpRequest();if(arguments.length>1){var m=MochiKit.Base;var qs=m.queryString.apply(null,m.extend(null,arguments,1));if(qs){url+="?"+qs;}}
req.open("GET",url,true);return _28.sendXMLHttpRequest(req);},loadJSONDoc:function(url){var _2d=MochiKit.Async;var d=_2d.doSimpleXMLHttpRequest.apply(_2d,arguments);d=d.addCallback(_2d.evalJSONRequest);return d;},wait:function(_2f,_30){var d=new MochiKit.Async.Deferred();var m=MochiKit.Base;if(typeof(_30)!="undefined"){d.addCallback(function(){return _30;});}
var _33=setTimeout(m.bind("callback",d),Math.floor(_2f*1000));d.canceller=function(){try{clearTimeout(_33);}
catch(e){}};return d;},callLater:function(_34,_35){var m=MochiKit.Base;var _37=m.partial.apply(m,m.extend(null,arguments,1));return MochiKit.Async.wait(_34).addCallback(function(res){return _37();});}});MochiKit.Async.DeferredLock=function(){this.waiting=[];this.locked=false;this.id=this._nextId();};MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){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 _39;if(this.locked){_39="locked, "+this.waiting.length+" waiting";}else{_39="unlocked";}
return"DeferredLock("+this.id+", "+_39+")";},toString:MochiKit.Base.forwardCall("repr")};MochiKit.Async.DeferredList=function(_3a,_3b,_3c,_3d,_3e){this.list=_3a;this.resultList=new Array(this.list.length);this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=_3e;this.silentlyCancelled=false;if(this.list.length===0&&!_3b){this.callback(this.resultList);}
this.finishedCount=0;this.fireOnOneCallback=_3b;this.fireOnOneErrback=_3c;this.consumeErrors=_3d;var _3f=0;MochiKit.Base.map(MochiKit.Base.bind(function(d){d.addCallback(MochiKit.Base.bind(this._cbDeferred,this),_3f,true);d.addErrback(MochiKit.Base.bind(this._cbDeferred,this),_3f,false);_3f+=1;},this),this.list);};MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,MochiKit.Async.Deferred.prototype);MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,{_cbDeferred:function(_41,_42,_43){this.resultList[_41]=[_42,_43];this.finishedCount+=1;if(this.fired!==0){if(_42&&this.fireOnOneCallback){this.callback([_41,_43]);}else{if(!_42&&this.fireOnOneErrback){this.errback(_43);}else{if(this.finishedCount==this.list.length){this.callback(this.resultList);}}}}
if(!_42&&this.consumeErrors){_43=null;}
return _43;}});MochiKit.Async.gatherResults=function(_44){var d=new MochiKit.Async.DeferredList(_44,false,true,false);d.addCallback(function(_46){var ret=[];for(var i=0;i<_46.length;i++){ret.push(_46[i][1]);}
return ret;});return d;};MochiKit.Async.maybeDeferred=function(_49){var _4a=MochiKit.Async;var _4b;try{var r=_49.apply(null,MochiKit.Base.extend([],arguments,1));if(r instanceof _4a.Deferred){_4b=r;}else{if(r instanceof Error){_4b=_4a.fail(r);}else{_4b=_4a.succeed(r);}}}
catch(e){_4b=_4a.fail(e);}
return _4b;};MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred"];MochiKit.Async.EXPORT_OK=["evalJSONRequest"];MochiKit.Async.__new__=function(){var m=MochiKit.Base;var ne=m.partial(m._newNamedError,this);ne("AlreadyCalledError",function(_4f){this.deferred=_4f;});ne("CancelledError",function(_50){this.deferred=_50;});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 Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){},K:function(x){return x;}};var Class={create:function(){return function(){this.initialize.apply(this,arguments);};}};var Abstract=new Object();Object.extend=function(_2,_3){for(var _4 in _3){_2[_4]=_3[_4];}
return _2;};Object.extend(Object,{inspect:function(_5){try{if(_5===undefined){return"undefined";}
if(_5===null){return"null";}
return _5.inspect?_5.inspect():_5.toString();}
catch(e){if(e instanceof RangeError){return"...";}
throw e;}},keys:function(_6){var _7=[];for(var _8 in _6){_7.push(_8);}
return _7;},values:function(_9){var _a=[];for(var _b in _9){_a.push(_9[_b]);}
return _a;},clone:function(_c){return Object.extend({},_c);}});Function.prototype.bind=function(){var _d=this,args=$A(arguments),object=args.shift();return function(){return _d.apply(object,args.concat($A(arguments)));};};Function.prototype.bindAsEventListener=function(_e){var _f=this,args=$A(arguments),_e=args.shift();return function(_10){return _f.apply(_e,[(_10||window.event)].concat(args).concat($A(arguments)));};};Object.extend(Number.prototype,{toColorPart:function(){var _11=this.toString(16);if(this<16){return"0"+_11;}
return _11;},succ:function(){return this+1;},times:function(_12){$R(0,this,true).each(_12);return this;}});var Try={these:function(){var _13;for(var i=0,length=arguments.length;i<length;i++){var _15=arguments[i];try{_13=_15();break;}
catch(e){}}
return _13;}};var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize:function(_16,_17){this.callback=_16;this.frequency=_17;this.currentlyExecuting=false;this.registerCallback();},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},stop:function(){if(!this.timer){return;}
clearInterval(this.timer);this.timer=null;},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.callback(this);}
finally{this.currentlyExecuting=false;}}}};String.interpret=function(_18){return _18==null?"":String(_18);};Object.extend(String.prototype,{gsub:function(_19,_1a){var _1b="",source=this,match;_1a=arguments.callee.prepareReplacement(_1a);while(source.length>0){if(match=source.match(_19)){_1b+=source.slice(0,match.index);_1b+=String.interpret(_1a(match));source=source.slice(match.index+match[0].length);}else{_1b+=source,source="";}}
return _1b;},sub:function(_1c,_1d,_1e){_1d=this.gsub.prepareReplacement(_1d);_1e=_1e===undefined?1:_1e;return this.gsub(_1c,function(_1f){if(--_1e<0){return _1f[0];}
return _1d(_1f);});},scan:function(_20,_21){this.gsub(_20,_21);return this;},truncate:function(_22,_23){_22=_22||30;_23=_23===undefined?"...":_23;return this.length>_22?this.slice(0,_22-_23.length)+_23:this;},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"");},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");},extractScripts:function(){var _24=new RegExp(Prototype.ScriptFragment,"img");var _25=new RegExp(Prototype.ScriptFragment,"im");return(this.match(_24)||[]).map(function(_26){return(_26.match(_25)||["",""])[1];});},evalScripts:function(){return this.extractScripts().map(function(_27){return eval(_27);});},escapeHTML:function(){var div=document.createElement("div");var _29=document.createTextNode(this);div.appendChild(_29);return div.innerHTML;},unescapeHTML:function(){var div=document.createElement("div");div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(_2b,_2c){return _2b+_2c.nodeValue;}):div.childNodes[0].nodeValue):"";},toQueryParams:function(_2d){var _2e=this.strip().match(/([^?#]*)(#.*)?$/);if(!_2e){return{};}
return _2e[1].split(_2d||"&").inject({},function(_2f,_30){if((_30=_30.split("="))[0]){var _31=decodeURIComponent(_30[0]);var _32=_30[1]?decodeURIComponent(_30[1]):undefined;if(_2f[_31]!==undefined){if(_2f[_31].constructor!=Array){_2f[_31]=[_2f[_31]];}
if(_32){_2f[_31].push(_32);}}else{_2f[_31]=_32;}}
return _2f;});},toArray:function(){return this.split("");},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);},camelize:function(){var _33=this.split("-"),len=_33.length;if(len==1){return _33[0];}
var _34=this.charAt(0)=="-"?_33[0].charAt(0).toUpperCase()+_33[0].substring(1):_33[0];for(var i=1;i<len;i++){_34+=_33[i].charAt(0).toUpperCase()+_33[i].substring(1);}
return _34;},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();},dasherize:function(){return this.gsub(/_/,"-");},inspect:function(_36){var _37=this.replace(/\\/g,"\\\\");if(_36){return"\""+_37.replace(/"/g,"\\\"")+"\"";}else{return"'"+_37.replace(/'/g,"\\'")+"'";}}});String.prototype.gsub.prepareReplacement=function(_38){if(typeof _38=="function"){return _38;}
var _39=new Template(_38);return function(_3a){return _39.evaluate(_3a);};};String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize:function(_3b,_3c){this.template=_3b.toString();this.pattern=_3c||Template.Pattern;},evaluate:function(_3d){return this.template.gsub(this.pattern,function(_3e){var _3f=_3e[1];if(_3f=="\\"){return _3e[2];}
return _3f+String.interpret(_3d[_3e[3]]);});}};var $break=new Object();var $continue=new Object();var Enumerable={each:function(_40){var _41=0;try{this._each(function(_42){try{_40(_42,_41++);}
catch(e){if(e!=$continue){throw e;}}});}
catch(e){if(e!=$break){throw e;}}
return this;},eachSlice:function(_43,_44){var _45=-_43,slices=[],array=this.toArray();while((_45+=_43)<array.length){slices.push(array.slice(_45,_45+_43));}
return slices.map(_44);},all:function(_46){var _47=true;this.each(function(_48,_49){_47=_47&&!!(_46||Prototype.K)(_48,_49);if(!_47){throw $break;}});return _47;},any:function(_4a){var _4b=false;this.each(function(_4c,_4d){if(_4b=!!(_4a||Prototype.K)(_4c,_4d)){throw $break;}});return _4b;},collect:function(_4e){var _4f=[];this.each(function(_50,_51){_4f.push((_4e||Prototype.K)(_50,_51));});return _4f;},detect:function(_52){var _53;this.each(function(_54,_55){if(_52(_54,_55)){_53=_54;throw $break;}});return _53;},findAll:function(_56){var _57=[];this.each(function(_58,_59){if(_56(_58,_59)){_57.push(_58);}});return _57;},grep:function(_5a,_5b){var _5c=[];this.each(function(_5d,_5e){var _5f=_5d.toString();if(_5f.match(_5a)){_5c.push((_5b||Prototype.K)(_5d,_5e));}});return _5c;},include:function(_60){var _61=false;this.each(function(_62){if(_62==_60){_61=true;throw $break;}});return _61;},inGroupsOf:function(_63,_64){_64=_64===undefined?null:_64;return this.eachSlice(_63,function(_65){while(_65.length<_63){_65.push(_64);}
return _65;});},inject:function(_66,_67){this.each(function(_68,_69){_66=_67(_66,_68,_69);});return _66;},invoke:function(_6a){var _6b=$A(arguments).slice(1);return this.map(function(_6c){return _6c[_6a].apply(_6c,_6b);});},max:function(_6d){var _6e;this.each(function(_6f,_70){_6f=(_6d||Prototype.K)(_6f,_70);if(_6e==undefined||_6f>=_6e){_6e=_6f;}});return _6e;},min:function(_71){var _72;this.each(function(_73,_74){_73=(_71||Prototype.K)(_73,_74);if(_72==undefined||_73<_72){_72=_73;}});return _72;},partition:function(_75){var _76=[],falses=[];this.each(function(_77,_78){((_75||Prototype.K)(_77,_78)?_76:falses).push(_77);});return[_76,falses];},pluck:function(_79){var _7a=[];this.each(function(_7b,_7c){_7a.push(_7b[_79]);});return _7a;},reject:function(_7d){var _7e=[];this.each(function(_7f,_80){if(!_7d(_7f,_80)){_7e.push(_7f);}});return _7e;},sortBy:function(_81){return this.map(function(_82,_83){return{value:_82,criteria:_81(_82,_83)};}).sort(function(_84,_85){var a=_84.criteria,b=_85.criteria;return a<b?-1:a>b?1:0;}).pluck("value");},toArray:function(){return this.map();},zip:function(){var _87=Prototype.K,args=$A(arguments);if(typeof args.last()=="function"){_87=args.pop();}
var _88=[this].concat(args).map($A);return this.map(function(_89,_8a){return _87(_88.pluck(_8a));});},size:function(){return this.toArray().length;},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">";}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});var $A=Array.from=function(_8b){if(!_8b){return[];}
if(_8b.toArray){return _8b.toArray();}else{var _8c=[];for(var i=0,length=_8b.length;i<length;i++){_8c.push(_8b[i]);}
return _8c;}};Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse;}
Object.extend(Array.prototype,{_each:function(_8e){for(var i=0,length=this.length;i<length;i++){_8e(this[i]);}},clear:function(){this.length=0;return this;},first:function(){return this[0];},last:function(){return this[this.length-1];},compact:function(){return this.select(function(_90){return _90!=null;});},flatten:function(){return this.inject([],function(_91,_92){return _91.concat(_92&&_92.constructor==Array?_92.flatten():[_92]);});},without:function(){var _93=$A(arguments);return this.select(function(_94){return!_93.include(_94);});},indexOf:function(_95){for(var i=0,length=this.length;i<length;i++){if(this[i]==_95){return i;}}
return-1;},reverse:function(_97){return(_97!==false?this:this.toArray())._reverse();},reduce:function(){return this.length>1?this:this[0];},uniq:function(){return this.inject([],function(_98,_99){return _98.include(_99)?_98:_98.concat([_99]);});},clone:function(){return[].concat(this);},size:function(){return this.length;},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]";}});Array.prototype.toArray=Array.prototype.clone;function $w(_9a){_9a=_9a.strip();return _9a?_9a.split(/\s+/):[];}
if(window.opera){Array.prototype.concat=function(){var _9b=[];for(var i=0,length=this.length;i<length;i++){_9b.push(this[i]);}
for(var i=0,length=arguments.length;i<length;i++){if(arguments[i].constructor==Array){for(var j=0,arrayLength=arguments[i].length;j<arrayLength;j++){_9b.push(arguments[i][j]);}}else{_9b.push(arguments[i]);}}
return _9b;};}
var Hash=function(obj){Object.extend(this,obj||{});};Object.extend(Hash,{toQueryString:function(obj){var _a1=[];this.prototype._each.call(obj,function(_a2){if(!_a2.key){return;}
if(_a2.value&&_a2.value.constructor==Array){var _a3=_a2.value.compact();if(_a3.length<2){_a2.value=_a3.reduce();}else{key=encodeURIComponent(_a2.key);_a3.each(function(_a4){_a4=_a4!=undefined?encodeURIComponent(_a4):"";_a1.push(key+"="+encodeURIComponent(_a4));});return;}}
if(_a2.value==undefined){_a2[1]="";}
_a1.push(_a2.map(encodeURIComponent).join("="));});return _a1.join("&");}});Object.extend(Hash.prototype,Enumerable);Object.extend(Hash.prototype,{_each:function(_a5){for(var key in this){var _a7=this[key];if(_a7&&_a7==Hash.prototype[key]){continue;}
var _a8=[key,_a7];_a8.key=key;_a8.value=_a7;_a5(_a8);}},keys:function(){return this.pluck("key");},values:function(){return this.pluck("value");},merge:function(_a9){return $H(_a9).inject(this,function(_aa,_ab){_aa[_ab.key]=_ab.value;return _aa;});},remove:function(){var _ac;for(var i=0,length=arguments.length;i<length;i++){var _ae=this[arguments[i]];if(_ae!==undefined){if(_ac===undefined){_ac=_ae;}else{if(_ac.constructor!=Array){_ac=[_ac];}
_ac.push(_ae);}}
delete this[arguments[i]];}
return _ac;},toQueryString:function(){return Hash.toQueryString(this);},inspect:function(){return"#<Hash:{"+this.map(function(_af){return _af.map(Object.inspect).join(": ");}).join(", ")+"}>";}});function $H(_b0){if(_b0&&_b0.constructor==Hash){return _b0;}
return new Hash(_b0);}
ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize:function(_b1,end,_b3){this.start=_b1;this.end=end;this.exclusive=_b3;},_each:function(_b4){var _b5=this.start;while(this.include(_b5)){_b4(_b5);_b5=_b5.succ();}},include:function(_b6){if(_b6<this.start){return false;}
if(this.exclusive){return _b6<this.end;}
return _b6<=this.end;}});var $R=function(_b7,end,_b9){return new ObjectRange(_b7,end,_b9);};var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");})||false;},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(_ba){this.responders._each(_ba);},register:function(_bb){if(!this.include(_bb)){this.responders.push(_bb);}},unregister:function(_bc){this.responders=this.responders.without(_bc);},dispatch:function(_bd,_be,_bf,_c0){this.each(function(_c1){if(typeof _c1[_bd]=="function"){try{_c1[_bd].apply(_c1,[_be,_bf,_c0]);}
catch(e){}}});}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++;},onComplete:function(){Ajax.activeRequestCount--;}});Ajax.Base=function(){};Ajax.Base.prototype={setOptions:function(_c2){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};Object.extend(this.options,_c2||{});this.options.method=this.options.method.toLowerCase();if(typeof this.options.parameters=="string"){this.options.parameters=this.options.parameters.toQueryParams();}}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(url,_c4){this.transport=Ajax.getTransport();this.setOptions(_c4);this.request(url);},request:function(url){this.url=url;this.method=this.options.method;var _c6=this.options.parameters;if(!["get","post"].include(this.method)){_c6["_method"]=this.method;this.method="post";}
_c6=Hash.toQueryString(_c6);if(_c6&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){_c6+="&_=";}
if(this.method=="get"&&_c6){this.url+=(this.url.indexOf("?")>-1?"&":"?")+_c6;}
try{Ajax.Responders.dispatch("onCreate",this,this.transport);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){setTimeout(function(){this.respondToReadyState(1);}.bind(this),10);}
this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var _c7=this.method=="post"?(this.options.postBody||_c6):null;this.transport.send(_c7);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange();}}
catch(e){this.dispatchException(e);}},onStateChange:function(){var _c8=this.transport.readyState;if(_c8>1&&!((_c8==4)&&this._complete)){this.respondToReadyState(this.transport.readyState);}},setRequestHeaders:function(){var _c9={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){_c9["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){_c9["Connection"]="close";}}
if(typeof this.options.requestHeaders=="object"){var _ca=this.options.requestHeaders;if(typeof _ca.push=="function"){for(var i=0,length=_ca.length;i<length;i+=2){_c9[_ca[i]]=_ca[i+1];}}else{$H(_ca).each(function(_cc){_c9[_cc.key]=_cc.value;});}}
for(var _cd in _c9){this.transport.setRequestHeader(_cd,_c9[_cd]);}},success:function(){return!this.transport.status||(this.transport.status>=200&&this.transport.status<300);},respondToReadyState:function(_ce){var _cf=Ajax.Request.Events[_ce];var _d0=this.transport,json=this.evalJSON();if(_cf=="Complete"){try{this._complete=true;(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(_d0,json);}
catch(e){this.dispatchException(e);}
if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){this.evalResponse();}}
try{(this.options["on"+_cf]||Prototype.emptyFunction)(_d0,json);Ajax.Responders.dispatch("on"+_cf,this,_d0,json);}
catch(e){this.dispatchException(e);}
if(_cf=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction;}},getHeader:function(_d1){try{return this.transport.getResponseHeader(_d1);}
catch(e){return null;}},evalJSON:function(){try{var _d2=this.getHeader("X-JSON");return _d2?eval("("+_d2+")"):null;}
catch(e){return null;}},evalResponse:function(){try{return eval(this.transport.responseText);}
catch(e){this.dispatchException(e);}},dispatchException:function(_d3){(this.options.onException||Prototype.emptyFunction)(this,_d3);Ajax.Responders.dispatch("onException",this,_d3);}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(_d4,url,_d6){this.container={success:(_d4.success||_d4),failure:(_d4.failure||(_d4.success?null:_d4))};this.transport=Ajax.getTransport();this.setOptions(_d6);var _d7=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(_d8,_d9){this.updateContent();_d7(_d8,_d9);}).bind(this);this.request(url);},updateContent:function(){var _da=this.container[this.success()?"success":"failure"];var _db=this.transport.responseText;if(!this.options.evalScripts){_db=_db.stripScripts();}
if(_da=$(_da)){if(this.options.insertion){new this.options.insertion(_da,_db);}else{_da.update(_db);}}
if(this.success()){if(this.onComplete){setTimeout(this.onComplete.bind(this),10);}}}});Ajax.PeriodicalUpdater=Class.create();Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(_dc,url,_de){this.setOptions(_de);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=_dc;this.url=url;this.start();},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent();},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments);},updateComplete:function(_df){if(this.options.decay){this.decay=(_df.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=_df.responseText;}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options);}});function $(_e0){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++){elements.push($(arguments[i]));}
return elements;}
if(typeof _e0=="string"){_e0=document.getElementById(_e0);}
return Element.extend(_e0);}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(_e2,_e3){var _e4=[];var _e5=document.evaluate(_e2,$(_e3)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=_e5.snapshotLength;i<length;i++){_e4.push(_e5.snapshotItem(i));}
return _e4;};}
document.getElementsByClassName=function(_e7,_e8){if(Prototype.BrowserFeatures.XPath){var q=".//*[contains(concat(' ', @class, ' '), ' "+_e7+" ')]";return document._getElementsByXPath(q,_e8);}else{var _ea=($(_e8)||document.body).getElementsByTagName("*");var _eb=[],child;for(var i=0,length=_ea.length;i<length;i++){child=_ea[i];if(Element.hasClassName(child,_e7)){_eb.push(Element.extend(child));}}
return _eb;}};if(!window.Element){var Element=new Object();}
Element.extend=function(_ed){if(!_ed||_nativeExtensions||_ed.nodeType==3){return _ed;}
if(!_ed._extended&&_ed.tagName&&_ed!=window){var _ee=Object.clone(Element.Methods),cache=Element.extend.cache;if(_ed.tagName=="FORM"){Object.extend(_ee,Form.Methods);}
if(["INPUT","TEXTAREA","SELECT"].include(_ed.tagName)){Object.extend(_ee,Form.Element.Methods);}
Object.extend(_ee,Element.Methods.Simulated);for(var _ef in _ee){var _f0=_ee[_ef];if(typeof _f0=="function"&&!(_ef in _ed)){_ed[_ef]=cache.findOrStore(_f0);}}}
_ed._extended=true;return _ed;};Element.extend.cache={findOrStore:function(_f1){return this[_f1]=this[_f1]||function(){return _f1.apply(null,[this].concat($A(arguments)));};}};Element.Methods={visible:function(_f2){return $(_f2).style.display!="none";},toggle:function(_f3){_f3=$(_f3);Element[Element.visible(_f3)?"hide":"show"](_f3);return _f3;},hide:function(_f4){$(_f4).style.display="none";return _f4;},show:function(_f5){$(_f5).style.display="";return _f5;},remove:function(_f6){_f6=$(_f6);_f6.parentNode.removeChild(_f6);return _f6;},update:function(_f7,_f8){_f8=typeof _f8=="undefined"?"":_f8.toString();$(_f7).innerHTML=_f8.stripScripts();setTimeout(function(){_f8.evalScripts();},10);return _f7;},replace:function(_f9,_fa){_f9=$(_f9);_fa=typeof _fa=="undefined"?"":_fa.toString();if(_f9.outerHTML){_f9.outerHTML=_fa.stripScripts();}else{var _fb=_f9.ownerDocument.createRange();_fb.selectNodeContents(_f9);_f9.parentNode.replaceChild(_fb.createContextualFragment(_fa.stripScripts()),_f9);}
setTimeout(function(){_fa.evalScripts();},10);return _f9;},inspect:function(_fc){_fc=$(_fc);var _fd="<"+_fc.tagName.toLowerCase();$H({"id":"id","className":"class"}).each(function(_fe){var _ff=_fe.first(),attribute=_fe.last();var _100=(_fc[_ff]||"").toString();if(_100){_fd+=" "+attribute+"="+_100.inspect(true);}});return _fd+">";},recursivelyCollect:function(_101,_102){_101=$(_101);var _103=[];while(_101=_101[_102]){if(_101.nodeType==1){_103.push(Element.extend(_101));}}
return _103;},ancestors:function(_104){return $(_104).recursivelyCollect("parentNode");},descendants:function(_105){return $A($(_105).getElementsByTagName("*"));},immediateDescendants:function(_106){if(!(_106=$(_106).firstChild)){return[];}
while(_106&&_106.nodeType!=1){_106=_106.nextSibling;}
if(_106){return[_106].concat($(_106).nextSiblings());}
return[];},previousSiblings:function(_107){return $(_107).recursivelyCollect("previousSibling");},nextSiblings:function(_108){return $(_108).recursivelyCollect("nextSibling");},siblings:function(_109){_109=$(_109);return _109.previousSiblings().reverse().concat(_109.nextSiblings());},match:function(_10a,_10b){if(typeof _10b=="string"){_10b=new Selector(_10b);}
return _10b.match($(_10a));},up:function(_10c,_10d,_10e){return Selector.findElement($(_10c).ancestors(),_10d,_10e);},down:function(_10f,_110,_111){return Selector.findElement($(_10f).descendants(),_110,_111);},previous:function(_112,_113,_114){return Selector.findElement($(_112).previousSiblings(),_113,_114);},next:function(_115,_116,_117){return Selector.findElement($(_115).nextSiblings(),_116,_117);},getElementsBySelector:function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args);},getElementsByClassName:function(_119,_11a){return document.getElementsByClassName(_11a,_119);},readAttribute:function(_11b,name){_11b=$(_11b);if(document.all&&!window.opera){var t=Element._attributeTranslations;if(t.values[name]){return t.values[name](_11b,name);}
if(t.names[name]){name=t.names[name];}
var _11e=_11b.attributes[name];if(_11e){return _11e.nodeValue;}}
return _11b.getAttribute(name);},getHeight:function(_11f){return $(_11f).getDimensions().height;},getWidth:function(_120){return $(_120).getDimensions().width;},classNames:function(_121){return new Element.ClassNames(_121);},hasClassName:function(_122,_123){if(!(_122=$(_122))){return;}
var _124=_122.className;if(_124.length==0){return false;}
if(_124==_123||_124.match(new RegExp("(^|\\s)"+_123+"(\\s|$)"))){return true;}
return false;},addClassName:function(_125,_126){if(!(_125=$(_125))){return;}
Element.classNames(_125).add(_126);return _125;},removeClassName:function(_127,_128){if(!(_127=$(_127))){return;}
Element.classNames(_127).remove(_128);return _127;},toggleClassName:function(_129,_12a){if(!(_129=$(_129))){return;}
Element.classNames(_129)[_129.hasClassName(_12a)?"remove":"add"](_12a);return _129;},observe:function(){Event.observe.apply(Event,arguments);return $A(arguments).first();},stopObserving:function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first();},cleanWhitespace:function(_12b){_12b=$(_12b);var node=_12b.firstChild;while(node){var _12d=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue)){_12b.removeChild(node);}
node=_12d;}
return _12b;},empty:function(_12e){return $(_12e).innerHTML.match(/^\s*$/);},descendantOf:function(_12f,_130){_12f=$(_12f),_130=$(_130);while(_12f=_12f.parentNode){if(_12f==_130){return true;}}
return false;},scrollTo:function(_131){_131=$(_131);var pos=Position.cumulativeOffset(_131);window.scrollTo(pos[0],pos[1]);return _131;},getStyle:function(_133,_134){_133=$(_133);if(["float","cssFloat"].include(_134)){_134=(typeof _133.style.styleFloat!="undefined"?"styleFloat":"cssFloat");}
_134=_134.camelize();var _135=_133.style[_134];if(!_135){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(_133,null);_135=css?css[_134]:null;}else{if(_133.currentStyle){_135=_133.currentStyle[_134];}}}
if((_135=="auto")&&["width","height"].include(_134)&&(_133.getStyle("display")!="none")){_135=_133["offset"+_134.capitalize()]+"px";}
if(window.opera&&["left","top","right","bottom"].include(_134)){if(Element.getStyle(_133,"position")=="static"){_135="auto";}}
if(_134=="opacity"){if(_135){return parseFloat(_135);}
if(_135=(_133.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(_135[1]){return parseFloat(_135[1])/100;}}
return 1;}
return _135=="auto"?null:_135;},setStyle:function(_137,_138){_137=$(_137);for(var name in _138){var _13a=_138[name];if(name=="opacity"){if(_13a==1){_13a=(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1;if(/MSIE/.test(navigator.userAgent)&&!window.opera){_137.style.filter=_137.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");}}else{if(_13a==""){if(/MSIE/.test(navigator.userAgent)&&!window.opera){_137.style.filter=_137.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");}}else{if(_13a<0.00001){_13a=0;}
if(/MSIE/.test(navigator.userAgent)&&!window.opera){_137.style.filter=_137.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_13a*100+")";}}}}else{if(["float","cssFloat"].include(name)){name=(typeof _137.style.styleFloat!="undefined")?"styleFloat":"cssFloat";}}
_137.style[name.camelize()]=_13a;}
return _137;},getDimensions:function(_13b){_13b=$(_13b);var _13c=$(_13b).getStyle("display");if(_13c!="none"&&_13c!=null){return{width:_13b.offsetWidth,height:_13b.offsetHeight};}
var els=_13b.style;var _13e=els.visibility;var _13f=els.position;var _140=els.display;els.visibility="hidden";els.position="absolute";els.display="block";var _141=_13b.clientWidth;var _142=_13b.clientHeight;els.display=_140;els.position=_13f;els.visibility=_13e;return{width:_141,height:_142};},makePositioned:function(_143){_143=$(_143);var pos=Element.getStyle(_143,"position");if(pos=="static"||!pos){_143._madePositioned=true;_143.style.position="relative";if(window.opera){_143.style.top=0;_143.style.left=0;}}
return _143;},undoPositioned:function(_145){_145=$(_145);if(_145._madePositioned){_145._madePositioned=undefined;_145.style.position=_145.style.top=_145.style.left=_145.style.bottom=_145.style.right="";}
return _145;},makeClipping:function(_146){_146=$(_146);if(_146._overflow){return _146;}
_146._overflow=_146.style.overflow||"auto";if((Element.getStyle(_146,"overflow")||"visible")!="hidden"){_146.style.overflow="hidden";}
return _146;},undoClipping:function(_147){_147=$(_147);if(!_147._overflow){return _147;}
_147.style.overflow=_147._overflow=="auto"?"":_147._overflow;_147._overflow=null;return _147;}};Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});Element._attributeTranslations={};Element._attributeTranslations.names={colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"};Element._attributeTranslations.values={_getAttr:function(_148,_149){return _148.getAttribute(_149,2);},_flag:function(_14a,_14b){return $(_14a).hasAttribute(_14b)?_14b:null;},style:function(_14c){return _14c.style.cssText.toLowerCase();},title:function(_14d){var node=_14d.getAttributeNode("title");return node.specified?node.nodeValue:null;}};Object.extend(Element._attributeTranslations.values,{href:Element._attributeTranslations.values._getAttr,src:Element._attributeTranslations.values._getAttr,disabled:Element._attributeTranslations.values._flag,checked:Element._attributeTranslations.values._flag,readonly:Element._attributeTranslations.values._flag,multiple:Element._attributeTranslations.values._flag});Element.Methods.Simulated={hasAttribute:function(_14f,_150){var t=Element._attributeTranslations;_150=t.names[_150]||_150;return $(_14f).getAttributeNode(_150).specified;}};if(document.all&&!window.opera){Element.Methods.update=function(_152,html){_152=$(_152);html=typeof html=="undefined"?"":html.toString();var _154=_152.tagName.toUpperCase();if(["THEAD","TBODY","TR","TD"].include(_154)){var div=document.createElement("div");switch(_154){case"THEAD":case"TBODY":div.innerHTML="<table><tbody>"+html.stripScripts()+"</tbody></table>";depth=2;break;case"TR":div.innerHTML="<table><tbody><tr>"+html.stripScripts()+"</tr></tbody></table>";depth=3;break;case"TD":div.innerHTML="<table><tbody><tr><td>"+html.stripScripts()+"</td></tr></tbody></table>";depth=4;}
$A(_152.childNodes).each(function(node){_152.removeChild(node);});depth.times(function(){div=div.firstChild;});$A(div.childNodes).each(function(node){_152.appendChild(node);});}else{_152.innerHTML=html.stripScripts();}
setTimeout(function(){html.evalScripts();},10);return _152;};}
Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){["","Form","Input","TextArea","Select"].each(function(tag){var _159="HTML"+tag+"Element";if(window[_159]){return;}
var _15a=window[_159]={};_15a.prototype=document.createElement(tag?tag.toLowerCase():"div").__proto__;});}
Element.addMethods=function(_15b){Object.extend(Element.Methods,_15b||{});function copy(_15c,_15d,_15e){_15e=_15e||false;var _15f=Element.extend.cache;for(var _160 in _15c){var _161=_15c[_160];if(!_15e||!(_160 in _15d)){_15d[_160]=_15f.findOrStore(_161);}}}
if(typeof HTMLElement!="undefined"){copy(Element.Methods,HTMLElement.prototype);copy(Element.Methods.Simulated,HTMLElement.prototype,true);copy(Form.Methods,HTMLFormElement.prototype);[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(_162){copy(Form.Element.Methods,_162.prototype);});_nativeExtensions=true;}};var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(_163){this.adjacency=_163;};Abstract.Insertion.prototype={initialize:function(_164,_165){this.element=$(_164);this.content=_165.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content);}
catch(e){var _166=this.element.tagName.toUpperCase();if(["TBODY","TR"].include(_166)){this.insertContent(this.contentFromAnonymousTable());}else{throw e;}}}else{this.range=this.element.ownerDocument.createRange();if(this.initializeRange){this.initializeRange();}
this.insertContent([this.range.createContextualFragment(this.content)]);}
setTimeout(function(){_165.evalScripts();},10);},contentFromAnonymousTable:function(){var div=document.createElement("div");div.innerHTML="<table><tbody>"+this.content+"</tbody></table>";return $A(div.childNodes[0].childNodes[0].childNodes);}};var Insertion=new Object();Insertion.Before=Class.create();Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){this.range.setStartBefore(this.element);},insertContent:function(_168){_168.each((function(_169){this.element.parentNode.insertBefore(_169,this.element);}).bind(this));}});Insertion.Top=Class.create();Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(true);},insertContent:function(_16a){_16a.reverse(false).each((function(_16b){this.element.insertBefore(_16b,this.element.firstChild);}).bind(this));}});Insertion.Bottom=Class.create();Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){this.range.selectNodeContents(this.element);this.range.collapse(this.element);},insertContent:function(_16c){_16c.each((function(_16d){this.element.appendChild(_16d);}).bind(this));}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){this.range.setStartAfter(this.element);},insertContent:function(_16e){_16e.each((function(_16f){this.element.parentNode.insertBefore(_16f,this.element.nextSibling);}).bind(this));}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(_170){this.element=$(_170);},_each:function(_171){this.element.className.split(/\s+/).select(function(name){return name.length>0;})._each(_171);},set:function(_173){this.element.className=_173;},add:function(_174){if(this.include(_174)){return;}
this.set($A(this).concat(_174).join(" "));},remove:function(_175){if(!this.include(_175)){return;}
this.set($A(this).without(_175).join(" "));},toString:function(){return $A(this).join(" ");}};Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize:function(_176){this.params={classNames:[]};this.expression=_176.toString().strip();this.parseExpression();this.compileMatcher();},parseExpression:function(){function abort(_177){throw"Parse error in selector: "+_177;}
if(this.expression==""){abort("empty expression");}
var _178=this.params,expr=this.expression,match,modifier,clause,rest;while(match=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){_178.attributes=_178.attributes||[];_178.attributes.push({name:match[2],operator:match[3],value:match[4]||match[5]||""});expr=match[1];}
if(expr=="*"){return this.params.wildcard=true;}
while(match=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){modifier=match[1],clause=match[2],rest=match[3];switch(modifier){case"#":_178.id=clause;break;case".":_178.classNames.push(clause);break;case"":case undefined:_178.tagName=clause.toUpperCase();break;default:abort(expr.inspect());}
expr=rest;}
if(expr.length>0){abort(expr.inspect());}},buildMatchExpression:function(){var _179=this.params,conditions=[],clause;if(_179.wildcard){conditions.push("true");}
if(clause=_179.id){conditions.push("element.readAttribute(\"id\") == "+clause.inspect());}
if(clause=_179.tagName){conditions.push("element.tagName.toUpperCase() == "+clause.inspect());}
if((clause=_179.classNames).length>0){for(var i=0,length=clause.length;i<length;i++){conditions.push("element.hasClassName("+clause[i].inspect()+")");}}
if(clause=_179.attributes){clause.each(function(_17b){var _17c="element.readAttribute("+_17b.name.inspect()+")";var _17d=function(_17e){return _17c+" && "+_17c+".split("+_17e.inspect()+")";};switch(_17b.operator){case"=":conditions.push(_17c+" == "+_17b.value.inspect());break;case"~=":conditions.push(_17d(" ")+".include("+_17b.value.inspect()+")");break;case"|=":conditions.push(_17d("-")+".first().toUpperCase() == "+_17b.value.toUpperCase().inspect());break;case"!=":conditions.push(_17c+" != "+_17b.value.inspect());break;case"":case undefined:conditions.push("element.hasAttribute("+_17b.name.inspect()+")");break;default:throw"Unknown operator "+_17b.operator+" in selector";}});}
return conditions.join(" && ");},compileMatcher:function(){this.match=new Function("element","if (!element.tagName) return false;       element = $(element);       return "+this.buildMatchExpression());},findElements:function(_17f){var _180;if(_180=$(this.params.id)){if(this.match(_180)){if(!_17f||Element.childOf(_180,_17f)){return[_180];}}}
_17f=(_17f||document).getElementsByTagName(this.params.tagName||"*");var _181=[];for(var i=0,length=_17f.length;i<length;i++){if(this.match(_180=_17f[i])){_181.push(Element.extend(_180));}}
return _181;},toString:function(){return this.expression;}};Object.extend(Selector,{matchElements:function(_183,_184){var _185=new Selector(_184);return _183.select(_185.match.bind(_185)).map(Element.extend);},findElement:function(_186,_187,_188){if(typeof _187=="number"){_188=_187,_187=false;}
return Selector.matchElements(_186,_187||"*")[_188||0];},findChildElements:function(_189,_18a){return _18a.map(function(_18b){return _18b.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(_18c,expr){var _18e=new Selector(expr);return _18c.inject([],function(_18f,_190){return _18f.concat(_18e.findElements(_190||_189));});});}).flatten();}});function $$(){return Selector.findChildElements(document,$A(arguments));}
var Form={reset:function(form){$(form).reset();return form;},serializeElements:function(_192,_193){var data=_192.inject({},function(_195,_196){if(!_196.disabled&&_196.name){var key=_196.name,value=$(_196).getValue();if(value!=undefined){if(_195[key]){if(_195[key].constructor!=Array){_195[key]=[_195[key]];}
_195[key].push(value);}else{_195[key]=value;}}}
return _195;});return _193?data:Hash.toQueryString(data);}};Form.Methods={serialize:function(form,_199){return Form.serializeElements(Form.getElements(form),_199);},getElements:function(form){return $A($(form).getElementsByTagName("*")).inject([],function(_19b,_19c){if(Form.Element.Serializers[_19c.tagName.toLowerCase()]){_19b.push(Element.extend(_19c));}
return _19b;});},getInputs:function(form,_19e,name){form=$(form);var _1a0=form.getElementsByTagName("input");if(!_19e&&!name){return $A(_1a0).map(Element.extend);}
for(var i=0,matchingInputs=[],length=_1a0.length;i<length;i++){var _1a2=_1a0[i];if((_19e&&_1a2.type!=_19e)||(name&&_1a2.name!=name)){continue;}
matchingInputs.push(Element.extend(_1a2));}
return matchingInputs;},disable:function(form){form=$(form);form.getElements().each(function(_1a4){_1a4.blur();_1a4.disabled="true";});return form;},enable:function(form){form=$(form);form.getElements().each(function(_1a6){_1a6.disabled="";});return form;},findFirstElement:function(form){return $(form).getElements().find(function(_1a8){return _1a8.type!="hidden"&&!_1a8.disabled&&["input","select","textarea"].include(_1a8.tagName.toLowerCase());});},focusFirstElement:function(form){form=$(form);form.findFirstElement().activate();return form;}};Object.extend(Form,Form.Methods);Form.Element={focus:function(_1aa){$(_1aa).focus();return _1aa;},select:function(_1ab){$(_1ab).select();return _1ab;}};Form.Element.Methods={serialize:function(_1ac){_1ac=$(_1ac);if(!_1ac.disabled&&_1ac.name){var _1ad=_1ac.getValue();if(_1ad!=undefined){var pair={};pair[_1ac.name]=_1ad;return Hash.toQueryString(pair);}}
return"";},getValue:function(_1af){_1af=$(_1af);var _1b0=_1af.tagName.toLowerCase();return Form.Element.Serializers[_1b0](_1af);},clear:function(_1b1){$(_1b1).value="";return _1b1;},present:function(_1b2){return $(_1b2).value!="";},activate:function(_1b3){_1b3=$(_1b3);_1b3.focus();if(_1b3.select&&(_1b3.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(_1b3.type))){_1b3.select();}
return _1b3;},disable:function(_1b4){_1b4=$(_1b4);_1b4.disabled=true;return _1b4;},enable:function(_1b5){_1b5=$(_1b5);_1b5.blur();_1b5.disabled=false;return _1b5;}};Object.extend(Form.Element,Form.Element.Methods);var Field=Form.Element;var $F=Form.Element.getValue;Form.Element.Serializers={input:function(_1b6){switch(_1b6.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(_1b6);default:return Form.Element.Serializers.textarea(_1b6);}},inputSelector:function(_1b7){return _1b7.checked?_1b7.value:null;},textarea:function(_1b8){return _1b8.value;},select:function(_1b9){return this[_1b9.type=="select-one"?"selectOne":"selectMany"](_1b9);},selectOne:function(_1ba){var _1bb=_1ba.selectedIndex;return _1bb>=0?this.optionValue(_1ba.options[_1bb]):null;},selectMany:function(_1bc){var _1bd,length=_1bc.length;if(!length){return null;}
for(var i=0,_1bd=[];i<length;i++){var opt=_1bc.options[i];if(opt.selected){_1bd.push(this.optionValue(opt));}}
return _1bd;},optionValue:function(opt){return Element.extend(opt).hasAttribute("value")?opt.value:opt.text;}};Abstract.TimedObserver=function(){};Abstract.TimedObserver.prototype={initialize:function(_1c1,_1c2,_1c3){this.frequency=_1c2;this.element=$(_1c1);this.callback=_1c3;this.lastValue=this.getValue();this.registerCallback();},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1000);},onTimerEvent:function(){var _1c4=this.getValue();var _1c5=("string"==typeof this.lastValue&&"string"==typeof _1c4?this.lastValue!=_1c4:String(this.lastValue)!=String(_1c4));if(_1c5){this.callback(this.element,_1c4);this.lastValue=_1c4;}}};Form.Element.Observer=Class.create();Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.Observer=Class.create();Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){return Form.serialize(this.element);}});Abstract.EventObserver=function(){};Abstract.EventObserver.prototype={initialize:function(_1c6,_1c7){this.element=$(_1c6);this.callback=_1c7;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks();}else{this.registerCallback(this.element);}},onElementEvent:function(){var _1c8=this.getValue();if(this.lastValue!=_1c8){this.callback(this.element,_1c8);this.lastValue=_1c8;}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback.bind(this));},registerCallback:function(_1c9){if(_1c9.type){switch(_1c9.type.toLowerCase()){case"checkbox":case"radio":Event.observe(_1c9,"click",this.onElementEvent.bind(this));break;default:Event.observe(_1c9,"change",this.onElementEvent.bind(this));break;}}}};Form.Element.EventObserver=Class.create();Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.Element.getValue(this.element);}});Form.EventObserver=Class.create();Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){return Form.serialize(this.element);}});if(!window.Event){var Event=new Object();}
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(_1ca){return _1ca.target||_1ca.srcElement;},isLeftClick:function(_1cb){return(((_1cb.which)&&(_1cb.which==1))||((_1cb.button)&&(_1cb.button==1)));},pointerX:function(_1cc){return _1cc.pageX||(_1cc.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));},pointerY:function(_1cd){return _1cd.pageY||(_1cd.clientY+(document.documentElement.scrollTop||document.body.scrollTop));},stop:function(_1ce){if(_1ce.preventDefault){_1ce.preventDefault();_1ce.stopPropagation();}else{_1ce.returnValue=false;_1ce.cancelBubble=true;}},findElement:function(_1cf,_1d0){var _1d1=Event.element(_1cf);while(_1d1.parentNode&&(!_1d1.tagName||(_1d1.tagName.toUpperCase()!=_1d0.toUpperCase()))){_1d1=_1d1.parentNode;}
return _1d1;},observers:false,_observeAndCache:function(_1d2,name,_1d4,_1d5){if(!this.observers){this.observers=[];}
if(_1d2.addEventListener){this.observers.push([_1d2,name,_1d4,_1d5]);_1d2.addEventListener(name,_1d4,_1d5);}else{if(_1d2.attachEvent){this.observers.push([_1d2,name,_1d4,_1d5]);_1d2.attachEvent("on"+name,_1d4);}}},unloadCache:function(){if(!Event.observers){return;}
for(var i=0,length=Event.observers.length;i<length;i++){Event.stopObserving.apply(this,Event.observers[i]);Event.observers[i][0]=null;}
Event.observers=false;},observe:function(_1d7,name,_1d9,_1da){_1d7=$(_1d7);_1da=_1da||false;if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_1d7.attachEvent)){name="keydown";}
Event._observeAndCache(_1d7,name,_1d9,_1da);},stopObserving:function(_1db,name,_1dd,_1de){_1db=$(_1db);_1de=_1de||false;if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_1db.detachEvent)){name="keydown";}
if(_1db.removeEventListener){_1db.removeEventListener(name,_1dd,_1de);}else{if(_1db.detachEvent){try{_1db.detachEvent("on"+name,_1dd);}
catch(e){}}}}});if(navigator.appVersion.match(/\bMSIE\b/)){Event.observe(window,"unload",Event.unloadCache,false);}
var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;},realOffset:function(_1df){var _1e0=0,valueL=0;do{_1e0+=_1df.scrollTop||0;valueL+=_1df.scrollLeft||0;_1df=_1df.parentNode;}while(_1df);return[valueL,_1e0];},cumulativeOffset:function(_1e1){var _1e2=0,valueL=0;do{_1e2+=_1e1.offsetTop||0;valueL+=_1e1.offsetLeft||0;_1e1=_1e1.offsetParent;}while(_1e1);return[valueL,_1e2];},positionedOffset:function(_1e3){var _1e4=0,valueL=0;do{_1e4+=_1e3.offsetTop||0;valueL+=_1e3.offsetLeft||0;_1e3=_1e3.offsetParent;if(_1e3){if(_1e3.tagName=="BODY"){break;}
var p=Element.getStyle(_1e3,"position");if(p=="relative"||p=="absolute"){break;}}}while(_1e3);return[valueL,_1e4];},offsetParent:function(_1e6){if(_1e6.offsetParent){return _1e6.offsetParent;}
if(_1e6==document.body){return _1e6;}
while((_1e6=_1e6.parentNode)&&_1e6!=document.body){if(Element.getStyle(_1e6,"position")!="static"){return _1e6;}}
return document.body;},within:function(_1e7,x,y){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(_1e7,x,y);}
this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(_1e7);return(y>=this.offset[1]&&y<this.offset[1]+_1e7.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_1e7.offsetWidth);},withinIncludingScrolloffsets:function(_1ea,x,y){var _1ed=this.realOffset(_1ea);this.xcomp=x+_1ed[0]-this.deltaX;this.ycomp=y+_1ed[1]-this.deltaY;this.offset=this.cumulativeOffset(_1ea);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_1ea.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_1ea.offsetWidth);},overlap:function(mode,_1ef){if(!mode){return 0;}
if(mode=="vertical"){return((this.offset[1]+_1ef.offsetHeight)-this.ycomp)/_1ef.offsetHeight;}
if(mode=="horizontal"){return((this.offset[0]+_1ef.offsetWidth)-this.xcomp)/_1ef.offsetWidth;}},page:function(_1f0){var _1f1=0,valueL=0;var _1f2=_1f0;do{_1f1+=_1f2.offsetTop||0;valueL+=_1f2.offsetLeft||0;if(_1f2.offsetParent==document.body){if(Element.getStyle(_1f2,"position")=="absolute"){break;}}}while(_1f2=_1f2.offsetParent);_1f2=_1f0;do{if(!window.opera||_1f2.tagName=="BODY"){_1f1-=_1f2.scrollTop||0;valueL-=_1f2.scrollLeft||0;}}while(_1f2=_1f2.parentNode);return[valueL,_1f1];},clone:function(_1f3,_1f4){var _1f5=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});_1f3=$(_1f3);var p=Position.page(_1f3);_1f4=$(_1f4);var _1f7=[0,0];var _1f8=null;if(Element.getStyle(_1f4,"position")=="absolute"){_1f8=Position.offsetParent(_1f4);_1f7=Position.page(_1f8);}
if(_1f8==document.body){_1f7[0]-=document.body.offsetLeft;_1f7[1]-=document.body.offsetTop;}
if(_1f5.setLeft){_1f4.style.left=(p[0]-_1f7[0]+_1f5.offsetLeft)+"px";}
if(_1f5.setTop){_1f4.style.top=(p[1]-_1f7[1]+_1f5.offsetTop)+"px";}
if(_1f5.setWidth){_1f4.style.width=_1f3.offsetWidth+"px";}
if(_1f5.setHeight){_1f4.style.height=_1f3.offsetHeight+"px";}},absolutize:function(_1f9){_1f9=$(_1f9);if(_1f9.style.position=="absolute"){return;}
Position.prepare();var _1fa=Position.positionedOffset(_1f9);var top=_1fa[1];var left=_1fa[0];var _1fd=_1f9.clientWidth;var _1fe=_1f9.clientHeight;_1f9._originalLeft=left-parseFloat(_1f9.style.left||0);_1f9._originalTop=top-parseFloat(_1f9.style.top||0);_1f9._originalWidth=_1f9.style.width;_1f9._originalHeight=_1f9.style.height;_1f9.style.position="absolute";_1f9.style.top=top+"px";_1f9.style.left=left+"px";_1f9.style.width=_1fd+"px";_1f9.style.height=_1fe+"px";},relativize:function(_1ff){_1ff=$(_1ff);if(_1ff.style.position=="relative"){return;}
Position.prepare();_1ff.style.position="relative";var top=parseFloat(_1ff.style.top||0)-(_1ff._originalTop||0);var left=parseFloat(_1ff.style.left||0)-(_1ff._originalLeft||0);_1ff.style.top=top+"px";_1ff.style.left=left+"px";_1ff.style.height=_1ff._originalHeight;_1ff.style.width=_1ff._originalWidth;}};if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(_202){var _203=0,valueL=0;do{_203+=_202.offsetTop||0;valueL+=_202.offsetLeft||0;if(_202.offsetParent==document.body){if(Element.getStyle(_202,"position")=="absolute"){break;}}
_202=_202.offsetParent;}while(_202);return[valueL,_203];};}
Element.addMethods();
