
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - ++resource++MochiKit.js - */
// http://www.naec.org.uk/portal_javascripts/++resource++MochiKit.js?original=1
if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Base")}
if(typeof(MochiKit)=="undefined"){MochiKit={}}
if(typeof(MochiKit.Base)=="undefined"){MochiKit.Base={}}
MochiKit.Base.VERSION="1.2";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()}},extend:function(_9,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(!_9){_9=[]}
for(var i=_11;i<l;i++){_9.push(obj[i])}}
return _9},updatetree:function(_13,obj){if(_13==null){_13={}}
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(_13[k])=="object"&&typeof(v)=="object"){arguments.callee(_13[k],v)}else{_13[k]=v}}}}
return _13},setdefault:function(_15,obj){if(_15==null){_15={}}
for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var k in o){if(!(k in _15)){_15[k]=o[k]}}}
return _15},keys:function(obj){var _16=[];for(var _17 in obj){_16.push(_17)}
return _16},items:function(obj){var _18=[];var e;for(var _20 in obj){var v;try{v=obj[_20]}
catch(e){continue}
_18.push([_20,v])}
return _18},_newNamedError:function(_21,_22,_23){_23.prototype=new MochiKit.Base.NamedError(_21.NAME+"."+_22);_21[_22]=_23},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}},forward:function(_26){return function(){return this[_26].apply(this,arguments)}},itemgetter:function(_27){return function(arg){return arg[_27]}},typeMatcher:function(){var _29={};for(var i=0;i<arguments.length;i++){var typ=arguments[i];_29[typ]=typ}
return function(){for(var i=0;i<arguments.length;i++){if(!(typeof(arguments[i]) in _29)){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},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"||typeof(o.getTime)!="function"){return false}}
return true},xmap:function(fn){if(fn==null){return MochiKit.Base.extend(null,arguments,1)}
var _32=[];for(var i=1;i<arguments.length;i++){_32.push(fn(arguments[i]))}
return _32},map:function(fn,lst){var m=MochiKit.Base;var _35=m.isArrayLike;if(arguments.length<=2){if(!_35(lst)){if(MochiKit.Iter){lst=MochiKit.Iter.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 _36=[];for(var i=0;i<lst.length;i++){_36.push(fn(lst[i]))}
return _36}else{if(fn==null){fn=Array}
var _37=null;for(i=1;i<arguments.length;i++){if(!_35(arguments[i])){if(MochiKit.Iter){arguments[i]=MochiKit.Iter.list(arguments[i])}else{throw new TypeError("Argument not an array-like and MochiKit.Iter not present")}}
var l=arguments[i].length;if(_37==null||_37>l){_37=l}}
_36=[];for(i=0;i<_37;i++){var _38=[];for(var j=1;j<arguments.length;j++){_38.push(arguments[j][i])}
_36.push(fn.apply(this,_38))}
return _36}},xfilter:function(fn){var _40=[];if(fn==null){fn=MochiKit.Base.operator.truth}
for(var i=1;i<arguments.length;i++){var o=arguments[i];if(fn(o)){_40.push(o)}}
return _40},filter:function(fn,lst,_41){var _42=[];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,_41)}else{if(typeof(_41)=="undefined"||_41==null){for(var i=0;i<lst.length;i++){var o=lst[i];if(fn(o)){_42.push(o)}}}else{for(i=0;i<lst.length;i++){o=lst[i];if(fn.call(_41,o)){_42.push(o)}}}}
return _42},_wrapDumbFunction:function(_43){return function(){switch(arguments.length){case 0:return _43();case 1:return _43(arguments[0]);case 2:return _43(arguments[0],arguments[1]);case 3:return _43(arguments[0],arguments[1],arguments[2])}
var _44=[];for(var i=0;i<arguments.length;i++){_44.push("arguments["+i+"]")}
return eval("(func("+_44.join(",")+"))")}},bind:function(_45,_46){if(typeof(_45)=="string"){_45=_46[_45]}
var _47=_45.im_func;var _48=_45.im_preargs;var _49=_45.im_self;var m=MochiKit.Base;if(typeof(_45)=="function"&&typeof(_45.apply)=="undefined"){_45=m._wrapDumbFunction(_45)}
if(typeof(_47)!="function"){_47=_45}
if(typeof(_46)!="undefined"){_49=_46}
if(typeof(_48)=="undefined"){_48=[]}else{_48=_48.slice()}
m.extend(_48,arguments,2);var _50=function(){var _51=arguments;var me=arguments.callee;if(me.im_preargs.length>0){_51=m.concat(me.im_preargs,_51)}
var _46=me.im_self;if(!_46){_46=this}
return me.im_func.apply(_46,_51)};_50.im_self=_49;_50.im_func=_47;_50.im_preargs=_48;return _50},bindMethods:function(_52){var _53=MochiKit.Base.bind;for(var k in _52){var _54=_52[k];if(typeof(_54)=="function"){_52[k]=_53(_54,_52)}}},registerComparator:function(_55,_56,_57,_58){MochiKit.Base.comparatorRegistry.register(_55,_56,_57,_58)},_primitives:{"bool":true,"string":true,"number":true},compare:function(a,b){if(a==b){return 0}
var _59=(typeof(a)=="undefined"||a==null);var _60=(typeof(b)=="undefined"||b==null);if(_59&&_60){return 0}else{if(_59){return-1}else{if(_60){return 1}}}
var m=MochiKit.Base;var _61=m._primitives;if(!(typeof(a) in _61&&typeof(b) in _61)){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 _62=m.repr;throw new TypeError(_62(a)+" and "+_62(b)+" can not be compared")},compareDateLike:function(a,b){return MochiKit.Base.compare(a.getTime(),b.getTime())},compareArrayLike:function(a,b){var _63=MochiKit.Base.compare;var _64=a.length;var _65=0;if(_64>b.length){_65=1;_64=b.length}else{if(_64<b.length){_65=-1}}
for(var i=0;i<_64;i++){var cmp=_63(a[i],b[i]);if(cmp){return cmp}}
return _65},registerRepr:function(_67,_68,_69,_70){MochiKit.Base.reprRegistry.register(_67,_68,_69,_70)},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 _71=(o+"")}
catch(e){return "["+typeof(o)+"]"}
if(typeof(o)=="function"){o=_71.replace(/^\s+/,"");var idx=o.indexOf("{");if(idx!=-1){o=o.substr(0,idx)+"{...}"}}
return _71},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(_73,_74,_75,_76){MochiKit.Base.jsonRegistry.register(_73,_74,_75,_76)},evalJSON:function(){return eval("("+arguments[0]+")")},serializeJSON:function(o){var _77=typeof(o);if(_77=="undefined"){return "undefined"}else{if(_77=="number"||_77=="boolean"){return o+""}else{if(o===null){return "null"}}}
var m=MochiKit.Base;var _78=m.reprString;if(_77=="string"){return _78(o)}
var me=arguments.callee;var _79;if(typeof(o.__json__)=="function"){_79=o.__json__();if(o!==_79){return me(_79)}}
if(typeof(o.json)=="function"){_79=o.json();if(o!==_79){return me(_79)}}
if(_77!="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{_79=m.jsonRegistry.match(o);return me(_79)}
catch(e){if(e!=m.NotFound){throw e}}
if(_77=="function"){return null}
res=[];for(var k in o){var _82;if(typeof(k)=="number"){_82="\""+k+"\""}else{if(typeof(k)=="string"){_82=_78(k)}else{continue}}
val=me(o[k]);if(typeof(val)!="string"){continue}
res.push(_82+":"+val)}
return "{"+res.join(", ")+"}"},objEqual:function(a,b){return(MochiKit.Base.compare(a,b)==0)},arrayEqual:function(_83,arr){if(_83.length!=arr.length){return false}
return(MochiKit.Base.compare(_83,arr)==0)},concat:function(){var _85=[];var _86=MochiKit.Base.extend;for(var i=0;i<arguments.length;i++){_86(_85,arguments[i])}
return _85},keyComparator:function(key){var m=MochiKit.Base;var _88=m.compare;if(arguments.length==1){return function(a,b){return _88(a[key],b[key])}}
var _89=m.extend(null,arguments);return function(a,b){var _90=0;for(var i=0;(_90==0)&&(i<_89.length);i++){var key=_89[i];_90=_88(a[key],b[key])}
return _90}},reverseKeyComparator:function(key){var _91=MochiKit.Base.keyComparator.apply(this,arguments);return function(a,b){return _91(b,a)}},partial:function(_92){var m=MochiKit.Base;return m.bind.apply(this,m.extend([_92,undefined],arguments,1))},listMinMax:function(_93,lst){if(lst.length==0){return null}
var cur=lst[0];var _95=MochiKit.Base.compare;for(var i=1;i<lst.length;i++){var o=lst[i];if(_95(o,cur)==_93){cur=o}}
return cur},objMax:function(){return MochiKit.Base.listMinMax(1,arguments)},objMin:function(){return MochiKit.Base.listMinMax(-1,arguments)},findIdentical:function(lst,_96,_97,end){if(typeof(end)=="undefined"||end==null){end=lst.length}
for(var i=(_97||0);i<end;i++){if(lst[i]===_96){return i}}
return-1},find:function(lst,_99,_100,end){if(typeof(end)=="undefined"||end==null){end=lst.length}
var cmp=MochiKit.Base.compare;for(var i=(_100||0);i<end;i++){if(cmp(lst[i],_99)==0){return i}}
return-1},nodeWalk:function(node,_102){var _103=[node];var _104=MochiKit.Base.extend;while(_103.length){var res=_102(_103.shift());if(res){_104(_103,res)}}},nameFunctions:function(_105){var base=_105.NAME;if(typeof(base)=="undefined"){base=""}else{base=base+"."}
for(var name in _105){var o=_105[name];if(typeof(o)=="function"&&typeof(o.NAME)=="undefined"){try{o.NAME=base+name}
catch(e){}}}},queryString:function(_108,_109){if(typeof(MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof(_108)=="string"||(typeof(_108.nodeType)!="undefined"&&_108.nodeType>0))){var kv=MochiKit.DOM.formContents(_108);_108=kv[0];_109=kv[1]}else{if(arguments.length==1){var o=_108;_108=[];_109=[];for(var k in o){var v=o[k];if(typeof(v)!="function"){_108.push(k);_109.push(v)}}}}
var rval=[];var len=Math.min(_108.length,_109.length);var _113=MochiKit.Base.urlEncode;for(var i=0;i<len;i++){v=_109[i];if(typeof(v)!="undefined"&&v!=null){rval.push(_113(_108[i])+"="+_113(v))}}
return rval.join("&")},parseQueryString:function(_114,_115){var _116=_114.replace(/\+/g,"%20").split("&");var o={};var _117;if(typeof(decodeURIComponent)!="undefined"){_117=decodeURIComponent}else{_117=unescape}
if(_115){for(var i=0;i<_116.length;i++){var pair=_116[i].split("=");var name=_117(pair[0]);var arr=o[name];if(!(arr instanceof Array)){arr=[];o[name]=arr}
arr.push(_117(pair[1]))}}else{for(i=0;i<_116.length;i++){pair=_116[i].split("=");o[_117(pair[0])]=_117(pair[1])}}
return o}});MochiKit.Base.AdapterRegistry=function(){this.pairs=[]};MochiKit.Base.AdapterRegistry.prototype={register:function(name,_119,wrap,_121){if(_121){this.pairs.unshift([name,_119,wrap])}else{this.pairs.push([name,_119,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","forward","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","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","find","findIdentical"];MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];MochiKit.Base._exportSymbols=function(_122,_123){if(typeof(MochiKit.__export__)=="undefined"){MochiKit.__export__=(MochiKit.__compat__||(typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined"))}
if(!MochiKit.__export__){return}
var all=_123.EXPORT_TAGS[":all"];for(var i=0;i<all.length;i++){_122[all[i]]=_123[all[i]]}};MochiKit.Base.__new__=function(){var m=this;if(typeof(encodeURIComponent)!="undefined"){m.urlEncode=function(_125){return encodeURIComponent(_125).replace(/\'/g,"%27")}}else{m.urlEncode=function(_126){return escape(_126).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.forward("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__();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.2";MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){return "["+this.NAME+" "+this.VERSION+"]"},toString:function(){return this.__repr__()},registerIteratorFactory:function(name,_127,_128,_129){MochiKit.Iter.iteratorRegistry.register(name,_127,_128,_129)},iter:function(_130,_131){var self=MochiKit.Iter;if(arguments.length==2){return self.takewhile(function(a){return a!=_131},_130)}
if(typeof(_130.next)=="function"){return _130}else{if(typeof(_130.iter)=="function"){return _130.iter()}}
try{return self.iteratorRegistry.match(_130)}
catch(e){var m=MochiKit.Base;if(e==m.NotFound){e=new TypeError(typeof(_130)+": "+m.repr(_130)+" is not iterable")}
throw e}},count:function(n){if(!n){n=0}
var m=MochiKit.Base;return{repr:function(){return "count("+n+")"},toString:m.forward("repr"),next:m.counter(n)}},cycle:function(p){var self=MochiKit.Iter;var m=MochiKit.Base;var lst=[];var _134=self.iter(p);return{repr:function(){return "cycle(...)"},toString:m.forward("repr"),next:function(){try{var rval=_134.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.forward("repr"),next:function(){return elem}}}
return{repr:function(){return "repeat("+m.repr(elem)+", "+n+")"},toString:m.forward("repr"),next:function(){if(n<=0){throw MochiKit.Iter.StopIteration}
n-=1;return elem}}},next:function(_136){return _136.next()},izip:function(p,q){var m=MochiKit.Base;var next=MochiKit.Iter.next;var _139=m.map(iter,arguments);return{repr:function(){return "izip(...)"},toString:m.forward("repr"),next:function(){return m.map(next,_139)}}},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.forward("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.forward("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 _142=0;var stop=0;var step=1;var i=-1;if(arguments.length==2){stop=arguments[1]}else{if(arguments.length==3){_142=arguments[1];stop=arguments[2]}else{_142=arguments[1];stop=arguments[2];step=arguments[3]}}
return{repr:function(){return "islice("+["...",_142,stop,step].join(", ")+")"},toString:m.forward("repr"),next:function(){var rval;while(i<_142){rval=seq.next();i++}
if(_142>=stop){throw self.StopIteration}
_142+=step;return rval}}},imap:function(fun,p,q){var m=MochiKit.Base;var self=MochiKit.Iter;var _146=m.map(self.iter,m.extend(null,arguments,1));var map=m.map;var next=self.next;return{repr:function(){return "imap(...)"},toString:m.forward("repr"),next:function(){return fun.apply(this,map(next,_146))}}},applymap:function(fun,seq,self){seq=MochiKit.Iter.iter(seq);var m=MochiKit.Base;return{repr:function(){return "applymap(...)"},toString:m.forward("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 _148=m.map(self.iter,arguments);return{repr:function(){return "chain(...)"},toString:m.forward("repr"),next:function(){while(_148.length>1){try{return _148[0].next()}
catch(e){if(e!=self.StopIteration){throw e}
_148.shift()}}
if(_148.length==1){var arg=_148.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.forward("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.forward("repr"),"next":function(){while(true){var rval=seq.next();if(!pred(rval)){break}}
this.next=bind("next",seq);return rval}}},_tee:function(_150,sync,_152){sync.pos[_150]=-1;var m=MochiKit.Base;var _153=m.listMin;return{repr:function(){return "tee("+_150+", ...)"},toString:m.forward("repr"),next:function(){var rval;var i=sync.pos[_150];if(i==sync.max){rval=_152.next();sync.deque.push(rval);sync.max+=1;sync.pos[_150]+=1}else{rval=sync.deque[i-sync.min];sync.pos[_150]+=1;if(i==sync.min&&_153(sync.pos)!=sync.min){sync.min+=1;sync.deque.shift()}}
return rval}}},tee:function(_154,n){var rval=[];var sync={"pos":[],"deque":[],"max":-1,"min":-1};if(arguments.length==1){n=2}
var self=MochiKit.Iter;_154=self.iter(_154);var _tee=self._tee;for(var i=0;i<n;i++){rval.push(_tee(i,sync,_154))}
return rval},list:function(_156){var m=MochiKit.Base;if(typeof(_156.slice)=="function"){return _156.slice()}else{if(m.isArrayLike(_156)){return m.concat(_156)}}
var self=MochiKit.Iter;_156=self.iter(_156);var rval=[];try{while(true){rval.push(_156.next())}}
catch(e){if(e!=self.StopIteration){throw e}
return rval}
return undefined},reduce:function(fn,_157,_158){var i=0;var x=_158;var self=MochiKit.Iter;_157=self.iter(_157);if(arguments.length<3){try{x=_157.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,_157.next())}}
catch(e){if(e!=self.StopIteration){throw e}}
return x},range:function(){var _160=0;var stop=0;var step=1;if(arguments.length==1){stop=arguments[0]}else{if(arguments.length==2){_160=arguments[0];stop=arguments[1]}else{if(arguments.length==3){_160=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&&_160>=stop)||(step<0&&_160<=stop)){throw MochiKit.Iter.StopIteration}
var rval=_160;_160+=step;return rval},repr:function(){return "range("+[_160,stop,step].join(", ")+")"},toString:MochiKit.Base.forward("repr")}},sum:function(_161,_162){var x=_162||0;var self=MochiKit.Iter;_161=self.iter(_161);try{while(true){x+=_161.next()}}
catch(e){if(e!=self.StopIteration){throw e}}
return x},exhaust:function(_163){var self=MochiKit.Iter;_163=self.iter(_163);try{while(true){_163.next()}}
catch(e){if(e!=self.StopIteration){throw e}}},forEach:function(_164,func,self){var m=MochiKit.Base;if(arguments.length>2){func=m.bind(func,self)}
if(m.isArrayLike(_164)){try{for(var i=0;i<_164.length;i++){func(_164[i])}}
catch(e){if(e!=MochiKit.Iter.StopIteration){throw e}}}else{self=MochiKit.Iter;self.exhaust(self.imap(func,_164))}},every:function(_166,func){var self=MochiKit.Iter;try{self.ifilterfalse(func,_166).next();return false}
catch(e){if(e!=self.StopIteration){throw e}
return true}},sorted:function(_167,cmp){var rval=MochiKit.Iter.list(_167);if(arguments.length==1){cmp=MochiKit.Base.compare}
rval.sort(cmp);return rval},reversed:function(_168){var rval=MochiKit.Iter.list(_168);rval.reverse();return rval},some:function(_169,func){var self=MochiKit.Iter;try{self.ifilter(func,_169).next();return true}
catch(e){if(e!=self.StopIteration){throw e}
return false}},iextend:function(lst,_170){if(MochiKit.Base.isArrayLike(_170)){for(var i=0;i<_170.length;i++){lst.push(_170[i])}}else{var self=MochiKit.Iter;_170=self.iter(_170);try{while(true){lst.push(_170.next())}}
catch(e){if(e!=self.StopIteration){throw e}}}
return lst},groupby:function(_171,_172){var m=MochiKit.Base;var self=MochiKit.Iter;if(arguments.length<2){_172=m.operator.identity}
_171=self.iter(_171);var pk=undefined;var k=undefined;var v;
function fetch(){v=_171.next();k=_172(v)}
function eat(){var ret=v;v=undefined;return ret}
var _175=true;return{repr:function(){return "groupby(...)"},next:function(){while(k==pk){fetch();if(_175){_175=false;break}}
pk=k;return [k,{next:function(){if(v==undefined){fetch()}
if(k!=pk){throw self.StopIteration}
return eat()}}]}}},groupby_as_array:function(_176,_177){var m=MochiKit.Base;var self=MochiKit.Iter;if(arguments.length<2){_177=m.operator.identity}
_176=self.iter(_176);var _178=[];var _179=true;var _180;while(true){try{var _181=_176.next();var key=_177(_181)}
catch(e){if(e==self.StopIteration){break}
throw e}
if(_179||key!=_180){var _182=[];_178.push([key,_182])}
_182.push(_181);_179=false;_180=key}
return _178},arrayLikeIter:function(_183){var i=0;return{repr:function(){return "arrayLikeIter(...)"},toString:MochiKit.Base.forward("repr"),next:function(){if(i>=_183.length){throw MochiKit.Iter.StopIteration}
return _183[i++]}}},hasIterateNext:function(_184){return(_184&&typeof(_184.iterateNext)=="function")},iterateNextIter:function(_185){return{repr:function(){return "iterateNextIter(...)"},toString:MochiKit.Base.forward("repr"),next:function(){var rval=_185.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__();reduce=MochiKit.Iter.reduce;MochiKit.Base._exportSymbols(this,MochiKit.Iter);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Logging");dojo.require("MochiKit.Base")}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Base",[])}
try{if(typeof(MochiKit.Base)=="undefined"){throw ""}}
catch(e){throw "MochiKit.Logging depends on MochiKit.Base!"}
if(typeof(MochiKit.Logging)=="undefined"){MochiKit.Logging={}}
MochiKit.Logging.NAME="MochiKit.Logging";MochiKit.Logging.VERSION="1.2";MochiKit.Logging.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.Logging.toString=function(){return this.__repr__()};MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"];MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"];MochiKit.Logging.LogMessage=function(num,_187,info){this.num=num;this.level=_187;this.info=info;this.timestamp=new Date()};MochiKit.Logging.LogMessage.prototype={repr:function(){var m=MochiKit.Base;return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"},toString:MochiKit.Base.forward("repr")};MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_189){var self=MochiKit.Logging;if(typeof(_189)=="string"){_189=self.LogLevel[_189]}
return function(msg){var _191=msg.level;if(typeof(_191)=="string"){_191=self.LogLevel[_191]}
return _191>=_189}},isLogMessage:function(){var _192=MochiKit.Logging.LogMessage;for(var i=0;i<arguments.length;i++){if(!(arguments[i] instanceof _192)){return false}}
return true},compareLogMessage:function(a,b){return MochiKit.Base.compare([a.level,a.info],[b.level,b.info])},alertListener:function(msg){alert("num: "+msg.num+"\nlevel: "+msg.level+"\ninfo: "+msg.info.join(" "))}});MochiKit.Logging.Logger=function(_193){this.counter=0;if(typeof(_193)=="undefined"||_193==null){_193=-1}
this.maxSize=_193;this._messages=[];this.listeners={}};MochiKit.Logging.Logger.prototype={clear:function(){this._messages.splice(0,this._messages.length)},dispatchListeners:function(msg){for(var k in this.listeners){var pair=this.listeners[k];if(pair.ident!=k||(pair[0]&&!pair[0](msg))){continue}
pair[1](msg)}},addListener:function(_194,_195,_196){if(typeof(_195)=="string"){_195=MochiKit.Logging.logLevelAtLeast(_195)}
var _197=[_195,_196];_197.ident=_194;this.listeners[_194]=_197},removeListener:function(_198){delete this.listeners[_198]},baseLog:function(_199,_200){var msg=new MochiKit.Logging.LogMessage(this.counter,_199,MochiKit.Base.extend(null,arguments,1));this._messages.push(msg);this.dispatchListeners(msg);this.counter+=1;while(this.maxSize>=0&&this._messages.length>this.maxSize){this._messges.shift()}},getMessages:function(_201){var _202=0;if(!(typeof(_201)=="undefined"||_201==null)){_202=Math.max(0,this._messages.length-_201)}
return this._messages.slice(_202)},getMessageText:function(_203){if(typeof(_203)=="undefined"||_203==null){_203=30}
var _204=this.getMessages(_203);if(_204.length){var lst=map(function(m){return "\n  ["+m.num+"] "+m.level+": "+m.info.join(" ")},_204);lst.unshift("LAST "+_204.length+" MESSAGES:");return lst.join("")}
return ""},debuggingBookmarklet:function(_205){if(typeof(MochiKit.LoggingPane)=="undefined"){alert(this.getMessageText())}else{MochiKit.LoggingPane.createLoggingPane(_205||false)}}};MochiKit.Logging.__new__=function(){this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10};var m=MochiKit.Base;m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage);var _206=m.partial;var _207=this.Logger;var _208=_207.prototype.baseLog;m.update(this.Logger.prototype,{debug:_206(_208,"DEBUG"),log:_206(_208,"INFO"),error:_206(_208,"ERROR"),fatal:_206(_208,"FATAL"),warning:_206(_208,"WARNING")});var self=this;var _209=function(name){return function(){self.logger[name].apply(self.logger,arguments)}};this.log=_209("log");this.logError=_209("error");this.logDebug=_209("debug");this.logFatal=_209("fatal");this.logWarning=_209("warning");this.logger=new _207();this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};m.nameFunctions(this)};MochiKit.Logging.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Logging);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.DateTime")}
if(typeof(MochiKit)=="undefined"){MochiKit={}}
if(typeof(MochiKit.DateTime)=="undefined"){MochiKit.DateTime={}}
MochiKit.DateTime.NAME="MochiKit.DateTime";MochiKit.DateTime.VERSION="1.2";MochiKit.DateTime.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.DateTime.toString=function(){return this.__repr__()};MochiKit.DateTime.isoDate=function(str){str=str+"";if(typeof(str)!="string"||str.length==0){return null}
var iso=str.split("-");if(iso.length==0){return null}
return new Date(iso[0],iso[1]-1,iso[2])};MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;MochiKit.DateTime.isoTimestamp=function(str){str=str+"";if(typeof(str)!="string"||str.length==0){return null}
var res=str.match(MochiKit.DateTime._isoRegexp);if(typeof(res)=="undefined"||res==null){return null}
var year,month,day,hour,min,sec,msec;year=parseInt(res[1],10);if(typeof(res[2])=="undefined"||res[2]==""){return new Date(year)}
month=parseInt(res[2],10)-1;day=parseInt(res[3],10);if(typeof(res[4])=="undefined"||res[4]==""){return new Date(year,month,day)}
hour=parseInt(res[4],10);min=parseInt(res[5],10);sec=(typeof(res[6])!="undefined"&&res[6]!="")?parseInt(res[6],10):0;if(typeof(res[7])!="undefined"&&res[7]!=""){msec=Math.round(1000*parseFloat("0."+res[7]))}else{msec=0}
if((typeof(res[8])=="undefined"||res[8]=="")&&(typeof(res[9])=="undefined"||res[9]=="")){return new Date(year,month,day,hour,min,sec,msec)}
var ofs;if(typeof(res[9])!="undefined"&&res[9]!=""){ofs=parseInt(res[10],10)*3600000;if(typeof(res[11])!="undefined"&&res[11]!=""){ofs+=parseInt(res[11],10)*60000}
if(res[9]=="-"){ofs=-ofs}}else{ofs=0}
return new Date(Date.UTC(year,month,day,hour,min,sec,msec)-ofs)};MochiKit.DateTime.toISOTime=function(date,_215){if(typeof(date)=="undefined"||date==null){return null}
var hh=date.getHours();var mm=date.getMinutes();var ss=date.getSeconds();var lst=[((_215&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)];return lst.join(":")};MochiKit.DateTime.toISOTimestamp=function(date,_219){if(typeof(date)=="undefined"||date==null){return null}
var sep=_219?"T":" ";var foot=_219?"Z":"";if(_219){date=new Date(date.getTime()+(date.getTimezoneOffset()*60000))}
return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_219)+foot};MochiKit.DateTime.toISODate=function(date){if(typeof(date)=="undefined"||date==null){return null}
var _222=MochiKit.DateTime._padTwo;return [date.getFullYear(),_222(date.getMonth()+1),_222(date.getDate())].join("-")};MochiKit.DateTime.americanDate=function(d){d=d+"";if(typeof(d)!="string"||d.length==0){return null}
var a=d.split("/");return new Date(a[2],a[0]-1,a[1])};MochiKit.DateTime._padTwo=function(n){return(n>9)?n:"0"+n};MochiKit.DateTime.toPaddedAmericanDate=function(d){if(typeof(d)=="undefined"||d==null){return null}
var _224=MochiKit.DateTime._padTwo;return [_224(d.getMonth()+1),_224(d.getDate()),d.getFullYear()].join("/")};MochiKit.DateTime.toAmericanDate=function(d){if(typeof(d)=="undefined"||d==null){return null}
return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/")};MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"];MochiKit.DateTime.EXPORT_OK=[];MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT};MochiKit.DateTime.__new__=function(){var base=this.NAME+".";for(var k in this){var o=this[k];if(typeof(o)=="function"&&typeof(o.NAME)=="undefined"){try{o.NAME=base+k}
catch(e){}}}};MochiKit.DateTime.__new__();if(typeof(MochiKit.Base)!="undefined"){MochiKit.Base._exportSymbols(this,MochiKit.DateTime)}else{(function(_225,_226){if((typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined")||(typeof(MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){var all=_226.EXPORT_TAGS[":all"];for(var i=0;i<all.length;i++){_225[all[i]]=_226[all[i]]}}})(this,MochiKit.DateTime)}
if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Format")}
if(typeof(MochiKit)=="undefined"){MochiKit={}}
if(typeof(MochiKit.Format)=="undefined"){MochiKit.Format={}}
MochiKit.Format.NAME="MochiKit.Format";MochiKit.Format.VERSION="1.2";MochiKit.Format.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.Format.toString=function(){return this.__repr__()};MochiKit.Format._numberFormatter=function(_227,_228,_229,_230,_231,_232,_233,_234,_235){return function(num){num=parseFloat(num);if(typeof(num)=="undefined"||num==null||isNaN(num)){return _227}
var _236=_228;var _237=_229;if(num<0){num=-num}else{_236=_236.replace(/-/,"")}
var me=arguments.callee;var fmt=MochiKit.Format.formatLocale(_230);if(_231){num=num*100;_237=fmt.percent+_237}
num=MochiKit.Format.roundToFixed(num,_232);var _239=num.split(/\./);var _240=_239[0];var frac=(_239.length==1)?"":_239[1];var res="";while(_240.length<_233){_240="0"+_240}
if(_234){while(_240.length>_234){var i=_240.length-_234;res=fmt.separator+_240.substring(i,_240.length)+res;_240=_240.substring(0,i)}}
res=_240+res;if(_232>0){while(frac.length<_235){frac=frac+"0"}
res=res+fmt.decimal+frac}
return _236+res+_237}};MochiKit.Format.numberFormatter=function(_242,_243,_244){if(typeof(_243)=="undefined"){_243=""}
var _245=_242.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/);if(!_245){throw TypeError("Invalid pattern")}
var _246=_242.substr(0,_245.index);var _247=_242.substr(_245.index+_245[0].length);if(_246.search(/-/)==-1){_246=_246+"-"}
var _248=_245[1];var frac=(typeof(_245[2])=="string"&&_245[2]!="")?_245[2]:"";var _249=(typeof(_245[3])=="string"&&_245[3]!="");var tmp=_248.split(/,/);var _251;if(typeof(_244)=="undefined"){_244="default"}
if(tmp.length==1){_251=null}else{_251=tmp[1].length}
var _252=_248.length-_248.replace(/0/g,"").length;var _253=frac.length-frac.replace(/0/g,"").length;var _254=frac.length;var rval=MochiKit.Format._numberFormatter(_243,_246,_247,_244,_249,_254,_252,_251,_253);var m=MochiKit.Base;if(m){var fn=arguments.callee;var args=m.concat(arguments);rval.repr=function(){return [self.NAME,"(",map(m.repr,args).join(", "),")"].join("")}}
return rval};MochiKit.Format.formatLocale=function(_256){if(typeof(_256)=="undefined"||_256==null){_256="default"}
if(typeof(_256)=="string"){var rval=MochiKit.Format.LOCALE[_256];if(typeof(rval)=="string"){rval=arguments.callee(rval);MochiKit.Format.LOCALE[_256]=rval}
return rval}else{return _256}};MochiKit.Format.twoDigitAverage=function(_257,_258){if(_258){var res=_257/_258;if(!isNaN(res)){return MochiKit.Format.twoDigitFloat(_257/_258)}}
return "0"};MochiKit.Format.twoDigitFloat=function(_259){var sign=(_259<0?"-":"");var s=Math.floor(Math.abs(_259)*100).toString();if(s=="0"){return s}
if(s.length<3){while(s.charAt(s.length-1)=="0"){s=s.substring(0,s.length-1)}
return sign+"0."+s}
var head=sign+s.substring(0,s.length-2);var tail=s.substring(s.length-2,s.length);if(tail=="00"){return head}else{if(tail.charAt(1)=="0"){return head+"."+tail.charAt(0)}else{return head+"."+tail}}};MochiKit.Format.lstrip=function(str,_264){str=str+"";if(typeof(str)!="string"){return null}
if(!_264){return str.replace(/^\s+/,"")}else{return str.replace(new RegExp("^["+_264+"]+"),"")}};MochiKit.Format.rstrip=function(str,_265){str=str+"";if(typeof(str)!="string"){return null}
if(!_265){return str.replace(/\s+$/,"")}else{return str.replace(new RegExp("["+_265+"]+$"),"")}};MochiKit.Format.strip=function(str,_266){var self=MochiKit.Format;return self.rstrip(self.lstrip(str,_266),_266)};MochiKit.Format.truncToFixed=function(_267,_268){_267=Math.floor(_267*Math.pow(10,_268));var res=(_267*Math.pow(10,-_268)).toFixed(_268);if(res.charAt(0)=="."){res="0"+res}
return res};MochiKit.Format.roundToFixed=function(_269,_270){return MochiKit.Format.truncToFixed(_269+0.5*Math.pow(10,-_270),_270)};MochiKit.Format.percentFormat=function(_271){return MochiKit.Format.twoDigitFloat(100*_271)+"%"};MochiKit.Format.EXPORT=["truncToFixed","roundToFixed","numberFormatter","formatLocale","twoDigitAverage","twoDigitFloat","percentFormat","lstrip","rstrip","strip"];MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US"};MochiKit.Format.EXPORT_OK=[];MochiKit.Format.EXPORT_TAGS={":all":MochiKit.Format.EXPORT,":common":MochiKit.Format.EXPORT};MochiKit.Format.__new__=function(){var base=this.NAME+".";var k,v,o;for(k in this.LOCALE){o=this.LOCALE[k];if(typeof(o)=="object"){o.repr=function(){return this.NAME};o.NAME=base+"LOCALE."+k}}
for(k in this){o=this[k];if(typeof(o)=="function"&&typeof(o.NAME)=="undefined"){try{o.NAME=base+k}
catch(e){}}}};MochiKit.Format.__new__();if(typeof(MochiKit.Base)!="undefined"){MochiKit.Base._exportSymbols(this,MochiKit.Format)}else{(function(_272,_273){if((typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined")||(typeof(MochiKit.__compat__)=="boolean"&&MochiKit.__compat__)){var all=_273.EXPORT_TAGS[":all"];for(var i=0;i<all.length;i++){_272[all[i]]=_273[all[i]]}}})(this,MochiKit.Format)}
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.2";MochiKit.Async.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.Async.toString=function(){return this.__repr__()};MochiKit.Async.Deferred=function(_274){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=_274;this.silentlyCancelled=false};MochiKit.Async.Deferred.prototype={repr:function(){var _275;if(this.fired==-1){_275="unfired"}else{if(this.fired==0){_275="success"}else{_275="error"}}
return "Deferred("+this.id+", "+_275+")"},toString:MochiKit.Base.forward("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();this._resback(res)},errback:function(res){this._check();if(!(res instanceof Error)){res=new MochiKit.Async.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){this.chain.push([cb,eb]);if(this.fired>=0){this._fire()}
return this},_fire:function(){var _278=this.chain;var _279=this.fired;var res=this.results[_279];var self=this;var cb=null;while(_278.length>0&&this.paused==0){var pair=_278.shift();var f=pair[_279];if(f==null){continue}
try{res=f(res);_279=((res instanceof Error)?1:0);if(res instanceof MochiKit.Async.Deferred){cb=function(res){self._continue(res)};this._pause()}}
catch(err){_279=1;res=err}}
this.fired=_279;this.results[_279]=res;if(cb&&this.paused){res.addBoth(cb)}}};MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){return eval("("+arguments[0].responseText+")")},succeed:function(_281){var d=new MochiKit.Async.Deferred();d.callback.apply(d,arguments);return d},fail:function(_282){var d=new MochiKit.Async.Deferred();d.errback.apply(d,arguments);return d},getXMLHttpRequest:function(){var self=arguments.callee;if(!self.XMLHttpRequest){var _283=[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<_283.length;i++){var func=_283[i];try{self.XMLHttpRequest=func;return func()}
catch(e){}}}
return self.XMLHttpRequest()},sendXMLHttpRequest:function(req,_285){if(typeof(_285)=="undefined"){_285=null}
var _286=function(){try{req.onreadystatechange=null}
catch(e){try{req.onreadystatechange=function(){}}
catch(e){}}
req.abort()};var self=MochiKit.Async;var d=new self.Deferred(_286);var _287=function(){if(req.readyState==4){try{req.onreadystatechange=null}
catch(e){try{req.onreadystatechange=function(){}}
catch(e){}}
var _288=null;try{_288=req.status;if(!_288&&MochiKit.Base.isNotEmpty(req.responseText)){_288=304}}
catch(e){}
if(_288==200||_288==304){d.callback(req)}else{var err=new self.XMLHttpRequestError(req,"Request failed");if(err.number){d.errback(err)}else{d.errback(err)}}}};try{req.onreadystatechange=_287;req.send(_285)}
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(_292,_293){var d=new MochiKit.Async.Deferred();var m=MochiKit.Base;if(typeof(_293)!="undefined"){d.addCallback(function(){return _293})}
var _294=setTimeout(m.bind("callback",d),Math.floor(_292*1000));d.canceller=function(){try{clearTimeout(_294)}
catch(e){}};return d},callLater:function(_295,func){var m=MochiKit.Base;var _296=m.partial.apply(m,m.extend(null,arguments,1));return MochiKit.Async.wait(_295).addCallback(function(res){return _296()})}});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 _297;if(this.locked){_297="locked, "+this.waiting.length+" waiting"}else{_297="unlocked"}
return "DeferredLock("+this.id+", "+_297+")"},toString:MochiKit.Base.forward("repr")};MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock"];MochiKit.Async.EXPORT_OK=["evalJSONRequest"];MochiKit.Async.__new__=function(){var m=MochiKit.Base;var ne=m.partial(m._newNamedError,this);ne("AlreadyCalledError",function(_299){this.deferred=_299});ne("CancelledError",function(_300){this.deferred=_300});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.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.2";MochiKit.DOM.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.DOM.toString=function(){return this.__repr__()};MochiKit.DOM.EXPORT=["elementDimensions","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","elementPosition"];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.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.w||0,elem.h||0)}
var s=elem.style;var _305=s.visibility;var _306=s.position;s.visibility="hidden";s.position="absolute";s.display="";var _307=elem.clientWidth;var _308=elem.clientHeight;s.display="none";s.position=_306;s.visibility=_305;return new self.Dimensions(_307,_308)};MochiKit.DOM.elementPosition=function(elem,_309){var self=MochiKit.DOM;elem=self.getElement(elem);if(!elem){return undefined}
var x=0;var y=0;if(elem.offsetParent){while(elem.offsetParent){x+=elem.offsetLeft;y+=elem.offsetTop;elem=elem.offsetParent}}else{x=elem.x||x;y=elem.y||y}
if(_309){_309=arguments.callee(_309);if(_309){x-=(_309.x||0);y-=(_309.y||0)}}
return new self.Coordinates(x,y)};MochiKit.DOM.currentWindow=function(){return MochiKit.DOM._window};MochiKit.DOM.currentDocument=function(){return MochiKit.DOM._document};MochiKit.DOM.withWindow=function(win,func){var self=MochiKit.DOM;var _311=self._document;var _312=self._win;var rval;try{self._window=win;self._document=win.document;rval=func()}
catch(e){self._window=_312;self._document=_311;throw e}
self._window=_312;self._document=_311;return rval};MochiKit.DOM.formContents=function(elem){var _313=[];var _314=[];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)){if(elem.tagName=="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){return null}
if(elem.tagName=="SELECT"){var opts=elem.options;for(var i=0;i<opts.length;i++){var opt=opts[i];if(!opt.selected){continue}
_313.push(name);_314.push((opt.value)?opt.value:opt.text)}}else{_313.push(name);_314.push(elem.value||"")}
return null}
return elem.childNodes});return [_313,_314]};MochiKit.DOM.withDocument=function(doc,func){var self=MochiKit.DOM;var _318=self._document;var rval;try{self._document=doc;rval=func()}
catch(e){self._document=_318;throw e}
self._document=_318;return rval};MochiKit.DOM.registerDOMConverter=function(name,_319,wrap,_320){MochiKit.DOM.domConverters.register(name,_319,wrap,_320)};MochiKit.DOM.coerceToDOM=function(node,ctx){var im=MochiKit.Iter;var self=MochiKit.DOM;var iter=im.iter;var _324=im.repeat;var imap=im.imap;var _326=self.domConverters;var _327=self.coerceToDOM;var _328=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)=="bool"){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 _329=null;try{_329=iter(node)}
catch(e){}
if(_329){return imap(_327,_329,_324(ctx))}
try{node=_326.match(node,ctx);continue}
catch(e){if(e!=_328){throw e}}
return self._document.createTextNode(node.toString())}
return undefined};MochiKit.DOM.setNodeAttribute=function(node,attr,_331){var o={};o[attr]=_331;try{return MochiKit.DOM.updateNodeAttributes(node,o)}
catch(e){}
return null};MochiKit.DOM.getNodeAttribute=function(node,attr){var self=MochiKit.DOM;var _332=self.attributeArray.renames[attr];node=self.getElement(node);try{if(_332){return node[_332]}
return node.getAttribute(attr)}
catch(e){}
return null};MochiKit.DOM.updateNodeAttributes=function(node,_333){var elem=node;var self=MochiKit.DOM;if(typeof(node)=="string"){elem=self.getElement(node)}
if(_333){var _334=MochiKit.Base.updatetree;if(self.attributeArray.compliant){for(var k in _333){var v=_333[k];if(typeof(v)=="object"&&typeof(elem[k])=="object"){_334(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 _335=self.attributeArray.renames;for(k in _333){v=_333[k];var _336=_335[k];if(k=="style"&&typeof(v)=="string"){elem.style.cssText=v}else{if(typeof(_336)=="string"){elem[_336]=v}else{if(typeof(elem[k])=="object"&&typeof(v)=="object"){_334(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};MochiKit.DOM.appendChildNodes=function(node){var elem=node;var self=MochiKit.DOM;if(typeof(node)=="string"){elem=self.getElement(node)}
var _337=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];var _338=MochiKit.Iter.iextend;while(_337.length){var n=_337.shift();if(typeof(n)=="undefined"||n==null){}else{if(typeof(n.nodeType)=="number"){elem.appendChild(n)}else{_338(_337,n)}}}
return elem};MochiKit.DOM.replaceChildNodes=function(node){var elem=node;var self=MochiKit.DOM;if(typeof(node)=="string"){elem=self.getElement(node);arguments[0]=elem}
var _339;while((_339=elem.firstChild)){elem.removeChild(_339)}
if(arguments.length<2){return elem}else{return self.appendChildNodes.apply(this,arguments)}};MochiKit.DOM.createDOM=function(name,_340){var elem;var self=MochiKit.DOM;if(typeof(name)=="string"){if(_340&&"name" in _340&&!self.attributeArray.compliant){name="<"+name+" name=\""+self.escapeHTML(_340.name)+"\">"}
elem=self._document.createElement(name)}else{elem=name}
if(_340){self.updateNodeAttributes(elem,_340)}
if(arguments.length<=2){return elem}else{var args=MochiKit.Base.extend([elem],arguments,2);return self.appendChildNodes.apply(this,args)}};MochiKit.DOM.createDOMFunc=function(){var m=MochiKit.Base;return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments))};MochiKit.DOM.swapDOM=function(dest,src){var self=MochiKit.DOM;dest=self.getElement(dest);var _343=dest.parentNode;if(src){src=self.getElement(src);_343.replaceChild(src,dest)}else{_343.removeChild(dest)}
return src};MochiKit.DOM.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)}};MochiKit.DOM.computedStyle=function(_345,_346,_347){if(arguments.length==2){_347=_346}
var self=MochiKit.DOM;var el=self.getElement(_345);var _349=self._document;if(!el||el==_349){return undefined}
if(el.currentStyle){return el.currentStyle[_346]}
if(typeof(_349.defaultView)=="undefined"){return undefined}
if(_349.defaultView==null){return undefined}
var _350=_349.defaultView.getComputedStyle(el,null);if(typeof(_350)=="undefined"||_350==null){return undefined}
return _350.getPropertyValue(_347)};MochiKit.DOM.getElementsByTagAndClassName=function(_351,_352,_353){var self=MochiKit.DOM;if(typeof(_351)=="undefined"||_351==null){_351="*"}
if(typeof(_353)=="undefined"||_353==null){_353=self._document}
_353=self.getElement(_353);var _354=_353.getElementsByTagName(_351)||self._document.all;if(typeof(_352)=="undefined"||_352==null){return MochiKit.Base.extend(null,_354)}
var _355=[];for(var i=0;i<_354.length;i++){var _356=_354[i];var _357=_356.className.split(" ");for(var j=0;j<_357.length;j++){if(_357[j]==_352){_355.push(_356);break}}}
return _355};MochiKit.DOM._newCallStack=function(path,once){var rval=function(){var _360=arguments.callee.callStack;for(var i=0;i<_360.length;i++){if(_360[i].apply(this,arguments)===false){break}}
if(once){try{this[path]=null}
catch(e){}}};rval.callStack=[];return rval};MochiKit.DOM.addToCallStack=function(_361,path,func,once){var self=MochiKit.DOM;var _362=_361[path];var _363=_362;if(!(typeof(_362)=="function"&&typeof(_362.callStack)=="object"&&_362.callStack!=null)){_363=self._newCallStack(path,once);if(typeof(_362)=="function"){_363.callStack.push(_362)}
_361[path]=_363}
_363.callStack.push(func)};MochiKit.DOM.addLoadEvent=function(func){var self=MochiKit.DOM;self.addToCallStack(self._window,"onload",func,true)};MochiKit.DOM.focusOnLoad=function(_364){var self=MochiKit.DOM;self.addLoadEvent(function(){_364=self.getElement(_364);if(_364){_364.focus()}})};MochiKit.DOM.setElementClass=function(_365,_366){var self=MochiKit.DOM;var obj=self.getElement(_365);if(self.attributeArray.compliant){obj.setAttribute("class",_366)}else{obj.setAttribute("className",_366)}};MochiKit.DOM.toggleElementClass=function(_367){var self=MochiKit.DOM;for(var i=1;i<arguments.length;i++){var obj=self.getElement(arguments[i]);if(!self.addElementClass(obj,_367)){self.removeElementClass(obj,_367)}}};MochiKit.DOM.addElementClass=function(_368,_369){var self=MochiKit.DOM;var obj=self.getElement(_368);var cls=obj.className;if(cls.length==0){self.setElementClass(obj,_369);return true}
if(cls==_369){return false}
var _371=obj.className.split(" ");for(var i=0;i<_371.length;i++){if(_371[i]==_369){return false}}
self.setElementClass(obj,cls+" "+_369);return true};MochiKit.DOM.removeElementClass=function(_372,_373){var self=MochiKit.DOM;var obj=self.getElement(_372);var cls=obj.className;if(cls.length==0){return false}
if(cls==_373){self.setElementClass(obj,"");return true}
var _374=obj.className.split(" ");for(var i=0;i<_374.length;i++){if(_374[i]==_373){_374.splice(i,1);self.setElementClass(obj,_374.join(" "));return true}}
return false};MochiKit.DOM.swapElementClass=function(_375,_376,_377){var obj=MochiKit.DOM.getElement(_375);var res=MochiKit.DOM.removeElementClass(obj,_376);if(res){MochiKit.DOM.addElementClass(obj,_377)}
return res};MochiKit.DOM.hasElementClass=function(_378,_379){var obj=MochiKit.DOM.getElement(_378);var _380=obj.className.split(" ");for(var i=1;i<arguments.length;i++){var good=false;for(var j=0;j<_380.length;j++){if(_380[j]==arguments[i]){good=true;break}}
if(!good){return false}}
return true};MochiKit.DOM.escapeHTML=function(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};MochiKit.DOM.toHTML=function(dom){return MochiKit.DOM.emitHTML(dom).join("")};MochiKit.DOM.emitHTML=function(dom,lst){if(typeof(lst)=="undefined"||lst==null){lst=[]}
var _383=[dom];var self=MochiKit.DOM;var _384=self.escapeHTML;var _385=self.attributeArray;while(_383.length){dom=_383.pop();if(typeof(dom)=="string"){lst.push(dom)}else{if(dom.nodeType==1){lst.push("<"+dom.nodeName.toLowerCase());var _386=[];var _387=_385(dom);for(var i=0;i<_387.length;i++){var a=_387[i];_386.push([" ",a.name,"=\"",_384(a.value),"\""])}
_386.sort();for(i=0;i<_386.length;i++){var _388=_386[i];for(var j=0;j<_388.length;j++){lst.push(_388[j])}}
if(dom.hasChildNodes()){lst.push(">");_383.push("</"+dom.nodeName.toLowerCase()+">");var _389=dom.childNodes;for(i=_389.length-1;i>=0;i--){_383.push(_389[i])}}else{lst.push("/>")}}else{if(dom.nodeType==3){lst.push(_384(dom.nodeValue))}}}}
return lst};MochiKit.DOM.setDisplayForElement=function(_390,_391){var m=MochiKit.Base;var _392=m.extend(null,arguments,1);MochiKit.Iter.forEach(m.filter(null,m.map(MochiKit.DOM.getElement,_392)),function(_391){_391.style.display=_390})};MochiKit.DOM.scrapeText=function(node,_393){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 _395=node.nodeValue;if(typeof(_395)=="string"){rval.push(_395)}})(MochiKit.DOM.getElement(node));if(_393){return rval}else{return rval.join("")}};MochiKit.DOM.__new__=function(win){var m=MochiKit.Base;this._document=document;this._window=win;this.domConverters=new m.AdapterRegistry();var _396=this._document.createElement("span");var _397;if(_396&&_396.attributes&&_396.attributes.length>0){var _398=m.filter;_397=function(node){return _398(_397.ignoreAttrFilter,node.attributes)};_397.ignoreAttr={};MochiKit.Iter.forEach(_396.attributes,function(a){_397.ignoreAttr[a.name]=a.value});_397.ignoreAttrFilter=function(a){return(_397.ignoreAttr[a.name]!=a.value)};_397.compliant=false;_397.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor"}}else{_397=function(node){return node.attributes};_397.compliant=true;_397.renames={}}
this.attributeArray=_397;var _399=this.createDOMFunc;this.UL=_399("ul");this.OL=_399("ol");this.LI=_399("li");this.TD=_399("td");this.TR=_399("tr");this.TBODY=_399("tbody");this.THEAD=_399("thead");this.TFOOT=_399("tfoot");this.TABLE=_399("table");this.TH=_399("th");this.INPUT=_399("input");this.SPAN=_399("span");this.A=_399("a");this.DIV=_399("div");this.IMG=_399("img");this.BUTTON=_399("button");this.TT=_399("tt");this.PRE=_399("pre");this.H1=_399("h1");this.H2=_399("h2");this.H3=_399("h3");this.BR=_399("br");this.HR=_399("hr");this.LABEL=_399("label");this.TEXTAREA=_399("textarea");this.FORM=_399("form");this.P=_399("p");this.SELECT=_399("select");this.OPTION=_399("option");this.OPTGROUP=_399("optgroup");this.LEGEND=_399("legend");this.FIELDSET=_399("fieldset");this.STRONG=_399("strong");this.CANVAS=_399("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__(this);withWindow=MochiKit.DOM.withWindow;withDocument=MochiKit.DOM.withDocument;MochiKit.Base._exportSymbols(this,MochiKit.DOM);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.LoggingPane");dojo.require("MochiKit.Logging");dojo.require("MochiKit.Base")}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Logging",[]);JSAN.use("MochiKit.Base",[])}
try{if(typeof(MochiKit.Base)=="undefined"||typeof(MochiKit.Logging)=="undefined"){throw ""}}
catch(e){throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!"}
if(typeof(MochiKit.LoggingPane)=="undefined"){MochiKit.LoggingPane={}}
MochiKit.LoggingPane.NAME="MochiKit.LoggingPane";MochiKit.LoggingPane.VERSION="1.2";MochiKit.LoggingPane.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.LoggingPane.toString=function(){return this.__repr__()};MochiKit.LoggingPane.createLoggingPane=function(_400){var m=MochiKit.LoggingPane;_400=!(!_400);if(m._loggingPane&&m._loggingPane.inline!=_400){m._loggingPane.closePane();m._loggingPane=null}
if(!m._loggingPane||m._loggingPane.closed){m._loggingPane=new m.LoggingPane(_400,MochiKit.Logging.logger)}
return m._loggingPane};MochiKit.LoggingPane.LoggingPane=function(_401,_402){if(typeof(_402)=="undefined"||_402==null){_402=MochiKit.Logging.logger}
this.logger=_402;var _403=MochiKit.Base.update;var _404=MochiKit.Base.updatetree;var bind=MochiKit.Base.bind;var _405=MochiKit.Base.clone;var win=window;var uid="_MochiKit_LoggingPane";if(typeof(MochiKit.DOM)!="undefined"){win=MochiKit.DOM.currentWindow()}
if(!_401){var url=win.location.href.split("?")[0].replace(/[:\/.><&]/g,"_");var name=uid+"_"+url;var nwin=win.open("",name,"dependent,resizable,height=200");if(!nwin){alert("Not able to open debugging window due to pop-up blocking.");return undefined}
nwin.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" "+"\"http://www.w3.org/TR/html4/loose.dtd\">"+"<html><head><title>[MochiKit.LoggingPane]</title></head>"+"<body></body></html>");nwin.document.close();nwin.document.title+=" "+win.document.title;win=nwin}
var doc=win.document;this.doc=doc;var _408=doc.getElementById(uid);var _409=!!_408;if(_408&&typeof(_408.loggingPane)!="undefined"){_408.loggingPane.logger=this.logger;_408.loggingPane.buildAndApplyFilter();return _408.loggingPane}
if(_409){var _410;while((_410=_408.firstChild)){_408.removeChild(_410)}}else{_408=doc.createElement("div");_408.id=uid}
_408.loggingPane=this;var _411=doc.createElement("input");var _412=doc.createElement("input");var _413=doc.createElement("button");var _414=doc.createElement("button");var _415=doc.createElement("button");var _416=doc.createElement("button");var _417=doc.createElement("div");var _418=doc.createElement("div");var _419=uid+"_Listener";this.colorTable=_405(this.colorTable);var _420=[];var _421=null;var _422=function(msg){var _423=msg.level;if(typeof(_423)=="number"){_423=MochiKit.Logging.LogLevel[_423]}
return _423};var _424=function(msg){return msg.info.join(" ")};var _425=bind(function(msg){var _426=_422(msg);var text=_424(msg);var c=this.colorTable[_426];var p=doc.createElement("span");p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_426;p.style.cssText="margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: "+c;p.appendChild(doc.createTextNode(_426+": "+text));_418.appendChild(p);_418.appendChild(doc.createElement("br"));if(_417.offsetHeight>_417.scrollHeight){_417.scrollTop=0}else{_417.scrollTop=_417.scrollHeight}},this);var _429=function(msg){_420[_420.length]=msg;_425(msg)};var _430=function(){var _431,infore;try{_431=new RegExp(_411.value);infore=new RegExp(_412.value)}
catch(e){logDebug("Error in filter regex: "+e.message);return null}
return function(msg){return(_431.test(_422(msg))&&infore.test(_424(msg)))}};var _432=function(){while(_418.firstChild){_418.removeChild(_418.firstChild)}};var _433=function(){_420=[];_432()};var _434=bind(function(){if(this.closed){return}
this.closed=true;if(MochiKit.LoggingPane._loggingPane==this){MochiKit.LoggingPane._loggingPane=null}
this.logger.removeListener(_419);_408.loggingPane=null;if(_401){_408.parentNode.removeChild(_408)}else{this.win.close()}},this);var _435=function(){_432();for(var i=0;i<_420.length;i++){var msg=_420[i];if(_421==null||_421(msg)){_425(msg)}}};this.buildAndApplyFilter=function(){_421=_430();_435();this.logger.removeListener(_419);this.logger.addListener(_419,_421,_429)};var _436=bind(function(){_420=this.logger.getMessages();_435()},this);var _437=bind(function(_438){_438=_438||window.event;key=_438.which||_438.keyCode;if(key==13){this.buildAndApplyFilter()}},this);var _439="display: block; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont;if(_401){_439+="; height: 10em; border-top: 2px solid black"}else{_439+="; height: 100%;"}
_408.style.cssText=_439;if(!_409){doc.body.appendChild(_408)}
_439={"cssText":"width: 33%; display: inline; font: "+this.logFont};_404(_411,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_437,"style":_439});_408.appendChild(_411);_404(_412,{"value":".*","onkeypress":_437,"style":_439});_408.appendChild(_412);_439="width: 8%; display:inline; font: "+this.logFont;_413.appendChild(doc.createTextNode("Filter"));_413.onclick=bind("buildAndApplyFilter",this);_413.style.cssText=_439;_408.appendChild(_413);_414.appendChild(doc.createTextNode("Load"));_414.onclick=_436;_414.style.cssText=_439;_408.appendChild(_414);_415.appendChild(doc.createTextNode("Clear"));_415.onclick=_433;_415.style.cssText=_439;_408.appendChild(_415);_416.appendChild(doc.createTextNode("Close"));_416.onclick=_434;_416.style.cssText=_439;_408.appendChild(_416);_417.style.cssText="overflow: auto; width: 100%";_418.style.cssText="width: 100%; height: "+(_401?"8em":"100%");_417.appendChild(_418);_408.appendChild(_417);this.buildAndApplyFilter();_436();if(_401){this.win=undefined}else{this.win=win}
this.inline=_401;this.closePane=_434;this.closed=false;return this};MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}};MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"];MochiKit.LoggingPane.EXPORT=["createLoggingPane"];MochiKit.LoggingPane.__new__=function(){this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)};MochiKit.Base.nameFunctions(this);MochiKit.LoggingPane._loggingPane=null};MochiKit.LoggingPane.__new__();MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane);if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Color");dojo.require("MochiKit.Base")}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Base",[])}
try{if(typeof(MochiKit.Base)=="undefined"){throw ""}}
catch(e){throw "MochiKit.Color depends on MochiKit.Base"}
if(typeof(MochiKit.Color)=="undefined"){MochiKit.Color={}}
MochiKit.Color.NAME="MochiKit.Color";MochiKit.Color.VERSION="1.2";MochiKit.Color.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.Color.toString=function(){return this.__repr__()};MochiKit.Color.Color=function(red,_441,blue,_443){if(typeof(_443)=="undefined"||_443==null){_443=1}
this.rgb={r:red,g:_441,b:blue,a:_443}};MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_444){var rgb=this.rgb;var m=MochiKit.Color;return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_444)},colorWithHue:function(hue){var hsl=this.asHSL();hsl.h=hue;var m=MochiKit.Color;return m.Color.fromHSL(hsl)},colorWithSaturation:function(_448){var hsl=this.asHSL();hsl.s=_448;var m=MochiKit.Color;return m.Color.fromHSL(hsl)},colorWithLightness:function(_449){var hsl=this.asHSL();hsl.l=_449;var m=MochiKit.Color;return m.Color.fromHSL(hsl)},darkerColorWithLevel:function(_450){var hsl=this.asHSL();hsl.l=Math.max(hsl.l-_450,0);var m=MochiKit.Color;return m.Color.fromHSL(hsl)},lighterColorWithLevel:function(_451){var hsl=this.asHSL();hsl.l=Math.min(hsl.l+_451,1);var m=MochiKit.Color;return m.Color.fromHSL(hsl)},blendedColor:function(_452,_453){if(typeof(_453)=="undefined"||_453==null){_453=0.5}
var sf=1-_453;var s=this.rgb;var d=_452.rgb;var df=_453;return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df))},compareRGB:function(_456){var a=this.asRGB();var b=_456.asRGB();return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a])},isLight:function(){return this.asHSL().b>0.5},isDark:function(){return(!this.isLight())},toHSLString:function(){var c=this.asHSL();var ccc=MochiKit.Color.clampColorComponent;var rval=this._hslString;if(!rval){var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%");var a=c.a;if(a>=1){a=1;rval="hsl("+mid+")"}else{if(a<=0){a=0}
rval="hsla("+mid+","+a+")"}
this._hslString=rval}
return rval},toRGBString:function(){var c=this.rgb;var ccc=MochiKit.Color.clampColorComponent;var rval=this._rgbString;if(!rval){var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0));if(c.a!=1){rval="rgba("+mid+","+c.a+")"}else{rval="rgb("+mid+")"}
this._rgbString=rval}
return rval},asRGB:function(){return MochiKit.Base.clone(this.rgb)},toHexString:function(){var m=MochiKit.Color;var c=this.rgb;var ccc=MochiKit.Color.clampColorComponent;var rval=this._hexString;if(!rval){rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255)));this._hexString=rval}
return rval},asHSV:function(){var hsv=this.hsv;var c=this.rgb;if(typeof(hsv)=="undefined"||hsv==null){hsv=MochiKit.Color.rgbToHSV(this.rgb);this.hsv=hsv}
return MochiKit.Base.clone(hsv)},asHSL:function(){var hsl=this.hsl;var c=this.rgb;if(typeof(hsl)=="undefined"||hsl==null){hsl=MochiKit.Color.rgbToHSL(this.rgb);this.hsl=hsl}
return MochiKit.Base.clone(hsl)},toString:function(){return this.toRGBString()},repr:function(){var c=this.rgb;var col=[c.r,c.g,c.b,c.a];return this.__class__.NAME+"("+col.join(", ")+")"}};MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_461,blue,_462){var _463=MochiKit.Color.Color;if(arguments.length==1){var rgb=red;red=rgb.r;_461=rgb.g;blue=rgb.b;if(typeof(rgb.a)=="undefined"){_462=undefined}else{_462=rgb.a}}
return new _463(red,_461,blue,_462)},fromHSL:function(hue,_464,_465,_466){var m=MochiKit.Color;return m.Color.fromRGB(m.hslToRGB.apply(m,arguments))},fromHSV:function(hue,_467,_468,_469){var m=MochiKit.Color;return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments))},fromName:function(name){var _470=MochiKit.Color.Color;var _471=_470._namedColors[name.toLowerCase()];if(typeof(_471)=="string"){return _470.fromHexString(_471)}else{if(name=="transparent"){return _470.transparentColor()}}
return null},fromString:function(_472){var self=MochiKit.Color.Color;var _473=_472.substr(0,3);if(_473=="rgb"){return self.fromRGBString(_472)}else{if(_473=="hsl"){return self.fromHSLString(_472)}else{if(_472.charAt(0)=="#"){return self.fromHexString(_472)}}}
return self.fromName(_472)},fromHexString:function(_474){if(_474.charAt(0)=="#"){_474=_474.substring(1)}
var _475=[];var i,hex;if(_474.length==3){for(i=0;i<3;i++){hex=_474.substr(i,1);_475.push(parseInt(hex+hex,16)/255)}}else{for(i=0;i<6;i+=2){hex=_474.substr(i,2);_475.push(parseInt(hex,16)/255)}}
var _476=MochiKit.Color.Color;return _476.fromRGB.apply(_476,_475)},_fromColorString:function(pre,_478,_479,_480){if(_480.indexOf(pre)==0){_480=_480.substring(_480.indexOf("(",3)+1,_480.length-1)}
var _481=_480.split(/\s*,\s*/);var _482=[];for(var i=0;i<_481.length;i++){var c=_481[i];var val;var _483=c.substring(c.length-3);if(c.charAt(c.length-1)=="%"){val=0.01*parseFloat(c.substring(0,c.length-1))}else{if(_483=="deg"){val=parseFloat(c)/360}else{if(_483=="rad"){val=parseFloat(c)/(Math.PI*2)}else{val=_479[i]*parseFloat(c)}}}
_482.push(val)}
return this[_478].apply(this,_482)},fromComputedStyle:function(elem,_484,_485){var d=MochiKit.DOM;var cls=MochiKit.Color.Color;for(elem=d.getElement(elem);elem;elem=elem.parentNode){var _486=d.computedStyle.apply(d,arguments);if(!_486){continue}
var _487=cls.fromString(_486);if(!_487){break}
if(_487.asRGB().a>0){return _487}}
return null},fromBackground:function(elem){var cls=MochiKit.Color.Color;return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor()},fromText:function(elem){var cls=MochiKit.Color.Color;return cls.fromComputedStyle(elem,"color","color")||cls.blackColor()},namedColors:function(){return MochiKit.Base.clone(MochiKit.Color.Color._namedColors)}});MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_488){v*=_488;if(v<0){return 0}else{if(v>_488){return _488}else{return v}}},_hslValue:function(n1,n2,hue){if(hue>6){hue-=6}else{if(hue<0){hue+=6}}
var val;if(hue<1){val=n1+(n2-n1)*hue}else{if(hue<3){val=n2}else{if(hue<4){val=n1+(n2-n1)*(4-hue)}else{val=n1}}}
return val},hsvToRGB:function(hue,_491,_492,_493){if(arguments.length==1){var hsv=hue;hue=hsv.h;_491=hsv.s;_492=hsv.v;_493=hsv.a}
var red;var _494;var blue;if(_491==0){red=0;_494=0;blue=0}else{var i=Math.floor(hue*6);var f=(hue*6)-i;var p=_492*(1-_491);var q=_492*(1-(_491*f));var t=_492*(1-(_491*(1-f)));switch(i){case 1:red=q;_494=_492;blue=p;break;case 2:red=p;_494=_492;blue=t;break;case 3:red=p;_494=q;blue=_492;break;case 4:red=t;_494=p;blue=_492;break;case 5:red=_492;_494=p;blue=q;break;case 6:case 0:red=_492;_494=t;blue=p;break}}
return{r:red,g:_494,b:blue,a:_493}},hslToRGB:function(hue,_496,_497,_498){if(arguments.length==1){var hsl=hue;hue=hsl.h;_496=hsl.s;_497=hsl.l;_498=hsl.a}
var red;var _499;var blue;if(_496==0){red=_497;_499=_497;blue=_497}else{var m2;if(_497<=0.5){m2=_497*(1+_496)}else{m2=_497+_496-(_497*_496)}
var m1=(2*_497)-m2;var f=MochiKit.Color._hslValue;var h6=hue*6;red=f(m1,m2,h6+2);_499=f(m1,m2,h6);blue=f(m1,m2,h6-2)}
return{r:red,g:_499,b:blue,a:_498}},rgbToHSV:function(red,_503,blue,_504){if(arguments.length==1){var rgb=red;red=rgb.r;_503=rgb.g;blue=rgb.b;_504=rgb.a}
var max=Math.max(Math.max(red,_503),blue);var min=Math.min(Math.min(red,_503),blue);var hue;var _507;var _508=max;if(min==max){hue=0;_507=0}else{var _509=(max-min);_507=_509/max;if(red==max){hue=(_503-blue)/_509}else{if(_503==max){hue=2+((blue-red)/_509)}else{hue=4+((red-_503)/_509)}}
hue/=6;if(hue<0){hue+=1}
if(hue>1){hue-=1}}
return{h:hue,s:_507,v:_508,a:_504}},rgbToHSL:function(red,_510,blue,_511){if(arguments.length==1){var rgb=red;red=rgb.r;_510=rgb.g;blue=rgb.b;_511=rgb.a}
var max=Math.max(red,Math.max(_510,blue));var min=Math.min(red,Math.min(_510,blue));var hue;var _512;var _513=(max+min)/2;var _514=max-min;if(_514==0){hue=0;_512=0}else{if(_513<=0.5){_512=_514/(max+min)}else{_512=_514/(2-max-min)}
if(red==max){hue=(_510-blue)/_514}else{if(_510==max){hue=2+((blue-red)/_514)}else{hue=4+((red-_510)/_514)}}
hue/=6;if(hue<0){hue+=1}
if(hue>1){hue-=1}}
return{h:hue,s:_512,l:_513,a:_511}},toColorPart:function(num){var _515=Math.round(num).toString(16);if(num<16){return "0"+_515}
return _515},__new__:function(){var m=MochiKit.Base;this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]);this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]);var _516=1/3;var _517={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_516,_516,_516],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_516,2*_516,2*_516],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]};var _518=function(name,r,g,b,a){var rval=this.fromRGB(r,g,b,a);this[name]=function(){return rval};return rval};for(var k in _517){var name=k+"Color";var _521=m.concat([_518,this.Color,name],_517[k]);this.Color[name]=m.bind.apply(null,_521)}
var _522=function(){for(var i=0;i<arguments.length;i++){if(!(arguments[i] instanceof Color)){return false}}
return true};var _523=function(a,b){return a.compareRGB(b)};m.nameFunctions(this);m.registerComparator(this.Color.NAME,_522,_523);this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}}});MochiKit.Color.EXPORT=["Color"];MochiKit.Color.EXPORT_OK=["clampColorComponent","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","toColorPart"];MochiKit.Color.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Color);MochiKit.Color.Color._namedColors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Visual");dojo.require("MochiKit.Base");dojo.require("MochiKit.DOM");dojo.require("MochiKit.Color")}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Base",[]);JSAN.use("MochiKit.DOM",[]);JSAN.use("MochiKit.Color",[])}
try{if(typeof(MochiKit.Base)=="undefined"||typeof(MochiKit.DOM)=="undefined"||typeof(MochiKit.Color)=="undefined"){throw ""}}
catch(e){throw "MochiKit.Visual depends on MochiKit.Base, MochiKit.DOM and MochiKit.Color!"}
if(typeof(MochiKit.Visual)=="undefined"){MochiKit.Visual={}}
MochiKit.Visual.NAME="MochiKit.Visual";MochiKit.Visual.VERSION="1.2";MochiKit.Visual.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.Visual.toString=function(){return this.__repr__()};MochiKit.Visual._RoundCorners=function(e,_524){e=MochiKit.DOM.getElement(e);this._setOptions(_524);if(this.options.__unstable__wrapElement){e=this._doWrap(e)}
var _525=this.options.color;var C=MochiKit.Color.Color;if(this.options.color=="fromElement"){_525=C.fromBackground(e)}else{if(!(_525 instanceof C)){_525=C.fromString(_525)}}
this.isTransparent=(_525.asRGB().a<=0);var _527=this.options.bgColor;if(this.options.bgColor=="fromParent"){_527=C.fromBackground(e.offsetParent)}else{if(!(_527 instanceof C)){_527=C.fromString(_527)}}
this._roundCornersImpl(e,_525,_527)};MochiKit.Visual._RoundCorners.prototype={_doWrap:function(e){var _528=e.parentNode;var doc=MochiKit.DOM.currentDocument();if(typeof(doc.defaultView)=="undefined"||doc.defaultView==null){return e}
var _529=doc.defaultView.getComputedStyle(e,null);if(typeof(_529)=="undefined"||_529==null){return e}
var _530=MochiKit.DOM.DIV({"style":{display:"block",marginTop:_529.getPropertyValue("padding-top"),marginRight:_529.getPropertyValue("padding-right"),marginBottom:_529.getPropertyValue("padding-bottom"),marginLeft:_529.getPropertyValue("padding-left"),padding:"0px"}});_530.innerHTML=e.innerHTML;e.innerHTML="";e.appendChild(_530);return e},_roundCornersImpl:function(e,_531,_532){if(this.options.border){this._renderBorder(e,_532)}
if(this._isTopRounded()){this._roundTopCorners(e,_531,_532)}
if(this._isBottomRounded()){this._roundBottomCorners(e,_531,_532)}},_renderBorder:function(el,_533){var _534="1px solid "+this._borderColor(_533);var _535="border-left: "+_534;var _536="border-right: "+_534;var _537="style='"+_535+";"+_536+"'";el.innerHTML="<div "+_537+">"+el.innerHTML+"</div>"},_roundTopCorners:function(el,_538,_539){var _540=this._createCorner(_539);for(var i=0;i<this.options.numSlices;i++){_540.appendChild(this._createCornerSlice(_538,_539,i,"top"))}
el.style.paddingTop=0;el.insertBefore(_540,el.firstChild)},_roundBottomCorners:function(el,_541,_542){var _543=this._createCorner(_542);for(var i=(this.options.numSlices-1);i>=0;i--){_543.appendChild(this._createCornerSlice(_541,_542,i,"bottom"))}
el.style.paddingBottom=0;el.appendChild(_543)},_createCorner:function(_544){var dom=MochiKit.DOM;return dom.DIV({style:{backgroundColor:_544.toString()}})},_createCornerSlice:function(_545,_546,n,_547){var _548=MochiKit.DOM.SPAN();var _549=_548.style;_549.backgroundColor=_545.toString();_549.display="block";_549.height="1px";_549.overflow="hidden";_549.fontSize="1px";var _550=this._borderColor(_545,_546);if(this.options.border&&n==0){_549.borderTopStyle="solid";_549.borderTopWidth="1px";_549.borderLeftWidth="0px";_549.borderRightWidth="0px";_549.borderBottomWidth="0px";_549.height="0px";_549.borderColor=_550.toString()}else{if(_550){_549.borderColor=_550.toString();_549.borderStyle="solid";_549.borderWidth="0px 1px"}}
if(!this.options.compact&&(n==(this.options.numSlices-1))){_549.height="2px"}
this._setMargin(_548,n,_547);this._setBorder(_548,n,_547);return _548},_setOptions:function(_551){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false};MochiKit.Base.update(this.options,_551);this.options.numSlices=(this.options.compact?2:4)},_whichSideTop:function(){var _552=this.options.corners;if(this._hasString(_552,"all","top")){return ""}
var _553=(_552.indexOf("tl")!=-1);var _554=(_552.indexOf("tr")!=-1);if(_553&&_554){return ""}
if(_553){return "left"}
if(_554){return "right"}
return ""},_whichSideBottom:function(){var _555=this.options.corners;if(this._hasString(_555,"all","bottom")){return ""}
var _556=(_555.indexOf("bl")!=-1);var _557=(_555.indexOf("br")!=-1);if(_556&&_557){return ""}
if(_556){return "left"}
if(_557){return "right"}
return ""},_borderColor:function(_558,_559){if(_558=="transparent"){return _559}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return _559.blendedColor(_558)}}}
return ""},_setMargin:function(el,n,_560){var _561=this._marginSize(n)+"px";var _562=(_560=="top"?this._whichSideTop():this._whichSideBottom());var _563=el.style;if(_562=="left"){_563.marginLeft=_561;_563.marginRight="0px"}else{if(_562=="right"){_563.marginRight=_561;_563.marginLeft="0px"}else{_563.marginLeft=_561;_563.marginRight=_561}}},_setBorder:function(el,n,_564){var _565=this._borderSize(n)+"px";var _566=(_564=="top"?this._whichSideTop():this._whichSideBottom());var _567=el.style;if(_566=="left"){_567.borderLeftWidth=_565;_567.borderRightWidth="0px"}else{if(_566=="right"){_567.borderRightWidth=_565;_567.borderLeftWidth="0px"}else{_567.borderLeftWidth=_565;_567.borderRightWidth=_565}}},_marginSize:function(n){if(this.isTransparent){return 0}
var o=this.options;if(o.compact&&o.blend){var _568=[1,0];return _568[n]}else{if(o.compact){var _569=[2,1];return _569[n]}else{if(o.blend){var _570=[3,2,1,0];return _570[n]}else{var _571=[5,3,2,1];return _571[n]}}}},_borderSize:function(n){var o=this.options;var _572;if(o.compact&&(o.blend||this.isTransparent)){return 1}else{if(o.compact){_572=[1,0]}else{if(o.blend){_572=[2,1,1,1]}else{if(o.border){_572=[0,2,0,0]}else{if(this.isTransparent){_572=[5,3,2,1]}else{return 0}}}}}
return _572[n]},_hasString:function(str){for(var i=1;i<arguments.length;i++){if(str.indexOf(arguments[i])!=-1){return true}}
return false},_isTopRounded:function(){return this._hasString(this.options.corners,"all","top","tl","tr")},_isBottomRounded:function(){return this._hasString(this.options.corners,"all","bottom","bl","br")},_hasSingleTextChild:function(el){return(el.childNodes.length==1&&el.childNodes[0].nodeType==3)}};MochiKit.Visual.roundElement=function(e,_573){new MochiKit.Visual._RoundCorners(e,_573)};MochiKit.Visual.roundClass=function(_574,_575,_576){var _577=MochiKit.DOM.getElementsByTagAndClassName(_574,_575);for(var i=0;i<_577.length;i++){MochiKit.Visual.roundElement(_577[i],_576)}};MochiKit.Visual.Color=MochiKit.Color.Color;MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle;MochiKit.Visual.__new__=function(){var m=MochiKit.Base;m.nameFunctions(this);this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}};MochiKit.Visual.EXPORT=["roundElement","roundClass"];MochiKit.Visual.EXPORT_OK=[];MochiKit.Visual.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Visual);if(typeof(MochiKit)=="undefined"){MochiKit={}}
if(typeof(MochiKit.MochiKit)=="undefined"){MochiKit.MochiKit={}}
MochiKit.MochiKit.NAME="MochiKit.MochiKit";MochiKit.MochiKit.VERSION="1.2";MochiKit.MochiKit.__repr__=function(){return "["+this.NAME+" "+this.VERSION+"]"};MochiKit.MochiKit.toString=function(){return this.__repr__()};MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Async","DOM","LoggingPane","Color","Visual"];if(typeof(JSAN)!="undefined"||typeof(dojo)!="undefined"){if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.MochiKit");dojo.require("MochiKit.*")}
if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit.Base",[]);JSAN.use("MochiKit.Iter",[]);JSAN.use("MochiKit.Logging",[]);JSAN.use("MochiKit.DateTime",[]);JSAN.use("MochiKit.Format",[]);JSAN.use("MochiKit.Async",[]);JSAN.use("MochiKit.DOM",[]);JSAN.use("MochiKit.LoggingPane",[]);JSAN.use("MochiKit.Color",[]);JSAN.use("MochiKit.Visual",[])}(function(){var _578=MochiKit.Base.extend;var self=MochiKit.MochiKit;var _579=self.SUBMODULES;var _580=[];var _581=[];var _582={};var i,k,m,all;for(i=0;i<_579.length;i++){m=MochiKit[_579[i]];_578(_580,m.EXPORT);_578(_581,m.EXPORT_OK);for(k in m.EXPORT_TAGS){_582[k]=_578(_582[k],m.EXPORT_TAGS[k])}
all=m.EXPORT_TAGS[":all"];if(!all){all=_578(null,m.EXPORT,m.EXPORT_OK)}
for(i=0;i<all.length;i++){k=all[i];self[k]=m[k]}}
self.EXPORT=_580;self.EXPORT_OK=_581;self.EXPORT_TAGS=_582}())}else{if(typeof(MochiKit.__compat__)=="undefined"){MochiKit.__compat__=true}(function(){var _583=document.getElementsByTagName("script");var _584="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";var base=null;var _585=null;var _586={};var i;for(i=0;i<_583.length;i++){var src=_583[i].getAttribute("src");if(!src){continue}
_586[src]=true;if(src.match(/MochiKit.js$/)){base=src.substring(0,src.lastIndexOf("MochiKit.js"));_585=_583[i]}}
if(base==null){return}
var _587=MochiKit.MochiKit.SUBMODULES;for(i=0;i<_587.length;i++){if(MochiKit[_587[i]]){continue}
var uri=base+_587[i]+".js";if(uri in _586){continue}
if(document.documentElement&&document.documentElement.namespaceURI==_584){var s=document.createElementNS(_584,"script");s.setAttribute("id","MochiKit_"+base+_587[i]);s.setAttribute("src",uri);s.setAttribute("type","application/x-javascript");_585.parentNode.appendChild(s)}else{var tag="<"+"script src=\""+uri+"\" type=\"text/javascript\""+">"+"<"+"/script"+">";document.write(tag)}}})()}


