This file is indexed.

/usr/share/javascript/mochikit/MochiKit.min.js is in libjs-mochikit 1.4.2-4fakesync1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.Base")}if(typeof(MochiKit)=="undefined"){MochiKit={}}if(typeof(MochiKit.Base)=="undefined"){MochiKit.Base={}}if(typeof(MochiKit.__export__)=="undefined"){MochiKit.__export__=(MochiKit.__compat__||(typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined"))}MochiKit.Base.VERSION="1.4.2";MochiKit.Base.NAME="MochiKit.Base";MochiKit.Base.update=function(d,c){if(d===null||d===undefined){d={}}for(var b=1;b<arguments.length;b++){var e=arguments[b];if(typeof(e)!="undefined"&&e!==null){for(var a in e){d[a]=e[a]}}}return d};MochiKit.Base.update(MochiKit.Base,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]"},toString:function(){return this.__repr__()},camelize:function(b){var a=b.split("-");var d=a[0];for(var c=1;c<a.length;c++){d+=a[c].charAt(0).toUpperCase()+a[c].substring(1)}return d},counter:function(a){if(arguments.length===0){a=1}return function(){return a++}},clone:function(a){var b=arguments.callee;if(arguments.length==1){b.prototype=a;return new b()}},_deps:function(b,a){if(!(b in MochiKit)){MochiKit[b]={}}if(typeof(dojo)!="undefined"){dojo.provide("MochiKit."+b)}for(var c=0;c<a.length;c++){if(typeof(dojo)!="undefined"){dojo.require("MochiKit."+a[c])}if(typeof(JSAN)!="undefined"){JSAN.use("MochiKit."+a[c],[])}if(!(a[c] in MochiKit)){throw"MochiKit."+b+" depends on MochiKit."+a[c]+"!"}}},_flattenArray:function(c,a){for(var b=0;b<a.length;b++){var d=a[b];if(d instanceof Array){arguments.callee(c,d)}else{c.push(d)}}return c},flattenArray:function(a){return MochiKit.Base._flattenArray([],a)},flattenArguments:function(b){var e=[];var a=MochiKit.Base;var c=a.extend(null,arguments);while(c.length){var f=c.shift();if(f&&typeof(f)=="object"&&typeof(f.length)=="number"){for(var d=f.length-1;d>=0;d--){c.unshift(f[d])}}else{e.push(f)}}return e},extend:function(d,e,b){if(!b){b=0}if(e){var a=e.length;if(typeof(a)!="number"){if(typeof(MochiKit.Iter)!="undefined"){e=MochiKit.Iter.list(e);a=e.length}else{throw new TypeError("Argument not an array-like and MochiKit.Iter not present")}}if(!d){d=[]}for(var c=b;c<a;c++){d.push(e[c])}}return d},updatetree:function(a,e){if(a===null||a===undefined){a={}}for(var d=1;d<arguments.length;d++){var f=arguments[d];if(typeof(f)!="undefined"&&f!==null){for(var c in f){var b=f[c];if(typeof(a[c])=="object"&&typeof(b)=="object"){arguments.callee(a[c],b)}else{a[c]=b}}}}return a},setdefault:function(c,d){if(c===null||c===undefined){c={}}for(var b=1;b<arguments.length;b++){var e=arguments[b];for(var a in e){if(!(a in c)){c[a]=e[a]}}}return c},keys:function(c){var b=[];for(var a in c){b.push(a)}return b},values:function(c){var a=[];for(var b in c){a.push(c[b])}return a},items:function(d){var a=[];var c;for(var f in d){var b;try{b=d[f]}catch(c){continue}a.push([f,b])}return a},_newNamedError:function(c,b,a){a.prototype=new MochiKit.Base.NamedError(c.NAME+"."+b);c[b]=a},operator:{truth:function(b){return !!b},lognot:function(b){return !b},identity:function(b){return b},not:function(b){return ~b},neg:function(b){return -b},add:function(d,c){return d+c},sub:function(d,c){return d-c},div:function(d,c){return d/c},mod:function(d,c){return d%c},mul:function(d,c){return d*c},and:function(d,c){return d&c},or:function(d,c){return d|c},xor:function(d,c){return d^c},lshift:function(d,c){return d<<c},rshift:function(d,c){return d>>c},zrshift:function(d,c){return d>>>c},eq:function(d,c){return d==c},ne:function(d,c){return d!=c},gt:function(d,c){return d>c},ge:function(d,c){return d>=c},lt:function(d,c){return d<c},le:function(d,c){return d<=c},seq:function(d,c){return d===c},sne:function(d,c){return d!==c},ceq:function(d,c){return MochiKit.Base.compare(d,c)===0},cne:function(d,c){return MochiKit.Base.compare(d,c)!==0},cgt:function(d,c){return MochiKit.Base.compare(d,c)==1},cge:function(d,c){return MochiKit.Base.compare(d,c)!=-1},clt:function(d,c){return MochiKit.Base.compare(d,c)==-1},cle:function(d,c){return MochiKit.Base.compare(d,c)!=1},logand:function(d,c){return d&&c},logor:function(d,c){return d||c},contains:function(d,c){return c in d}},forwardCall:function(a){return function(){return this[a].apply(this,arguments)}},itemgetter:function(a){return function(b){return b[a]}},typeMatcher:function(){var a={};for(var b=0;b<arguments.length;b++){var c=arguments[b];a[c]=c}return function(){for(var d=0;d<arguments.length;d++){if(!(typeof(arguments[d]) in a)){return false}}return true}},isNull:function(){for(var a=0;a<arguments.length;a++){if(arguments[a]!==null){return false}}return true},isUndefinedOrNull:function(){for(var a=0;a<arguments.length;a++){var b=arguments[a];if(!(typeof(b)=="undefined"||b===null)){return false}}return true},isEmpty:function(a){return !MochiKit.Base.isNotEmpty.apply(this,arguments)},isNotEmpty:function(b){for(var a=0;a<arguments.length;a++){var c=arguments[a];if(!(c&&c.length)){return false}}return true},isArrayLike:function(){for(var a=0;a<arguments.length;a++){var c=arguments[a];var b=typeof(c);if((b!="object"&&!(b=="function"&&typeof(c.item)=="function"))||c===null||typeof(c.length)!="number"||c.nodeType===3||c.nodeType===4){return false}}return true},isDateLike:function(){for(var a=0;a<arguments.length;a++){var b=arguments[a];if(typeof(b)!="object"||b===null||typeof(b.getTime)!="function"){return false}}return true},xmap:function(b){if(b===null){return MochiKit.Base.extend(null,arguments,1)}var c=[];for(var a=1;a<arguments.length;a++){c.push(b(arguments[a]))}return c},map:function(n,e){var a=MochiKit.Base;var g=MochiKit.Iter;var o=a.isArrayLike;if(arguments.length<=2){if(!o(e)){if(g){e=g.list(e);if(n===null){return e}}else{throw new TypeError("Argument not an array-like and MochiKit.Iter not present")}}if(n===null){return a.extend(null,e)}var k=[];for(var d=0;d<e.length;d++){k.push(n(e[d]))}return k}else{if(n===null){n=Array}var h=null;for(d=1;d<arguments.length;d++){if(!o(arguments[d])){if(g){return g.list(g.imap.apply(null,arguments))}else{throw new TypeError("Argument not an array-like and MochiKit.Iter not present")}}var b=arguments[d].length;if(h===null||h>b){h=b}}k=[];for(d=0;d<h;d++){var f=[];for(var c=1;c<arguments.length;c++){f.push(arguments[c][d])}k.push(n.apply(this,f))}return k}},xfilter:function(b){var c=[];if(b===null){b=MochiKit.Base.operator.truth}for(var a=1;a<arguments.length;a++){var d=arguments[a];if(b(d)){c.push(d)}}return c},filter:function(d,b,f){var e=[];var a=MochiKit.Base;if(!a.isArrayLike(b)){if(MochiKit.Iter){b=MochiKit.Iter.list(b)}else{throw new TypeError("Argument not an array-like and MochiKit.Iter not present")}}if(d===null){d=a.operator.truth}if(typeof(Array.prototype.filter)=="function"){return Array.prototype.filter.call(b,d,f)}else{if(typeof(f)=="undefined"||f===null){for(var c=0;c<b.length;c++){var g=b[c];if(d(g)){e.push(g)}}}else{for(c=0;c<b.length;c++){g=b[c];if(d.call(f,g)){e.push(g)}}}}return e},_wrapDumbFunction:function(_a2){return function(){switch(arguments.length){case 0:return _a2();case 1:return _a2(arguments[0]);case 2:return _a2(arguments[0],arguments[1]);case 3:return _a2(arguments[0],arguments[1],arguments[2])}var _a3=[];for(var i=0;i<arguments.length;i++){_a3.push("arguments["+i+"]")}return eval("(func("+_a3.join(",")+"))")}},methodcaller:function(b){var a=MochiKit.Base.extend(null,arguments,1);if(typeof(b)=="function"){return function(c){return b.apply(c,a)}}else{return function(c){return c[b].apply(c,a)}}},method:function(c,b){var a=MochiKit.Base;return a.bind.apply(this,a.extend([b,c],arguments,2))},compose:function(b,f){var e=[];var a=MochiKit.Base;if(arguments.length===0){throw new TypeError("compose() requires at least one argument")}for(var c=0;c<arguments.length;c++){var d=arguments[c];if(typeof(d)!="function"){throw new TypeError(a.repr(d)+" is not a function")}e.push(d)}return function(){var h=arguments;for(var g=e.length-1;g>=0;g--){h=[e[g].apply(this,h)]}return h[0]}},bind:function(g,f){if(typeof(g)=="string"){g=f[g]}var d=g.im_func;var c=g.im_preargs;var b=g.im_self;var a=MochiKit.Base;if(typeof(g)=="function"&&typeof(g.apply)=="undefined"){g=a._wrapDumbFunction(g)}if(typeof(d)!="function"){d=g}if(typeof(f)!="undefined"){b=f}if(typeof(c)=="undefined"){c=[]}else{c=c.slice()}a.extend(c,arguments,2);var e=function(){var j=arguments;var k=arguments.callee;if(k.im_preargs.length>0){j=a.concat(k.im_preargs,j)}var h=k.im_self;if(!h){h=this}return k.im_func.apply(h,j)};e.im_self=b;e.im_func=d;e.im_preargs=c;return e},bindLate:function(b,e){var a=MochiKit.Base;if(typeof(b)!="string"){return a.bind.apply(this,arguments)}var d=a.extend([],arguments,2);var c=function(){var h=arguments;var g=arguments.callee;if(g.im_preargs.length>0){h=a.concat(g.im_preargs,h)}var f=g.im_self;if(!f){f=this}return f[g.im_func].apply(f,h)};c.im_self=e;c.im_func=b;c.im_preargs=d;return c},bindMethods:function(d){var c=MochiKit.Base.bind;for(var b in d){var a=d[b];if(typeof(a)=="function"){d[b]=c(a,d)}}},registerComparator:function(d,c,b,a){MochiKit.Base.comparatorRegistry.register(d,c,b,a)},_primitives:{"boolean":true,string:true,number:true},compare:function(g,d){if(g==d){return 0}var h=(typeof(g)=="undefined"||g===null);var f=(typeof(d)=="undefined"||d===null);if(h&&f){return 0}else{if(h){return -1}else{if(f){return 1}}}var c=MochiKit.Base;var l=c._primitives;if(!(typeof(g) in l&&typeof(d) in l)){try{return c.comparatorRegistry.match(g,d)}catch(j){if(j!=c.NotFound){throw j}}}if(g<d){return -1}else{if(g>d){return 1}}var k=c.repr;throw new TypeError(k(g)+" and "+k(d)+" can not be compared")},compareDateLike:function(d,c){return MochiKit.Base.compare(d.getTime(),c.getTime())},compareArrayLike:function(d,c){var f=MochiKit.Base.compare;var j=d.length;var h=0;if(j>c.length){h=1;j=c.length}else{if(j<c.length){h=-1}}for(var e=0;e<j;e++){var g=f(d[e],c[e]);if(g){return g}}return h},registerRepr:function(d,b,c,a){MochiKit.Base.reprRegistry.register(d,b,c,a)},repr:function(d){if(typeof(d)=="undefined"){return"undefined"}else{if(d===null){return"null"}}try{if(typeof(d.__repr__)=="function"){return d.__repr__()}else{if(typeof(d.repr)=="function"&&d.repr!=arguments.callee){return d.repr()}}return MochiKit.Base.reprRegistry.match(d)}catch(c){if(typeof(d.NAME)=="string"&&(d.toString==Function.prototype.toString||d.toString==Object.prototype.toString)){return d.NAME}}try{var b=(d+"")}catch(c){return"["+typeof(d)+"]"}if(typeof(d)=="function"){b=b.replace(/^\s+/,"").replace(/\s+/g," ");b=b.replace(/,(\S)/,", $1");var a=b.indexOf("{");if(a!=-1){b=b.substr(0,a)+"{...}"}}return b},reprArrayLike:function(b){var a=MochiKit.Base;return"["+a.map(a.repr,b).join(", ")+"]"},reprString:function(a){return('"'+a.replace(/(["\\])/g,"\\$1")+'"').replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\v]/g,"\\v").replace(/[\r]/g,"\\r")},reprNumber:function(a){return a+""},registerJSON:function(a,d,c,b){MochiKit.Base.jsonRegistry.register(a,d,c,b)},evalJSON:function(){return eval("("+MochiKit.Base._filterJSON(arguments[0])+")")},_filterJSON:function(b){var a=b.match(/^\s*\/\*(.*)\*\/\s*$/);if(a){return a[1]}return b},serializeJSON:function(b){var a=typeof(b);if(a=="number"||a=="boolean"){return b+""}else{if(b===null){return"null"}else{if(a=="string"){var n="";for(var j=0;j<b.length;j++){var q=b.charAt(j);if(q=='"'){n+='\\"'}else{if(q=="\\"){n+="\\\\"}else{if(q=="\b"){n+="\\b"}else{if(q=="\f"){n+="\\f"}else{if(q=="\n"){n+="\\n"}else{if(q=="\r"){n+="\\r"}else{if(q=="\t"){n+="\\t"}else{if(b.charCodeAt(j)<=31){var g=b.charCodeAt(j).toString(16);if(g.length<2){g="0"+g}n+="\\u00"+g.toUpperCase()}else{n+=q}}}}}}}}}return'"'+n+'"'}}}var r=arguments.callee;var s;if(typeof(b.__json__)=="function"){s=b.__json__();if(b!==s){return r(s)}}if(typeof(b.json)=="function"){s=b.json();if(b!==s){return r(s)}}if(a!="function"&&typeof(b.length)=="number"){var n=[];for(var j=0;j<b.length;j++){var d=r(b[j]);if(typeof(d)!="string"){continue}n.push(d)}return"["+n.join(", ")+"]"}var f=MochiKit.Base;try{s=f.jsonRegistry.match(b);if(b!==s){return r(s)}}catch(l){if(l!=f.NotFound){throw l}}if(a=="undefined"){throw new TypeError("undefined can not be serialized as JSON")}if(a=="function"){return null}n=[];for(var h in b){var t;if(typeof(h)=="number"){t='"'+h+'"'}else{if(typeof(h)=="string"){t=r(h)}else{continue}}d=r(b[h]);if(typeof(d)!="string"){continue}n.push(t+":"+d)}return"{"+n.join(", ")+"}"},objEqual:function(d,c){return(MochiKit.Base.compare(d,c)===0)},arrayEqual:function(b,a){if(b.length!=a.length){return false}return(MochiKit.Base.compare(b,a)===0)},concat:function(){var c=[];var b=MochiKit.Base.extend;for(var a=0;a<arguments.length;a++){b(c,arguments[a])}return c},keyComparator:function(c){var a=MochiKit.Base;var b=a.compare;if(arguments.length==1){return function(f,e){return b(f[c],e[c])}}var d=a.extend(null,arguments);return function(f,e){var j=0;for(var h=0;(j===0)&&(h<d.length);h++){var g=d[h];j=b(f[g],e[g])}return j}},reverseKeyComparator:function(a){var b=MochiKit.Base.keyComparator.apply(this,arguments);return function(d,c){return b(c,d)}},partial:function(b){var a=MochiKit.Base;return a.bind.apply(this,a.extend([b,undefined],arguments,1))},listMinMax:function(d,a){if(a.length===0){return null}var f=a[0];var b=MochiKit.Base.compare;for(var c=1;c<a.length;c++){var e=a[c];if(b(e,f)==d){f=e}}return f},objMax:function(){return MochiKit.Base.listMinMax(1,arguments)},objMin:function(){return MochiKit.Base.listMinMax(-1,arguments)},findIdentical:function(a,d,c,b){if(typeof(b)=="undefined"||b===null){b=a.length}if(typeof(c)=="undefined"||c===null){c=0}for(var e=c;e<b;e++){if(a[e]===d){return e}}return -1},mean:function(){var d=0;var a=MochiKit.Base;var b=a.extend(null,arguments);var f=b.length;while(b.length){var e=b.shift();if(e&&typeof(e)=="object"&&typeof(e.length)=="number"){f+=e.length-1;for(var c=e.length-1;c>=0;c--){d+=e[c]}}else{d+=e}}if(f<=0){throw new TypeError("mean() requires at least one argument")}return d/f},median:function(){var b=MochiKit.Base.flattenArguments(arguments);if(b.length===0){throw new TypeError("median() requires at least one argument")}b.sort(compare);if(b.length%2==0){var a=b.length/2;return(b[a]+b[a-1])/2}else{return b[(b.length-1)/2]}},findValue:function(a,d,c,b){if(typeof(b)=="undefined"||b===null){b=a.length}if(typeof(c)=="undefined"||c===null){c=0}var f=MochiKit.Base.compare;for(var e=c;e<b;e++){if(f(a[e],d)===0){return e}}return -1},nodeWalk:function(e,c){var b=[e];var a=MochiKit.Base.extend;while(b.length){var d=c(b.shift());if(d){a(b,d)}}},nameFunctions:function(a){var c=a.NAME;if(typeof(c)=="undefined"){c=""}else{c=c+"."}for(var b in a){var f=a[b];if(typeof(f)=="function"&&typeof(f.NAME)=="undefined"){try{f.NAME=c+b}catch(d){}}}},queryString:function(j,h){if(typeof(MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof(j)=="string"||(typeof(j.nodeType)!="undefined"&&j.nodeType>0))){var f=MochiKit.DOM.formContents(j);j=f[0];h=f[1]}else{if(arguments.length==1){if(typeof(j.length)=="number"&&j.length==2){return arguments.callee(j[0],j[1])}var a=j;j=[];h=[];for(var b in a){var l=a[b];if(typeof(l)=="function"){continue}else{if(MochiKit.Base.isArrayLike(l)){for(var c=0;c<l.length;c++){j.push(b);h.push(l[c])}}else{j.push(b);h.push(l)}}}}}var d=[];var e=Math.min(j.length,h.length);var g=MochiKit.Base.urlEncode;for(var c=0;c<e;c++){l=h[c];if(typeof(l)!="undefined"&&l!==null){d.push(g(j[c])+"="+g(l))}}return d.join("&")},parseQueryString:function(k,j){var c=(k.charAt(0)=="?")?k.substring(1):k;var h=c.replace(/\+/g,"%20").split(/\&amp\;|\&\#38\;|\&#x26;|\&/);var b={};var g;if(typeof(decodeURIComponent)!="undefined"){g=decodeURIComponent}else{g=unescape}if(j){for(var e=0;e<h.length;e++){var d=h[e].split("=");var a=g(d.shift());if(!a){continue}var f=b[a];if(!(f instanceof Array)){f=[];b[a]=f}f.push(g(d.join("=")))}}else{for(e=0;e<h.length;e++){d=h[e].split("=");var a=d.shift();if(!a){continue}b[g(a)]=g(d.join("="))}}return b}});MochiKit.Base.AdapterRegistry=function(){this.pairs=[]};MochiKit.Base.AdapterRegistry.prototype={register:function(a,d,b,c){if(c){this.pairs.unshift([a,d,b])}else{this.pairs.push([a,d,b])}},match:function(){for(var a=0;a<this.pairs.length;a++){var b=this.pairs[a];if(b[1].apply(this,arguments)){return b[2].apply(this,arguments)}}throw MochiKit.Base.NotFound},unregister:function(a){for(var b=0;b<this.pairs.length;b++){var c=this.pairs[b];if(c[0]==a){this.pairs.splice(b,1);return true}}return false}};MochiKit.Base.EXPORT=["flattenArray","noop","camelize","counter","clone","extend","update","updatetree","setdefault","keys","values","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","methodcaller","compose","bind","bindLate","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","findValue","findIdentical","flattenArguments","method","average","mean","median"];MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];MochiKit.Base._exportSymbols=function(b,a){if(!MochiKit.__export__){return}var d=a.EXPORT_TAGS[":all"];for(var c=0;c<d.length;c++){b[d[c]]=a[d[c]]}};MochiKit.Base.__new__=function(){var a=this;a.noop=a.operator.identity;a.forward=a.forwardCall;a.find=a.findValue;if(typeof(encodeURIComponent)!="undefined"){a.urlEncode=function(c){return encodeURIComponent(c).replace(/\'/g,"%27")}}else{a.urlEncode=function(c){return escape(c).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27")}}a.NamedError=function(c){this.message=c;this.name=c};a.NamedError.prototype=new Error();a.update(a.NamedError.prototype,{repr:function(){if(this.message&&this.message!=this.name){return this.name+"("+a.repr(this.message)+")"}else{return this.name+"()"}},toString:a.forwardCall("repr")});a.NotFound=new a.NamedError("MochiKit.Base.NotFound");a.listMax=a.partial(a.listMinMax,1);a.listMin=a.partial(a.listMinMax,-1);a.isCallable=a.typeMatcher("function");a.isUndefined=a.typeMatcher("undefined");a.merge=a.partial(a.update,null);a.zip=a.partial(a.map,null);a.average=a.mean;a.comparatorRegistry=new a.AdapterRegistry();a.registerComparator("dateLike",a.isDateLike,a.compareDateLike);a.registerComparator("arrayLike",a.isArrayLike,a.compareArrayLike);a.reprRegistry=new a.AdapterRegistry();a.registerRepr("arrayLike",a.isArrayLike,a.reprArrayLike);a.registerRepr("string",a.typeMatcher("string"),a.reprString);a.registerRepr("numbers",a.typeMatcher("number","boolean"),a.reprNumber);a.jsonRegistry=new a.AdapterRegistry();var b=a.concat(a.EXPORT,a.EXPORT_OK);a.EXPORT_TAGS={":common":a.concat(a.EXPORT_OK),":all":b};a.nameFunctions(this)};MochiKit.Base.__new__();if(MochiKit.__export__){compare=MochiKit.Base.compare;compose=MochiKit.Base.compose;serializeJSON=MochiKit.Base.serializeJSON;mean=MochiKit.Base.mean;median=MochiKit.Base.median}MochiKit.Base._exportSymbols(this,MochiKit.Base);MochiKit.Base._deps("Iter",["Base"]);MochiKit.Iter.NAME="MochiKit.Iter";MochiKit.Iter.VERSION="1.4.2";MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]"},toString:function(){return this.__repr__()},registerIteratorFactory:function(a,d,c,b){MochiKit.Iter.iteratorRegistry.register(a,d,c,b)},isIterable:function(a){return a!=null&&(typeof(a.next)=="function"||typeof(a.iter)=="function")},iter:function(d,c){var b=MochiKit.Iter;if(arguments.length==2){return b.takewhile(function(e){return e!=c},d)}if(typeof(d.next)=="function"){return d}else{if(typeof(d.iter)=="function"){return d.iter()}}try{return b.iteratorRegistry.match(d)}catch(f){var a=MochiKit.Base;if(f==a.NotFound){f=new TypeError(typeof(d)+": "+a.repr(d)+" is not iterable")}throw f}},count:function(b){if(!b){b=0}var a=MochiKit.Base;return{repr:function(){return"count("+b+")"},toString:a.forwardCall("repr"),next:a.counter(b)}},cycle:function(e){var d=MochiKit.Iter;var b=MochiKit.Base;var a=[];var c=d.iter(e);return{repr:function(){return"cycle(...)"},toString:b.forwardCall("repr"),next:function(){try{var h=c.next();a.push(h);return h}catch(g){if(g!=d.StopIteration){throw g}if(a.length===0){this.next=function(){throw d.StopIteration}}else{var f=-1;this.next=function(){f=(f+1)%a.length;return a[f]}}return this.next()}}}},repeat:function(b,c){var a=MochiKit.Base;if(typeof(c)=="undefined"){return{repr:function(){return"repeat("+a.repr(b)+")"},toString:a.forwardCall("repr"),next:function(){return b}}}return{repr:function(){return"repeat("+a.repr(b)+", "+c+")"},toString:a.forwardCall("repr"),next:function(){if(c<=0){throw MochiKit.Iter.StopIteration}c-=1;return b}}},next:function(a){return a.next()},izip:function(f,e){var a=MochiKit.Base;var c=MochiKit.Iter;var d=c.next;var b=a.map(c.iter,arguments);return{repr:function(){return"izip(...)"},toString:a.forwardCall("repr"),next:function(){return a.map(d,b)}}},ifilter:function(c,b){var a=MochiKit.Base;b=MochiKit.Iter.iter(b);if(c===null){c=a.operator.truth}return{repr:function(){return"ifilter(...)"},toString:a.forwardCall("repr"),next:function(){while(true){var d=b.next();if(c(d)){return d}}return undefined}}},ifilterfalse:function(c,b){var a=MochiKit.Base;b=MochiKit.Iter.iter(b);if(c===null){c=a.operator.truth}return{repr:function(){return"ifilterfalse(...)"},toString:a.forwardCall("repr"),next:function(){while(true){var d=b.next();if(!c(d)){return d}}return undefined}}},islice:function(c){var b=MochiKit.Iter;var a=MochiKit.Base;c=b.iter(c);var g=0;var e=0;var f=1;var d=-1;if(arguments.length==2){e=arguments[1]}else{if(arguments.length==3){g=arguments[1];e=arguments[2]}else{g=arguments[1];e=arguments[2];f=arguments[3]}}return{repr:function(){return"islice("+["...",g,e,f].join(", ")+")"},toString:a.forwardCall("repr"),next:function(){var h;while(d<g){h=c.next();d++}if(g>=e){throw b.StopIteration}g+=f;return h}}},imap:function(b,h,f){var a=MochiKit.Base;var c=MochiKit.Iter;var d=a.map(c.iter,a.extend(null,arguments,1));var g=a.map;var e=c.next;return{repr:function(){return"imap(...)"},toString:a.forwardCall("repr"),next:function(){return b.apply(this,g(e,d))}}},applymap:function(b,d,c){d=MochiKit.Iter.iter(d);var a=MochiKit.Base;return{repr:function(){return"applymap(...)"},toString:a.forwardCall("repr"),next:function(){return b.apply(c,d.next())}}},chain:function(e,d){var b=MochiKit.Iter;var a=MochiKit.Base;if(arguments.length==1){return b.iter(arguments[0])}var c=a.map(b.iter,arguments);return{repr:function(){return"chain(...)"},toString:a.forwardCall("repr"),next:function(){while(c.length>1){try{var g=c[0].next();return g}catch(h){if(h!=b.StopIteration){throw h}c.shift();var g=c[0].next();return g}}if(c.length==1){var f=c.shift();this.next=a.bind("next",f);return this.next()}throw b.StopIteration}}},takewhile:function(c,b){var a=MochiKit.Iter;b=a.iter(b);return{repr:function(){return"takewhile(...)"},toString:MochiKit.Base.forwardCall("repr"),next:function(){var d=b.next();if(!c(d)){this.next=function(){throw a.StopIteration};this.next()}return d}}},dropwhile:function(c,b){b=MochiKit.Iter.iter(b);var a=MochiKit.Base;var d=a.bind;return{repr:function(){return"dropwhile(...)"},toString:a.forwardCall("repr"),next:function(){while(true){var e=b.next();if(!c(e)){break}}this.next=d("next",b);return e}}},_tee:function(b,c,e){c.pos[b]=-1;var a=MochiKit.Base;var d=a.listMin;return{repr:function(){return"tee("+b+", ...)"},toString:a.forwardCall("repr"),next:function(){var g;var f=c.pos[b];if(f==c.max){g=e.next();c.deque.push(g);c.max+=1;c.pos[b]+=1}else{g=c.deque[f-c.min];c.pos[b]+=1;if(f==c.min&&d(c.pos)!=c.min){c.min+=1;c.deque.shift()}}return g}}},tee:function(g,f){var e=[];var d={pos:[],deque:[],max:-1,min:-1};if(arguments.length==1||typeof(f)=="undefined"||f===null){f=2}var b=MochiKit.Iter;g=b.iter(g);var a=b._tee;for(var c=0;c<f;c++){e.push(a(c,d,g))}return e},list:function(d){var g;if(d instanceof Array){return d.slice()}if(typeof(d)=="function"&&!(d instanceof Function)&&typeof(d.length)=="number"){g=[];for(var c=0;c<d.length;c++){g.push(d[c])}return g}var b=MochiKit.Iter;d=b.iter(d);var g=[];var a;try{while(true){a=d.next();g.push(a)}}catch(f){if(f!=b.StopIteration){throw f}return g}return undefined},reduce:function(d,h,g){var c=0;var a=g;var b=MochiKit.Iter;h=b.iter(h);if(arguments.length<3){try{a=h.next()}catch(f){if(f==b.StopIteration){f=new TypeError("reduce() of empty sequence with no initial value")}throw f}c++}try{while(true){a=d(a,h.next())}}catch(f){if(f!=b.StopIteration){throw f}}return a},range:function(){var c=0;var a=0;var b=1;if(arguments.length==1){a=arguments[0]}else{if(arguments.length==2){c=arguments[0];a=arguments[1]}else{if(arguments.length==3){c=arguments[0];a=arguments[1];b=arguments[2]}else{throw new TypeError("range() takes 1, 2, or 3 arguments!")}}}if(b===0){throw new TypeError("range() step must not be 0")}return{next:function(){if((b>0&&c>=a)||(b<0&&c<=a)){throw MochiKit.Iter.StopIteration}var d=c;c+=b;return d},repr:function(){return"range("+[c,a,b].join(", ")+")"},toString:MochiKit.Base.forwardCall("repr")}},sum:function(f,c){if(typeof(c)=="undefined"||c===null){c=0}var a=c;var b=MochiKit.Iter;f=b.iter(f);try{while(true){a+=f.next()}}catch(d){if(d!=b.StopIteration){throw d}}return a},exhaust:function(b){var a=MochiKit.Iter;b=a.iter(b);try{while(true){b.next()}}catch(c){if(c!=a.StopIteration){throw c}}},forEach:function(c,f,h){var a=MochiKit.Base;var b=MochiKit.Iter;if(arguments.length>2){f=a.bind(f,h)}if(a.isArrayLike(c)&&!b.isIterable(c)){try{for(var d=0;d<c.length;d++){f(c[d])}}catch(g){if(g!=b.StopIteration){throw g}}}else{b.exhaust(b.imap(f,c))}},every:function(a,c){var b=MochiKit.Iter;try{b.ifilterfalse(c,a).next();return false}catch(d){if(d!=b.StopIteration){throw d}return true}},sorted:function(a,b){var c=MochiKit.Iter.list(a);if(arguments.length==1){b=MochiKit.Base.compare}c.sort(b);return c},reversed:function(b){var a=MochiKit.Iter.list(b);a.reverse();return a},some:function(c,b){var a=MochiKit.Iter;try{a.ifilter(b,c).next();return true}catch(d){if(d!=a.StopIteration){throw d}return false}},iextend:function(b,d){var a=MochiKit.Base;var c=MochiKit.Iter;if(a.isArrayLike(d)&&!c.isIterable(d)){for(var f=0;f<d.length;f++){b.push(d[f])}}else{d=c.iter(d);try{while(true){b.push(d.next())}}catch(g){if(g!=c.StopIteration){throw g}}}return b},groupby:function(j,h){var c=MochiKit.Base;var n=MochiKit.Iter;if(arguments.length<2){h=c.operator.identity}j=n.iter(j);var f=undefined;var d=undefined;var l;function a(){l=j.next();d=h(l)}function b(){var k=l;l=undefined;return k}var g=true;var e=c.compare;return{repr:function(){return"groupby(...)"},next:function(){while(e(d,f)===0){a();if(g){g=false;break}}f=d;return[d,{next:function(){if(l==undefined){a()}if(e(d,f)!==0){throw n.StopIteration}return b()}}]}}},groupby_as_array:function(f,d){var b=MochiKit.Base;var o=MochiKit.Iter;if(arguments.length<2){d=b.operator.identity}f=o.iter(f);var k=[];var j=true;var h;var g=b.compare;while(true){try{var c=f.next();var n=d(c)}catch(l){if(l==o.StopIteration){break}throw l}if(j||g(n,h)!==0){var a=[];k.push([n,a])}a.push(c);j=false;h=n}return k},arrayLikeIter:function(a){var b=0;return{repr:function(){return"arrayLikeIter(...)"},toString:MochiKit.Base.forwardCall("repr"),next:function(){if(b>=a.length){throw MochiKit.Iter.StopIteration}return a[b++]}}},hasIterateNext:function(a){return(a&&typeof(a.iterateNext)=="function")},iterateNextIter:function(a){return{repr:function(){return"iterateNextIter(...)"},toString:MochiKit.Base.forwardCall("repr"),next:function(){var b=a.iterateNext();if(b===null||b===undefined){throw MochiKit.Iter.StopIteration}return b}}}});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 a=MochiKit.Base;if(typeof(StopIteration)!="undefined"){this.StopIteration=StopIteration}else{this.StopIteration=new a.NamedError("StopIteration")}this.iteratorRegistry=new a.AdapterRegistry();this.registerIteratorFactory("arrayLike",a.isArrayLike,this.arrayLikeIter);this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter);this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)};MochiKit.Iter.__new__();if(MochiKit.__export__){reduce=MochiKit.Iter.reduce}MochiKit.Base._exportSymbols(this,MochiKit.Iter);MochiKit.Base._deps("Logging",["Base"]);MochiKit.Logging.NAME="MochiKit.Logging";MochiKit.Logging.VERSION="1.4.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(a,b,c){this.num=a;this.level=b;this.info=c;this.timestamp=new Date()};MochiKit.Logging.LogMessage.prototype={repr:function(){var a=MochiKit.Base;return"LogMessage("+a.map(a.repr,[this.num,this.level,this.info]).join(", ")+")"},toString:MochiKit.Base.forwardCall("repr")};MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(b){var a=MochiKit.Logging;if(typeof(b)=="string"){b=a.LogLevel[b]}return function(d){var c=d.level;if(typeof(c)=="string"){c=a.LogLevel[c]}return c>=b}},isLogMessage:function(){var a=MochiKit.Logging.LogMessage;for(var b=0;b<arguments.length;b++){if(!(arguments[b] instanceof a)){return false}}return true},compareLogMessage:function(d,c){return MochiKit.Base.compare([d.level,d.info],[c.level,c.info])},alertListener:function(a){alert("num: "+a.num+"\nlevel: "+a.level+"\ninfo: "+a.info.join(" "))}});MochiKit.Logging.Logger=function(a){this.counter=0;if(typeof(a)=="undefined"||a===null){a=-1}this.maxSize=a;this._messages=[];this.listeners={};this.useNativeConsole=false};MochiKit.Logging.Logger.prototype={clear:function(){this._messages.splice(0,this._messages.length)},logToConsole:function(a){if(typeof(window)!="undefined"&&window.console&&window.console.log){window.console.log(a.replace(/%/g,"\uff05"))}else{if(typeof(opera)!="undefined"&&opera.postError){opera.postError(a)}else{if(typeof(printfire)=="function"){printfire(a)}else{if(typeof(Debug)!="undefined"&&Debug.writeln){Debug.writeln(a)}else{if(typeof(debug)!="undefined"&&debug.trace){debug.trace(a)}}}}}},dispatchListeners:function(c){for(var a in this.listeners){var b=this.listeners[a];if(b.ident!=a||(b[0]&&!b[0](c))){continue}b[1](c)}},addListener:function(d,c,b){if(typeof(c)=="string"){c=MochiKit.Logging.logLevelAtLeast(c)}var a=[c,b];a.ident=d;this.listeners[d]=a},removeListener:function(a){delete this.listeners[a]},baseLog:function(a,b){if(typeof(a)=="number"){if(a>=MochiKit.Logging.LogLevel.FATAL){a="FATAL"}else{if(a>=MochiKit.Logging.LogLevel.ERROR){a="ERROR"}else{if(a>=MochiKit.Logging.LogLevel.WARNING){a="WARNING"}else{if(a>=MochiKit.Logging.LogLevel.INFO){a="INFO"}else{a="DEBUG"}}}}}var c=new MochiKit.Logging.LogMessage(this.counter,a,MochiKit.Base.extend(null,arguments,1));this._messages.push(c);this.dispatchListeners(c);if(this.useNativeConsole){this.logToConsole(c.level+": "+c.info.join(" "))}this.counter+=1;while(this.maxSize>=0&&this._messages.length>this.maxSize){this._messages.shift()}},getMessages:function(b){var a=0;if(!(typeof(b)=="undefined"||b===null)){a=Math.max(0,this._messages.length-b)}return this._messages.slice(a)},getMessageText:function(b){if(typeof(b)=="undefined"||b===null){b=30}var c=this.getMessages(b);if(c.length){var a=map(function(d){return"\n  ["+d.num+"] "+d.level+": "+d.info.join(" ")},c);a.unshift("LAST "+c.length+" MESSAGES:");return a.join("")}return""},debuggingBookmarklet:function(a){if(typeof(MochiKit.LoggingPane)=="undefined"){alert(this.getMessageText())}else{MochiKit.LoggingPane.createLoggingPane(a||false)}}};MochiKit.Logging.__new__=function(){this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10};var a=MochiKit.Base;a.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage);var f=a.partial;var e=this.Logger;var d=e.prototype.baseLog;a.update(this.Logger.prototype,{debug:f(d,"DEBUG"),log:f(d,"INFO"),error:f(d,"ERROR"),fatal:f(d,"FATAL"),warning:f(d,"WARNING")});var b=this;var c=function(g){return function(){b.logger[g].apply(b.logger,arguments)}};this.log=c("log");this.logError=c("error");this.logDebug=c("debug");this.logFatal=c("fatal");this.logWarning=c("warning");this.logger=new e();this.logger.useNativeConsole=true;this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)};if(typeof(printfire)=="undefined"&&typeof(document)!="undefined"&&document.createEvent&&typeof(dispatchEvent)!="undefined"){printfire=function(){printfire.args=arguments;var a=document.createEvent("Events");a.initEvent("printfire",false,true);dispatchEvent(a)}}MochiKit.Logging.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Logging);MochiKit.Base._deps("DateTime",["Base"]);MochiKit.DateTime.NAME="MochiKit.DateTime";MochiKit.DateTime.VERSION="1.4.2";MochiKit.DateTime.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.DateTime.toString=function(){return this.__repr__()};MochiKit.DateTime.isoDate=function(c){c=c+"";if(typeof(c)!="string"||c.length===0){return null}var b=c.split("-");if(b.length===0){return null}var a=new Date(b[0],b[1]-1,b[2]);a.setFullYear(b[0]);a.setMonth(b[1]-1);a.setDate(b[2]);return a};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(h){h=h+"";if(typeof(h)!="string"||h.length===0){return null}var g=h.match(MochiKit.DateTime._isoRegexp);if(typeof(g)=="undefined"||g===null){return null}var j,b,k,c,d,e,a;j=parseInt(g[1],10);if(typeof(g[2])=="undefined"||g[2]===""){return new Date(j)}b=parseInt(g[2],10)-1;k=parseInt(g[3],10);if(typeof(g[4])=="undefined"||g[4]===""){return new Date(j,b,k)}c=parseInt(g[4],10);d=parseInt(g[5],10);e=(typeof(g[6])!="undefined"&&g[6]!=="")?parseInt(g[6],10):0;if(typeof(g[7])!="undefined"&&g[7]!==""){a=Math.round(1000*parseFloat("0."+g[7]))}else{a=0}if((typeof(g[8])=="undefined"||g[8]==="")&&(typeof(g[9])=="undefined"||g[9]==="")){return new Date(j,b,k,c,d,e,a)}var f;if(typeof(g[9])!="undefined"&&g[9]!==""){f=parseInt(g[10],10)*3600000;if(typeof(g[11])!="undefined"&&g[11]!==""){f+=parseInt(g[11],10)*60000}if(g[9]=="-"){f=-f}}else{f=0}return new Date(Date.UTC(j,b,k,c,d,e,a)-f)};MochiKit.DateTime.toISOTime=function(b,e){if(typeof(b)=="undefined"||b===null){return null}var d=b.getHours();var f=b.getMinutes();var c=b.getSeconds();var a=[((e&&(d<10))?"0"+d:d),((f<10)?"0"+f:f),((c<10)?"0"+c:c)];return a.join(":")};MochiKit.DateTime.toISOTimestamp=function(c,b){if(typeof(c)=="undefined"||c===null){return null}var a=b?"T":" ";var d=b?"Z":"";if(b){c=new Date(c.getTime()+(c.getTimezoneOffset()*60000))}return MochiKit.DateTime.toISODate(c)+a+MochiKit.DateTime.toISOTime(c,b)+d};MochiKit.DateTime.toISODate=function(b){if(typeof(b)=="undefined"||b===null){return null}var c=MochiKit.DateTime._padTwo;var a=MochiKit.DateTime._padFour;return[a(b.getFullYear()),c(b.getMonth()+1),c(b.getDate())].join("-")};MochiKit.DateTime.americanDate=function(c){c=c+"";if(typeof(c)!="string"||c.length===0){return null}var b=c.split("/");return new Date(b[2],b[0]-1,b[1])};MochiKit.DateTime._padTwo=function(a){return(a>9)?a:"0"+a};MochiKit.DateTime._padFour=function(a){switch(a.toString().length){case 1:return"000"+a;break;case 2:return"00"+a;break;case 3:return"0"+a;break;case 4:default:return a}};MochiKit.DateTime.toPaddedAmericanDate=function(a){if(typeof(a)=="undefined"||a===null){return null}var b=MochiKit.DateTime._padTwo;return[b(a.getMonth()+1),b(a.getDate()),a.getFullYear()].join("/")};MochiKit.DateTime.toAmericanDate=function(a){if(typeof(a)=="undefined"||a===null){return null}return[a.getMonth()+1,a.getDate(),a.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 b=this.NAME+".";for(var a in this){var d=this[a];if(typeof(d)=="function"&&typeof(d.NAME)=="undefined"){try{d.NAME=b+a}catch(c){}}}};MochiKit.DateTime.__new__();if(typeof(MochiKit.Base)!="undefined"){MochiKit.Base._exportSymbols(this,MochiKit.DateTime)}else{(function(d,b){if((typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined")||(MochiKit.__export__===false)){var c=b.EXPORT_TAGS[":all"];for(var a=0;a<c.length;a++){d[c[a]]=b[c[a]]}}})(this,MochiKit.DateTime)}MochiKit.Base._deps("Format",["Base"]);MochiKit.Format.NAME="MochiKit.Format";MochiKit.Format.VERSION="1.4.2";MochiKit.Format.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Format.toString=function(){return this.__repr__()};MochiKit.Format._numberFormatter=function(b,j,h,g,f,e,d,c,a){return function(s){s=parseFloat(s);if(typeof(s)=="undefined"||s===null||isNaN(s)){return b}var r=j;var o=h;if(s<0){s=-s}else{r=r.replace(/-/,"")}var u=arguments.callee;var m=MochiKit.Format.formatLocale(g);if(f){s=s*100;o=m.percent+o}s=MochiKit.Format.roundToFixed(s,e);var n=s.split(/\./);var l=n[0];var k=(n.length==1)?"":n[1];var t="";while(l.length<d){l="0"+l}if(c){while(l.length>c){var q=l.length-c;t=m.separator+l.substring(q,l.length)+t;l=l.substring(0,q)}}t=l+t;if(e>0){while(k.length<a){k=k+"0"}t=t+m.decimal+k}return r+t+o}};MochiKit.Format.numberFormatter=function(q,o,n){if(typeof(o)=="undefined"){o=""}var l=q.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/);if(!l){throw TypeError("Invalid pattern")}var g=q.substr(0,l.index);var f=q.substr(l.index+l[0].length);if(g.search(/-/)==-1){g=g+"-"}var e=l[1];var h=(typeof(l[2])=="string"&&l[2]!="")?l[2]:"";var c=(typeof(l[3])=="string"&&l[3]!="");var r=e.split(/,/);var b;if(typeof(n)=="undefined"){n="default"}if(r.length==1){b=null}else{b=r[1].length}var a=e.length-e.replace(/0/g,"").length;var u=h.length-h.replace(/0/g,"").length;var s=h.length;var t=MochiKit.Format._numberFormatter(o,g,f,n,c,s,a,b,u);var k=MochiKit.Base;if(k){var j=arguments.callee;var d=k.concat(arguments);t.repr=function(){return[self.NAME,"(",map(k.repr,d).join(", "),")"].join("")}}return t};MochiKit.Format.formatLocale=function(a){if(typeof(a)=="undefined"||a===null){a="default"}if(typeof(a)=="string"){var b=MochiKit.Format.LOCALE[a];if(typeof(b)=="string"){b=arguments.callee(b);MochiKit.Format.LOCALE[a]=b}return b}else{return a}};MochiKit.Format.twoDigitAverage=function(c,b){if(b){var a=c/b;if(!isNaN(a)){return MochiKit.Format.twoDigitFloat(a)}}return"0"};MochiKit.Format.twoDigitFloat=function(a){var b=roundToFixed(a,2);if(b.indexOf(".00")>0){return b.substring(0,b.length-3)}else{if(b.charAt(b.length-1)=="0"){return b.substring(0,b.length-1)}else{return b}}};MochiKit.Format.lstrip=function(a,b){a=a+"";if(typeof(a)!="string"){return null}if(!b){return a.replace(/^\s+/,"")}else{return a.replace(new RegExp("^["+b+"]+"),"")}};MochiKit.Format.rstrip=function(b,a){b=b+"";if(typeof(b)!="string"){return null}if(!a){return b.replace(/\s+$/,"")}else{return b.replace(new RegExp("["+a+"]+$"),"")}};MochiKit.Format.strip=function(c,a){var b=MochiKit.Format;return b.rstrip(b.lstrip(c,a),a)};MochiKit.Format.truncToFixed=function(d,c){var b=Math.floor(d).toFixed(0);if(d<0){b=Math.ceil(d).toFixed(0);if(b.charAt(0)!="-"&&c>0){b="-"+b}}if(b.indexOf("e")<0&&c>0){var a=d.toString();if(a.indexOf("e")>0){a="."}else{if(a.indexOf(".")<0){a="."}else{a=a.substring(a.indexOf("."))}}if(a.length-1>c){a=a.substring(0,c+1)}while(a.length-1<c){a+="0"}b+=a}return b};MochiKit.Format.roundToFixed=function(d,c){var b=Math.abs(d)+0.5*Math.pow(10,-c);var a=MochiKit.Format.truncToFixed(b,c);if(d<0){a="-"+a}return a};MochiKit.Format.percentFormat=function(a){return MochiKit.Format.twoDigitFloat(100*a)+"%"};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:"%"},pt_BR:{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 c=this.NAME+".";var b,a,f;for(b in this.LOCALE){f=this.LOCALE[b];if(typeof(f)=="object"){f.repr=function(){return this.NAME};f.NAME=c+"LOCALE."+b}}for(b in this){f=this[b];if(typeof(f)=="function"&&typeof(f.NAME)=="undefined"){try{f.NAME=c+b}catch(d){}}}};MochiKit.Format.__new__();if(typeof(MochiKit.Base)!="undefined"){MochiKit.Base._exportSymbols(this,MochiKit.Format)}else{(function(d,a){if((typeof(JSAN)=="undefined"&&typeof(dojo)=="undefined")||(MochiKit.__export__===false)){var c=a.EXPORT_TAGS[":all"];for(var b=0;b<c.length;b++){d[c[b]]=a[c[b]]}}})(this,MochiKit.Format)}MochiKit.Base._deps("Async",["Base"]);MochiKit.Async.NAME="MochiKit.Async";MochiKit.Async.VERSION="1.4.2";MochiKit.Async.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Async.toString=function(){return this.__repr__()};MochiKit.Async.Deferred=function(a){this.chain=[];this.id=this._nextId();this.fired=-1;this.paused=0;this.results=[null,null];this.canceller=a;this.silentlyCancelled=false;this.chained=false};MochiKit.Async.Deferred.prototype={repr:function(){var a;if(this.fired==-1){a="unfired"}else{if(this.fired===0){a="success"}else{a="error"}}return"Deferred("+this.id+", "+a+")"},toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){var a=MochiKit.Async;if(this.fired==-1){if(this.canceller){this.canceller(this)}else{this.silentlyCancelled=true}if(this.fired==-1){this.errback(new a.CancelledError(this))}}else{if((this.fired===0)&&(this.results[0] instanceof a.Deferred)){this.results[0].cancel()}}},_resback:function(a){this.fired=((a instanceof Error)?1:0);this.results[this.fired]=a;this._fire()},_check:function(){if(this.fired!=-1){if(!this.silentlyCancelled){throw new MochiKit.Async.AlreadyCalledError(this)}this.silentlyCancelled=false;return}},callback:function(a){this._check();if(a instanceof MochiKit.Async.Deferred){throw new Error("Deferred instances can only be chained if they are the result of a callback")}this._resback(a)},errback:function(b){this._check();var a=MochiKit.Async;if(b instanceof a.Deferred){throw new Error("Deferred instances can only be chained if they are the result of a callback")}if(!(b instanceof Error)){b=new a.GenericError(b)}this._resback(b)},addBoth:function(a){if(arguments.length>1){a=MochiKit.Base.partial.apply(null,arguments)}return this.addCallbacks(a,a)},addCallback:function(a){if(arguments.length>1){a=MochiKit.Base.partial.apply(null,arguments)}return this.addCallbacks(a,null)},addErrback:function(a){if(arguments.length>1){a=MochiKit.Base.partial.apply(null,arguments)}return this.addCallbacks(null,a)},addCallbacks:function(a,b){if(this.chained){throw new Error("Chained Deferreds can not be re-used")}this.chain.push([a,b]);if(this.fired>=0){this._fire()}return this},_fire:function(){var b=this.chain;var e=this.fired;var d=this.results[e];var c=this;var a=null;while(b.length>0&&this.paused===0){var j=b.shift();var h=j[e];if(h===null){continue}try{d=h(d);e=((d instanceof Error)?1:0);if(d instanceof MochiKit.Async.Deferred){a=function(f){c._resback(f);c.paused--;if((c.paused===0)&&(c.fired>=0)){c._fire()}};this.paused++}}catch(g){e=1;if(!(g instanceof Error)){g=new MochiKit.Async.GenericError(g)}d=g}}this.fired=e;this.results[e]=d;if(a&&this.paused){d.addBoth(a);d.chained=true}}};MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(a){return MochiKit.Base.evalJSON(a.responseText)},succeed:function(b){var a=new MochiKit.Async.Deferred();a.callback.apply(a,arguments);return a},fail:function(a){var b=new MochiKit.Async.Deferred();b.errback.apply(b,arguments);return b},getXMLHttpRequest:function(){var a=arguments.callee;if(!a.XMLHttpRequest){var c=[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 b=0;b<c.length;b++){var d=c[b];try{a.XMLHttpRequest=d;return d()}catch(f){}}}return a.XMLHttpRequest()},_xhr_onreadystatechange:function(g){var a=MochiKit.Base;if(this.readyState==4){try{this.onreadystatechange=null}catch(f){try{this.onreadystatechange=a.noop}catch(f){}}var b=null;try{b=this.status;if(!b&&a.isNotEmpty(this.responseText)){b=304}}catch(f){}if(b==200||b==201||b==204||b==304||b==1223){g.callback(this)}else{var c=new MochiKit.Async.XMLHttpRequestError(this,"Request failed");if(c.number){g.errback(c)}else{g.errback(c)}}}},_xhr_canceller:function(a){try{a.onreadystatechange=null}catch(b){try{a.onreadystatechange=MochiKit.Base.noop}catch(b){}}a.abort()},sendXMLHttpRequest:function(f,c){if(typeof(c)=="undefined"||c===null){c=""}var a=MochiKit.Base;var b=MochiKit.Async;var h=new b.Deferred(a.partial(b._xhr_canceller,f));try{f.onreadystatechange=a.bind(b._xhr_onreadystatechange,f,h);f.send(c)}catch(g){try{f.onreadystatechange=null}catch(j){}h.errback(g)}return h},doXHR:function(b,c){var a=MochiKit.Async;return a.callLater(0,a._doXHR,b,c)},_doXHR:function(c,a){var d=MochiKit.Base;a=d.update({method:"GET",sendContent:""},a);var l=MochiKit.Async;var k=l.getXMLHttpRequest();if(a.queryString){var j=d.queryString(a.queryString);if(j){c+="?"+j}}if("username" in a){k.open(a.method,c,true,a.username,a.password)}else{k.open(a.method,c,true)}if(k.overrideMimeType&&a.mimeType){k.overrideMimeType(a.mimeType)}k.setRequestHeader("X-Requested-With","XMLHttpRequest");if(a.headers){var h=a.headers;if(!d.isArrayLike(h)){h=d.items(h)}for(var e=0;e<h.length;e++){var g=h[e];var b=g[0];var f=g[1];k.setRequestHeader(b,f)}}return l.sendXMLHttpRequest(k,a.sendContent)},_buildURL:function(c){if(arguments.length>1){var b=MochiKit.Base;var a=b.queryString.apply(null,b.extend(null,arguments,1));if(a){return c+"?"+a}}return c},doSimpleXMLHttpRequest:function(b){var a=MochiKit.Async;b=a._buildURL.apply(a,arguments);return a.doXHR(b)},loadJSONDoc:function(b){var a=MochiKit.Async;b=a._buildURL.apply(a,arguments);var c=a.doXHR(b,{mimeType:"text/plain",headers:[["Accept","application/json"]]});c=c.addCallback(a.evalJSONRequest);return c},wait:function(b,f){var e=new MochiKit.Async.Deferred();var a=MochiKit.Base;if(typeof(f)!="undefined"){e.addCallback(function(){return f})}var c=setTimeout(a.bind("callback",e),Math.floor(b*1000));e.canceller=function(){try{clearTimeout(c)}catch(d){}};return e},callLater:function(d,c){var a=MochiKit.Base;var b=a.partial.apply(a,a.extend(null,arguments,1));return MochiKit.Async.wait(d).addCallback(function(e){return b()})}});MochiKit.Async.DeferredLock=function(){this.waiting=[];this.locked=false;this.id=this._nextId()};MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){var a=new MochiKit.Async.Deferred();if(this.locked){this.waiting.push(a)}else{this.locked=true;a.callback(this)}return a},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 a;if(this.locked){a="locked, "+this.waiting.length+" waiting"}else{a="unlocked"}return"DeferredLock("+this.id+", "+a+")"},toString:MochiKit.Base.forwardCall("repr")};MochiKit.Async.DeferredList=function(f,k,j,h,b){MochiKit.Async.Deferred.apply(this,[b]);this.list=f;var a=[];this.resultList=a;this.finishedCount=0;this.fireOnOneCallback=k;this.fireOnOneErrback=j;this.consumeErrors=h;var c=MochiKit.Base.bind(this._cbDeferred,this);for(var e=0;e<f.length;e++){var g=f[e];a.push(undefined);g.addCallback(c,e,true);g.addErrback(c,e,false)}if(f.length===0&&!k){this.callback(this.resultList)}};MochiKit.Async.DeferredList.prototype=new MochiKit.Async.Deferred();MochiKit.Async.DeferredList.prototype._cbDeferred=function(b,c,a){this.resultList[b]=[c,a];this.finishedCount+=1;if(this.fired==-1){if(c&&this.fireOnOneCallback){this.callback([b,a])}else{if(!c&&this.fireOnOneErrback){this.errback(a)}else{if(this.finishedCount==this.list.length){this.callback(this.resultList)}}}}if(!c&&this.consumeErrors){a=null}return a};MochiKit.Async.gatherResults=function(a){var b=new MochiKit.Async.DeferredList(a,false,true,false);b.addCallback(function(e){var c=[];for(var d=0;d<e.length;d++){c.push(e[d][1])}return c});return b};MochiKit.Async.maybeDeferred=function(d){var b=MochiKit.Async;var a;try{var c=d.apply(null,MochiKit.Base.extend([],arguments,1));if(c instanceof b.Deferred){a=c}else{if(c instanceof Error){a=b.fail(c)}else{a=b.succeed(c)}}}catch(f){a=b.fail(f)}return a};MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred","doXHR"];MochiKit.Async.EXPORT_OK=["evalJSONRequest"];MochiKit.Async.__new__=function(){var a=MochiKit.Base;var b=a.partial(a._newNamedError,this);b("AlreadyCalledError",function(c){this.deferred=c});b("CancelledError",function(c){this.deferred=c});b("BrowserComplianceError",function(c){this.message=c});b("GenericError",function(c){this.message=c});b("XMLHttpRequestError",function(c,f){this.req=c;this.message=f;try{this.number=c.status}catch(d){}});this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)};MochiKit.Async.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Async);MochiKit.Base._deps("DOM",["Base"]);MochiKit.DOM.NAME="MochiKit.DOM";MochiKit.DOM.VERSION="1.4.2";MochiKit.DOM.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.DOM.toString=function(){return this.__repr__()};MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","removeNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","insertSiblingNodesAfter","insertSiblingNodesBefore","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","H4","H5","H6","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","DL","DT","DD","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","computedStyle","escapeHTML","toHTML","emitHTML","scrapeText","getFirstParentByTagAndClassName","getFirstElementByTagAndClassName"];MochiKit.DOM.EXPORT_OK=["domConverters"];MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["getViewportDimensions","MochiKit.Style.getViewportDimensions","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["makeClipping","MochiKit.Style.makeClipping","1.4.1"],["makePositioned","MochiKit.Style.makePositioned","1.4.1"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["undoClipping","MochiKit.Style.undoClipping","1.4.1"],["undoPositioned","MochiKit.Style.undoPositioned","1.4.1"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]];MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){return MochiKit.DOM._window},currentDocument:function(){return MochiKit.DOM._document},withWindow:function(h,d){var a=MochiKit.DOM;var c=a._document;var b=a._window;var g;try{a._window=h;a._document=h.document;g=d()}catch(f){a._window=b;a._document=c;throw f}a._window=b;a._document=c;return g},formContents:function(e){var d=[];var c=[];var a=MochiKit.Base;var b=MochiKit.DOM;if(typeof(e)=="undefined"||e===null){e=b._document.body}else{e=b.getElement(e)}a.nodeWalk(e,function(n){var g=n.name;if(a.isNotEmpty(g)){var o=n.tagName.toUpperCase();if(o==="INPUT"&&(n.type=="radio"||n.type=="checkbox")&&!n.checked){return null}if(o==="SELECT"){if(n.type=="select-one"){if(n.selectedIndex>=0){var k=n.options[n.selectedIndex];var f=k.value;if(!f){var l=k.outerHTML;if(l&&!l.match(/^[^>]+\svalue\s*=/i)){f=k.text}}d.push(g);c.push(f);return null}d.push(g);c.push("");return null}else{var m=n.options;if(!m.length){d.push(g);c.push("");return null}for(var j=0;j<m.length;j++){var k=m[j];if(!k.selected){continue}var f=k.value;if(!f){var l=k.outerHTML;if(l&&!l.match(/^[^>]+\svalue\s*=/i)){f=k.text}}d.push(g);c.push(f)}return null}}if(o==="FORM"||o==="P"||o==="SPAN"||o==="DIV"){return n.childNodes}d.push(g);c.push(n.value||"");return null}return n.childNodes});return[d,c]},withDocument:function(g,c){var b=MochiKit.DOM;var a=b._document;var f;try{b._document=g;f=c()}catch(d){b._document=a;throw d}b._document=a;return f},registerDOMConverter:function(c,b,d,a){MochiKit.DOM.domConverters.register(c,b,d,a)},coerceToDOM:function(d,r){var f=MochiKit.Base;var h=MochiKit.Iter;var q=MochiKit.DOM;if(h){var j=h.iter;var o=h.repeat}var b=f.map;var n=q.domConverters;var l=arguments.callee;var k=f.NotFound;while(true){if(typeof(d)=="undefined"||d===null){return null}if(typeof(d)=="function"&&typeof(d.length)=="number"&&!(d instanceof Function)){d=h?h.list(d):f.extend(null,d)}if(typeof(d.nodeType)!="undefined"&&d.nodeType>0){return d}if(typeof(d)=="number"||typeof(d)=="boolean"){d=d.toString()}if(typeof(d)=="string"){return q._document.createTextNode(d)}if(typeof(d.__dom__)=="function"){d=d.__dom__(r);continue}if(typeof(d.dom)=="function"){d=d.dom(r);continue}if(typeof(d)=="function"){d=d.apply(r,[r]);continue}if(h){var a=null;try{a=j(d)}catch(g){}if(a){return b(l,a,o(r))}}else{if(f.isArrayLike(d)){var c=function(e){return l(e,r)};return b(c,d)}}try{d=n.match(d,r);continue}catch(g){if(g!=k){throw g}}return q._document.createTextNode(d.toString())}return undefined},isChildNode:function(c,b){var a=MochiKit.DOM;if(typeof(c)=="string"){c=a.getElement(c)}if(typeof(b)=="string"){b=a.getElement(b)}if(typeof(c)=="undefined"||c===null){return false}while(c!=null&&c!==a._document){if(c===b){return true}c=c.parentNode}return false},setNodeAttribute:function(c,b,a){var f={};f[b]=a;try{return MochiKit.DOM.updateNodeAttributes(c,f)}catch(d){}return null},getNodeAttribute:function(g,a){var b=MochiKit.DOM;var f=b.attributeArray.renames[a];var d=b.attributeArray.ignoreAttr[a];g=b.getElement(g);try{if(f){return g[f]}var c=g.getAttribute(a);if(c!=d){return c}}catch(h){}return null},removeNodeAttribute:function(d,a){var b=MochiKit.DOM;var c=b.attributeArray.renames[a];d=b.getElement(d);try{if(c){return d[c]}return d.removeAttribute(a)}catch(f){}return null},updateNodeAttributes:function(c,g){var d=c;var j=MochiKit.DOM;if(typeof(c)=="string"){d=j.getElement(c)}if(g){var f=MochiKit.Base.updatetree;if(j.attributeArray.compliant){for(var e in g){var h=g[e];if(typeof(h)=="object"&&typeof(d[e])=="object"){if(e=="style"&&MochiKit.Style){MochiKit.Style.setStyle(d,h)}else{f(d[e],h)}}else{if(e.substring(0,2)=="on"){if(typeof(h)=="string"){h=new Function(h)}d[e]=h}else{d.setAttribute(e,h)}}if(typeof(d[e])=="string"&&d[e]!=h){d[e]=h}}}else{var b=j.attributeArray.renames;for(var e in g){h=g[e];var a=b[e];if(e=="style"&&typeof(h)=="string"){d.style.cssText=h}else{if(typeof(a)=="string"){d[a]=h}else{if(typeof(d[e])=="object"&&typeof(h)=="object"){if(e=="style"&&MochiKit.Style){MochiKit.Style.setStyle(d,h)}else{f(d[e],h)}}else{if(e.substring(0,2)=="on"){if(typeof(h)=="string"){h=new Function(h)}d[e]=h}else{d.setAttribute(e,h)}}}}if(typeof(d[e])=="string"&&d[e]!=h){d[e]=h}}}}return d},appendChildNodes:function(c){var b=c;var a=MochiKit.DOM;if(typeof(c)=="string"){b=a.getElement(c)}var f=[a.coerceToDOM(MochiKit.Base.extend(null,arguments,1),b)];var d=MochiKit.Base.concat;while(f.length){var e=f.shift();if(typeof(e)=="undefined"||e===null){}else{if(typeof(e.nodeType)=="number"){b.appendChild(e)}else{f=d(e,f)}}}return b},insertSiblingNodesBefore:function(f){var e=f;var a=MochiKit.DOM;if(typeof(f)=="string"){e=a.getElement(f)}var d=[a.coerceToDOM(MochiKit.Base.extend(null,arguments,1),e)];var c=e.parentNode;var b=MochiKit.Base.concat;while(d.length){var g=d.shift();if(typeof(g)=="undefined"||g===null){}else{if(typeof(g.nodeType)=="number"){c.insertBefore(g,e)}else{d=b(g,d)}}}return c},insertSiblingNodesAfter:function(c){var b=c;var a=MochiKit.DOM;if(typeof(c)=="string"){b=a.getElement(c)}var d=[a.coerceToDOM(MochiKit.Base.extend(null,arguments,1),b)];if(b.nextSibling){return a.insertSiblingNodesBefore(b.nextSibling,d)}else{return a.appendChildNodes(b.parentNode,d)}},replaceChildNodes:function(d){var c=d;var b=MochiKit.DOM;if(typeof(d)=="string"){c=b.getElement(d);arguments[0]=c}var a;while((a=c.firstChild)){c.removeChild(a)}if(arguments.length<2){return c}else{return b.appendChildNodes.apply(this,arguments)}},createDOM:function(a,j){var b;var k=MochiKit.DOM;var c=MochiKit.Base;if(typeof(j)=="string"||typeof(j)=="number"){var g=c.extend([a,null],arguments,1);return arguments.callee.apply(this,g)}if(typeof(a)=="string"){var h=k._xhtml;if(j&&!k.attributeArray.compliant){var f="";if("name" in j){f+=' name="'+k.escapeHTML(j.name)+'"'}if(a=="input"&&"type" in j){f+=' type="'+k.escapeHTML(j.type)+'"'}if(f){a="<"+a+f+">";h=false}}var e=k._document;if(h&&e===document){b=e.createElementNS("http://www.w3.org/1999/xhtml",a)}else{b=e.createElement(a)}}else{b=a}if(j){k.updateNodeAttributes(b,j)}if(arguments.length<=2){return b}else{var g=c.extend([b],arguments,2);return k.appendChildNodes.apply(this,g)}},createDOMFunc:function(){var a=MochiKit.Base;return a.partial.apply(this,a.extend([MochiKit.DOM.createDOM],arguments))},removeElement:function(b){var a=MochiKit.DOM;var c=a.coerceToDOM(a.getElement(b));c.parentNode.removeChild(c);return c},swapDOM:function(c,d){var b=MochiKit.DOM;c=b.getElement(c);var a=c.parentNode;if(d){d=b.coerceToDOM(b.getElement(d),a);a.replaceChild(d,c)}else{a.removeChild(c)}return d},getElement:function(b){var a=MochiKit.DOM;if(arguments.length==1){return((typeof(b)=="string")?a._document.getElementById(b):b)}else{return MochiKit.Base.map(a.getElement,arguments)}},getElementsByTagAndClassName:function(h,g,f){var m=MochiKit.DOM;if(typeof(h)=="undefined"||h===null){h="*"}if(typeof(f)=="undefined"||f===null){f=m._document}f=m.getElement(f);if(f==null){return[]}var d=(f.getElementsByTagName(h)||m._document.all);if(typeof(g)=="undefined"||g===null){return MochiKit.Base.extend(null,d)}var c=[];for(var k=0;k<d.length;k++){var b=d[k];var l=b.className;if(typeof(l)!="string"){l=b.getAttribute("class")}if(typeof(l)=="string"){var a=l.split(" ");for(var e=0;e<a.length;e++){if(a[e]==g){c.push(b);break}}}}return c},_newCallStack:function(c,a){var b=function(){var d=arguments.callee.callStack;for(var f=0;f<d.length;f++){if(d[f].apply(this,arguments)===false){break}}if(a){try{this[c]=null}catch(g){}}};b.callStack=[];return b},addToCallStack:function(a,g,d,c){var b=MochiKit.DOM;var f=a[g];var e=f;if(!(typeof(f)=="function"&&typeof(f.callStack)=="object"&&f.callStack!==null)){e=b._newCallStack(g,c);if(typeof(f)=="function"){e.callStack.push(f)}a[g]=e}e.callStack.push(d)},addLoadEvent:function(b){var a=MochiKit.DOM;a.addToCallStack(a._window,"onload",b,true)},focusOnLoad:function(b){var a=MochiKit.DOM;a.addLoadEvent(function(){b=a.getElement(b);if(b){b.focus()}})},setElementClass:function(c,b){var a=MochiKit.DOM;var d=a.getElement(c);if(a.attributeArray.compliant){d.setAttribute("class",b)}else{d.setAttribute("className",b)}},toggleElementClass:function(b){var a=MochiKit.DOM;for(var c=1;c<arguments.length;c++){var d=a.getElement(arguments[c]);if(!a.addElementClass(d,b)){a.removeElementClass(d,b)}}},addElementClass:function(c,a){var d=MochiKit.DOM;var g=d.getElement(c);var b=g.className;if(typeof(b)!="string"){b=g.getAttribute("class")}if(typeof(b)!="string"||b.length===0){d.setElementClass(g,a);return true}if(b==a){return false}var f=b.split(" ");for(var e=0;e<f.length;e++){if(f[e]==a){return false}}d.setElementClass(g,b+" "+a);return true},removeElementClass:function(e,g){var b=MochiKit.DOM;var f=b.getElement(e);var a=f.className;if(typeof(a)!="string"){a=f.getAttribute("class")}if(typeof(a)!="string"||a.length===0){return false}if(a==g){b.setElementClass(f,"");return true}var d=a.split(" ");for(var c=0;c<d.length;c++){if(d[c]==g){d.splice(c,1);b.setElementClass(f,d.join(" "));return true}}return false},swapElementClass:function(d,c,a){var e=MochiKit.DOM.getElement(d);var b=MochiKit.DOM.removeElementClass(e,c);if(b){MochiKit.DOM.addElementClass(e,a)}return b},hasElementClass:function(a,h){var g=MochiKit.DOM.getElement(a);if(g==null){return false}var b=g.className;if(typeof(b)!="string"){b=g.getAttribute("class")}if(typeof(b)!="string"){return false}var f=b.split(" ");for(var d=1;d<arguments.length;d++){var e=false;for(var c=0;c<f.length;c++){if(f[c]==arguments[d]){e=true;break}}if(!e){return false}}return true},escapeHTML:function(a){return a.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},toHTML:function(a){return MochiKit.DOM.emitHTML(a).join("")},emitHTML:function(k,n){if(typeof(n)=="undefined"||n===null){n=[]}var m=[k];var q=MochiKit.DOM;var g=q.escapeHTML;var f=q.attributeArray;while(m.length){k=m.pop();if(typeof(k)=="string"){n.push(k)}else{if(k.nodeType==1){n.push("<"+k.tagName.toLowerCase());var d=[];var c=f(k);for(var l=0;l<c.length;l++){var o=c[l];d.push([" ",o.name,'="',g(o.value),'"'])}d.sort();for(l=0;l<d.length;l++){var b=d[l];for(var h=0;h<b.length;h++){n.push(b[h])}}if(k.hasChildNodes()){n.push(">");m.push("</"+k.tagName.toLowerCase()+">");var e=k.childNodes;for(l=e.length-1;l>=0;l--){m.push(e[l])}}else{n.push("/>")}}else{if(k.nodeType==3){n.push(g(k.nodeValue))}}}}return n},scrapeText:function(b,a){var c=[];(function(e){var g=e.childNodes;if(g){for(var d=0;d<g.length;d++){arguments.callee.call(this,g[d])}}var f=e.nodeValue;if(typeof(f)=="string"){c.push(f)}})(MochiKit.DOM.getElement(b));if(a){return c}else{return c.join("")}},removeEmptyTextNodes:function(c){c=MochiKit.DOM.getElement(c);for(var a=0;a<c.childNodes.length;a++){var b=c.childNodes[a];if(b.nodeType==3&&!/\S/.test(b.nodeValue)){b.parentNode.removeChild(b)}}},getFirstElementByTagAndClassName:function(f,e,c){var h=MochiKit.DOM;if(typeof(f)=="undefined"||f===null){f="*"}if(typeof(c)=="undefined"||c===null){c=h._document}c=h.getElement(c);if(c==null){return null}var l=(c.getElementsByTagName(f)||h._document.all);if(l.length<=0){return null}else{if(typeof(e)=="undefined"||e===null){return l[0]}}for(var b=0;b<l.length;b++){var g=l[b];var k=g.className;if(typeof(k)!="string"){k=g.getAttribute("class")}if(typeof(k)=="string"){var d=k.split(" ");for(var a=0;a<d.length;a++){if(d[a]==e){return g}}}}return null},getFirstParentByTagAndClassName:function(c,a,e){var b=MochiKit.DOM;c=b.getElement(c);if(typeof(a)=="undefined"||a===null){a="*"}else{a=a.toUpperCase()}if(typeof(e)=="undefined"||e===null){e=null}if(c){c=c.parentNode}while(c&&c.tagName){var d=c.tagName.toUpperCase();if((a==="*"||a==d)&&(e===null||b.hasElementClass(c,e))){return c}c=c.parentNode}return null},__new__:function(k){var c=MochiKit.Base;if(typeof(document)!="undefined"){this._document=document;var h="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===h)}else{if(MochiKit.MockDOM){this._document=MochiKit.MockDOM.document}}this._window=k;this.domConverters=new c.AdapterRegistry();var g=this._document.createElement("span");var e;if(g&&g.attributes&&g.attributes.length>0){var n=c.filter;e=function(a){return n(e.ignoreAttrFilter,a.attributes)};e.ignoreAttr={};var l=g.attributes;var j=e.ignoreAttr;for(var f=0;f<l.length;f++){var o=l[f];j[o.name]=o.value}e.ignoreAttrFilter=function(m){return(e.ignoreAttr[m.name]!=m.value)};e.compliant=false;e.renames={"class":"className",checked:"defaultChecked",usemap:"useMap","for":"htmlFor",readonly:"readOnly",colspan:"colSpan",bgcolor:"bgColor",cellspacing:"cellSpacing",cellpadding:"cellPadding"}}else{e=function(a){return a.attributes};e.compliant=true;e.ignoreAttr={};e.renames={}}this.attributeArray=e;var d=function(m,a){var t=a[0];var r=a[1];var q=r.split(".")[1];var s="";s+="if (!MochiKit."+q+') { throw new Error("';s+="This function has been deprecated and depends on MochiKit.";s+=q+'.");}';s+="return "+r+".apply(this, arguments);";MochiKit[m][t]=new Function(s)};for(var f=0;f<MochiKit.DOM.DEPRECATED.length;f++){d("DOM",MochiKit.DOM.DEPRECATED[f])}var b=this.createDOMFunc;this.UL=b("ul");this.OL=b("ol");this.LI=b("li");this.DL=b("dl");this.DT=b("dt");this.DD=b("dd");this.TD=b("td");this.TR=b("tr");this.TBODY=b("tbody");this.THEAD=b("thead");this.TFOOT=b("tfoot");this.TABLE=b("table");this.TH=b("th");this.INPUT=b("input");this.SPAN=b("span");this.A=b("a");this.DIV=b("div");this.IMG=b("img");this.BUTTON=b("button");this.TT=b("tt");this.PRE=b("pre");this.H1=b("h1");this.H2=b("h2");this.H3=b("h3");this.H4=b("h4");this.H5=b("h5");this.H6=b("h6");this.BR=b("br");this.HR=b("hr");this.LABEL=b("label");this.TEXTAREA=b("textarea");this.FORM=b("form");this.P=b("p");this.SELECT=b("select");this.OPTION=b("option");this.OPTGROUP=b("optgroup");this.LEGEND=b("legend");this.FIELDSET=b("fieldset");this.STRONG=b("strong");this.CANVAS=b("canvas");this.$=this.getElement;this.EXPORT_TAGS={":common":this.EXPORT,":all":c.concat(this.EXPORT,this.EXPORT_OK)};c.nameFunctions(this)}});MochiKit.DOM.__new__(((typeof(window)=="undefined")?this:window));if(MochiKit.__export__){withWindow=MochiKit.DOM.withWindow;withDocument=MochiKit.DOM.withDocument}MochiKit.Base._exportSymbols(this,MochiKit.DOM);MochiKit.Base._deps("Selector",["Base","DOM","Iter"]);MochiKit.Selector.NAME="MochiKit.Selector";MochiKit.Selector.VERSION="1.4.2";MochiKit.Selector.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Selector.toString=function(){return this.__repr__()};MochiKit.Selector.EXPORT=["Selector","findChildElements","findDocElements","$$"];MochiKit.Selector.EXPORT_OK=[];MochiKit.Selector.Selector=function(a){this.params={classNames:[],pseudoClassNames:[]};this.expression=a.toString().replace(/(^\s+|\s+$)/g,"");this.parseExpression();this.compileMatcher()};MochiKit.Selector.Selector.prototype={__class__:MochiKit.Selector.Selector,parseExpression:function(){function h(j){throw"Parse error in selector: "+j}if(this.expression==""){h("empty expression")}var a=MochiKit.Base.repr;var f=this.params;var g=this.expression;var c,e,b,d;while(c=g.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){f.attributes=f.attributes||[];f.attributes.push({name:c[2],operator:c[3],value:c[4]||c[5]||""});g=c[1]}if(g=="*"){return this.params.wildcard=true}while(c=g.match(/^([^a-z0-9_-])?([a-z0-9_-]+(?:\([^)]*\))?)(.*)/i)){e=c[1];b=c[2];d=c[3];switch(e){case"#":f.id=b;break;case".":f.classNames.push(b);break;case":":f.pseudoClassNames.push(b);break;case"":case undefined:f.tagName=b.toUpperCase();break;default:h(a(g))}g=d}if(g.length>0){h(a(g))}},buildMatchExpression:function(){var c=MochiKit.Base.repr;var n=this.params;var l=[];var j,d;function k(a){return"MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, "+a+".childNodes)"}if(n.wildcard){l.push("true")}if(j=n.id){l.push("element.id == "+c(j))}if(j=n.tagName){l.push("element.tagName.toUpperCase() == "+c(j))}if((j=n.classNames).length>0){for(d=0;d<j.length;d++){l.push("MochiKit.DOM.hasElementClass(element, "+c(j[d])+")")}}if((j=n.pseudoClassNames).length>0){for(d=0;d<j.length;d++){var e=j[d].match(/^([^(]+)(?:\((.*)\))?$/);var o=e[1];var m=e[2];switch(o){case"root":l.push("element.nodeType == 9 || element === element.ownerDocument.documentElement");break;case"nth-child":case"nth-last-child":case"nth-of-type":case"nth-last-of-type":e=m.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/);if(!e){throw"Invalid argument to pseudo element nth-child: "+m}var h,f;if(e[0]=="odd"){h=2;f=1}else{if(e[0]=="even"){h=2;f=0}else{h=e[2]&&parseInt(e)||null;f=parseInt(e[3])}}l.push("this.nthChild(element,"+h+","+f+","+!!o.match("^nth-last")+","+!!o.match("of-type$")+")");break;case"first-child":l.push("this.nthChild(element, null, 1)");break;case"last-child":l.push("this.nthChild(element, null, 1, true)");break;case"first-of-type":l.push("this.nthChild(element, null, 1, false, true)");break;case"last-of-type":l.push("this.nthChild(element, null, 1, true, true)");break;case"only-child":l.push(k("element.parentNode")+".length == 1");break;case"only-of-type":l.push("MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, "+k("element.parentNode")+").length == 1");break;case"empty":l.push("element.childNodes.length == 0");break;case"enabled":l.push("(this.isUIElement(element) && element.disabled === false)");break;case"disabled":l.push("(this.isUIElement(element) && element.disabled === true)");break;case"checked":l.push("(this.isUIElement(element) && element.checked === true)");break;case"not":var g=new MochiKit.Selector.Selector(m);l.push("!( "+g.buildMatchExpression()+")");break}}}if(j=n.attributes){MochiKit.Base.map(function(b){var q="MochiKit.DOM.getNodeAttribute(element, "+c(b.name)+")";var a=function(r){return q+".split("+c(r)+")"};l.push(q+" != null");switch(b.operator){case"=":l.push(q+" == "+c(b.value));break;case"~=":l.push("MochiKit.Base.findValue("+a(" ")+", "+c(b.value)+") > -1");break;case"^=":l.push(q+".substring(0, "+b.value.length+") == "+c(b.value));break;case"$=":l.push(q+".substring("+q+".length - "+b.value.length+") == "+c(b.value));break;case"*=":l.push(q+".match("+c(b.value)+")");break;case"|=":l.push(a("-")+"[0].toUpperCase() == "+c(b.value.toUpperCase()));break;case"!=":l.push(q+" != "+c(b.value));break;case"":case undefined:break;default:throw"Unknown operator "+b.operator+" in selector"}},j)}return l.join(" && ")},compileMatcher:function(){var a="return (!element.tagName) ? false : "+this.buildMatchExpression()+";";this.match=new Function("element",a)},nthChild:function(g,f,e,d,j){var h=MochiKit.Base.filter(function(a){return a.nodeType==1},g.parentNode.childNodes);if(j){h=MochiKit.Base.filter(function(a){return a.tagName==g.tagName},h)}if(d){h=MochiKit.Iter.reversed(h)}if(f){var c=MochiKit.Base.findIdentical(h,g);return((c+1-e)/f)%1==0}else{return e==MochiKit.Base.findIdentical(h,g)+1}},isUIElement:function(a){return MochiKit.Base.findValue(["input","button","select","option","textarea","object"],a.tagName.toLowerCase())>-1},findElements:function(f,d){var c;if(d==undefined){d=""}function a(k,j){if(d==""){return MochiKit.DOM.isChildNode(k,j)}else{if(d==">"){return k.parentNode===j}else{if(d=="+"){return k===b(j)}else{if(d=="~"){var h=j;while(h=b(h)){if(k===h){return true}}return false}else{throw"Invalid axis: "+d}}}}}if(c=MochiKit.DOM.getElement(this.params.id)){if(this.match(c)){if(!f||a(c,f)){return[c]}}}function b(h){h=h.nextSibling;while(h&&h.nodeType!=1){h=h.nextSibling}return h}if(d==""){f=(f||MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName||"*")}else{if(d==">"){if(!f){throw"> combinator not allowed without preceeding expression"}f=MochiKit.Base.filter(function(h){return h.nodeType==1},f.childNodes)}else{if(d=="+"){if(!f){throw"+ combinator not allowed without preceeding expression"}f=b(f)&&[b(f)]}else{if(d=="~"){if(!f){throw"~ combinator not allowed without preceeding expression"}var g=[];while(b(f)){f=b(f);g.push(f)}f=g}}}}if(!f){return[]}var e=MochiKit.Base.filter(MochiKit.Base.bind(function(h){return this.match(h)},this),f);return e},repr:function(){return"Selector("+this.expression+")"},toString:MochiKit.Base.forwardCall("repr")};MochiKit.Base.update(MochiKit.Selector,{findChildElements:function(b,a){var c=function(d){var f=[];for(var e=0;e<d.length;e++){if(MochiKit.Base.findIdentical(f,d[e])<0){f.push(d[e])}}return f};return MochiKit.Base.flattenArray(MochiKit.Base.map(function(e){var f="";var d=function(k,l){if(match=l.match(/^[>+~]$/)){f=match[0];return k}else{var j=new MochiKit.Selector.Selector(l);var h=MochiKit.Iter.reduce(function(n,m){return MochiKit.Base.extend(n,j.findElements(m||b,f))},k,[]);f="";return h}};var g=e.replace(/(^\s+|\s+$)/g,"").split(/\s+/);return c(MochiKit.Iter.reduce(d,g,[null]))},a))},findDocElements:function(){return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(),arguments)},__new__:function(){var a=MochiKit.Base;this.$$=this.findDocElements;this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)}});MochiKit.Selector.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Selector);MochiKit.Base._deps("Style",["Base","DOM"]);MochiKit.Style.NAME="MochiKit.Style";MochiKit.Style.VERSION="1.4.2";MochiKit.Style.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Style.toString=function(){return this.__repr__()};MochiKit.Style.EXPORT_OK=[];MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","makePositioned","undoPositioned","makeClipping","undoClipping","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"];MochiKit.Style.Dimensions=function(a,b){this.w=a;this.h=b};MochiKit.Style.Dimensions.prototype.__repr__=function(){var a=MochiKit.Base.repr;return"{w: "+a(this.w)+", h: "+a(this.h)+"}"};MochiKit.Style.Dimensions.prototype.toString=function(){return this.__repr__()};MochiKit.Style.Coordinates=function(a,b){this.x=a;this.y=b};MochiKit.Style.Coordinates.prototype.__repr__=function(){var a=MochiKit.Base.repr;return"{x: "+a(this.x)+", y: "+a(this.y)+"}"};MochiKit.Style.Coordinates.prototype.toString=function(){return this.__repr__()};MochiKit.Base.update(MochiKit.Style,{getStyle:function(b,k){var c=MochiKit.DOM;var f=c._document;b=c.getElement(b);k=MochiKit.Base.camelize(k);if(!b||b==f){return undefined}if(k=="opacity"&&typeof(b.filters)!="undefined"){var j=(MochiKit.Style.getStyle(b,"filter")||"").match(/alpha\(opacity=(.*)\)/);if(j&&j[1]){return parseFloat(j[1])/100}return 1}if(k=="float"||k=="cssFloat"||k=="styleFloat"){if(b.style["float"]){return b.style["float"]}else{if(b.style.cssFloat){return b.style.cssFloat}else{if(b.style.styleFloat){return b.style.styleFloat}else{return"none"}}}}var h=b.style?b.style[k]:null;if(!h){if(f.defaultView&&f.defaultView.getComputedStyle){var e=f.defaultView.getComputedStyle(b,null);k=k.replace(/([A-Z])/g,"-$1").toLowerCase();h=e?e.getPropertyValue(k):null}else{if(b.currentStyle){h=b.currentStyle[k];if(/^\d/.test(h)&&!/px$/.test(h)&&k!="fontWeight"){var a=b.style.left;var g=b.runtimeStyle.left;b.runtimeStyle.left=b.currentStyle.left;b.style.left=h||0;h=b.style.pixelLeft+"px";b.style.left=a;b.runtimeStyle.left=g}}}}if(k=="opacity"){h=parseFloat(h)}if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.findValue(["left","top","right","bottom"],k)!=-1)){if(MochiKit.Style.getStyle(b,"position")=="static"){h="auto"}}return h=="auto"?null:h},setStyle:function(c,b){c=MochiKit.DOM.getElement(c);for(var a in b){switch(a){case"opacity":MochiKit.Style.setOpacity(c,b[a]);break;case"float":case"cssFloat":case"styleFloat":if(typeof(c.style["float"])!="undefined"){c.style["float"]=b[a]}else{if(typeof(c.style.cssFloat)!="undefined"){c.style.cssFloat=b[a]}else{c.style.styleFloat=b[a]}}break;default:c.style[MochiKit.Base.camelize(a)]=b[a]}}},setOpacity:function(b,c){b=MochiKit.DOM.getElement(b);var a=MochiKit.Style;if(c==1){var d=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));b.style.opacity=d?0.999999:1;if(/MSIE/.test(navigator.userAgent)){b.style.filter=a.getStyle(b,"filter").replace(/alpha\([^\)]*\)/gi,"")}}else{if(c<0.00001){c=0}b.style.opacity=c;if(/MSIE/.test(navigator.userAgent)){b.style.filter=a.getStyle(b,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+c*100+")"}}},getElementPosition:function(e,k){var r=MochiKit.Style;var f=MochiKit.DOM;e=f.getElement(e);if(!e||(!(e.x&&e.y)&&(!e.parentNode===null||r.getStyle(e,"display")=="none"))){return undefined}var m=new r.Coordinates(0,0);var h=null;var g=null;var l=MochiKit.DOM._document;var o=l.documentElement;var n=l.body;if(!e.parentNode&&e.x&&e.y){m.x+=e.x||0;m.y+=e.y||0}else{if(e.getBoundingClientRect){h=e.getBoundingClientRect();m.x+=h.left+(o.scrollLeft||n.scrollLeft)-(o.clientLeft||0);m.y+=h.top+(o.scrollTop||n.scrollTop)-(o.clientTop||0)}else{if(e.offsetParent){m.x+=e.offsetLeft;m.y+=e.offsetTop;g=e.offsetParent;if(g!=e){while(g){m.x+=parseInt(g.style.borderLeftWidth)||0;m.y+=parseInt(g.style.borderTopWidth)||0;m.x+=g.offsetLeft;m.y+=g.offsetTop;g=g.offsetParent}}var a=navigator.userAgent.toLowerCase();if((typeof(opera)!="undefined"&&parseFloat(opera.version())<9)||(a.indexOf("AppleWebKit")!=-1&&r.getStyle(e,"position")=="absolute")){m.x-=n.offsetLeft;m.y-=n.offsetTop}if(e.parentNode){g=e.parentNode}else{g=null}while(g){var j=g.tagName.toUpperCase();if(j==="BODY"||j==="HTML"){break}var q=r.getStyle(g,"display");if(q.search(/^inline|table-row.*$/i)){m.x-=g.scrollLeft;m.y-=g.scrollTop}if(g.parentNode){g=g.parentNode}else{g=null}}}}}if(typeof(k)!="undefined"){k=arguments.callee(k);if(k){m.x-=(k.x||0);m.y-=(k.y||0)}}return m},setElementPosition:function(e,d,b){e=MochiKit.DOM.getElement(e);if(typeof(b)=="undefined"){b="px"}var c={};var a=MochiKit.Base.isUndefinedOrNull;if(!a(d.x)){c.left=d.x+b}if(!a(d.y)){c.top=d.y+b}MochiKit.DOM.updateNodeAttributes(e,{style:c})},makePositioned:function(a){a=MochiKit.DOM.getElement(a);var b=MochiKit.Style.getStyle(a,"position");if(b=="static"||!b){a.style.position="relative";if(/Opera/.test(navigator.userAgent)){a.style.top=0;a.style.left=0}}},undoPositioned:function(a){a=MochiKit.DOM.getElement(a);if(a.style.position=="relative"){a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}},makeClipping:function(c){c=MochiKit.DOM.getElement(c);var a=c.style;var b={overflow:a.overflow,"overflow-x":a.overflowX,"overflow-y":a.overflowY};if((MochiKit.Style.getStyle(c,"overflow")||"visible")!="hidden"){c.style.overflow="hidden";c.style.overflowX="hidden";c.style.overflowY="hidden"}return b},undoClipping:function(b,a){b=MochiKit.DOM.getElement(b);if(typeof(a)=="string"){b.style.overflow=a}else{if(a!=null){b.style.overflow=a.overflow;b.style.overflowX=a["overflow-x"];b.style.overflowY=a["overflow-y"]}}},getElementDimensions:function(b,a){var o=MochiKit.Style;var c=MochiKit.DOM;if(typeof(b.w)=="number"||typeof(b.h)=="number"){return new o.Dimensions(b.w||0,b.h||0)}b=c.getElement(b);if(!b){return undefined}var l=o.getStyle(b,"display");if(l=="none"||l==""||typeof(l)=="undefined"){var q=b.style;var r=q.visibility;var n=q.position;var m=q.display;q.visibility="hidden";q.position="absolute";q.display=o._getDefaultDisplay(b);var k=b.offsetWidth;var j=b.offsetHeight;q.display=m;q.position=n;q.visibility=r}else{k=b.offsetWidth||0;j=b.offsetHeight||0}if(a){var h="colSpan" in b&&"rowSpan" in b;var g=(h&&b.parentNode&&o.getStyle(b.parentNode,"borderCollapse")=="collapse");if(g){if(/MSIE/.test(navigator.userAgent)){var f=b.previousSibling?0.5:1;var e=b.nextSibling?0.5:1}else{var f=0.5;var e=0.5}}else{var f=1;var e=1}k-=Math.round((parseFloat(o.getStyle(b,"paddingLeft"))||0)+(parseFloat(o.getStyle(b,"paddingRight"))||0)+f*(parseFloat(o.getStyle(b,"borderLeftWidth"))||0)+e*(parseFloat(o.getStyle(b,"borderRightWidth"))||0));if(h){if(/Gecko|Opera/.test(navigator.userAgent)&&!/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)){var d=0}else{if(/MSIE/.test(navigator.userAgent)){var d=1}else{var d=g?0.5:1}}}else{var d=1}j-=Math.round((parseFloat(o.getStyle(b,"paddingTop"))||0)+(parseFloat(o.getStyle(b,"paddingBottom"))||0)+d*((parseFloat(o.getStyle(b,"borderTopWidth"))||0)+(parseFloat(o.getStyle(b,"borderBottomWidth"))||0)))}return new o.Dimensions(k,j)},setElementDimensions:function(b,e,d){b=MochiKit.DOM.getElement(b);if(typeof(d)=="undefined"){d="px"}var c={};var a=MochiKit.Base.isUndefinedOrNull;if(!a(e.w)){c.width=e.w+d}if(!a(e.h)){c.height=e.h+d}MochiKit.DOM.updateNodeAttributes(b,{style:c})},_getDefaultDisplay:function(c){var a=MochiKit.Style;var d=MochiKit.DOM;c=d.getElement(c);if(!c){return undefined}var b=c.tagName.toUpperCase();return a._defaultDisplay[b]||"block"},setDisplayForElement:function(d,c){var b=MochiKit.Base.extend(null,arguments,1);var a=MochiKit.DOM.getElement;for(var e=0;e<b.length;e++){c=a(b[e]);if(c){c.style.display=d}}},getViewportDimensions:function(){var e=new MochiKit.Style.Dimensions();var c=MochiKit.DOM._window;var a=MochiKit.DOM._document.body;if(c.innerWidth){e.w=c.innerWidth;e.h=c.innerHeight}else{if(a&&a.parentElement&&a.parentElement.clientWidth){e.w=a.parentElement.clientWidth;e.h=a.parentElement.clientHeight}else{if(a&&a.clientWidth){e.w=a.clientWidth;e.h=a.clientHeight}}}return e},getViewportPosition:function(){var f=new MochiKit.Style.Coordinates(0,0);var b=MochiKit.DOM._document;var e=b.documentElement;var a=b.body;if(e&&(e.scrollTop||e.scrollLeft)){f.x=e.scrollLeft;f.y=e.scrollTop}else{if(a){f.x=a.scrollLeft;f.y=a.scrollTop}}return f},__new__:function(){var a=MochiKit.Base;var e=["A","ABBR","ACRONYM","B","BASEFONT","BDO","BIG","BR","CITE","CODE","DFN","EM","FONT","I","IMG","KBD","LABEL","Q","S","SAMP","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","TEXTAREA","TT","U","VAR"];this._defaultDisplay={TABLE:"table",THEAD:"table-header-group",TBODY:"table-row-group",TFOOT:"table-footer-group",COLGROUP:"table-column-group",COL:"table-column",TR:"table-row",TD:"table-cell",TH:"table-cell",CAPTION:"table-caption",LI:"list-item",INPUT:"inline-block",SELECT:"inline-block"};if(/MSIE/.test(navigator.userAgent)){for(var c in this._defaultDisplay){var b=this._defaultDisplay[c];if(b.indexOf("table")==0){this._defaultDisplay[c]="block"}}}for(var d=0;d<e.length;d++){this._defaultDisplay[e[d]]="inline"}this.elementPosition=this.getElementPosition;this.elementDimensions=this.getElementDimensions;this.hideElement=a.partial(this.setDisplayForElement,"none");this.showElement=a.partial(this.setDisplayForElement,"block");this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)}});MochiKit.Style.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Style);MochiKit.Base._deps("LoggingPane",["Base","Logging"]);MochiKit.LoggingPane.NAME="MochiKit.LoggingPane";MochiKit.LoggingPane.VERSION="1.4.2";MochiKit.LoggingPane.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.LoggingPane.toString=function(){return this.__repr__()};MochiKit.LoggingPane.createLoggingPane=function(b){var a=MochiKit.LoggingPane;b=!(!b);if(a._loggingPane&&a._loggingPane.inline!=b){a._loggingPane.closePane();a._loggingPane=null}if(!a._loggingPane||a._loggingPane.closed){a._loggingPane=new a.LoggingPane(b,MochiKit.Logging.logger)}return a._loggingPane};MochiKit.LoggingPane.LoggingPane=function(v,u){if(typeof(u)=="undefined"||u===null){u=MochiKit.Logging.logger}this.logger=u;var t=MochiKit.Base.update;var s=MochiKit.Base.updatetree;var d=MochiKit.Base.bind;var N=MochiKit.Base.clone;var H=window;var g="_MochiKit_LoggingPane";if(typeof(MochiKit.DOM)!="undefined"){H=MochiKit.DOM.currentWindow()}if(!v){var c=H.location.href.split("?")[0].replace(/[#:\/.><&%-]/g,"_");var n=g+"_"+c;var M=H.open("",n,"dependent,resizable,height=200");if(!M){alert("Not able to open debugging window due to pop-up blocking.");return undefined}M.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>');M.document.close();M.document.title+=" "+H.document.title;H=M}var j=H.document;this.doc=j;var m=j.getElementById(g);var l=!!m;if(m&&typeof(m.loggingPane)!="undefined"){m.loggingPane.logger=this.logger;m.loggingPane.buildAndApplyFilter();return m.loggingPane}if(l){var k;while((k=m.firstChild)){m.removeChild(k)}}else{m=j.createElement("div");m.id=g}m.loggingPane=this;var h=j.createElement("input");var f=j.createElement("input");var e=j.createElement("button");var b=j.createElement("button");var a=j.createElement("button");var B=j.createElement("button");var A=j.createElement("div");var z=j.createElement("div");var y=g+"_Listener";this.colorTable=N(this.colorTable);var x=[];var w=null;var L=function(O){var P=O.level;if(typeof(P)=="number"){P=MochiKit.Logging.LogLevel[P]}return P};var K=function(O){return O.info.join(" ")};var J=d(function(R){var O=L(R);var Q=K(R);var S=this.colorTable[O];var P=j.createElement("span");P.className="MochiKit-LogMessage MochiKit-LogLevel-"+O;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: "+S;P.appendChild(j.createTextNode(O+": "+Q));z.appendChild(P);z.appendChild(j.createElement("br"));if(A.offsetHeight>A.scrollHeight){A.scrollTop=0}else{A.scrollTop=A.scrollHeight}},this);var r=function(O){x[x.length]=O;J(O)};var q=function(){var P,O;try{P=new RegExp(h.value);O=new RegExp(f.value)}catch(Q){logDebug("Error in filter regex: "+Q.message);return null}return function(R){return(P.test(L(R))&&O.test(K(R)))}};var I=function(){while(z.firstChild){z.removeChild(z.firstChild)}};var G=function(){x=[];I()};var F=d(function(){if(this.closed){return}this.closed=true;if(MochiKit.LoggingPane._loggingPane==this){MochiKit.LoggingPane._loggingPane=null}this.logger.removeListener(y);try{try{m.loggingPane=null}catch(O){logFatal("Bookmarklet was closed incorrectly.")}if(v){m.parentNode.removeChild(m)}else{this.win.close()}}catch(O){}},this);var E=function(){I();for(var O=0;O<x.length;O++){var P=x[O];if(w===null||w(P)){J(P)}}};this.buildAndApplyFilter=function(){w=q();E();this.logger.removeListener(y);this.logger.addListener(y,w,r)};var D=d(function(){x=this.logger.getMessages();E()},this);var C=d(function(O){O=O||window.event;key=O.which||O.keyCode;if(key==13){this.buildAndApplyFilter()}},this);var o="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont;if(v){o+="; height: 10em; border-top: 2px solid black"}else{o+="; height: 100%;"}m.style.cssText=o;if(!l){j.body.appendChild(m)}o={cssText:"width: 33%; display: inline; font: "+this.logFont};s(h,{value:"FATAL|ERROR|WARNING|INFO|DEBUG",onkeypress:C,style:o});m.appendChild(h);s(f,{value:".*",onkeypress:C,style:o});m.appendChild(f);o="width: 8%; display:inline; font: "+this.logFont;e.appendChild(j.createTextNode("Filter"));e.onclick=d("buildAndApplyFilter",this);e.style.cssText=o;m.appendChild(e);b.appendChild(j.createTextNode("Load"));b.onclick=D;b.style.cssText=o;m.appendChild(b);a.appendChild(j.createTextNode("Clear"));a.onclick=G;a.style.cssText=o;m.appendChild(a);B.appendChild(j.createTextNode("Close"));B.onclick=F;B.style.cssText=o;m.appendChild(B);A.style.cssText="overflow: auto; width: 100%";z.style.cssText="width: 100%; height: "+(v?"8em":"100%");A.appendChild(z);m.appendChild(A);this.buildAndApplyFilter();D();if(v){this.win=undefined}else{this.win=H}this.inline=v;this.closePane=F;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);MochiKit.Base._deps("Color",["Base","DOM","Style"]);MochiKit.Color.NAME="MochiKit.Color";MochiKit.Color.VERSION="1.4.2";MochiKit.Color.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Color.toString=function(){return this.__repr__()};MochiKit.Color.Color=function(d,c,a,b){if(typeof(b)=="undefined"||b===null){b=1}this.rgb={r:d,g:c,b:a,a:b}};MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(c){var b=this.rgb;var a=MochiKit.Color;return a.Color.fromRGB(b.r,b.g,b.b,c)},colorWithHue:function(c){var b=this.asHSL();b.h=c;var a=MochiKit.Color;return a.Color.fromHSL(b)},colorWithSaturation:function(b){var c=this.asHSL();c.s=b;var a=MochiKit.Color;return a.Color.fromHSL(c)},colorWithLightness:function(c){var b=this.asHSL();b.l=c;var a=MochiKit.Color;return a.Color.fromHSL(b)},darkerColorWithLevel:function(b){var c=this.asHSL();c.l=Math.max(c.l-b,0);var a=MochiKit.Color;return a.Color.fromHSL(c)},lighterColorWithLevel:function(c){var b=this.asHSL();b.l=Math.min(b.l+c,1);var a=MochiKit.Color;return a.Color.fromHSL(b)},blendedColor:function(e,c){if(typeof(c)=="undefined"||c===null){c=0.5}var b=1-c;var a=this.rgb;var g=e.rgb;var f=c;return MochiKit.Color.Color.fromRGB((a.r*b)+(g.r*f),(a.g*b)+(g.g*f),(a.b*b)+(g.b*f),(a.a*b)+(g.a*f))},compareRGB:function(e){var d=this.asRGB();var c=e.asRGB();return MochiKit.Base.compare([d.r,d.g,d.b,d.a],[c.r,c.g,c.b,c.a])},isLight:function(){return this.asHSL().b>0.5},isDark:function(){return(!this.isLight())},toHSLString:function(){var g=this.asHSL();var f=MochiKit.Color.clampColorComponent;var e=this._hslString;if(!e){var d=(f(g.h,360).toFixed(0)+","+f(g.s,100).toPrecision(4)+"%,"+f(g.l,100).toPrecision(4)+"%");var b=g.a;if(b>=1){b=1;e="hsl("+d+")"}else{if(b<=0){b=0}e="hsla("+d+","+b+")"}this._hslString=e}return e},toRGBString:function(){var e=this.rgb;var d=MochiKit.Color.clampColorComponent;var b=this._rgbString;if(!b){var a=(d(e.r,255).toFixed(0)+","+d(e.g,255).toFixed(0)+","+d(e.b,255).toFixed(0));if(e.a!=1){b="rgba("+a+","+e.a+")"}else{b="rgb("+a+")"}this._rgbString=b}return b},asRGB:function(){return MochiKit.Base.clone(this.rgb)},toHexString:function(){var a=MochiKit.Color;var e=this.rgb;var d=MochiKit.Color.clampColorComponent;var b=this._hexString;if(!b){b=("#"+a.toColorPart(d(e.r,255))+a.toColorPart(d(e.g,255))+a.toColorPart(d(e.b,255)));this._hexString=b}return b},asHSV:function(){var a=this.hsv;var b=this.rgb;if(typeof(a)=="undefined"||a===null){a=MochiKit.Color.rgbToHSV(this.rgb);this.hsv=a}return MochiKit.Base.clone(a)},asHSL:function(){var a=this.hsl;var b=this.rgb;if(typeof(a)=="undefined"||a===null){a=MochiKit.Color.rgbToHSL(this.rgb);this.hsl=a}return MochiKit.Base.clone(a)},toString:function(){return this.toRGBString()},repr:function(){var b=this.rgb;var a=[b.r,b.g,b.b,b.a];return this.__class__.NAME+"("+a.join(", ")+")"}};MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(f,d,b,c){var a=MochiKit.Color.Color;if(arguments.length==1){var e=f;f=e.r;d=e.g;b=e.b;if(typeof(e.a)=="undefined"){c=undefined}else{c=e.a}}return new a(f,d,b,c)},fromHSL:function(b,e,d,c){var a=MochiKit.Color;return a.Color.fromRGB(a.hslToRGB.apply(a,arguments))},fromHSV:function(b,c,e,d){var a=MochiKit.Color;return a.Color.fromRGB(a.hsvToRGB.apply(a,arguments))},fromName:function(c){var b=MochiKit.Color.Color;if(c.charAt(0)=='"'){c=c.substr(1,c.length-2)}var a=b._namedColors[c.toLowerCase()];if(typeof(a)=="string"){return b.fromHexString(a)}else{if(c=="transparent"){return b.transparentColor()}}return null},fromString:function(c){var b=MochiKit.Color.Color;var a=c.substr(0,3);if(a=="rgb"){return b.fromRGBString(c)}else{if(a=="hsl"){return b.fromHSLString(c)}else{if(c.charAt(0)=="#"){return b.fromHexString(c)}}}return b.fromName(c)},fromHexString:function(a){if(a.charAt(0)=="#"){a=a.substring(1)}var e=[];var b,c;if(a.length==3){for(b=0;b<3;b++){c=a.substr(b,1);e.push(parseInt(c+c,16)/255)}}else{for(b=0;b<6;b+=2){c=a.substr(b,2);e.push(parseInt(c,16)/255)}}var d=MochiKit.Color.Color;return d.fromRGB.apply(d,e)},_fromColorString:function(b,e,k,j){if(j.indexOf(b)===0){j=j.substring(j.indexOf("(",3)+1,j.length-1)}var h=j.split(/\s*,\s*/);var g=[];for(var d=0;d<h.length;d++){var f=h[d];var a;var l=f.substring(f.length-3);if(f.charAt(f.length-1)=="%"){a=0.01*parseFloat(f.substring(0,f.length-1))}else{if(l=="deg"){a=parseFloat(f)/360}else{if(l=="rad"){a=parseFloat(f)/(Math.PI*2)}else{a=k[d]*parseFloat(f)}}}g.push(a)}return this[e].apply(this,g)},fromComputedStyle:function(e,g){var f=MochiKit.DOM;var a=MochiKit.Color.Color;for(e=f.getElement(e);e;e=e.parentNode){var c=MochiKit.Style.getStyle.apply(f,arguments);if(!c){continue}var b=a.fromString(c);if(!b){break}if(b.asRGB().a>0){return b}}return null},fromBackground:function(b){var a=MochiKit.Color.Color;return a.fromComputedStyle(b,"backgroundColor","background-color")||a.whiteColor()},fromText:function(b){var a=MochiKit.Color.Color;return a.fromComputedStyle(b,"color","color")||a.blackColor()},namedColors:function(){return MochiKit.Base.clone(MochiKit.Color.Color._namedColors)}});MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(a,b){a*=b;if(a<0){return 0}else{if(a>b){return b}else{return a}}},_hslValue:function(c,b,a){if(a>6){a-=6}else{if(a<0){a+=6}}var d;if(a<1){d=c+(b-c)*a}else{if(a<3){d=b}else{if(a<4){d=c+(b-c)*(4-a)}else{d=c}}}return d},hsvToRGB:function(l,k,h,e){if(arguments.length==1){var j=l;l=j.h;k=j.s;h=j.v;e=j.a}var d;var c;var n;if(k===0){d=h;c=h;n=h}else{var g=Math.floor(l*6);var m=(l*6)-g;var b=h*(1-k);var a=h*(1-(k*m));var o=h*(1-(k*(1-m)));switch(g){case 1:d=a;c=h;n=b;break;case 2:d=b;c=h;n=o;break;case 3:d=b;c=a;n=h;break;case 4:d=o;c=b;n=h;break;case 5:d=h;c=b;n=a;break;case 6:case 0:d=h;c=o;n=b;break}}return{r:d,g:c,b:n,a:e}},hslToRGB:function(h,d,c,b){if(arguments.length==1){var m=h;h=m.h;d=m.s;c=m.l;b=m.a}var e;var a;var k;if(d===0){e=c;a=c;k=c}else{var l;if(c<=0.5){l=c*(1+d)}else{l=c+d-(c*d)}var n=(2*c)-l;var j=MochiKit.Color._hslValue;var g=h*6;e=j(n,l,g+2);a=j(n,l,g);k=j(n,l,g-2)}return{r:e,g:a,b:k,a:b}},rgbToHSV:function(b,a,k,l){if(arguments.length==1){var f=b;b=f.r;a=f.g;k=f.b;l=f.a}var h=Math.max(Math.max(b,a),k);var c=Math.min(Math.min(b,a),k);var d;var j;var g=h;if(c==h){d=0;j=0}else{var e=(h-c);j=e/h;if(b==h){d=(a-k)/e}else{if(a==h){d=2+((k-b)/e)}else{d=4+((b-a)/e)}}d/=6;if(d<0){d+=1}if(d>1){d-=1}}return{h:d,s:j,v:g,a:l}},rgbToHSL:function(a,h,l,c){if(arguments.length==1){var j=a;a=j.r;h=j.g;l=j.b;c=j.a}var k=Math.max(a,Math.max(h,l));var b=Math.min(a,Math.min(h,l));var d;var g;var f=(k+b)/2;var e=k-b;if(e===0){d=0;g=0}else{if(f<=0.5){g=e/(k+b)}else{g=e/(2-k-b)}if(a==k){d=(h-l)/e}else{if(h==k){d=2+((l-a)/e)}else{d=4+((a-h)/e)}}d/=6;if(d<0){d+=1}if(d>1){d-=1}}return{h:d,s:g,l:f,a:c}},toColorPart:function(a){a=Math.round(a);var b=a.toString(16);if(a<16){return"0"+b}return b},__new__:function(){var e=MochiKit.Base;this.Color.fromRGBString=e.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]);this.Color.fromHSLString=e.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]);var j=1/3;var g={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[j,j,j],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*j,2*j,2*j],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 f=function(m,o,n,k,l){var q=this.fromRGB(o,n,k,l);this[m]=function(){return q};return q};for(var h in g){var a=h+"Color";var c=e.concat([f,this.Color,a],g[h]);this.Color[a]=e.bind.apply(null,c)}var d=function(){for(var k=0;k<arguments.length;k++){if(!(arguments[k] instanceof MochiKit.Color.Color)){return false}}return true};var b=function(l,k){return l.compareRGB(k)};e.nameFunctions(this);e.registerComparator(this.Color.NAME,d,b);this.EXPORT_TAGS={":common":this.EXPORT,":all":e.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"};MochiKit.Base._deps("Signal",["Base","DOM","Style"]);MochiKit.Signal.NAME="MochiKit.Signal";MochiKit.Signal.VERSION="1.4.2";MochiKit.Signal._observers=[];MochiKit.Signal.Event=function(b,a){this._event=a||window.event;this._src=b};MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){var a=MochiKit.Base.repr;var b="{event(): "+a(this.event())+", src(): "+a(this.src())+", type(): "+a(this.type())+", target(): "+a(this.target());if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){b+=", modifier(): {alt: "+a(this.modifier().alt)+", ctrl: "+a(this.modifier().ctrl)+", meta: "+a(this.modifier().meta)+", shift: "+a(this.modifier().shift)+", any: "+a(this.modifier().any)+"}"}if(this.type()&&this.type().indexOf("key")===0){b+=", key(): {code: "+a(this.key().code)+", string: "+a(this.key().string)+"}"}if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){b+=", mouse(): {page: "+a(this.mouse().page)+", client: "+a(this.mouse().client);if(this.type()!="mousemove"&&this.type()!="mousewheel"){b+=", button: {left: "+a(this.mouse().button.left)+", middle: "+a(this.mouse().button.middle)+", right: "+a(this.mouse().button.right)+"}"}if(this.type()=="mousewheel"){b+=", wheel: "+a(this.mouse().wheel)}b+="}"}if(this.type()=="mouseover"||this.type()=="mouseout"||this.type()=="mouseenter"||this.type()=="mouseleave"){b+=", relatedTarget(): "+a(this.relatedTarget())}b+="}";return b},toString:function(){return this.__repr__()},src:function(){return this._src},event:function(){return this._event},type:function(){if(this._event.type==="DOMMouseScroll"){return"mousewheel"}else{return this._event.type||undefined}},target:function(){return this._event.target||this._event.srcElement},_relatedTarget:null,relatedTarget:function(){if(this._relatedTarget!==null){return this._relatedTarget}var a=null;if(this.type()=="mouseover"||this.type()=="mouseenter"){a=(this._event.relatedTarget||this._event.fromElement)}else{if(this.type()=="mouseout"||this.type()=="mouseleave"){a=(this._event.relatedTarget||this._event.toElement)}}try{if(a!==null&&a.nodeType!==null){this._relatedTarget=a;return a}}catch(b){}return undefined},_modifier:null,modifier:function(){if(this._modifier!==null){return this._modifier}var a={};a.alt=this._event.altKey;a.ctrl=this._event.ctrlKey;a.meta=this._event.metaKey||false;a.shift=this._event.shiftKey;a.any=a.alt||a.ctrl||a.shift||a.meta;this._modifier=a;return a},_key:null,key:function(){if(this._key!==null){return this._key}var a={};if(this.type()&&this.type().indexOf("key")===0){if(this.type()=="keydown"||this.type()=="keyup"){a.code=this._event.keyCode;a.string=(MochiKit.Signal._specialKeys[a.code]||"KEY_UNKNOWN");this._key=a;return a}else{if(this.type()=="keypress"){a.code=0;a.string="";if(typeof(this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){a.code=this._event.charCode;a.string=String.fromCharCode(a.code)}else{if(this._event.keyCode&&typeof(this._event.charCode)=="undefined"){a.code=this._event.keyCode;a.string=String.fromCharCode(a.code)}}this._key=a;return a}}}return undefined},_mouse:null,mouse:function(){if(this._mouse!==null){return this._mouse}var c={};var d=this._event;if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){c.client=new MochiKit.Style.Coordinates(0,0);if(d.clientX||d.clientY){c.client.x=(!d.clientX||d.clientX<0)?0:d.clientX;c.client.y=(!d.clientY||d.clientY<0)?0:d.clientY}c.page=new MochiKit.Style.Coordinates(0,0);if(d.pageX||d.pageY){c.page.x=(!d.pageX||d.pageX<0)?0:d.pageX;c.page.y=(!d.pageY||d.pageY<0)?0:d.pageY}else{var f=MochiKit.DOM._document.documentElement;var a=MochiKit.DOM._document.body;c.page.x=d.clientX+(f.scrollLeft||a.scrollLeft)-(f.clientLeft||0);c.page.y=d.clientY+(f.scrollTop||a.scrollTop)-(f.clientTop||0)}if(this.type()!="mousemove"&&this.type()!="mousewheel"){c.button={};c.button.left=false;c.button.right=false;c.button.middle=false;if(d.which){c.button.left=(d.which==1);c.button.middle=(d.which==2);c.button.right=(d.which==3)}else{c.button.left=!!(d.button&1);c.button.right=!!(d.button&2);c.button.middle=!!(d.button&4)}}if(this.type()=="mousewheel"){c.wheel=new MochiKit.Style.Coordinates(0,0);if(d.wheelDeltaX||d.wheelDeltaY){c.wheel.x=d.wheelDeltaX/-40||0;c.wheel.y=d.wheelDeltaY/-40||0}else{if(d.wheelDelta){c.wheel.y=d.wheelDelta/-40}else{c.wheel.y=d.detail||0}}}this._mouse=c;return c}return undefined},stop:function(){this.stopPropagation();this.preventDefault()},stopPropagation:function(){if(this._event.stopPropagation){this._event.stopPropagation()}else{this._event.cancelBubble=true}},preventDefault:function(){if(this._event.preventDefault){this._event.preventDefault()}else{if(this._confirmUnload===null){this._event.returnValue=false}}},_confirmUnload:null,confirmUnload:function(a){if(this.type()=="beforeunload"){this._confirmUnload=a;this._event.returnValue=a}}});MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"};(function(){var a=MochiKit.Signal._specialMacKeys;for(i=63236;i<=63242;i++){a[i]="KEY_F"+(i-63236+1)}})();MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"};(function(){var a=MochiKit.Signal._specialKeys;for(var b=48;b<=57;b++){a[b]="KEY_"+(b-48)}for(b=65;b<=90;b++){a[b]="KEY_"+String.fromCharCode(b)}for(b=96;b<=105;b++){a[b]="KEY_NUM_PAD_"+(b-96)}for(b=112;b<=123;b++){a[b]="KEY_F"+(b-112+1)}})();MochiKit.Signal.Ident=function(a){this.source=a.source;this.signal=a.signal;this.listener=a.listener;this.isDOM=a.isDOM;this.objOrFunc=a.objOrFunc;this.funcOrStr=a.funcOrStr;this.connected=a.connected};MochiKit.Signal.Ident.prototype={};MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){return"["+this.NAME+" "+this.VERSION+"]"},toString:function(){return this.__repr__()},_unloadCache:function(){var a=MochiKit.Signal;var c=a._observers;for(var b=0;b<c.length;b++){if(c[b].signal!=="onload"&&c[b].signal!=="onunload"){a._disconnect(c[b])}}},_listener:function(g,f,c,e,b){var a=MochiKit.Signal;var d=a.Event;if(!b){if(typeof(c.im_self)=="undefined"){return MochiKit.Base.bindLate(c,e)}else{return c}}e=e||g;if(typeof(c)=="string"){if(f==="onload"||f==="onunload"){return function(h){e[c].apply(e,[new d(g,h)]);var j=new MochiKit.Signal.Ident({source:g,signal:f,objOrFunc:e,funcOrStr:c});MochiKit.Signal._disconnect(j)}}else{return function(h){e[c].apply(e,[new d(g,h)])}}}else{if(f==="onload"||f==="onunload"){return function(j){c.apply(e,[new d(g,j)]);var h=new MochiKit.Signal.Ident({source:g,signal:f,objOrFunc:c});MochiKit.Signal._disconnect(h)}}else{return function(h){c.apply(e,[new d(g,h)])}}}},_browserAlreadyHasMouseEnterAndLeave:function(){return/MSIE/.test(navigator.userAgent)},_browserLacksMouseWheelEvent:function(){return/Gecko\//.test(navigator.userAgent)},_mouseEnterListener:function(e,d,a,c){var b=MochiKit.Signal.Event;return function(h){var g=new b(e,h);try{g.relatedTarget().nodeName}catch(f){return}g.stop();if(MochiKit.DOM.isChildNode(g.relatedTarget(),e)){return}g.type=function(){return d};if(typeof(a)=="string"){return c[a].apply(c,[g])}else{return a.apply(c,[g])}}},_getDestPair:function(d,b){var c=null;var a=null;if(typeof(b)!="undefined"){c=d;a=b;if(typeof(b)=="string"){if(typeof(d[b])!="function"){throw new Error("'funcOrStr' must be a function on 'objOrFunc'")}}else{if(typeof(b)!="function"){throw new Error("'funcOrStr' must be a function or string")}}}else{if(typeof(d)!="function"){throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given")}else{a=d}}return[c,a]},connect:function(b,m,d,c){b=MochiKit.DOM.getElement(b);var k=MochiKit.Signal;if(typeof(m)!="string"){throw new Error("'sig' must be a string")}var l=k._getDestPair(d,c);var f=l[0];var e=l[1];if(typeof(f)=="undefined"||f===null){f=b}var j=!!(b.addEventListener||b.attachEvent);if(j&&(m==="onmouseenter"||m==="onmouseleave")&&!k._browserAlreadyHasMouseEnterAndLeave()){var h=k._mouseEnterListener(b,m.substr(2),e,f);if(m==="onmouseenter"){m="onmouseover"}else{m="onmouseout"}}else{if(j&&m=="onmousewheel"&&k._browserLacksMouseWheelEvent()){var h=k._listener(b,m,e,f,j);m="onDOMMouseScroll"}else{var h=k._listener(b,m,e,f,j)}}if(b.addEventListener){b.addEventListener(m.substr(2),h,false)}else{if(b.attachEvent){b.attachEvent(m,h)}}var a=new MochiKit.Signal.Ident({source:b,signal:m,listener:h,isDOM:j,objOrFunc:d,funcOrStr:c,connected:true});k._observers.push(a);if(!j&&typeof(b.__connect__)=="function"){var g=MochiKit.Base.extend([a],arguments,1);b.__connect__.apply(b,g)}return a},_disconnect:function(d){if(!d.connected){return}d.connected=false;var c=d.source;var b=d.signal;var a=d.listener;if(!d.isDOM){if(typeof(c.__disconnect__)=="function"){c.__disconnect__(d,b,d.objOrFunc,d.funcOrStr)}return}if(c.removeEventListener){c.removeEventListener(b.substr(2),a,false)}else{if(c.detachEvent){c.detachEvent(b,a)}else{throw new Error("'src' must be a DOM element")}}},disconnect:function(j){var k=MochiKit.Signal;var g=k._observers;var d=MochiKit.Base;if(arguments.length>1){var a=MochiKit.DOM.getElement(arguments[0]);var l=arguments[1];var f=arguments[2];var c=arguments[3];for(var e=g.length-1;e>=0;e--){var b=g[e];if(b.source===a&&b.signal===l&&b.objOrFunc===f&&b.funcOrStr===c){k._disconnect(b);if(!k._lock){g.splice(e,1)}else{k._dirty=true}return true}}}else{var h=d.findIdentical(g,j);if(h>=0){k._disconnect(j);if(!k._lock){g.splice(h,1)}else{k._dirty=true}return true}}return false},disconnectAllTo:function(e,d){var j=MochiKit.Signal;var c=j._observers;var b=j._disconnect;var h=j._lock;var g=j._dirty;if(typeof(d)==="undefined"){d=null}for(var a=c.length-1;a>=0;a--){var f=c[a];if(f.objOrFunc===e&&(d===null||f.funcOrStr===d)){b(f);if(h){g=true}else{c.splice(a,1)}}}j._dirty=g},disconnectAll:function(a,n){a=MochiKit.DOM.getElement(a);var b=MochiKit.Base;var f=b.flattenArguments(b.extend(null,arguments,1));var k=MochiKit.Signal;var d=k._disconnect;var j=k._observers;var c,h;var g=k._lock;var e=k._dirty;if(f.length===0){for(c=j.length-1;c>=0;c--){h=j[c];if(h.source===a){d(h);if(!g){j.splice(c,1)}else{e=true}}}}else{var l={};for(c=0;c<f.length;c++){l[f[c]]=true}for(c=j.length-1;c>=0;c--){h=j[c];if(h.source===a&&h.signal in l){d(h);if(!g){j.splice(c,1)}else{e=true}}}}k._dirty=e},signal:function(a,k){var j=MochiKit.Signal;var d=j._observers;a=MochiKit.DOM.getElement(a);var h=MochiKit.Base.extend(null,arguments,2);var c=[];j._lock=true;for(var f=0;f<d.length;f++){var b=d[f];if(b.source===a&&b.signal===k&&b.connected){try{b.listener.apply(a,h)}catch(g){c.push(g)}}}j._lock=false;if(j._dirty){j._dirty=false;for(var f=d.length-1;f>=0;f--){if(!d[f].connected){d.splice(f,1)}}}if(c.length==1){throw c[0]}else{if(c.length>1){var g=new Error("Multiple errors thrown in handling 'sig', see errors property");g.errors=c;throw g}}}});MochiKit.Signal.EXPORT_OK=[];MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"];MochiKit.Signal.__new__=function(c){var a=MochiKit.Base;this._document=document;this._window=c;this._lock=false;this._dirty=false;try{this.connect(window,"onunload",this._unloadCache)}catch(b){}this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)};MochiKit.Signal.__new__(this);if(MochiKit.__export__){connect=MochiKit.Signal.connect;disconnect=MochiKit.Signal.disconnect;disconnectAll=MochiKit.Signal.disconnectAll;signal=MochiKit.Signal.signal}MochiKit.Base._exportSymbols(this,MochiKit.Signal);MochiKit.Base._deps("Position",["Base","DOM","Style"]);MochiKit.Position.NAME="MochiKit.Position";MochiKit.Position.VERSION="1.4.2";MochiKit.Position.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Position.toString=function(){return this.__repr__()};MochiKit.Position.EXPORT_OK=[];MochiKit.Position.EXPORT=[];MochiKit.Base.update(MochiKit.Position,{includeScrollOffsets:false,prepare:function(){var b=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;var a=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;this.windowOffset=new MochiKit.Style.Coordinates(b,a)},cumulativeOffset:function(c){var b=0;var a=0;do{b+=c.offsetTop||0;a+=c.offsetLeft||0;c=c.offsetParent}while(c);return new MochiKit.Style.Coordinates(a,b)},realOffset:function(c){var b=0;var a=0;do{b+=c.scrollTop||0;a+=c.scrollLeft||0;c=c.parentNode}while(c);return new MochiKit.Style.Coordinates(a,b)},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=this.cumulativeOffset(b);if(b.style.position=="fixed"){this.offset.x+=this.windowOffset.x;this.offset.y+=this.windowOffset.y}return(c>=this.offset.y&&c<this.offset.y+b.offsetHeight&&a>=this.offset.x&&a<this.offset.x+b.offsetWidth)},withinIncludingScrolloffsets:function(c,a,d){var b=this.realOffset(c);this.xcomp=a+b.x-this.windowOffset.x;this.ycomp=d+b.y-this.windowOffset.y;this.offset=this.cumulativeOffset(c);return(this.ycomp>=this.offset.y&&this.ycomp<this.offset.y+c.offsetHeight&&this.xcomp>=this.offset.x&&this.xcomp<this.offset.x+c.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset.y+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset.x+a.offsetWidth)-this.xcomp)/a.offsetWidth}},absolutize:function(e){e=MochiKit.DOM.getElement(e);if(e.style.position=="absolute"){return}MochiKit.Position.prepare();var d=MochiKit.Position.positionedOffset(e);var c=e.clientWidth;var a=e.clientHeight;var b={position:e.style.position,left:d.x-parseFloat(e.style.left||0),top:d.y-parseFloat(e.style.top||0),width:e.style.width,height:e.style.height};e.style.position="absolute";e.style.top=d.y+"px";e.style.left=d.x+"px";e.style.width=c+"px";e.style.height=a+"px";return b},positionedOffset:function(c){var b=0,a=0;do{b+=c.offsetTop||0;a+=c.offsetLeft||0;c=c.offsetParent;if(c){p=MochiKit.Style.getStyle(c,"position");if(p=="relative"||p=="absolute"){break}}}while(c);return new MochiKit.Style.Coordinates(a,b)},relativize:function(b,a){b=MochiKit.DOM.getElement(b);if(b.style.position=="relative"){return}MochiKit.Position.prepare();var d=parseFloat(b.style.top||0)-(a.top||0);var c=parseFloat(b.style.left||0)-(a.left||0);b.style.position=a.position;b.style.top=d+"px";b.style.left=c+"px";b.style.width=a.width;b.style.height=a.height},clone:function(c,b){c=MochiKit.DOM.getElement(c);b=MochiKit.DOM.getElement(b);b.style.position="absolute";var a=this.cumulativeOffset(c);b.style.top=a.y+"px";b.style.left=a.x+"px";b.style.width=c.offsetWidth+"px";b.style.height=c.offsetHeight+"px"},page:function(a){var d=0;var c=0;var b=a;do{d+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&MochiKit.Style.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=a;do{d-=b.scrollTop||0;c-=b.scrollLeft||0}while(b=b.parentNode);return new MochiKit.Style.Coordinates(c,d)}});MochiKit.Position.__new__=function(b){var a=MochiKit.Base;this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)};a.nameFunctions(this)};MochiKit.Position.__new__(this);MochiKit.Base._exportSymbols(this,MochiKit.Position);MochiKit.Base._deps("Visual",["Base","DOM","Style","Color","Position"]);MochiKit.Visual.NAME="MochiKit.Visual";MochiKit.Visual.VERSION="1.4.2";MochiKit.Visual.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Visual.toString=function(){return this.__repr__()};MochiKit.Visual._RoundCorners=function(d,c){d=MochiKit.DOM.getElement(d);this._setOptions(c);if(this.options.__unstable__wrapElement){d=this._doWrap(d)}var b=this.options.color;var f=MochiKit.Color.Color;if(this.options.color==="fromElement"){b=f.fromBackground(d)}else{if(!(b instanceof f)){b=f.fromString(b)}}this.isTransparent=(b.asRGB().a<=0);var a=this.options.bgColor;if(this.options.bgColor==="fromParent"){a=f.fromBackground(d.offsetParent)}else{if(!(a instanceof f)){a=f.fromString(a)}}this._roundCornersImpl(d,b,a)};MochiKit.Visual._RoundCorners.prototype={_doWrap:function(d){var a=d.parentNode;var c=MochiKit.DOM.currentDocument();if(typeof(c.defaultView)==="undefined"||c.defaultView===null){return d}var f=c.defaultView.getComputedStyle(d,null);if(typeof(f)==="undefined"||f===null){return d}var b=MochiKit.DOM.DIV({style:{display:"block",marginTop:f.getPropertyValue("padding-top"),marginRight:f.getPropertyValue("padding-right"),marginBottom:f.getPropertyValue("padding-bottom"),marginLeft:f.getPropertyValue("padding-left"),padding:"0px"}});b.innerHTML=d.innerHTML;d.innerHTML="";d.appendChild(b);return d},_roundCornersImpl:function(c,b,a){if(this.options.border){this._renderBorder(c,a)}if(this._isTopRounded()){this._roundTopCorners(c,b,a)}if(this._isBottomRounded()){this._roundBottomCorners(c,b,a)}},_renderBorder:function(a,e){var f="1px solid "+this._borderColor(e);var d="border-left: "+f;var c="border-right: "+f;var b="style='"+d+";"+c+"'";a.innerHTML="<div "+b+">"+a.innerHTML+"</div>"},_roundTopCorners:function(e,d,c){var a=this._createCorner(c);for(var b=0;b<this.options.numSlices;b++){a.appendChild(this._createCornerSlice(d,c,b,"top"))}e.style.paddingTop=0;e.insertBefore(a,e.firstChild)},_roundBottomCorners:function(e,d,c){var a=this._createCorner(c);for(var b=(this.options.numSlices-1);b>=0;b--){a.appendChild(this._createCornerSlice(d,c,b,"bottom"))}e.style.paddingBottom=0;e.appendChild(a)},_createCorner:function(a){var b=MochiKit.DOM;return b.DIV({style:{backgroundColor:a.toString()}})},_createCornerSlice:function(f,e,g,d){var c=MochiKit.DOM.SPAN();var b=c.style;b.backgroundColor=f.toString();b.display="block";b.height="1px";b.overflow="hidden";b.fontSize="1px";var a=this._borderColor(f,e);if(this.options.border&&g===0){b.borderTopStyle="solid";b.borderTopWidth="1px";b.borderLeftWidth="0px";b.borderRightWidth="0px";b.borderBottomWidth="0px";b.height="0px";b.borderColor=a.toString()}else{if(a){b.borderColor=a.toString();b.borderStyle="solid";b.borderWidth="0px 1px"}}if(!this.options.compact&&(g==(this.options.numSlices-1))){b.height="2px"}this._setMargin(c,g,d);this._setBorder(c,g,d);return c},_setOptions:function(a){this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false};MochiKit.Base.update(this.options,a);this.options.numSlices=(this.options.compact?2:4)},_whichSideTop:function(){var a=this.options.corners;if(this._hasString(a,"all","top")){return""}var c=(a.indexOf("tl")!=-1);var b=(a.indexOf("tr")!=-1);if(c&&b){return""}if(c){return"left"}if(b){return"right"}return""},_whichSideBottom:function(){var c=this.options.corners;if(this._hasString(c,"all","bottom")){return""}var b=(c.indexOf("bl")!=-1);var a=(c.indexOf("br")!=-1);if(b&&a){return""}if(b){return"left"}if(a){return"right"}return""},_borderColor:function(b,a){if(b=="transparent"){return a}else{if(this.options.border){return this.options.border}else{if(this.options.blend){return a.blendedColor(b)}}}return""},_setMargin:function(b,f,e){var d=this._marginSize(f)+"px";var c=(e=="top"?this._whichSideTop():this._whichSideBottom());var a=b.style;if(c=="left"){a.marginLeft=d;a.marginRight="0px"}else{if(c=="right"){a.marginRight=d;a.marginLeft="0px"}else{a.marginLeft=d;a.marginRight=d}}},_setBorder:function(e,f,b){var a=this._borderSize(f)+"px";var d=(b=="top"?this._whichSideTop():this._whichSideBottom());var c=e.style;if(d=="left"){c.borderLeftWidth=a;c.borderRightWidth="0px"}else{if(d=="right"){c.borderRightWidth=a;c.borderLeftWidth="0px"}else{c.borderLeftWidth=a;c.borderRightWidth=a}}},_marginSize:function(f){if(this.isTransparent){return 0}var e=this.options;if(e.compact&&e.blend){var d=[1,0];return d[f]}else{if(e.compact){var b=[2,1];return b[f]}else{if(e.blend){var c=[3,2,1,0];return c[f]}else{var a=[5,3,2,1];return a[f]}}}},_borderSize:function(c){var b=this.options;var a;if(b.compact&&(b.blend||this.isTransparent)){return 1}else{if(b.compact){a=[1,0]}else{if(b.blend){a=[2,1,1,1]}else{if(b.border){a=[0,2,0,0]}else{if(this.isTransparent){a=[5,3,2,1]}else{return 0}}}}}return a[c]},_hasString:function(b){for(var a=1;a<arguments.length;a++){if(b.indexOf(arguments[a])!=-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(a){return(a.childNodes.length==1&&a.childNodes[0].nodeType==3)}};MochiKit.Visual.roundElement=function(b,a){new MochiKit.Visual._RoundCorners(b,a)};MochiKit.Visual.roundClass=function(e,d,c){var b=MochiKit.DOM.getElementsByTagAndClassName(e,d);for(var a=0;a<b.length;a++){MochiKit.Visual.roundElement(b[a],c)}};MochiKit.Visual.tagifyText=function(a,b){b=b||"position:relative";if(/MSIE/.test(navigator.userAgent)){b+=";zoom:1"}a=MochiKit.DOM.getElement(a);var c=MochiKit.Base.map;c(function(d){if(d.nodeType==3){c(function(e){a.insertBefore(MochiKit.DOM.SPAN({style:b},e==" "?String.fromCharCode(160):e),d)},d.nodeValue.split(""));MochiKit.DOM.removeElement(d)}},a.childNodes)};MochiKit.Visual.forceRerendering=function(c){try{c=MochiKit.DOM.getElement(c);var b=document.createTextNode(" ");c.appendChild(b);c.removeChild(b)}catch(a){}};MochiKit.Visual.multiple=function(d,c,b){b=MochiKit.Base.update({speed:0.1,delay:0},b);var a=b.delay;var e=0;MochiKit.Base.map(function(f){b.delay=e*b.speed+a;new c(f,b);e+=1},d)};MochiKit.Visual.PAIRS={slide:["slideDown","slideUp"],blind:["blindDown","blindUp"],appear:["appear","fade"],size:["grow","shrink"]};MochiKit.Visual.toggle=function(d,c,b){d=MochiKit.DOM.getElement(d);c=(c||"appear").toLowerCase();b=MochiKit.Base.update({queue:{position:"end",scope:(d.id||"global"),limit:1}},b);var a=MochiKit.Visual;a[MochiKit.Style.getStyle(d,"display")!="none"?a.PAIRS[c][1]:a.PAIRS[c][0]](d,b)};MochiKit.Visual.Transitions={};MochiKit.Visual.Transitions.linear=function(a){return a};MochiKit.Visual.Transitions.sinoidal=function(a){return 0.5-Math.cos(a*Math.PI)/2};MochiKit.Visual.Transitions.reverse=function(a){return 1-a};MochiKit.Visual.Transitions.flicker=function(a){return 0.25-Math.cos(a*Math.PI)/4+Math.random()/2};MochiKit.Visual.Transitions.wobble=function(a){return 0.5-Math.cos(9*a*Math.PI)/2};MochiKit.Visual.Transitions.pulse=function(c,b){if(b){c*=2*b}else{c*=10}var a=c-Math.floor(c);return(Math.floor(c)%2==0)?a:1-a};MochiKit.Visual.Transitions.parabolic=function(a){return a*a};MochiKit.Visual.Transitions.none=function(a){return 0};MochiKit.Visual.Transitions.full=function(a){return 1};MochiKit.Visual.ScopedQueue=function(){var a=arguments.callee;if(!(this instanceof a)){return new a()}this.__init__()};MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype,{__init__:function(){this.effects=[];this.interval=null},add:function(d){var c=new Date().getTime();var b=(typeof(d.options.queue)=="string")?d.options.queue:d.options.queue.position;var e=MochiKit.Base.map;switch(b){case"front":e(function(f){if(f.state=="idle"){f.startOn+=d.finishOn;f.finishOn+=d.finishOn}},this.effects);break;case"end":var a;e(function(g){var f=g.finishOn;if(f>=(a||f)){a=f}},this.effects);c=a||c;break;case"break":e(function(f){f.finalize()},this.effects);break}d.startOn+=c;d.finishOn+=c;if(!d.options.queue.limit||this.effects.length<d.options.queue.limit){this.effects.push(d)}if(!this.interval){this.interval=this.startLoop(MochiKit.Base.bind(this.loop,this),40)}},startLoop:function(b,a){return setInterval(b,a)},remove:function(a){this.effects=MochiKit.Base.filter(function(b){return b!=a},this.effects);if(!this.effects.length){this.stopLoop(this.interval);this.interval=null}},stopLoop:function(a){clearInterval(a)},loop:function(){var a=new Date().getTime();MochiKit.Base.map(function(b){b.loop(a)},this.effects)}});MochiKit.Visual.Queues={instances:{},get:function(a){if(typeof(a)!="string"){return a}if(!this.instances[a]){this.instances[a]=new MochiKit.Visual.ScopedQueue()}return this.instances[a]}};MochiKit.Visual.Queue=MochiKit.Visual.Queues.get("global");MochiKit.Visual.DefaultOptions={transition:MochiKit.Visual.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"};MochiKit.Visual.Base=function(){};MochiKit.Visual.Base.prototype={__class__:MochiKit.Visual.Base,start:function(b){var a=MochiKit.Visual;this.options=MochiKit.Base.setdefault(b,a.DefaultOptions);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){a.Queues.get(typeof(this.options.queue)=="string"?"global":this.options.queue.scope).add(this)}},loop:function(b){if(b>=this.startOn){if(b>=this.finishOn){return this.finalize()}var c=(b-this.startOn)/(this.finishOn-this.startOn);var a=Math.round(c*this.options.fps*this.options.duration);if(a>this.currentFrame){this.render(c);this.currentFrame=a}}},render:function(a){if(this.state=="idle"){this.state="running";this.event("beforeSetup");this.setup();this.event("afterSetup")}if(this.state=="running"){if(this.options.transition){a=this.options.transition(a)}a*=(this.options.to-this.options.from);a+=this.options.from;this.event("beforeUpdate");this.update(a);this.event("afterUpdate")}},cancel:function(){if(!this.options.sync){MochiKit.Visual.Queues.get(typeof(this.options.queue)=="string"?"global":this.options.queue.scope).remove(this)}this.state="finished"},finalize:function(){this.render(1);this.cancel();this.event("beforeFinish");this.finish();this.event("afterFinish")},setup:function(){},finish:function(){},update:function(a){},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},repr:function(){return"["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"}};MochiKit.Visual.Parallel=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.Visual.Parallel.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Parallel.prototype,{__class__:MochiKit.Visual.Parallel,__init__:function(b,a){this.effects=b||[];this.start(a)},update:function(a){MochiKit.Base.map(function(b){b.render(a)},this.effects)},finish:function(){MochiKit.Base.map(function(a){a.finalize()},this.effects)}});MochiKit.Visual.Sequence=function(c,a){var b=arguments.callee;if(!(this instanceof b)){return new b(c,a)}this.__init__(c,a)};MochiKit.Visual.Sequence.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Sequence.prototype,{__class__:MochiKit.Visual.Sequence,__init__:function(b,c){var a={transition:MochiKit.Visual.Transitions.linear,duration:0};this.effects=b||[];MochiKit.Base.map(function(d){a.duration+=d.options.duration},this.effects);MochiKit.Base.setdefault(c,a);this.start(c)},update:function(c){var d=c*this.options.duration;for(var b=0;b<this.effects.length;b++){var a=this.effects[b];if(d<=a.options.duration){a.render(d/a.options.duration);break}else{d-=a.options.duration}}},finish:function(){MochiKit.Base.map(function(a){a.finalize()},this.effects)}});MochiKit.Visual.Opacity=function(b,c){var a=arguments.callee;if(!(this instanceof a)){return new a(b,c)}this.__init__(b,c)};MochiKit.Visual.Opacity.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Opacity.prototype,{__class__:MochiKit.Visual.Opacity,__init__:function(d,c){var a=MochiKit.Base;var e=MochiKit.Style;this.element=MochiKit.DOM.getElement(d);if(this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){e.setStyle(this.element,{zoom:1})}c=a.update({from:e.getStyle(this.element,"opacity")||0,to:1},c);this.start(c)},update:function(a){MochiKit.Style.setStyle(this.element,{opacity:a})}});MochiKit.Visual.Move=function(c,a){var b=arguments.callee;if(!(this instanceof b)){return new b(c,a)}this.__init__(c,a)};MochiKit.Visual.Move.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Move.prototype,{__class__:MochiKit.Visual.Move,__init__:function(b,a){this.element=MochiKit.DOM.getElement(b);a=MochiKit.Base.update({x:0,y:0,mode:"relative"},a);this.start(a)},setup:function(){MochiKit.Style.makePositioned(this.element);var b=this.element.style;var c=b.visibility;var a=b.display;if(a=="none"){b.visibility="hidden";b.display=""}this.originalLeft=parseFloat(MochiKit.Style.getStyle(this.element,"left")||"0");this.originalTop=parseFloat(MochiKit.Style.getStyle(this.element,"top")||"0");if(this.options.mode=="absolute"){this.options.x-=this.originalLeft;this.options.y-=this.originalTop}if(a=="none"){b.visibility=c;b.display=a}},update:function(a){MochiKit.Style.setStyle(this.element,{left:Math.round(this.options.x*a+this.originalLeft)+"px",top:Math.round(this.options.y*a+this.originalTop)+"px"})}});MochiKit.Visual.Scale=function(d,c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(d,c,b)}this.__init__(d,c,b)};MochiKit.Visual.Scale.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Scale.prototype,{__class__:MochiKit.Visual.Scale,__init__:function(c,a,b){this.element=MochiKit.DOM.getElement(c);b=MochiKit.Base.update({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:a},b);this.start(b)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=MochiKit.Style.getStyle(this.element,"position");var d=MochiKit.Base.map;var c=MochiKit.Base.bind;this.originalStyle={};d(c(function(b){this.originalStyle[b]=this.element.style[b]},this),["top","left","width","height","fontSize"]);this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=MochiKit.Style.getStyle(this.element,"font-size")||"100%";d(c(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}},this),["em","px","%"]);this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}else{if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}else{this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}}},update:function(b){var a=(this.options.scaleFrom/100)+(this.factor*b);if(this.options.scaleContent&&this.fontSize){MochiKit.Style.setStyle(this.element,{fontSize:this.fontSize*a+this.fontSizeType})}this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(){if(this.restoreAfterFinish){MochiKit.Style.setStyle(this.element,this.originalStyle)}},setDimensions:function(f,c){var g={};var b=Math.round;if(/MSIE/.test(navigator.userAgent)){b=Math.ceil}if(this.options.scaleX){g.width=b(c)+"px"}if(this.options.scaleY){g.height=b(f)+"px"}if(this.options.scaleFromCenter){var a=(f-this.dims[0])/2;var e=(c-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){g.top=this.originalTop-a+"px"}if(this.options.scaleX){g.left=this.originalLeft-e+"px"}}else{if(this.options.scaleY){g.top=-a+"px"}if(this.options.scaleX){g.left=-e+"px"}}}MochiKit.Style.setStyle(this.element,g)}});MochiKit.Visual.Highlight=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.Visual.Highlight.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Highlight.prototype,{__class__:MochiKit.Visual.Highlight,__init__:function(b,a){this.element=MochiKit.DOM.getElement(b);a=MochiKit.Base.update({startcolor:"#ffff99"},a);this.start(a)},setup:function(){var a=MochiKit.Base;var c=MochiKit.Style;if(c.getStyle(this.element,"display")=="none"){this.cancel();return}this.oldStyle={backgroundImage:c.getStyle(this.element,"background-image")};c.setStyle(this.element,{backgroundImage:"none"});if(!this.options.endcolor){this.options.endcolor=MochiKit.Color.Color.fromBackground(this.element).toHexString()}if(a.isUndefinedOrNull(this.options.restorecolor)){this.options.restorecolor=c.getStyle(this.element,"background-color")}this._base=a.map(a.bind(function(b){return parseInt(this.options.startcolor.slice(b*2+1,b*2+3),16)},this),[0,1,2]);this._delta=a.map(a.bind(function(b){return parseInt(this.options.endcolor.slice(b*2+1,b*2+3),16)-this._base[b]},this),[0,1,2])},update:function(b){var a="#";MochiKit.Base.map(MochiKit.Base.bind(function(c){a+=MochiKit.Color.toColorPart(Math.round(this._base[c]+this._delta[c]*b))},this),[0,1,2]);MochiKit.Style.setStyle(this.element,{backgroundColor:a})},finish:function(){MochiKit.Style.setStyle(this.element,MochiKit.Base.update(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});MochiKit.Visual.ScrollTo=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.Visual.ScrollTo.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype,{__class__:MochiKit.Visual.ScrollTo,__init__:function(b,a){this.element=MochiKit.DOM.getElement(b);this.start(a)},setup:function(){var b=MochiKit.Position;b.prepare();var c=b.cumulativeOffset(this.element);if(this.options.offset){c.y+=this.options.offset}var a;if(window.innerHeight){a=window.innerHeight-window.height}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight-document.body.scrollHeight}else{if(document.body){a=document.body.clientHeight-document.body.scrollHeight}}}this.scrollStart=b.windowOffset.y;this.delta=(c.y>a?a:c.y)-this.scrollStart},update:function(a){var b=MochiKit.Position;b.prepare();window.scrollTo(b.windowOffset.x,this.scrollStart+(a*this.delta))}});MochiKit.Visual.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;MochiKit.Visual.Morph=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.Visual.Morph.prototype=new MochiKit.Visual.Base();MochiKit.Base.update(MochiKit.Visual.Morph.prototype,{__class__:MochiKit.Visual.Morph,__init__:function(b,a){this.element=MochiKit.DOM.getElement(b);this.start(a)},setup:function(){var d=MochiKit.Base;var f=this.options.style;this.styleStart={};this.styleEnd={};this.units={};var e,h;for(var g in f){e=f[g];g=d.camelize(g);if(MochiKit.Visual.CSS_LENGTH.test(e)){var a=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(a[1]);h=(a.length==3)?a[2]:null;this.styleEnd[g]=e;this.units[g]=h;e=MochiKit.Style.getStyle(this.element,g);a=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);e=parseFloat(a[1]);this.styleStart[g]=e}else{if(/[Cc]olor$/.test(g)){var j=MochiKit.Color.Color;e=j.fromString(e);if(e){this.units[g]="color";this.styleEnd[g]=e.toHexString();e=MochiKit.Style.getStyle(this.element,g);this.styleStart[g]=j.fromString(e).toHexString();this.styleStart[g]=d.map(d.bind(function(b){return parseInt(this.styleStart[g].slice(b*2+1,b*2+3),16)},this),[0,1,2]);this.styleEnd[g]=d.map(d.bind(function(b){return parseInt(this.styleEnd[g].slice(b*2+1,b*2+3),16)},this),[0,1,2])}}else{this.element.style[g]=e}}}},update:function(f){var e;for(var d in this.styleStart){if(this.units[d]=="color"){var a="#";var c=this.styleStart[d];var b=this.styleEnd[d];MochiKit.Base.map(MochiKit.Base.bind(function(g){a+=MochiKit.Color.toColorPart(Math.round(c[g]+(b[g]-c[g])*f))},this),[0,1,2]);this.element.style[d]=a}else{e=this.styleStart[d]+Math.round((this.styleEnd[d]-this.styleStart[d])*f*1000)/1000+this.units[d];this.element.style[d]=e}}}});MochiKit.Visual.fade=function(a,d){var c=MochiKit.Style;var b=c.getStyle(a,"opacity");d=MochiKit.Base.update({from:c.getStyle(a,"opacity")||1,to:0,afterFinishInternal:function(e){if(e.options.to!==0){return}c.hideElement(e.element);c.setStyle(e.element,{opacity:b})}},d);return new MochiKit.Visual.Opacity(a,d)};MochiKit.Visual.appear=function(c,a){var d=MochiKit.Style;var b=MochiKit.Visual;a=MochiKit.Base.update({from:(d.getStyle(c,"display")=="none"?0:d.getStyle(c,"opacity")||0),to:1,afterFinishInternal:function(e){b.forceRerendering(e.element)},beforeSetupInternal:function(e){d.setStyle(e.element,{opacity:e.options.from});d.showElement(e.element)}},a);return new b.Opacity(c,a)};MochiKit.Visual.puff=function(f,e){var d=MochiKit.Style;var a=MochiKit.Visual;f=MochiKit.DOM.getElement(f);var c=MochiKit.Style.getElementDimensions(f,true);var b={position:d.getStyle(f,"position"),top:f.style.top,left:f.style.left,width:f.style.width,height:f.style.height,opacity:d.getStyle(f,"opacity")};e=MochiKit.Base.update({beforeSetupInternal:function(g){MochiKit.Position.absolutize(g.effects[0].element)},afterFinishInternal:function(g){d.hideElement(g.effects[0].element);d.setStyle(g.effects[0].element,b)},scaleContent:true,scaleFromCenter:true},e);return new a.Parallel([new a.Scale(f,200,{sync:true,scaleFromCenter:e.scaleFromCenter,scaleMode:{originalHeight:c.h,originalWidth:c.w},scaleContent:e.scaleContent,restoreAfterFinish:true}),new a.Opacity(f,{sync:true,to:0})],e)};MochiKit.Visual.blindUp=function(f,e){var g=MochiKit.DOM;var c=MochiKit.Style;f=g.getElement(f);var b=c.getElementDimensions(f,true);var a=c.makeClipping(f);e=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:b.h,originalWidth:b.w},restoreAfterFinish:true,afterFinishInternal:function(d){c.hideElement(d.element);c.undoClipping(d.element,a)}},e);return new MochiKit.Visual.Scale(f,0,e)};MochiKit.Visual.blindDown=function(b,a){var g=MochiKit.DOM;var c=MochiKit.Style;b=g.getElement(b);var f=c.getElementDimensions(b,true);var e;a=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:f.h,originalWidth:f.w},restoreAfterFinish:true,afterSetupInternal:function(d){e=c.makeClipping(d.element);c.setStyle(d.element,{height:"0px"});c.showElement(d.element)},afterFinishInternal:function(d){c.undoClipping(d.element,e)}},a);return new MochiKit.Visual.Scale(b,100,a)};MochiKit.Visual.switchOff=function(j,g){var h=MochiKit.DOM;var e=MochiKit.Style;j=h.getElement(j);var c=e.getElementDimensions(j,true);var f=e.getStyle(j,"opacity");var b;g=MochiKit.Base.update({duration:0.7,restoreAfterFinish:true,beforeSetupInternal:function(d){e.makePositioned(j);b=e.makeClipping(j)},afterFinishInternal:function(d){e.hideElement(j);e.undoClipping(j,b);e.undoPositioned(j);e.setStyle(j,{opacity:f})}},g);var a=MochiKit.Visual;return new a.Sequence([new a.appear(j,{sync:true,duration:0.57*g.duration,from:0,transition:a.Transitions.flicker}),new a.Scale(j,1,{sync:true,duration:0.43*g.duration,scaleFromCenter:true,scaleX:false,scaleMode:{originalHeight:c.h,originalWidth:c.w},scaleContent:false,restoreAfterFinish:true})],g)};MochiKit.Visual.dropOut=function(b,a){var g=MochiKit.DOM;var e=MochiKit.Style;b=g.getElement(b);var f={top:e.getStyle(b,"top"),left:e.getStyle(b,"left"),opacity:e.getStyle(b,"opacity")};a=MochiKit.Base.update({duration:0.5,distance:100,beforeSetupInternal:function(d){e.makePositioned(d.effects[0].element)},afterFinishInternal:function(d){e.hideElement(d.effects[0].element);e.undoPositioned(d.effects[0].element);e.setStyle(d.effects[0].element,f)}},a);var c=MochiKit.Visual;return new c.Parallel([new c.Move(b,{x:0,y:a.distance,sync:true}),new c.Opacity(b,{sync:true,to:0})],a)};MochiKit.Visual.shake=function(g,e){var f=MochiKit.DOM;var b=MochiKit.Visual;var c=MochiKit.Style;g=f.getElement(g);var a={top:c.getStyle(g,"top"),left:c.getStyle(g,"left")};e=MochiKit.Base.update({duration:0.5,afterFinishInternal:function(d){c.undoPositioned(g);c.setStyle(g,a)}},e);return new b.Sequence([new b.Move(g,{sync:true,duration:0.1*e.duration,x:20,y:0}),new b.Move(g,{sync:true,duration:0.2*e.duration,x:-40,y:0}),new b.Move(g,{sync:true,duration:0.2*e.duration,x:40,y:0}),new b.Move(g,{sync:true,duration:0.2*e.duration,x:-40,y:0}),new b.Move(g,{sync:true,duration:0.2*e.duration,x:40,y:0}),new b.Move(g,{sync:true,duration:0.1*e.duration,x:-20,y:0})],e)};MochiKit.Visual.slideDown=function(c,k){var h=MochiKit.DOM;var a=MochiKit.Base;var e=MochiKit.Style;c=h.getElement(c);if(!c.firstChild){throw new Error("MochiKit.Visual.slideDown must be used on a element with a child")}h.removeEmptyTextNodes(c);var f=e.getStyle(c.firstChild,"bottom")||0;var j=e.getElementDimensions(c,true);var g;k=a.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:j.h,originalWidth:j.w},restoreAfterFinish:true,afterSetupInternal:function(b){e.makePositioned(b.element);e.makePositioned(b.element.firstChild);if(/Opera/.test(navigator.userAgent)){e.setStyle(b.element,{top:""})}g=e.makeClipping(b.element);e.setStyle(b.element,{height:"0px"});e.showElement(b.element)},afterUpdateInternal:function(d){var b=e.getElementDimensions(d.element,true);e.setStyle(d.element.firstChild,{bottom:(d.dims[0]-b.h)+"px"})},afterFinishInternal:function(b){e.undoClipping(b.element,g);if(/MSIE/.test(navigator.userAgent)){e.undoPositioned(b.element);e.undoPositioned(b.element.firstChild)}else{e.undoPositioned(b.element.firstChild);e.undoPositioned(b.element)}e.setStyle(b.element.firstChild,{bottom:f})}},k);return new MochiKit.Visual.Scale(c,100,k)};MochiKit.Visual.slideUp=function(h,g){var j=MochiKit.DOM;var c=MochiKit.Base;var f=MochiKit.Style;h=j.getElement(h);if(!h.firstChild){throw new Error("MochiKit.Visual.slideUp must be used on a element with a child")}j.removeEmptyTextNodes(h);var e=f.getStyle(h.firstChild,"bottom");var a=f.getElementDimensions(h,true);var k;g=c.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:a.h,originalWidth:a.w},scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(b){f.makePositioned(b.element);f.makePositioned(b.element.firstChild);if(/Opera/.test(navigator.userAgent)){f.setStyle(b.element,{top:""})}k=f.makeClipping(b.element);f.showElement(b.element)},afterUpdateInternal:function(d){var b=f.getElementDimensions(d.element,true);f.setStyle(d.element.firstChild,{bottom:(d.dims[0]-b.h)+"px"})},afterFinishInternal:function(b){f.hideElement(b.element);f.undoClipping(b.element,k);f.undoPositioned(b.element.firstChild);f.undoPositioned(b.element);f.setStyle(b.element.firstChild,{bottom:e})}},g);return new MochiKit.Visual.Scale(h,0,g)};MochiKit.Visual.squish=function(j,h){var g=MochiKit.DOM;var a=MochiKit.Base;var c=MochiKit.Style;var f=c.getElementDimensions(j,true);var e;h=a.update({restoreAfterFinish:true,scaleMode:{originalHeight:f.w,originalWidth:f.h},beforeSetupInternal:function(b){e=c.makeClipping(b.element)},afterFinishInternal:function(b){c.hideElement(b.element);c.undoClipping(b.element,e)}},h);return new MochiKit.Visual.Scale(j,/Opera/.test(navigator.userAgent)?1:0,h)};MochiKit.Visual.grow=function(g,f){var k=MochiKit.DOM;var m=MochiKit.Visual;var n=MochiKit.Style;g=k.getElement(g);f=MochiKit.Base.update({direction:"center",moveTransition:m.Transitions.sinoidal,scaleTransition:m.Transitions.sinoidal,opacityTransition:m.Transitions.full,scaleContent:true,scaleFromCenter:false},f);var j={top:g.style.top,left:g.style.left,height:g.style.height,width:g.style.width,opacity:n.getStyle(g,"opacity")};var l=n.getElementDimensions(g,true);var h,e;var c,b;switch(f.direction){case"top-left":h=e=c=b=0;break;case"top-right":h=l.w;e=b=0;c=-l.w;break;case"bottom-left":h=c=0;e=l.h;b=-l.h;break;case"bottom-right":h=l.w;e=l.h;c=-l.w;b=-l.h;break;case"center":h=l.w/2;e=l.h/2;c=-l.w/2;b=-l.h/2;break}var a=MochiKit.Base.update({beforeSetupInternal:function(d){n.setStyle(d.effects[0].element,{height:"0px"});n.showElement(d.effects[0].element)},afterFinishInternal:function(d){n.undoClipping(d.effects[0].element);n.undoPositioned(d.effects[0].element);n.setStyle(d.effects[0].element,j)}},f);return new m.Move(g,{x:h,y:e,duration:0.01,beforeSetupInternal:function(d){n.hideElement(d.element);n.makeClipping(d.element);n.makePositioned(d.element)},afterFinishInternal:function(d){new m.Parallel([new m.Opacity(d.element,{sync:true,to:1,from:0,transition:f.opacityTransition}),new m.Move(d.element,{x:c,y:b,sync:true,transition:f.moveTransition}),new m.Scale(d.element,100,{scaleMode:{originalHeight:l.h,originalWidth:l.w},sync:true,scaleFrom:/Opera/.test(navigator.userAgent)?1:0,transition:f.scaleTransition,scaleContent:f.scaleContent,scaleFromCenter:f.scaleFromCenter,restoreAfterFinish:true})],a)}})};MochiKit.Visual.shrink=function(e,c){var h=MochiKit.DOM;var k=MochiKit.Visual;var m=MochiKit.Style;e=h.getElement(e);c=MochiKit.Base.update({direction:"center",moveTransition:k.Transitions.sinoidal,scaleTransition:k.Transitions.sinoidal,opacityTransition:k.Transitions.none,scaleContent:true,scaleFromCenter:false},c);var g={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:m.getStyle(e,"opacity")};var j=m.getElementDimensions(e,true);var f,b;switch(c.direction){case"top-left":f=b=0;break;case"top-right":f=j.w;b=0;break;case"bottom-left":f=0;b=j.h;break;case"bottom-right":f=j.w;b=j.h;break;case"center":f=j.w/2;b=j.h/2;break}var a;var l=MochiKit.Base.update({beforeStartInternal:function(d){m.makePositioned(d.effects[0].element);a=m.makeClipping(d.effects[0].element)},afterFinishInternal:function(d){m.hideElement(d.effects[0].element);m.undoClipping(d.effects[0].element,a);m.undoPositioned(d.effects[0].element);m.setStyle(d.effects[0].element,g)}},c);return new k.Parallel([new k.Opacity(e,{sync:true,to:0,from:1,transition:c.opacityTransition}),new k.Scale(e,/Opera/.test(navigator.userAgent)?1:0,{scaleMode:{originalHeight:j.h,originalWidth:j.w},sync:true,transition:c.scaleTransition,scaleContent:c.scaleContent,scaleFromCenter:c.scaleFromCenter,restoreAfterFinish:true}),new k.Move(e,{x:f,y:b,sync:true,transition:c.moveTransition})],l)};MochiKit.Visual.pulsate=function(j,h){var g=MochiKit.DOM;var c=MochiKit.Visual;var a=MochiKit.Base;var f=MochiKit.Style.getStyle(j,"opacity");h=a.update({duration:3,from:0,afterFinishInternal:function(b){MochiKit.Style.setStyle(b.element,{opacity:f})}},h);var e=h.transition||c.Transitions.sinoidal;h.transition=function(b){return e(1-c.Transitions.pulse(b,h.pulses))};return new c.Opacity(j,h)};MochiKit.Visual.fold=function(h,g){var j=MochiKit.DOM;var c=MochiKit.Visual;var f=MochiKit.Style;h=j.getElement(h);var e=f.getElementDimensions(h,true);var b={top:h.style.top,left:h.style.left,width:h.style.width,height:h.style.height};var a=f.makeClipping(h);g=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:e.h,originalWidth:e.w},afterFinishInternal:function(d){new c.Scale(h,1,{scaleContent:false,scaleY:false,scaleMode:{originalHeight:e.h,originalWidth:e.w},afterFinishInternal:function(k){f.hideElement(k.element);f.undoClipping(k.element,a);f.setStyle(k.element,b)}})}},g);return new c.Scale(h,5,g)};MochiKit.Visual.Color=MochiKit.Color.Color;MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle;MochiKit.Visual.__new__=function(){var a=MochiKit.Base;a.nameFunctions(this);this.EXPORT_TAGS={":common":this.EXPORT,":all":a.concat(this.EXPORT,this.EXPORT_OK)}};MochiKit.Visual.EXPORT=["roundElement","roundClass","tagifyText","multiple","toggle","Parallel","Sequence","Opacity","Move","Scale","Highlight","ScrollTo","Morph","fade","appear","puff","blindUp","blindDown","switchOff","dropOut","shake","slideDown","slideUp","squish","grow","shrink","pulsate","fold"];MochiKit.Visual.EXPORT_OK=["Base","PAIRS"];MochiKit.Visual.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Visual);MochiKit.Base._deps("DragAndDrop",["Base","Iter","DOM","Signal","Visual","Position"]);MochiKit.DragAndDrop.NAME="MochiKit.DragAndDrop";MochiKit.DragAndDrop.VERSION="1.4.2";MochiKit.DragAndDrop.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.DragAndDrop.toString=function(){return this.__repr__()};MochiKit.DragAndDrop.EXPORT=["Droppable","Draggable"];MochiKit.DragAndDrop.EXPORT_OK=["Droppables","Draggables"];MochiKit.DragAndDrop.Droppables={drops:[],remove:function(a){this.drops=MochiKit.Base.filter(function(b){return b.element!=MochiKit.DOM.getElement(a)},this.drops)},register:function(a){this.drops.push(a)},unregister:function(a){this.drops=MochiKit.Base.filter(function(b){return b!=a},this.drops)},prepare:function(a){MochiKit.Base.map(function(b){if(b.isAccepted(a)){if(b.options.activeclass){MochiKit.DOM.addElementClass(b.element,b.options.activeclass)}b.options.onactive(b.element,a)}},this.drops)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i){if(MochiKit.DOM.isChildNode(a[i].element,deepest.element)){deepest=a[i]}}return deepest},show:function(c,a){if(!this.drops.length){return}var b=[];if(this.last_active){this.last_active.deactivate()}MochiKit.Iter.forEach(this.drops,function(d){if(d.isAffected(c,a)){b.push(d)}});if(b.length>0){drop=this.findDeepestChild(b);MochiKit.Position.within(drop.element,c.page.x,c.page.y);drop.options.onhover(a,drop.element,MochiKit.Position.overlap(drop.options.overlap,drop.element));drop.activate()}},fire:function(b,a){if(!this.last_active){return}MochiKit.Position.prepare();if(this.last_active.isAffected(b.mouse(),a)){this.last_active.options.ondrop(a,this.last_active.element,b)}},reset:function(a){MochiKit.Base.map(function(b){if(b.options.activeclass){MochiKit.DOM.removeElementClass(b.element,b.options.activeclass)}b.options.ondesactive(b.element,a)},this.drops);if(this.last_active){this.last_active.deactivate()}}};MochiKit.DragAndDrop.Droppable=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.DragAndDrop.Droppable.prototype={__class__:MochiKit.DragAndDrop.Droppable,__init__:function(e,c){var f=MochiKit.DOM;var a=MochiKit.Base;this.element=f.getElement(e);this.options=a.update({greedy:true,hoverclass:null,activeclass:null,hoverfunc:a.noop,accept:null,onactive:a.noop,ondesactive:a.noop,onhover:a.noop,ondrop:a.noop,containment:[],tree:false},c);this.options._containers=[];a.map(MochiKit.Base.bind(function(b){this.options._containers.push(f.getElement(b))},this),this.options.containment);MochiKit.Style.makePositioned(this.element);MochiKit.DragAndDrop.Droppables.register(this)},isContained:function(b){if(this.options._containers.length){var a;if(this.options.tree){a=b.treeNode}else{a=b.parentNode}return MochiKit.Iter.some(this.options._containers,function(d){return a==d})}else{return true}},isAccepted:function(a){return((!this.options.accept)||MochiKit.Iter.some(this.options.accept,function(b){return MochiKit.DOM.hasElementClass(a,b)}))},isAffected:function(b,a){return((this.element!=a)&&this.isContained(a)&&this.isAccepted(a)&&MochiKit.Position.within(this.element,b.page.x,b.page.y))},deactivate:function(){if(this.options.hoverclass){MochiKit.DOM.removeElementClass(this.element,this.options.hoverclass)}this.options.hoverfunc(this.element,false);MochiKit.DragAndDrop.Droppables.last_active=null},activate:function(){if(this.options.hoverclass){MochiKit.DOM.addElementClass(this.element,this.options.hoverclass)}this.options.hoverfunc(this.element,true);MochiKit.DragAndDrop.Droppables.last_active=this},destroy:function(){MochiKit.DragAndDrop.Droppables.unregister(this)},repr:function(){return"["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"}};MochiKit.DragAndDrop.Draggables={drags:[],register:function(a){if(this.drags.length===0){var b=MochiKit.Signal.connect;this.eventMouseUp=b(document,"onmouseup",this,this.endDrag);this.eventMouseMove=b(document,"onmousemove",this,this.updateDrag);this.eventKeypress=b(document,"onkeypress",this,this.keyPress)}this.drags.push(a)},unregister:function(a){this.drags=MochiKit.Base.filter(function(c){return c!=a},this.drags);if(this.drags.length===0){var b=MochiKit.Signal.disconnect;b(this.eventMouseUp);b(this.eventMouseMove);b(this.eventKeypress)}},activate:function(a){window.focus();this.activeDraggable=a},deactivate:function(){this.activeDraggable=null},updateDrag:function(b){if(!this.activeDraggable){return}var a=b.mouse();if(this._lastPointer&&(MochiKit.Base.repr(this._lastPointer.page)==MochiKit.Base.repr(a.page))){return}this._lastPointer=a;this.activeDraggable.updateDrag(b,a)},endDrag:function(a){if(!this.activeDraggable){return}this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)}},notify:function(b,c,a){MochiKit.Signal.signal(this,b,c,a)}};MochiKit.DragAndDrop.Draggable=function(c,b){var a=arguments.callee;if(!(this instanceof a)){return new a(c,b)}this.__init__(c,b)};MochiKit.DragAndDrop.Draggable.prototype={__class__:MochiKit.DragAndDrop.Draggable,__init__:function(f,e){var c=MochiKit.Visual;var a=MochiKit.Base;e=a.update({handle:false,starteffect:function(b){this._savedOpacity=MochiKit.Style.getStyle(b,"opacity")||1;new c.Opacity(b,{duration:0.2,from:this._savedOpacity,to:0.7})},reverteffect:function(h,d,b){var j=Math.sqrt(Math.abs(d^2)+Math.abs(b^2))*0.02;return new c.Move(h,{x:-b,y:-d,duration:j})},endeffect:function(b){new c.Opacity(b,{duration:0.2,from:0.7,to:this._savedOpacity})},onchange:a.noop,zindex:1000,revert:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false},e);var g=MochiKit.DOM;this.element=g.getElement(f);if(e.handle&&(typeof(e.handle)=="string")){this.handle=g.getFirstElementByTagAndClassName(null,e.handle,this.element)}if(!this.handle){this.handle=g.getElement(e.handle)}if(!this.handle){this.handle=this.element}if(e.scroll&&!e.scroll.scrollTo&&!e.scroll.outerHTML){e.scroll=g.getElement(e.scroll);this._isScrollChild=MochiKit.DOM.isChildNode(this.element,e.scroll)}MochiKit.Style.makePositioned(this.element);this.delta=this.currentDelta();this.options=e;this.dragging=false;this.eventMouseDown=MochiKit.Signal.connect(this.handle,"onmousedown",this,this.initDrag);MochiKit.DragAndDrop.Draggables.register(this)},destroy:function(){MochiKit.Signal.disconnect(this.eventMouseDown);MochiKit.DragAndDrop.Draggables.unregister(this)},currentDelta:function(){var a=MochiKit.Style.getStyle;return[parseInt(a(this.element,"left")||"0"),parseInt(a(this.element,"top")||"0")]},initDrag:function(e){if(!e.mouse().button.left){return}var c=e.target();var b=(c.tagName||"").toUpperCase();if(b==="INPUT"||b==="SELECT"||b==="OPTION"||b==="BUTTON"||b==="TEXTAREA"){return}if(this._revert){this._revert.cancel();this._revert=null}var a=e.mouse();var d=MochiKit.Position.cumulativeOffset(this.element);this.offset=[a.page.x-d.x,a.page.y-d.y];MochiKit.DragAndDrop.Draggables.activate(this);e.stop()},startDrag:function(b){this.dragging=true;if(this.options.selectclass){MochiKit.DOM.addElementClass(this.element,this.options.selectclass)}if(this.options.zindex){this.originalZ=parseInt(MochiKit.Style.getStyle(this.element,"z-index")||"0");this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.ghostPosition=MochiKit.Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var a=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=a.left;this.originalScrollTop=a.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}MochiKit.DragAndDrop.Droppables.prepare(this.element);MochiKit.DragAndDrop.Draggables.notify("start",this,b);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(c,a){if(!this.dragging){this.startDrag(c)}MochiKit.Position.prepare();MochiKit.DragAndDrop.Droppables.show(a,this.element);MochiKit.DragAndDrop.Draggables.notify("drag",this,c);this.draw(a);this.options.onchange(this);if(this.options.scroll){this.stopScrolling();var f,e;if(this.options.scroll==window){var d=this._getWindowScroll(this.options.scroll);f=new MochiKit.Style.Coordinates(d.left,d.top);e=new MochiKit.Style.Coordinates(d.left+d.width,d.top+d.height)}else{f=MochiKit.Position.page(this.options.scroll);f.x+=this.options.scroll.scrollLeft;f.y+=this.options.scroll.scrollTop;f.x+=(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0);f.y+=(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);e=new MochiKit.Style.Coordinates(f.x+this.options.scroll.offsetWidth,f.y+this.options.scroll.offsetHeight)}var b=[0,0];if(a.page.x>(e.x-this.options.scrollSensitivity)){b[0]=a.page.x-(e.x-this.options.scrollSensitivity)}else{if(a.page.x<(f.x+this.options.scrollSensitivity)){b[0]=a.page.x-(f.x+this.options.scrollSensitivity)}}if(a.page.y>(e.y-this.options.scrollSensitivity)){b[1]=a.page.y-(e.y-this.options.scrollSensitivity)}else{if(a.page.y<(f.y+this.options.scrollSensitivity)){b[1]=a.page.y-(f.y+this.options.scrollSensitivity)}}this.startScrolling(b)}if(/AppleWebKit/.test(navigator.appVersion)){window.scrollBy(0,0)}c.stop()},finishDrag:function(c,a){var e=MochiKit.DragAndDrop;this.dragging=false;if(this.options.selectclass){MochiKit.DOM.removeElementClass(this.element,this.options.selectclass)}if(this.options.ghosting){MochiKit.Position.relativize(this.element,this.ghostPosition);MochiKit.DOM.removeElement(this._clone);this._clone=null}if(a){e.Droppables.fire(c,this.element)}e.Draggables.notify("end",this,c);var b=this.options.revert;if(b&&typeof(b)=="function"){b=b(this.element)}var f=this.currentDelta();if(b&&this.options.reverteffect){this._revert=this.options.reverteffect(this.element,f[1]-this.delta[1],f[0]-this.delta[0])}else{this.delta=f}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}e.Draggables.deactivate();e.Droppables.reset(this.element)},keyPress:function(a){if(a.key().string!="KEY_ESCAPE"){return}this.finishDrag(a,false);a.stop()},endDrag:function(a){if(!this.dragging){return}this.stopScrolling();this.finishDrag(a,true);a.stop()},draw:function(f){var g=MochiKit.Position.cumulativeOffset(this.element);var e=this.currentDelta();g.x-=e[0];g.y-=e[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){g.x-=this.options.scroll.scrollLeft-this.originalScrollLeft;g.y-=this.options.scroll.scrollTop-this.originalScrollTop}var c=[f.page.x-g.x-this.offset[0],f.page.y-g.y-this.offset[1]];if(this.options.snap){if(typeof(this.options.snap)=="function"){c=this.options.snap(c[0],c[1])}else{if(this.options.snap instanceof Array){var a=-1;c=MochiKit.Base.map(MochiKit.Base.bind(function(d){a+=1;return Math.round(d/this.options.snap[a])*this.options.snap[a]},this),c)}else{c=MochiKit.Base.map(MochiKit.Base.bind(function(d){return Math.round(d/this.options.snap)*this.options.snap},this),c)}}}var b=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=c[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=c[1]+"px"}if(b.visibility=="hidden"){b.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;MochiKit.DragAndDrop.Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!a[0]&&!a[1]){return}this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(MochiKit.Base.bind(this.scroll,this),10)},scroll:function(){var e=new Date();var b=e-this.lastScrolled;this.lastScrolled=e;if(this.options.scroll==window){var c=this._getWindowScroll(this.options.scroll);if(this.scrollSpeed[0]||this.scrollSpeed[1]){var a=b/1000;this.options.scroll.scrollTo(c.left+a*this.scrollSpeed[0],c.top+a*this.scrollSpeed[1])}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*b/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*b/1000}var f=MochiKit.DragAndDrop;MochiKit.Position.prepare();f.Droppables.show(f.Draggables._lastPointer,this.element);f.Draggables.notify("drag",this);if(this._isScrollChild){f.Draggables._lastScrollPointer=f.Draggables._lastScrollPointer||f.Draggables._lastPointer;f.Draggables._lastScrollPointer.x+=this.scrollSpeed[0]*b/1000;f.Draggables._lastScrollPointer.y+=this.scrollSpeed[1]*b/1000;if(f.Draggables._lastScrollPointer.x<0){f.Draggables._lastScrollPointer.x=0}if(f.Draggables._lastScrollPointer.y<0){f.Draggables._lastScrollPointer.y=0}this.draw(f.Draggables._lastScrollPointer)}this.options.onchange(this)},_getWindowScroll:function(d){var b,a,c;MochiKit.DOM.withWindow(d,function(){b=MochiKit.Style.getViewportPosition(d.document)});if(d.innerWidth){a=d.innerWidth;c=d.innerHeight}else{if(d.document.documentElement&&d.document.documentElement.clientWidth){a=d.document.documentElement.clientWidth;c=d.document.documentElement.clientHeight}else{a=d.document.body.offsetWidth;c=d.document.body.offsetHeight}}return{top:b.y,left:b.x,width:a,height:c}},repr:function(){return"["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"}};MochiKit.DragAndDrop.__new__=function(){MochiKit.Base.nameFunctions(this);this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}};MochiKit.DragAndDrop.__new__();MochiKit.Base._exportSymbols(this,MochiKit.DragAndDrop);MochiKit.Base._deps("Sortable",["Base","Iter","DOM","Position","DragAndDrop"]);MochiKit.Sortable.NAME="MochiKit.Sortable";MochiKit.Sortable.VERSION="1.4.2";MochiKit.Sortable.__repr__=function(){return"["+this.NAME+" "+this.VERSION+"]"};MochiKit.Sortable.toString=function(){return this.__repr__()};MochiKit.Sortable.EXPORT=[];MochiKit.Sortable.EXPORT_OK=[];MochiKit.Base.update(MochiKit.Sortable,{sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&MochiKit.Sortable.sortables[a.id]){return a}a=a.parentNode}},_createElementId:function(a){if(a.id==null||a.id==""){var b=MochiKit.DOM;var e;var c=1;while(b.getElement(e="sortable"+c)!=null){c+=1}b.setNodeAttribute(a,"id",e)}},options:function(a){a=MochiKit.Sortable._findRootElement(MochiKit.DOM.getElement(a));if(!a){return}return MochiKit.Sortable.sortables[a.id]},destroy:function(e){var c=MochiKit.Sortable.options(e);var a=MochiKit.Base;var f=MochiKit.DragAndDrop;if(c){MochiKit.Signal.disconnect(c.startHandle);MochiKit.Signal.disconnect(c.endHandle);a.map(function(b){f.Droppables.remove(b)},c.droppables);a.map(function(b){b.destroy()},c.draggables);delete MochiKit.Sortable.sortables[c.element.id]}},create:function(d,c){d=MochiKit.DOM.getElement(d);var b=MochiKit.Sortable;b._createElementId(d);c=MochiKit.Base.update({element:d,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:[d],handle:false,only:false,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:/^[^_]*_(.*)$/,onChange:MochiKit.Base.noop,onUpdate:MochiKit.Base.noop,accept:null},c);b.destroy(d);var a={revert:true,ghosting:c.ghosting,scroll:c.scroll,scrollSensitivity:c.scrollSensitivity,scrollSpeed:c.scrollSpeed,constraint:c.constraint,handle:c.handle};if(c.starteffect){a.starteffect=c.starteffect}if(c.reverteffect){a.reverteffect=c.reverteffect}else{if(c.ghosting){a.reverteffect=function(g){g.style.top=0;g.style.left=0}}}if(c.endeffect){a.endeffect=c.endeffect}if(c.zindex){a.zindex=c.zindex}var f={overlap:c.overlap,containment:c.containment,hoverclass:c.hoverclass,onhover:b.onHover,tree:c.tree,accept:c.accept};var e={onhover:b.onEmptyHover,overlap:c.overlap,containment:c.containment,hoverclass:c.hoverclass,accept:c.accept};MochiKit.DOM.removeEmptyTextNodes(d);c.draggables=[];c.droppables=[];if(c.dropOnEmpty||c.tree){new MochiKit.DragAndDrop.Droppable(d,e);c.droppables.push(d)}MochiKit.Base.map(function(h){var g=c.handle?MochiKit.DOM.getFirstElementByTagAndClassName(null,c.handle,h):h;c.draggables.push(new MochiKit.DragAndDrop.Draggable(h,MochiKit.Base.update(a,{handle:g})));new MochiKit.DragAndDrop.Droppable(h,f);if(c.tree){h.treeNode=d}c.droppables.push(h)},(b.findElements(d,c)||[]));if(c.tree){MochiKit.Base.map(function(g){new MochiKit.DragAndDrop.Droppable(g,e);g.treeNode=d;c.droppables.push(g)},(b.findTreeElements(d,c)||[]))}b.sortables[d.id]=c;c.lastValue=b.serialize(d);c.startHandle=MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables,"start",MochiKit.Base.partial(b.onStart,d));c.endHandle=MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables,"end",MochiKit.Base.partial(b.onEnd,d))},onStart:function(d,c){var a=MochiKit.Sortable;var b=a.options(d);b.lastValue=a.serialize(b.element)},onEnd:function(d,c){var a=MochiKit.Sortable;a.unmark();var b=a.options(d);if(b.lastValue!=a.serialize(b.element)){b.onUpdate(b.element)}},findElements:function(b,a){return MochiKit.Sortable.findChildren(b,a.only,a.tree,a.tag)},findTreeElements:function(b,a){return MochiKit.Sortable.findChildren(b,a.only,a.tree?true:false,a.treeTag)},findChildren:function(a,e,d,c){if(!a.hasChildNodes()){return null}c=c.toUpperCase();if(e){e=MochiKit.Base.flattenArray([e])}var b=[];MochiKit.Base.map(function(g){if(g.tagName&&g.tagName.toUpperCase()==c&&(!e||MochiKit.Iter.some(e,function(h){return MochiKit.DOM.hasElementClass(g,h)}))){b.push(g)}if(d){var f=MochiKit.Sortable.findChildren(g,e,d,c);if(f&&f.length>0){b=b.concat(f)}}},a.childNodes);return b},onHover:function(f,e,d){if(MochiKit.DOM.isChildNode(e,f)){return}var a=MochiKit.Sortable;if(d>0.33&&d<0.66&&a.options(e).tree){return}else{if(d>0.5){a.mark(e,"before");if(e.previousSibling!=f){var c=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,e);if(e.parentNode!=c){a.options(c).onChange(f)}a.options(e.parentNode).onChange(f)}}else{a.mark(e,"after");var b=e.nextSibling||null;if(b!=f){var c=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,b);if(e.parentNode!=c){a.options(c).onChange(f)}a.options(e.parentNode).onChange(f)}}}},_offsetSize:function(a,b){if(b=="vertical"||b=="height"){return a.offsetHeight}else{return a.offsetWidth}},onEmptyHover:function(c,j,h){var g=c.parentNode;var k=MochiKit.Sortable;var f=k.options(j);if(!MochiKit.DOM.isChildNode(j,c)){var e;var d=k.findElements(j,{tag:f.tag,only:f.only});var b=null;if(d){var a=k._offsetSize(j,f.overlap)*(1-h);for(e=0;e<d.length;e+=1){if(a-k._offsetSize(d[e],f.overlap)>=0){a-=k._offsetSize(d[e],f.overlap)}else{if(a-(k._offsetSize(d[e],f.overlap)/2)>=0){b=e+1<d.length?d[e+1]:null;break}else{b=d[e];break}}}}j.insertBefore(c,b);k.options(g).onChange(c);f.onChange(c)}},unmark:function(){var a=MochiKit.Sortable._marker;if(a){MochiKit.Style.hideElement(a)}},mark:function(g,e){var f=MochiKit.DOM;var a=MochiKit.Sortable;var c=a.options(g.parentNode);if(c&&!c.ghosting){return}if(!a._marker){a._marker=f.getElement("dropmarker")||document.createElement("DIV");MochiKit.Style.hideElement(a._marker);f.addElementClass(a._marker,"dropmarker");a._marker.style.position="absolute";document.getElementsByTagName("body").item(0).appendChild(a._marker)}var b=MochiKit.Position.cumulativeOffset(g);a._marker.style.left=b.x+"px";a._marker.style.top=b.y+"px";if(e=="after"){if(c.overlap=="horizontal"){a._marker.style.left=(b.x+g.clientWidth)+"px"}else{a._marker.style.top=(b.y+g.clientHeight)+"px"}}MochiKit.Style.showElement(a._marker)},_tree:function(g,f,e){var b=MochiKit.Sortable;var d=b.findElements(g,f)||[];for(var c=0;c<d.length;++c){var a=d[c].id.match(f.format);if(!a){continue}var h={id:encodeURIComponent(a?a[1]:null),element:g,parent:e,children:[],position:e.children.length,container:b._findChildrenElement(d[c],f.treeTag.toUpperCase())};if(h.container){b._tree(h.container,f,h)}e.children.push(h)}return e},_findChildrenElement:function(c,b){if(c&&c.hasChildNodes){b=b.toUpperCase();for(var a=0;a<c.childNodes.length;++a){if(c.childNodes[a].tagName.toUpperCase()==b){return c.childNodes[a]}}}return null},tree:function(d,c){d=MochiKit.DOM.getElement(d);var b=MochiKit.Sortable.options(d);c=MochiKit.Base.update({tag:b.tag,treeTag:b.treeTag,only:b.only,name:d.id,format:b.format},c||{});var a={id:null,parent:null,children:new Array,container:d,position:0};return MochiKit.Sortable._tree(d,c,a)},setSequence:function(e,g,f){var d=MochiKit.Sortable;var a=MochiKit.Base;e=MochiKit.DOM.getElement(e);f=a.update(d.options(e),f||{});var c={};a.map(function(h){var b=h.id.match(f.format);if(b){c[b[1]]=[h,h.parentNode]}h.parentNode.removeChild(h)},d.findElements(e,f));a.map(function(b){var h=c[b];if(h){h[1].appendChild(h[0]);delete c[b]}},g)},_constructIndex:function(a){var b="";do{if(a.id){b="["+a.position+"]"+b}}while((a=a.parent)!=null);return b},sequence:function(c,b){c=MochiKit.DOM.getElement(c);var a=MochiKit.Sortable;var b=MochiKit.Base.update(a.options(c),b||{});return MochiKit.Base.map(function(d){return d.id.match(b.format)?d.id.match(b.format)[1]:""},MochiKit.DOM.getElement(a.findElements(c,b)||[]))},serialize:function(c,d){c=MochiKit.DOM.getElement(c);var a=MochiKit.Sortable;d=MochiKit.Base.update(a.options(c),d||{});var b=encodeURIComponent(d.name||c.id);if(d.tree){return MochiKit.Base.flattenArray(MochiKit.Base.map(function(e){return[b+a._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))},a.tree(c,d).children)).join("&")}else{return MochiKit.Base.map(function(e){return b+"[]="+encodeURIComponent(e)},a.sequence(c,d)).join("&")}}});MochiKit.Sortable.Sortable=MochiKit.Sortable;MochiKit.Sortable.__new__=function(){MochiKit.Base.nameFunctions(this);this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}};MochiKit.Sortable.__new__();MochiKit.Base._exportSymbols(this,MochiKit.Sortable);if(typeof(MochiKit)=="undefined"){MochiKit={}}if(typeof(MochiKit.MochiKit)=="undefined"){MochiKit.MochiKit={}}MochiKit.MochiKit.NAME="MochiKit.MochiKit";MochiKit.MochiKit.VERSION="1.4.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","Selector","Style","LoggingPane","Color","Signal","Position","Visual","DragAndDrop","Sortable"];if(typeof(JSAN)!="undefined"||typeof(dojo)!="undefined"){if(typeof(dojo)!="undefined"){dojo.provide("MochiKit.MochiKit");(function(a){for(var b=0;b<a.length;b++){dojo.require("MochiKit."+a[b])}})(MochiKit.MochiKit.SUBMODULES)}if(typeof(JSAN)!="undefined"){(function(a){for(var b=0;b<a.length;b++){JSAN.use("MochiKit."+a[b],[])}})(MochiKit.MochiKit.SUBMODULES)}(function(){var l=MochiKit.Base.extend;var o=MochiKit.MochiKit;var h=o.SUBMODULES;var g=[];var f=[];var e={};var d,b,a,n;for(d=0;d<h.length;d++){a=MochiKit[h[d]];l(g,a.EXPORT);l(f,a.EXPORT_OK);for(b in a.EXPORT_TAGS){e[b]=l(e[b],a.EXPORT_TAGS[b])}n=a.EXPORT_TAGS[":all"];if(!n){n=l(null,a.EXPORT,a.EXPORT_OK)}var c;for(c=0;c<n.length;c++){b=n[c];o[b]=a[b]}}o.EXPORT=g;o.EXPORT_OK=f;o.EXPORT_TAGS=e}())}else{if(typeof(MochiKit.__compat__)=="undefined"){MochiKit.__compat__=true}(function(){if(typeof(document)=="undefined"){return}var m=document.getElementsByTagName("script");var l="http://www.w3.org/1999/xhtml";var k="http://www.w3.org/2000/svg";var j="http://www.w3.org/1999/xlink";var h="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";var b=null;var f=null;var e={};var g;var a;for(g=0;g<m.length;g++){a=null;switch(m[g].namespaceURI){case k:a=m[g].getAttributeNS(j,"href");break;default:a=m[g].getAttribute("src");break}if(!a){continue}e[a]=true;if(a.match(/MochiKit.js(\?.*)?$/)){b=a.substring(0,a.lastIndexOf("MochiKit.js"));f=m[g]}}if(b===null){return}var d=MochiKit.MochiKit.SUBMODULES;for(var g=0;g<d.length;g++){if(MochiKit[d[g]]){continue}var c=b+d[g]+".js";if(c in e){continue}if(f.namespaceURI==k||f.namespaceURI==h){var n=document.createElementNS(f.namespaceURI,"script");n.setAttribute("id","MochiKit_"+b+d[g]);if(f.namespaceURI==k){n.setAttributeNS(j,"href",c)}else{n.setAttribute("src",c)}n.setAttribute("type","application/x-javascript");f.parentNode.appendChild(n)}else{document.write("<"+f.nodeName+' src="'+c+'" type="text/javascript"><\/script>')}}})()};