document.documentElement.className="js";
function mostrarOcultarSeguent(b){var a=obtenirSeguent(b);
mostrarOcultar(a)
}function obtenirSeguent(b){var a=b.nextSibling;
while(a.nodeType!=1){a=a.nextSibling
}return a
}function mostrarOcultar(a){if(a!=null){if(a.className.indexOf("ocultJs")>-1){a.className=a.className.replace("ocultJs","")
}else{a.className=a.className+" ocultJs"
}}}var Prototype={Version:"1.6.0.3",Browser:{IE:!!(window.attachEvent&&navigator.userAgent.indexOf("Opera")===-1),Opera:navigator.userAgent.indexOf("Opera")>-1,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")===-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div")["__proto__"]&&document.createElement("div")["__proto__"]!==document.createElement("form")["__proto__"]},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a
}};
if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false
}var Class={create:function(){var d=null,b=$A(arguments);
if(Object.isFunction(b[0])){d=b.shift()
}function e(){this.initialize.apply(this,arguments)
}Object.extend(e,Class.Methods);
e.superclass=d;
e.subclasses=[];
if(d){var f=function(){};
f.prototype=d.prototype;
e.prototype=new f;
d.subclasses.push(e)
}for(var a=0;
a<b.length;
a++){e.addMethods(b[a])
}if(!e.prototype.initialize){e.prototype.initialize=Prototype.emptyFunction
}e.prototype.constructor=e;
return e
}};
Class.Methods={addMethods:function(j){var e=this.superclass&&this.superclass.prototype;
var d=Object.keys(j);
if(!Object.keys({toString:true}).length){d.push("toString","valueOf")
}for(var b=0,f=d.length;
b<f;
b++){var h=d[b],g=j[h];
if(e&&Object.isFunction(g)&&g.argumentNames().first()=="$super"){var a=g;
g=(function(k){return function(){return e[k].apply(this,arguments)
}
})(h).wrap(a);
g.valueOf=a.valueOf.bind(a);
g.toString=a.toString.bind(a)
}this.prototype[h]=g
}return this
}};
var Abstract={};
Object.extend=function(b,a){for(var d in a){b[d]=a[d]
}return b
};
Object.extend(Object,{inspect:function(a){try{if(Object.isUndefined(a)){return"undefined"
}if(a===null){return"null"
}return a.inspect?a.inspect():String(a)
}catch(b){if(b instanceof RangeError){return"..."
}throw b
}},toJSON:function(e){var a=typeof e;
switch(a){case"undefined":case"function":case"unknown":return;
case"boolean":return e.toString()
}if(e===null){return"null"
}if(e.toJSON){return e.toJSON()
}if(Object.isElement(e)){return
}var f=[];
for(var d in e){var b=Object.toJSON(e[d]);
if(!Object.isUndefined(b)){f.push(d.toJSON()+": "+b)
}}return"{"+f.join(", ")+"}"
},toQueryString:function(a){return $H(a).toQueryString()
},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)
},keys:function(b){var d=[];
for(var a in b){d.push(a)
}return d
},values:function(d){var b=[];
for(var a in d){b.push(d[a])
}return b
},clone:function(a){return Object.extend({},a)
},isElement:function(a){return !!(a&&a.nodeType==1)
},isArray:function(a){return a!=null&&typeof a=="object"&&"splice" in a&&"join" in a
},isHash:function(a){return a instanceof Hash
},isFunction:function(a){return typeof a=="function"
},isString:function(a){return typeof a=="string"
},isNumber:function(a){return typeof a=="number"
},isUndefined:function(a){return typeof a=="undefined"
}});
Object.extend(Function.prototype,{argumentNames:function(){var a=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");
return a.length==1&&!a[0]?[]:a
},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this
}var b=this,a=$A(arguments),d=a.shift();
return function(){return b.apply(d,a.concat($A(arguments)))
}
},bindAsEventListener:function(){var b=this,a=$A(arguments),d=a.shift();
return function(e){return b.apply(d,[e||window.event].concat(a))
}
},curry:function(){if(!arguments.length){return this
}var a=this,b=$A(arguments);
return function(){return a.apply(this,b.concat($A(arguments)))
}
},delay:function(){var b=this,d=$A(arguments),a=d.shift()*1000;
return window.setTimeout(function(){return b.apply(b,d)
},a)
},defer:function(){var a=[0.01].concat($A(arguments));
return this.delay.apply(this,a)
},wrap:function(b){var a=this;
return function(){return b.apply(this,[a.bind(this)].concat($A(arguments)))
}
},methodize:function(){if(this._methodized){return this._methodized
}var a=this;
return this._methodized=function(){return a.apply(null,[this].concat($A(arguments)))
}
}});
Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'
};
var Try={these:function(){var a;
for(var g=0,b=arguments.length;
g<b;
g++){var f=arguments[g];
try{a=f();
break
}catch(d){}}return a
}};
RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")
};
var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;
this.frequency=a;
this.currentlyExecuting=false;
this.registerCallback()
},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)
},execute:function(){this.callback(this)
},stop:function(){if(!this.timer){return
}clearInterval(this.timer);
this.timer=null
},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;
this.execute()
}finally{this.currentlyExecuting=false
}}}});
Object.extend(String,{interpret:function(a){return a==null?"":String(a)
},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(d,a){var e="",b=this,f;
a=arguments.callee.prepareReplacement(a);
while(b.length>0){if(f=b.match(d)){e+=b.slice(0,f.index);
e+=String.interpret(a(f));
b=b.slice(f.index+f[0].length)
}else{e+=b,b=""
}}return e
},sub:function(a,b,d){b=this.gsub.prepareReplacement(b);
d=Object.isUndefined(d)?1:d;
return this.gsub(a,function(e){if(--d<0){return e[0]
}return b(e)
})
},scan:function(b,a){this.gsub(b,a);
return String(this)
},truncate:function(b,a){b=b||30;
a=Object.isUndefined(a)?"...":a;
return this.length>b?this.slice(0,b-a.length)+a:String(this)
},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")
},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")
},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")
},extractScripts:function(){var b=new RegExp(Prototype.ScriptFragment,"img");
var a=new RegExp(Prototype.ScriptFragment,"im");
return(this.match(b)||[]).map(function(d){return(d.match(a)||["",""])[1]
})
},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)
})
},escapeHTML:function(){var a=arguments.callee;
a.text.data=this;
return a.div.innerHTML
},unescapeHTML:function(){var a=new Element("div");
a.innerHTML=this.stripTags();
return a.childNodes[0]?(a.childNodes.length>1?$A(a.childNodes).inject("",function(b,d){return b+d.nodeValue
}):a.childNodes[0].nodeValue):""
},toQueryParams:function(b){var a=this.strip().match(/([^?#]*)(#.*)?$/);
if(!a){return{}
}return a[1].split(b||"&").inject({},function(d,e){if((e=e.split("="))[0]){var f=decodeURIComponent(e.shift());
var g=e.length>1?e.join("="):e[0];
if(g!=undefined){g=decodeURIComponent(g)
}if(f in d){if(!Object.isArray(d[f])){d[f]=[d[f]]
}d[f].push(g)
}else{d[f]=g
}}return d
})
},toArray:function(){return this.split("")
},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)
},times:function(a){return a<1?"":new Array(a+1).join(this)
},camelize:function(){var b=this.split("-"),d=b.length;
if(d==1){return b[0]
}var a=this.charAt(0)=="-"?b[0].charAt(0).toUpperCase()+b[0].substring(1):b[0];
for(var e=1;
e<d;
e++){a+=b[e].charAt(0).toUpperCase()+b[e].substring(1)
}return a
},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()
},underscore:function(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()
},dasherize:function(){return this.gsub(/_/,"-")
},inspect:function(b){var a=this.gsub(/[\x00-\x1f\\]/,function(d){var e=String.specialChar[d[0]];
return e?e:"\\u00"+d[0].charCodeAt().toPaddedString(2,16)
});
if(b){return'"'+a.replace(/"/g,'\\"')+'"'
}return"'"+a.replace(/'/g,"\\'")+"'"
},toJSON:function(){return this.inspect(true)
},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")
},isJSON:function(){var a=this;
if(a.blank()){return false
}a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");
return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(a)
},evalJSON:function(sanitize){var json=this.unfilterJSON();
try{if(!sanitize||json.isJSON()){return eval("("+json+")")
}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())
},include:function(a){return this.indexOf(a)>-1
},startsWith:function(a){return this.indexOf(a)===0
},endsWith:function(a){var b=this.length-a.length;
return b>=0&&this.lastIndexOf(a)===b
},empty:function(){return this==""
},blank:function(){return/^\s*$/.test(this)
},interpolate:function(a,b){return new Template(this,b).evaluate(a)
}});
if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")
},unescapeHTML:function(){return this.stripTags().replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")
}})
}String.prototype.gsub.prepareReplacement=function(b){if(Object.isFunction(b)){return b
}var a=new Template(b);
return function(d){return a.evaluate(d)
}
};
String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});
String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
var Template=Class.create({initialize:function(a,b){this.template=a.toString();
this.pattern=b||Template.Pattern
},evaluate:function(a){if(Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()
}return this.template.gsub(this.pattern,function(b){if(a==null){return""
}var f=b[1]||"";
if(f=="\\"){return b[2]
}var e=a,g=b[3];
var d=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
b=d.exec(g);
if(b==null){return f
}while(b!=null){var h=b[1].startsWith("[")?b[2].gsub("\\\\]","]"):b[1];
e=e[h];
if(null==e||""==b[3]){break
}g=g.substring("["==b[3]?b[1].length:b[0].length);
b=d.exec(g)
}return f+String.interpret(e)
})
}});
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={};
var Enumerable={each:function(a,f){var d=0;
try{this._each(function(e){a.call(f,e,d++)
})
}catch(b){if(b!=$break){throw b
}}return this
},eachSlice:function(a,g,f){var e=-a,b=[],d=this.toArray();
if(a<1){return d
}while((e+=a)<d.length){b.push(d.slice(e,e+a))
}return b.collect(g,f)
},all:function(a,d){a=a||Prototype.K;
var b=true;
this.each(function(f,e){b=b&&!!a.call(d,f,e);
if(!b){throw $break
}});
return b
},any:function(a,d){a=a||Prototype.K;
var b=false;
this.each(function(f,e){if(b=!!a.call(d,f,e)){throw $break
}});
return b
},collect:function(a,d){a=a||Prototype.K;
var b=[];
this.each(function(f,e){b.push(a.call(d,f,e))
});
return b
},detect:function(a,d){var b;
this.each(function(f,e){if(a.call(d,f,e)){b=f;
throw $break
}});
return b
},findAll:function(a,d){var b=[];
this.each(function(f,e){if(a.call(d,f,e)){b.push(f)
}});
return b
},grep:function(b,a,e){a=a||Prototype.K;
var d=[];
if(Object.isString(b)){b=new RegExp(b)
}this.each(function(g,f){if(b.match(g)){d.push(a.call(e,g,f))
}});
return d
},include:function(a){if(Object.isFunction(this.indexOf)){if(this.indexOf(a)!=-1){return true
}}var b=false;
this.each(function(d){if(d==a){b=true;
throw $break
}});
return b
},inGroupsOf:function(b,a){a=Object.isUndefined(a)?null:a;
return this.eachSlice(b,function(d){while(d.length<b){d.push(a)
}return d
})
},inject:function(b,a,d){this.each(function(f,e){b=a.call(d,b,f,e)
});
return b
},invoke:function(b){var a=$A(arguments).slice(1);
return this.map(function(d){return d[b].apply(d,a)
})
},max:function(a,d){a=a||Prototype.K;
var b;
this.each(function(f,e){f=a.call(d,f,e);
if(b==null||f>=b){b=f
}});
return b
},min:function(a,d){a=a||Prototype.K;
var b;
this.each(function(f,e){f=a.call(d,f,e);
if(b==null||f<b){b=f
}});
return b
},partition:function(b,e){b=b||Prototype.K;
var a=[],d=[];
this.each(function(g,f){(b.call(e,g,f)?a:d).push(g)
});
return[a,d]
},pluck:function(b){var a=[];
this.each(function(d){a.push(d[b])
});
return a
},reject:function(a,d){var b=[];
this.each(function(f,e){if(!a.call(d,f,e)){b.push(f)
}});
return b
},sortBy:function(b,a){return this.map(function(e,d){return{value:e,criteria:b.call(a,e,d)}
}).sort(function(e,d){var g=e.criteria,f=d.criteria;
return g<f?-1:g>f?1:0
}).pluck("value")
},toArray:function(){return this.map()
},zip:function(){var d=Prototype.K,b=$A(arguments);
if(Object.isFunction(b.last())){d=b.pop()
}var a=[this].concat(b).map($A);
return this.map(function(f,e){return d(a.pluck(e))
})
},size:function(){return this.toArray().length
},inspect:function(){return"#<Enumerable:"+this.toArray().inspect()+">"
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});
function $A(a){if(!a){return[]
}if(a.toArray){return a.toArray()
}var d=a.length||0,b=new Array(d);
while(d--){b[d]=a[d]
}return b
}if(Prototype.Browser.WebKit){$A=function(a){if(!a){return[]
}if(!(typeof a==="function"&&typeof a.length==="number"&&typeof a.item==="function")&&a.toArray){return a.toArray()
}var d=a.length||0,b=new Array(d);
while(d--){b[d]=a[d]
}return b
}
}Array.from=$A;
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse
}Object.extend(Array.prototype,{_each:function(d){for(var b=0,a=this.length;
b<a;
b++){d(this[b])
}},clear:function(){this.length=0;
return this
},first:function(){return this[0]
},last:function(){return this[this.length-1]
},compact:function(){return this.select(function(a){return a!=null
})
},flatten:function(){return this.inject([],function(b,a){return b.concat(Object.isArray(a)?a.flatten():[a])
})
},without:function(){var a=$A(arguments);
return this.select(function(b){return !a.include(b)
})
},reverse:function(a){return(a!==false?this:this.toArray())._reverse()
},reduce:function(){return this.length>1?this:this[0]
},uniq:function(a){return this.inject([],function(e,d,b){if(0==b||(a?e.last()!=d:!e.include(d))){e.push(d)
}return e
})
},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(d){return b===d
})
})
},clone:function(){return[].concat(this)
},size:function(){return this.length
},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"
},toJSON:function(){var a=[];
this.each(function(b){var d=Object.toJSON(b);
if(!Object.isUndefined(d)){a.push(d)
}});
return"["+a.join(", ")+"]"
}});
if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach
}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(a,b){b||(b=0);
var d=this.length;
if(b<0){b=d+b
}for(;
b<d;
b++){if(this[b]===a){return b
}}return -1
}
}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(d,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;
var a=this.slice(0,b).reverse().indexOf(d);
return(a<0)?a:b-a-1
}
}Array.prototype.toArray=Array.prototype.clone;
function $w(a){if(!Object.isString(a)){return[]
}a=a.strip();
return a?a.split(/\s+/):[]
}if(Prototype.Browser.Opera){Array.prototype.concat=function(){var d=[];
for(var f=0,a=this.length;
f<a;
f++){d.push(this[f])
}for(var f=0,a=arguments.length;
f<a;
f++){if(Object.isArray(arguments[f])){for(var e=0,b=arguments[f].length;
e<b;
e++){d.push(arguments[f][e])
}}else{d.push(arguments[f])
}}return d
}
}Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)
},succ:function(){return this+1
},times:function(b,a){$R(0,this,true).each(b,a);
return this
},toPaddedString:function(a,d){var b=this.toString(d||10);
return"0".times(a-b.length)+b
},toJSON:function(){return isFinite(this)?this.toString():"null"
}});
$w("abs round ceil floor").each(function(a){Number.prototype[a]=Math[a].methodize()
});
function $H(a){return new Hash(a)
}var Hash=Class.create(Enumerable,(function(){function a(b,d){if(Object.isUndefined(d)){return b
}return b+"="+encodeURIComponent(String.interpret(d))
}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)
},_each:function(d){for(var b in this._object){var e=this._object[b],f=[b,e];
f.key=b;
f.value=e;
d(f)
}},set:function(b,d){return this._object[b]=d
},get:function(b){if(this._object[b]!==Object.prototype[b]){return this._object[b]
}},unset:function(b){var d=this._object[b];
delete this._object[b];
return d
},toObject:function(){return Object.clone(this._object)
},keys:function(){return this.pluck("key")
},values:function(){return this.pluck("value")
},index:function(d){var b=this.detect(function(e){return e.value===d
});
return b&&b.key
},merge:function(b){return this.clone().update(b)
},update:function(b){return new Hash(b).inject(this,function(d,e){d.set(e.key,e.value);
return d
})
},toQueryString:function(){return this.inject([],function(e,f){var d=encodeURIComponent(f.key),b=f.value;
if(b&&typeof b=="object"){if(Object.isArray(b)){return e.concat(b.map(a.curry(d)))
}}else{e.push(a(d,b))
}return e
}).join("&")
},inspect:function(){return"#<Hash:{"+this.map(function(b){return b.map(Object.inspect).join(": ")
}).join(", ")+"}>"
},toJSON:function(){return Object.toJSON(this.toObject())
},clone:function(){return new Hash(this)
}}
})());
Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;
Hash.from=$H;
var ObjectRange=Class.create(Enumerable,{initialize:function(a,b,d){this.start=a;
this.end=b;
this.exclusive=d
},_each:function(a){var b=this.start;
while(this.include(b)){a(b);
b=b.succ()
}},include:function(a){if(a<this.start){return false
}if(this.exclusive){return a<this.end
}return a<=this.end
}});
var $R=function(a,b,d){return new ObjectRange(a,b,d)
};
var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()
},function(){return new ActiveXObject("Msxml2.XMLHTTP")
},function(){return new ActiveXObject("Microsoft.XMLHTTP")
})||false
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)
},register:function(a){if(!this.include(a)){this.responders.push(a)
}},unregister:function(a){this.responders=this.responders.without(a)
},dispatch:function(b,e,a,d){this.each(function(f){if(Object.isFunction(f[b])){try{f[b].apply(f,[e,a,d])
}catch(g){}}})
}};
Object.extend(Ajax.Responders,Enumerable);
Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++
},onComplete:function(){Ajax.activeRequestCount--
}});
Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};
Object.extend(this.options,a||{});
this.options.method=this.options.method.toLowerCase();
if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()
}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()
}}}});
Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);
this.transport=Ajax.getTransport();
this.request(b)
},request:function(f){this.url=f;
this.method=this.options.method;
var b=Object.clone(this.options.parameters);
if(!["get","post"].include(this.method)){b._method=this.method;
this.method="post"
}this.parameters=b;
if(b=Object.toQueryString(b)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+b
}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){b+="&_="
}}}try{var d=new Ajax.Response(this);
if(this.options.onCreate){this.options.onCreate(d)
}Ajax.Responders.dispatch("onCreate",this,d);
this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);
if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)
}this.transport.onreadystatechange=this.onStateChange.bind(this);
this.setRequestHeaders();
this.body=this.method=="post"?(this.options.postBody||b):null;
this.transport.send(this.body);
if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()
}}catch(a){this.dispatchException(a)
}},onStateChange:function(){var a=this.transport.readyState;
if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)
}},setRequestHeaders:function(){var d={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};
if(this.method=="post"){d["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){d.Connection="close"
}}if(typeof this.options.requestHeaders=="object"){var a=this.options.requestHeaders;
if(Object.isFunction(a.push)){for(var f=0,b=a.length;
f<b;
f+=2){d[a[f]]=a[f+1]
}}else{$H(a).each(function(g){d[g.key]=g.value
})
}}for(var e in d){this.transport.setRequestHeader(e,d[e])
}},success:function(){var a=this.getStatus();
return !a||(a>=200&&a<300)
},getStatus:function(){try{return this.transport.status||0
}catch(a){return 0
}},respondToReadyState:function(f){var a=Ajax.Request.Events[f],g=new Ajax.Response(this);
if(a=="Complete"){try{this._complete=true;
(this.options["on"+g.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(g,g.headerJSON)
}catch(b){this.dispatchException(b)
}var d=g.getHeader("Content-type");
if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&d&&d.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()
}}try{(this.options["on"+a]||Prototype.emptyFunction)(g,g.headerJSON);
Ajax.Responders.dispatch("on"+a,this,g,g.headerJSON)
}catch(b){this.dispatchException(b)
}if(a=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction
}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);
return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))
},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null
}catch(b){return null
}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())
}catch(e){this.dispatchException(e)
}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);
Ajax.Responders.dispatch("onException",this,a)
}});
Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Response=Class.create({initialize:function(a){this.request=a;
var b=this.transport=a.transport,d=this.readyState=b.readyState;
if((d>2&&!Prototype.Browser.IE)||d==4){this.status=this.getStatus();
this.statusText=this.getStatusText();
this.responseText=String.interpret(b.responseText);
this.headerJSON=this._getHeaderJSON()
}if(d==4){var e=b.responseXML;
this.responseXML=Object.isUndefined(e)?null:e;
this.responseJSON=this._getResponseJSON()
}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""
}catch(a){return""
}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()
}catch(a){return null
}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)
},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()
},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");
if(!a){return null
}a=decodeURIComponent(escape(a));
try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())
}catch(b){this.request.dispatchException(b)
}},_getResponseJSON:function(){var a=this.request.options;
if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null
}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())
}catch(b){this.request.dispatchException(b)
}}});
Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,d,a,e){this.container={success:(d.success||d),failure:(d.failure||(d.success?null:d))};
e=Object.clone(e);
var b=e.onComplete;
e.onComplete=(function(f,g){this.updateContent(f.responseText);
if(Object.isFunction(b)){b(f,g)
}}).bind(this);
$super(a,e)
},updateContent:function(b){var a=this.container[this.success()?"success":"failure"],d=this.options;
if(!d.evalScripts){b=b.stripScripts()
}if(a=$(a)){if(d.insertion){if(Object.isString(d.insertion)){var e={};
e[d.insertion]=b;
a.insert(e)
}else{d.insertion(a,b)
}}else{a.update(b)
}}}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,a,d){$super(d);
this.onComplete=this.options.onComplete;
this.frequency=(this.options.frequency||2);
this.decay=(this.options.decay||1);
this.updater={};
this.container=b;
this.url=a;
this.start()
},start:function(){this.options.onComplete=this.updateComplete.bind(this);
this.onTimerEvent()
},stop:function(){this.updater.options.onComplete=undefined;
clearTimeout(this.timer);
(this.onComplete||Prototype.emptyFunction).apply(this,arguments)
},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);
this.lastText=a.responseText
}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)
},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)
}});
function $(e){if(arguments.length>1){for(var d=0,b=[],a=arguments.length;
d<a;
d++){b.push($(arguments[d]))
}return b
}if(Object.isString(e)){e=document.getElementById(e)
}return Element.extend(e)
}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(d,e){var g=[];
var b=document.evaluate(d,$(e)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(var f=0,a=b.snapshotLength;
f<a;
f++){g.push(Element.extend(b.snapshotItem(f)))
}return g
}
}if(!window.Node){var Node={}
}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})
}(function(){var a=this.Element;
this.Element=function(e,d){d=d||{};
e=e.toLowerCase();
var b=Element.cache;
if(Prototype.Browser.IE&&d.name){e="<"+e+' name="'+d.name+'">';
delete d.name;
return Element.writeAttribute(document.createElement(e),d)
}if(!b[e]){b[e]=Element.extend(document.createElement(e))
}return Element.writeAttribute(b[e].cloneNode(false),d)
};
Object.extend(this.Element,a||{});
if(a){this.Element.prototype=a.prototype
}}).call(window);
Element.cache={};
Element.Methods={visible:function(a){return $(a).style.display!="none"
},toggle:function(a){a=$(a);
Element[Element.visible(a)?"hide":"show"](a);
return a
},hide:function(a){a=$(a);
a.style.display="none";
return a
},show:function(a){a=$(a);
a.style.display="";
return a
},remove:function(a){a=$(a);
a.parentNode.removeChild(a);
return a
},update:function(a,b){a=$(a);
if(b&&b.toElement){b=b.toElement()
}if(Object.isElement(b)){return a.update().insert(b)
}b=Object.toHTML(b);
a.innerHTML=b.stripScripts();
b.evalScripts.bind(b).defer();
return a
},replace:function(d,a){d=$(d);
if(a&&a.toElement){a=a.toElement()
}else{if(!Object.isElement(a)){a=Object.toHTML(a);
var b=d.ownerDocument.createRange();
b.selectNode(d);
a.evalScripts.bind(a).defer();
a=b.createContextualFragment(a.stripScripts())
}}d.parentNode.replaceChild(a,d);
return d
},insert:function(f,h){f=$(f);
if(Object.isString(h)||Object.isNumber(h)||Object.isElement(h)||(h&&(h.toElement||h.toHTML))){h={bottom:h}
}var g,a,e,b;
for(var d in h){g=h[d];
d=d.toLowerCase();
a=Element._insertionTranslations[d];
if(g&&g.toElement){g=g.toElement()
}if(Object.isElement(g)){a(f,g);
continue
}g=Object.toHTML(g);
e=((d=="before"||d=="after")?f.parentNode:f).tagName.toUpperCase();
b=Element._getContentFromAnonymousElement(e,g.stripScripts());
if(d=="top"||d=="after"){b.reverse()
}b.each(a.curry(f));
g.evalScripts.bind(g).defer()
}return f
},wrap:function(d,a,b){d=$(d);
if(Object.isElement(a)){$(a).writeAttribute(b||{})
}else{if(Object.isString(a)){a=new Element(a,b)
}else{a=new Element("div",a)
}}if(d.parentNode){d.parentNode.replaceChild(a,d)
}a.appendChild(d);
return a
},inspect:function(b){b=$(b);
var a="<"+b.tagName.toLowerCase();
$H({id:"id",className:"class"}).each(function(e){var d=e.first(),f=e.last();
var g=(b[d]||"").toString();
if(g){a+=" "+f+"="+g.inspect(true)
}});
return a+">"
},recursivelyCollect:function(b,a){b=$(b);
var d=[];
while(b=b[a]){if(b.nodeType==1){d.push(Element.extend(b))
}}return d
},ancestors:function(a){return $(a).recursivelyCollect("parentNode")
},descendants:function(a){return $(a).select("*")
},firstDescendant:function(a){a=$(a).firstChild;
while(a&&a.nodeType!=1){a=a.nextSibling
}return $(a)
},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]
}while(a&&a.nodeType!=1){a=a.nextSibling
}if(a){return[a].concat($(a).nextSiblings())
}return[]
},previousSiblings:function(a){return $(a).recursivelyCollect("previousSibling")
},nextSiblings:function(a){return $(a).recursivelyCollect("nextSibling")
},siblings:function(a){a=$(a);
return a.previousSiblings().reverse().concat(a.nextSiblings())
},match:function(b,a){if(Object.isString(a)){a=new Selector(a)
}return a.match($(b))
},up:function(e,b,d){e=$(e);
if(arguments.length==1){return $(e.parentNode)
}var a=e.ancestors();
return Object.isNumber(b)?a[b]:Selector.findElement(a,b,d)
},down:function(d,a,b){d=$(d);
if(arguments.length==1){return d.firstDescendant()
}return Object.isNumber(a)?d.descendants()[a]:Element.select(d,a)[b||0]
},previous:function(e,b,d){e=$(e);
if(arguments.length==1){return $(Selector.handlers.previousElementSibling(e))
}var a=e.previousSiblings();
return Object.isNumber(b)?a[b]:Selector.findElement(a,b,d)
},next:function(a,b,e){a=$(a);
if(arguments.length==1){return $(Selector.handlers.nextElementSibling(a))
}var d=a.nextSiblings();
return Object.isNumber(b)?d[b]:Selector.findElement(d,b,e)
},select:function(){var a=$A(arguments),b=$(a.shift());
return Selector.findChildElements(b,a)
},adjacent:function(){var a=$A(arguments),b=$(a.shift());
return Selector.findChildElements(b.parentNode,a).without(b)
},identify:function(d){d=$(d);
var a=d.readAttribute("id"),b=arguments.callee;
if(a){return a
}do{a="anonymous_element_"+b.counter++
}while($(a));
d.writeAttribute("id",a);
return a
},readAttribute:function(a,b){a=$(a);
if(Prototype.Browser.IE){var d=Element._attributeTranslations.read;
if(d.values[b]){return d.values[b](a,b)
}if(d.names[b]){b=d.names[b]
}if(b.include(":")){return(!a.attributes||!a.attributes[b])?null:a.attributes[b].value
}}return a.getAttribute(b)
},writeAttribute:function(b,g,d){b=$(b);
var f={},a=Element._attributeTranslations.write;
if(typeof g=="object"){f=g
}else{f[g]=Object.isUndefined(d)?true:d
}for(var e in f){g=a.names[e]||e;
d=f[e];
if(a.values[e]){g=a.values[e](b,d)
}if(d===false||d===null){b.removeAttribute(g)
}else{if(d===true){b.setAttribute(g,g)
}else{b.setAttribute(g,d)
}}}return b
},getHeight:function(a){return $(a).getDimensions().height
},getWidth:function(a){return $(a).getDimensions().width
},classNames:function(a){return new Element.ClassNames(a)
},hasClassName:function(b,d){if(!(b=$(b))){return
}var a=b.className;
return(a.length>0&&(a==d||new RegExp("(^|\\s)"+d+"(\\s|$)").test(a)))
},addClassName:function(a,b){if(!(a=$(a))){return
}if(!a.hasClassName(b)){a.className+=(a.className?" ":"")+b
}return a
},removeClassName:function(a,b){if(!(a=$(a))){return
}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();
return a
},toggleClassName:function(a,b){if(!(a=$(a))){return
}return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)
},cleanWhitespace:function(d){d=$(d);
var a=d.firstChild;
while(a){var b=a.nextSibling;
if(a.nodeType==3&&!/\S/.test(a.nodeValue)){d.removeChild(a)
}a=b
}return d
},empty:function(a){return $(a).innerHTML.blank()
},descendantOf:function(b,a){b=$(b),a=$(a);
if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8
}if(a.contains){return a.contains(b)&&a!==b
}while(b=b.parentNode){if(b==a){return true
}}return false
},scrollTo:function(a){a=$(a);
var b=a.cumulativeOffset();
window.scrollTo(b[0],b[1]);
return a
},getStyle:function(e,a){e=$(e);
a=a=="float"?"cssFloat":a.camelize();
var b=e.style[a];
if(!b||b=="auto"){var d=document.defaultView.getComputedStyle(e,null);
b=d?d[a]:null
}if(a=="opacity"){return b?parseFloat(b):1
}return b=="auto"?null:b
},getOpacity:function(a){return $(a).getStyle("opacity")
},setStyle:function(f,a){f=$(f);
var d=f.style,e;
if(Object.isString(a)){f.style.cssText+=";"+a;
return a.include("opacity")?f.setOpacity(a.match(/opacity:\s*(\d?\.?\d*)/)[1]):f
}for(var b in a){if(b=="opacity"){f.setOpacity(a[b])
}else{d[(b=="float"||b=="cssFloat")?(Object.isUndefined(d.styleFloat)?"cssFloat":"styleFloat"):b]=a[b]
}}return f
},setOpacity:function(a,b){a=$(a);
a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;
return a
},getDimensions:function(e){e=$(e);
var j=e.getStyle("display");
if(j!="none"&&j!=null){return{width:e.offsetWidth,height:e.offsetHeight}
}var d=e.style;
var h=d.visibility;
var f=d.position;
var b=d.display;
d.visibility="hidden";
d.position="absolute";
d.display="block";
var a=e.clientWidth;
var g=e.clientHeight;
d.display=b;
d.position=f;
d.visibility=h;
return{width:a,height:g}
},makePositioned:function(a){a=$(a);
var b=Element.getStyle(a,"position");
if(b=="static"||!b){a._madePositioned=true;
a.style.position="relative";
if(Prototype.Browser.Opera){a.style.top=0;
a.style.left=0
}}return a
},undoPositioned:function(a){a=$(a);
if(a._madePositioned){a._madePositioned=undefined;
a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""
}return a
},makeClipping:function(a){a=$(a);
if(a._overflow){return a
}a._overflow=Element.getStyle(a,"overflow")||"auto";
if(a._overflow!=="hidden"){a.style.overflow="hidden"
}return a
},undoClipping:function(a){a=$(a);
if(!a._overflow){return a
}a.style.overflow=a._overflow=="auto"?"":a._overflow;
a._overflow=null;
return a
},cumulativeOffset:function(d){var b=0,a=0;
do{b+=d.offsetTop||0;
a+=d.offsetLeft||0;
d=d.offsetParent
}while(d);
return Element._returnOffset(a,b)
},positionedOffset:function(e){var d=0,b=0;
do{d+=e.offsetTop||0;
b+=e.offsetLeft||0;
e=e.offsetParent;
if(e){if(e.tagName.toUpperCase()=="BODY"){break
}var a=Element.getStyle(e,"position");
if(a!=="static"){break
}}}while(e);
return Element._returnOffset(b,d)
},absolutize:function(f){f=$(f);
if(f.getStyle("position")=="absolute"){return f
}var a=f.positionedOffset();
var d=a[1];
var b=a[0];
var g=f.clientWidth;
var e=f.clientHeight;
f._originalLeft=b-parseFloat(f.style.left||0);
f._originalTop=d-parseFloat(f.style.top||0);
f._originalWidth=f.style.width;
f._originalHeight=f.style.height;
f.style.position="absolute";
f.style.top=d+"px";
f.style.left=b+"px";
f.style.width=g+"px";
f.style.height=e+"px";
return f
},relativize:function(b){b=$(b);
if(b.getStyle("position")=="relative"){return b
}b.style.position="relative";
var a=parseFloat(b.style.top||0)-(b._originalTop||0);
var d=parseFloat(b.style.left||0)-(b._originalLeft||0);
b.style.top=a+"px";
b.style.left=d+"px";
b.style.height=b._originalHeight;
b.style.width=b._originalWidth;
return b
},cumulativeScrollOffset:function(d){var b=0,a=0;
do{b+=d.scrollTop||0;
a+=d.scrollLeft||0;
d=d.parentNode
}while(d);
return Element._returnOffset(a,b)
},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)
}if(a==document.body){return $(a)
}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)
}}return $(document.body)
},viewportOffset:function(b){var d=0,a=0;
var e=b;
do{d+=e.offsetTop||0;
a+=e.offsetLeft||0;
if(e.offsetParent==document.body&&Element.getStyle(e,"position")=="absolute"){break
}}while(e=e.offsetParent);
e=b;
do{if(!Prototype.Browser.Opera||(e.tagName&&(e.tagName.toUpperCase()=="BODY"))){d-=e.scrollTop||0;
a-=e.scrollLeft||0
}}while(e=e.parentNode);
return Element._returnOffset(a,d)
},clonePosition:function(f,a){var e=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
a=$(a);
var b=a.viewportOffset();
f=$(f);
var d=[0,0];
var g=null;
if(Element.getStyle(f,"position")=="absolute"){g=f.getOffsetParent();
d=g.viewportOffset()
}if(g==document.body){d[0]-=document.body.offsetLeft;
d[1]-=document.body.offsetTop
}if(e.setLeft){f.style.left=(b[0]-d[0]+e.offsetLeft)+"px"
}if(e.setTop){f.style.top=(b[1]-d[1]+e.offsetTop)+"px"
}if(e.setWidth){f.style.width=a.offsetWidth+"px"
}if(e.setHeight){f.style.height=a.offsetHeight+"px"
}return f
}};
Element.Methods.identify.counter=1;
Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});
Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};
if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(b,f,a){switch(a){case"left":case"top":case"right":case"bottom":if(b(f,"position")==="static"){return null
}case"height":case"width":if(!Element.visible(f)){return null
}var d=parseInt(b(f,a),10);
if(d!==f["offset"+a.capitalize()]){return d+"px"
}var e;
if(a==="height"){e=["border-top-width","padding-top","padding-bottom","border-bottom-width"]
}else{e=["border-left-width","padding-left","padding-right","border-right-width"]
}return e.inject(d,function(j,g){var h=b(f,g);
return h===null?j:j-parseInt(h,10)
})+"px";
default:return b(f,a)
}});
Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,d){if(d==="title"){return b.title
}return a(b,d)
})
}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,g){g=$(g);
try{g.offsetParent
}catch(d){return $(document.body)
}var f=g.getStyle("position");
if(f!=="static"){return a(g)
}g.setStyle({position:"relative"});
var b=a(g);
g.setStyle({position:f});
return b
});
$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(f,j){j=$(j);
try{j.offsetParent
}catch(h){return Element._returnOffset(0,0)
}var d=j.getStyle("position");
if(d!=="static"){return f(j)
}var b=j.getOffsetParent();
if(b&&b.getStyle("position")==="fixed"){b.setStyle({zoom:1})
}j.setStyle({position:"relative"});
var g=f(j);
j.setStyle({position:d});
return g
})
});
Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(d,b){try{b.offsetParent
}catch(a){return Element._returnOffset(0,0)
}return d(b)
});
Element.Methods.getStyle=function(b,d){b=$(b);
d=(d=="float"||d=="cssFloat")?"styleFloat":d.camelize();
var a=b.style[d];
if(!a&&b.currentStyle){a=b.currentStyle[d]
}if(d=="opacity"){if(a=(b.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(a[1]){return parseFloat(a[1])/100
}}return 1
}if(a=="auto"){if((d=="width"||d=="height")&&(b.getStyle("display")!="none")){return b["offset"+d.capitalize()]+"px"
}return null
}return a
};
Element.Methods.setOpacity=function(f,b){function d(h){return h.replace(/alpha\([^\)]*\)/gi,"")
}f=$(f);
var e=f.currentStyle;
if((e&&!e.hasLayout)||(!e&&f.style.zoom=="normal")){f.style.zoom=1
}var a=f.getStyle("filter"),g=f.style;
if(b==1||b===""){(a=d(a))?g.filter=a:g.removeAttribute("filter");
return f
}else{if(b<0.00001){b=0
}}g.filter=d(a)+"alpha(opacity="+(b*100)+")";
return f
};
Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)
},_getAttrNode:function(b,a){var d=b.getAttributeNode(a);
return d?d.value:""
},_getEv:function(a,b){b=a.getAttribute(b);
return b?b.toString().slice(23,-2):null
},_flag:function(a,b){return $(a).hasAttribute(b)?b:null
},style:function(a){return a.style.cssText.toLowerCase()
},title:function(a){return a.title
}}}};
Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b
},style:function(a,b){a.style.cssText=b?b:""
}}};
Element._attributeTranslations.has={};
$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;
Element._attributeTranslations.has[a.toLowerCase()]=a
});
(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})
})(Element._attributeTranslations.read.values)
}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);
a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;
return a
}
}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(d,f){d=$(d);
d.style.opacity=(f==1||f==="")?"":(f<0.00001)?0:f;
if(f==1){if(d.tagName.toUpperCase()=="IMG"&&d.width){d.width++;
d.width--
}else{try{var b=document.createTextNode(" ");
d.appendChild(b);
d.removeChild(b)
}catch(a){}}}return d
};
Element.Methods.cumulativeOffset=function(d){var b=0,a=0;
do{b+=d.offsetTop||0;
a+=d.offsetLeft||0;
if(d.offsetParent==document.body){if(Element.getStyle(d,"position")=="absolute"){break
}}d=d.offsetParent
}while(d);
return Element._returnOffset(a,b)
}
}}}}if(Prototype.Browser.IE||Prototype.Browser.Opera){Element.Methods.update=function(d,a){d=$(d);
if(a&&a.toElement){a=a.toElement()
}if(Object.isElement(a)){return d.update().insert(a)
}a=Object.toHTML(a);
var b=d.tagName.toUpperCase();
if(b in Element._insertionTranslations.tags){$A(d.childNodes).each(function(e){d.removeChild(e)
});
Element._getContentFromAnonymousElement(b,a.stripScripts()).each(function(e){d.appendChild(e)
})
}else{d.innerHTML=a.stripScripts()
}a.evalScripts.bind(a).defer();
return d
}
}if("outerHTML" in document.createElement("div")){Element.Methods.replace=function(g,b){g=$(g);
if(b&&b.toElement){b=b.toElement()
}if(Object.isElement(b)){g.parentNode.replaceChild(b,g);
return g
}b=Object.toHTML(b);
var a=g.parentNode,f=a.tagName.toUpperCase();
if(Element._insertionTranslations.tags[f]){var d=g.next();
var e=Element._getContentFromAnonymousElement(f,b.stripScripts());
a.removeChild(g);
if(d){e.each(function(h){a.insertBefore(h,d)
})
}else{e.each(function(h){a.appendChild(h)
})
}}else{g.outerHTML=b.stripScripts()
}b.evalScripts.bind(b).defer();
return g
}
}Element._returnOffset=function(d,a){var b=[d,a];
b.left=d;
b.top=a;
return b
};
Element._getContentFromAnonymousElement=function(a,e){var b=new Element("div"),d=Element._insertionTranslations.tags[a];
if(d){b.innerHTML=d[0]+e+d[1];
d[2].times(function(){b=b.firstChild
})
}else{b.innerHTML=e
}return $A(b.childNodes)
};
Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)
},top:function(a,b){a.insertBefore(b,a.firstChild)
},bottom:function(a,b){a.appendChild(b)
},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)
},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};
(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})
}).call(Element._insertionTranslations);
Element.Methods.Simulated={hasAttribute:function(b,a){a=Element._attributeTranslations.has[a]||a;
var d=$(b).getAttributeNode(a);
return !!(d&&d.specified)
}};
Element.Methods.ByTag={};
Object.extend(Element,Element.Methods);
if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div")["__proto__"]){window.HTMLElement={};
window.HTMLElement.prototype=document.createElement("div")["__proto__"];
Prototype.BrowserFeatures.ElementExtensions=true
}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K
}var b={},d=Element.Methods.ByTag;
var a=Object.extend(function(j){if(!j||j._extendedByPrototype||j.nodeType!=1||j==window){return j
}var g=Object.clone(b),h=j.tagName.toUpperCase(),f,e;
if(d[h]){Object.extend(g,d[h])
}for(f in g){e=g[f];
if(Object.isFunction(e)&&!(f in j)){j[f]=e.methodize()
}}j._extendedByPrototype=Prototype.emptyFunction;
return j
},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(b,Element.Methods);
Object.extend(b,Element.Methods.Simulated)
}}});
a.refresh();
return a
})();
Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)
}return Element.Methods.Simulated.hasAttribute(a,b)
};
Element.addMethods=function(a){var g=Prototype.BrowserFeatures,b=Element.Methods.ByTag;
if(!a){Object.extend(Form,Form.Methods);
Object.extend(Form.Element,Form.Element.Methods);
Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})
}if(arguments.length==2){var k=a;
a=arguments[1]
}if(!k){Object.extend(Element.Methods,a||{})
}else{if(Object.isArray(k)){k.each(f)
}else{f(k)
}}function f(l){l=l.toUpperCase();
if(!Element.Methods.ByTag[l]){Element.Methods.ByTag[l]={}
}Object.extend(Element.Methods.ByTag[l],a)
}function j(n,m,l){l=l||false;
for(var p in n){var o=n[p];
if(!Object.isFunction(o)){continue
}if(!l||!(p in m)){m[p]=o.methodize()
}}}function d(n){var l;
var m={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};
if(m[n]){l="HTML"+m[n]+"Element"
}if(window[l]){return window[l]
}l="HTML"+n+"Element";
if(window[l]){return window[l]
}l="HTML"+n.capitalize()+"Element";
if(window[l]){return window[l]
}window[l]={};
window[l].prototype=document.createElement(n)["__proto__"];
return window[l]
}if(g.ElementExtensions){j(Element.Methods,HTMLElement.prototype);
j(Element.Methods.Simulated,HTMLElement.prototype,true)
}if(g.SpecificElementExtensions){for(var h in Element.Methods.ByTag){var e=d(h);
if(Object.isUndefined(e)){continue
}j(b[h],e.prototype)
}}Object.extend(Element,Element.Methods);
delete Element.ByTag;
if(Element.extend.refresh){Element.extend.refresh()
}Element.cache={}
};
document.viewport={getDimensions:function(){var a={},b=Prototype.Browser;
$w("width height").each(function(e){var d=e.capitalize();
if(b.WebKit&&!document.evaluate){a[e]=self["inner"+d]
}else{if(b.Opera&&parseFloat(window.opera.version())<9.5){a[e]=document.body["client"+d]
}else{a[e]=document.documentElement["client"+d]
}}});
return a
},getWidth:function(){return this.getDimensions().width
},getHeight:function(){return this.getDimensions().height
},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)
}};
var Selector=Class.create({initialize:function(a){this.expression=a.strip();
if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"
}else{if(this.shouldUseXPath()){this.mode="xpath";
this.compileXPathMatcher()
}else{this.mode="normal";
this.compileMatcher()
}}},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false
}var a=this.expression;
if(Prototype.Browser.WebKit&&(a.include("-of-type")||a.include(":empty"))){return false
}if((/(\[[\w-]*?:|:checked)/).test(a)){return false
}return true
},shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false
}if(!Selector._div){Selector._div=new Element("div")
}try{Selector._div.querySelector(this.expression)
}catch(a){return false
}return true
},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;
if(Selector._cache[e]){this.matcher=Selector._cache[e];
return
}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];
while(e&&le!=e&&(/\S/).test(e)){le=e;
for(var i in ps){p=ps[i];
if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));
e=e.replace(m[0],"");
break
}}}this.matcher.push("return h.unique(n);\n}");
eval(this.matcher.join("\n"));
Selector._cache[this.expression]=this.matcher
},compileXPathMatcher:function(){var b=this.expression,d=Selector.patterns,g=Selector.xpath,a,f;
if(Selector._cache[b]){this.xpath=Selector._cache[b];
return
}this.matcher=[".//*"];
while(b&&a!=b&&(/\S/).test(b)){a=b;
for(var h in d){if(f=b.match(d[h])){this.matcher.push(Object.isFunction(g[h])?g[h](f):new Template(g[h]).evaluate(f));
b=b.replace(f[0],"");
break
}}}this.xpath=this.matcher.join("");
Selector._cache[this.expression]=this.xpath
},findElements:function(f){f=f||document;
var a=this.expression,g;
switch(this.mode){case"selectorsAPI":if(f!==document){var b=f.id,d=$(f).identify();
a="#"+d+" "+a
}g=$A(f.querySelectorAll(a)).map(Element.extend);
f.id=b;
return g;
case"xpath":return document._getElementsByXPath(this.xpath,f);
default:return this.matcher(f)
}},match:function(q){this.tokens=[];
var g=this.expression,d=Selector.patterns,l=Selector.assertions;
var h,k,n;
while(g&&h!==g&&(/\S/).test(g)){h=g;
for(var a in d){k=d[a];
if(n=g.match(k)){if(l[a]){this.tokens.push([a,Object.clone(n)]);
g=g.replace(n[0],"")
}else{return this.findElements(document).include(q)
}}}}var f=true,j,b;
for(var a=0,o;
o=this.tokens[a];
a++){j=o[0],b=o[1];
if(!Selector.assertions[j](q,b)){f=false;
break
}}return f
},toString:function(){return this.expression
},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"
}});
Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""
}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"
},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();
return new Template("[@#{1}]").evaluate(a)
},attr:function(a){a[1]=a[1].toLowerCase();
a[3]=a[5]||a[6];
return new Template(Selector.xpath.operators[a[2]]).evaluate(a)
},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];
if(!b){return""
}if(Object.isFunction(b)){return b(a)
}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)
},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(h){var a=h[6],k=Selector.patterns,b=Selector.xpath,g,d;
var j=[];
while(a&&g!=a&&(/\S/).test(a)){g=a;
for(var f in k){if(h=a.match(k[f])){d=Object.isFunction(b[f])?b[f](h):new Template(b[f]).evaluate(h);
j.push("("+d.substring(1,d.length-1)+")");
a=a.replace(h[0],"");
break
}}}return"[not("+j.join(" and ")+")]"
},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)
},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)
},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)
},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)
},"first-of-type":function(a){a[6]="1";
return Selector.xpath.pseudos["nth-of-type"](a)
},"last-of-type":function(a){a[6]="1";
return Selector.xpath.pseudos["nth-last-of-type"](a)
},"only-of-type":function(a){var b=Selector.xpath.pseudos;
return b["first-of-type"](a)+b["last-of-type"](a)
},nth:function(g,k){var e,f=k[6],j;
if(f=="even"){f="2n+0"
}if(f=="odd"){f="2n+1"
}if(e=f.match(/^(\d+)$/)){return"["+g+"= "+e[1]+"]"
}if(e=f.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(e[1]=="-"){e[1]=-1
}var d=e[1]?Number(e[1]):1;
var h=e[2]?Number(e[2]):0;
j="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";
return new Template(j).evaluate({fragment:g,a:d,b:h})
}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)
},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')
}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)
},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[((?:[\w]+:)?[\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()
},className:function(a,b){return Element.hasClassName(a,b[1])
},id:function(a,b){return a.id===b[1]
},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])
},attr:function(d,a){var b=Element.readAttribute(d,a[1]);
return b&&Selector.operators[a[2]](b,a[5]||a[6])
}},handlers:{concat:function(g,f){for(var d=0,e;
e=f[d];
d++){g.push(e)
}return g
},mark:function(d){var b=Prototype.emptyFunction;
for(var e=0,a;
a=d[e];
e++){a._countedByPrototype=b
}return d
},unmark:function(b){for(var d=0,a;
a=b[d];
d++){a._countedByPrototype=undefined
}return b
},index:function(d,g,b){d._countedByPrototype=Prototype.emptyFunction;
if(g){for(var e=d.childNodes,h=e.length-1,f=1;
h>=0;
h--){var a=e[h];
if(a.nodeType==1&&(!b||a._countedByPrototype)){a.nodeIndex=f++
}}}else{for(var h=0,f=1,e=d.childNodes;
a=e[h];
h++){if(a.nodeType==1&&(!b||a._countedByPrototype)){a.nodeIndex=f++
}}}},unique:function(f){if(f.length==0){return f
}var b=[],d;
for(var a=0,e=f.length;
a<e;
a++){if(!(d=f[a])._countedByPrototype){d._countedByPrototype=Prototype.emptyFunction;
b.push(Element.extend(d))
}}return Selector.handlers.unmark(b)
},descendant:function(e){var b=Selector.handlers;
for(var a=0,f=[],d;
d=e[a];
a++){b.concat(f,d.getElementsByTagName("*"))
}return f
},child:function(d){var k=Selector.handlers;
for(var g=0,f=[],a;
a=d[g];
g++){for(var e=0,b;
b=a.childNodes[e];
e++){if(b.nodeType==1&&b.tagName!="!"){f.push(b)
}}}return f
},adjacent:function(e){for(var a=0,f=[],d;
d=e[a];
a++){var b=this.nextElementSibling(d);
if(b){f.push(b)
}}return f
},laterSibling:function(e){var b=Selector.handlers;
for(var a=0,f=[],d;
d=e[a];
a++){b.concat(f,Element.nextSiblings(d))
}return f
},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a
}}return null
},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a
}}return null
},tagName:function(k,g,a,l){var j=a.toUpperCase();
var d=[],f=Selector.handlers;
if(k){if(l){if(l=="descendant"){for(var e=0,b;
b=k[e];
e++){f.concat(d,b.getElementsByTagName(a))
}return d
}else{k=this[l](k)
}if(a=="*"){return k
}}for(var e=0,b;
b=k[e];
e++){if(b.tagName.toUpperCase()===j){d.push(b)
}}return d
}else{return g.getElementsByTagName(a)
}},id:function(d,b,a,j){var k=$(a),f=Selector.handlers;
if(!k){return[]
}if(!d&&b==document){return[k]
}if(d){if(j){if(j=="child"){for(var e=0,g;
g=d[e];
e++){if(k.parentNode==g){return[k]
}}}else{if(j=="descendant"){for(var e=0,g;
g=d[e];
e++){if(Element.descendantOf(k,g)){return[k]
}}}else{if(j=="adjacent"){for(var e=0,g;
g=d[e];
e++){if(Selector.handlers.previousElementSibling(k)==g){return[k]
}}}else{d=f[j](d)
}}}}for(var e=0,g;
g=d[e];
e++){if(g==k){return[k]
}}return[]
}return(k&&Element.descendantOf(k,b))?[k]:[]
},className:function(e,d,a,b){if(e&&b){e=this[b](e)
}return Selector.handlers.byClassName(e,d,a)
},byClassName:function(e,d,h){if(!e){e=Selector.handlers.descendant([d])
}var a=" "+h+" ";
for(var g=0,f=[],j,b;
j=e[g];
g++){b=j.className;
if(b.length==0){continue
}if(b==h||(" "+b+" ").include(a)){f.push(j)
}}return f
},attrPresence:function(f,e,d,b){if(!f){f=e.getElementsByTagName("*")
}if(f&&b){f=this[b](f)
}var h=[];
for(var g=0,a;
a=f[g];
g++){if(Element.hasAttribute(a,d)){h.push(a)
}}return h
},attr:function(g,d,b,e,j,h){if(!g){g=d.getElementsByTagName("*")
}if(g&&h){g=this[h](g)
}var f=Selector.operators[j],m=[];
for(var l=0,k;
k=g[l];
l++){var a=Element.readAttribute(k,b);
if(a===null){continue
}if(f(a,e)){m.push(k)
}}return m
},pseudo:function(f,a,d,e,b){if(f&&b){f=this[b](f)
}if(!f){f=e.getElementsByTagName("*")
}return Selector.pseudos[a](f,d,e)
}},pseudos:{"first-child":function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(Selector.handlers.previousElementSibling(b)){continue
}g.push(b)
}return g
},"last-child":function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(Selector.handlers.nextElementSibling(b)){continue
}g.push(b)
}return g
},"only-child":function(e,b,d){var j=Selector.handlers;
for(var g=0,f=[],a;
a=e[g];
g++){if(!j.previousElementSibling(a)&&!j.nextElementSibling(a)){f.push(a)
}}return f
},"nth-child":function(d,a,b){return Selector.pseudos.nth(d,a,b)
},"nth-last-child":function(d,a,b){return Selector.pseudos.nth(d,a,b,true)
},"nth-of-type":function(d,a,b){return Selector.pseudos.nth(d,a,b,false,true)
},"nth-last-of-type":function(d,a,b){return Selector.pseudos.nth(d,a,b,true,true)
},"first-of-type":function(d,a,b){return Selector.pseudos.nth(d,"1",b,false,true)
},"last-of-type":function(d,a,b){return Selector.pseudos.nth(d,"1",b,true,true)
},"only-of-type":function(e,b,d){var a=Selector.pseudos;
return a["last-of-type"](a["first-of-type"](e,b,d),b,d)
},getIndices:function(d,f,e){if(d==0){return f>0?[f]:[]
}return $R(1,e).inject([],function(a,b){if(0==(b-f)%d&&(b-f)/d>=0){a.push(b)
}return a
})
},nth:function(e,u,x,t,g){if(e.length==0){return[]
}if(u=="even"){u="2n+0"
}if(u=="odd"){u="2n+1"
}var s=Selector.handlers,r=[],f=[],k;
s.mark(e);
for(var p=0,q;
q=e[p];
p++){if(!q.parentNode._countedByPrototype){s.index(q.parentNode,t,g);
f.push(q.parentNode)
}}if(u.match(/^\d+$/)){u=Number(u);
for(var p=0,q;
q=e[p];
p++){if(q.nodeIndex==u){r.push(q)
}}}else{if(k=u.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(k[1]=="-"){k[1]=-1
}var y=k[1]?Number(k[1]):1;
var w=k[2]?Number(k[2]):0;
var d=Selector.pseudos.getIndices(y,w,e.length);
for(var p=0,q,n=d.length;
q=e[p];
p++){for(var o=0;
o<n;
o++){if(q.nodeIndex==d[o]){r.push(q)
}}}}}s.unmark(e);
s.unmark(f);
return r
},empty:function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(b.tagName=="!"||b.firstChild){continue
}g.push(b)
}return g
},not:function(j,n,f){var d=Selector.handlers,g,l;
var e=new Selector(n).findElements(f);
d.mark(e);
for(var b=0,a=[],k;
k=j[b];
b++){if(!k._countedByPrototype){a.push(k)
}}d.unmark(e);
return a
},enabled:function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(!b.disabled&&(!b.type||b.type!=="hidden")){g.push(b)
}}return g
},disabled:function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(b.disabled){g.push(b)
}}return g
},checked:function(f,d,e){for(var a=0,g=[],b;
b=f[a];
a++){if(b.checked){g.push(b)
}}return g
}},operators:{"=":function(b,a){return b==a
},"!=":function(b,a){return b!=a
},"^=":function(b,a){return b==a||b&&b.startsWith(a)
},"$=":function(b,a){return b==a||b&&b.endsWith(a)
},"*=":function(b,a){return b==a||b&&b.include(a)
},"$=":function(b,a){return b.endsWith(a)
},"*=":function(b,a){return b.include(a)
},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")
},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")
}},split:function(b){var a=[];
b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(d){a.push(d[1].strip())
});
return a
},matchElements:function(a,b){var j=$$(b),g=Selector.handlers;
g.mark(j);
for(var f=0,e=[],d;
d=a[f];
f++){if(d._countedByPrototype){e.push(d)
}}g.unmark(j);
return e
},findElement:function(d,a,b){if(Object.isNumber(a)){b=a;
a=false
}return Selector.matchElements(d,a||"*")[b||0]
},findChildElements:function(j,b){b=Selector.split(b.join(","));
var g=[],a=Selector.handlers;
for(var f=0,e=b.length,d;
f<e;
f++){d=new Selector(b[f].strip());
a.concat(g,d.findElements(j))
}return(e>1)?a.unique(g):g
}});
if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(g,f){for(var d=0,e;
e=f[d];
d++){if(e.tagName!=="!"){g.push(e)
}}return g
},unmark:function(b){for(var d=0,a;
a=b[d];
d++){a.removeAttribute("_countedByPrototype")
}return b
}})
}function $$(){return Selector.findChildElements(document,$A(arguments))
}var Form={reset:function(a){$(a).reset();
return a
},serializeElements:function(b,e){if(typeof e!="object"){e={hash:!!e}
}else{if(Object.isUndefined(e.hash)){e.hash=true
}}var f,a,d=false,h=e.submit;
var g=b.inject({},function(j,k){if(!k.disabled&&k.name){f=k.name;
a=$(k).getValue();
if(a!=null&&k.type!="file"&&(k.type!="submit"||(!d&&h!==false&&(!h||f==h)&&(d=true)))){if(f in j){if(!Object.isArray(j[f])){j[f]=[j[f]]
}j[f].push(a)
}else{j[f]=a
}}}return j
});
return e.hash?g:Object.toQueryString(g)
}};
Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)
},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,d){if(Form.Element.Serializers[d.tagName.toLowerCase()]){b.push(Element.extend(d))
}return b
})
},getInputs:function(j,e,f){j=$(j);
var b=j.getElementsByTagName("input");
if(!e&&!f){return $A(b).map(Element.extend)
}for(var g=0,a=[],h=b.length;
g<h;
g++){var d=b[g];
if((e&&d.type!=e)||(f&&d.name!=f)){continue
}a.push(Element.extend(d))
}return a
},disable:function(a){a=$(a);
Form.getElements(a).invoke("disable");
return a
},enable:function(a){a=$(a);
Form.getElements(a).invoke("enable");
return a
},findFirstElement:function(d){var a=$(d).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled
});
var b=a.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0
}).sortBy(function(e){return e.tabIndex
}).first();
return b?b:a.find(function(e){return["input","select","textarea"].include(e.tagName.toLowerCase())
})
},focusFirstElement:function(a){a=$(a);
a.findFirstElement().activate();
return a
},request:function(e,d){e=$(e),d=Object.clone(d||{});
var b=d.parameters,a=e.readAttribute("action")||"";
if(a.blank()){a=window.location.href
}d.parameters=e.serialize(true);
if(b){if(Object.isString(b)){b=b.toQueryParams()
}Object.extend(d.parameters,b)
}if(e.hasAttribute("method")&&!d.method){d.method=e.method
}return new Ajax.Request(a,d)
}};
Form.Element={focus:function(a){$(a).focus();
return a
},select:function(a){$(a).select();
return a
}};
Form.Element.Methods={serialize:function(b){b=$(b);
if(!b.disabled&&b.name){var d=b.getValue();
if(d!=undefined){var a={};
a[b.name]=d;
return Object.toQueryString(a)
}}return""
},getValue:function(a){a=$(a);
var b=a.tagName.toLowerCase();
return Form.Element.Serializers[b](a)
},setValue:function(b,d){b=$(b);
var a=b.tagName.toLowerCase();
Form.Element.Serializers[a](b,d);
return b
},clear:function(a){$(a).value="";
return a
},present:function(a){return $(a).value!=""
},activate:function(a){a=$(a);
try{a.focus();
if(a.select&&(a.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(a.type))){a.select()
}}catch(b){}return a
},disable:function(a){a=$(a);
a.disabled=true;
return a
},enable:function(a){a=$(a);
a.disabled=false;
return a
}};
var Field=Form.Element;
var $F=Form.Element.Methods.getValue;
Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);
default:return Form.Element.Serializers.textarea(a,b)
}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null
}else{a.checked=!!b
}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value
}else{a.value=b
}},select:function(f,a){if(Object.isUndefined(a)){return this[f.type=="select-one"?"selectOne":"selectMany"](f)
}else{var e,g,b=!Object.isArray(a);
for(var d=0,h=f.length;
d<h;
d++){e=f.options[d];
g=this.optionValue(e);
if(b){if(g==a){e.selected=true;
return
}}else{e.selected=a.include(g)
}}}},selectOne:function(b){var a=b.selectedIndex;
return a>=0?this.optionValue(b.options[a]):null
},selectMany:function(b){var e,d=b.length;
if(!d){return null
}for(var a=0,e=[];
a<d;
a++){var f=b.options[a];
if(f.selected){e.push(this.optionValue(f))
}}return e
},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text
}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,d,a){$super(a,d);
this.element=$(b);
this.lastValue=this.getValue()
},execute:function(){var a=this.getValue();
if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);
this.lastValue=a
}}});
Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)
}});
Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);
this.callback=b;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()
}else{this.registerCallback(this.element)
}},onElementEvent:function(){var a=this.getValue();
if(this.lastValue!=a){this.callback(this.element,a);
this.lastValue=a
}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)
},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));
break;
default:Event.observe(a,"change",this.onElementEvent.bind(this));
break
}}}});
Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)
}});
Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)
}});
if(!window.Event){var Event={}
}Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{},relatedTarget:function(b){var a;
switch(b.type){case"mouseover":a=b.fromElement;
break;
case"mouseout":a=b.toElement;
break;
default:return null
}return Element.extend(a)
}});
Event.Methods=(function(){var a;
if(Prototype.Browser.IE){var b={0:1,1:4,2:2};
a=function(e,d){return e.button==b[d]
}
}else{if(Prototype.Browser.WebKit){a=function(e,d){switch(d){case 0:return e.which==1&&!e.metaKey;
case 1:return e.which==1&&e.metaKey;
default:return false
}}
}else{a=function(e,d){return e.which?(e.which===d+1):(e.button===d)
}
}}return{isLeftClick:function(d){return a(d,0)
},isMiddleClick:function(d){return a(d,1)
},isRightClick:function(d){return a(d,2)
},element:function(d){d=Event.extend(d);
var g=d.target,f=d.type,e=d.currentTarget;
if(e&&e.tagName){if(f==="load"||f==="error"||(f==="click"&&e.tagName.toLowerCase()==="input"&&e.type==="radio")){g=e
}}if(g.nodeType==Node.TEXT_NODE){g=g.parentNode
}return Element.extend(g)
},findElement:function(g,e){var f=Event.element(g);
if(!e){return f
}var d=[f].concat(f.ancestors());
return Selector.findElement(d,e,0)
},pointer:function(e){var d=document.documentElement,f=document.body||{scrollLeft:0,scrollTop:0};
return{x:e.pageX||(e.clientX+(d.scrollLeft||f.scrollLeft)-(d.clientLeft||0)),y:e.pageY||(e.clientY+(d.scrollTop||f.scrollTop)-(d.clientTop||0))}
},pointerX:function(d){return Event.pointer(d).x
},pointerY:function(d){return Event.pointer(d).y
},stop:function(d){Event.extend(d);
d.preventDefault();
d.stopPropagation();
d.stopped=true
}}
})();
Event.extend=(function(){var a=Object.keys(Event.Methods).inject({},function(b,d){b[d]=Event.Methods[d].methodize();
return b
});
if(Prototype.Browser.IE){Object.extend(a,{stopPropagation:function(){this.cancelBubble=true
},preventDefault:function(){this.returnValue=false
},inspect:function(){return"[object Event]"
}});
return function(b){if(!b){return false
}if(b._extendedByPrototype){return b
}b._extendedByPrototype=Prototype.emptyFunction;
var d=Event.pointer(b);
Object.extend(b,{target:b.srcElement,relatedTarget:Event.relatedTarget(b),pageX:d.x,pageY:d.y});
return Object.extend(b,a)
}
}else{Event.prototype=Event.prototype||document.createEvent("HTMLEvents")["__proto__"];
Object.extend(Event.prototype,a);
return Prototype.K
}})();
Object.extend(Event,(function(){var k=Event.cache;
function a(l){if(l._prototypeEventID){return l._prototypeEventID[0]
}arguments.callee.id=arguments.callee.id||1;
return l._prototypeEventID=[++arguments.callee.id]
}function f(l){if(l&&l.include(":")){return"dataavailable"
}return l
}function j(l){return k[l]=k[l]||{}
}function e(n,l){var m=j(n);
return m[l]=m[l]||[]
}function g(m,l,n){var q=a(m);
var p=e(q,l);
if(p.pluck("handler").include(n)){return false
}var o=function(r){if(!Event||!Event.extend||(r.eventName&&r.eventName!=l)){return false
}Event.extend(r);
n.call(m,r)
};
o.handler=n;
p.push(o);
return o
}function h(o,l,m){var n=e(o,l);
return n.find(function(p){return p.handler==m
})
}function b(o,l,m){var n=j(o);
if(!n[l]){return false
}n[l]=n[l].without(h(o,l,m))
}function d(){for(var m in k){for(var l in k[m]){k[m][l]=null
}}}if(window.attachEvent){window.attachEvent("onunload",d)
}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)
}return{observe:function(n,l,o){n=$(n);
var m=f(l);
var p=g(n,l,o);
if(!p){return n
}if(n.addEventListener){n.addEventListener(m,p,false)
}else{n.attachEvent("on"+m,p)
}return n
},stopObserving:function(n,l,o){n=$(n);
var q=a(n),m=f(l);
if(!o&&l){e(q,l).each(function(r){n.stopObserving(l,r.handler)
});
return n
}else{if(!l){Object.keys(j(q)).each(function(r){n.stopObserving(r)
});
return n
}}var p=h(q,l,o);
if(!p){return n
}if(n.removeEventListener){n.removeEventListener(m,p,false)
}else{n.detachEvent("on"+m,p)
}b(q,l,o);
return n
},fire:function(n,m,l){n=$(n);
if(n==document&&document.createEvent&&!n.dispatchEvent){n=document.documentElement
}var o;
if(document.createEvent){o=document.createEvent("HTMLEvents");
o.initEvent("dataavailable",true,true)
}else{o=document.createEventObject();
o.eventType="ondataavailable"
}o.eventName=m;
o.memo=l||{};
if(document.createEvent){n.dispatchEvent(o)
}else{n.fireEvent(o.eventType,o)
}return Event.extend(o)
}}
})());
Object.extend(Event,Event.Methods);
Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});
Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize(),loaded:false});
(function(){var b;
function a(){if(document.loaded){return
}if(b){window.clearInterval(b)
}document.fire("dom:loaded");
document.loaded=true
}if(document.addEventListener){if(Prototype.Browser.WebKit){b=window.setInterval(function(){if(/loaded|complete/.test(document.readyState)){a()
}},0);
Event.observe(window,"load",a)
}else{document.addEventListener("DOMContentLoaded",a,false)
}}else{document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;
a()
}}
}})();
Hash.toQueryString=Object.toQueryString;
var Toggle={display:Element.toggle};
Element.Methods.childOf=Element.Methods.descendantOf;
var Insertion={Before:function(a,b){return Element.insert(a,{before:b})
},Top:function(a,b){return Element.insert(a,{top:b})
},Bottom:function(a,b){return Element.insert(a,{bottom:b})
},After:function(a,b){return Element.insert(a,{after:b})
}};
var $continue=new Error('"throw $continue" is deprecated, use "return" instead');
var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0
},within:function(d,b,a){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(d,b,a)
}this.xcomp=b;
this.ycomp=a;
this.offset=Element.cumulativeOffset(d);
return(a>=this.offset[1]&&a<this.offset[1]+d.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+d.offsetWidth)
},withinIncludingScrolloffsets:function(e,d,b){var a=Element.cumulativeScrollOffset(e);
this.xcomp=d+a[0]-this.deltaX;
this.ycomp=b+a[1]-this.deltaY;
this.offset=Element.cumulativeOffset(e);
return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+e.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+e.offsetWidth)
},overlap:function(b,a){if(!b){return 0
}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight
}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth
}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();
return Element.absolutize(a)
},relativize:function(a){Position.prepare();
return Element.relativize(a)
},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(d,a,b){b=b||{};
return Element.clonePosition(a,d,b)
}};
if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"
}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(f,e){e=e.toString().strip();
var d=/\s/.test(e)?$w(e).map(a).join(""):a(e);
return d?document._getElementsByXPath(".//*"+d,f):[]
}:function(j,k){k=k.toString().strip();
var l=[],e=(/\s/.test(k)?$w(k):null);
if(!e&&!k){return l
}var g=$(j).getElementsByTagName("*");
k=" "+k+" ";
for(var h=0,f,d;
f=g[h];
h++){if(f.className&&(d=" "+f.className+" ")&&(d.include(k)||(e&&e.all(function(m){return !m.toString().blank()&&d.include(" "+m+" ")
})))){l.push(Element.extend(f))
}}return l
};
return function(e,d){return $(d||document.body).getElementsByClassName(e)
}
}(Element.Methods)
}Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(a){this.element=$(a)
},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0
})._each(a)
},set:function(a){this.element.className=a
},add:function(a){if(this.include(a)){return
}this.set($A(this).concat(a).join(" "))
},remove:function(a){if(!this.include(a)){return
}this.set($A(this).without(a).join(" "))
},toString:function(){return $A(this).join(" ")
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
Element.addMethods();
String.prototype.parseColor=function(){var b="#";
if(this.slice(0,4)=="rgb("){var a=this.slice(4,this.length-1).split(",");
var d=0;
do{b+=parseInt(a[d]).toColorPart()
}while(++d<3)
}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var d=1;
d<4;
d++){b+=(this.charAt(d)+this.charAt(d)).toLowerCase()
}}if(this.length==7){b=this.toLowerCase()
}}}return(b.length==7?b:(arguments[0]||this))
};
Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))
}).flatten().join("")
};
Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(d){return(d.nodeType==3?d.nodeValue:((d.hasChildNodes()&&!Element.hasClassName(d,b))?Element.collectTextNodesIgnoreClass(d,b):""))
}).flatten().join("")
};
Element.setContentZoom=function(a,b){a=$(a);
a.setStyle({fontSize:(b/100)+"em"});
if(Prototype.Browser.WebKit){window.scrollBy(0,0)
}return a
};
Element.getInlineOpacity=function(a){return $(a).style.opacity||""
};
Element.forceRerendering=function(b){try{b=$(b);
var a=document.createTextNode(" ");
b.appendChild(a);
b.removeChild(a)
}catch(d){}};
var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5
},reverse:function(a){return 1-a
},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;
return a>1?1:a
},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5
},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5
},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))
},none:function(a){return 0
},full:function(a){return 1
}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";
if(Prototype.Browser.IE){b+=";zoom:1"
}a=$(a);
$A(a.childNodes).each(function(d){if(d.nodeType==3){d.nodeValue.toArray().each(function(e){a.insertBefore(new Element("span",{style:b}).update(e==" "?String.fromCharCode(160):e),d)
});
Element.remove(d)
}})
},multiple:function(f,a){var d;
if(((typeof f=="object")||Object.isFunction(f))&&(f.length)){d=f
}else{d=$(f).childNodes
}var e=Object.extend({speed:0.1,delay:0},arguments[2]||{});
var b=e.delay;
$A(d).each(function(h,g){new a(h,Object.extend(e,{delay:g*e.speed+b}))
})
},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(d,a){d=$(d);
a=(a||"appear").toLowerCase();
var b=Object.extend({queue:{position:"end",scope:(d.id||"global"),limit:1}},arguments[2]||{});
Effect[d.visible()?Effect.PAIRS[a][1]:Effect.PAIRS[a][0]](d,b)
}};
Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;
Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];
this.interval=null
},_each:function(a){this.effects._each(a)
},add:function(d){var a=new Date().getTime();
var b=Object.isString(d.options.queue)?d.options.queue:d.options.queue.position;
switch(b){case"front":this.effects.findAll(function(e){return e.state=="idle"
}).each(function(e){e.startOn+=d.finishOn;
e.finishOn+=d.finishOn
});
break;
case"with-last":a=this.effects.pluck("startOn").max()||a;
break;
case"end":a=this.effects.pluck("finishOn").max()||a;
break
}d.startOn+=a;
d.finishOn+=a;
if(!d.options.queue.limit||(this.effects.length<d.options.queue.limit)){this.effects.push(d)
}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)
}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a
});
if(this.effects.length==0){clearInterval(this.interval);
this.interval=null
}},loop:function(){var a=new Date().getTime();
for(var d=0,b=this.effects.length;
d<b;
d++){this.effects[d]&&this.effects[d].loop(a)
}}});
Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a
}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())
}};
Effect.Queue=Effect.Queues.get("global");
Effect.Base=Class.create({position:null,start:function(a){function b(e,d){return((e[d+"Internal"]?"this.options."+d+"Internal(this);":"")+(e[d]?"this.options."+d+"(this);":""))
}if(a&&a.transition===false){a.transition=Effect.Transitions.linear
}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});
this.currentFrame=0;
this.state="idle";
this.startOn=this.options.delay*1000;
this.finishOn=this.startOn+(this.options.duration*1000);
this.fromToDelta=this.options.to-this.options.from;
this.totalTime=this.finishOn-this.startOn;
this.totalFrames=this.options.fps*this.options.duration;
this.render=(function(){function d(e,f){if(e.options[f+"Internal"]){e.options[f+"Internal"](e)
}if(e.options[f]){e.options[f](e)
}}return function(e){if(this.state==="idle"){this.state="running";
d(this,"beforeSetup");
if(this.setup){this.setup()
}d(this,"afterSetup")
}if(this.state==="running"){e=(this.options.transition(e)*this.fromToDelta)+this.options.from;
this.position=e;
d(this,"beforeUpdate");
if(this.update){this.update(e)
}d(this,"afterUpdate")
}}
})();
this.event("beforeStart");
if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)
}},loop:function(a){if(a>=this.startOn){if(a>=this.finishOn){this.render(1);
this.cancel();
this.event("beforeFinish");
if(this.finish){this.finish()
}this.event("afterFinish");
return
}var d=(a-this.startOn)/this.totalTime,b=(d*this.totalFrames).round();
if(b>this.currentFrame){this.render(d);
this.currentFrame=b
}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)
}this.state="finished"
},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)
}if(this.options[a]){this.options[a](this)
}},inspect:function(){var a=$H();
for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])
}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"
}});
Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];
this.start(arguments[1])
},update:function(a){this.effects.invoke("render",a)
},finish:function(a){this.effects.each(function(b){b.render(1);
b.cancel();
b.event("beforeFinish");
if(b.finish){b.finish(a)
}b.event("afterFinish")
})
}});
Effect.Tween=Class.create(Effect.Base,{initialize:function(g,d,b){g=Object.isString(g)?$(g):g;
var f=$A(arguments),a=f.last(),e=f.length==5?f[3]:null;
this.method=Object.isFunction(a)?a.bind(g):Object.isFunction(g[a])?g[a].bind(g):function(h){g[a]=h
};
this.start(Object.extend({from:d,to:b},e||{}))
},update:function(a){this.method(a)
}});
Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))
},update:Prototype.emptyFunction});
Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);
if(!this.element){throw (Effect._elementDoesNotExistError)
}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})
}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});
this.start(a)
},update:function(a){this.element.setOpacity(a)
}});
Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);
if(!this.element){throw (Effect._elementDoesNotExistError)
}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});
this.start(a)
},setup:function(){this.element.makePositioned();
this.originalLeft=parseFloat(this.element.getStyle("left")||"0");
this.originalTop=parseFloat(this.element.getStyle("top")||"0");
if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;
this.options.y=this.options.y-this.originalTop
}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})
}});
Effect.MoveBy=function(d,b,a){return new Effect.Move(d,Object.extend({x:a,y:b},arguments[3]||{}))
};
Effect.Scale=Class.create(Effect.Base,{initialize:function(d,a){this.element=$(d);
if(!this.element){throw (Effect._elementDoesNotExistError)
}var b=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:a},arguments[2]||{});
this.start(b)
},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;
this.elementPositioning=this.element.getStyle("position");
this.originalStyle={};
["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]
}.bind(this));
this.originalTop=this.element.offsetTop;
this.originalLeft=this.element.offsetLeft;
var a=this.element.getStyle("font-size")||"100%";
["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);
this.fontSizeType=b
}}.bind(this));
this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;
this.dims=null;
if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]
}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]
}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]
}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);
if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})
}this.setDimensions(this.dims[0]*b,this.dims[1]*b)
},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)
}},setDimensions:function(f,b){var e={};
if(this.options.scaleX){e.width=b.round()+"px"
}if(this.options.scaleY){e.height=f.round()+"px"
}if(this.options.scaleFromCenter){var a=(f-this.dims[0])/2;
var g=(b-this.dims[1])/2;
if(this.elementPositioning=="absolute"){if(this.options.scaleY){e.top=this.originalTop-a+"px"
}if(this.options.scaleX){e.left=this.originalLeft-g+"px"
}}else{if(this.options.scaleY){e.top=-a+"px"
}if(this.options.scaleX){e.left=-g+"px"
}}}this.element.setStyle(e)
}});
Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);
if(!this.element){throw (Effect._elementDoesNotExistError)
}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});
this.start(a)
},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();
return
}this.oldStyle={};
if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");
this.element.setStyle({backgroundImage:"none"})
}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")
}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")
}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)
}.bind(this));
this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]
}.bind(this))
},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,d,e){return b+((this._base[e]+(this._delta[e]*a)).round().toColorPart())
}.bind(this))})
},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))
}});
Effect.ScrollTo=function(a){var e=arguments[1]||{},d=document.viewport.getScrollOffsets(),b=$(a).cumulativeOffset();
if(e.offset){b[1]+=e.offset
}return new Effect.Tween(null,d.top,b[1],e,function(f){scrollTo(d.left,f.round())
})
};
Effect.Fade=function(a){a=$(a);
var b=a.getInlineOpacity();
var d=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(e){if(e.options.to!=0){return
}e.element.hide().setStyle({opacity:b})
}},arguments[1]||{});
return new Effect.Opacity(a,d)
};
Effect.Appear=function(b){b=$(b);
var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(d){d.element.forceRerendering()
},beforeSetup:function(d){d.element.setOpacity(d.options.from).show()
}},arguments[1]||{});
return new Effect.Opacity(b,a)
};
Effect.Puff=function(b){b=$(b);
var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};
return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(d){Position.absolutize(d.effects[0].element)
},afterFinishInternal:function(d){d.effects[0].element.hide().setStyle(a)
}},arguments[1]||{}))
};
Effect.BlindUp=function(a){a=$(a);
a.makeClipping();
return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()
}},arguments[1]||{}))
};
Effect.BlindDown=function(b){b=$(b);
var a=b.getDimensions();
return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makeClipping().setStyle({height:"0px"}).show()
},afterFinishInternal:function(d){d.element.undoClipping()
}},arguments[1]||{}))
};
Effect.SwitchOff=function(b){b=$(b);
var a=b.getInlineOpacity();
return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(d){new Effect.Scale(d.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(e){e.element.makePositioned().makeClipping()
},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})
}})
}},arguments[1]||{}))
};
Effect.DropOut=function(b){b=$(b);
var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};
return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(d){d.effects[0].element.makePositioned()
},afterFinishInternal:function(d){d.effects[0].element.hide().undoPositioned().setStyle(a)
}},arguments[1]||{}))
};
Effect.Shake=function(b){b=$(b);
var f=Object.extend({distance:20,duration:0.5},arguments[1]||{});
var d=parseFloat(f.distance);
var a=parseFloat(f.duration)/10;
var e={top:b.getStyle("top"),left:b.getStyle("left")};
return new Effect.Move(b,{x:d,y:0,duration:a,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-d*2,y:0,duration:a*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:d*2,y:0,duration:a*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:-d*2,y:0,duration:a*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:d*2,y:0,duration:a*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:-d,y:0,duration:a,afterFinishInternal:function(m){m.element.undoPositioned().setStyle(e)
}})
}})
}})
}})
}})
}})
};
Effect.SlideDown=function(a){a=$(a).cleanWhitespace();
var b=a.down().getStyle("bottom");
var d=a.getDimensions();
return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();
e.element.down().makePositioned();
if(window.opera){e.element.setStyle({top:""})
}e.element.makeClipping().setStyle({height:"0px"}).show()
},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})
},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned();
e.element.down().undoPositioned().setStyle({bottom:b})
}},arguments[1]||{}))
};
Effect.SlideUp=function(a){a=$(a).cleanWhitespace();
var b=a.down().getStyle("bottom");
var d=a.getDimensions();
return new Effect.Scale(a,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:d.height,originalWidth:d.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();
e.element.down().makePositioned();
if(window.opera){e.element.setStyle({top:""})
}e.element.makeClipping().show()
},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})
},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned();
e.element.down().undoPositioned().setStyle({bottom:b})
}},arguments[1]||{}))
};
Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()
},afterFinishInternal:function(b){b.element.hide().undoClipping()
}})
};
Effect.Grow=function(e){e=$(e);
var d=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});
var b={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};
var j=e.getDimensions();
var a,h;
var g,f;
switch(d.direction){case"top-left":a=h=g=f=0;
break;
case"top-right":a=j.width;
h=f=0;
g=-j.width;
break;
case"bottom-left":a=g=0;
h=j.height;
f=-j.height;
break;
case"bottom-right":a=j.width;
h=j.height;
g=-j.width;
f=-j.height;
break;
case"center":a=j.width/2;
h=j.height/2;
g=-j.width/2;
f=-j.height/2;
break
}return new Effect.Move(e,{x:a,y:h,duration:0.01,beforeSetup:function(k){k.element.hide().makeClipping().makePositioned()
},afterFinishInternal:function(k){new Effect.Parallel([new Effect.Opacity(k.element,{sync:true,to:1,from:0,transition:d.opacityTransition}),new Effect.Move(k.element,{x:g,y:f,sync:true,transition:d.moveTransition}),new Effect.Scale(k.element,100,{scaleMode:{originalHeight:j.height,originalWidth:j.width},sync:true,scaleFrom:window.opera?1:0,transition:d.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(l){l.effects[0].element.setStyle({height:"0px"}).show()
},afterFinishInternal:function(l){l.effects[0].element.undoClipping().undoPositioned().setStyle(b)
}},d))
}})
};
Effect.Shrink=function(g){g=$(g);
var f=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});
var e={top:g.style.top,left:g.style.left,height:g.style.height,width:g.style.width,opacity:g.getInlineOpacity()};
var d=g.getDimensions();
var b,a;
switch(f.direction){case"top-left":b=a=0;
break;
case"top-right":b=d.width;
a=0;
break;
case"bottom-left":b=0;
a=d.height;
break;
case"bottom-right":b=d.width;
a=d.height;
break;
case"center":b=d.width/2;
a=d.height/2;
break
}return new Effect.Parallel([new Effect.Opacity(g,{sync:true,to:0,from:1,transition:f.opacityTransition}),new Effect.Scale(g,window.opera?1:0,{sync:true,transition:f.scaleTransition,restoreAfterFinish:true}),new Effect.Move(g,{x:b,y:a,sync:true,transition:f.moveTransition})],Object.extend({beforeStartInternal:function(h){h.effects[0].element.makePositioned().makeClipping()
},afterFinishInternal:function(h){h.effects[0].element.hide().undoClipping().undoPositioned().setStyle(e)
}},f))
};
Effect.Pulsate=function(a){a=$(a);
var f=arguments[1]||{},e=a.getInlineOpacity(),d=f.transition||Effect.Transitions.linear,b=function(g){return 1-d((-Math.cos((g*(f.pulses||5)*2)*Math.PI)/2)+0.5)
};
return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:e})
}},f),{transition:b}))
};
Effect.Fold=function(b){b=$(b);
var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};
b.makeClipping();
return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(d){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(a)
}})
}},arguments[1]||{}))
};
Effect.Morph=Class.create(Effect.Base,{initialize:function(a){this.element=$(a);
if(!this.element){throw (Effect._elementDoesNotExistError)
}var b=Object.extend({style:{}},arguments[1]||{});
if(!Object.isString(b.style)){this.style=$H(b.style)
}else{if(b.style.include(":")){this.style=b.style.parseStyle()
}else{this.element.addClassName(b.style);
this.style=$H(this.element.getStyles());
this.element.removeClassName(b.style);
var d=this.element.getStyles();
this.style=this.style.reject(function(e){return e.value==d[e.key]
});
b.afterFinishInternal=function(e){e.element.addClassName(e.options.style);
e.transforms.each(function(f){e.element.style[f.style]=""
})
}
}}this.start(b)
},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"
}b=b.parseColor();
return $R(0,2).map(function(d){return parseInt(b.slice(d*2+1,d*2+3),16)
})
}this.transforms=this.style.map(function(g){var f=g[0],e=g[1],b=null;
if(e.parseColor("#zzzzzz")!="#zzzzzz"){e=e.parseColor();
b="color"
}else{if(f=="opacity"){e=parseFloat(e);
if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})
}}else{if(Element.CSS_LENGTH.test(e)){var h=e.match(/^([\+\-]?[0-9\.]+)(.*)$/);
e=parseFloat(h[1]);
b=(h.length==3)?h[2]:null
}}}var d=this.element.getStyle(f);
return{style:f.camelize(),originalValue:b=="color"?a(d):parseFloat(d||0),targetValue:b=="color"?a(e):e,unit:b}
}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))
})
},update:function(d){var b={},e,a=this.transforms.length;
while(a--){b[(e=this.transforms[a]).style]=e.unit=="color"?"#"+(Math.round(e.originalValue[0]+(e.targetValue[0]-e.originalValue[0])*d)).toColorPart()+(Math.round(e.originalValue[1]+(e.targetValue[1]-e.originalValue[1])*d)).toColorPart()+(Math.round(e.originalValue[2]+(e.targetValue[2]-e.originalValue[2])*d)).toColorPart():(e.originalValue+(e.targetValue-e.originalValue)*d).toFixed(3)+(e.unit===null?"":e.unit)
}this.element.setStyle(b,true)
}});
Effect.Transform=Class.create({initialize:function(a){this.tracks=[];
this.options=arguments[1]||{};
this.addTracks(a)
},addTracks:function(a){a.each(function(b){b=$H(b);
var d=b.values().first();
this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:d}}))
}.bind(this));
return this
},play:function(){return new Effect.Parallel(this.tracks.map(function(e){var b=e.get("ids"),a=e.get("effect"),f=e.get("options");
var d=[$(b)||$$(b)].flatten();
return d.map(function(g){return new a(g,Object.extend({sync:true},f))
})
}).flatten(),this.options)
}});
Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");
Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
String.__parseStyleElement=document.createElement("div");
String.prototype.parseStyle=function(){var b,a=$H();
if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style
}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';
b=String.__parseStyleElement.childNodes[0].style
}Element.CSS_PROPERTIES.each(function(d){if(b[d]){a.set(d,b[d])
}});
if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])
}return a
};
if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);
return Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=a[e];
return d
})
}
}else{Element.getStyles=function(d){d=$(d);
var b=d.currentStyle,a;
a=Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=b[f];
return e
});
if(!a.opacity){a.opacity=d.getOpacity()
}return a
}
}Effect.Methods={morph:function(a,b){a=$(a);
new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));
return a
},visualEffect:function(a,d,f){a=$(a);
var b=d.dasherize().camelize(),e=b.charAt(0).toUpperCase()+b.substring(1);
new Effect[e](a,f);
return a
},highlight:function(b,a){b=$(b);
new Effect.Highlight(b,a);
return b
}};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(d,b){d=$(d);
Effect[a.charAt(0).toUpperCase()+a.substring(1)](d,b);
return d
}
});
$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]
});
Element.addMethods(Effect.Methods);
if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")
}var Autocompleter={};
Autocompleter.Base=Class.create({baseInitialize:function(d,a,b){d=$(d);
this.element=d;
this.update=$(a);
this.hasFocus=false;
this.changed=false;
this.active=false;
this.index=0;
this.entryCount=0;
this.oldElementValue=this.element.value;
if(this.setOptions){this.setOptions(b)
}else{this.options=b||{}
}this.options.paramName=this.options.paramName||this.element.name;
this.options.tokens=this.options.tokens||[];
this.options.frequency=this.options.frequency||0.4;
this.options.minChars=this.options.minChars||1;
this.options.onShow=this.options.onShow||function(e,f){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";
Position.clone(e,f,{setHeight:false,offsetTop:e.offsetHeight})
}Effect.Appear(f,{duration:0.15})
};
this.options.onHide=this.options.onHide||function(e,f){new Effect.Fade(f,{duration:0.15})
};
if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)
}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")
}this.observer=null;
this.element.setAttribute("autocomplete","off");
Element.hide(this.update);
Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));
Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))
},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)
}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
this.iefix=$(this.update.id+"_iefix")
}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)
}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});
this.iefix.style.zIndex=1;
this.update.style.zIndex=2;
Element.show(this.iefix)
},hide:function(){this.stopIndicator();
if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)
}if(this.iefix){Element.hide(this.iefix)
}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)
}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)
}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();
Event.stop(a);
case Event.KEY_ESC:this.hide();
this.active=false;
Event.stop(a);
return;
case Event.KEY_LEFT:case Event.KEY_RIGHT:return;
case Event.KEY_UP:this.markPrevious();
this.render();
Event.stop(a);
return;
case Event.KEY_DOWN:this.markNext();
this.render();
Event.stop(a);
return
}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&a.keyCode==0)){return
}}this.changed=true;
this.hasFocus=true;
if(this.observer){clearTimeout(this.observer)
}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)
},activate:function(){this.changed=false;
this.hasFocus=true;
this.getUpdatedChoices()
},onHover:function(b){var a=Event.findElement(b,"LI");
if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;
this.render()
}Event.stop(b)
},onClick:function(b){var a=Event.findElement(b,"LI");
this.index=a.autocompleteIndex;
this.selectEntry();
this.hide()
},onBlur:function(a){setTimeout(this.hide.bind(this),250);
this.hasFocus=false;
this.active=false
},render:function(){if(this.entryCount>0){for(var a=0;
a<this.entryCount;
a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")
}if(this.hasFocus){this.show();
this.active=true
}}else{this.active=false;
this.hide()
}},markPrevious:function(){if(this.index>0){this.index--
}else{this.index=this.entryCount-1
}this.getEntry(this.index).scrollIntoView(true)
},markNext:function(){if(this.index<this.entryCount-1){this.index++
}else{this.index=0
}this.getEntry(this.index).scrollIntoView(false)
},getEntry:function(a){return this.update.firstChild.childNodes[a]
},getCurrentEntry:function(){return this.getEntry(this.index)
},selectEntry:function(){this.active=false;
this.updateElement(this.getCurrentEntry())
},updateElement:function(d){if(this.options.updateElement){this.options.updateElement(d);
return
}var a="";
if(this.options.select){var e=$(d).select("."+this.options.select)||[];
if(e.length>0){a=Element.collectTextNodes(e[0],this.options.select)
}}else{a=Element.collectTextNodesIgnoreClass(d,"informal")
}var g=this.getTokenBounds();
if(g[0]!=-1){var b=this.element.value.substr(0,g[0]);
var f=this.element.value.substr(g[0]).match(/^\s+/);
if(f){b+=f[0]
}this.element.value=b+a+this.element.value.substr(g[1])
}else{this.element.value=a
}this.oldElementValue=this.element.value;
this.element.focus();
if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,d)
}},updateChoices:function(a){if(!this.changed&&this.hasFocus){this.update.innerHTML=a;
Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.down());
if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;
for(var b=0;
b<this.entryCount;
b++){var d=this.getEntry(b);
d.autocompleteIndex=b;
this.addObservers(d)
}}else{this.entryCount=0
}this.stopIndicator();
this.index=0;
if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();
this.hide()
}else{this.render()
}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));
Event.observe(a,"click",this.onClick.bindAsEventListener(this))
},onObserverEvent:function(){this.changed=false;
this.tokenBounds=null;
if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()
}else{this.active=false;
this.hide()
}this.oldElementValue=this.element.value
},getToken:function(){var a=this.getTokenBounds();
return this.element.value.substring(a[0],a[1]).strip()
},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds
}var g=this.element.value;
if(g.strip().empty()){return[-1,0]
}var h=arguments.callee.getFirstDifferencePos(g,this.oldElementValue);
var a=(h==this.oldElementValue.length?1:0);
var f=-1,e=g.length;
var j;
for(var d=0,b=this.options.tokens.length;
d<b;
++d){j=g.lastIndexOf(this.options.tokens[d],h+a-1);
if(j>f){f=j
}j=g.indexOf(this.options.tokens[d],h+a);
if(-1!=j&&j<e){e=j
}}return(this.tokenBounds=[f+1,e])
}});
Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(a,d){var b=Math.min(a.length,d.length);
for(var e=0;
e<b;
++e){if(a[e]!=d[e]){return e
}}return b
};
Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(a,b,e,d){this.baseInitialize(a,b,d);
this.options.asynchronous=true;
this.options.onComplete=this.onComplete.bind(this);
this.options.defaultParams=this.options.parameters||null;
this.url=e
},getUpdatedChoices:function(){this.startIndicator();
var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());
this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;
if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams
}new Ajax.Request(this.url,this.options)
},onComplete:function(a){this.updateChoices(a.responseText)
}});
Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(e,b,a,d){this.baseInitialize(e,b,d);
this.options.array=a
},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))
},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(e){var g=[];
var f=[];
var b=e.getToken();
var k=0;
for(var h=0;
h<e.options.array.length&&g.length<e.options.choices;
h++){var j=e.options.array[h];
var d=e.options.ignoreCase?j.toLowerCase().indexOf(b.toLowerCase()):j.indexOf(b);
while(d!=-1){if(d==0&&j.length!=b.length){g.push("<li><strong>"+j.substr(0,b.length)+"</strong>"+j.substr(b.length)+"</li>");
break
}else{if(b.length>=e.options.partialChars&&e.options.partialSearch&&d!=-1){if(e.options.fullSearch||/\s/.test(j.substr(d-1,1))){f.push("<li>"+j.substr(0,d)+"<strong>"+j.substr(d,b.length)+"</strong>"+j.substr(d+b.length)+"</li>");
break
}}}d=e.options.ignoreCase?j.toLowerCase().indexOf(b.toLowerCase(),d+1):j.indexOf(b,d+1)
}}if(f.length){g=g.concat(f.slice(0,e.options.choices-g.length))
}return"<ul>"+g.join("")+"</ul>"
}},a||{})
}});
Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)
},1)
};
Ajax.InPlaceEditor=Class.create({initialize:function(a,d,b){this.url=d;
this.element=a=$(a);
this.prepareOptions();
this._controls={};
arguments.callee.dealWithDeprecatedOptions(b);
Object.extend(this.options,b||{});
if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";
if($(this.options.formId)){this.options.formId=""
}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)
}if(!this.options.externalControl){this.options.externalControlOnly=false
}this._originalBackground=this.element.getStyle("background-color")||"transparent";
this.element.title=this.options.clickToEditText;
this._boundCancelHandler=this.handleFormCancellation.bind(this);
this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);
this._boundFailureHandler=this.handleAJAXFailure.bind(this);
this._boundSubmitHandler=this.handleFormSubmission.bind(this);
this._boundWrapperHandler=this.wrapUp.bind(this);
this.registerListeners()
},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey){return
}if(Event.KEY_ESC==a.keyCode){this.handleFormCancellation(a)
}else{if(Event.KEY_RETURN==a.keyCode){this.handleFormSubmission(a)
}}},createControl:function(b,f,e){var h=this.options[b+"Control"];
var a=this.options[b+"Text"];
if("button"==h){var d=document.createElement("input");
d.type="submit";
d.value=a;
d.className="editor_"+b+"_button";
if("cancel"==b){d.onclick=this._boundCancelHandler
}this._form.appendChild(d);
this._controls[b]=d
}else{if("link"==h){var g=document.createElement("a");
g.href="#";
g.appendChild(document.createTextNode(a));
g.onclick="cancel"==b?this._boundCancelHandler:this._boundSubmitHandler;
g.className="editor_"+b+"_link";
if(e){g.className+=" "+e
}this._form.appendChild(g);
this._controls[b]=g
}}},createEditField:function(){var a=(this.options.loadTextURL?this.options.loadingText:this.getText());
var d;
if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){d=document.createElement("input");
d.type="text";
var b=this.options.size||this.options.cols||0;
if(0<b){d.size=b
}}else{d=document.createElement("textarea");
d.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);
d.cols=this.options.cols||40
}d.name=this.options.paramName;
d.value=a;
d.className="editor_field";
if(this.options.submitOnBlur){d.onblur=this._boundSubmitHandler
}this._controls.editor=d;
if(this.options.loadTextURL){this.loadExternalText()
}this._form.appendChild(this._controls.editor)
},createForm:function(){var b=this;
function a(d,e){var f=b.options["text"+d+"Controls"];
if(!f||e===false){return
}b._form.appendChild(document.createTextNode(f))
}this._form=$(document.createElement("form"));
this._form.id=this.options.formId;
this._form.addClassName(this.options.formClassName);
this._form.onsubmit=this._boundSubmitHandler;
this.createEditField();
if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))
}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)
}a("Before",this.options.okControl||this.options.cancelControl);
this.createControl("ok",this._boundSubmitHandler);
a("Between",this.options.okControl&&this.options.cancelControl);
this.createControl("cancel",this._boundCancelHandler,"editor_cancel");
a("After",this.options.okControl||this.options.cancelControl)
},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML
}this.leaveEditMode();
this.unregisterListeners()
},enterEditMode:function(a){if(this._saving||this._editing){return
}this._editing=true;
this.triggerCallback("onEnterEditMode");
if(this.options.externalControl){this.options.externalControl.hide()
}this.element.hide();
this.createForm();
this.element.parentNode.insertBefore(this._form,this.element);
if(!this.options.loadTextURL){this.postProcessEditField()
}if(a){Event.stop(a)
}},enterHover:function(a){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)
}if(this._saving){return
}this.triggerCallback("onEnterHover")
},getText:function(){return this.element.innerHTML.unescapeHTML()
},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);
if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;
this._oldInnerHTML=null
}},handleFormCancellation:function(a){this.wrapUp();
if(a){Event.stop(a)
}},handleFormSubmission:function(b){var g=this._form;
var a=$F(this._controls.editor);
this.prepareSubmission();
var d=this.options.callback(g,a)||"";
if(Object.isString(d)){d=d.toQueryParams()
}d.editorId=this.element.id;
if(this.options.htmlResponse){var f=Object.extend({evalScripts:true},this.options.ajaxOptions);
Object.extend(f,{parameters:d,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});
new Ajax.Updater({success:this.element},this.url,f)
}else{var f=Object.extend({method:"get"},this.options.ajaxOptions);
Object.extend(f,{parameters:d,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});
new Ajax.Request(this.url,f)
}if(b){Event.stop(b)
}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);
this.removeForm();
this.leaveHover();
this.element.style.backgroundColor=this._originalBackground;
this.element.show();
if(this.options.externalControl){this.options.externalControl.show()
}this._saving=false;
this._editing=false;
this._oldInnerHTML=null;
this.triggerCallback("onLeaveEditMode")
},leaveHover:function(a){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)
}if(this._saving){return
}this.triggerCallback("onLeaveHover")
},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);
this._controls.editor.disabled=true;
var a=Object.extend({method:"get"},this.options.ajaxOptions);
Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(d){this._form.removeClassName(this.options.loadingClassName);
var b=d.responseText;
if(this.options.stripLoadedTextTags){b=b.stripTags()
}this._controls.editor.value=b;
this._controls.editor.disabled=false;
this.postProcessEditField()
}.bind(this),onFailure:this._boundFailureHandler});
new Ajax.Request(this.options.loadTextURL,a)
},postProcessEditField:function(){var a=this.options.fieldPostCreation;
if(a){$(this._controls.editor)["focus"==a?"focus":"activate"]()
}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);
Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);
[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)
}.bind(this))
},prepareSubmission:function(){this._saving=true;
this.removeForm();
this.leaveHover();
this.showSaving()
},registerListeners:function(){this._listeners={};
var a;
$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);
this._listeners[b.key]=a;
if(!this.options.externalControlOnly){this.element.observe(b.key,a)
}if(this.options.externalControl){this.options.externalControl.observe(b.key,a)
}}.bind(this))
},removeForm:function(){if(!this._form){return
}this._form.remove();
this._form=null;
this._controls={}
},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;
this.element.innerHTML=this.options.savingText;
this.element.addClassName(this.options.savingClassName);
this.element.style.backgroundColor=this._originalBackground;
this.element.show()
},triggerCallback:function(b,a){if("function"==typeof this.options[b]){this.options[b](this,a)
}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly){this.element.stopObserving(a.key,a.value)
}if(this.options.externalControl){this.options.externalControl.stopObserving(a.key,a.value)
}}.bind(this))
},wrapUp:function(a){this.leaveEditMode();
this._boundComplete(a,this.element)
}});
Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});
Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,a,d,b){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;
$super(a,d,b)
},createEditField:function(){var a=document.createElement("select");
a.name=this.options.paramName;
a.size=1;
this._controls.editor=a;
this._collection=this.options.collection||[];
if(this.options.loadCollectionURL){this.loadCollection()
}else{this.checkForExternalText()
}this._form.appendChild(this._controls.editor)
},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);
this.showLoadingText(this.options.loadingCollectionText);
var options=Object.extend({method:"get"},this.options.ajaxOptions);
Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();
if(!/^\[.*\]$/.test(js)){throw ("Server returned an invalid collection representation.")
}this._collection=eval(js);
this.checkForExternalText()
}.bind(this),onFailure:this.onFailure});
new Ajax.Request(this.options.loadCollectionURL,options)
},showLoadingText:function(b){this._controls.editor.disabled=true;
var a=this._controls.editor.firstChild;
if(!a){a=document.createElement("option");
a.value="";
this._controls.editor.appendChild(a);
a.selected=true
}a.update((b||"").stripScripts().stripTags())
},checkForExternalText:function(){this._text=this.getText();
if(this.options.loadTextURL){this.loadExternalText()
}else{this.buildOptionList()
}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);
var a=Object.extend({method:"get"},this.options.ajaxOptions);
Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){this._text=b.responseText.strip();
this.buildOptionList()
}.bind(this),onFailure:this.onFailure});
new Ajax.Request(this.options.loadTextURL,a)
},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);
this._collection=this._collection.map(function(e){return 2===e.length?e:[e,e].flatten()
});
var d=("value" in this.options)?this.options.value:this._text;
var b=this._collection.any(function(e){return e[0]==d
}.bind(this));
this._controls.editor.update("");
var a;
this._collection.each(function(f,e){a=document.createElement("option");
a.value=f[0];
a.selected=b?f[0]==d:0==e;
a.appendChild(document.createTextNode(f[1]));
this._controls.editor.appendChild(a)
}.bind(this));
this._controls.editor.disabled=false;
Field.scrollFreeActivate(this._controls.editor)
}});
Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){if(!a){return
}function b(d,e){if(d in a||e===undefined){return
}a[d]=e
}b("cancelControl",(a.cancelLink?"link":(a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined)));
b("okControl",(a.okLink?"link":(a.okButton?"button":a.okLink==a.okButton==false?false:undefined)));
b("highlightColor",a.highlightcolor);
b("highlightEndColor",a.highlightendcolor)
};
Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)
},onComplete:function(b,a){new Effect.Highlight(a,{startcolor:this.options.highlightColor,keepBackgroundImage:true})
},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;
if(a._effect){a._effect.cancel()
}},onFailure:function(b,a){alert("Error communication with the server: "+b.responseText.stripTags())
},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})
}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});
Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};
Form.Element.DelayedObserver=Class.create({initialize:function(d,b,a){this.delay=b||0.5;
this.element=$(d);
this.callback=a;
this.timer=null;
this.lastValue=$F(this.element);
Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))
},delayedListener:function(a){if(this.lastValue==$F(this.element)){return
}if(this.timer){clearTimeout(this.timer)
}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);
this.lastValue=$F(this.element)
},onTimerEvent:function(){this.timer=null;
this.callback(this.element,$F(this.element))
}});
if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")
}var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)
})
},add:function(d){d=$(d);
var b=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});
if(b.containment){b._containers=[];
var a=b.containment;
if(Object.isArray(a)){a.each(function(e){b._containers.push($(e))
})
}else{b._containers.push($(a))
}}if(b.accept){b.accept=[b.accept].flatten()
}Element.makePositioned(d);
b.element=d;
this.drops.push(b)
},findDeepestChild:function(a){deepest=a[0];
for(i=1;
i<a.length;
++i){if(Element.isParent(a[i].element,deepest.element)){deepest=a[i]
}}return deepest
},isContained:function(d,b){var a;
if(b.tree){a=d.treeNode
}else{a=d.parentNode
}return b._containers.detect(function(e){return a==e
})
},isAffected:function(b,a,d){return((d.element!=a)&&((!d._containers)||this.isContained(a,d))&&((!d.accept)||(Element.classNames(a).detect(function(e){return d.accept.include(e)
})))&&Position.within(d.element,b[0],b[1]))
},deactivate:function(a){if(a.hoverclass){Element.removeClassName(a.element,a.hoverclass)
}this.last_active=null
},activate:function(a){if(a.hoverclass){Element.addClassName(a.element,a.hoverclass)
}this.last_active=a
},show:function(d,a){if(!this.drops.length){return
}var e,b=[];
this.drops.each(function(f){if(Droppables.isAffected(d,a,f)){b.push(f)
}});
if(b.length>0){e=Droppables.findDeepestChild(b)
}if(this.last_active&&this.last_active!=e){this.deactivate(this.last_active)
}if(e){Position.within(e.element,d[0],d[1]);
if(e.onHover){e.onHover(a,e.element,Position.overlap(e.overlap,e.element))
}if(e!=this.last_active){Droppables.activate(e)
}}},fire:function(b,a){if(!this.last_active){return
}Position.prepare();
if(this.isAffected([Event.pointerX(b),Event.pointerY(b)],a,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(a,this.last_active.element,b);
return true
}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)
}}};
var Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.updateDrag.bindAsEventListener(this);
this.eventKeypress=this.keyPress.bindAsEventListener(this);
Event.observe(document,"mouseup",this.eventMouseUp);
Event.observe(document,"mousemove",this.eventMouseMove);
Event.observe(document,"keypress",this.eventKeypress)
}this.drags.push(a)
},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a
});
if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);
Event.stopObserving(document,"keypress",this.eventKeypress)
}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;
window.focus();
Draggables.activeDraggable=a
}.bind(this),a.options.delay)
}else{window.focus();
this.activeDraggable=a
}},deactivate:function(){this.activeDraggable=null
},updateDrag:function(a){if(!this.activeDraggable){return
}var b=[Event.pointerX(a),Event.pointerY(a)];
if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect())){return
}this._lastPointer=b;
this.activeDraggable.updateDrag(a,b)
},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);
this._timeout=null
}if(!this.activeDraggable){return
}this._lastPointer=null;
this.activeDraggable.endDrag(a);
this.activeDraggable=null
},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)
}},addObserver:function(a){this.observers.push(a);
this._cacheObserverCallbacks()
},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a
});
this._cacheObserverCallbacks()
},notify:function(d,b,a){if(this[d+"Count"]>0){this.observers.each(function(e){if(e[d]){e[d](d,b,a)
}})
}if(b.options[d]){b.options[d](b,a)
}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]
}).length
})
}};
var Draggable=Class.create({initialize:function(d){var a={handle:false,reverteffect:function(e,h,g){var f=Math.sqrt(Math.abs(h^2)+Math.abs(g^2))*0.02;
new Effect.Move(e,{x:-g,y:-h,duration:f,queue:{scope:"_draggable",position:"end"}})
},endeffect:function(f){var e=Object.isNumber(f._opacity)?f._opacity:1;
new Effect.Opacity(f,{duration:0.2,from:0.7,to:e,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[f]=false
}})
},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};
if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(a,{starteffect:function(e){e._opacity=Element.getOpacity(e);
Draggable._dragging[e]=true;
new Effect.Opacity(e,{duration:0.2,from:e._opacity,to:0.7})
}})
}var b=Object.extend(a,arguments[1]||{});
this.element=$(d);
if(b.handle&&Object.isString(b.handle)){this.handle=this.element.down("."+b.handle,0)
}if(!this.handle){this.handle=$(b.handle)
}if(!this.handle){this.handle=this.element
}if(b.scroll&&!b.scroll.scrollTo&&!b.scroll.outerHTML){b.scroll=$(b.scroll);
this._isScrollChild=Element.childOf(this.element,b.scroll)
}Element.makePositioned(this.element);
this.options=b;
this.dragging=false;
this.eventMouseDown=this.initDrag.bindAsEventListener(this);
Event.observe(this.handle,"mousedown",this.eventMouseDown);
Draggables.register(this)
},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);
Draggables.unregister(this)
},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])
},initDrag:function(d){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return
}if(Event.isLeftClick(d)){var a=Event.element(d);
if((tag_name=a.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return
}var e=[Event.pointerX(d),Event.pointerY(d)];
var b=Position.cumulativeOffset(this.element);
this.offset=[0,1].map(function(f){return(e[f]-b[f])
});
Draggables.activate(this);
Event.stop(d)
}},startDrag:function(b){this.dragging=true;
if(!this.delta){this.delta=this.currentDelta()
}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);
this.element.style.zIndex=this.options.zindex
}if(this.options.ghosting){this._clone=this.element.cloneNode(true);
this._originallyAbsolute=(this.element.getStyle("position")=="absolute");
if(!this._originallyAbsolute){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
}}Draggables.notify("onStart",this,b);
if(this.options.starteffect){this.options.starteffect(this.element)
}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)
}if(!this.options.quiet){Position.prepare();
Droppables.show(pointer,this.element)
}Draggables.notify("onDrag",this,event);
this.draw(pointer);
if(this.options.change){this.options.change(this)
}if(this.options.scroll){this.stopScrolling();
var p;
if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]
}}else{p=Position.page(this.options.scroll);
p[0]+=this.options.scroll.scrollLeft+Position.deltaX;
p[1]+=this.options.scroll.scrollTop+Position.deltaY;
p.push(p[0]+this.options.scroll.offsetWidth);
p.push(p[1]+this.options.scroll.offsetHeight)
}var speed=[0,0];
if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)
}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)
}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)
}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)
}this.startScrolling(speed)
}if(Prototype.Browser.WebKit){window.scrollBy(0,0)
}Event.stop(event)
},finishDrag:function(g,b){this.dragging=false;
if(this.options.quiet){Position.prepare();
var a=[Event.pointerX(g),Event.pointerY(g)];
Droppables.show(a,this.element)
}if(this.options.ghosting){if(!this._originallyAbsolute){Position.relativize(this.element)
}delete this._originallyAbsolute;
Element.remove(this._clone);
this._clone=null
}var e=false;
if(b){e=Droppables.fire(g,this.element);
if(!e){e=false
}}if(e&&this.options.onDropped){this.options.onDropped(this.element)
}Draggables.notify("onEnd",this,g);
var f=this.options.revert;
if(f&&Object.isFunction(f)){f=f(this.element)
}var h=this.currentDelta();
if(f&&this.options.reverteffect){if(e==0||f!="failure"){this.options.reverteffect(this.element,h[1]-this.delta[1],h[0]-this.delta[0])
}}else{this.delta=h
}if(this.options.zindex){this.element.style.zIndex=this.originalZ
}if(this.options.endeffect){this.options.endeffect(this.element)
}Draggables.deactivate(this);
Droppables.reset()
},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC){return
}this.finishDrag(a,false);
Event.stop(a)
},endDrag:function(a){if(!this.dragging){return
}this.stopScrolling();
this.finishDrag(a,true);
Event.stop(a)
},draw:function(f){var e=Position.cumulativeOffset(this.element);
if(this.options.ghosting){var h=Position.realOffset(this.element);
e[0]+=h[0]-Position.deltaX;
e[1]+=h[1]-Position.deltaY
}var b=this.currentDelta();
e[0]-=b[0];
e[1]-=b[1];
if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){e[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;
e[1]-=this.options.scroll.scrollTop-this.originalScrollTop
}var a=[0,1].map(function(d){return(f[d]-e[d]-this.offset[d])
}.bind(this));
if(this.options.snap){if(Object.isFunction(this.options.snap)){a=this.options.snap(a[0],a[1],this)
}else{if(Object.isArray(this.options.snap)){a=a.map(function(d,j){return(d/this.options.snap[j]).round()*this.options.snap[j]
}.bind(this))
}else{a=a.map(function(d){return(d/this.options.snap).round()*this.options.snap
}.bind(this))
}}}var g=this.element.style;
if((!this.options.constraint)||(this.options.constraint=="horizontal")){g.left=a[0]+"px"
}if((!this.options.constraint)||(this.options.constraint=="vertical")){g.top=a[1]+"px"
}if(g.visibility=="hidden"){g.visibility=""
}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);
this.scrollInterval=null;
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(this.scroll.bind(this),10)
},scroll:function(){var current=new Date();
var delta=current-this.lastScrolled;
this.lastScrolled=current;
if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;
this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])
}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;
this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000
}Position.prepare();
Droppables.show(Draggables._lastPointer,this.element);
Draggables.notify("onDrag",this);
if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);
Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;
Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;
if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0
}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0
}this.draw(Draggables._lastScrollPointer)
}if(this.options.change){this.options.change(this)
}},_getWindowScroll:function(w){var T,L,W,H;
with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;
L=documentElement.scrollLeft
}else{if(w.document.body){T=body.scrollTop;
L=body.scrollLeft
}}if(w.innerWidth){W=w.innerWidth;
H=w.innerHeight
}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;
H=documentElement.clientHeight
}else{W=body.offsetWidth;
H=body.offsetHeight
}}}return{top:T,left:L,width:W,height:H}
}});
Draggable._dragging={};
var SortableObserver=Class.create({initialize:function(b,a){this.element=$(b);
this.observer=a;
this.lastValue=Sortable.serialize(this.element)
},onStart:function(){this.lastValue=Sortable.serialize(this.element)
},onEnd:function(){Sortable.unmark();
if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)
}}});
var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id]){return a
}a=a.parentNode
}},options:function(a){a=Sortable._findRootElement($(a));
if(!a){return
}return Sortable.sortables[a.id]
},destroy:function(a){a=$(a);
var b=Sortable.sortables[a.id];
if(b){Draggables.removeObserver(b.element);
b.droppables.each(function(d){Droppables.remove(d)
});
b.draggables.invoke("destroy");
delete Sortable.sortables[b.element.id]
}},create:function(a){a=$(a);
var f=Object.extend({element:a,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:a,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});
this.destroy(a);
var e={revert:true,quiet:f.quiet,scroll:f.scroll,scrollSpeed:f.scrollSpeed,scrollSensitivity:f.scrollSensitivity,delay:f.delay,ghosting:f.ghosting,constraint:f.constraint,handle:f.handle};
if(f.starteffect){e.starteffect=f.starteffect
}if(f.reverteffect){e.reverteffect=f.reverteffect
}else{if(f.ghosting){e.reverteffect=function(g){g.style.top=0;
g.style.left=0
}
}}if(f.endeffect){e.endeffect=f.endeffect
}if(f.zindex){e.zindex=f.zindex
}var b={overlap:f.overlap,containment:f.containment,tree:f.tree,hoverclass:f.hoverclass,onHover:Sortable.onHover};
var d={onHover:Sortable.onEmptyHover,overlap:f.overlap,containment:f.containment,hoverclass:f.hoverclass};
Element.cleanWhitespace(a);
f.draggables=[];
f.droppables=[];
if(f.dropOnEmpty||f.tree){Droppables.add(a,d);
f.droppables.push(a)
}(f.elements||this.findElements(a,f)||[]).each(function(h,j){var g=f.handles?$(f.handles[j]):(f.handle?$(h).select("."+f.handle)[0]:h);
f.draggables.push(new Draggable(h,Object.extend(e,{handle:g})));
Droppables.add(h,b);
if(f.tree){h.treeNode=a
}f.droppables.push(h)
});
if(f.tree){(Sortable.findTreeElements(a,f)||[]).each(function(g){Droppables.add(g,d);
g.treeNode=a;
f.droppables.push(g)
})
}this.sortables[a.id]=f;
Draggables.addObserver(new SortableObserver(a,f.onUpdate))
},findElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.tag)
},findTreeElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.treeTag)
},onHover:function(d,b,e){if(Element.isParent(b,d)){return
}if(e>0.33&&e<0.66&&Sortable.options(b).tree){return
}else{if(e>0.5){Sortable.mark(b,"before");
if(b.previousSibling!=d){var f=d.parentNode;
d.style.visibility="hidden";
b.parentNode.insertBefore(d,b);
if(b.parentNode!=f){Sortable.options(f).onChange(d)
}Sortable.options(b.parentNode).onChange(d)
}}else{Sortable.mark(b,"after");
var a=b.nextSibling||null;
if(a!=d){var f=d.parentNode;
d.style.visibility="hidden";
b.parentNode.insertBefore(d,a);
if(b.parentNode!=f){Sortable.options(f).onChange(d)
}Sortable.options(b.parentNode).onChange(d)
}}}},onEmptyHover:function(d,f,g){var h=d.parentNode;
var j=Sortable.options(f);
if(!Element.isParent(f,d)){var e;
var a=Sortable.findElements(f,{tag:j.tag,only:j.only});
var k=null;
if(a){var b=Element.offsetSize(f,j.overlap)*(1-g);
for(e=0;
e<a.length;
e+=1){if(b-Element.offsetSize(a[e],j.overlap)>=0){b-=Element.offsetSize(a[e],j.overlap)
}else{if(b-(Element.offsetSize(a[e],j.overlap)/2)>=0){k=e+1<a.length?a[e+1]:null;
break
}else{k=a[e];
break
}}}}f.insertBefore(d,k);
Sortable.options(h).onChange(d);
j.onChange(d)
}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()
}},mark:function(e,d){var b=Sortable.options(e.parentNode);
if(b&&!b.ghosting){return
}if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)
}var a=Position.cumulativeOffset(e);
Sortable._marker.setStyle({left:a[0]+"px",top:a[1]+"px"});
if(d=="after"){if(b.overlap=="horizontal"){Sortable._marker.setStyle({left:(a[0]+e.clientWidth)+"px"})
}else{Sortable._marker.setStyle({top:(a[1]+e.clientHeight)+"px"})
}}Sortable._marker.show()
},_tree:function(h,e,a){var g=Sortable.findElements(h,e)||[];
for(var f=0;
f<g.length;
++f){var d=g[f].id.match(e.format);
if(!d){continue
}var b={id:encodeURIComponent(d?d[1]:null),element:h,parent:a,children:[],position:a.children.length,container:$(g[f]).down(e.treeTag)};
if(b.container){this._tree(b.container,e,b)
}a.children.push(b)
}return a
},tree:function(b){b=$(b);
var a=this.options(b);
var e=Object.extend({tag:a.tag,treeTag:a.treeTag,only:a.only,name:b.id,format:a.format},arguments[1]||{});
var d={id:null,parent:null,children:[],container:b,position:0};
return Sortable._tree(b,e,d)
},_constructIndex:function(b){var a="";
do{if(b.id){a="["+b.position+"]"+a
}}while((b=b.parent)!=null);
return a
},sequence:function(b){b=$(b);
var a=Object.extend(this.options(b),arguments[1]||{});
return $(this.findElements(b,a)||[]).map(function(d){return d.id.match(a.format)?d.id.match(a.format)[1]:""
})
},setSequence:function(e,a){e=$(e);
var d=Object.extend(this.options(e),arguments[2]||{});
var b={};
this.findElements(e,d).each(function(f){if(f.id.match(d.format)){b[f.id.match(d.format)[1]]=[f,f.parentNode]
}f.parentNode.removeChild(f)
});
a.each(function(f){var g=b[f];
if(g){g[1].appendChild(g[0]);
delete b[f]
}})
},serialize:function(a){a=$(a);
var d=Object.extend(Sortable.options(a),arguments[1]||{});
var b=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:a.id);
if(d.tree){return Sortable.tree(a,arguments[1]).children.map(function(e){return[b+Sortable._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))
}).flatten().join("&")
}else{return Sortable.sequence(a,arguments[1]).map(function(e){return b+"[]="+encodeURIComponent(e)
}).join("&")
}}};
Element.isParent=function(b,a){if(!b.parentNode||b==a){return false
}if(b.parentNode==a){return true
}return Element.isParent(b.parentNode,a)
};
Element.findChildren=function(b,f,e,a){if(!b.hasChildNodes()){return null
}a=a.toUpperCase();
if(f){f=[f].flatten()
}var d=[];
$A(b.childNodes).each(function(h){if(h.tagName&&h.tagName.toUpperCase()==a&&(!f||(Element.classNames(h).detect(function(j){return f.include(j)
})))){d.push(h)
}if(e){var g=Element.findChildren(h,f,e,a);
if(g){d.push(g)
}}});
return(d.length>0?d.flatten():[])
};
Element.offsetSize=function(a,b){return a["offset"+((b=="vertical"||b=="height")?"Height":"Width")]
};
if(!Control){var Control={}
}Control.Slider=Class.create({initialize:function(b,d,e){var a=this;
if(Object.isArray(b)){this.handles=b.collect(function(f){return $(f)
})
}else{this.handles=[$(b)]
}this.track=$(d);
this.options=e||{};
this.axis=this.options.axis||"horizontal";
this.increment=this.options.increment||1;
this.step=parseInt(this.options.step||"1");
this.range=this.options.range||$R(0,1);
this.value=0;
this.values=this.handles.map(function(){return 0
});
this.spans=this.options.spans?this.options.spans.map(function(f){return $(f)
}):false;
this.options.startSpan=$(this.options.startSpan||null);
this.options.endSpan=$(this.options.endSpan||null);
this.restricted=this.options.restricted||false;
this.maximum=this.options.maximum||this.range.end;
this.minimum=this.options.minimum||this.range.start;
this.alignX=parseInt(this.options.alignX||"0");
this.alignY=parseInt(this.options.alignY||"0");
this.trackLength=this.maximumOffset()-this.minimumOffset();
this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));
this.active=false;
this.dragging=false;
this.disabled=false;
if(this.options.disabled){this.setDisabled()
}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;
if(this.allowedValues){this.minimum=this.allowedValues.min();
this.maximum=this.allowedValues.max()
}this.eventMouseDown=this.startDrag.bindAsEventListener(this);
this.eventMouseUp=this.endDrag.bindAsEventListener(this);
this.eventMouseMove=this.update.bindAsEventListener(this);
this.handles.each(function(g,f){f=a.handles.length-1-f;
a.setValue(parseFloat((Object.isArray(a.options.sliderValue)?a.options.sliderValue[f]:a.options.sliderValue)||a.range.start),f);
g.makePositioned().observe("mousedown",a.eventMouseDown)
});
this.track.observe("mousedown",this.eventMouseDown);
document.observe("mouseup",this.eventMouseUp);
document.observe("mousemove",this.eventMouseMove);
this.initialized=true
},dispose:function(){var a=this;
Event.stopObserving(this.track,"mousedown",this.eventMouseDown);
Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove);
this.handles.each(function(b){Event.stopObserving(b,"mousedown",a.eventMouseDown)
})
},setDisabled:function(){this.disabled=true
},setEnabled:function(){this.disabled=false
},getNearestValue:function(b){if(this.allowedValues){if(b>=this.allowedValues.max()){return(this.allowedValues.max())
}if(b<=this.allowedValues.min()){return(this.allowedValues.min())
}var a=Math.abs(this.allowedValues[0]-b);
var d=this.allowedValues[0];
this.allowedValues.each(function(e){var f=Math.abs(e-b);
if(f<=a){d=e;
a=f
}});
return d
}if(b>this.range.end){return this.range.end
}if(b<this.range.start){return this.range.start
}return b
},setValue:function(b,a){if(!this.active){this.activeHandleIdx=a||0;
this.activeHandle=this.handles[this.activeHandleIdx];
this.updateStyles()
}a=a||this.activeHandleIdx||0;
if(this.initialized&&this.restricted){if((a>0)&&(b<this.values[a-1])){b=this.values[a-1]
}if((a<(this.handles.length-1))&&(b>this.values[a+1])){b=this.values[a+1]
}}b=this.getNearestValue(b);
this.values[a]=b;
this.value=this.values[0];
this.handles[a].style[this.isVertical()?"top":"left"]=this.translateToPx(b);
this.drawSpans();
if(!this.dragging||!this.event){this.updateFinished()
}},setValueBy:function(b,a){this.setValue(this.values[a||this.activeHandleIdx||0]+b,a||this.activeHandleIdx||0)
},translateToPx:function(a){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(a-this.range.start))+"px"
},translateToValue:function(a){return((a/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)
},getRange:function(b){var a=this.values.sortBy(Prototype.K);
b=b||0;
return $R(a[b],a[b+1])
},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX)
},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX)
},isVertical:function(){return(this.axis=="vertical")
},drawSpans:function(){var a=this;
if(this.spans){$R(0,this.spans.length-1).each(function(b){a.setSpan(a.spans[b],a.getRange(b))
})
}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))
}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))
}},setSpan:function(b,a){if(this.isVertical()){b.style.top=this.translateToPx(a.start);
b.style.height=this.translateToPx(a.end-a.start+this.range.start)
}else{b.style.left=this.translateToPx(a.start);
b.style.width=this.translateToPx(a.end-a.start+this.range.start)
}},updateStyles:function(){this.handles.each(function(a){Element.removeClassName(a,"selected")
});
Element.addClassName(this.activeHandle,"selected")
},startDrag:function(a){if(Event.isLeftClick(a)){if(!this.disabled){this.active=true;
var b=Event.element(a);
var d=[Event.pointerX(a),Event.pointerY(a)];
var e=b;
if(e==this.track){var f=Position.cumulativeOffset(this.track);
this.event=a;
this.setValue(this.translateToValue((this.isVertical()?d[1]-f[1]:d[0]-f[0])-(this.handleLength/2)));
var f=Position.cumulativeOffset(this.activeHandle);
this.offsetX=(d[0]-f[0]);
this.offsetY=(d[1]-f[1])
}else{while((this.handles.indexOf(b)==-1)&&b.parentNode){b=b.parentNode
}if(this.handles.indexOf(b)!=-1){this.activeHandle=b;
this.activeHandleIdx=this.handles.indexOf(this.activeHandle);
this.updateStyles();
var f=Position.cumulativeOffset(this.activeHandle);
this.offsetX=(d[0]-f[0]);
this.offsetY=(d[1]-f[1])
}}}Event.stop(a)
}},update:function(a){if(this.active){if(!this.dragging){this.dragging=true
}this.draw(a);
if(Prototype.Browser.WebKit){window.scrollBy(0,0)
}Event.stop(a)
}},draw:function(d){var a=[Event.pointerX(d),Event.pointerY(d)];
var b=Position.cumulativeOffset(this.track);
a[0]-=this.offsetX+b[0];
a[1]-=this.offsetY+b[1];
this.event=d;
this.setValue(this.translateToValue(this.isVertical()?a[1]:a[0]));
if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)
}},endDrag:function(a){if(this.active&&this.dragging){this.finishDrag(a,true);
Event.stop(a)
}this.active=false;
this.dragging=false
},finishDrag:function(a,b){this.active=false;
this.dragging=false;
this.updateFinished()
},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)
}this.event=null
}});
var Resizables={instances:[],observers:[],register:function(a){if(this.instances.length==0){this.eventMouseUp=this.endResize.bindAsEventListener(this);
this.eventMouseMove=this.updateResize.bindAsEventListener(this);
Event.observe(document,"mouseup",this.eventMouseUp);
Event.observe(document,"mousemove",this.eventMouseMove)
}this.instances.push(a)
},unregister:function(a){this.instances=this.instances.reject(function(b){return b==a
});
if(this.instances.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);
Event.stopObserving(document,"mousemove",this.eventMouseMove)
}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Resizables._timeout=null;
Resizables.activeResizable=a
}.bind(this),a.options.delay)
}else{this.activeResizable=a
}},deactivate:function(){this.activeResizable=null
},updateResize:function(a){if(!this.activeResizable){return
}var b=[Event.pointerX(a),Event.pointerY(a)];
if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect())){return
}this._lastPointer=b;
this.activeResizable.updateResize(a,b)
},endResize:function(a){if(this._timeout){clearTimeout(this._timeout);
this._timeout=null
}if(!this.activeResizable){return
}this._lastPointer=null;
this.activeResizable.endResize(a);
this.activeResizable=null
},addObserver:function(a){this.observers.push(a);
this._cacheObserverCallbacks()
},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a
});
this._cacheObserverCallbacks()
},notify:function(b,d,a){if(this[b+"Count"]>0){this.observers.each(function(e){if(e[b]){e[b](b,d,a)
}})
}if(d.options[b]){d.options[b](d,a)
}},_cacheObserverCallbacks:function(){["onStart","onEnd","onResize"].each(function(a){Resizables[a+"Count"]=Resizables.observers.select(function(b){return b[a]
}).length
})
}};
var Resizable=Class.create();
Resizable._resizing={};
Resizable.prototype={initialize:function(d){var a={handle:false,snap:false,delay:0,minHeight:false,minwidth:false,maxHeight:false,maxWidth:false};
this.element=$(d);
var b=Object.extend(a,arguments[1]||{});
if(b.handle&&typeof b.handle=="string"){this.handle=$(b.handle)
}else{if(b.handle){this.handle=b.handle
}}if(!this.handle){this.handle=this.element
}this.options=b;
this.dragging=false;
this.eventMouseDown=this.initResize.bindAsEventListener(this);
Event.observe(this.handle,"mousedown",this.eventMouseDown);
Resizables.register(this)
},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown)
},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"width")||"0"),parseInt(Element.getStyle(this.element,"height")||"0")])
},initResize:function(a){if(typeof Resizable._resizing[this.element]!="undefined"&&Resizable._resizing[this.element]){return
}if(Event.isLeftClick(a)){var b=Event.element(a);
if((tag_name=b.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return
}this.pointer=[Event.pointerX(a),Event.pointerY(a)];
this.size=[parseInt(this.element.getStyle("width"))||0,parseInt(this.element.getStyle("height"))||0];
Resizables.activate(this);
Event.stop(a)
}},startResize:function(a){this.resizing=true;
if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);
this.element.style.zIndex=this.options.zindex
}Resizables.notify("onStart",this,a);
Resizable._resizing[this.element]=true
},updateResize:function(a,b){if(!this.resizing){this.startResize(a)
}Resizables.notify("onResize",this,a);
this.draw(b);
if(this.options.change){this.options.change(this)
}if(Prototype.Browser.WebKit){window.scrollBy(0,0)
}Event.stop(a)
},finishResize:function(a,b){this.resizing=false;
Resizables.notify("onEnd",this,a);
if(this.options.zindex){this.element.style.zIndex=this.originalZ
}Resizable._resizing[this.element]=false;
Resizables.deactivate(this)
},endResize:function(a){if(!this.resizing){return
}this.finishResize(a,true);
Event.stop(a)
},draw:function(d){var b=[0,1].map(function(j){return(this.size[j]+d[j]-this.pointer[j])
}.bind(this));
if(this.options.snap){if(typeof this.options.snap=="function"){b=this.options.snap(b[0],b[1],this)
}else{if(this.options.snap instanceof Array){b=b.map(function(j,k){return Math.round(j/this.options.snap[k])*this.options.snap[k]
}.bind(this))
}else{b=b.map(function(j){return Math.round(j/this.options.snap)*this.options.snap
}.bind(this))
}}}var f=(typeof(this.options.minWidth)=="function")?this.options.minWidth(this.element):this.options.minWidth;
var h=(typeof(this.options.maxWidth)=="function")?this.options.maxWidth(this.element):this.options.maxWidth;
var a=(typeof(this.options.minHeight)=="function")?this.options.minHeight(this.element):this.options.minHeight;
var g=(typeof(this.options.maxHeight)=="function")?this.options.maxHeight(this.element):this.options.maxHeight;
if(f&&b[0]<=f){b[0]=f
}if(h&&b[0]>=h){b[0]=h
}if(a&&b[1]<=a){b[1]=a
}if(g&&b[1]>=g){b[1]=g
}var e=this.element.style;
if((!this.options.constraint)||(this.options.constraint=="horizontal")){e.width=b[0]+"px"
}if((!this.options.constraint)||(this.options.constraint=="vertical")){e.height=b[1]+"px"
}if(e.visibility=="hidden"){e.visibility=""
}}};
if(typeof(Control)=="undefined"){Control={}
}var $proc=function(a){return typeof(a)=="function"?a:function(){return a
}
};
var $value=function(a){return typeof(a)=="function"?a():a
};
Object.Event={extend:function(a){a._objectEventSetup=function(b){this._observers=this._observers||{};
this._observers[b]=this._observers[b]||[]
};
a.observe=function(f,b){if(typeof(f)=="string"&&typeof(b)!="undefined"){this._objectEventSetup(f);
if(!this._observers[f].include(b)){this._observers[f].push(b)
}}else{for(var d in f){this.observe(d,f[d])
}}};
a.stopObserving=function(d,b){this._objectEventSetup(d);
if(d&&b){this._observers[d]=this._observers[d].without(b)
}else{if(d){this._observers[d]=[]
}else{this._observers={}
}}};
a.observeOnce=function(e,d){var b=function(){d.apply(this,arguments);
this.stopObserving(e,b)
}.bind(this);
this._objectEventSetup(e);
this._observers[e].push(b)
};
a.notify=function(h){this._objectEventSetup(h);
var f=[];
var d=$A(arguments).slice(1);
try{for(var b=0;
b<this._observers[h].length;
++b){f.push(this._observers[h][b].apply(this._observers[h][b],d)||null)
}}catch(g){if(g==$break){return false
}else{throw g
}}return f
};
if(a.prototype){a.prototype._objectEventSetup=a._objectEventSetup;
a.prototype.observe=a.observe;
a.prototype.stopObserving=a.stopObserving;
a.prototype.observeOnce=a.observeOnce;
a.prototype.notify=function(h){if(a.notify){var d=$A(arguments).slice(1);
d.unshift(this);
d.unshift(h);
a.notify.apply(a,d)
}this._objectEventSetup(h);
var d=$A(arguments).slice(1);
var f=[];
try{if(this.options&&this.options[h]&&typeof(this.options[h])=="function"){f.push(this.options[h].apply(this,d)||null)
}for(var b=0;
b<this._observers[h].length;
++b){f.push(this._observers[h][b].apply(this._observers[h][b],d)||null)
}}catch(g){if(g==$break){return false
}else{throw g
}}return f
}
}}};
Element.addMethods({observeOnce:function(a,b,e){var d=function(){e.apply(this,arguments);
Element.stopObserving(a,b,d)
};
Element.observe(a,b,d)
}});
Object.extend(Event,(function(){var k=Event.cache;
function a(l){if(l._prototypeEventID){return l._prototypeEventID[0]
}arguments.callee.id=arguments.callee.id||1;
return l._prototypeEventID=[++arguments.callee.id]
}function f(l){if(l&&l.include(":")){return"dataavailable"
}if(!Prototype.Browser.IE){l={mouseenter:"mouseover",mouseleave:"mouseout"}[l]||l
}return l
}function j(l){return k[l]=k[l]||{}
}function e(n,l){var m=j(n);
return m[l]=m[l]||[]
}function g(m,l,n){var q=a(m);
var p=e(q,l);
if(p.pluck("handler").include(n)){return false
}var o=function(r){if(!Event||!Event.extend||(r.eventName&&r.eventName!=l)){return false
}Event.extend(r);
n.call(m,r)
};
if(!(Prototype.Browser.IE)&&["mouseenter","mouseleave"].include(l)){o=o.wrap(function(t,s){var r=s.relatedTarget;
var u=s.currentTarget;
if(r&&r.nodeType==Node.TEXT_NODE){r=r.parentNode
}if(r&&r!=u&&!r.descendantOf(u)){return t(s)
}})
}o.handler=n;
p.push(o);
return o
}function h(o,l,m){var n=e(o,l);
return n.find(function(p){return p.handler==m
})
}function b(o,l,m){var n=j(o);
if(!n[l]){return false
}n[l]=n[l].without(h(o,l,m))
}function d(){for(var m in k){for(var l in k[m]){k[m][l]=null
}}}if(window.attachEvent){window.attachEvent("onunload",d)
}return{observe:function(n,l,o){n=$(n);
var m=f(l);
var p=g(n,l,o);
if(!p){return n
}if(n.addEventListener){n.addEventListener(m,p,false)
}else{n.attachEvent("on"+m,p)
}return n
},stopObserving:function(n,l,o){n=$(n);
var q=a(n),m=f(l);
if(!o&&l){e(q,l).each(function(r){n.stopObserving(l,r.handler)
});
return n
}else{if(!l){Object.keys(j(q)).each(function(r){n.stopObserving(r)
});
return n
}}var p=h(q,l,o);
if(!p){return n
}if(n.removeEventListener){n.removeEventListener(m,p,false)
}else{n.detachEvent("on"+m,p)
}b(q,l,o);
return n
},fire:function(n,m,l){n=$(n);
if(n==document&&document.createEvent&&!n.dispatchEvent){n=document.documentElement
}var o;
if(document.createEvent){o=document.createEvent("HTMLEvents");
o.initEvent("dataavailable",true,true)
}else{o=document.createEventObject();
o.eventType="ondataavailable"
}o.eventName=m;
o.memo=l||{};
if(document.createEvent){n.dispatchEvent(o)
}else{n.fireEvent(o.eventType,o)
}return Event.extend(o)
}}
})());
Object.extend(Event,Event.Methods);
Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});
Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});
(function(){function a(d){var e;
if(d.wheelDelta){e=d.wheelDelta/120
}else{if(d.detail){e=-d.detail/3
}}if(!e){return
}var b=Event.element(d).fire("mouse:wheel",{delta:e});
if(b.stopped){Event.stop(d);
return false
}}document.observe("mousewheel",a);
document.observe("DOMMouseScroll",a)
})();
var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});
$(document.body).insert(this.element)
},hide:function(){this.element.hide();
return this
},show:function(){this.element.show();
return this
},positionUnder:function(b){var b=$(b);
var a=b.cumulativeOffset();
var d=b.getDimensions();
this.element.setStyle({left:a[0]+"px",top:a[1]+"px",width:d.width+"px",height:d.height+"px",zIndex:b.getStyle("zIndex")-1}).show();
return this
},setBounds:function(a){for(prop in a){a[prop]+="px"
}this.element.setStyle(a);
return this
},destroy:function(){if(this.element){this.element.remove()
}return this
}});
if(typeof(Prototype)=="undefined"){throw"Control.ContextMenu requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.ContextMenu requires Object.Event to be loaded."
}Control.ContextMenu=Class.create({initialize:function(a,b){Control.ContextMenu.load();
this.options=Object.extend({leftClick:false,disableOnShiftKey:true,disableOnAltKey:true,selectedClassName:"selected",activatedClassName:"activated",animation:true,animationCycles:2,animationLength:300,delayCallback:true},b||{});
this.activated=false;
this.items=this.options.items||[];
this.container=$(a);
this.container.observe(this.options.leftClick?"click":(Prototype.Browser.Opera?"click":"contextmenu"),function(d){if(!Control.ContextMenu.enabled||Prototype.Browser.Opera&&!d.ctrlKey){return
}this.open(d)
}.bindAsEventListener(this))
},open:function(a){if(Control.ContextMenu.current&&!Control.ContextMenu.current.close()){return
}if(this.notify("beforeOpen",a)===false){return false
}this.buildMenu();
if(this.items.length===0){this.close(a);
return false
}Control.ContextMenu.current=this;
Control.ContextMenu.positionContainer(a);
Control.ContextMenu.container.show();
if(this.notify("afterOpen",a)===false){return false
}a.stop();
return true
},close:function(a){if(a){a.stop()
}if(this.notify("beforeClose")===false){return false
}Control.ContextMenu.current=false;
this.activated=false;
Control.ContextMenu.container.removeClassName(this.options.activatedClassName);
Control.ContextMenu.container.select("li").invoke("stopObserving");
Control.ContextMenu.container.hide();
Control.ContextMenu.container.update("");
if(this.notify("afterClose")===false){return false
}return true
},buildMenu:function(){var a=document.createElement("ul");
Control.ContextMenu.container.appendChild(a);
this.items.each(function(d){if(!(!d.condition||d.condition&&d.condition()!==false)){return
}var b=$(document.createElement("li"));
b.update($value(d.label));
a.appendChild(b);
b[$value(d.enabled)?"removeClassName":"addClassName"]("disabled");
b.observe("mousedown",function(f,e){if(!$value(e.enabled)){return f.stop()
}this.activated=$value(e.label)
}.bindAsEventListener(this,d));
b.observe("click",this.selectMenuItem.bindAsEventListener(this,d,b));
b.observe("contextmenu",this.selectMenuItem.bindAsEventListener(this,d,b))
}.bind(this))
},addItem:function(a){if(!("enabled" in a)){a.enabled=true
}this.items.push(a);
return this
},destroy:function(){this.container.stopObserving(Prototype.Browser.Opera||this.options.leftClick?"click":"contextmenu");
this.items=[]
},selectMenuItem:function(a,d,b){if(!$value(d.enabled)){return a.stop()
}if(!this.activated||this.activated==$value(d.label)){if(this.options.animation){Control.ContextMenu.container.addClassName(this.options.activatedClassName);
$A($R(0,this.options.animationCycles*2)).each(function(e){window.setTimeout(function(){b.toggleClassName(this.options.selectedClassName)
}.bind(this),e*parseInt(this.options.animationLength/(this.options.animationCycles*2),10))
}.bind(this));
window.setTimeout(function(){if(this.close()&&this.options.delayCallback){d.callback()
}}.bind(this),this.options.animationLength);
if(!this.options.delayCallback){d.callback()
}}else{if(this.close()){d.callback()
}}}a.stop();
return false
}});
Object.extend(Control.ContextMenu,{loaded:false,capture_all:false,menus:[],current:false,enabled:false,offset:4,load:function(a){if(Control.ContextMenu.loaded){return
}Control.ContextMenu.loaded=true;
if(typeof(a)=="undefined"){a=false
}Control.ContextMenu.capture_all=a;
Control.ContextMenu.container=$(document.createElement("div"));
Control.ContextMenu.container.id="control_contextmenu";
Control.ContextMenu.container.style.position="absolute";
Control.ContextMenu.container.style.zIndex=99999;
Control.ContextMenu.container.hide();
document.body.appendChild(Control.ContextMenu.container);
Control.ContextMenu.enable()
},enable:function(){Control.ContextMenu.enabled=true;
Event.observe(document.body,"click",Control.ContextMenu.onClick);
if(Control.ContextMenu.capture_all){Event.observe(document.body,"contextmenu",Control.ContextMenu.onContextMenu)
}},disable:function(){Event.stopObserving(document.body,"click",Control.ContextMenu.onClick);
if(Control.ContextMenu.capture_all){Event.stopObserving(document.body,"contextmenu",Control.ContextMenu.onContextMenu)
}},onContextMenu:function(a){a.stop();
return false
},onClick:function(){if(Control.ContextMenu.current){Control.ContextMenu.current.close()
}},positionContainer:function(g){var f=Control.ContextMenu.container.getDimensions();
var a=Event.pointerY(g);
var j=Event.pointerX(g);
var b=f.height+a;
var d=f.width+j;
var e=document.viewport.getDimensions();
var h=document.viewport.getScrollOffsets();
if(b>e.height+h.top){a-=b-((e.height+h.top)-Control.ContextMenu.offset)
}if(d>e.width+h.left){j-=d-((e.width+h.left)-Control.ContextMenu.offset)
}Control.ContextMenu.container.setStyle({top:a+"px",left:j+"px"})
}});
Object.Event.extend(Control.ContextMenu);
if(typeof(Prototype)=="undefined"){throw"Cookie requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Cookie requires Object.Event to be loaded."
}var Cookie={build:function(){return $A(arguments).compact().join("; ")
},secondsFromNow:function(b){var a=new Date();
a.setTime(a.getTime()+(b*1000));
return a.toGMTString()
},set:function(d,a,b){Cookie.notify("set",d,a);
var e=b?"expires="+Cookie.secondsFromNow(b):null;
document.cookie=Cookie.build(d+"="+a,e,"path=/")
},get:function(a){Cookie.notify("get",a);
var b=new RegExp(a+"=([^;]+)").exec(document.cookie);
return b?b[1]:null
},unset:function(a){Cookie.notify("unset",a);
Cookie.set(a,"",-1)
}};
Object.Event.extend(Cookie);
if(typeof(Prototype)=="undefined"){throw"Event.Behavior requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Event.Behavior requires Object.Event to be loaded."
}Event.Behavior={addVerbs:function(a){for(name in a){v=new Event.Behavior.Verb(a[name]);
Event.Behavior.Verbs[name]=v;
Event.Behavior[name.underscore()]=Event.Behavior[name]=v.getCallbackForStack.bind(v)
}},addEvents:function(a){$H(a).each(function(b){Event.Behavior.Adjective.prototype[b.key.underscore()]=Event.Behavior.Adjective.prototype[b.key]=function(){this.nextConditionType="and";
this.events.push(b.value);
this.attachObserver(false);
return this
}
})
},invokeElementMethod:function(d,a,b){if(typeof(d)=="function"){return $A(d()).each(function(e){if(typeof(b[0])=="function"){return $A(b[0]).each(function(f){return $(e)[a].apply($(e),(f?[f]:[]))
})
}else{return $(e)[a].apply($(e),b||[])
}})
}else{return $(d)[a].apply($(d),b||[])
}}};
Event.Behavior.Verbs=$H({});
Event.Behavior.Verb=Class.create();
Object.extend(Event.Behavior.Verb.prototype,{originalAction:false,execute:false,executeOpposite:false,target:false,initialize:function(a){this.originalAction=a;
this.execute=function(d,e,b){return(b)?d(e,b):d(e)
}.bind(this,a)
},setOpposite:function(a){opposite_action=a.originalAction;
this.executeOpposite=function(b,e,d){return(d)?b(e,d):b(e)
}.bind(this,opposite_action)
},getCallbackForStack:function(a){return new Event.Behavior.Noun(this,a)
}});
Event.Behavior.addVerbs({call:function(a){a()
},show:function(a){return Event.Behavior.invokeElementMethod(a,"show")
},hide:function(a){return Event.Behavior.invokeElementMethod(a,"hide")
},remove:function(a){return Event.Behavior.invokeElementMethod(a,"remove")
},setStyle:function(a,b){return Event.Behavior.invokeElementMethod(a,"setStyle",[(typeof(b)=="function"?b():b)])
},addClassName:function(a,b){return Event.Behavior.invokeElementMethod(a,"addClassName",[(typeof(b)=="function"?b():b)])
},removeClassName:function(a,b){return Event.Behavior.invokeElementMethod(a,"removeClassName",[(typeof(b)=="function"?b():b)])
},setClassName:function(a,b){c=(typeof(b)=="function")?b():b;
if(typeof(a)=="function"){return $A(a()).each(function(d){$(d).className=c
})
}else{return $(a).className=c
}},update:function(b,a){return Event.Behavior.invokeElementMethod(a,"update",[(typeof(b)=="function"?b():b)])
},replace:function(b,a){return Event.Behavior.invokeElementMethod(a,"replace",[(typeof(b)=="function"?b():b)])
}});
Event.Behavior.Verbs.show.setOpposite(Event.Behavior.Verbs.hide);
Event.Behavior.Verbs.hide.setOpposite(Event.Behavior.Verbs.show);
Event.Behavior.Verbs.addClassName.setOpposite(Event.Behavior.Verbs.removeClassName);
Event.Behavior.Verbs.removeClassName.setOpposite(Event.Behavior.Verbs.addClassName);
Event.Behavior.Noun=Class.create();
Object.extend(Event.Behavior.Noun.prototype,{verbs:false,verb:false,argument:false,subject:false,target:false,initialize:function(b,a){this.verb=b;
this.argument=a
},execute:function(){return(this.target)?this.verb.execute(this.target,this.argument):this.verb.execute(this.argument)
},executeOpposite:function(){return(this.target)?this.verb.executeOpposite(this.target,this.argument):this.verb.executeOpposite(this.argument)
},when:function(a){this.subject=a;
return new Event.Behavior.Adjective(this)
},getValue:function(){return Try.these(function(){return $(this.subject).getValue()
}.bind(this),function(){return $(this.subject).options[$(this.subject).options.selectedIndex].value
}.bind(this),function(){return $(this.subject).value
}.bind(this),function(){return $(this.subject).innerHTML
}.bind(this))
},containsValue:function(a){value=this.getValue();
if(typeof(a)=="function"){return $A(a()).include(value)
}else{return value.match(a)
}},setTarget:function(a){this.target=a;
return this
},and:function(){}});
Event.Behavior.Noun.prototype._with=Event.Behavior.Noun.prototype.setTarget;
Event.Behavior.Noun.prototype.on=Event.Behavior.Noun.prototype.setTarget;
Event.Behavior.Noun.prototype.of=Event.Behavior.Noun.prototype.setTarget;
Event.Behavior.Noun.prototype.to=Event.Behavior.Noun.prototype.setTarget;
Event.Behavior.Noun.prototype.from=Event.Behavior.Noun.prototype.setTarget;
Event.Behavior.Adjective=Class.create();
Object.extend(Event.Behavior.Adjective.prototype,{noun:false,lastConditionName:"",nextConditionType:"and",conditions:$A([]),events:$A([]),attached:false,initialize:function(a){this.conditions=$A([]);
this.events=$A([]);
this.noun=a
},attachObserver:function(a){if(this.attached){if(a){this.execute()
}return
}this.attached=true;
if(typeof(this.noun.subject)=="function"){$A(this.noun.subject()).each(function(b){(this.events.length>0?this.events:$A(["change"])).each(function(d){(b.observe?b:$(b)).observe(d,function(){this.execute()
}.bind(this))
}.bind(this))
}.bind(this))
}else{(this.events.length>0?this.events:$A(["change"])).each(function(b){$(this.noun.subject).observe(b,function(){this.execute()
}.bind(this))
}.bind(this))
}if(a){this.execute()
}},execute:function(){if(this.match()){return this.noun.execute()
}else{if(this.noun.verb.executeOpposite){this.noun.executeOpposite()
}}},attachCondition:function(a){this.conditions.push([this.nextConditionType,a.bind(this)])
},match:function(){if(this.conditions.length==0){return true
}else{return this.conditions.inject(new Boolean(),function(a,b){return(b[0]=="and")?(a&&b[1]()):(a||b[1]())
})
}},is:function(a){this.lastConditionName="is";
this.attachCondition(function(b){return(typeof(b)=="function"?b():b)==this.noun.getValue()
}.bind(this,a));
this.attachObserver(true);
return this
},isNot:function(a){this.lastConditionName="isNot";
this.attachCondition(function(b){return(typeof(b)=="function"?b():b)!=this.noun.getValue()
}.bind(this,a));
this.attachObserver(true);
return this
},contains:function(a){this.lastConditionName="contains";
this.attachCondition(function(b){return this.noun.containsValue(b)
}.bind(this,a));
this.attachObserver(true);
return this
},within:function(a){this.lastConditionName="within";
this.attachCondition(function(b){}.bind(this,a));
this.attachObserver(true);
return this
},change:function(){this.nextConditionType="and";
this.attachObserver(true);
return this
},and:function(a){this.attached=false;
this.nextConditionType="and";
if(a){this[this.lastConditionName](a)
}return this
},or:function(a){this.attached=false;
this.nextConditionType="or";
if(a){this[this.lastConditionName](a)
}return this
}});
Event.Behavior.addEvents({losesFocus:"blur",gainsFocus:"focus",isClicked:"click",isDoubleClicked:"dblclick",keyPressed:"keypress"});
Event.Behavior.Adjective.prototype.is_not=Event.Behavior.Adjective.prototype.isNot;
Event.Behavior.Adjective.prototype.include=Event.Behavior.Adjective.prototype.contains;
Event.Behavior.Adjective.prototype.includes=Event.Behavior.Adjective.prototype.contains;
Event.Behavior.Adjective.prototype.are=Event.Behavior.Adjective.prototype.is;
Event.Behavior.Adjective.prototype.areNot=Event.Behavior.Adjective.prototype.isNot;
Event.Behavior.Adjective.prototype.are_not=Event.Behavior.Adjective.prototype.isNot;
Event.Behavior.Adjective.prototype.changes=Event.Behavior.Adjective.prototype.change;
if(typeof(Prototype)=="undefined"){throw"HotKey requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"HotKey requires Object.Event to be loaded."
}var HotKey=Class.create({initialize:function(d,a,b){d=d.toUpperCase();
HotKey.hotkeys.push(this);
this.options=Object.extend({element:false,shiftKey:false,altKey:false,ctrlKey:true},b||{});
this.letter=d;
this.callback=a;
this.element=$(this.options.element||document);
this.handler=function(e){if(!e||((Event["KEY_"+this.letter]||this.letter.charCodeAt(0))==e.keyCode&&((!this.options.shiftKey||(this.options.shiftKey&&e.shiftKey))&&(!this.options.altKey||(this.options.altKey&&e.altKey))&&(!this.options.ctrlKey||(this.options.ctrlKey&&e.ctrlKey))))){if(this.notify("beforeCallback",e)===false){return
}this.callback(e);
this.notify("afterCallback",e)
}}.bind(this);
this.enable()
},trigger:function(){this.handler()
},enable:function(){this.element.observe("keydown",this.handler)
},disable:function(){this.element.stopObserving("keydown",this.handler)
},destroy:function(){this.disable();
HotKey.hotkeys=HotKey.hotkeys.without(this)
}});
Object.extend(HotKey,{hotkeys:[]});
Object.Event.extend(HotKey);
if(typeof(Control)=="undefined"){Control={}
}if(typeof(Object.Event)=="undefined"){throw"Control.Pagination requires Object.Event to be loaded."
}Control.Paginator=Class.create({initialize:function(a,b){this.items=a;
this.options=Object.extend({size:10,onPageChange:Prototype.emptyFunction,onItemChange:Prototype.emptyFunction},b||{});
this.setSize(this.options.size);
this.page_index=1;
this.item_index=0
},setSize:function(a){this.options.size=a;
this.number_of_pages=Math.ceil(this.items.length/this.options.size)
},pageIndexFromItemIndex:function(a){return Math.floor(((a||this.item_index)/this.options.size)+1)
},goToPage:function(a){this.page_index=a;
this.triggerOnPageChange()
},triggerOnPageChange:function(){this.notify("onPageChange",this.items.slice((this.page_index-1)*this.options.size,((this.page_index-1)*this.options.size)+this.options.size),this.page_index)
},goToItem:function(a){this.item_index=a;
this.notify("onItemChange",this.items[this.item_index],this.item_index);
var b=this.pageIndexFromItemIndex(this.item_index);
if(b!=this.page_index){this.goToPage(b)
}},hasNextItem:function(){return this.item_index<this.items.length-1
},hasPreviousItem:function(){return this.item_index>=1
},nextItem:function(){if(!this.hasNextItem()){return false
}this.goToItem(this.item_index+1);
return true
},previousItem:function(){if(!this.hasPreviousItem()){return false
}this.goToItem(this.item_index-1);
return true
},hasNextPage:function(){return this.page_index<this.number_of_pages
},hasPreviousPage:function(){return this.page_index>=2
},nextPage:function(){if(!this.hasNextPage()){return false
}this.goToPage(this.page_index+1);
return true
},previousPage:function(){if(!this.hasPreviousPage()){return false
}this.goToPage(this.page_index-1);
return true
}});
Object.Event.extend(Control.Paginator);
if(typeof(Prototype)=="undefined"){throw"Control.ProgressBar requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.ProgressBar requires Object.Event to be loaded."
}Control.ProgressBar=Class.create({initialize:function(a,b){this.progress=0;
this.executer=false;
this.active=false;
this.poller=false;
this.container=$(a);
this.containerWidth=this.container.getDimensions().width-(parseInt(this.container.getStyle("border-right-width").replace(/px/,""))+parseInt(this.container.getStyle("border-left-width").replace(/px/,"")));
this.progressContainer=$(document.createElement("div"));
this.progressContainer.setStyle({width:this.containerWidth+"px",height:"100%",position:"absolute",top:"0px",right:"0px"});
this.container.appendChild(this.progressContainer);
this.options={afterChange:Prototype.emptyFunction,interval:0.25,step:1,classNames:{active:"progress_bar_active",inactive:"progress_bar_inactive"}};
Object.extend(this.options,b||{});
this.container.addClassName(this.options.classNames.inactive);
this.active=false
},setProgress:function(a){this.progress=a;
this.draw();
if(this.progress>=100){this.stop(false)
}this.notify("afterChange",this.progress,this.active)
},poll:function(b,a){this.active=true;
this.poller=new PeriodicalExecuter(function(){new Ajax.Request(b,{onSuccess:function(d){this.setProgress(parseInt(d.responseText));
if(!this.active){this.poller.stop()
}}.bind(this)})
}.bind(this),a||3)
},start:function(){this.active=true;
this.container.removeClassName(this.options.classNames.inactive);
this.container.addClassName(this.options.classNames.active);
this.executer=new PeriodicalExecuter(this.step.bind(this,this.options.step),this.options.interval)
},stop:function(a){this.active=false;
if(this.executer){this.executer.stop()
}this.container.removeClassName(this.options.classNames.active);
this.container.addClassName(this.options.classNames.inactive);
if(typeof(a)=="undefined"||a==true){this.reset()
}},step:function(a){this.active=true;
this.setProgress(Math.min(100,this.progress+a))
},reset:function(){this.active=false;
this.setProgress(0)
},draw:function(){this.progressContainer.setStyle({width:(this.containerWidth-Math.floor((parseInt(this.progress)/100)*this.containerWidth))+"px"})
},notify:function(a){if(this.options[a]){return[this.options[a].apply(this.options[a],$A(arguments).slice(1))]
}}});
Object.Event.extend(Control.ProgressBar);
if(typeof(Prototype)=="undefined"){throw"Control.Rating requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.Rating requires Object.Event to be loaded."
}Control.Rating=Class.create({initialize:function(b,a){Control.Rating.instances.push(this);
this.value=false;
this.links=[];
this.container=$(b);
this.container.update("");
this.options={min:1,max:5,rated:false,input:false,reverse:false,capture:true,multiple:false,classNames:{off:"rating_off",half:"rating_half",on:"rating_on",selected:"rating_selected"},updateUrl:false,updateParameterName:"value",afterChange:Prototype.emptyFunction};
Object.extend(this.options,a||{});
if(this.options.value){this.value=this.options.value;
delete this.options.value
}if(this.options.input){this.options.input=$(this.options.input);
this.options.input.observe("change",function(e){this.setValueFromInput(e)
}.bind(this,this.options.input));
this.setValueFromInput(this.options.input,true)
}var d=$R(this.options.min,this.options.max);
(this.options.reverse?$A(d).reverse():d).each(function(e){var f=this.buildLink(e);
this.container.appendChild(f);
this.links.push(f)
}.bind(this));
this.setValue(this.value||this.options.min-1,false,true)
},buildLink:function(a){var b=$(document.createElement("a"));
b.value=a;
if(this.options.multiple||(!this.options.rated&&!this.options.multiple)){b.href="";
b.onmouseover=this.mouseOver.bind(this,b);
b.onmouseout=this.mouseOut.bind(this,b);
b.onclick=this.click.bindAsEventListener(this,b)
}else{b.style.cursor="default";
b.observe("click",function(d){Event.stop(d);
return false
}.bindAsEventListener(this))
}b.addClassName(this.options.classNames.off);
return b
},disable:function(){this.links.each(function(a){a.onmouseover=Prototype.emptyFunction;
a.onmouseout=Prototype.emptyFunction;
a.onclick=Prototype.emptyFunction;
a.observe("click",function(b){Event.stop(b);
return false
}.bindAsEventListener(this));
a.style.cursor="default"
}.bind(this))
},setValueFromInput:function(a,b){this.setValue($F(a),true,b)
},setValue:function(f,d,e){this.value=f;
if(this.options.input){if(this.options.input.options){$A(this.options.input.options).each(function(h,a){if(h.value==this.value){this.options.input.options.selectedIndex=a;
throw $break
}}.bind(this))
}else{this.options.input.value=this.value
}}this.render(this.value,d);
if(!e){if(this.options.updateUrl){var g={},b;
g[this.options.updateParameterName]=this.value;
b=new Ajax.Request(this.options.updateUrl,{parameters:g})
}this.notify("afterChange",this.value)
}},render:function(b,a){(this.options.reverse?this.links.reverse():this.links).each(function(e,d){if(e.value<=Math.ceil(b)){e.className=this.options.classNames[e.value<=b?"on":"half"];
if(this.options.rated||a){e.addClassName(this.options.classNames.selected)
}}else{e.className=this.options.classNames.off
}}.bind(this))
},mouseOver:function(a){this.render(a.value,true)
},mouseOut:function(a){this.render(this.value)
},click:function(b,a){this.options.rated=true;
this.setValue((a.value?a.value:a),true);
if(!this.options.multiple){this.disable()
}if(this.options.capture){Event.stop(b);
return false
}}});
Object.extend(Control.Rating,{instances:[],findByElementId:function(a){return Control.Rating.instances.find(function(b){return(b.container.id&&b.container.id==a)
})
}});
Object.Event.extend(Control.Rating);
if(typeof(Prototype)=="undefined"){throw"Control.ScrollBar requires Prototype to be loaded."
}if(typeof(Control.Slider)=="undefined"){throw"Control.ScrollBar requires Control.Slider to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.ScrollBar requires Object.Event to be loaded."
}Control.ScrollBar=Class.create({initialize:function(d,b,a){this.enabled=false;
this.notificationTimeout=false;
this.container=$(d);
this.boundMouseWheelEvent=this.onMouseWheel.bindAsEventListener(this);
this.boundResizeObserver=this.onWindowResize.bind(this);
this.track=$(b);
this.handle=this.track.firstDescendant();
this.options=Object.extend({active_class_name:"scrolling",apply_active_class_name_to:this.container,notification_timeout_length:125,handle_minimum_height:25,scroll_to_smoothing:0.01,scroll_to_steps:15,proportional:true,slider_options:{}},a||{});
this.slider=new Control.Slider(this.handle,this.track,Object.extend({axis:"vertical",onSlide:this.onChange.bind(this),onChange:this.onChange.bind(this)},this.options.slider_options));
this.recalculateLayout();
Event.observe(window,"resize",this.boundResizeObserver);
this.handle.observe("mousedown",function(){if(this.auto_sliding_executer){this.auto_sliding_executer.stop()
}}.bind(this))
},destroy:function(){Event.stopObserving(window,"resize",this.boundResizeObserver)
},enable:function(){this.enabled=true;
this.container.observe("mouse:wheel",this.boundMouseWheelEvent);
this.slider.setEnabled();
this.track.show();
if(this.options.active_class_name){$(this.options.apply_active_class_name_to).addClassName(this.options.active_class_name)
}this.notify("enabled")
},disable:function(){this.enabled=false;
this.container.stopObserving("mouse:wheel",this.boundMouseWheelEvent);
this.slider.setDisabled();
this.track.hide();
if(this.options.active_class_name){$(this.options.apply_active_class_name_to).removeClassName(this.options.active_class_name)
}this.notify("disabled");
this.reset()
},reset:function(){this.slider.setValue(0)
},recalculateLayout:function(){if(this.container.scrollHeight<=this.container.offsetHeight){this.disable()
}else{this.slider.trackLength=this.slider.maximumOffset()-this.slider.minimumOffset();
if(this.options.proportional){this.handle.style.height=Math.max(this.container.offsetHeight*(this.container.offsetHeight/this.container.scrollHeight),this.options.handle_minimum_height)+"px";
this.slider.handleLength=this.handle.style.height.replace(/px/,"")
}this.enable()
}},onWindowResize:function(){this.recalculateLayout();
this.scrollBy(0)
},onMouseWheel:function(a){if(this.auto_sliding_executer){this.auto_sliding_executer.stop()
}this.slider.setValueBy(-(a.memo.delta/20));
a.stop();
return false
},onChange:function(a){this.container.scrollTop=Math.round(a/this.slider.maximum*(this.container.scrollHeight-this.container.offsetHeight));
if(this.notification_timeout){window.clearTimeout(this.notificationTimeout)
}this.notificationTimeout=window.setTimeout(function(){this.notify("change",a)
}.bind(this),this.options.notification_timeout_length)
},getCurrentMaximumDelta:function(){return this.slider.maximum*(this.container.scrollHeight-this.container.offsetHeight)
},getDeltaToElement:function(a){return this.slider.maximum*((a.positionedOffset().top+(a.getHeight()/2))-(this.container.getHeight()/2))
},scrollTo:function(d,e){var g=this.getCurrentMaximumDelta();
if(d=="top"){d=0
}else{if(d=="bottom"){d=g
}else{if(typeof(d)!="number"){d=this.getDeltaToElement($(d))
}}}if(this.enabled){d=Math.max(0,Math.min(d,g));
if(this.auto_sliding_executer){this.auto_sliding_executer.stop()
}var f=d/g;
var b=this.slider.value;
var a=(f-b)*g;
if(e){this.auto_sliding_executer=new PeriodicalExecuter(function(){if(Math.round(this.slider.value*100)/100<Math.round(f*100)/100||Math.round(this.slider.value*100)/100>Math.round(f*100)/100){this.scrollBy(a/this.options.scroll_to_steps)
}else{this.auto_sliding_executer.stop();
this.auto_sliding_executer=null;
if(typeof(e)=="function"){e()
}}}.bind(this),this.options.scroll_to_smoothing)
}else{this.scrollBy(a)
}}else{if(typeof(e)=="function"){e()
}}},scrollBy:function(a){if(!this.enabled){return false
}this.slider.setValueBy(a/this.getCurrentMaximumDelta())
}});
Object.Event.extend(Control.ScrollBar);
if(typeof(Prototype)=="undefined"){throw"Control.Selection requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.Selection requires Object.Event to be loaded."
}Control.Selection={options:{resize_layout_timeout:125,selected:Prototype.emptyFunction,deselected:Prototype.emptyFunction,change:Prototype.emptyFunction,selection_id:"control_selection",selection_style:{zIndex:999,cursor:"default",border:"1px dotted #000"},filter:function(a){return true
},drag_proxy:false,drag_proxy_threshold:1,drag_proxy_options:{}},selectableElements:[],elements:[],selectableObjects:[],objects:[],active:false,container:false,resizeTimeout:false,load:function(b){Control.Selection.options=Object.extend(Control.Selection.options,b||{});
Control.Selection.selection_div=$(document.createElement("div"));
Control.Selection.selection_div.id=Control.Selection.options.selection_id;
Control.Selection.selection_div.style.display="none";
Control.Selection.selection_div.setStyle(Control.Selection.options.selection_style);
Control.Selection.border_width=parseInt(Control.Selection.selection_div.getStyle("border-top-width"))*2;
Control.Selection.container=Prototype.Browser.IE?window.container:window;
$(document.body).insert(Control.Selection.selection_div);
Control.Selection.enable();
if(Control.Selection.options.drag_proxy&&typeof(Draggable)!="undefined"){Control.Selection.DragProxy.load()
}Event.observe(window,"resize",function(){if(Control.Selection.resizeTimeout){window.clearTimeout(Control.Selection.resizeTimeout)
}Control.Selection.resizeTimeout=window.setTimeout(Control.Selection.recalculateLayout,Control.Selection.options.resize_layout_timeout)
});
if(Prototype.Browser.IE){var a=$$("body").first();
a.observe("mouseleave",Control.Selection.stop);
a.observe("mouseup",Control.Selection.stop)
}},enable:function(){if(Prototype.Browser.IE){document.onselectstart=function(){return false
}
}Event.observe(Control.Selection.container,"mousedown",Control.Selection.start);
Event.observe(Control.Selection.container,"mouseup",Control.Selection.stop)
},disable:function(){if(Prototype.Browser.IE){document.onselectstart=function(){return true
}
}Event.stopObserving(Control.Selection.container,"mousedown",Control.Selection.start);
Event.stopObserving(Control.Selection.container,"mouseup",Control.Selection.stop)
},recalculateLayout:function(){Control.Selection.selectableElements.each(function(e){var a=e.getDimensions();
var b=e.cumulativeOffset();
var d=e.cumulativeScrollOffset();
if(!e._control_selection){e._control_selection={}
}e._control_selection.top=b[1]-d[1];
e._control_selection.left=b[0]-d[0];
e._control_selection.width=a.width;
e._control_selection.height=a.height
})
},addSelectable:function(f,e,a,b){f=$(f);
if(a){a=a.each?a:[a]
}var g=f.getDimensions();
var d=Position.cumulativeOffset(f);
f._control_selection={activation_targets:a,is_selected:false,top:d[1],left:d[0],width:g.width,height:g.height,activationTargetMouseMove:function(){Control.Selection.notify("activationTargetMouseMove",f);
if(a){a.each(function(h){h.stopObserving("mousemove",f._control_selection.activationTargetMouseMove)
})
}Control.Selection.DragProxy.container.stopObserving("mousemove",f._control_selection.activationTargetMouseMove)
},activationTargetMouseDown:function(h){if(!Control.Selection.elements.include(f)){Control.Selection.select(f)
}Control.Selection.DragProxy.start(h);
Control.Selection.DragProxy.container.hide();
if(a){a.each(function(j){j.observe("mousemove",f._control_selection.activationTargetMouseMove)
})
}Control.Selection.DragProxy.container.observe("mousemove",f._control_selection.activationTargetMouseMove)
},activationTargetClick:function(){Control.Selection.select(f);
if(typeof(b)=="function"){b()
}if(a){a.each(function(h){h.stopObserving("mousemove",f._control_selection.activationTargetMouseMove)
})
}Control.Selection.DragProxy.container.stopObserving("mousemove",f._control_selection.activationTargetMouseMove)
}};
f.onselectstart=function(){return false
};
f.unselectable="on";
f.style.MozUserSelect="none";
if(a){a.each(function(h){h.observe("mousedown",f._control_selection.activationTargetMouseDown);
h.observe("click",f._control_selection.activationTargetClick)
})
}Control.Selection.selectableElements.push(f);
Control.Selection.selectableObjects.push(e)
},removeSelectable:function(b){b=$(b);
if(b._control_selection.activation_targets){b._control_selection.activation_targets.each(function(d){d.stopObserving("mousedown",b._control_selection.activationTargetMouseDown)
});
b._control_selection.activation_targets.each(function(d){d.stopObserving("click",b._control_selection.activationTargetClick)
})
}b._control_selection=null;
b.onselectstart=function(){return true
};
b.unselectable="off";
b.style.MozUserSelect="";
var a=0;
Control.Selection.selectableElements.each(function(d,e){if(d==b){a=e;
throw $break
}});
Control.Selection.selectableElements=Control.Selection.selectableElements.without(b);
Control.Selection.selectableObjects=Control.Selection.selectableObjects.slice(0,a).concat(Control.Selection.selectableObjects.slice(a+1))
},select:function(a){if(typeof(a)=="undefined"||!a){a=[]
}if(!a.each&&!a._each){a=[a]
}var d=!(Control.Selection.elements.length==a.length&&Control.Selection.elements.all(function(g,f){return a[f]==g
}));
if(!d){return
}var e={};
var b=a.collect(function(f){var g=Control.Selection.selectableObjects[Control.Selection.selectableElements.indexOf(f)];
e[f]=g;
return g
});
if(Control.Selection.elements.length==0&&a.length!=0){a.each(function(f){Control.Selection.notify("selected",f,e[f])
})
}else{Control.Selection.elements.each(function(f){if(!a.include(f)){Control.Selection.notify("deselected",f,e[f])
}});
a.each(function(f){if(!Control.Selection.elements.include(f)){Control.Selection.notify("selected",f,e[f])
}})
}Control.Selection.elements=a;
Control.Selection.objects=b;
Control.Selection.notify("change",Control.Selection.elements,Control.Selection.objects)
},deselect:function(){if(Control.Selection.notify("deselect")===false){return false
}Control.Selection.elements.each(function(a){Control.Selection.notify("deselected",a,Control.Selection.selectableObjects[Control.Selection.selectableElements.indexOf(a)])
});
Control.Selection.objects=[];
Control.Selection.elements=[];
Control.Selection.notify("change",Control.Selection.objects,Control.Selection.elements);
return true
},start:function(a){if(!a.isLeftClick()||Control.Selection.notify("start",a)===false){return false
}if(!a.shiftKey&&!a.altKey){Control.Selection.deselect()
}Event.observe(Control.Selection.container,"mousemove",Control.Selection.onMouseMove);
Event.stop(a);
return false
},stop:function(){Event.stopObserving(Control.Selection.container,"mousemove",Control.Selection.onMouseMove);
Control.Selection.active=false;
Control.Selection.selection_div.setStyle({display:"none",top:null,left:null,width:null,height:null});
Control.Selection.start_mouse_coordinates={};
Control.Selection.current_mouse_coordinates={}
},mouseCoordinatesFromEvent:function(a){return{x:Event.pointerX(a),y:Event.pointerY(a)}
},onClick:function(a,d,b){var e=[];
if(a.shiftKey){e=Control.Selection.elements.clone();
if(!e.include(d)){e.push(d)
}}else{if(a.altKey){e=Control.Selection.elements.clone();
if(e.include(d)){e=e.without(d)
}}else{e=[d]
}}Control.Selection.select(e);
if(b=="click"){Event.stop(a)
}},onMouseMove:function(b){if(!Control.Selection.active){Control.Selection.active=true;
Control.Selection.start_mouse_coordinates=Control.Selection.mouseCoordinatesFromEvent(b)
}else{Control.Selection.current_mouse_coordinates=Control.Selection.mouseCoordinatesFromEvent(b);
Control.Selection.drawSelectionDiv();
var a=Control.Selection.selectableElements.findAll(function(d){return Control.Selection.options.filter(d)&&Control.Selection.elementWithinSelection(d)
});
if(b.shiftKey&&!b.altKey){Control.Selection.elements.each(function(d){if(!a.include(d)){a.push(d)
}})
}else{if(b.altKey&&!b.shiftKey){a=Control.Selection.elements.findAll(function(d){return !a.include(d)
})
}}Control.Selection.select(a)
}},drawSelectionDiv:function(){if(Control.Selection.start_mouse_coordinates==Control.Selection.current_mouse_coordinates){Control.Selection.selection_div.style.display="none"
}else{Control.Selection.viewport=document.viewport.getDimensions();
Control.Selection.selection_div.style.position="absolute";
Control.Selection.current_direction=(Control.Selection.start_mouse_coordinates.y>Control.Selection.current_mouse_coordinates.y?"N":"S")+(Control.Selection.start_mouse_coordinates.x<Control.Selection.current_mouse_coordinates.x?"E":"W");
Control.Selection.selection_div.setStyle(Control.Selection["dimensionsFor"+Control.Selection.current_direction]());
Control.Selection.selection_div.style.display="block"
}},dimensionsForNW:function(){return{top:(Control.Selection.start_mouse_coordinates.y-(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y))+"px",left:(Control.Selection.start_mouse_coordinates.x-(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x))+"px",width:(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x)+"px",height:(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y)+"px"}
},dimensionsForNE:function(){return{top:(Control.Selection.start_mouse_coordinates.y-(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y))+"px",left:Control.Selection.start_mouse_coordinates.x+"px",width:Math.min((Control.Selection.viewport.width-Control.Selection.start_mouse_coordinates.x)-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.x-Control.Selection.start_mouse_coordinates.x)+"px",height:(Control.Selection.start_mouse_coordinates.y-Control.Selection.current_mouse_coordinates.y)+"px"}
},dimensionsForSE:function(){return{top:Control.Selection.start_mouse_coordinates.y+"px",left:Control.Selection.start_mouse_coordinates.x+"px",width:Math.min((Control.Selection.viewport.width-Control.Selection.start_mouse_coordinates.x)-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.x-Control.Selection.start_mouse_coordinates.x)+"px",height:Math.min((Control.Selection.viewport.height-Control.Selection.start_mouse_coordinates.y)-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.y-Control.Selection.start_mouse_coordinates.y)+"px"}
},dimensionsForSW:function(){return{top:Control.Selection.start_mouse_coordinates.y+"px",left:(Control.Selection.start_mouse_coordinates.x-(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x))+"px",width:(Control.Selection.start_mouse_coordinates.x-Control.Selection.current_mouse_coordinates.x)+"px",height:Math.min((Control.Selection.viewport.height-Control.Selection.start_mouse_coordinates.y)-Control.Selection.border_width,Control.Selection.current_mouse_coordinates.y-Control.Selection.start_mouse_coordinates.y)+"px"}
},inBoundsForNW:function(a,b){return(((a.left>b.left||a.right>b.left)&&b.right>a.left)&&((a.top>b.top||a.bottom>b.top)&&b.bottom>a.top))
},inBoundsForNE:function(a,b){return(((a.left<b.right||a.left<b.right)&&b.left<a.right)&&((a.top>b.top||a.bottom>b.top)&&b.bottom>a.top))
},inBoundsForSE:function(a,b){return(((a.left<b.right||a.left<b.right)&&b.left<a.right)&&((a.bottom<b.bottom||a.top<b.bottom)&&b.top<a.bottom))
},inBoundsForSW:function(a,b){return(((a.left>b.left||a.right>b.left)&&b.right>a.left)&&((a.bottom<b.bottom||a.top<b.bottom)&&b.top<a.bottom))
},elementWithinSelection:function(a){if(Control.Selection["inBoundsFor"+Control.Selection.current_direction]({top:a._control_selection.top,left:a._control_selection.left,bottom:a._control_selection.top+a._control_selection.height,right:a._control_selection.left+a._control_selection.width},{top:parseInt(Control.Selection.selection_div.style.top),left:parseInt(Control.Selection.selection_div.style.left),bottom:parseInt(Control.Selection.selection_div.style.top)+parseInt(Control.Selection.selection_div.style.height),right:parseInt(Control.Selection.selection_div.style.left)+parseInt(Control.Selection.selection_div.style.width)})){a._control_selection.is_selected=true;
return true
}else{a._control_selection.is_selected=false;
return false
}},DragProxy:{active:false,xorigin:0,yorigin:0,load:function(){Control.Selection.DragProxy.container=$(document.createElement("div"));
Control.Selection.DragProxy.container.id="control_selection_drag_proxy";
Control.Selection.DragProxy.container.setStyle({position:"absolute",top:"1px",left:"1px",zIndex:99999});
Control.Selection.DragProxy.container.hide();
document.body.appendChild(Control.Selection.DragProxy.container);
Control.Selection.observe("selected",Control.Selection.DragProxy.selected);
Control.Selection.observe("deselected",Control.Selection.DragProxy.deselected)
},start:function(a){if(a.isRightClick()){Control.Selection.DragProxy.container.hide();
return
}if(Control.Selection.DragProxy.xorigin==Event.pointerX(a)&&Control.Selection.DragProxy.yorigin==Event.pointerY(a)){return
}Control.Selection.DragProxy.active=true;
Control.Selection.DragProxy.container.setStyle({position:"absolute",top:Event.pointerY(a)+"px",left:Event.pointerX(a)+"px"});
Control.Selection.DragProxy.container.observe("mouseup",Control.Selection.DragProxy.onMouseUp);
Control.Selection.DragProxy.container.show();
Control.Selection.DragProxy.container._draggable=new Draggable(Control.Selection.DragProxy.container,Object.extend({onEnd:Control.Selection.DragProxy.stop},Control.Selection.options.drag_proxy_options));
Control.Selection.DragProxy.container._draggable.eventMouseDown(a);
Control.Selection.DragProxy.notify("start",Control.Selection.DragProxy.container,Control.Selection.elements)
},stop:function(){window.setTimeout(function(){Control.Selection.DragProxy.active=false;
Control.Selection.DragProxy.container.hide();
if(Control.Selection.DragProxy.container._draggable){Control.Selection.DragProxy.container._draggable.destroy();
Control.Selection.DragProxy.container._draggable=null
}Control.Selection.DragProxy.notify("stop")
},1)
},onClick:function(a){Control.Selection.DragProxy.xorigin=Event.pointerX(a);
Control.Selection.DragProxy.yorigin=Event.pointerY(a);
if(a.isRightClick()){Control.Selection.DragProxy.container.hide()
}if(Control.Selection.elements.length>=Control.Selection.options.drag_proxy_threshold&&!(a.shiftKey||a.altKey)&&(Control.Selection.DragProxy.xorigin!=Event.pointerX(a)||Control.Selection.DragProxy.yorigin!=Event.pointerY(a))){Control.Selection.DragProxy.start(a);
Event.stop(a)
}},onMouseUp:function(a){Control.Selection.DragProxy.stop();
Control.Selection.DragProxy.container.stopObserving("mouseup",Control.Selection.DragProxy.onMouseUp)
},selected:function(a){a.observe("mousedown",Control.Selection.DragProxy.onClick)
},deselected:function(a){a.stopObserving("mousedown",Control.Selection.DragProxy.onClick)
}}};
Object.Event.extend(Control.Selection);
Object.Event.extend(Control.Selection.DragProxy);
if(typeof(Prototype)=="undefined"){throw"Control.SelectMultiple requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.SelectMultiple requires Object.Event to be loaded."
}Control.SelectMultiple=Class.create({select:false,container:false,numberOfCheckedBoxes:0,checkboxes:[],hasExtraOption:false,initialize:function(e,a,b){this.options={checkboxSelector:"input[type=checkbox]",nameSelector:"span.name",labelSeparator:", ",valueSeparator:",",afterChange:Prototype.emptyFunction,overflowString:function(f){return f.truncate()
},overflowLength:30};
Object.extend(this.options,b||{});
this.select=$(e);
this.container=$(a);
this.checkboxes=(typeof(this.options.checkboxSelector)=="function")?this.options.checkboxSelector.bind(this)():this.container.getElementsBySelector(this.options.checkboxSelector);
var d=false;
if(this.options.value){d=true;
this.setValue(this.options.value);
delete this.options.value
}this.hasExtraOption=false;
this.checkboxes.each(function(f){f.observe("click",this.checkboxOnClick.bind(this,f))
}.bind(this));
this.select.observe("change",this.selectOnChange.bind(this));
this.countAndCheckCheckBoxes();
if(!d){this.scanCheckBoxes()
}this.notify("afterChange",this.select.options[this.select.options.selectedIndex].value)
},countAndCheckCheckBoxes:function(){this.numberOfCheckedBoxes=this.checkboxes.inject(0,function(a,b){b.checked=(this.select.options[this.select.options.selectedIndex].value==b.value);
var f=this.select.options[this.select.options.selectedIndex].value;
var d=$A(f.split?f.split(this.options.valueSeparator):f);
var e=d.any(function(g){if(!e&&b.value==g){return true
}}.bind(this));
b.checked=e;
if(b.checked){++a
}return a
}.bind(this))
},setValue:function(a){this.numberOfCheckedBoxes=0;
var b=$A(a.split?a.split(this.options.valueSeparator):a);
this.checkboxes.each(function(d){d.checked=false;
b.each(function(e){if(d.value==e){++this.numberOfCheckedBoxes;
d.checked=true
}}.bind(this))
}.bind(this));
this.scanCheckBoxes()
},selectOnChange:function(){this.removeExtraOption();
this.countAndCheckCheckBoxes();
this.notify("afterChange",this.select.options[this.select.options.selectedIndex].value)
},checkboxOnClick:function(a){this.numberOfCheckedBoxes=this.checkboxes.findAll(function(b){return b.checked
}).length;
this.scanCheckBoxes();
this.notify("afterChange",this.numberOfCheckedBoxes===0?"":this.select.options[this.select.options.selectedIndex].value)
},scanCheckBoxes:function(){switch(this.numberOfCheckedBoxes){case 1:this.checkboxes.each(function(a){if(a.checked){$A(this.select.options).each(function(d,b){if(d.value==a.value){this.select.options.selectedIndex=b;
throw $break
}}.bind(this));
throw $break
}}.bind(this));
break;
case 0:this.removeExtraOption();
break;
default:this.addExtraOption();
break
}},getLabelForExtraOption:function(){var a=(typeof(this.options.nameSelector)=="function"?this.options.nameSelector.bind(this)():this.container.getElementsBySelector(this.options.nameSelector).inject([],function(e,d,b){if(this.checkboxes[b].checked){e.push(d.innerHTML)
}return e
}.bind(this))).join(this.options.labelSeparator);
return(a.length>=this.options.overflowLength&&this.options.overflowLength>0)?(typeof(this.options.overflowString)=="function"?this.options.overflowString(a):this.options.overflowString):a
},getValueForExtraOption:function(){return this.checkboxes.inject([],function(a,b){if(b.checked){a.push(b.value)
}return a
}).join(this.options.valueSeparator)
},addExtraOption:function(){this.removeExtraOption();
this.hasExtraOption=true;
this.select.options[this.select.options.length]=new Option(this.getLabelForExtraOption(),this.getValueForExtraOption());
this.select.options.selectedIndex=this.select.options.length-1
},removeExtraOption:function(){if(this.hasExtraOption){this.select.remove(this.select.options.length-1);
this.hasExtraOption=false
}}});
Object.Event.extend(Control.SelectMultiple);
if(typeof(Prototype)=="undefined"){throw"Control.Tabs requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.Tabs requires Object.Event to be loaded."
}Control.Tabs=Class.create({initialize:function(a,d){if(!$(a)){throw"Control.Tabs could not find the element: "+a
}this.activeContainer=false;
this.activeLink=false;
this.containers=$H({});
this.links=[];
Control.Tabs.instances.push(this);
this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:"li a",setClassOnContainer:false,activeClassName:"active",defaultTab:"first",autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};
Object.extend(this.options,d||{});
(typeof(this.options.linkSelector=="string")?$(a).select(this.options.linkSelector):this.options.linkSelector($(a))).findAll(function(e){return(/^#/).exec((Prototype.Browser.WebKit?decodeURIComponent(e.href):e.href).replace(window.location.href.split("#")[0],""))
}).each(function(e){this.addTab(e)
}.bind(this));
this.containers.values().each(Element.hide);
if(this.options.defaultTab=="first"){this.setActiveTab(this.links.first())
}else{if(this.options.defaultTab=="last"){this.setActiveTab(this.links.last())
}else{this.setActiveTab(this.options.defaultTab)
}}var b=this.options.targetRegExp.exec(window.location);
if(b&&b[1]){b[1].split(",").each(function(e){this.setActiveTab(this.links.find(function(f){return f.key==e
}))
}.bind(this))
}if(this.options.autoLinkExternal){$A(document.getElementsByTagName("a")).each(function(e){if(!this.links.include(e)){var f=e.href.replace(window.location.href.split("#")[0],"");
if(f.substring(0,1)=="#"){if(this.containers.keys().include(f.substring(1))){$(e).observe("click",function(h,g){this.setActiveTab(g.substring(1))
}.bindAsEventListener(this,f))
}}}}.bind(this))
}},addTab:function(b){this.links.push(b);
b.key=b.getAttribute("href").replace(window.location.href.split("#")[0],"").split("#").last().replace(/#/,"");
var a=$(b.key);
if(!a){throw"Control.Tabs: #"+b.key+" was not found on the page."
}this.containers.set(b.key,a);
b[this.options.hover?"onmouseover":"onclick"]=function(d){if(window.event){Event.stop(window.event)
}this.setActiveTab(d);
return false
}.bind(this,b)
},setActiveTab:function(a){if(!a&&typeof(a)=="undefined"){return
}if(typeof(a)=="string"){this.setActiveTab(this.links.find(function(b){return b.key==a
}))
}else{if(typeof(a)=="number"){this.setActiveTab(this.links[a])
}else{if(this.notify("beforeChange",this.activeContainer,this.containers.get(a.key))===false){return
}if(this.activeContainer){this.options.hideFunction(this.activeContainer)
}this.links.each(function(b){(this.options.setClassOnContainer?$(b.parentNode):b).removeClassName(this.options.activeClassName)
}.bind(this));
(this.options.setClassOnContainer?$(a.parentNode):a).addClassName(this.options.activeClassName);
this.activeContainer=this.containers.get(a.key);
this.activeLink=a;
this.options.showFunction(this.containers.get(a.key));
this.notify("afterChange",this.containers.get(a.key))
}}},next:function(){this.links.each(function(b,a){if(this.activeLink==b&&this.links[a+1]){this.setActiveTab(this.links[a+1]);
throw $break
}}.bind(this))
},previous:function(){this.links.each(function(b,a){if(this.activeLink==b&&this.links[a-1]){this.setActiveTab(this.links[a-1]);
throw $break
}}.bind(this))
},first:function(){this.setActiveTab(this.links.first())
},last:function(){this.setActiveTab(this.links.last())
}});
Object.extend(Control.Tabs,{instances:[],findByTabId:function(a){return Control.Tabs.instances.find(function(b){return b.links.find(function(d){return d.key==a
})
})
}});
Object.Event.extend(Control.Tabs);
if(typeof(Prototype)=="undefined"){throw"Control.TextArea requires Prototype to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.TextArea requires Object.Event to be loaded."
}Control.TextArea=Class.create({initialize:function(a){this.onChangeTimeout=false;
this.element=$(a);
$(this.element).observe("keyup",this.doOnChange.bindAsEventListener(this));
$(this.element).observe("paste",this.doOnChange.bindAsEventListener(this));
$(this.element).observe("input",this.doOnChange.bindAsEventListener(this));
if(!!document.selection){$(this.element).observe("mouseup",this.saveRange.bindAsEventListener(this));
$(this.element).observe("keyup",this.saveRange.bindAsEventListener(this))
}},doOnChange:function(a){if(this.onChangeTimeout){window.clearTimeout(this.onChangeTimeout)
}this.onChangeTimeout=window.setTimeout(function(){this.notify("change",this.getValue())
}.bind(this),Control.TextArea.onChangeTimeoutLength)
},saveRange:function(){this.range=document.selection.createRange()
},getValue:function(){return this.element.value
},getSelection:function(){if(!!document.selection){return document.selection.createRange().text
}else{if(!!this.element.setSelectionRange){return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd)
}else{return false
}}},replaceSelection:function(a){var e=this.element.scrollTop;
if(!!document.selection){this.element.focus();
var d=(this.range)?this.range:document.selection.createRange();
d.text=a;
d.select()
}else{if(!!this.element.setSelectionRange){var b=this.element.selectionStart;
this.element.value=this.element.value.substring(0,b)+a+this.element.value.substring(this.element.selectionEnd);
this.element.setSelectionRange(b+a.length,b+a.length)
}}this.doOnChange();
this.element.focus();
this.element.scrollTop=e
},wrapSelection:function(d,a){var b=this.getSelection();
if(b.indexOf(d)===0&&b.lastIndexOf(a)===(b.length-a.length)){this.replaceSelection(b.substring(d.length,b.length-a.length))
}else{this.replaceSelection(d+b+a)
}},insertBeforeSelection:function(a){this.replaceSelection(a+this.getSelection())
},insertAfterSelection:function(a){this.replaceSelection(this.getSelection()+a)
},collectFromEachSelectedLine:function(a,b,d){this.replaceSelection((b||"")+$A(this.getSelection().split("\n")).collect(a).join("\n")+(d||""))
},insertBeforeEachSelectedLine:function(a,b,d){this.collectFromEachSelectedLine(function(e){},b,d)
}});
Object.extend(Control.TextArea,{onChangeTimeoutLength:500});
Object.Event.extend(Control.TextArea);
Control.TextArea.ToolBar=Class.create({initialize:function(a,b){this.textarea=a;
if(b){this.container=$(b)
}else{this.container=$(document.createElement("ul"));
this.textarea.element.parentNode.insertBefore(this.container,this.textarea.element)
}},attachButton:function(a,b){a.onclick=function(){return false
};
$(a).observe("click",b.bindAsEventListener(this.textarea))
},addButton:function(b,g,e){var d=document.createElement("li");
var h=document.createElement("a");
h.href="#";
this.attachButton(h,g);
d.appendChild(h);
Object.extend(h,e||{});
if(b){var f=document.createElement("span");
f.innerHTML=b;
h.appendChild(f)
}this.container.appendChild(d)
}});
if(typeof(Draggable)!="undefined"){Draggable.prototype.draw=function(e){var b=Position.cumulativeOffset(this.element);
if(this.options.ghosting){var h=Position.realOffset(this.element);
b[0]+=h[0]-Position.deltaX;
b[1]+=h[1]-Position.deltaY
}var a=this.currentDelta();
b[0]-=a[0];
b[1]-=a[1];
if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){b[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;
b[1]-=this.options.scroll.scrollTop-this.originalScrollTop
}var k=[0,1].map(function(d){return(e[d]-b[d]-this.offset[d])
}.bind(this));
if(this.options.snap){if(typeof this.options.snap=="function"){k=this.options.snap(k[0],k[1],this)
}else{if(this.options.snap instanceof Array){k=k.map(function(d,o){return Math.round(d/this.options.snap[o])*this.options.snap[o]
}.bind(this))
}else{k=k.map(function(d){return Math.round(d/this.options.snap)*this.options.snap
}.bind(this))
}}}if(this.options.onDraw){this.options.onDraw.bind(this)(k)
}else{var j=this.element.style;
if(this.options.constrainToViewport){var g=document.viewport.getDimensions();
var m=this.element.getDimensions();
var n=parseInt(this.element.getStyle("margin-top"));
var f=parseInt(this.element.getStyle("margin-left"));
var l=[[0-f,0-n],[(g.width-m.width)-f,(g.height-m.height)-n]];
if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((k[0]>=l[0][0])&&(k[0]<=l[1][0])){this.element.style.left=k[0]+"px"
}else{this.element.style.left=((k[0]<l[0][0])?l[0][0]:l[1][0])+"px"
}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((k[1]>=l[0][1])&&(k[1]<=l[1][1])){this.element.style.top=k[1]+"px"
}else{this.element.style.top=((k[1]<=l[0][1])?l[0][1]:l[1][1])+"px"
}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){j.left=k[0]+"px"
}if((!this.options.constraint)||(this.options.constraint=="vertical")){j.top=k[1]+"px"
}}if(j.visibility=="hidden"){j.visibility=""
}}}
}if(typeof(Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."
}if(typeof(IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."
}if(typeof(Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."
}Control.Window=Class.create({initialize:function(e,a){Control.Window.windows.push(this);
this.container=false;
this.isOpen=false;
this.href=false;
this.sourceContainer=false;
this.ajaxRequest=false;
this.remoteContentLoaded=false;
this.numberInSequence=Control.Window.windows.length+1;
this.indicator=false;
this.effects={fade:false,appear:false};
this.indicatorEffects={fade:false,appear:false};
this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:"post",parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},a||{});
this.indicator=this.options.indicator?$(this.options.indicator):false;
if(e){if(typeof(e)=="string"&&e.match(Control.Window.uriRegex)){this.href=e
}else{this.container=$(e);
this.createDefaultContainer(e);
if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)
}else{this.sourceContainer=this.container;
this.href=this.container.readAttribute("href");
var d=this.href.match(/^#(.+)$/);
if(d&&d[1]){this.container=$(d[1]);
this.href=false
}else{this.container=false
}}this.sourceContainerOpenHandler=function(f){this.open(f);
f.stop();
return false
}.bindAsEventListener(this);
this.sourceContainerCloseHandler=function(f){this.close(f)
}.bindAsEventListener(this);
this.sourceContainerMouseMoveHandler=function(f){this.position(f)
}.bindAsEventListener(this);
if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);
this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);
if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)
}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)
}}}}this.createDefaultContainer(e);
if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container
}var b={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};
if(this.options.width){b.width=$value(this.options.width)+"px"
}if(this.options.height){b.height=$value(this.options.height)+"px"
}this.container.setStyle(b);
if(this.options.className){this.container.addClassName(this.options.className)
}this.positionHandler=this.position.bindAsEventListener(this);
this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);
this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);
this.container.observe("mousedown",this.bringToFrontHandler);
this.container.hide();
this.closeHandler=this.close.bindAsEventListener(this);
if(this.options.iframeshim){this.iFrameShim=new IframeShim();
this.iFrameShim.hide()
}this.applyResizable();
this.applyDraggable();
Event.observe(window,"resize",this.outOfBoundsPositionHandler);
this.notify("afterInitialize")
},open:function(a){if(this.isOpen){this.bringToFront();
return false
}if(this.notify("beforeOpen")===false){return false
}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)
}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container
}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();
this.closeOnClickContainer=Control.Overlay.container
}else{this.closeOnClickContainer=$(this.options.closeOnClick)
}}}this.closeOnClickContainer.observe("click",this.closeHandler)
}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;
if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var b=new Element("img");
b.observe("load",function(e){this.getRemoteContentInsertionTarget().insert(e);
this.position();
if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}}.bind(this,b));
b.writeAttribute("src",this.href)
}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()
}this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(e){this.notify("onComplete",e);
this.ajaxRequest=false
}.bind(this),onSuccess:function(e){this.getRemoteContentInsertionTarget().insert(e.responseText);
this.notify("onSuccess",e);
if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}}.bind(this),onFailure:function(e){this.notify("onFailure",e);
if(this.options.indicator){this.hideIndicator()
}}.bind(this),onException:function(e,f){this.notify("onException",e,f);
if(this.options.indicator){this.hideIndicator()
}}.bind(this)})
}}return true
}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;
if(this.options.indicator){this.showIndicator()
}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));
var d=this.container.down("iframe");
d.onload=function(){this.notify("onRemoteContentLoaded");
if(this.options.indicator){this.hideIndicator()
}d.onload=null
}.bind(this)
}}this.finishOpen(a);
return true
},close:function(a){if(!this.isOpen||this.notify("beforeClose",a)===false){return false
}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)
}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()
}this.isOpen=false;
this.notify("afterClose")
}.bind(this)})
}else{this.container.hide();
if(this.iFrameShim){this.iFrameShim.hide()
}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()
}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)
}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)
}if(this.options.indicator){this.hideIndicator()
}if(!this.options.fade){this.isOpen=false;
this.notify("afterClose")
}return true
},position:function(f){if(this.options.position=="mouse"){var j=[Event.pointerX(f),Event.pointerY(f)];
this.container.setStyle({top:j[1]+$value(this.options.offsetTop)+"px",left:j[0]+$value(this.options.offsetLeft)+"px"});
return
}var a=this.container.getDimensions();
var e=document.viewport.getDimensions();
Position.prepare();
var d=(Position.deltaX+Math.floor((e.width-a.width)/2));
var b=(Position.deltaY+((e.height>a.height)?Math.floor((e.height-a.height)/2):0));
if(this.options.position=="center"){this.container.setStyle({top:(a.height<=e.height)?((b!=null&&b>0)?b:0)+"px":0,left:(a.width<=e.width)?((d!=null&&d>0)?d:0)+"px":0})
}else{if(this.options.position=="relative"){var j=this.sourceContainer.cumulativeOffset();
var h=j[1]+$value(this.options.offsetTop);
var g=j[0]+$value(this.options.offsetLeft);
this.container.setStyle({top:(a.height<=e.height)?(this.options.constrainToViewport?Math.max(0,Math.min(e.height-(a.height),h)):h)+"px":0,left:(a.width<=e.width)?(this.options.constrainToViewport?Math.max(0,Math.min(e.width-(a.width),g)):g)+"px":0})
}else{if(this.options.position.length){var h=$value(this.options.position[1])+$value(this.options.offsetTop);
var g=$value(this.options.position[0])+$value(this.options.offsetLeft);
this.container.setStyle({top:(a.height<=e.height)?(this.options.constrainToViewport?Math.max(0,Math.min(e.height-(a.height),h)):h)+"px":0,left:(a.width<=e.width)?(this.options.constrainToViewport?Math.max(0,Math.min(e.width-(a.width),g)):g)+"px":0})
}}}if(this.iFrameShim){this.updateIFrameShimZIndex()
}},ensureInBounds:function(){if(!this.isOpen){return
}var b=document.viewport.getDimensions();
var a=this.container.cumulativeOffset();
var d=this.container.getDimensions();
if(a.left+d.width>b.width){this.container.setStyle({left:(Math.max(0,b.width-d.width))+"px"})
}if(a.top+d.height>b.height){this.container.setStyle({top:(Math.max(0,b.height-d.height))+"px"})
}},bringToFront:function(){Control.Window.bringToFront(this);
this.notify("bringToFront")
},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);
if(this.draggable){Draggables.removeObserver(this.container);
this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);
this.draggable.destroy()
}if(this.resizable){Resizables.removeObserver(this.container);
this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);
this.resizable.destroy()
}if(this.container&&!this.sourceContainer){this.container.remove()
}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);
this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);
if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)
}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)
}}if(this.iFrameShim){this.iFrameShim.destroy()
}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);
Control.Window.windows=Control.Window.windows.without(this);
this.notify("afterDestroy")
},applyResizable:function(){if(this.options.resizable){if(typeof(Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."
}var a=null;
if(this.options.resizable===true){a=new Element("div",{className:"resizable_handle"});
this.container.insert(a)
}else{a=$(this.options.resziable)
}this.resizable=new Resizable(this.container,{handle:a,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().height-parseInt(b.style.top||0))-(b.getHeight()-parseInt(b.style.height||0))
}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(b){return(document.viewport.getDimensions().width-parseInt(b.style.left||0))-(b.getWidth()-parseInt(b.style.width||0))
}:this.options.maxWidth});
this.resizable.handle.observe("mousedown",this.bringToFrontHandler);
Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.notify("onResize")
}.bind(this)))
}},applyDraggable:function(){if(this.options.draggable){if(typeof(Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."
}var a=null;
if(this.options.draggable===true){a=new Element("div",{className:"draggable_handle"});
this.container.insert(a)
}else{a=$(this.options.draggable)
}this.draggable=new Draggable(this.container,{handle:a,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;
document.onselectstart=function(){return false
}
}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart
}.bind(this)});
this.draggable.handle.observe("mousedown",this.bringToFrontHandler);
Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.notify("onDrag")
}.bind(this)))
}},createDefaultContainer:function(a){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});
$(document.body).insert(this.container);
if(typeof(a)=="string"&&$(a)==null&&!a.match(/^#(.+)$/)&&!a.match(Control.Window.uriRegex)){this.container.update(a)
}}},finishOpen:function(a){this.bringToFront();
if(this.options.fade){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."
}if(this.effects.fade){this.effects.fade.cancel()
}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()
}this.isOpen=true;
this.notify("afterOpen")
}.bind(this)})
}else{this.container.show()
}this.position(a);
if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)
}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)
}if(!this.options.fade){this.isOpen=true;
this.notify("afterOpen")
}return true
},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})
}else{this.indicator.show()
}}.bind(this),Control.Window.indicatorTimeout)
},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)
}this.indicator.hide()
},getRemoteContentInsertionTarget:function(){return typeof(this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)
},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)
}}});
Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(a){Control.Window.windows=Control.Window.windows.without(a);
Control.Window.windows.push(a);
Control.Window.windows.each(function(d,e){var b=Control.Window.baseZIndex+e;
d.container.setStyle({zIndex:b});
if(d.isOpen){if(d.iFrameShim){d.updateIFrameShimZIndex()
}}if(d.options.draggable){d.draggable.options.zindex=b
}})
},open:function(d,a){var b=new Control.Window(d,a);
b.open();
return b
},initialZIndexForWindow:function(a){return Control.Window.baseZIndex+(Control.Window.windows.length-1)
}});
Object.Event.extend(Control.Window);
Control.Window.LayoutUpdateObserver=Class.create({initialize:function(a,b){this.w=a;
this.element=$(a.container);
this.observer=b
},onStart:Prototype.emptyFunction,onEnd:function(b,a){if(a.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()
}},onResize:function(b,a){if(a.element==this.element){this.observer(this.element)
}},onDrag:function(b,a){if(a.element==this.element){this.observer(this.element)
}}});
Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false
}Control.Overlay.loaded=true;
Control.Overlay.container=new Element("div",{id:Control.Overlay.id});
$(document.body).insert(Control.Overlay.container);
if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);
Event.observe(window,"scroll",Control.Overlay.positionOverlay);
Event.observe(window,"resize",Control.Overlay.positionOverlay);
Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)
}else{Control.Overlay.container.setStyle(Control.Overlay.styles)
}Control.Overlay.iFrameShim=new IframeShim();
Control.Overlay.iFrameShim.hide();
Event.observe(window,"resize",Control.Overlay.positionIFrameShim);
Control.Overlay.container.hide();
return true
},unload:function(){if(!Control.Overlay.loaded){return false
}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);
Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);
Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);
Control.Overlay.iFrameShim.destroy();
Control.Overlay.container.remove();
Control.Overlay.loaded=false;
return true
},show:function(a,b){if(Control.Overlay.notify("beforeShow")===false){return false
}Control.Overlay.lastOpacity=a;
Control.Overlay.positionIFrameShim();
Control.Overlay.iFrameShim.show();
if(b){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."
}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()
}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")
},from:0,to:Control.Overlay.lastOpacity,duration:(b===true?0.75:b)/2})
}else{Control.Overlay.container.setStyle({opacity:a||1});
Control.Overlay.container.show();
Control.Overlay.notify("afterShow")
}return true
},hide:function(a){if(Control.Overlay.notify("beforeHide")===false){return false
}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()
}Control.Overlay.iFrameShim.hide();
if(a){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")
},from:Control.Overlay.lastOpacity,to:0,duration:(a===true?0.75:a)/2})
}else{Control.Overlay.container.hide();
Control.Overlay.notify("afterHide")
}return true
},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)
}},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+"px",height:document.body.clientHeight+"px"})
}};
Object.Event.extend(Control.Overlay);
Control.ToolTip=Class.create(Control.Window,{initialize:function($super,b,a,d){$super(a,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),d||{}),{position:"mouse",hover:b}))
}});
Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});
Control.Modal=Class.create(Control.Window,{initialize:function($super,a,b){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();
$super(a,Object.extend(Object.clone(Control.Modal.defaultOptions),b||{}))
}});
Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(b,d){var a=new Control.Modal(b,d);
a.open();
return a
},close:function(){if(Control.Modal.current){Control.Modal.current.close()
}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();
this.overlayFinishedOpening=false;
this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));
this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));
this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))
}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;
this.open()
}.bind(this));
Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);
throw $break
}else{Control.Window.windows.without(this).invoke("close")
}},afterOpen:function(){Control.Modal.current=this
},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);
Control.Modal.current=false;
this.overlayFinishedOpening=false
}}});
Control.LightBox=Class.create(Control.Window,{initialize:function($super,a,b){this.allImagesLoaded=false;
if(b.modal){var b=Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{});
b=Object.extend(Object.clone(Control.Modal.defaultOptions),b);
b=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(b);
$super(a,b)
}else{$super(a,Object.extend(Object.clone(Control.LightBox.defaultOptions),b||{}))
}this.hasRemoteContent=this.href&&!this.options.iframe;
if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))
}else{this.applyImageObservers()
}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))
},applyImageObservers:function(){var a=this.getImages();
this.numberImagesToLoad=a.length;
this.numberofImagesLoaded=0;
a.each(function(b){b.observe("load",function(d){++this.numberofImagesLoaded;
if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;
this.onAllImagesLoaded()
}}.bind(this,b));
b.hide()
}.bind(this))
},onAllImagesLoaded:function(){this.getImages().each(function(a){this.showImage(a)
}.bind(this));
if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()
}this.finishOpen()
}else{this.open()
}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)
},showImage:function(a){a.show()
}});
Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break
}},onRemoteContentLoaded:function(){this.applyImageObservers();
if(!this.allImagesLoaded){throw $break
}}}});
var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:'<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/syntaxhighlighter</a></p>&copy;2004-2007 Alex Gorbatchev.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'},ClipboardSwf:null,Version:"1.5"}};
dp.SyntaxHighlighter=dp.sh;
dp.sh.Toolbar.Commands={ExpandSource:{label:"+ expand source",check:function(a){return a.collapse
},func:function(b,a){b.parentNode.removeChild(b);
a.div.className=a.div.className.replace("collapsed","")
}},ViewSource:{label:"view plain",func:function(e,d){var b=d.originalCode.replace(/</g,"&lt;");
var a=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");
a.document.write('<textarea style="width:99%;height:99%">'+b+"</textarea>");
a.document.close()
}},CopyToClipboard:{label:"copy to clipboard",check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null
},func:function(e,d){var b=d.originalCode;
if(window.clipboardData){window.clipboardData.setData("text",b)
}else{if(dp.sh.ClipboardSwf!=null){var a=d.flashCopier;
if(a==null){a=document.createElement("div");
d.flashCopier=a;
d.div.appendChild(a)
}a.innerHTML='<embed src="'+dp.sh.ClipboardSwf+'" FlashVars="clipboard='+encodeURIComponent(b)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>'
}}alert("The code is in your clipboard now")
}},PrintSource:{label:"print",func:function(e,d){var a=document.createElement("IFRAME");
var b=null;
a.style.cssText="position:absolute;width:0px;height:0px;left:-500px;top:-500px;";
document.body.appendChild(a);
b=a.contentWindow.document;
dp.sh.Utils.CopyStyles(b,window.document);
b.write('<div class="'+d.div.className.replace("collapsed","")+' printing">'+d.div.innerHTML+"</div>");
b.close();
a.contentWindow.focus();
a.contentWindow.print();
alert("Printing...");
document.body.removeChild(a)
}},About:{label:"?",func:function(b){var d=window.open("","_blank","dialog,width=300,height=150,scrollbars=0");
var a=d.document;
dp.sh.Utils.CopyStyles(a,window.document);
a.write(dp.sh.Strings.AboutDialog.replace("{V}",dp.sh.Version));
a.close();
d.focus()
}}};
dp.sh.Toolbar.Create=function(e){var b=document.createElement("DIV");
b.className="tools";
for(var d in dp.sh.Toolbar.Commands){var a=dp.sh.Toolbar.Commands[d];
if(a.check!=null&&!a.check(e)){continue
}b.innerHTML+='<a href="#" onclick="dp.sh.Toolbar.Command(\''+d+"',this);return false;\">"+a.label+"</a>"
}return b
};
dp.sh.Toolbar.Command=function(b,d){var a=d;
while(a!=null&&a.className.indexOf("dp-highlighter")==-1){a=a.parentNode
}if(a!=null){dp.sh.Toolbar.Commands[b].func(d,a.highlighter)
}};
dp.sh.Utils.CopyStyles=function(d,b){var e=b.getElementsByTagName("link");
for(var a=0;
a<e.length;
a++){if(e[a].rel.toLowerCase()=="stylesheet"){d.write('<link type="text/css" rel="stylesheet" href="'+e[a].href+'"></link>')
}}};
dp.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""])*"',"g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'","g")};
dp.sh.Match=function(a,b,d){this.value=a;
this.index=b;
this.length=a.length;
this.css=d
};
dp.sh.Highlighter=function(){this.noGutter=false;
this.addControls=true;
this.collapse=false;
this.tabsToSpaces=true;
this.wrapColumn=80;
this.showColumns=true
};
dp.sh.Highlighter.SortCallback=function(b,a){if(b.index<a.index){return -1
}else{if(b.index>a.index){return 1
}else{if(b.length<a.length){return -1
}else{if(b.length>a.length){return 1
}}}}return 0
};
dp.sh.Highlighter.prototype.CreateElement=function(b){var a=document.createElement(b);
a.highlighter=this;
return a
};
dp.sh.Highlighter.prototype.GetMatches=function(b,a){var e=0;
var d=null;
while((d=b.exec(this.code))!=null){this.matches[this.matches.length]=new dp.sh.Match(d[0],d.index,a)
}};
dp.sh.Highlighter.prototype.AddBit=function(d,a){if(d==null||d.length==0){return
}var b=this.CreateElement("SPAN");
d=d.replace(/ /g,"&nbsp;");
d=d.replace(/</g,"&lt;");
d=d.replace(/\n/gm,"&nbsp;<br>");
if(a!=null){if((/br/gi).test(d)){var e=d.split("&nbsp;<br>");
for(var f=0;
f<e.length;
f++){b=this.CreateElement("SPAN");
b.className=a;
b.innerHTML=e[f];
this.div.appendChild(b);
if(f+1<e.length){this.div.appendChild(this.CreateElement("BR"))
}}}else{b.className=a;
b.innerHTML=d;
this.div.appendChild(b)
}}else{b.innerHTML=d;
this.div.appendChild(b)
}};
dp.sh.Highlighter.prototype.IsInside=function(b){if(b==null||b.length==0){return false
}for(var d=0;
d<this.matches.length;
d++){var a=this.matches[d];
if(a==null){continue
}if((b.index>a.index)&&(b.index<a.index+a.length)){return true
}}return false
};
dp.sh.Highlighter.prototype.ProcessRegexList=function(){for(var a=0;
a<this.regexList.length;
a++){this.GetMatches(this.regexList[a].regex,this.regexList[a].css)
}};
dp.sh.Highlighter.prototype.ProcessSmartTabs=function(h){var d=h.split("\n");
var b="";
var j=4;
var f="\t";
function a(q,p,n){var o=q.substr(0,p);
var m=q.substr(p+1,q.length);
var k="";
for(var l=0;
l<n;
l++){k+=" "
}return o+k+m
}function g(n,l){if(n.indexOf(f)==-1){return n
}var m=0;
while((m=n.indexOf(f))!=-1){var k=l-m%l;
n=a(n,m,k)
}return n
}for(var e=0;
e<d.length;
e++){b+=g(d[e],j)+"\n"
}return b
};
dp.sh.Highlighter.prototype.SwitchToList=function(){var d=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n");
var h=d.split("\n");
if(this.addControls==true){this.bar.appendChild(dp.sh.Toolbar.Create(this))
}if(this.showColumns){var j=this.CreateElement("div");
var a=this.CreateElement("div");
var k=10;
var b=1;
while(b<=150){if(b%k==0){j.innerHTML+=b;
b+=(b+"").length
}else{j.innerHTML+="&middot;";
b++
}}a.className="columns";
a.appendChild(j);
this.bar.appendChild(a)
}for(var b=0,g=this.firstLine;
b<h.length-1;
b++,g++){var f=this.CreateElement("LI");
var e=this.CreateElement("SPAN");
f.className=(b%2==0)?"alt":"";
e.innerHTML=h[b]+"&nbsp;";
f.appendChild(e);
this.ol.appendChild(f)
}this.div.innerHTML=""
};
dp.sh.Highlighter.prototype.Highlight=function(f){function h(k){return k.replace(/^\s*(.*?)[\s\n]*$/g,"$1")
}function j(k){return k.replace(/\n*$/,"").replace(/^\n*/,"")
}function d(p){var q=p.split("\n");
var o=new Array();
var m=new RegExp("^\\s*","g");
var l=1000;
for(var k=0;
k<q.length&&l>0;
k++){if(h(q[k]).length==0){continue
}var n=m.exec(q[k]);
if(n!=null&&n.length>0){l=Math.min(n[0].length,l)
}}if(l>0){for(var k=0;
k<q.length;
k++){q[k]=q[k].substr(l)
}}return q.join("\n")
}function g(m,l,k){return m.substr(l,k-l)
}var a=0;
if(f==null){f=""
}this.originalCode=f;
this.code=j(d(f));
this.div=this.CreateElement("DIV");
this.bar=this.CreateElement("DIV");
this.ol=this.CreateElement("OL");
this.matches=new Array();
this.div.className="dp-highlighter";
this.div.highlighter=this;
this.bar.className="bar";
this.ol.start=this.firstLine;
if(this.CssClass!=null){this.ol.className=this.CssClass
}if(this.collapse){this.div.className+=" collapsed"
}if(this.noGutter){this.div.className+=" nogutter"
}if(this.tabsToSpaces==true){this.code=this.ProcessSmartTabs(this.code)
}this.ProcessRegexList();
if(this.matches.length==0){this.AddBit(this.code,null);
this.SwitchToList();
this.div.appendChild(this.ol);
return
}this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);
for(var e=0;
e<this.matches.length;
e++){if(this.IsInside(this.matches[e])){this.matches[e]=null
}}for(var e=0;
e<this.matches.length;
e++){var b=this.matches[e];
if(b==null||b.length==0){continue
}this.AddBit(g(this.code,a,b.index),null);
this.AddBit(b.value,b.css);
a=b.index+b.length
}this.AddBit(this.code.substr(a),null);
this.SwitchToList();
this.div.appendChild(this.bar);
this.div.appendChild(this.ol)
};
dp.sh.Highlighter.prototype.GetKeywords=function(a){return"\\b"+a.replace(/ /g,"\\b|\\b")+"\\b"
};
dp.sh.HighlightAll=function(n,j,u,s,f,a){function k(){var y=arguments;
for(var x=0;
x<y.length;
x++){if(y[x]==null){continue
}if(typeof(y[x])=="string"&&y[x]!=""){return y[x]+""
}if(typeof(y[x])=="object"&&y[x].value!=""){return y[x].value+""
}}return null
}function t(x,z){for(var y=0;
y<z.length;
y++){if(z[y]==x){return true
}}return false
}function m(z,B,x){var y=new RegExp("^"+z+"\\[(\\w+)\\]$","gi");
var A=null;
for(var C=0;
C<B.length;
C++){if((A=y.exec(B[C]))!=null){return A[1]
}}return x
}function p(z,A,x){var y=document.getElementsByTagName(x);
for(var B=0;
B<y.length;
B++){if(y[B].getAttribute("class")==A){z.push(y[B])
}}}var g=[];
var l=null;
var w={};
var h="innerHTML";
p(g,n,"code");
if(g.length==0){return
}for(var d in dp.sh.Brushes){var r=dp.sh.Brushes[d].Aliases;
if(r==null){continue
}for(var q=0;
q<r.length;
q++){w[r[q]]=d
}}for(var q=0;
q<g.length;
q++){var b=g[q];
var e=k(b.attributes["class"],b.className,b.attributes.language,b.language);
var o="";
if(e==null){continue
}e=e.split(":");
o=e[0].toLowerCase();
if(w[o]==null){continue
}l=new dp.sh.Brushes[w[o]]();
b.style.display="none";
l.noGutter=(j==null)?t("nogutter",e):!j;
l.addControls=(u==null)?!t("nocontrols",e):u;
l.collapse=(s==null)?t("collapse",e):s;
l.showColumns=(a==null)?t("showcolumns",e):a;
l.firstLine=(f==null)?parseInt(m("firstline",e,1)):f;
l.Highlight(b[h]);
l.source=b;
b.parentNode.insertBefore(l.div,b)
}};
dp.sh.Brushes.JScript=function(){var d="\\$ abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface long native new package private protected public return short static super switch synchronized throw throws transient try typeof var void volatile while with";
var b="true false null TRUE FALSE NULL [0-9]+";
var a="window document event Object Function Math Array Hash String Date RegExp";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(d),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(a),"gm"),css:"builtin"},{regex:new RegExp(this.GetKeywords(b),"g"),css:"constants"},{regex:new RegExp("this(?=(\\.|\\,|\\)))","g"),css:"_this"},{regex:new RegExp("(\\s|\\{|\\,)[a-zA-Z0-9_]+(?=\\s?:\\s?function)","gm"),css:"func_dec"},{regex:new RegExp("on(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))","g"),css:"support_property"},{regex:new RegExp("(s(h(ift|ow(Mod(elessDialog|alDialog)|Help))|croll(X|By(Pages|Lines)?|Y|To)?|t(op|rike)|i(n|zeToContent|debar|gnText)|ort|u(p|b(str(ing)?)?)|pli(ce|t)|e(nd|t(Re(sizable|questHeader)|M(i(nutes|lliseconds)|onth)|Seconds|Ho(tKeys|urs)|Year|Cursor|Time(out)?|Interval|ZOptions|Date|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(ome|andleEvent)|navigate|c(har(CodeAt|At)|o(s|n(cat|textual|firm)|mpile)|eil|lear(Timeout|Interval)?|a(ptureEvents|ll)|reate(StyleSheet|Popup|EventObject))|t(o(GMTString|S(tring|ource)|U(TCString|pperCase)|Lo(caleString|werCase))|est|a(n|int(Enabled)?))|i(s(NaN|Finite)|ndexOf|talics)|d(isableExternalCapture|ump|etachEvent)|u(n(shift|taint|escape|watch)|pdateCommands)|j(oin|avaEnabled)|p(o(p|w)|ush|lugins.refresh|a(ddings|rse(Int|Float)?)|r(int|ompt|eference))|e(scape|nableExternalCapture|val|lementFromPoint|x(p|ec(Script|Command)?))|valueOf|UTC|queryCommand(State|Indeterm|Enabled|Value)|f(i(nd|le(ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(nt(size|color)|rward)|loor|romCharCode)|watch|l(ink|o(ad|g)|astIndexOf)|a(sin|nchor|cos|t(tachEvent|ob|an(2)?)|pply|lert|b(s|ort))|r(ou(nd|teEvents)|e(size(By|To)|calc|turnValue|place|verse|l(oad|ease(Capture|Events)))|andom)|g(o|et(ResponseHeader|M(i(nutes|lliseconds)|onth)|Se(conds|lection)|Hours|Year|Time(zoneOffset)?|Da(y|te)|UTC(M(i(nutes|lliseconds)|onth)|Seconds|Hours|Da(y|te)|FullYear)|FullYear|A(ttention|llResponseHeaders)))|m(in|ove(B(y|elow)|To(Absolute)?|Above)|ergeAttributes|a(tch|rgins|x))|b(toa|ig|o(ld|rderWidths)|link|ack))(?=\\()","g"),css:"support_method"},{regex:new RegExp("(s(ub(stringData|mit)|plitText|e(t(NamedItem|Attribute(Node)?)|lect))|has(ChildNodes|Feature)|namedItem|c(l(ick|o(se|neNode))|reate(C(omment|DATASection|aption)|T(Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(ntityReference|lement)|Attribute))|tabIndex|i(nsert(Row|Before|Cell|Data)|tem)|open|delete(Row|C(ell|aption)|T(Head|Foot)|Data)|focus|write(ln)?|a(dd|ppend(Child|Data))|re(set|place(Child|Data)|move(NamedItem|Child|Attribute(Node)?)?)|get(NamedItem|Element(sBy(Name|TagName)|ById)|Attribute(Node)?)|blur)(?=\\()","g"),css:"support_method"},{regex:new RegExp("on(R(ow(s(inserted|delete)|e(nter|xit))|e(s(ize(start|end)?|et)|adystatechange))|Mouse(o(ut|ver)|down|up|move)|B(efore(cut|deactivate|u(nload|pdate)|p(aste|rint)|editfocus|activate)|lur)|S(croll|top|ubmit|elect(start|ionchange)?)|H(over|elp)|C(hange|ont(extmenu|rolselect)|ut|ellchange|l(ick|ose))|D(eactivate|ata(setc(hanged|omplete)|available)|r(op|ag(start|over|drop|en(ter|d)|leave)?)|blclick)|Unload|P(aste|ropertychange)|Error(update)?|Key(down|up|press)|Focus|Load|A(ctivate|fter(update|print)|bort))","g"),css:"support_property"},{regex:new RegExp("\\.(s(ystemLanguage|cr(ipts|ollbars|een(X|Y|Top|Left))|t(yle(Sheets)?|atus(Text|bar)?)|ibling(Below|Above)|ource|uffixes|e(curity(Policy)?|l(ection|f)))|h(istory|ost(name)?|as(h|Focus))|y|X(MLDocument|SLDocument)|n(ext|ame(space(s|URI)|Prop))|M(IN_VALUE|AX_VALUE)|c(haracterSet|o(n(structor|trollers)|okieEnabled|lorDepth|mp(onents|lete))|urrent|puClass|l(i(p(boardData)?|entInformation)|osed|asses)|alle(e|r)|rypto)|t(o(olbar|p)|ext(Transform|Indent|Decoration|Align)|ags)|SQRT(1_2|2)|i(n(ner(Height|Width)|put)|ds|gnoreCase)|zIndex|o(scpu|n(readystatechange|Line)|uter(Height|Width)|p(sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(i(splay|alog(Height|Top|Width|Left|Arguments)|rectories)|e(scription|fault(Status|Ch(ecked|arset)|View)))|u(ser(Profile|Language|Agent)|n(iqueID|defined)|pdateInterval)|_content|p(ixelDepth|ort|ersonalbar|kcs11|l(ugins|atform)|a(thname|dding(Right|Bottom|Top|Left)|rent(Window|Layer)?|ge(X(Offset)?|Y(Offset)?))|r(o(to(col|type)|duct(Sub)?|mpter)|e(vious|fix)))|e(n(coding|abledPlugin)|x(ternal|pando)|mbeds)|v(isibility|endor(Sub)?|Linkcolor)|URLUnencoded|P(I|OSITIVE_INFINITY)|f(ilename|o(nt(Size|Family|Weight)|rmName)|rame(s|Element)|gColor)|E|whiteSpace|l(i(stStyleType|n(eHeight|kColor))|o(ca(tion(bar)?|lName)|wsrc)|e(ngth|ft(Context)?)|a(st(M(odified|atch)|Index|Paren)|yer(s|X)|nguage))|a(pp(MinorVersion|Name|Co(deName|re)|Version)|vail(Height|Top|Width|Left)|ll|r(ity|guments)|Linkcolor|bove)|r(ight(Context)?|e(sponse(XML|Text)|adyState))|global|x|m(imeTypes|ultiline|enubar|argin(Right|Bottom|Top|Left))|L(N(10|2)|OG(10E|2E))|b(o(ttom|rder(RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(Color|Image)))","g"),css:"support_property"}];
this.CssClass="javascript"
};
dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.JScript.Aliases=["js","jscript","javascript"];
dp.sh.Brushes.CSS=function(){var d="ascent azimuth background-attachment background-color background-image background-position background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position quotes richness right size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index important";
var b="above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia gray green groove hand handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow";
var a="[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif";
this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\#[a-fA-F0-9]{3,6}","g"),css:"color"},{regex:new RegExp("-?(\\d+)(px|pt|:|\\s)?","g"),css:"size"},{regex:new RegExp(this.GetKeywords(d),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(b),"g"),css:"value"},{regex:new RegExp(this.GetKeywords(a),"g"),css:"fonts"},{regex:new RegExp("(^|\n)[\\s\\#\\._\\-a-zA-Z0-9\\:\\,\\*]+[\\s\\n]*(?=\\{)","gm"),css:"rule"}];
this.CssClass="css"
};
dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.CSS.Aliases=["css"];
dp.sh.Brushes.Xml=function(){this.CssClass="xml"
};
dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"];
dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){function a(g,f){g[g.length]=f
}var e=0;
var d=null;
var b=null;
this.GetMatches(new RegExp("(&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&gt;|>)","gm"),"cdata");
this.GetMatches(new RegExp("(&lt;|<)!--\\s*.*?\\s*--(&gt;|>)","gm"),"comments");
b=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");
while((d=b.exec(this.code))!=null){if(d[1]==null){continue
}a(this.matches,new dp.sh.Match(d[1],d.index,"attribute"));
if(d[2]!=undefined){a(this.matches,new dp.sh.Match(d[2],d.index+d[0].indexOf(d[2]),"attribute-value"))
}}this.GetMatches(new RegExp("(&lt;|<)/*\\?*(?!\\!)|/*\\?*(&gt;|>)","gm"),"tag");
b=new RegExp("(?:&lt;|<)/*\\?*\\s*([:\\w-.]+)","gm");
while((d=b.exec(this.code))!=null){a(this.matches,new dp.sh.Match(d[1],d.index+d[0].indexOf(d[1]),"tag-name"))
}};
Event.observe(window,"load",function(){dp.sh.HighlightAll("javascript",false,false,false,true,false);
dp.sh.HighlightAll("css",false,false,false,true,false);
dp.sh.HighlightAll("xml",false,false,false,true,false)
});
var Showdown={};
Showdown.converter=function(){var s;
var C;
var d;
var B=0;
this.makeHtml=function(K){s=new Array();
C=new Array();
d=new Array();
K=K.replace(/~/g,"~T");
K=K.replace(/\$/g,"~D");
K=K.replace(/\r\n/g,"\n");
K=K.replace(/\r/g,"\n");
K="\n\n"+K+"\n\n";
K=b(K);
K=K.replace(/^[ \t]+$/mg,"");
K=F(K);
K=w(K);
K=p(K);
K=e(K);
K=K.replace(/~D/g,"$$");
K=K.replace(/~T/g,"~");
return K
};
var w=function(K){var K=K.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,function(N,P,O,M,L){P=P.toLowerCase();
s[P]=A(O);
if(M){return M+L
}else{if(L){C[P]=L.replace(/"/g,"&quot;")
}}return""
});
return K
};
var F=function(M){M=M.replace(/\n/g,"\n\n");
var L="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";
var K="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";
M=M.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,G);
M=M.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,G);
M=M.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,G);
M=M.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,G);
M=M.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,G);
M=M.replace(/\n\n/g,"\n");
return M
};
var G=function(K,L){var M=L;
M=M.replace(/\n\n/g,"\n");
M=M.replace(/^\n/,"");
M=M.replace(/\n+$/g,"");
M="\n\n~K"+(d.push(M)-1)+"K\n\n";
return M
};
var p=function(L){L=y(L);
var K=J("<hr />");
L=L.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,K);
L=L.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,K);
L=L.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,K);
L=m(L);
L=t(L);
L=o(L);
L=F(L);
L=z(L);
return L
};
var f=function(K){K=h(K);
K=E(K);
K=x(K);
K=n(K);
K=I(K);
K=H(K);
K=A(K);
K=u(K);
K=K.replace(/  +\n/g," <br />\n");
return K
};
var E=function(L){var K=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;
L=L.replace(K,function(N){var M=N.replace(/(.)<\/?code>(?=.)/g,"$1`");
M=r(M,"\\`*_");
return M
});
return L
};
var I=function(K){K=K.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,k);
K=K.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,k);
K=K.replace(/(\[([^\[\]]+)\])()()()()()/g,k);
return K
};
var k=function(Q,W,V,U,T,S,P,O){if(O==undefined){O=""
}var N=W;
var L=V;
var M=U.toLowerCase();
var K=T;
var R=O;
if(K==""){if(M==""){M=L.toLowerCase().replace(/ ?\n/g," ")
}K="#"+M;
if(s[M]!=undefined){K=s[M];
if(C[M]!=undefined){R=C[M]
}}else{if(N.search(/\(\s*\)$/m)>-1){K=""
}else{return N
}}}K=r(K,"*_");
var X='<a href="'+K+'"';
if(R!=""){R=R.replace(/"/g,"&quot;");
R=r(R,"*_");
X+=' title="'+R+'"'
}X+=">"+L+"</a>";
return X
};
var n=function(K){K=K.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,l);
K=K.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,l);
return K
};
var l=function(Q,W,V,U,T,S,P,O){var N=W;
var M=V;
var L=U.toLowerCase();
var K=T;
var R=O;
if(!R){R=""
}if(K==""){if(L==""){L=M.toLowerCase().replace(/ ?\n/g," ")
}K="#"+L;
if(s[L]!=undefined){K=s[L];
if(C[L]!=undefined){R=C[L]
}}else{return N
}}M=M.replace(/"/g,"&quot;");
K=r(K,"*_");
var X='<img src="'+K+'" alt="'+M+'"';
R=R.replace(/"/g,"&quot;");
R=r(R,"*_");
X+=' title="'+R+'"';
X+=" />";
return X
};
var y=function(K){K=K.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(L,M){return J("<h1>"+f(M)+"</h1>")
});
K=K.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(M,L){return J("<h2>"+f(L)+"</h2>")
});
K=K.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(L,O,N){var M=O.length;
return J("<h"+M+">"+f(N)+"</h"+M+">")
});
return K
};
var a;
var m=function(L){L+="~0";
var K=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
if(B){L=L.replace(K,function(N,Q,P){var R=Q;
var O=(P.search(/[*+-]/g)>-1)?"ul":"ol";
R=R.replace(/\n{2,}/g,"\n\n\n");
var M=a(R);
M=M.replace(/\s+$/,"");
M="<"+O+">"+M+"</"+O+">\n";
return M
})
}else{K=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
L=L.replace(K,function(O,S,Q,N){var R=S;
var T=Q;
var P=(N.search(/[*+-]/g)>-1)?"ul":"ol";
var T=T.replace(/\n{2,}/g,"\n\n\n");
var M=a(T);
M=R+"<"+P+">\n"+M+"</"+P+">\n";
return M
})
}L=L.replace(/~0/,"");
return L
};
a=function(K){B++;
K=K.replace(/\n{2,}$/,"\n");
K+="~0";
K=K.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(N,P,O,M,L){var R=L;
var Q=P;
var S=O;
if(Q||(R.search(/\n{2,}/)>-1)){R=p(j(R))
}else{R=m(j(R));
R=R.replace(/\n$/,"");
R=f(R)
}return"<li>"+R+"</li>\n"
});
K=K.replace(/~0/g,"");
B--;
return K
};
var t=function(K){K+="~0";
K=K.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(L,N,M){var O=N;
var P=M;
O=q(j(O));
O=b(O);
O=O.replace(/^\n+/g,"");
O=O.replace(/\n+$/g,"");
O="<pre><code>"+O+"\n</code></pre>";
return J(O)+P
});
K=K.replace(/~0/,"");
return K
};
var J=function(K){K=K.replace(/(^\n+|\n+$)/g,"");
return"\n\n~K"+(d.push(K)-1)+"K\n\n"
};
var h=function(K){K=K.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(N,P,O,M,L){var Q=M;
Q=Q.replace(/^([ \t]*)/g,"");
Q=Q.replace(/[ \t]*$/g,"");
Q=q(Q);
return P+"<code>"+Q+"</code>"
});
return K
};
var q=function(K){K=K.replace(/&/g,"&amp;");
K=K.replace(/</g,"&lt;");
K=K.replace(/>/g,"&gt;");
K=r(K,"*_{}[]\\",false);
return K
};
var u=function(K){K=K.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>");
K=K.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>");
return K
};
var o=function(K){K=K.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(L,M){var N=M;
N=N.replace(/^[ \t]*>[ \t]?/gm,"~0");
N=N.replace(/~0/g,"");
N=N.replace(/^[ \t]+$/gm,"");
N=p(N);
N=N.replace(/(^|\n)/g,"$1  ");
N=N.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(O,P){var Q=P;
Q=Q.replace(/^  /mg,"~0");
Q=Q.replace(/~0/g,"");
return Q
});
return J("<blockquote>\n"+N+"\n</blockquote>")
});
return K
};
var z=function(Q){Q=Q.replace(/^\n+/g,"");
Q=Q.replace(/\n+$/g,"");
var P=Q.split(/\n{2,}/g);
var M=new Array();
var K=P.length;
for(var L=0;
L<K;
L++){var O=P[L];
if(O.search(/~K(\d+)K/g)>=0){M.push(O)
}else{if(O.search(/\S/)>=0){O=f(O);
O=O.replace(/^([ \t]*)/g,"<p>");
O+="</p>";
M.push(O)
}}}K=M.length;
for(var L=0;
L<K;
L++){while(M[L].search(/~K(\d+)K/)>=0){var N=d[RegExp.$1];
N=N.replace(/\$/g,"$$$$");
M[L]=M[L].replace(/~K\d+K/,N)
}}return M.join("\n\n")
};
var A=function(K){K=K.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;");
K=K.replace(/<(?![a-z\/?\$!])/gi,"&lt;");
return K
};
var x=function(K){K=K.replace(/\\(\\)/g,D);
K=K.replace(/\\([`*_{}\[\]()>#+-.!])/g,D);
return K
};
var H=function(K){K=K.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>');
K=K.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(L,M){return g(e(M))
});
return K
};
var g=function(M){function L(O){var N="0123456789ABCDEF";
var P=O.charCodeAt(0);
return(N.charAt(P>>4)+N.charAt(P&15))
}var K=[function(N){return"&#"+N.charCodeAt(0)+";"
},function(N){return"&#x"+L(N)+";"
},function(N){return N
}];
M="mailto:"+M;
M=M.replace(/./g,function(N){if(N=="@"){N=K[Math.floor(Math.random()*2)](N)
}else{if(N!=":"){var O=Math.random();
N=(O>0.9?K[2](N):O>0.45?K[1](N):K[0](N))
}}return N
});
M='<a href="'+M+'">'+M+"</a>";
M=M.replace(/">.+:/g,'">');
return M
};
var e=function(K){K=K.replace(/~E(\d+)E/g,function(L,N){var M=parseInt(N);
return String.fromCharCode(M)
});
return K
};
var j=function(K){K=K.replace(/^(\t|[ ]{1,4})/gm,"~0");
K=K.replace(/~0/g,"");
return K
};
var b=function(K){K=K.replace(/\t(?=\t)/g,"    ");
K=K.replace(/\t/g,"~A~B");
K=K.replace(/~B(.+?)~A/g,function(L,O,N){var Q=O;
var M=4-Q.length%4;
for(var P=0;
P<M;
P++){Q+=" "
}return Q
});
K=K.replace(/~A/g,"    ");
K=K.replace(/~B/g,"");
return K
};
var r=function(O,L,M){var K="(["+L.replace(/([\[\]\\])/g,"\\$1")+"])";
if(M){K="\\\\"+K
}var N=new RegExp(K,"g");
O=O.replace(N,D);
return O
};
var D=function(K,M){var L=M.charCodeAt(0);
return"~E"+L+"E"
}
};
function DWREngine(){}DWREngine.XMLHttpRequest=1;
DWREngine.IFrame=2;
DWREngine.setErrorHandler=function(a){DWREngine._errorHandler=a
};
DWREngine.setWarningHandler=function(a){DWREngine._warningHandler=a
};
DWREngine.setTimeout=function(a){DWREngine._timeout=a
};
DWREngine.setPreHook=function(a){DWREngine._preHook=a
};
DWREngine.setPostHook=function(a){DWREngine._postHook=a
};
DWREngine.setMethod=function(a){if(a!=DWREngine.XMLHttpRequest&&a!=DWREngine.IFrame){DWREngine._handleError("Remoting method must be one of DWREngine.XMLHttpRequest or DWREngine.IFrame");
return
}DWREngine._method=a
};
DWREngine.setVerb=function(a){if(a!="GET"&&a!="POST"){DWREngine._handleError("Remoting verb must be one of GET or POST");
return
}DWREngine._verb=a
};
DWREngine.setOrdered=function(a){DWREngine._ordered=a
};
DWREngine.setAsynchronous=function(a){DWREngine._asynchronous=a
};
DWREngine.defaultMessageHandler=function(a){if(typeof a=="object"&&a.name=="Error"&&a.description){alert("Error: "+a.description)
}else{alert(a)
}};
DWREngine.beginBatch=function(){if(DWREngine._batch){DWREngine._handleError("Batch already started.");
return
}DWREngine._batch={};
DWREngine._batch.map={};
DWREngine._batch.paramCount=0;
DWREngine._batch.map.callCount=0;
DWREngine._batch.metadata={}
};
DWREngine.endBatch=function(){var a=DWREngine._batch;
if(a==null){DWREngine._handleError("No batch in progress.");
return
}if(!a.preHook){a.preHook=DWREngine._preHook
}if(!a.postHook){a.postHook=DWREngine._postHook
}if(!a.method){a.method=DWREngine._method
}if(!a.verb){a.verb=DWREngine._verb
}if(!a.asynchronous){a.asynchronous=DWREngine._asynchronous
}if(!DWREngine._ordered){DWREngine._sendData(a);
DWREngine._batches[DWREngine._batches.length]=a
}else{if(DWREngine._batches.length==0){DWREngine._sendData(a);
DWREngine._batches[DWREngine._batches.length]=a
}else{DWREngine._batchQueue[DWREngine._batchQueue.length]=a
}}DWREngine._batch=null
};
DWREngine._errorHandler=DWREngine.defaultMessageHandler;
DWREngine._warningHandler=DWREngine.defaultMessageHandler;
DWREngine._preHook=null;
DWREngine._postHook=null;
DWREngine._batches=[];
DWREngine._batchQueue=[];
DWREngine._callData={};
DWREngine._method=DWREngine.XMLHttpRequest;
DWREngine._verb="POST";
DWREngine._ordered=false;
DWREngine._asynchronous=true;
DWREngine._batch=null;
DWREngine._timeout=0;
DWREngine._DOMDocument=["Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","Msxml2.DOMDocument.3.0","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];
DWREngine._XMLHTTP=["Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
DWREngine._execute=function(b,d,o,m){var h=false;
if(DWREngine._batch==null){DWREngine.beginBatch();
h=true
}var k=[];
for(var g=0;
g<arguments.length-3;
g++){k[g]=arguments[g+3]
}if(DWREngine._batch.path==null){DWREngine._batch.path=b
}else{if(DWREngine._batch.path!=b){DWREngine._handleError("Can't batch requests to multiple DWR Servlets.");
return
}}var f;
var a;
var e=k[0];
var q=k[k.length-1];
if(typeof e=="function"){a={callback:k.shift()};
f=k
}else{if(typeof q=="function"){a={callback:k.pop()};
f=k
}else{if(e==null){if(q==null&&k.length>2){if(DWREngine._warningHandler){DWREngine._warningHandler("Ambiguous nulls at start and end of parameter list. Which is the callback function?")
}}a={callback:k.shift()};
f=k
}else{if(q==null){a={callback:k.pop()};
f=k
}else{if(typeof q=="object"&&q.callback!=null&&typeof q.callback=="function"){a=k.pop();
f=k
}else{if(DWREngine._warningHandler){DWREngine._warningHandler("Missing callback function or metadata object.")
}return
}}}}}var p=Math.floor(Math.random()*10001);
var n=(p+"_"+new Date().getTime()).toString();
DWREngine._callData[n]=a;
var j="c"+DWREngine._batch.map.callCount+"-";
if(!a.errorHandler){a.errorHandler=DWREngine._errorHandler
}if(!a.warningHandler){a.warningHandler=DWREngine._warningHandler
}if(!a.timeout){a.timeout=DWREngine._timeout
}if(a!=null){for(var l in a){DWREngine._batch.metadata[l]=a[l]
}}DWREngine._batch.map[j+"scriptName"]=d;
DWREngine._batch.map[j+"methodName"]=o;
DWREngine._batch.map[j+"id"]=n;
DWREngine._addSerializeFunctions();
for(g=0;
g<f.length;
g++){DWREngine._serializeAll(DWREngine._batch,[],f[g],j+"param"+g)
}DWREngine._removeSerializeFunctions();
DWREngine._batch.map.callCount++;
if(h){DWREngine.endBatch()
}};
DWREngine._sendData=function(k){if(k.map.callCount==0){return
}if(k.preHook){k.preHook()
}if(k.metadata&&k.metadata.timeout&&k.metadata.timeout!=0){var l=function(){DWREngine._abortRequest(k)
};
setTimeout(l,k.metadata.timeout)
}var f;
if(k.map.callCount==1){f=k.map["c0-scriptName"]+"."+k.map["c0-methodName"]
}else{f="Multiple."+k.map.callCount
}if(k.method==DWREngine.XMLHttpRequest){if(window.XMLHttpRequest){k.req=new XMLHttpRequest()
}else{if(window.ActiveXObject&&!(navigator.userAgent.indexOf("Mac")>=0&&navigator.userAgent.indexOf("MSIE")>=0)){k.req=DWREngine._newActiveXObject(DWREngine._XMLHTTP)
}}}var d="";
var h;
if(k.req){k.map.xml="true";
k.req.onreadystatechange=function(){DWREngine._stateChange(k)
};
if(k.verb=="GET"||navigator.userAgent.indexOf("Safari")>=0){k.map.callCount=""+k.map.callCount;
for(h in k.map){var j=encodeURIComponent(h);
var e=encodeURIComponent(k.map[h]);
if(e==""){if(DWREngine._warningHandler){DWREngine._warningHandler("Found empty qval for qkey="+j)
}}d+=j+"="+e+"&"
}d=d.substring(0,d.length-1);
try{k.req.open("GET",k.path+"/exec/"+f+"?"+d,k.asynchronous);
k.req.send(null)
}catch(b){DWREngine._handleMetaDataError(k.metadata,b)
}}else{for(h in k.map){if(typeof k.map[h]!="function"){d+=h+"="+k.map[h]+"\n"
}}try{k.req.open("POST",k.path+"/exec/"+f,k.asynchronous);
k.req.send(d)
}catch(b){DWREngine._handleMetaDataError(k.metadata,b)
}}}else{k.map.xml="false";
var a="dwr-if-"+k.map["c0-id"];
k.div=document.createElement("div");
k.div.innerHTML="<iframe frameborder='0' width='0' height='0' id='"+a+"' name='"+a+"'></iframe>";
document.body.appendChild(k.div);
k.iframe=document.getElementById(a);
k.iframe.setAttribute("style","width:0px; height:0px; border:0px;");
if(k.verb=="GET"){for(h in k.map){d+=encodeURIComponent(h)+"="+encodeURIComponent(k.map[h])+"&"
}d=d.substring(0,d.length-1);
k.iframe.setAttribute("src",k.path+"/exec/"+f+"?"+d);
document.body.appendChild(k.iframe)
}else{k.form=document.createElement("form");
k.form.setAttribute("id","dwr-form");
k.form.setAttribute("action",k.path+"/exec"+f);
k.form.setAttribute("target",a);
k.form.target=a;
k.form.setAttribute("method","post");
for(h in k.map){var g=document.createElement("input");
g.setAttribute("type","hidden");
g.setAttribute("name",h);
g.setAttribute("value",k.map[h]);
k.form.appendChild(g)
}document.body.appendChild(k.form);
k.form.submit()
}}};
DWREngine._stateChange=function(batch){if(batch.req.readyState==4&&!batch.completed){try{var reply=batch.req.responseText;
var status=batch.req.status;
DWREngine._clearUp(batch);
if(reply==null||reply==""){DWREngine._handleMetaDataError(batch.metadata,"No data received from server");
return
}if(reply.search("DWREngine._handle")==-1){DWREngine._handleMetaDataError(batch.metadata,"Invalid reply from server");
return
}if(status!=200){if(reply==null){reply="Unknown error occured"
}DWREngine._handleMetaDataError(batch.metadata,reply);
return
}eval(reply)
}catch(ex){if(ex==null){ex="Unknown error occured"
}DWREngine._handleMetaDataError(batch.metadata,ex)
}finally{if(DWREngine._batchQueue.length!=0){var sendbatch=DWREngine._batchQueue.shift();
DWREngine._sendData(sendbatch);
DWREngine._batches[DWREngine._batches.length]=sendbatch
}}}};
DWREngine._handleResponse=function(b,a){var d=DWREngine._callData[b];
DWREngine._callData[b]=null;
if(d){try{if(d.callback){d.callback(a)
}}catch(e){DWREngine._handleMetaDataError(d,e)
}}};
DWREngine._handleServerError=function(a,d){var b=DWREngine._callData[a];
DWREngine._callData[a]=null;
if(d.message){DWREngine._handleMetaDataError(b,d.message,d)
}else{DWREngine._handleMetaDataError(b,d)
}};
DWREngine._abortRequest=function(a){if(a&&a.metadata&&!a.completed){DWREngine._clearUp();
if(a.req){a.req.abort()
}}};
DWREngine._clearUp=function(a){if(a.completed){alert("double complete");
return
}if(a.div){a.div.parentNode.removeChild(a.div)
}if(a.iframe){a.iframe.parentNode.removeChild(a.iframe)
}if(a.form){a.form.parentNode.removeChild(a.form)
}delete a.req;
if(a.postHook){a.postHook()
}for(var b=0;
b<DWREngine._batches.length;
b++){if(DWREngine._batches[b]==a){DWREngine._batches.splice(b,1);
break
}}a.completed=true
};
DWREngine._handleError=function(b,a){if(DWREngine._errorHandler){DWREngine._errorHandler(b,a)
}else{alert("HE"+b)
}};
DWREngine._handleMetaDataError=function(d,a,b){if(d.errorHandler){d.errorHandler(a,b)
}else{alert("HMDE"+a)
}};
DWREngine._addSerializeFunctions=function(){Object.prototype.dwrSerialize=DWREngine._serializeObject;
Array.prototype.dwrSerialize=DWREngine._serializeArray;
Boolean.prototype.dwrSerialize=DWREngine._serializeBoolean;
Number.prototype.dwrSerialize=DWREngine._serializeNumber;
String.prototype.dwrSerialize=DWREngine._serializeString;
Date.prototype.dwrSerialize=DWREngine._serializeDate
};
DWREngine._removeSerializeFunctions=function(){delete Object.prototype.dwrSerialize;
delete Array.prototype.dwrSerialize;
delete Boolean.prototype.dwrSerialize;
delete Number.prototype.dwrSerialize;
delete String.prototype.dwrSerialize;
delete Date.prototype.dwrSerialize
};
DWREngine._serializeAll=function(e,b,a,d){if(a==null){e.map[d]="null:null";
return
}switch(typeof a){case"boolean":e.map[d]="boolean:"+a;
break;
case"number":e.map[d]="number:"+a;
break;
case"string":e.map[d]="string:"+encodeURIComponent(a);
break;
case"object":if(a.dwrSerialize){e.map[d]=a.dwrSerialize(e,b,a,d)
}else{if(a.nodeName){e.map[d]=DWREngine._serializeXml(e,b,a,d)
}else{if(DWREngine._warningHandler){DWREngine._warningHandler("Object without dwrSerialize: "+typeof a+", attempting default converter.")
}e.map[d]="default:"+a
}}break;
case"function":break;
default:if(DWREngine._warningHandler){DWREngine._warningHandler("Unexpected type: "+typeof a+", attempting default converter.")
}e.map[d]="default:"+a;
break
}};
DWREngine._lookup=function(d,a,e){var b;
for(var f=0;
f<d.length;
f++){if(d[f].data==a){b=d[f];
break
}}if(b){return"reference:"+b.name
}d.push({data:a,name:e});
return null
};
DWREngine._serializeObject=function(e,a,j,d){var h=DWREngine._lookup(a,this,d);
if(h){return h
}if(j.nodeName){return DWREngine._serializeXml(e,a,j,d)
}var g="Object:{";
var f;
for(f in this){if(f!="dwrSerialize"){e.paramCount++;
var b="c"+DWREngine._batch.map.callCount+"-e"+e.paramCount;
DWREngine._serializeAll(e,a,this[f],b);
g+=encodeURIComponent(f);
g+=":reference:";
g+=b;
g+=", "
}}if(g.substring(g.length-2)==", "){g=g.substring(0,g.length-2)
}g+="}";
return g
};
DWREngine._serializeXml=function(f,b,a,e){var h=DWREngine._lookup(b,this,e);
if(h){return h
}var d;
if(window.XMLSerializer){var g=new XMLSerializer();
d=g.serializeToString(a)
}else{d=a.toXml
}return"XML:"+encodeURIComponent(d)
};
DWREngine._serializeArray=function(e,a,j,d){var h=DWREngine._lookup(a,this,d);
if(h){return h
}var g="Array:[";
for(var f=0;
f<this.length;
f++){if(f!=0){g+=","
}e.paramCount++;
var b="c"+DWREngine._batch.map.callCount+"-e"+e.paramCount;
DWREngine._serializeAll(e,a,this[f],b);
g+="reference:";
g+=b
}g+="]";
return g
};
DWREngine._serializeBoolean=function(e,b,a,d){return"Boolean:"+this
};
DWREngine._serializeNumber=function(e,b,a,d){return"Number:"+this
};
DWREngine._serializeString=function(e,b,a,d){return"String:"+encodeURIComponent(this)
};
DWREngine._serializeDate=function(e,b,a,d){return"Date:"+this.getTime()
};
DWREngine._unserializeDocument=function(e){var a;
if(window.DOMParser){var d=new DOMParser();
a=d.parseFromString(e,"text/xml");
if(!a.documentElement||a.documentElement.tagName=="parsererror"){var f=a.documentElement.firstChild.data;
f+="\n"+a.documentElement.firstChild.nextSibling.firstChild.data;
throw f
}return a
}else{if(window.ActiveXObject){a=DWREngine._newActiveXObject(DWREngine._DOMDocument);
a.loadXML(e);
return a
}else{var b=document.createElement("div");
b.innerHTML=e;
return b
}}};
DWREngine._newActiveXObject=function(d){var b;
for(var a=0;
a<d.length;
a++){try{b=new ActiveXObject(d[a]);
break
}catch(e){}}return b
};
if(typeof window.encodeURIComponent==="undefined"){DWREngine._utf8=function(f){f=""+f;
var d;
var b;
var e="";
var a=0;
while(a<f.length){d=f.charCodeAt(a++);
if(d>=56320&&d<57344){continue
}if(d>=55296&&d<56320){if(a>=f.length){continue
}b=f.charCodeAt(a++);
if(b<56320||d>=56832){continue
}d=((d-55296)<<10)+(b-56320)+65536
}if(d<128){e+=String.fromCharCode(d)
}else{if(d<2048){e+=String.fromCharCode(192+(d>>6),128+(d&63))
}else{if(d<65536){e+=String.fromCharCode(224+(d>>12),128+(d>>6&63),128+(d&63))
}else{e+=String.fromCharCode(240+(d>>18),128+(d>>12&63),128+(d>>6&63),128+(d&63))
}}}}return e
};
DWREngine._hexchars="0123456789ABCDEF";
DWREngine._toHex=function(a){return DWREngine._hexchars.charAt(a>>4)+DWREngine._hexchars.charAt(a&15)
};
DWREngine._okURIchars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
window.encodeURIComponent=function(a){a=DWREngine._utf8(a);
var b;
var d="";
for(var e=0;
e<a.length;
e++){if(DWREngine._okURIchars.indexOf(a.charAt(e))==-1){d+="%"+DWREngine._toHex(a.charCodeAt(e))
}else{d+=a.charAt(e)
}}return d
}
}if(typeof Array.prototype.splice==="undefined"){Array.prototype.splice=function(a,d){if(arguments.length==0){return a
}if(typeof a!="number"){a=0
}if(a<0){a=Math.max(0,this.length+a)
}if(a>this.length){if(arguments.length>2){a=this.length
}else{return[]
}}if(arguments.length<2){d=this.length-a
}d=(typeof d=="number")?Math.max(0,d):0;
removeArray=this.slice(a,a+d);
endArray=this.slice(a+d);
this.length=a;
for(var b=2;
b<arguments.length;
b++){this[this.length]=arguments[b]
}for(b=0;
b<endArray.length;
b++){this[this.length]=endArray[b]
}return removeArray
}
}if(typeof Array.prototype.shift==="undefined"){Array.prototype.shift=function(a){var d=this[0];
for(var b=1;
b<this.length;
++b){this[b-1]=this[b]
}this.length--;
return d
}
}if(typeof Array.prototype.unshift==="undefined"){Array.prototype.unshift=function(){var b=unshift.arguments.length;
for(var a=this.length-1;
a>=0;
--a){this[a+b]=this[a]
}for(a=0;
a<b;
++a){this[a]=unshift.arguments[a]
}}
}if(typeof Array.prototype.push==="undefined"){Array.prototype.push=function(){var b=this.length;
for(var a=0;
a<push.arguments.length;
++a){this[b]=push.arguments[a];
b++
}}
}if(typeof Array.prototype.pop==="undefined"){Array.prototype.pop=function(){var a=this[this.length-1];
this.length--;
return a
}
}function DWRUtil(){}DWRUtil.onReturn=function(a,b){if(!a){a=window.event
}if(a&&a.keyCode&&a.keyCode==13){b()
}};
DWRUtil.selectRange=function(a,d,e){var b=a;
a=$(a);
if(a==null){alert("selectRange() can't find an element with id: "+b+".");
return
}if(a.setSelectionRange){a.setSelectionRange(d,e)
}else{if(a.createTextRange){var f=a.createTextRange();
f.moveStart("character",d);
f.moveEnd("character",e-a.value.length);
f.select()
}}a.focus()
};
var $;
if(!$&&document.getElementById){$=function(){var a=new Array();
for(var d=0;
d<arguments.length;
d++){var b=arguments[d];
if(typeof b=="string"){b=document.getElementById(b)
}if(arguments.length==1){return b
}a.push(b)
}return a
}
}else{if(!$&&document.all){$=function(){var a=new Array();
for(var d=0;
d<arguments.length;
d++){var b=arguments[d];
if(typeof b=="string"){b=document.all[b]
}if(arguments.length==1){return b
}a.push(b)
}return a
}
}}DWRUtil.toDescriptiveString=function(n,h,l){var j="";
var a=0;
var f;
var m;
if(h==null){h=0
}if(l==null){l=0
}if(n==null){return"null"
}if(DWRUtil._isArray(n)){if(n.length==0){j+="[]"
}else{if(h!=0){j+="[\n"
}else{j="["
}for(a=0;
a<n.length;
a++){try{m=n[a];
if(m==null||typeof m=="function"){continue
}else{if(typeof m=="object"){if(h>0){f=DWRUtil.toDescriptiveString(m,h-1,l+1)
}else{f=DWRUtil._detailedTypeOf(m)
}}else{f=""+m;
f=f.replace(/\/n/g,"\\n");
f=f.replace(/\/t/g,"\\t")
}}}catch(d){f=""+d
}if(h!=0){j+=DWRUtil._indent(h,l+2)+f+", \n"
}else{if(f.length>13){f=f.substring(0,10)+"..."
}j+=f+", ";
if(a>5){j+="...";
break
}}}if(h!=0){j+=DWRUtil._indent(h,l)+"]"
}else{j+="]"
}}return j
}if(typeof n=="string"||typeof n=="number"||DWRUtil._isDate(n)){return n.toString()
}if(typeof n=="object"){var k=DWRUtil._detailedTypeOf(n);
if(k!="Object"){j=k+" "
}if(h!=0){j+="{\n"
}else{j="{"
}var e=DWRUtil._isHTMLElement(n);
for(var g in n){if(e){if(g.toUpperCase()==g||g=="title"||g=="lang"||g=="dir"||g=="className"||g=="form"||g=="name"||g=="prefix"||g=="namespaceURI"||g=="nodeType"||g=="firstChild"||g=="lastChild"||g.match(/^offset/)){continue
}}f="";
try{m=n[g];
if(m==null||typeof m=="function"){continue
}else{if(typeof m=="object"){if(h>0){f="\n";
f+=DWRUtil._indent(h,l+2);
f=DWRUtil.toDescriptiveString(m,h-1,l+1)
}else{f=DWRUtil._detailedTypeOf(m)
}}else{f=""+m;
f=f.replace(/\/n/g,"\\n");
f=f.replace(/\/t/g,"\\t")
}}}catch(d){f=""+d
}if(h==0&&f.length>13){f=f.substring(0,10)+"..."
}var b=g;
if(b.length>30){b=b.substring(0,27)+"..."
}if(h!=0){j+=DWRUtil._indent(h,l+1)
}j+=g+":"+f+", ";
if(h!=0){j+="\n"
}a++;
if(h==0&&a>5){j+="...";
break
}}j+=DWRUtil._indent(h,l);
j+="}";
return j
}return n.toString()
};
DWRUtil._indent=function(b,a){var e="";
if(b!=0){for(var d=0;
d<a;
d++){e+="\u00A0\u00A0"
}e+=" "
}return e
};
DWRUtil.useLoadingMessage=function(a){var b;
if(a){b=a
}else{b="Loading"
}DWREngine.setPreHook(function(){var d=$("disabledZone");
if(!d){d=document.createElement("div");
d.setAttribute("id","disabledZone");
d.style.position="absolute";
d.style.zIndex="1000";
d.style.left="0px";
d.style.top="0px";
d.style.width="100%";
d.style.height="100%";
document.body.appendChild(d);
var f=document.createElement("div");
f.setAttribute("id","messageZone");
f.style.position="absolute";
f.style.top="0px";
f.style.right="0px";
f.style.background="red";
f.style.color="white";
f.style.fontFamily="Arial,Helvetica,sans-serif";
f.style.padding="4px";
d.appendChild(f);
var e=document.createTextNode(b);
f.appendChild(e)
}else{$("messageZone").innerHTML=b;
d.style.visibility="visible"
}});
DWREngine.setPostHook(function(){$("disabledZone").style.visibility="hidden"
})
};
DWRUtil.setValue=function(a,b){if(b==null){b=""
}var d=a;
var e,f;
a=$(a);
if(a==null){e=document.getElementsByName(d);
if(e.length>=1){a=e.item(0)
}}if(a==null){alert("setValue() can't find an element with id/name: "+d+".");
return
}if(DWRUtil._isHTMLElement(a,"select")){if(a.type=="select-multiple"&&DWRUtil._isArray(b)){DWRUtil._selectListItems(a,b)
}else{DWRUtil._selectListItem(a,b)
}return
}if(DWRUtil._isHTMLElement(a,"input")){if(e&&a.type=="radio"){for(f=0;
f<e.length;
f++){if(e.item(f).type=="radio"){e.item(f).checked=(e.item(f).value==b)
}}}else{switch(a.type){case"checkbox":case"check-box":a.checked=(b==true);
return;
case"radio":e=document.getElementsByName(d);
for(f=0;
f<e.length;
f++){if(e.item(f).type=="radio"){e.item(f).checked=(e.item(f).value==b)
}}a.checked=(b==true);
return;
default:a.value=b;
return
}}}if(DWRUtil._isHTMLElement(a,"textarea")){a.value=b;
return
}if(b.nodeType){if(b.nodeType==9){b=b.documentElement
}b=DWRUtil._importNode(a.ownerDocument,b,true);
a.appendChild(b);
return
}a.innerHTML=b
};
DWRUtil._selectListItems=function(b,d){var a=false;
var f;
var e;
for(f=0;
f<b.options.length;
f++){b.options[f].selected=false;
for(e=0;
e<d.length;
e++){if(b.options[f].value==d[e]){b.options[f].selected=true
}}}if(a){return
}for(f=0;
f<b.options.length;
f++){for(e=0;
e<d.length;
e++){if(b.options[f].text==d[e]){b.options[f].selected=true
}}}};
DWRUtil._selectListItem=function(a,b){var e=false;
var d;
for(d=0;
d<a.options.length;
d++){if(a.options[d].value==b){a.options[d].selected=true;
e=true
}else{a.options[d].selected=false
}}if(e){return
}for(d=0;
d<a.options.length;
d++){if(a.options[d].text==b){a.options[d].selected=true;
break
}}};
DWRUtil.getValue=function(b){var e;
var d=b;
b=$(b);
if(b==null){e=document.getElementsByName(d);
if(e.length>=1){b=e.item(0)
}}if(b==null){alert("getValue() can't find an element with id/name: "+d+".");
return""
}if(DWRUtil._isHTMLElement(b,"select")){var a=b.selectedIndex;
if(a!=-1){var f=b.options[a].value;
return f
}else{return""
}}if(DWRUtil._isHTMLElement(b,"input")){if(e&&b.type=="radio"){for(i=0;
i<e.length;
i++){if(e.item(i).type=="radio"){if(e.item(i).checked){return e.item(i).value
}}}}switch(b.type){case"checkbox":case"check-box":case"radio":if(b.checked){return b.checked
}else{return""
}default:return b.value
}}if(DWRUtil._isHTMLElement(b,"textarea")){return b.value
}return b.innerHTML
};
DWRUtil.getText=function(d){var a=d;
d=$(d);
if(d==null){alert("getText() can't find an element with id: "+a+".");
return""
}if(!DWRUtil._isHTMLElement(d,"select")){alert("getText() can only be used with select elements. Attempt to use: "+DWRUtil._detailedTypeOf(d)+" from  id: "+a+".");
return""
}var b=d.selectedIndex;
if(b!=-1){return d.options[b].text
}else{return""
}};
DWRUtil.setValues=function(b){for(var a in b){var e=$(a);
if(e!=null){var d=b[a];
DWRUtil.setValue(a,d)
}}};
DWRUtil.getValues=function(a){for(var d in a){var b=$(d);
if(b!=null){a[d]=DWRUtil.getValue(d)
}}};
DWRUtil.addOptions=function(g,a){var d=g;
g=$(g);
if(g==null){alert("addOptions() can't find an element with id: "+d+".");
return
}var k=DWRUtil._isHTMLElement(g,"select");
var b=DWRUtil._isHTMLElement(g,["ul","ol"]);
if(!k&&!b){alert("addOptions() can only be used with select elements. Attempt to use: "+DWRUtil._detailedTypeOf(g));
return
}if(a==null){return
}var f;
var e;
var j;
if(DWRUtil._isArray(a)){for(var l=0;
l<a.length;
l++){if(k){if(arguments[2]!=null){if(arguments[3]!=null){f=DWRUtil._getValueFrom(a[l],arguments[3]);
e=DWRUtil._getValueFrom(a[l],arguments[2])
}else{e=DWRUtil._getValueFrom(a[l],arguments[2]);
f=e
}}else{f=DWRUtil._getValueFrom(a[l],arguments[3]);
e=f
}if(f||e){j=new Option(f,e);
g.options[g.options.length]=j
}}else{li=document.createElement("li");
e=DWRUtil._getValueFrom(a[l],arguments[2]);
if(e!=null){e=""+new String(e);
if(e.indexOf("<li>")==0){e=e.substring("<li>".length)
}if(e.indexOf("</li>")!=-1){e=e.substring(0,e.indexOf("</li>"))
}li.innerHTML=e;
g.appendChild(li)
}}}}else{for(var h in a){if(!k){alert("DWRUtil.addOptions can only create select lists from objects.");
return
}if(arguments[2]){f=h;
e=a[h]
}else{f=a[h];
e=h
}if(f||e){j=new Option(f,e);
g.options[g.options.length]=j
}}}};
DWRUtil._getValueFrom=function(a,b){if(b==null){return a
}else{if(typeof b=="function"){return b(a)
}else{return a[b]
}}};
DWRUtil.removeAllOptions=function(e){var b=e;
e=$(e);
if(e==null){alert("removeAllOptions() can't find an element with id: "+b+".");
return
}var d=DWRUtil._isHTMLElement(e,"select");
var a=DWRUtil._isHTMLElement(e,["ul","ol"]);
if(!d&&!a){alert("removeAllOptions() can only be used with select, ol and ul elements. Attempt to use: "+DWRUtil._detailedTypeOf(e));
return
}if(d){e.options.length=0
}else{while(e.childNodes.length>0){e.removeChild(e.firstChild)
}}};
DWRUtil.addRows=function(h,g,b,d){var a=h;
h=$(h);
if(h==null){alert("addRows() can't find an element with id: "+a+".");
return
}if(!DWRUtil._isHTMLElement(h,["table","tbody","thead","tfoot"])){alert("addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: "+DWRUtil._detailedTypeOf(h));
return
}if(!d){d={}
}if(!d.rowCreator){d.rowCreator=DWRUtil._defaultRowCreator
}if(!d.cellCreator){d.cellCreator=DWRUtil._defaultCellCreator
}var f,e;
if(DWRUtil._isArray(g)){for(e=0;
e<g.length;
e++){f=DWRUtil._addRowInner(g[e],b,d);
if(f!=null){h.appendChild(f)
}}}else{if(typeof g=="object"){e=0;
for(var j in g){f=DWRUtil._addRowInner(j,b,d,e);
if(f!=null){h.appendChild(f)
}e++
}}}};
DWRUtil._addRowInner=function(g,k,h,e){var f=h.rowCreator(g,e);
if(f==null){return null
}for(var d=0;
d<k.length;
d++){var a=k[d];
var b;
if(typeof a=="string"){b=h.cellCreator();
b.appendChild(document.createTextNode(a))
}else{var l=a(g);
b=h.cellCreator(l,d);
if(DWRUtil._isHTMLElement(l,"td")){b=l
}else{if(DWRUtil._isHTMLElement(l)){b.appendChild(l)
}else{b.innerHTML=l
}}}f.appendChild(b)
}return f
};
DWRUtil._defaultRowCreator=function(b,a){return document.createElement("tr")
};
DWRUtil._defaultCellCreator=function(b,a){return document.createElement("td")
};
DWRUtil.removeAllRows=function(a){var b=a;
a=$(a);
if(a==null){alert("removeAllRows() can't find an element with id: "+b+".");
return
}if(!DWRUtil._isHTMLElement(a,["table","tbody","thead","tfoot"])){alert("removeAllRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: "+DWRUtil._detailedTypeOf(a));
return
}while(a.childNodes.length>0){a.removeChild(a.firstChild)
}};
DWRUtil._isHTMLElement=function(a,d){if(a==null||typeof a!="object"||a.nodeName==null){return false
}if(d!=null){var b=a.nodeName.toLowerCase();
if(typeof d=="string"){return b==d.toLowerCase()
}if(DWRUtil._isArray(d)){var e=false;
for(var f=0;
f<d.length&&!e;
f++){if(b==d[f].toLowerCase()){e=true
}}return e
}alert("DWRUtil._isHTMLElement was passed test node name that is neither a string or array of strings");
return false
}return true
};
DWRUtil._detailedTypeOf=function(a){var b=typeof a;
if(b=="object"){b=Object.prototype.toString.apply(a);
b=b.substring(8,b.length-1)
}return b
};
DWRUtil._isArray=function(a){return(a&&a.join)?true:false
};
DWRUtil._isDate=function(a){return(a&&a.toUTCString)?true:false
};
DWRUtil._importNode=function(d,b,f){var a;
if(b.nodeType==1){a=d.createElement(b.nodeName);
for(var g=0;
g<b.attributes.length;
g++){var e=b.attributes[g];
if(e.nodeValue!=null&&e.nodeValue!=""){a.setAttribute(e.name,e.nodeValue)
}}if(typeof b.style!="undefined"){a.style.cssText=b.style.cssText
}}else{if(b.nodeType==3){a=d.createTextNode(b.nodeValue)
}}if(f&&b.hasChildNodes()){for(g=0;
g<b.childNodes.length;
g++){a.appendChild(DWRUtil._importNode(d,b.childNodes[g],true))
}}return a
};
if(typeof document.importNode!="function"){document.importNode=function(b,a){DWRUtil._importNode(this,b,a)
}
};