/* - ++resource++prototype.js - */
// http://www.naec.org.uk/portal_javascripts/++resource++prototype.js?original=1
var Prototype={Version:'1.5.0_rc1',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(destination,source){for(var property in source){destination[property]=source[property]}
return destination}
Object.extend(Object,{inspect: function(object){try{if(object===undefined) return 'undefined';if(object===null) return 'null';return object.inspect?object.inspect():object.toString()} catch(e){if(e instanceof RangeError) return '...';throw e}},keys: function(object){var keys=[];for(var property in object)
keys.push(property);return keys},values: function(object){var values=[];for(var property in object)
values.push(object[property]);return values},clone: function(object){return Object.extend({},object)}});Function.prototype.bind=function(){var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)))}}
Function.prototype.bindAsEventListener=function(object){var __method=this,args=$A(arguments),object=args.shift();return function(event){return __method.apply(object,[(event||window.event)].concat(args).concat($A(arguments)))}}
Object.extend(Number.prototype,{toColorPart: function(){var digits=this.toString(16);if(this<16) return '0'+digits;return digits},succ: function(){return this+1},times: function(iterator){$R(0,this,true).each(iterator);return this}});var Try={these: function(){var returnValue;for(var i=0;i<arguments.length;i++){var lambda=arguments[i];try{returnValue=lambda();break} catch(e){}}
return returnValue}}
var PeriodicalExecuter=Class.create();PeriodicalExecuter.prototype={initialize: function(callback,frequency){this.callback=callback;this.frequency=frequency;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}}}}
Object.extend(String.prototype,{gsub: function(pattern,replacement){var result='',source=this,match;replacement=arguments.callee.prepareReplacement(replacement);while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=(replacement(match)||'').toString();source=source.slice(match.index+match[0].length)} else{result+=source,source=''}}
return result},sub: function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern, function(match){if(--count<0) return match[0];return replacement(match)})},scan: function(pattern,iterator){this.gsub(pattern,iterator);return this},truncate: function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation: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 matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1]})},evalScripts: function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML: function(){var div=document.createElement('div');var text=document.createTextNode(this);div.appendChild(text);return div.innerHTML},unescapeHTML: function(){var div=document.createElement('div');div.innerHTML=this.stripTags();return div.childNodes[0]?div.childNodes[0].nodeValue:''},toQueryParams: function(){var match=this.strip().match(/[^?]*$/)[0];if(!match) return{};var pairs=match.split('&');return pairs.inject({}, function(params,pairString){var pair=pairString.split('=');var value=pair[1]?decodeURIComponent(pair[1]):undefined;params[decodeURIComponent(pair[0])]=value;return params})},toArray: function(){return this.split('')},camelize: function(){var oStringList=this.split('-');if(oStringList.length==1) return oStringList[0];var camelizedString=this.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,length=oStringList.length;i<length;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1)}
return camelizedString},inspect: function(useDoubleQuotes){var escapedString=this.replace(/\\/g,'\\\\');if(useDoubleQuotes)
return '"'+escapedString.replace(/"/g, '\\"') + '"';else
return "'"+escapedString.replace(/'/g, '\\\'')+"'"}});String.prototype.gsub.prepareReplacement=function(replacement){if(typeof replacement=='function') return replacement;var template=new Template(replacement);return function(match){return template.evaluate(match)}}
String.prototype.parseQuery=String.prototype.toQueryParams;var Template=Class.create();Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;Template.prototype={initialize: function(template,pattern){this.template=template.toString();this.pattern=pattern||Template.Pattern},evaluate: function(object){return this.template.gsub(this.pattern, function(match){var before=match[1];if(before=='\\') return match[2];return before+(object[match[3]]||'').toString()})}}
var $break=new Object();var $continue=new Object();var Enumerable={each: function(iterator){var index=0;try{this._each(function(value){try{iterator(value,index++)} catch(e){if(e!=$continue) throw e}})} catch(e){if(e!=$break) throw e}
return this},eachSlice: function(number,iterator){var index=-number,slices=[],array=this.toArray();while((index+=number)<array.length)
slices.push(array.slice(index,index+number));return slices.collect(iterator||Prototype.K)},all: function(iterator){var result=true;this.each(function(value,index){result=result&&!!(iterator||Prototype.K)(value,index);if(!result) throw $break});return result},any: function(iterator){var result=false;this.each(function(value,index){if(result=!!(iterator||Prototype.K)(value,index))
throw $break});return result},collect: function(iterator){var results=[];this.each(function(value,index){results.push(iterator(value,index))});return results},detect: function(iterator){var result;this.each(function(value,index){if(iterator(value,index)){result=value;throw $break}});return result},findAll: function(iterator){var results=[];this.each(function(value,index){if(iterator(value,index))
results.push(value)});return results},grep: function(pattern,iterator){var results=[];this.each(function(value,index){var stringValue=value.toString();if(stringValue.match(pattern))
results.push((iterator||Prototype.K)(value,index))})
return results},include: function(object){var found=false;this.each(function(value){if(value==object){found=true;throw $break}});return found},inGroupsOf: function(number,fillWith){fillWith=fillWith||null;var results=this.eachSlice(number);if(results.length>0)(number-results.last().length).times(function(){results.last().push(fillWith)});return results},inject: function(memo,iterator){this.each(function(value,index){memo=iterator(memo,value,index)});return memo},invoke: function(method){var args=$A(arguments).slice(1);return this.collect(function(value){return value[method].apply(value,args)})},max: function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value>=result)
result=value});return result},min: function(iterator){var result;this.each(function(value,index){value=(iterator||Prototype.K)(value,index);if(result==undefined||value<result)
result=value});return result},partition: function(iterator){var trues=[],falses=[];this.each(function(value,index){((iterator||Prototype.K)(value,index)?trues:falses).push(value)});return [trues,falses]},pluck: function(property){var results=[];this.each(function(value,index){results.push(value[property])});return results},reject: function(iterator){var results=[];this.each(function(value,index){if(!iterator(value,index))
results.push(value)});return results},sortBy: function(iterator){return this.collect(function(value,index){return{value:value,criteria:iterator(value,index)}}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0}).pluck('value')},toArray: function(){return this.collect(Prototype.K)},zip: function(){var iterator=Prototype.K,args=$A(arguments);if(typeof args.last()=='function')
iterator=args.pop();var collections=[this].concat(args).map($A);return this.map(function(value,index){return iterator(collections.pluck(index))})},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(iterable){if(!iterable) return [];if(iterable.toArray){return iterable.toArray()} else{var results=[];for(var i=0,length=iterable.length;i<length;i++)
results.push(iterable[i]);return results}}
Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)
Array.prototype._reverse=Array.prototype.reverse;Object.extend(Array.prototype,{_each: function(iterator){for(var i=0,length=this.length;i<length;i++)
iterator(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(value){return value!=undefined||value!=null})},flatten: function(){return this.inject([], function(array,value){return array.concat(value&&value.constructor==Array?value.flatten():[value])})},without: function(){var values=$A(arguments);return this.select(function(value){return!values.include(value)})},indexOf: function(object){for(var i=0,length=this.length;i<length;i++)
if(this[i]==object) return i;return-1},reverse: function(inline){return(inline!==false?this:this.toArray())._reverse()},reduce: function(){return this.length>1?this:this[0]},uniq: function(){return this.inject([], function(array,value){return array.include(value)?array:array.concat([value])})},clone: function(){return [].concat(this)},inspect: function(){return '['+this.map(Object.inspect).join(', ')+']'}});Array.prototype.toArray=Array.prototype.clone;var Hash={_each: function(iterator){for(var key in this){var value=this[key];if(typeof value=='function') continue;var pair=[key,value];pair.key=key;pair.value=value;iterator(pair)}},keys: function(){return this.pluck('key')},values: function(){return this.pluck('value')},merge: function(hash){return $H(hash).inject(this, function(mergedHash,pair){mergedHash[pair.key]=pair.value;return mergedHash})},toQueryString: function(){return this.map(function(pair){if(!pair.value&&pair.value!==0) pair[1]='';if(!pair.key) return;return pair.map(encodeURIComponent).join('=')}).join('&')},inspect: function(){return '#<Hash:{'+this.map(function(pair){return pair.map(Object.inspect).join(': ')}).join(', ')+'}>'}}
function $H(object){var hash=Object.extend({},object||{});Object.extend(hash,Enumerable);Object.extend(hash,Hash);return hash}
ObjectRange=Class.create();Object.extend(ObjectRange.prototype,Enumerable);Object.extend(ObjectRange.prototype,{initialize: function(start,end,exclusive){this.start=start;this.end=end;this.exclusive=exclusive},_each: function(iterator){var value=this.start;while(this.include(value)){iterator(value);value=value.succ()}},include: function(value){if(value<this.start)
return false;if(this.exclusive)
return value<this.end;return value<=this.end}});var $R=function(start,end,exclusive){return new ObjectRange(start,end,exclusive)}
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(iterator){this.responders._each(iterator)},register: function(responder){if(!this.include(responder))
this.responders.push(responder)},unregister: function(responder){this.responders=this.responders.without(responder)},dispatch: function(callback,request,transport,json){this.each(function(responder){if(typeof responder[callback]=='function'){try{responder[callback].apply(responder,[request,transport,json])} 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(options){this.options={method:'post',asynchronous:true,contentType:'application/x-www-form-urlencoded',encoding:'UTF-8',parameters:''}
Object.extend(this.options,options||{});this.options.method=this.options.method.toLowerCase();this.options.parameters=$H(typeof this.options.parameters=='string'?this.options.parameters.toQueryParams():this.options.parameters)}}
Ajax.Request=Class.create();Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];Ajax.Request.prototype=Object.extend(new Ajax.Base(),{initialize: function(url,options){this.transport=Ajax.getTransport();this.setOptions(options);this.request(url)},request: function(url){var params=this.options.parameters;if(params.any()) params['_']='';if(!['get','post'].include(this.options.method)){params['_method']=this.options.method;this.options.method='post'}
this.url=url;if(this.options.method=='get'&&params.any())
this.url+=(this.url.indexOf('?')>=0?'&':'?')+params.toQueryString();try{Ajax.Responders.dispatch('onCreate',this,this.transport);this.transport.open(this.options.method.toUpperCase(),this.url,this.options.asynchronous,this.options.username,this.options.password);if(this.options.asynchronous)
setTimeout(function(){this.respondToReadyState(1)}.bind(this),10);this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();var body=this.options.method=='post'?(this.options.postBody||params.toQueryString()):null;this.transport.send(body);if(!this.options.asynchronous&&this.transport.overrideMimeType)
this.onStateChange()}
catch(e){this.dispatchException(e)}},onStateChange: function(){var readyState=this.transport.readyState;if(readyState>1)
this.respondToReadyState(this.transport.readyState)},setRequestHeaders: function(){var headers={'X-Requested-With':'XMLHttpRequest','X-Prototype-Version':Prototype.Version,'Accept':'text/javascript, text/html, application/xml, text/xml, */*'};if(this.options.method=='post'){headers['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)
headers['Connection']='close'}
if(typeof this.options.requestHeaders=='object'){var extras=this.options.requestHeaders;if(typeof extras.push=='function')
for(var i=0;i<extras.length;i+=2)
headers[extras[i]]=extras[i+1];else
$H(extras).each(function(pair){headers[pair.key]=pair.value})}
for(var name in headers)
this.transport.setRequestHeader(name,headers[name])},success: function(){return!this.transport.status||(this.transport.status>=200&&this.transport.status<300)},respondToReadyState: function(readyState){var state=Ajax.Request.Events[readyState];var transport=this.transport,json=this.evalJSON();if(state=='Complete'){try{(this.options['on'+this.transport.status]||this.options['on'+(this.success()?'Success':'Failure')]||Prototype.emptyFunction)(transport,json)} catch(e){this.dispatchException(e)}}
try{(this.options['on'+state]||Prototype.emptyFunction)(transport,json);Ajax.Responders.dispatch('on'+state,this,transport,json)} catch(e){this.dispatchException(e)}
if(state=='Complete'){if((this.getHeader('Content-type')||'').strip().
match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
this.evalResponse();this.transport.onreadystatechange=Prototype.emptyFunction}},getHeader: function(name){try{return this.transport.getResponseHeader(name)} catch(e){return null}},evalJSON: function(){try{var json=this.getHeader('X-JSON');return json?eval('('+json+')'):null} catch(e){return null}},evalResponse: function(){try{return eval(this.transport.responseText)} catch(e){this.dispatchException(e)}},dispatchException: function(exception){(this.options.onException||Prototype.emptyFunction)(this,exception);Ajax.Responders.dispatch('onException',this,exception)}});Ajax.Updater=Class.create();Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize: function(container,url,options){this.container={success:(container.success||container),failure:(container.failure||(container.success?null:container))}
this.transport=Ajax.getTransport();this.setOptions(options);var onComplete=this.options.onComplete||Prototype.emptyFunction;this.options.onComplete=(function(transport,param){this.updateContent();onComplete(transport,param)}).bind(this);this.request(url)},updateContent: function(){var receiver=this.container[this.success()?'success':'failure'];var response=this.transport.responseText;if(!this.options.evalScripts) response=response.stripScripts();if(receiver=$(receiver)){if(this.options.insertion)
new this.options.insertion(receiver,response);else
receiver.update(response)}
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(container,url,options){this.setOptions(options);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=container;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(request){if(this.options.decay){this.decay=(request.responseText==this.lastText?this.decay * this.options.decay:1);this.lastText=request.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 $(element){if(arguments.length>1){for(var i=0,elements=[],length=arguments.length;i<length;i++)
elements.push($(arguments[i]));return elements}
if(typeof element=='string')
element=document.getElementById(element);return Element.extend(element)}
if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(expression,parentElement){var results=[];var query=document.evaluate(expression,$(parentElement)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,len=query.snapshotLength;i<len;i++)
results.push(query.snapshotItem(i));return results}}
document.getElementsByClassName=function(className,parentElement){if(Prototype.BrowserFeatures.XPath){var q=".//*[contains(concat(' ', @class, ' '), ' "+className+" ')]";return document._getElementsByXPath(q,parentElement)} else{var children=($(parentElement)||document.body).getElementsByTagName('*');var elements=[],child;for(var i=0,length=children.length;i<length;i++){child=children[i];if(Element.hasClassName(child,className))
elements.push(Element.extend(child))}
return elements}}
if(!window.Element)
var Element=new Object();Element.extend=function(element){if(!element) return;if(_nativeExtensions||element.nodeType==3) return element;if(!element._extended&&element.tagName&&element!=window){var methods=Object.clone(Element.Methods),cache=Element.extend.cache;if(element.tagName=='FORM')
Object.extend(methods,Form.Methods);if(['INPUT','TEXTAREA','SELECT'].include(element.tagName))
Object.extend(methods,Form.Element.Methods);for(var property in methods){var value=methods[property];if(typeof value=='function')
element[property]=cache.findOrStore(value)}
var methods=Object.clone(Element.Methods.Simulated),cache=Element.extend.cache;for(var property in methods){var value=methods[property];if('function'==typeof value&&!(property in element))
element[property]=cache.findOrStore(value)}}
element._extended=true;return element}
Element.extend.cache={findOrStore: function(value){return this[value]=this[value]|| function(){return value.apply(null,[this].concat($A(arguments)))}}}
Element.Methods={visible: function(element){return $(element).style.display!='none'},toggle: function(element){element=$(element);Element[Element.visible(element)?'hide':'show'](element);return element},hide: function(element){$(element).style.display='none';return element},show: function(element){$(element).style.display='';return element},remove: function(element){element=$(element);element.parentNode.removeChild(element);return element},update: function(element,html){html=typeof html=='undefined'?'':html.toString();$(element).innerHTML=html.stripScripts();setTimeout(function(){html.evalScripts()},10);return element},replace: function(element,html){element=$(element);if(element.outerHTML){element.outerHTML=html.stripScripts()} else{var range=element.ownerDocument.createRange();range.selectNodeContents(element);element.parentNode.replaceChild(range.createContextualFragment(html.stripScripts()),element)}
setTimeout(function(){html.evalScripts()},10);return element},inspect: function(element){element=$(element);var result='<'+element.tagName.toLowerCase();$H({'id':'id','className':'class'}).each(function(pair){var property=pair.first(),attribute=pair.last();var value=(element[property]||'').toString();if(value) result+=' '+attribute+'='+value.inspect(true)});return result+'>'},recursivelyCollect: function(element,property){element=$(element);var elements=[];while(element=element[property])
if(element.nodeType==1)
elements.push(Element.extend(element));return elements},ancestors: function(element){return $(element).recursivelyCollect('parentNode')},descendants: function(element){element=$(element);return $A(element.getElementsByTagName('*'))},previousSiblings: function(element){return $(element).recursivelyCollect('previousSibling')},nextSiblings: function(element){return $(element).recursivelyCollect('nextSibling')},siblings: function(element){element=$(element);return element.previousSiblings().reverse().concat(element.nextSiblings())},match: function(element,selector){element=$(element);if(typeof selector=='string')
selector=new Selector(selector);return selector.match(element)},up: function(element,expression,index){return Selector.findElement($(element).ancestors(),expression,index)},down: function(element,expression,index){return Selector.findElement($(element).descendants(),expression,index)},previous: function(element,expression,index){return Selector.findElement($(element).previousSiblings(),expression,index)},next: function(element,expression,index){return Selector.findElement($(element).nextSiblings(),expression,index)},getElementsBySelector: function(){var args=$A(arguments),element=$(args.shift());return Selector.findChildElements(element,args)},getElementsByClassName: function(element,className){element=$(element);return document.getElementsByClassName(className,element)},getHeight: function(element){element=$(element);return element.offsetHeight},classNames: function(element){return new Element.ClassNames(element)},hasClassName: function(element,className){if(!(element=$(element))) return;var elementClassName=element.className;if(elementClassName.length==0) return false;if(elementClassName==className||elementClassName.match(new RegExp("(^|\\s)"+className+"(\\s|$)")))
return true;return false},addClassName: function(element,className){if(!(element=$(element))) return;Element.classNames(element).add(className);return element},removeClassName: function(element,className){if(!(element=$(element))) return;Element.classNames(element).remove(className);return element},observe: function(){Event.observe.apply(Event,arguments);return $A(arguments).first()},stopObserving: function(){Event.stopObserving.apply(Event,arguments);return $A(arguments).first()},cleanWhitespace: function(element){element=$(element);var node=element.firstChild;while(node){var nextNode=node.nextSibling;if(node.nodeType==3&&!/\S/.test(node.nodeValue))
element.removeChild(node);node=nextNode}
return element},empty: function(element){return $(element).innerHTML.match(/^\s*$/)},childOf: function(element,ancestor){element=$(element),ancestor=$(ancestor);while(element=element.parentNode)
if(element==ancestor) return true;return false},scrollTo: function(element){element=$(element);var x=element.x?element.x:element.offsetLeft,y=element.y?element.y:element.offsetTop;window.scrollTo(x,y);return element},getStyle: function(element,style){element=$(element);var value=element.style[style.camelize()];if(!value){if(document.defaultView&&document.defaultView.getComputedStyle){var css=document.defaultView.getComputedStyle(element,null);value=css?css.getPropertyValue(style):null} else if(element.currentStyle){value=element.currentStyle[style.camelize()]}}
if(window.opera&&['left','top','right','bottom'].include(style))
if(Element.getStyle(element,'position')=='static') value='auto';return value=='auto'?null:value},setStyle: function(element,style){element=$(element);for(var name in style)
element.style[name.camelize()]=style[name];return element},getDimensions: function(element){element=$(element);if(Element.getStyle(element,'display')!='none')
return{width:element.offsetWidth,height:element.offsetHeight};var els=element.style;var originalVisibility=els.visibility;var originalPosition=els.position;els.visibility='hidden';els.position='absolute';els.display='';var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;els.display='none';els.position=originalPosition;els.visibility=originalVisibility;return{width:originalWidth,height:originalHeight}},makePositioned: function(element){element=$(element);var pos=Element.getStyle(element,'position');if(pos=='static'||!pos){element._madePositioned=true;element.style.position='relative';if(window.opera){element.style.top=0;element.style.left=0}}
return element},undoPositioned: function(element){element=$(element);if(element._madePositioned){element._madePositioned=undefined;element.style.position=element.style.top=element.style.left=element.style.bottom=element.style.right=''}
return element},makeClipping: function(element){element=$(element);if(element._overflow) return element;element._overflow=element.style.overflow||'auto';if((Element.getStyle(element,'overflow')||'visible')!='hidden')
element.style.overflow='hidden';return element},undoClipping: function(element){element=$(element);if(!element._overflow) return element;element.style.overflow=element._overflow=='auto'?'':element._overflow;element._overflow=null;return element}}
Element.Methods.Simulated={hasAttribute: function(element,attribute){return $(element).getAttributeNode(attribute).specified}}
if(document.all){Element.Methods.update=function(element,html){element=$(element);html=typeof html=='undefined'?'':html.toString();var tagName=element.tagName.toUpperCase();if(['THEAD','TBODY','TR','TD'].indexOf(tagName)>-1){var div=document.createElement('div');switch(tagName){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(element.childNodes).each(function(node){element.removeChild(node)});depth.times(function(){div=div.firstChild});$A(div.childNodes).each(
function(node){element.appendChild(node)})} else{element.innerHTML=html.stripScripts()}
setTimeout(function(){html.evalScripts()},10);return element}}
Object.extend(Element,Element.Methods);var _nativeExtensions=false;if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
['','Form','Input','TextArea','Select'].each(function(tag){var className='HTML'+tag+'Element';if(window[className]) return;var klass=window[className]={};klass.prototype=document.createElement(tag?tag.toLowerCase():'div').__proto__});Element.addMethods=function(methods){Object.extend(Element.Methods,methods||{});
function copy(methods,destination,onlyIfAbsent){onlyIfAbsent=onlyIfAbsent||false;var cache=Element.extend.cache;for(var property in methods){var value=methods[property];if(!onlyIfAbsent||!(property in destination))
destination[property]=cache.findOrStore(value)}}
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(klass){copy(Form.Element.Methods,klass.prototype)});_nativeExtensions=true}}
var Toggle=new Object();Toggle.display=Element.toggle;Abstract.Insertion=function(adjacency){this.adjacency=adjacency}
Abstract.Insertion.prototype={initialize: function(element,content){this.element=$(element);this.content=content.stripScripts();if(this.adjacency&&this.element.insertAdjacentHTML){try{this.element.insertAdjacentHTML(this.adjacency,this.content)} catch(e){var tagName=this.element.tagName.toLowerCase();if(tagName=='tbody'||tagName=='tr'){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(){content.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(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,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(fragments){fragments.reverse(false).each((function(fragment){this.element.insertBefore(fragment,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(fragments){fragments.each((function(fragment){this.element.appendChild(fragment)}).bind(this))}});Insertion.After=Class.create();Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{initializeRange: function(){this.range.setStartAfter(this.element)},insertContent: function(fragments){fragments.each((function(fragment){this.element.parentNode.insertBefore(fragment,this.element.nextSibling)}).bind(this))}});Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize: function(element){this.element=$(element)},_each: function(iterator){this.element.className.split(/\s+/).select(function(name){return name.length>0})._each(iterator)},set: function(className){this.element.className=className},add: function(classNameToAdd){if(this.include(classNameToAdd)) return;this.set($A(this).concat(classNameToAdd).join(' '))},remove: function(classNameToRemove){if(!this.include(classNameToRemove)) return;this.set($A(this).without(classNameToRemove).join(' '))},toString: function(){return $A(this).join(' ')}}
Object.extend(Element.ClassNames.prototype,Enumerable);var Selector=Class.create();Selector.prototype={initialize: function(expression){this.params={classNames:[]};this.expression=expression.toString().strip();this.parseExpression();this.compileMatcher()},parseExpression: function(){
function abort(message){throw 'Parse error in selector: '+message}
if(this.expression=='') abort('empty expression');var params=this.params,expr=this.expression,match,modifier,clause,rest;while(match=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){params.attributes=params.attributes||[];params.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 '#':params.id=clause;break;case '.':params.classNames.push(clause);break;case '':case undefined:params.tagName=clause.toUpperCase();break;default:abort(expr.inspect())}
expr=rest}
if(expr.length>0) abort(expr.inspect())},buildMatchExpression: function(){var params=this.params,conditions=[],clause;if(params.wildcard)
conditions.push('true');if(clause=params.id)
conditions.push('element.id == '+clause.inspect());if(clause=params.tagName)
conditions.push('element.tagName.toUpperCase() == '+clause.inspect());if((clause=params.classNames).length>0)
for(var i=0;i<clause.length;i++)
conditions.push('Element.hasClassName(element, '+clause[i].inspect()+')');if(clause=params.attributes){clause.each(function(attribute){var value='element.getAttribute('+attribute.name.inspect()+')';var splitValueBy=function(delimiter){return value+' && '+value+'.split('+delimiter.inspect()+')'}
switch(attribute.operator){case '=':conditions.push(value+' == '+attribute.value.inspect());break;case '~=':conditions.push(splitValueBy(' ')+'.include('+attribute.value.inspect()+')');break;case '|=':conditions.push(splitValueBy('-')+'.first().toUpperCase() == '+attribute.value.toUpperCase().inspect());break;case '!=':conditions.push(value+' != '+attribute.value.inspect());break;case '':case undefined:conditions.push(value+' != null');break;default:throw 'Unknown operator '+attribute.operator+' in selector'}})}
return conditions.join(' && ')},compileMatcher: function(){this.match=new Function('element','if(!element.tagName) return false;\
return '+this.buildMatchExpression())},findElements: function(scope){var element;if(element=$(this.params.id))
if(this.match(element))
if(!scope||Element.childOf(element,scope))
return [element];scope=(scope||document).getElementsByTagName(this.params.tagName||'*');var results=[];for(var i=0,length=scope.length;i<length;i++)
if(this.match(element=scope[i]))
results.push(Element.extend(element));return results},toString: function(){return this.expression}}
Object.extend(Selector,{matchElements: function(elements,expression){var selector=new Selector(expression);return elements.select(selector.match.bind(selector)).collect(Element.extend)},findElement: function(elements,expression,index){if(typeof expression=='number') index=expression,expression=false;return Selector.matchElements(elements,expression||'*')[index||0]},findChildElements: function(element,expressions){return expressions.map(function(expression){return expression.strip().split(/\s+/).inject([null], function(results,expr){var selector=new Selector(expr);return results.inject([], function(elements,result){return elements.concat(selector.findElements(result||element))})})}).flatten()}});
function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset: function(form){$(form).reset();return form},serializeElements: function(elements){return elements.inject([], function(queryComponents,element){var queryComponent=Form.Element.serialize(element);if(queryComponent) queryComponents.push(queryComponent);return queryComponents}).join('&')}};Form.Methods={serialize: function(form){return Form.serializeElements($(form).getElements())},getElements: function(form){return $A($(form).getElementsByTagName('*')).inject([],
function(elements,child){if(Form.Element.Serializers[child.tagName.toLowerCase()])
elements.push(Element.extend(child));return elements})},getInputs: function(form,typeName,name){form=$(form);var inputs=form.getElementsByTagName('input');if(!typeName&&!name)
return inputs;var matchingInputs=new Array();for(var i=0,length=inputs.length;i<length;i++){var input=inputs[i];if((typeName&&input.type!=typeName)||(name&&input.name!=name))
continue;matchingInputs.push(Element.extend(input))}
return matchingInputs},disable: function(form){form=$(form);form.getElements().each(function(element){element.blur();element.disabled='true'});return form},enable: function(form){form=$(form);form.getElements().each(function(element){element.disabled=''});return form},findFirstElement: function(form){return $(form).getElements().find(function(element){return element.type!='hidden'&&!element.disabled&&['input','select','textarea'].include(element.tagName.toLowerCase())})},focusFirstElement: function(form){form=$(form);form.findFirstElement().activate();return form}}
Object.extend(Form,Form.Methods);Form.Element={focus: function(element){$(element).focus();return element},select: function(element){$(element).select();return element}}
Form.Element.Methods={serialize: function(element){element=$(element);if(element.disabled) return '';var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter){var key=encodeURIComponent(parameter[0]);if(key.length==0) return;if(parameter[1].constructor!=Array)
parameter[1]=[parameter[1]];return parameter[1].map(function(value){return key+'='+encodeURIComponent(value)}).join('&')}},getValue: function(element){element=$(element);var method=element.tagName.toLowerCase();var parameter=Form.Element.Serializers[method](element);if(parameter)
return parameter[1]},clear: function(element){$(element).value='';return element},present: function(element){return $(element).value!=''},activate: function(element){element=$(element);element.focus();if(element.select)
element.select();return element},disable: function(element){element=$(element);element.disabled=true;return element},enable: function(element){element=$(element);element.blur();element.disabled=false;return element}}
Object.extend(Form.Element,Form.Element.Methods);var Field=Form.Element;Form.Element.Serializers={input: function(element){switch(element.type.toLowerCase()){case 'checkbox':case 'radio':return Form.Element.Serializers.inputSelector(element);default:return Form.Element.Serializers.textarea(element)}
return false},inputSelector: function(element){if(element.checked)
return [element.name,element.value]},textarea: function(element){return [element.name,element.value]},select: function(element){return Form.Element.Serializers[element.type=='select-one'?'selectOne':'selectMany'](element)},selectOne: function(element){var value='',opt,index=element.selectedIndex;if(index>=0){opt=Element.extend(element.options[index]);value=opt.hasAttribute('value')?opt.value:opt.text}
return [element.name,value]},selectMany: function(element){var value=[];for(var i=0;i<element.length;i++){var opt=Element.extend(element.options[i]);if(opt.selected)
value.push(opt.hasAttribute('value')?opt.value:opt.text)}
return [element.name,value]}}
var $F=Form.Element.getValue;Abstract.TimedObserver=function(){}
Abstract.TimedObserver.prototype={initialize: function(element,frequency,callback){this.frequency=frequency;this.element=$(element);this.callback=callback;this.lastValue=this.getValue();this.registerCallback()},registerCallback: function(){setInterval(this.onTimerEvent.bind(this),this.frequency * 1000)},onTimerEvent: function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value}}}
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(element,callback){this.element=$(element);this.callback=callback;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=='form')
this.registerFormCallbacks();else
this.registerCallback(this.element)},onElementEvent: function(){var value=this.getValue();if(this.lastValue!=value){this.callback(this.element,value);this.lastValue=value}},registerFormCallbacks: function(){Form.getElements(this.element).each(this.registerCallback.bind(this))},registerCallback: function(element){if(element.type){switch(element.type.toLowerCase()){case 'checkbox':case 'radio':Event.observe(element,'click',this.onElementEvent.bind(this));break;default:Event.observe(element,'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(event){return event.target||event.srcElement},isLeftClick: function(event){return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)))},pointerX: function(event){return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))},pointerY: function(event){return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))},stop: function(event){if(event.preventDefault){event.preventDefault();event.stopPropagation()} else{event.returnValue=false;event.cancelBubble=true}},findElement: function(event,tagName){var element=Event.element(event);while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
element=element.parentNode;return element},observers:false,_observeAndCache: function(element,name,observer,useCapture){if(!this.observers) this.observers=[];if(element.addEventListener){this.observers.push([element,name,observer,useCapture]);element.addEventListener(name,observer,useCapture)} else if(element.attachEvent){this.observers.push([element,name,observer,useCapture]);element.attachEvent('on'+name,observer)}},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(element,name,observer,useCapture){element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.attachEvent))
name='keydown';Event._observeAndCache(element,name,observer,useCapture)},stopObserving: function(element,name,observer,useCapture){element=$(element);useCapture=useCapture||false;if(name=='keypress'&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||element.detachEvent))
name='keydown';if(element.removeEventListener){element.removeEventListener(name,observer,useCapture)} else if(element.detachEvent){try{element.detachEvent('on'+name,observer)} 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(element){var valueT=0,valueL=0;do{valueT+=element.scrollTop||0;valueL+=element.scrollLeft||0;element=element.parentNode} while(element);return [valueL,valueT]},cumulativeOffset: function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent} while(element);return [valueL,valueT]},positionedOffset: function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;if(element){if(element.tagName=='BODY') break;var p=Element.getStyle(element,'position');if(p=='relative'||p=='absolute') break}} while(element);return [valueL,valueT]},offsetParent: function(element){if(element.offsetParent) return element.offsetParent;if(element==document.body) return element;while((element=element.parentNode)&&element!=document.body)
if(Element.getStyle(element,'position')!='static')
return element;return document.body},within: function(element,x,y){if(this.includeScrollOffsets)
return this.withinIncludingScrolloffsets(element,x,y);this.xcomp=x;this.ycomp=y;this.offset=this.cumulativeOffset(element);return(y>=this.offset[1]&&y<this.offset[1]+element.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+element.offsetWidth)},withinIncludingScrolloffsets: function(element,x,y){var offsetcache=this.realOffset(element);this.xcomp=x+offsetcache[0]-this.deltaX;this.ycomp=y+offsetcache[1]-this.deltaY;this.offset=this.cumulativeOffset(element);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+element.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+element.offsetWidth)},overlap: function(mode,element){if(!mode) return 0;if(mode=='vertical')
return((this.offset[1]+element.offsetHeight)-this.ycomp)/element.offsetHeight;if(mode=='horizontal')
return((this.offset[0]+element.offsetWidth)-this.xcomp)/element.offsetWidth},page: function(forElement){var valueT=0,valueL=0;var element=forElement;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute') break} while(element=element.offsetParent);element=forElement;do{if(!window.opera||element.tagName=='BODY'){valueT-=element.scrollTop||0;valueL-=element.scrollLeft||0}} while(element=element.parentNode);return [valueL,valueT]},clone: function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{})
source=$(source);var p=Position.page(source);target=$(target);var delta=[0,0];var parent=null;if(Element.getStyle(target,'position')=='absolute'){parent=Position.offsetParent(target);delta=Position.page(parent)}
if(parent==document.body){delta[0]-=document.body.offsetLeft;delta[1]-=document.body.offsetTop}
if(options.setLeft) target.style.left=(p[0]-delta[0]+options.offsetLeft)+'px';if(options.setTop) target.style.top=(p[1]-delta[1]+options.offsetTop)+'px';if(options.setWidth) target.style.width=source.offsetWidth+'px';if(options.setHeight) target.style.height=source.offsetHeight+'px'},absolutize: function(element){element=$(element);if(element.style.position=='absolute') return;Position.prepare();var offsets=Position.positionedOffset(element);var top=offsets[1];var left=offsets[0];var width=element.clientWidth;var height=element.clientHeight;element._originalLeft=left-parseFloat(element.style.left||0);element._originalTop=top-parseFloat(element.style.top||0);element._originalWidth=element.style.width;element._originalHeight=element.style.height;element.style.position='absolute';element.style.top=top+'px';element.style.left=left+'px';element.style.width=width+'px';element.style.height=height+'px'},relativize: function(element){element=$(element);if(element.style.position=='relative') return;Position.prepare();element.style.position='relative';var top=parseFloat(element.style.top||0)-(element._originalTop||0);var left=parseFloat(element.style.left||0)-(element._originalLeft||0);element.style.top=top+'px';element.style.left=left+'px';element.style.height=element._originalHeight;element.style.width=element._originalWidth}}
if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)){Position.cumulativeOffset=function(element){var valueT=0,valueL=0;do{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;if(element.offsetParent==document.body)
if(Element.getStyle(element,'position')=='absolute') break;element=element.offsetParent} while(element);return [valueL,valueT]}}
Element.addMethods();

/* - ++resource++effects.js - */
// http://www.naec.org.uk/portal_javascripts/++resource++effects.js?original=1
String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()} while(++i<3)} else{if(this.slice(0,1)=='#'){if(this.length==4) for(var i=1;i<4;i++) color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7) color=this.toLowerCase()}}
return(color.length==7?color:(arguments[0]||this))}
Element.collectTextNodes=function(element){return $A($(element).childNodes).collect( function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''))}).flatten().join('')}
Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect( function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''))}).flatten().join('')}
Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);return element}
Element.getOpacity=function(element){element=$(element);var opacity;if(opacity=element.getStyle('opacity'))
return parseFloat(opacity);if(opacity=(element.getStyle('filter')||'').match(/alpha\(opacity=(.*)\)/))
if(opacity[1]) return parseFloat(opacity[1])/100;return 1.0}
Element.setOpacity=function(element,value){element=$(element);if(value==1){element.setStyle({opacity:(/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1.0});if(/MSIE/.test(navigator.userAgent)&&!window.opera)
element.setStyle({filter:Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')})} else{if(value<0.00001) value=0;element.setStyle({opacity:value});if(/MSIE/.test(navigator.userAgent)&&!window.opera)
element.setStyle({filter:element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'')+'alpha(opacity='+value*100+')'})}
return element}
Element.getInlineOpacity=function(element){return $(element).style.opacity||''}
Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n)} catch(e){}};Array.prototype.call=function(){var args=arguments;this.each(function(f){f.apply(this,args)})}
var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},tagifyText: function(element){if(typeof Builder=='undefined')
throw("Effect.tagifyText requires including script.aculo.us' builder.js library");var tagifyStyle='position:relative';if(/MSIE/.test(navigator.userAgent)&&!window.opera) tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each( function(child){if(child.nodeType==3){child.nodeValue.toArray().each( function(character){element.insertBefore(Builder.node('span',{style:tagifyStyle},character==' '?String.fromCharCode(160):character),child)});Element.remove(child)}})},multiple: function(element,effect){var elements;if(((typeof element=='object')||(typeof element=='function'))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each( function(element,index){new effect(element,Object.extend(options,{delay:index * options.speed+masterDelay}))})},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle: function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options)}};var Effect2=Effect;Effect.Transitions={linear:Prototype.K,sinoidal: function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5},reverse: function(pos){return 1-pos},flicker: function(pos){return((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4},wobble: function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5},pulse: function(pos,pulses){pulses=pulses||5;return(Math.round((pos%(1/pulses)) * pulses)==0?((pos * pulses * 2)-Math.floor(pos * pulses * 2)):1-((pos * pulses * 2)-Math.floor(pos * pulses * 2)))},none: function(pos){return 0},full: function(pos){return 1}};Effect.ScopedQueue=Class.create();Object.extend(Object.extend(Effect.ScopedQueue.prototype,Enumerable),{initialize: function(){this.effects=[];this.interval=null},_each: function(iterator){this.effects._each(iterator)},add: function(effect){var timestamp=new Date().getTime();var position=(typeof effect.options.queue=='string')?effect.options.queue:effect.options.queue.position;switch(position){case 'front':this.effects.findAll(function(e){return e.state=='idle'}).each( function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn});break;case 'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case 'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),40)},remove: function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop: function(){var timePos=new Date().getTime();this.effects.invoke('loop',timePos)}});Effect.Queues={instances:$H(),get: function(queueName){if(typeof queueName!='string') return queueName;if(!this.instances[queueName])
this.instances[queueName]=new Effect.ScopedQueue();return this.instances[queueName]}}
Effect.Queue=Effect.Queues.get('global');Effect.DefaultOptions={transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'}
Effect.Base=function(){};Effect.Base.prototype={position:null,start: function(options){this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).add(this)},loop: function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish) this.finish();this.event('afterFinish');return}
var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);var frame=Math.round(pos * this.options.fps * this.options.duration);if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame}}},render: function(pos){if(this.state=='idle'){this.state='running';this.event('beforeSetup');if(this.setup) this.setup();this.event('afterSetup')}
if(this.state=='running'){if(this.options.transition) pos=this.options.transition(pos);pos *=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event('beforeUpdate');if(this.update) this.update(pos);this.event('afterUpdate')}},cancel: function(){if(!this.options.sync)
Effect.Queues.get(typeof this.options.queue=='string'?'global':this.options.queue.scope).remove(this);this.state='finished'},event: function(eventName){if(this.options[eventName+'Internal']) this.options[eventName+'Internal'](this);if(this.options[eventName]) this.options[eventName](this)},inspect: function(){return '#<Effect:'+$H(this).inspect()+',options:'+$H(this.options).inspect()+'>'}}
Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{initialize: function(effects){this.effects=effects||[];this.start(arguments[1])},update: function(position){this.effects.invoke('render',position)},finish: function(position){this.effects.each( function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish) effect.finish(position);effect.event('afterFinish')})}});Effect.Event=Class.create();Object.extend(Object.extend(Effect.Event.prototype,Effect.Base.prototype),{initialize: function(){var options=Object.extend({duration:0},arguments[0]||{});this.start(options)},update:Prototype.emptyFunction});Effect.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize: function(element){this.element=$(element);if(!this.element) throw(Effect._elementDoesNotExistError);if(/MSIE/.test(navigator.userAgent)&&!window.opera&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options)},update: function(position){this.element.setOpacity(position)}});Effect.Move=Class.create();Object.extend(Object.extend(Effect.Move.prototype,Effect.Base.prototype),{initialize: function(element){this.element=$(element);if(!this.element) throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options)},setup: function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update: function(position){this.element.setStyle({left:Math.round(this.options.x * position+this.originalLeft)+'px',top:Math.round(this.options.y * position+this.originalTop)+'px'})}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}))};Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize: function(element,percent){this.element=$(element);if(!this.element) throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options)},setup: function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each( function(k){this.originalStyle[k]=this.element.style[k]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each( function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]},update: function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor * position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize * currentScale+this.fontSizeType});this.setDimensions(this.dims[0] * currentScale,this.dims[1] * currentScale)},finish: function(position){if(this.restoreAfterFinish) this.element.setStyle(this.originalStyle)},setDimensions: function(height,width){var d={};if(this.options.scaleX) d.width=Math.round(width)+'px';if(this.options.scaleY) d.height=Math.round(height)+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY) d.top=this.originalTop-topd+'px';if(this.options.scaleX) d.left=this.originalLeft-leftd+'px'} else{if(this.options.scaleY) d.top=-topd+'px';if(this.options.scaleX) d.left=-leftd+'px'}}
this.element.setStyle(d)}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize: function(element){this.element=$(element);if(!this.element) throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options)},setup: function(){if(this.element.getStyle('display')=='none'){this.cancel();return}
this.oldStyle={backgroundImage:this.element.getStyle('background-image')};this.element.setStyle({backgroundImage:'none'});if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this))},update: function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+(Math.round(this._base[i]+(this._delta[i]*position)).toColorPart())}.bind(this))})},finish: function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize: function(element){this.element=$(element);this.start(arguments[1]||{})},setup: function(){Position.prepare();var offsets=Position.cumulativeOffset(this.element);if(this.options.offset) offsets[1]+=this.options.offset;var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(offsets[1]>max?max:offsets[1])-this.scrollStart},update: function(position){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(position*this.delta))}});Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal: function(effect){if(effect.options.to!=0) return;effect.element.hide().setStyle({opacity:oldOpacity})}},arguments[1]||{});return new Effect.Opacity(element,options)}
Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal: function(effect){effect.element.forceRerendering()},beforeSetup: function(effect){effect.element.setOpacity(effect.options.from).show()}},arguments[1]||{});return new Effect.Opacity(element,options)}
Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal: function(effect){Position.absolutize(effect.effects[0].element)},afterFinishInternal: function(effect){effect.effects[0].element.hide().setStyle(oldStyle)}},arguments[1]||{}))}
Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal: function(effect){effect.element.hide().undoClipping()}},arguments[1]||{}))}
Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup: function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show()},afterFinishInternal: function(effect){effect.element.undoClipping()}},arguments[1]||{}))}
Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal: function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup: function(effect){effect.element.makePositioned().makeClipping()},afterFinishInternal: function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity})}})}},arguments[1]||{}))}
Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup: function(effect){effect.effects[0].element.makePositioned()},afterFinishInternal: function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle)}},arguments[1]||{}))}
Effect.Shake=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:20,y:0,duration:0.05,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:-40,y:0,duration:0.1,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:40,y:0,duration:0.1,afterFinishInternal: function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.05,afterFinishInternal: function(effect){effect.element.undoPositioned().setStyle(oldStyle)}})}})}})}})}})}})}
Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup: function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera) effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show()},afterUpdateInternal: function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'})},afterFinishInternal: function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom})}},arguments[1]||{}))}
Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal: function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera) effect.element.setStyle({top:''});effect.element.makeClipping().show()},afterUpdateInternal: function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'})},afterFinishInternal: function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({bottom:oldInnerBottom});effect.element.down().undoPositioned()}},arguments[1]||{}))}
Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup: function(effect){effect.element.makeClipping()},afterFinishInternal: function(effect){effect.element.hide().undoClipping()}})}
Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case 'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case 'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case 'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case 'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case 'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup: function(effect){effect.element.hide().makeClipping().makePositioned()},afterFinishInternal: function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup: function(effect){effect.effects[0].element.setStyle({height:'0px'}).show()},afterFinishInternal: function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle)}},options))}})}
Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case 'top-left':moveX=moveY=0;break;case 'top-right':moveX=dims.width;moveY=0;break;case 'bottom-left':moveX=0;moveY=dims.height;break;case 'bottom-right':moveX=dims.width;moveY=dims.height;break;case 'center':moveX=dims.width/2;moveY=dims.height/2;break}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal: function(effect){effect.effects[0].element.makePositioned().makeClipping()},afterFinishInternal: function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle)}},options))}
Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos,options.pulses))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal: function(effect){effect.element.setStyle({opacity:oldOpacity})}},options),{transition:reverser}))}
Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal: function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal: function(effect){effect.element.hide().undoClipping().setStyle(oldStyle)}})}},arguments[1]||{}))};['setOpacity','getOpacity','getInlineOpacity','forceRerendering','setContentZoom','collectTextNodes','collectTextNodesIgnoreClass'].each(
function(f){Element.Methods[f]=Element[f]});Element.Methods.visualEffect=function(element,effect,options){s=effect.gsub(/_/,'-').camelize();effect_class=s.charAt(0).toUpperCase()+s.substring(1);new Effect[effect_class](element,options);return $(element)};Element.addMethods();

/* - ++resource++cssQuery-compat.js - */
// http://www.naec.org.uk/portal_javascripts/++resource++cssQuery-compat.js?original=1
if(typeof(window.cssQuery)=='undefined'){window.cssQuery=function(selector,element){if(typeof(element)=='undefined'){element=document}
var results=base2.DOM.Document.matchAll(element,selector);var nodes=[];for(var i=0;i<results.length;i++){nodes.push(results.item(i))}
return nodes}};

/* - ++resource++base2-dom-fp.js - */
// http://www.naec.org.uk/portal_javascripts/++resource++base2-dom-fp.js?original=1
var base2={name:"base2",version:"1.0 (beta 2)",exports:"Base,Package,Abstract,Module,Enumerable,Map,Collection,RegGrp,"+"assert,assertArity,assertType,assignID,copy,detect,extend,"+"forEach,format,global,instanceOf,match,rescape,slice,trim,typeOf,"+"I,K,Undefined,Null,True,False,bind,delegate,flip,not,unbind",global:this,detect:new function(_){var global=_;var jscript=NaN/*@cc_on||@_jscript_version@*/;var java=_.java?true:false;if(_.navigator){var MSIE=/MSIE[\d.]+/g;var element=document.createElement("span");var userAgent=navigator.userAgent.replace(/([a-z])[\s\/](\d)/gi,"$1$2");if(!jscript)userAgent=userAgent.replace(MSIE,"");if(MSIE.test(userAgent))userAgent=userAgent.match(MSIE)[0]+" "+userAgent.replace(MSIE,"");userAgent=navigator.platform+" "+userAgent;java&=navigator.javaEnabled()}return function(a){var r=false;var b=a.charAt(0)=="!";if(b)a=a.slice(1);if(a.charAt(0)=="("){try{eval("r=!!"+a)}catch(e){}}else{r=new RegExp("("+a+")","i").test(userAgent)}return!!(b^r)}}(this)};new function(_){var _0="function base(o,a){return o.base.apply(o,a)};";eval(_0);var detect=base2.detect;var Undefined=K(),Null=K(null),True=K(true),False=K(false);var _1=/%([1-9])/g;var _2=/^\s\s*/;var _3=/\s\s*$/;var _4=/([\/()[\]{}|*+-.,^$?\\])/g;var _5=/eval/.test(detect)?/\bbase\s*\(/:/.*/;var _6=["constructor","toString","valueOf"];var _7=detect("(jscript)")?new RegExp("^"+rescape(isNaN).replace(/isNaN/,"\\w+")+"$"):{test:False};var _8=1;var _9=Array.prototype.slice;var slice=Array.slice||function(a){return _9.apply(a,_9.call(arguments,1))};_10();var _11=function(a,b){base2.__prototyping=this.prototype;var c=new this;extend(c,a);delete base2.__prototyping;var d=c.constructor;function e(){if(!base2.__prototyping){if(this.constructor==arguments.callee||this.__constructing){this.__constructing=true;d.apply(this,arguments);delete this.__constructing}else{return extend(arguments[0],c)}}return this};c.constructor=e;for(var i in Base)e[i]=this[i];e.ancestor=this;e.base=Undefined;e.init=Undefined;extend(e,b);e.prototype=c;e.init();return e};var Base=_11.call(Object,{constructor:function(){if(arguments.length>0){this.extend(arguments[0])}},base:function(){},extend:delegate(extend)},Base={ancestorOf:delegate(_12),extend:_11,forEach:delegate(_10),implement:function(a){if(typeof a=="function"){if(_12(Base,a)){a(this.prototype)}}else{extend(this.prototype,a)}return this}});var Package=Base.extend({constructor:function(d,e){this.extend(e);if(this.init)this.init();if(this.name!="base2"){if(!this.parent)this.parent=base2;this.parent.addName(this.name,this);this.namespace=format("var %1=%2;",this.name,String(this).slice(1,-1))}var f=/[^\s,]+/g;if(d){d.imports=Array2.reduce(this.imports.match(f),function(a,b){eval("var ns=base2."+b);assert(ns,format("Package not found: '%1'.",b),ReferenceError);return a+=ns.namespace},_0+base2.namespace+JavaScript.namespace);d.exports=Array2.reduce(this.exports.match(f),function(a,b){var c=this.name+"."+b;this.namespace+="var "+b+"="+c+";";return a+="if(!"+c+")"+c+"="+b+";"},"",this)}},exports:"",imports:"",name:"",namespace:"",parent:null,addName:function(a,b){if(!this[a]){this[a]=b;this.exports+=","+a;this.namespace+=format("var %1=%2.%1;",a,this.name)}},addPackage:function(a){this.addName(a,new Package(null,{name:a,parent:this}))},toString:function(){return format("[%1]",this.parent?String(this.parent).slice(1,-1)+"."+this.name:this.name)}});var Abstract=Base.extend({constructor:function(){throw new TypeError("Class cannot be instantiated.");}});var Module=Abstract.extend(null,{extend:function(a,b){var c=this.base();c.implement(this);c.implement(a);extend(c,b);c.init();return c},implement:function(d){var e=this;if(typeof d=="function"){if(!_12(d,e)){this.base(d)}if(_12(Module,d)){forEach(d,function(a,b){if(!e[b]){if(typeof a=="function"&&a.call&&d.prototype[b]){a=function(){return d[b].apply(d,arguments)}}e[b]=a}})}}else{extend(e,d);_10(Object,d,function(b,c){if(c.charAt(0)=="@"){if(detect(c.slice(1))){forEach(b,arguments.callee)}}else if(typeof b=="function"&&b.call){e.prototype[c]=function(){var a=_9.call(arguments);a.unshift(this);return e[c].apply(e,a)}}})}return e}});var Enumerable=Module.extend({every:function(c,d,e){var f=true;try{this.forEach(c,function(a,b){f=d.call(e,a,b,c);if(!f)throw StopIteration;})}catch(error){if(error!=StopIteration)throw error;}return!!f},filter:function(d,e,f){var i=0;return this.reduce(d,function(a,b,c){if(e.call(f,b,c,d)){a[i++]=b}return a},[])},invoke:function(b,c){var d=_9.call(arguments,2);return this.map(b,(typeof c=="function")?function(a){return(a==null)?undefined:c.apply(a,d)}:function(a){return(a==null)?undefined:a[c].apply(a,d)})},map:function(c,d,e){var f=[],i=0;this.forEach(c,function(a,b){f[i++]=d.call(e,a,b,c)});return f},pluck:function(b,c){return this.map(b,function(a){return(a==null)?undefined:a[c]})},reduce:function(c,d,e,f){var g=arguments.length>2;this.forEach(c,function(a,b){if(g){e=d.call(f,e,a,b,c)}else{e=a;g=true}});return e},some:function(a,b,c){return!this.every(a,not(b),c)}},{forEach:forEach});var _13="#";var Map=Base.extend({constructor:function(a){this.merge(a)},copy:delegate(copy),forEach:function(a,b){for(var c in this)if(c.charAt(0)==_13){a.call(b,this[c],c.slice(1),this)}},get:function(a){return this[_13+a]},getKeys:function(){return this.map(flip(I))},getValues:function(){return this.map(I)},has:function(a){/*@cc_on@*//*@if(@_14<5.5)return $Legacy.has(this,_13+a);@else@*/return _13+a in this;/*@end@*/},merge:function(b){var c=flip(this.put);forEach(arguments,function(a){forEach(a,c,this)},this);return this},remove:function(a){delete this[_13+a]},put:function(a,b){if(arguments.length==1)b=a;this[_13+a]=b},size:function(){var a=0;for(var b in this)if(b.charAt(0)==_13)a++;return a},union:function(a){return this.merge.apply(this.copy(),arguments)}});Map.implement(Enumerable);var _15="~";var Collection=Map.extend({constructor:function(a){this[_15]=new Array2;this.base(a)},add:function(a,b){assert(!this.has(a),"Duplicate key '"+a+"'.");this.put.apply(this,arguments)},copy:function(){var a=this.base();a[_15]=this[_15].copy();return a},forEach:function(a,b){var c=this[_15];var d=c.length;for(var i=0;i<d;i++){a.call(b,this[_13+c[i]],c[i],this)}},getAt:function(a){if(a<0)a+=this[_15].length;var b=this[_15][a];return(b===undefined)?undefined:this[_13+b]},getKeys:function(){return this[_15].concat()},indexOf:function(a){return this[_15].indexOf(String(a))},insertAt:function(a,b,c){assert(Math.abs(a)<this[_15].length,"Index out of bounds.");assert(!this.has(b),"Duplicate key '"+b+"'.");this[_15].insertAt(a,String(b));this[_13+b]==null;this.put.apply(this,_9.call(arguments,1))},item:function(a){return this[typeof a=="number"?"getAt":"get"](a)},put:function(a,b){if(arguments.length==1)b=a;if(!this.has(a)){this[_15].push(String(a))}var c=this.constructor;if(c.Item&&!instanceOf(b,c.Item)){b=c.create.apply(c,arguments)}this[_13+a]=b},putAt:function(a,b){assert(Math.abs(a)<this[_15].length,"Index out of bounds.");arguments[0]=this[_15].item(a);this.put.apply(this,arguments)},remove:function(a){if(this.has(a)){this[_15].remove(String(a));delete this[_13+a]}},removeAt:function(a){var b=this[_15].removeAt(a);delete this[_13+b]},reverse:function(){this[_15].reverse();return this},size:function(){return this[_15].length},sort:function(c){if(c){var d=this;this[_15].sort(function(a,b){return c(d[_13+a],d[_13+b],a,b)})}else this[_15].sort();return this},toString:function(){return String(this[_15])}},{Item:null,create:function(a,b){return this.Item?new this.Item(a,b):b},extend:function(a,b){var c=this.base(a);c.create=this.create;extend(c,b);if(!c.Item){c.Item=this.Item}else if(typeof c.Item!="function"){c.Item=(this.Item||Base).extend(c.Item)}c.init();return c}});var _16=/\\(\d+)/g,_17=/\\./g,_18=/\(\?[:=!]|\[[^\]]+\]/g,_19=/\(/g,_20=/\$(\d+)/,_21=/^\$\d+$/;var RegGrp=Collection.extend({constructor:function(a,b){this.base(a);if(typeof b=="string"){this.global=/g/.test(b);this.ignoreCase=/i/.test(b)}},global:true,ignoreCase:false,exec:function(f,g){var h=(this.global?"g":"")+(this.ignoreCase?"i":"");f=String(f)+"";if(arguments.length==1){var j=this;var k=this[_15];g=function(a){if(a){var b,c=1,i=0;while((b=j[_13+k[i++]])){var d=c+b.length+1;if(arguments[c]){var e=b.replacement;switch(typeof e){case"function":return e.apply(j,_9.call(arguments,c,d));case"number":return arguments[c+e];default:return e}}c=d}}return""}}return f.replace(new RegExp(this,h),g)},insertAt:function(a,b,c){if(instanceOf(b,RegExp)){arguments[1]=b.source}return base(this,arguments)},test:function(a){return this.exec(a)!=a},toString:function(){var e=0;return"("+this.map(function(c){var d=String(c).replace(_16,function(a,b){return"\\"+(1+Number(b)+e)});e+=c.length+1;return d}).join(")|(")+")"}},{IGNORE:"$0",init:function(){forEach("add,get,has,put,remove".split(","),function(b){_22(this,b,function(a){if(instanceOf(a,RegExp)){arguments[0]=a.source}return base(this,arguments)})},this.prototype)},Item:{constructor:function(a,b){if(typeof b=="number")b=String(b);else if(b==null)b="";if(typeof b=="string"&&_20.test(b)){if(_21.test(b)){b=parseInt(b.slice(1))}else{var Q=/'/.test(b.replace(/\\./g,""))?'"':"'";b=b.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\$(\d+)/g,Q+"+(arguments[$1]||"+Q+Q+")+"+Q);b=new Function("return "+Q+b.replace(/(['"])\1\+(.*)\+\1\1$/,"$1")+Q)}}this.length=RegGrp.count(a);this.replacement=b;this.toString=K(String(a))},length:0,replacement:""},count:function(a){a=String(a).replace(_17,"").replace(_18,"");return match(a,_19).length}});var JavaScript={name:"JavaScript",version:base2.version,exports:"Array2,Date2,String2",namespace:"",bind:function(c){forEach(this.exports.match(/\w+/g),function(a){var b=a.slice(0,-1);extend(c[b],this[a]);this[a](c[b].prototype)},this);return this}};if((new Date).getYear()>1900){Date.prototype.getYear=function(){return this.getFullYear()-1900};Date.prototype.setYear=function(a){return this.setFullYear(a+1900)}}Function.prototype.prototype={};if("".replace(/^/,K("$$"))=="$"){extend(String.prototype,"replace",function(a,b){if(typeof b=="function"){var c=b;b=function(){return String(c.apply(null,arguments)).split("$").join("$$")}}return this.base(a,b)})}var Array2=_23(Array,Array,"concat,join,pop,push,reverse,shift,slice,sort,splice,unshift",[Enumerable,{combine:function(d,e){if(!e)e=d;return this.reduce(d,function(a,b,c){a[b]=e[c];return a},{})},contains:function(a,b){return this.indexOf(a,b)!=-1},copy:function(a){var b=_9.call(a);if(!b.swap)this(b);return b},flatten:function(c){var d=0;return this.reduce(c,function(a,b){if(this.like(b)){this.reduce(b,arguments.callee,a,this)}else{a[d++]=b}return a},[],this)},forEach:_24,indexOf:function(a,b,c){var d=a.length;if(c==null){c=0}else if(c<0){c=Math.max(0,d+c)}for(var i=c;i<d;i++){if(a[i]===b)return i}return-1},insertAt:function(a,b,c){this.splice(a,b,0,c);return c},item:function(a,b){if(b<0)b+=a.length;return a[b]},lastIndexOf:function(a,b,c){var d=a.length;if(c==null){c=d-1}else if(c<0){c=Math.max(0,d+c)}for(var i=c;i>=0;i--){if(a[i]===b)return i}return-1},map:function(c,d,e){var f=[];this.forEach(c,function(a,b){f[b]=d.call(e,a,b,c)});return f},remove:function(a,b){var c=this.indexOf(a,b);if(c!=-1)this.removeAt(a,c);return b},removeAt:function(a,b){return this.splice(a,b,1)},swap:function(a,b,c){if(b<0)b+=a.length;if(c<0)c+=a.length;var d=a[b];a[b]=a[c];a[c]=d;return a}}]);Array2.reduce=Enumerable.reduce;Array2.like=function(a){return!!(a&&typeof a=="object"&&typeof a.length=="number")};var _25=/^((-\d+|\d{4,})(-(\d{2})(-(\d{2}))?)?)?T((\d{2})(:(\d{2})(:(\d{2})(\.(\d{1,3})(\d)?\d*)?)?)?)?(([+-])(\d{2})(:(\d{2}))?|Z)?$/;var _26={FullYear:2,Month:4,Date:6,Hours:8,Minutes:10,Seconds:12,Milliseconds:14};var _27={Hectomicroseconds:15,UTC:16,Sign:17,Hours:18,Minutes:20};var _28=/(((00)?:0+)?:0+)?\.0+$/;var _29=/(T[0-9:.]+)$/;var Date2=_23(Date,function(a,b,c,h,m,s,d){switch(arguments.length){case 0:return new Date;case 1:return new Date(a);default:return new Date(a,b,arguments.length==2?1:c,h||0,m||0,s||0,d||0)}},"",[{toISOString:function(c){var d="####-##-##T##:##:##.###";for(var e in _26){d=d.replace(/#+/,function(a){var b=c["getUTC"+e]();if(e=="Month")b++;return("000"+b).slice(-a.length)})}return d.replace(_28,"").replace(_29,"$1Z")}}]);Date2.now=function(){return(new Date).valueOf()};Date2.parse=function(a,b){if(arguments.length>1){assertType(b,"number","defaultDate should be of type 'number'.")}var c=String(a).match(_25);if(c){if(c[_26.Month])c[_26.Month]--;if(c[_27.Hectomicroseconds]>=5)c[_26.Milliseconds]++;var d=new Date(b||0);var e=c[_27.UTC]||c[_27.Hours]?"UTC":"";for(var f in _26){var g=c[_26[f]];if(!g)continue;d["set"+e+f](g);if(d["get"+e+f]()!=c[_26[f]]){return NaN}}if(c[_27.Hours]){var h=Number(c[_27.Sign]+c[_27.Hours]);var i=Number(c[_27.Sign]+(c[_27.Minutes]||0));d.setUTCMinutes(d.getUTCMinutes()+(h*60)+i)}return d.valueOf()}else{return Date.parse(a)}};var String2=_23(String,function(a){return new String(arguments.length==0?"":a)},"charAt,charCodeAt,concat,indexOf,lastIndexOf,match,replace,search,slice,split,substr,substring,toLowerCase,toUpperCase",[{trim:trim}]);function _23(c,constructor,d,e){var f=Module.extend();forEach(d.match(/\w+/g),function(a){f[a]=unbind(c.prototype[a])});forEach(e,f.implement,f);var g=function(){return f(this.constructor==f?constructor.apply(null,arguments):arguments[0])};g.prototype=f.prototype;forEach(f,function(a,b){if(c[b]){f[b]=c[b];delete f.prototype[b]}g[b]=f[b]});g.ancestor=Object;delete g.extend;if(c!=Array)delete g.forEach;return g};function extend(a,b){if(a&&b){if(arguments.length>2){var c=b;b={};b[c]=arguments[2]}var d=(typeof b=="function"?Function:Object).prototype;var i=_6.length,c;if(base2.__prototyping){while(c=_6[--i]){var e=b[c];if(e!=d[c]){if(_5.test(e)){_22(a,c,e)}else{a[c]=e}}}}for(c in b){if(d[c]===undefined){var e=b[c];if(c.charAt(0)=="@"){if(detect(c.slice(1)))arguments.callee(a,e);continue}var f=a[c];if(f&&typeof e=="function"){if(e!=f&&(!f.method||!_12(e,f))){if(_5.test(e)){_22(a,c,e)}else{e.ancestor=f;a[c]=e}}}else{a[c]=e}}}}return a};function _12(a,b){while(b){if(!b.ancestor)return false;b=b.ancestor;if(b==a)return true}return false};function _22(c,d,e){var f=c[d];var g=base2.__prototyping;if(g&&f!=g[d])g=null;function h(){var a=this.base;this.base=g?g[d]:f;var b=e.apply(this,arguments);this.base=a;return b};h.ancestor=f;c[d]=h};if(typeof StopIteration=="undefined"){StopIteration=new Error("StopIteration")}function forEach(a,b,c,d){if(a==null)return;if(!d){if(typeof a=="function"&&a.call){d=Function}else if(typeof a.forEach=="function"&&a.forEach!=arguments.callee){a.forEach(b,c);return}else if(typeof a.length=="number"){_24(a,b,c);return}}_10(d||Object,a,b,c)};function _24(a,b,c){if(a==null)return;var d=a.length,i;if(typeof a=="string"){for(i=0;i<d;i++){b.call(c,a.charAt(i),i,a)}}else{for(i=0;i<d;i++){/*@cc_on@*//*@if(@_14<5.2)if($Legacy.has(a,i))@else@*/if(i in a)/*@end@*/b.call(c,a[i],i,a)}}};function _10(g,h,j,k){var l=function(){this.i=1};l.prototype={i:1};var m=0;for(var i in new l)m++;_10=(m>1)?function(a,b,c,d){var e={};for(var f in b){if(!e[f]&&a.prototype[f]===undefined){e[f]=true;c.call(d,b[f],f,b)}}}:function(a,b,c,d){for(var e in b){if(a.prototype[e]===undefined){c.call(d,b[e],e,b)}}};_10(g,h,j,k)};function typeOf(a){var b=typeof a;switch(b){case"object":return a===null?"null":typeof a.call=="function"||_7.test(a)?"function":b;case"function":return typeof a.call=="function"?b:"object";default:return b}};function instanceOf(a,b){if(typeof b!="function"){throw new TypeError("Invalid 'instanceOf' operand.");}if(a==null)return false;/*@cc_on if(typeof a.constructor!="function"){return typeOf(a)==typeof b.prototype.valueOf()}@*//*@if(@_14<5.1)if($Legacy.instanceOf(a,b))return true;@else@*/if(a instanceof b)return true;/*@end@*/if(Base.ancestorOf==b.ancestorOf)return false;if(Base.ancestorOf==a.constructor.ancestorOf)return b==Object;switch(b){case Array:return!!(typeof a=="object"&&a.join&&a.splice);case Function:return typeOf(a)=="function";case RegExp:return typeof a.constructor.$1=="string";case Date:return!!a.getTimezoneOffset;case String:case Number:case Boolean:return typeof a==typeof b.prototype.valueOf();case Object:return true}return false};function assert(a,b,c){if(!a){throw new(c||Error)(b||"Assertion failed.");}};function assertArity(a,b,c){if(b==null)b=a.callee.length;if(a.length<b){throw new SyntaxError(c||"Not enough arguments.");}};function assertType(a,b,c){if(b&&(typeof b=="function"?!instanceOf(a,b):typeOf(a)!=b)){throw new TypeError(c||"Invalid type.");}};function assignID(a){if(!a.base2ID)a.base2ID="b2_"+_8++;return a.base2ID};function copy(a){var b=function(){};b.prototype=a;return new b};function format(c){var d=arguments;var e=new RegExp("%([1-"+arguments.length+"])","g");return String(c).replace(e,function(a,b){return d[b]})};function match(a,b){return String(a).match(b)||[]};function rescape(a){return String(a).replace(_4,"\\$1")};function trim(a){return String(a).replace(_2,"").replace(_3,"")};function I(i){return i};function K(k){return function(){return k}};function bind(a,b){var c=_9.call(arguments,2);return c.length==0?function(){return a.apply(b,arguments)}:function(){return a.apply(b,c.concat.apply(c,arguments))}};function delegate(b,c){return function(){var a=_9.call(arguments);a.unshift(this);return b.apply(c,a)}};function flip(a){return function(){return a.apply(this,Array2.swap(arguments,0,1))}};function not(a){return function(){return!a.apply(this,arguments)}};function unbind(b){return function(a){return b.apply(a,_9.call(arguments,1))}};base2=new Package(this,base2);eval(this.exports);base2.extend=extend;forEach(Enumerable,function(a,b){if(!Module[b])base2.addName(b,bind(a,Enumerable))});JavaScript=new Package(this,JavaScript);eval(this.exports)};new function(_){var DOM=new base2.Package(this,{name:"DOM",version:"1.0 (beta 2)",exports:"Interface,Binding,Node,Document,Element,AbstractView,HTMLDocument,HTMLElement,"+"Selector,Traversal,XPathParser,NodeSelector,DocumentSelector,ElementSelector,"+"StaticNodeList,Event,EventTarget,DocumentEvent,ViewCSS,CSSStyleDeclaration",bind:function(a){if(a&&a.nodeType){var b=assignID(a);if(!DOM.bind[b]){switch(a.nodeType){case 1:if(typeof a.className=="string"){(HTMLElement.bindings[a.tagName]||HTMLElement).bind(a)}else{Element.bind(a)}break;case 9:if(a.writeln){HTMLDocument.bind(a)}else{Document.bind(a)}break;default:Node.bind(a)}DOM.bind[b]=true}}return a},"@MSIE5.+win":{bind:function(a){if(a&&a.writeln){a.nodeType=9}return this.base(a)}}});eval(this.imports);var _30=detect("MSIE");var _31=detect("MSIE5");var Interface=Module.extend(null,{implement:function(e){var f=this;if(Interface.ancestorOf(e)){forEach(e,function(a,b){if(e[b]._32){f[b]=function(){return e[b].apply(e,arguments)}}})}else if(typeof e=="object"){this.forEach(e,function(a,b){if(b.charAt(0)=="@"){forEach(a,arguments.callee)}else if(typeof a=="function"&&a.call){if(!f[b]){var c="var fn=function _%1(%2){%3.base=%3.%1.ancestor;var m=%3.base?'base':'%1';return %3[m](%4)}";var d="abcdefghij".split("").slice(-a.length);eval(format(c,b,d,d[0],d.slice(1)));fn._32=b;f[b]=fn}}})}return this.base(e)}});var Binding=Interface.extend(null,{bind:function(a){return extend(a,this.prototype)}});var Node=Binding.extend({"@!(element.compareDocumentPosition)":{compareDocumentPosition:function(a,b){if(Traversal.contains(a,b)){return 4|16}else if(Traversal.contains(b,a)){return 2|8}var c=_33(a);var d=_33(b);if(c<d){return 4}else if(c>d){return 2}return 0}}});var _33=document.documentElement.sourceIndex?function(a){return a.sourceIndex}:function(a){var b=0;while(a){b=Traversal.getNodeIndex(a)+"."+b;a=a.parentNode}return b};var Document=Node.extend(null,{bind:function(b){extend(b,"createElement",function(a){return DOM.bind(this.base(a))});AbstractView.bind(b.defaultView);if(b!=window.document)new DOMContentLoadedEvent(b);return this.base(b)},"@!(document.defaultView)":{bind:function(a){a.defaultView=Traversal.getDefaultView(a);return this.base(a)}}});var _34=/^(href|src)$/;var _35={"class":"className","for":"htmlFor"};var Element=Node.extend({"@MSIE.+win":{getAttribute:function(a,b,c){if(a.className===undefined){return this.base(a,b)}var d=_36(a,b);if(d&&(d.specified||b=="value")){if(_34.test(b)){return this.base(a,b,2)}else if(b=="style"){return a.style.cssText}else{return d.nodeValue}}return null},setAttribute:function(a,b,c){if(a.className===undefined){this.base(a,b,c)}else if(b=="style"){a.style.cssText=c}else{c=String(c);var d=_36(a,b);if(d){d.nodeValue=c}else{this.base(a,_35[b]||b,c)}}}},"@!(element.hasAttribute)":{hasAttribute:function(a,b){return this.getAttribute(a,b)!=null}}});extend(Element.prototype,"cloneNode",function(a){var b=this.base(a||false);b.base2ID=undefined;return b});if(_30){var _37="colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc";extend(_35,Array2.combine(_37.toLowerCase().split(","),_37.split(",")));var _36=_31?function(a,b){return a.attributes[b]||a.attributes[_35[b.toLowerCase()]]}:function(a,b){return a.getAttributeNode(b)}}var TEXT=_30?"innerText":"textContent";var Traversal=Module.extend({getDefaultView:function(a){return this.getDocument(a).defaultView},getNextElementSibling:function(a){while(a&&(a=a.nextSibling)&&!this.isElement(a))continue;return a},getNodeIndex:function(a){var b=0;while(a&&(a=a.previousSibling))b++;return b},getOwnerDocument:function(a){return a.ownerDocument},getPreviousElementSibling:function(a){while(a&&(a=a.previousSibling)&&!this.isElement(a))continue;return a},getTextContent:function(a){return a[TEXT]},isEmpty:function(a){a=a.firstChild;while(a){if(a.nodeType==3||this.isElement(a))return false;a=a.nextSibling}return true},setTextContent:function(a,b){return a[TEXT]=b},"@MSIE":{getDefaultView:function(a){return(a.document||a).parentWindow},"@MSIE5":{getOwnerDocument:function(a){return a.ownerDocument||a.document}}}},{contains:function(a,b){while(b&&(b=b.parentNode)&&a!=b)continue;return!!b},getDocument:function(a){return this.isDocument(a)?a:this.getOwnerDocument(a)},isDocument:function(a){return!!(a&&a.documentElement)},isElement:function(a){return!!(a&&a.nodeType==1)},"@(element.contains)":{contains:function(a,b){return a!=b&&(this.isDocument(a)?a==this.getOwnerDocument(b):a.contains(b))}},"@MSIE5":{isElement:function(a){return!!(a&&a.nodeType==1&&a.nodeName!="!")}}});var AbstractView=Binding.extend();var Event=Binding.extend({"@!(document.createEvent)":{initEvent:function(a,b,c,d){a.type=b;a.bubbles=c;a.cancelable=d;a.timeStamp=new Date().valueOf()},"@MSIE":{initEvent:function(a,b,c,d){this.base(a,b,c,d);a.cancelBubble=!a.bubbles},preventDefault:function(a){if(a.cancelable!==false){a.returnValue=false}},stopPropagation:function(a){a.cancelBubble=true}}}},{"@!(document.createEvent)":{"@MSIE":{bind:function(a){if(!a.timeStamp){a.bubbles=!!_38[a.type];a.cancelable=!!_39[a.type];a.timeStamp=new Date().valueOf()}if(!a.target){a.target=a.srcElement}a.relatedTarget=a[(a.type=="mouseout"?"to":"from")+"Element"];return this.base(a)}}}});if(_30){var _38="abort,error,select,change,resize,scroll";var _39="click,mousedown,mouseup,mouseover,mousemove,mouseout,keydown,keyup,submit,reset";_38=Array2.combine((_38+","+_39).split(","));_39=Array2.combine(_39.split(","))}var EventTarget=Interface.extend({"@!(element.addEventListener)":{addEventListener:function(a,b,c,d){var e=assignID(a);var f=assignID(c);var g=_40[e];if(!g)g=_40[e]={};var h=g[b];var i=a["on"+b];if(!h){h=g[b]={};if(i)h[0]=i}h[f]=c;if(i!==undefined){a["on"+b]=_40._41}},dispatchEvent:function(a,b){return _41.call(a,b)},removeEventListener:function(a,b,c,d){var e=_40[a.base2ID];if(e&&e[b]){delete e[b][c.base2ID]}},"@(element.fireEvent)":{dispatchEvent:function(a,b){var c="on"+b.type;b.target=a;if(a[c]===undefined){return this.base(a,b)}else{return a.fireEvent(c,b)}}}}});var _40=new Base({_41:_41,"@MSIE":{_41:function(){var a=this;var b=(a.document||a).parentWindow;if(a.Infinity)a=b;return _41.call(a,b.event)}}});function _41(a){var b=true;var c=_40[this.base2ID];if(c){Event.bind(a);var d=c[a.type];for(var i in d){var listener=d[i];if(listener.handleEvent){var result=listener.handleEvent(a)}else{result=listener.call(this,a)}if(result===false||a.returnValue===false)b=false}}return b};var DocumentEvent=Interface.extend({"@!(document.createEvent)":{createEvent:function(a,b){return Event.bind({})},"@(document.createEventObject)":{createEvent:function(a,b){return Event.bind(a.createEventObject())}}},"@(document.createEvent)":{"@!(document.createEvent('Events'))":{createEvent:function(a,b){return this.base(a,b=="Events"?"UIEvents":b)}}}});var DOMContentLoadedEvent=Base.extend({constructor:function(b){var c=false;this.fire=function(){if(!c){c=true;setTimeout(function(){var a=DocumentEvent.createEvent(b,"Events");Event.initEvent(a,"DOMContentLoaded",false,false);EventTarget.dispatchEvent(b,a)},1)}};EventTarget.addEventListener(b,"DOMContentLoaded",function(){c=true},false);this.listen(b)},listen:function(a){EventTarget.addEventListener(Traversal.getDefaultView(a),"load",this.fire,false)},"@MSIE.+win":{listen:function(a){if(a.readyState!="complete"){var b=this;a.write("<script id=__ready defer src=//:><\/script>");a.all.__ready.onreadystatechange=function(){if(this.readyState=="complete"){this.removeNode();b.fire()}}}}},"@KHTML":{listen:function(a){if(a.readyState!="complete"){var b=this;var c=setInterval(function(){if(/loaded|complete/.test(a.readyState)){clearInterval(c);b.fire()}},100)}}}});new DOMContentLoadedEvent(document);Document.implement(DocumentEvent);Document.implement(EventTarget);Element.implement(EventTarget);var _42=/^\d+(px)?$/i;var _43=/(width|height|top|bottom|left|right|fontSize)$/;var _44=/^(color|backgroundColor)$/;var ViewCSS=Interface.extend({"@!(document.defaultView.getComputedStyle)":{"@MSIE":{getComputedStyle:function(a,b,c){var d=b.currentStyle;var e={};for(var i in d){if(_43.test(i)){e[i]=_45(b,e[i])+"px"}else if(_44.test(i)){e[i]=_46(b,i=="color"?"ForeColor":"BackColor")}else{e[i]=d[i]}}return e}}},getComputedStyle:function(a,b,c){return _47.bind(this.base(a,b,c))}},{toCamelCase:function(c){return c.replace(/\-([a-z])/g,function(a,b){return b.toUpperCase()})}});function _45(a,b){if(_42.test(b))return parseInt(b);var c=a.style.left;var d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;b=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return b};function _46(a,b){var c=a.document.body.createTextRange();c.moveToElementText(a);var d=c.queryCommandValue(b);return format("rgb(%1,%2,%3)",d&0xff,(d&0xff00)>>8,(d&0xff0000)>>16)};var _47=Binding.extend({getPropertyValue:function(a,b){return this.base(a,_48[b]||b)},"@MSIE.+win":{getPropertyValue:function(a,b){return b=="float"?a.styleFloat:a[ViewCSS.toCamelCase(b)]}}});var CSSStyleDeclaration=_47.extend({setProperty:function(a,b,c,d){return this.base(a,_48[b]||b,c,d)},"@MSIE.+win":{setProperty:function(a,b,c,d){if(b=="opacity"){c*=100;a.opacity=c;a.zoom=1;a.filter="Alpha(opacity="+c+")"}else{a.setAttribute(b,c)}}}},{"@MSIE":{bind:function(a){a.getPropertyValue=this.prototype.getPropertyValue;a.setProperty=this.prototype.setProperty;return a}}});var _48=new Base({"@Gecko":{opacity:"-moz-opacity"},"@KHTML":{opacity:"-khtml-opacity"}});with(CSSStyleDeclaration.prototype)getPropertyValue.toString=setProperty.toString=function(){return"[base2]"};AbstractView.implement(ViewCSS);var NodeSelector=Interface.extend({"@!(element.querySelector)":{querySelector:function(a,b){return new Selector(b).exec(a,1)},querySelectorAll:function(a,b){return new Selector(b).exec(a)}}});extend(NodeSelector.prototype,{querySelector:function(a){return DOM.bind(this.base(a))},querySelectorAll:function(b){return extend(this.base(b),"item",function(a){return DOM.bind(this.base(a))})}});var DocumentSelector=NodeSelector.extend();var ElementSelector=NodeSelector.extend({"@!(element.matchesSelector)":{matchesSelector:function(a,b){return new Selector(b).test(a)}}});var StaticNodeList=Base.extend({constructor:function(b){b=b||[];this.length=b.length;this.item=function(a){return b[a]}},length:0,forEach:function(a,b){for(var i=0;i<this.length;i++){a.call(b,this.item(i),i,this)}},item:Undefined,"@(XPathResult)":{constructor:function(b){if(b&&b.snapshotItem){this.length=b.snapshotLength;this.item=function(a){return b.snapshotItem(a)}}else this.base(b)}}});StaticNodeList.implement(Enumerable);var _49=/'(\\.|[^'\\])*'|"(\\.|[^"\\])*"/g,_50=/([\s>+~,]|[^(]\+|^)([#.:\[])/g,_51=/(^|,)([^\s>+~])/g,_52=/\s*([\s>+~(),]|^|$)\s*/g,_53=/\s\*\s/g,_54=/\x01(\d+)/g,_55=/'/g;var CSSParser=RegGrp.extend({constructor:function(a){this.base(a);this.cache={};this.sorter=new RegGrp;this.sorter.add(/:not\([^)]*\)/,RegGrp.IGNORE);this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/,"$1$3$6$4")},cache:null,ignoreCase:true,escape:function(b){var c=this._56=[];return this.optimise(this.format(String(b).replace(_49,function(a){return"\x01"+c.push(a.slice(1,-1).replace(_55,"\\'"))})))},format:function(a){return a.replace(_52,"$1").replace(_51,"$1 $2").replace(_50,"$1*$2")},optimise:function(a){return this.sorter.exec(a.replace(_53,">* "))},parse:function(a){return this.cache[a]||(this.cache[a]=this.unescape(this.exec(this.escape(a))))},unescape:function(c){var d=this._56;return c.replace(_54,function(a,b){return d[b-1]})}});function _57(c,d,e,f,g,h,i,j){f=/last/i.test(c)?f+"+1-":"";if(!isNaN(d))d="0n+"+d;else if(d=="even")d="2n";else if(d=="odd")d="2n+1";d=d.split("n");var a=d[0]?(d[0]=="-")?-1:parseInt(d[0]):1;var b=parseInt(d[1])||0;var k=a<0;if(k){a=-a;if(a==1)b++}var l=format(a==0?"%3%7"+(f+b):"(%4%3-%2)%6%1%70%5%4%3>=%2",a,b,e,f,h,i,j);if(k)l=g+"("+l+")";return l};var XPathParser=CSSParser.extend({constructor:function(){this.base(XPathParser.rules);this.sorter.putAt(1,"$1$4$3$6")},escape:function(a){return this.base(a).replace(/,/g,"\x02")},unescape:function(b){return this.base(b.replace(/\[self::\*\]/g,"").replace(/(^|\x02)\//g,"$1./").replace(/\x02/g," | ")).replace(/'[^'\\]*\\'(\\.|[^'\\])*'/g,function(a){return"concat("+a.split("\\'").join("',\"'\",'")+")"})},"@opera":{unescape:function(a){return this.base(a.replace(/last\(\)/g,"count(preceding-sibling::*)+count(following-sibling::*)+1"))}}},{init:function(){this.values.attributes[""]="[@$1]";forEach(this.types,function(a,b){forEach(this.values[b],a,this.rules)},this)},optimised:{pseudoClasses:{"first-child":"[1]","last-child":"[last()]","only-child":"[last()=1]"}},rules:extend({},{"@!KHTML":{"(^|\\x02) (\\*|[\\w-]+)#([\\w-]+)":"$1id('$3')[self::$2]","([ >])(\\*|[\\w-]+):([\\w-]+-child(\\(([^)]+)\\))?)":function(a,b,c,d,e,f){var g=(b==" ")?"//*":"/*";if(/^nth/i.test(d)){g+=_58(d,f,"position()")}else{g+=XPathParser.optimised.pseudoClasses[d]}return g+"[self::"+c+"]"}}}),types:{identifiers:function(a,b){this[rescape(b)+"([\\w-]+)"]=a},combinators:function(a,b){this[rescape(b)+"(\\*|[\\w-]+)"]=a},attributes:function(a,b){this["\\[([\\w-]+)\\s*"+rescape(b)+"\\s*([^\\]]*)\\]"]=a},pseudoClasses:function(a,b){this[":"+b.replace(/\(\)$/,"\\(([^)]+)\\)")]=a}},values:{identifiers:{"#":"[@id='$1'][1]",".":"[contains(concat(' ',@class,' '),' $1 ')]"},combinators:{" ":"/descendant::$1",">":"/child::$1","+":"/following-sibling::*[1][self::$1]","~":"/following-sibling::$1"},attributes:{"*=":"[contains(@$1,'$2')]","^=":"[starts-with(@$1,'$2')]","$=":"[substring(@$1,string-length(@$1)-string-length('$2')+1)='$2']","~=":"[contains(concat(' ',@$1,' '),' $2 ')]","|=":"[contains(concat('-',@$1,'-'),'-$2-')]","!=":"[not(@$1='$2')]","=":"[@$1='$2']"},pseudoClasses:{"empty":"[not(child::*) and not(text())]","first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","not()":_59,"nth-child()":_58,"nth-last-child()":_58,"only-child":"[not(preceding-sibling::*) and not(following-sibling::*)]","root":"[not(parent::*)]"}},"@opera":{init:function(){this.optimised.pseudoClasses["last-child"]=this.values.pseudoClasses["last-child"];this.optimised.pseudoClasses["only-child"]=this.values.pseudoClasses["only-child"];this.base()}}});var _60=new XPathParser;function _59(a,b){return"[not("+_60.exec(trim(b)).replace(/\[1\]/g,"").replace(/^(\*|[\w-]+)/,"[self::$1]").replace(/\]\[/g," and ").slice(1,-1)+")]"};function _58(a,b,c){return"["+_57(a,b,c||"count(preceding-sibling::*)+1","last()","not"," and "," mod ","=")+"]"};var Selector=Base.extend({constructor:function(a){this.toString=K(trim(a))},exec:function(a,b){return Selector.parse(this)(a,b)},test:function(a){var b=new Selector(this+"[b2-test]");a.setAttribute("b2-test",true);var c=b.exec(Traversal.getOwnerDocument(a),true);a.removeAttribute("b2-test");return c==a},toXPath:function(){return Selector.toXPath(this)},"@(XPathResult)":{exec:function(a,b){if(_61.test(this)){return this.base(a,b)}var c=Traversal.getDocument(a);var d=b?9:7;var e=c.evaluate(this.toXPath(),a,null,d,null);return b?e.singleNodeValue:e}},"@MSIE":{exec:function(a,b){if(typeof a.selectNodes!="undefined"&&!_61.test(this)){var c=b?"selectSingleNode":"selectNodes";return a[c](this.toXPath())}return this.base(a,b)}},"@(true)":{exec:function(a,b){try{var c=this.base(a||document,b)}catch(error){throw new SyntaxError(format("'%1' is not a valid CSS selector.",this));}return b?c:new StaticNodeList(c)}}},{toXPath:function(a){if(!_62)_62=new XPathParser;return _62.parse(a)}});var _61=":(checked|disabled|enabled|contains)|^(#[\\w-]+\\s*)?\\w+$";if(detect("KHTML")){if(detect("WebKit5")){_61+="|nth\\-|,"}else{_61="."}}_61=new RegExp(_61);var _63={"=":"%1=='%2'","!=":"%1!='%2'","~=":/(^| )%1( |$)/,"|=":/^%1(-|$)/,"^=":/^%1/,"$=":/%1$/,"*=":/%1/};_63[""]="%1!=null";var _64={"checked":"e%1.checked","contains":"e%1[TEXT].indexOf('%2')!=-1","disabled":"e%1.disabled","empty":"Traversal.isEmpty(e%1)","enabled":"e%1.disabled===false","first-child":"!Traversal.getPreviousElementSibling(e%1)","last-child":"!Traversal.getNextElementSibling(e%1)","only-child":"!Traversal.getPreviousElementSibling(e%1)&&!Traversal.getNextElementSibling(e%1)","root":"e%1==Traversal.getDocument(e%1).documentElement"};var _65=detect("(element.sourceIndex)");var _66="var p%2=0,i%2,e%2,n%2=e%1.";var _67=_65?"e%1.sourceIndex":"assignID(e%1)";var _68="var g="+_67+";if(!p[g]){p[g]=1;";var _69="r[r.length]=e%1;if(s)return e%1;";var _70="var _71=function(e0,s){_72++;var r=[],p={},reg=[%1],"+"d=Traversal.getDocument(e0),c=d.body?'toUpperCase':'toString';";var _62;var _73;var _74;var _75;var _76;var _77;var _78={};var _79=new CSSParser({"^ \\*:root":function(a){_75=false;var b="e%2=d.documentElement;if(Traversal.contains(e%1,e%2)){";return format(b,_74++,_74)}," (\\*|[\\w-]+)#([\\w-]+)":function(a,b,c){_75=false;var d="var e%2=_80(d,'%4');if(e%2&&";if(b!="*")d+="e%2.nodeName=='%3'[c]()&&";d+="Traversal.contains(e%1,e%2)){";if(_76)d+=format("i%1=n%1.length;",_76);return format(d,_74++,_74,b,c)}," (\\*|[\\w-]+)":function(a,b){_77++;_75=b=="*";var c=_66;c+=(_75&&_31)?"all":"getElementsByTagName('%3')";c+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";return format(c,_74++,_76=_74,b)},">(\\*|[\\w-]+)":function(a,b){var c=_30&&_76;_75=b=="*";var d=_66;d+=c?"children":"childNodes";if(!_75&&c)d+=".tags('%3')";d+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";if(_75){d+="if(e%2.nodeType==1){";_75=_31}else{if(!c)d+="if(e%2.nodeName=='%3'[c]()){"}return format(d,_74++,_76=_74,b)},"\\+(\\*|[\\w-]+)":function(a,b){var c="";if(_75&&_30)c+="if(e%1.nodeName!='!'){";_75=false;c+="e%1=Traversal.getNextElementSibling(e%1);if(e%1";if(b!="*")c+="&&e%1.nodeName=='%2'[c]()";c+="){";return format(c,_74,b)},"~(\\*|[\\w-]+)":function(a,b){var c="";if(_75&&_30)c+="if(e%1.nodeName!='!'){";_75=false;_77=2;c+="while(e%1=e%1.nextSibling){if(e%1.b2_adjacent==_72)break;if(";if(b=="*"){c+="e%1.nodeType==1";if(_31)c+="&&e%1.nodeName!='!'"}else c+="e%1.nodeName=='%2'[c]()";c+="){e%1.b2_adjacent=_72;";return format(c,_74,b)},"#([\\w-]+)":function(a,b){_75=false;var c="if(e%1.id=='%2'){";if(_76)c+=format("i%1=n%1.length;",_76);return format(c,_74,b)},"\\.([\\w-]+)":function(a,b){_75=false;_73.push(new RegExp("(^|\\s)"+rescape(b)+"(\\s|$)"));return format("if(e%1.className&&reg[%2].test(e%1.className)){",_74,_73.length-1)},":not\\((\\*|[\\w-]+)?([^)]*)\\)":function(a,b,c){var d=(b&&b!="*")?format("if(e%1.nodeName=='%2'[c]()){",_74,b):"";d+=_79.exec(c);return"if(!"+d.slice(2,-1).replace(/\)\{if\(/g,"&&")+"){"},":nth(-last)?-child\\(([^)]+)\\)":function(a,b,c){_75=false;b=format("e%1.parentNode.b2_length",_74);var d="if(p%1!==e%1.parentNode)p%1=_81(e%1.parentNode);";d+="var i=e%1[p%1.b2_lookup];if(p%1.b2_lookup!='b2_index')i++;if(";return format(d,_74)+_57(a,c,"i",b,"!","&&","%","==")+"){"},":([\\w-]+)(\\(([^)]+)\\))?":function(a,b,c,d){return"if("+format(_64[b]||"throw",_74,d||"")+"){"},"\\[([\\w-]+)\\s*([^=]?=)?\\s*([^\\]]*)\\]":function(a,b,c,d){var e=_35[b]||b;if(c){var f="e%1.getAttribute('%2',2)";if(!_34.test(b)){f="e%1.%3||"+f}b=format("("+f+")",_74,b,e)}else{b=format("Element.getAttribute(e%1,'%2')",_74,b)}var g=_63[c||""];if(instanceOf(g,RegExp)){_73.push(new RegExp(format(g.source,rescape(_79.unescape(d)))));g="reg[%2].test(%1)";d=_73.length-1}return"if("+format(g,b,d)+"){"}});new function(_){var _80=_30?function(a,b){var c=a.all[b]||null;if(!c||c.id==b)return c;for(var i=0;i<c.length;i++){if(c[i].id==b)return c[i]}return null}:function(a,b){return a.getElementById(b)};var _72=1;function _81(a){if(a.rows){a.b2_length=a.rows.length;a.b2_lookup="rowIndex"}else if(a.cells){a.b2_length=a.cells.length;a.b2_lookup="cellIndex"}else if(a.b2_indexed!=_72){var b=0;var c=a.firstChild;while(c){if(c.nodeType==1&&c.nodeName!="!"){c.b2_index=++b}c=c.nextSibling}a.b2_length=b;a.b2_lookup="b2_index"}a.b2_indexed=_72;return a};Selector.parse=function(a){if(!_78[a]){_73=[];var b="";var c=_79.escape(a).split(",");for(var i=0;i<c.length;i++){_75=_74=_76=0;_77=c.length>1?2:0;var d=_79.exec(c[i])||"throw;";if(_75&&_30){d+=format("if(e%1.nodeName!='!'){",_74)}var e=(_77>1)?_68:"";d+=format(e+_69,_74);d+=Array(match(d,/\{/g).length+1).join("}");b+=d}eval(format(_70,_73)+_79.unescape(b)+"return s?null:r}");_78[a]=_71}return _78[a]}};Document.implement(DocumentSelector);Element.implement(ElementSelector);var HTMLDocument=Document.extend(null,{"@(document.activeElement===undefined)":{bind:function(b){b.activeElement=null;EventTarget.addEventListener(b,"focus",function(a){b.activeElement=a.target},false);return this.base(b)}}});var HTMLElement=Element.extend({addClass:function(a,b){if(!this.hasClass(a,b)){a.className+=(a.className?" ":"")+b}},hasClass:function(a,b){var c=new RegExp("(^|\\s)"+b+"(\\s|$)");return c.test(a.className)},removeClass:function(a,b){var c=new RegExp("(^|\\s)"+b+"(\\s|$)","g");a.className=trim(a.className.replace(c,"$2"))},toggleClass:function(a,b){if(this.hasClass(a,b)){this.removeClass(a,b)}else{this.addClass(a,b)}}},{bindings:{},tags:"*",bind:function(a){CSSStyleDeclaration.bind(a.style);return this.base(a)},extend:function(){var b=base(this,arguments);var c=(b.tags||"").toUpperCase().split(",");forEach(c,function(a){HTMLElement.bindings[a]=b});return b},"@!(element.ownerDocument)":{bind:function(a){a.ownerDocument=Traversal.getOwnerDocument(a);return this.base(a)}}});HTMLElement.extend(null,{tags:"APPLET,EMBED",bind:I});eval(this.exports)};
