var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,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,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(){function a(){this.initialize.apply(this,arguments)}var b=null,c=$A(arguments);if(Object.isFunction(c[0]))b=c.shift();Object.extend(a,Class.Methods);a.superclass=b;a.subclasses=[];if(b){var d=function(){};d.prototype=b.prototype;a.prototype=new d;b.subclasses.push(a)}for(b=0;b<c.length;b++)a.addMethods(c[b]);if(!a.prototype.initialize)a.prototype.initialize=Prototype.emptyFunction;return a.prototype.constructor=a}};
Class.Methods={addMethods:function(a){var b=this.superclass&&this.superclass.prototype,c=Object.keys(a);Object.keys({toString:true}).length||c.push("toString","valueOf");for(var d=0,e=c.length;d<e;d++){var f=c[d],g=a[f];if(b&&Object.isFunction(g)&&g.argumentNames().first()=="$super"){var j=g;g=Object.extend(function(h){return function(){return b[h].apply(this,arguments)}}(f).wrap(j),{valueOf:function(){return j},toString:function(){return j.toString()}})}this.prototype[f]=g}return this}};
var Abstract={};Object.extend=function(a,b){for(var c in b)a[c]=b[c];return a};
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(a){switch(typeof a){case "undefined":case "function":case "unknown":return;case "boolean":return a.toString()}if(a===null)return"null";if(a.toJSON)return a.toJSON();if(!Object.isElement(a)){var b=[];for(var c in a){var d=Object.toJSON(a[c]);Object.isUndefined(d)||b.push(c.toJSON()+
": "+d)}return"{"+b.join(", ")+"}"}},toQueryString:function(a){return $H(a).toQueryString()},toHTML:function(a){return a&&a.toHTML?a.toHTML():String.interpret(a)},keys:function(a){var b=[];for(var c in a)b.push(c);return b},values:function(a){var b=[];for(var c in a)b.push(a[c]);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].split(",").invoke("strip");return a.length==1&&!a[0]?[]:a},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var a=this,b=$A(arguments),c=b.shift();return function(){return a.apply(c,b.concat($A(arguments)))}},bindAsEventListener:function(){var a=this,b=$A(arguments),c=b.shift();return function(d){return a.apply(c,[d||window.event].concat(b))}},
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 a=this,b=$A(arguments),c=b.shift()*1E3;return window.setTimeout(function(){return a.apply(a,b)},c)},wrap:function(a){var b=this;return function(){return a.apply(this,[b.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)))}}});
Function.prototype.defer=Function.prototype.delay.curry(0.01);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(){for(var a,b=0,c=arguments.length;b<c;b++){var d=arguments[b];try{a=d();break}catch(e){}}return a}};RegExp.prototype.match=RegExp.prototype.test;
RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};
var PeriodicalExecuter=Class.create({initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},execute:function(){this.callback(this)},stop:function(){if(this.timer){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:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r","\\":"\\\\"}});
Object.extend(String.prototype,{gsub:function(a,b){var c="",d=this,e;for(b=arguments.callee.prepareReplacement(b);d.length>0;)if(e=d.match(a)){c+=d.slice(0,e.index);c+=String.interpret(b(e));d=d.slice(e.index+e[0].length)}else{c+=d;d=""}return c},sub:function(a,b,c){b=this.gsub.prepareReplacement(b);c=Object.isUndefined(c)?1:c;return this.gsub(a,function(d){if(--c<0)return d[0];return b(d)})},scan:function(a,b){this.gsub(a,b);return String(this)},truncate:function(a,b){a=a||30;b=Object.isUndefined(b)?
"...":b;return this.length>a?this.slice(0,a-b.length)+b: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 a=new RegExp(Prototype.ScriptFragment,"img"),b=new RegExp(Prototype.ScriptFragment,"im");return(this.match(a)||[]).map(function(c){return(c.match(b)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(a){return eval(a)})},
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,c){return b+c.nodeValue}):a.childNodes[0].nodeValue:""},toQueryParams:function(a){var b=this.strip().match(/([^?#]*)(#.*)?$/);if(!b)return{};return b[1].split(a||"&").inject({},function(c,d){if((d=d.split("="))[0]){var e=decodeURIComponent(d.shift()),f=d.length>
1?d.join("="):d[0];if(f!=undefined)f=decodeURIComponent(f);if(e in c){Object.isArray(c[e])||(c[e]=[c[e]]);c[e].push(f)}else c[e]=f}return c})},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 a=this.split("-"),b=a.length;if(b==1)return a[0];for(var c=this.charAt(0)=="-"?a[0].charAt(0).toUpperCase()+a[0].substring(1):
a[0],d=1;d<b;d++)c+=a[d].charAt(0).toUpperCase()+a[d].substring(1);return c},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(a){var b=this.gsub(/[\x00-\x1f\\]/,function(c){var d=String.specialChar[c[0]];return d?d:"\\u00"+c[0].charCodeAt().toPaddedString(2,
16)});if(a)return'"'+b.replace(/"/g,'\\"')+'"';return"'"+b.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(true)},unfilterJSON:function(a){return this.sub(a||Prototype.JSONFilter,"#{1}")},isJSON:function(){var a;if(this.blank())return false;a=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(a)},evalJSON:function(a){var b=this.unfilterJSON();try{if(!a||b.isJSON())return eval("("+b+")")}catch(c){}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.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">")}});String.prototype.gsub.prepareReplacement=function(a){if(Object.isFunction(a))return a;var b=new Template(a);return function(c){return b.evaluate(c)}};String.prototype.parseQuery=String.prototype.toQueryParams;
Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML)div.appendChild(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 c=b[1]||"";if(c=="\\")return b[2];var d=a,e=b[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;b=f.exec(e);if(b==null)return c;for(;b!=null;){var g=b[1].startsWith("[")?b[2].gsub("\\\\]","]"):b[1];d=d[g];if(null==d||""==
b[3])break;e=e.substring("["==b[3]?b[1].length:b[0].length);b=f.exec(e)}return c+String.interpret(d)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
var $break={},Enumerable={each:function(a,b){var c=0;a=a.bind(b);try{this._each(function(e){a(e,c++)})}catch(d){if(d!=$break)throw d;}return this},eachSlice:function(a,b,c){b=b?b.bind(c):Prototype.K;for(var d=-a,e=[],f=this.toArray();(d+=a)<f.length;)e.push(f.slice(d,d+a));return e.collect(b,c)},all:function(a,b){a=a?a.bind(b):Prototype.K;var c=true;this.each(function(d,e){c=c&&!!a(d,e);if(!c)throw $break;});return c},any:function(a,b){a=a?a.bind(b):Prototype.K;var c=false;this.each(function(d,e){if(c=
!!a(d,e))throw $break;});return c},collect:function(a,b){a=a?a.bind(b):Prototype.K;var c=[];this.each(function(d,e){c.push(a(d,e))});return c},detect:function(a,b){a=a.bind(b);var c;this.each(function(d,e){if(a(d,e)){c=d;throw $break;}});return c},findAll:function(a,b){a=a.bind(b);var c=[];this.each(function(d,e){a(d,e)&&c.push(d)});return c},grep:function(a,b,c){b=b?b.bind(c):Prototype.K;var d=[];if(Object.isString(a))a=new RegExp(a);this.each(function(e,f){a.match(e)&&d.push(b(e,f))});return d},
include:function(a){if(Object.isFunction(this.indexOf))if(this.indexOf(a)!=-1)return true;var b=false;this.each(function(c){if(c==a){b=true;throw $break;}});return b},inGroupsOf:function(a,b){b=Object.isUndefined(b)?null:b;return this.eachSlice(a,function(c){for(;c.length<a;)c.push(b);return c})},inject:function(a,b,c){b=b.bind(c);this.each(function(d,e){a=b(a,d,e)});return a},invoke:function(a){var b=$A(arguments).slice(1);return this.map(function(c){return c[a].apply(c,b)})},max:function(a,b){a=
a?a.bind(b):Prototype.K;var c;this.each(function(d,e){d=a(d,e);if(c==null||d>=c)c=d});return c},min:function(a,b){a=a?a.bind(b):Prototype.K;var c;this.each(function(d,e){d=a(d,e);if(c==null||d<c)c=d});return c},partition:function(a,b){a=a?a.bind(b):Prototype.K;var c=[],d=[];this.each(function(e,f){(a(e,f)?c:d).push(e)});return[c,d]},pluck:function(a){var b=[];this.each(function(c){b.push(c[a])});return b},reject:function(a,b){a=a.bind(b);var c=[];this.each(function(d,e){a(d,e)||c.push(d)});return c},
sortBy:function(a,b){a=a.bind(b);return this.map(function(c,d){return{value:c,criteria:a(c,d)}}).sort(function(c,d){var e=c.criteria,f=d.criteria;return e<f?-1:e>f?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var a=Prototype.K,b=$A(arguments);if(Object.isFunction(b.last()))a=b.pop();var c=[this].concat(b).map($A);return this.map(function(d,e){return a(c.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();for(var b=a.length||0,c=new Array(b);b--;)c[b]=a[b];return c}
if(Prototype.Browser.WebKit)$A=function(a){if(!a)return[];if(!(Object.isFunction(a)&&a=="[object NodeList]")&&a.toArray)return a.toArray();for(var b=a.length||0,c=new Array(b);b--;)c[b]=a[b];return c};Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse)Array.prototype._reverse=Array.prototype.reverse;
Object.extend(Array.prototype,{_each:function(a){for(var b=0,c=this.length;b<c;b++)a(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(a,b){return a.concat(Object.isArray(b)?b.flatten():[b])})},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(b,c,d){if(0==d||(a?b.last()!=c:!b.include(c)))b.push(c);return b})},intersect:function(a){return this.uniq().findAll(function(b){return a.detect(function(c){return b===c})})},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){b=
Object.toJSON(b);Object.isUndefined(b)||a.push(b)});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 c=this.length;if(b<0)b=c+b;for(;b<c;b++)if(this[b]===a)return b;return-1};
if(!Array.prototype.lastIndexOf)Array.prototype.lastIndexOf=function(a,b){b=isNaN(b)?this.length:(b<0?this.length+b:b)+1;var c=this.slice(0,b).reverse().indexOf(a);return c<0?c:b-c-1};Array.prototype.toArray=Array.prototype.clone;function $w(a){if(!Object.isString(a))return[];return(a=a.strip())?a.split(/\s+/):[]}
if(Prototype.Browser.Opera)Array.prototype.concat=function(){for(var a=[],b=0,c=this.length;b<c;b++)a.push(this[b]);b=0;for(c=arguments.length;b<c;b++)if(Object.isArray(arguments[b]))for(var d=0,e=arguments[b].length;d<e;d++)a.push(arguments[b][d]);else a.push(arguments[b]);return a};
Object.extend(Number.prototype,{toColorPart:function(){return this.toPaddedString(2,16)},succ:function(){return this+1},times:function(a){$R(0,this,true).each(a);return this},toPaddedString:function(a,b){var c=this.toString(b||10);return"0".times(a-c.length)+c},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,c){if(Object.isUndefined(c))return b;return b+"="+encodeURIComponent(String.interpret(c))}return{initialize:function(b){this._object=Object.isHash(b)?b.toObject():Object.clone(b)},_each:function(b){for(var c in this._object){var d=this._object[c],e=[c,d];e.key=c;e.value=d;b(e)}},set:function(b,c){return this._object[b]=c},get:function(b){return this._object[b]},unset:function(b){var c=this._object[b];delete this._object[b];return c},toObject:function(){return Object.clone(this._object)},
keys:function(){return this.pluck("key")},values:function(){return this.pluck("value")},index:function(b){var c=this.detect(function(d){return d.value===b});return c&&c.key},merge:function(b){return this.clone().update(b)},update:function(b){return(new Hash(b)).inject(this,function(c,d){c.set(d.key,d.value);return c})},toQueryString:function(){return this.map(function(b){var c=encodeURIComponent(b.key);if((b=b.value)&&typeof b=="object")if(Object.isArray(b))return b.map(a.curry(c)).join("&");return a(c,
b)}).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,c){this.start=a;this.end=b;this.exclusive=c},_each:function(a){for(var b=this.start;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}}),$R=function(a,b,c){return new ObjectRange(a,b,c)},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){this.include(a)||this.responders.push(a)},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(a,b,c,d){this.each(function(e){if(Object.isFunction(e[a]))try{e[a].apply(e,[b,c,d])}catch(f){}})}};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,c){$super(c);this.transport=Ajax.getTransport();this.request(b)},request:function(a){this.url=a;this.method=this.options.method;a=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){a._method=this.method;this.method="post"}this.parameters=a;if(a=Object.toQueryString(a))if(this.method=="get")this.url+=(this.url.include("?")?"&":"?")+a;else if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))a+=
"&_=";try{var b=new Ajax.Response(this);this.options.onCreate&&this.options.onCreate(b);Ajax.Responders.dispatch("onCreate",this,b);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);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||a:null;this.transport.send(this.body);!this.options.asynchronous&&this.transport.overrideMimeType&&
this.onStateChange()}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;a>1&&!(a==4&&this._complete)&&this.respondToReadyState(this.transport.readyState)},setRequestHeaders:function(){var a={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){a["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)a.Connection="close"}if(typeof this.options.requestHeaders=="object"){var b=this.options.requestHeaders;if(Object.isFunction(b.push))for(var c=0,d=b.length;c<d;c+=2)a[b[c]]=b[c+1];else $H(b).each(function(f){a[f.key]=f.value})}for(var e in a)this.transport.setRequestHeader(e,a[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(a){a=Ajax.Request.Events[a];var b=new Ajax.Response(this);if(a=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(c){this.dispatchException(c)}var d=b.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)(b,b.headerJSON);Ajax.Responders.dispatch("on"+a,this,b,b.headerJSON)}catch(e){this.dispatchException(e)}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(a){this.dispatchException(a)}},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;a=this.transport=a.transport;var b=this.readyState=a.readyState;if(b>2&&!Prototype.Browser.IE||b==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(a.responseText);this.headerJSON=this._getHeaderJSON()}if(b==4){a=a.responseXML;this.responseXML=Object.isUndefined(a)?null:a;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,b,c,d){this.container={success:b.success||b,failure:b.failure||(b.success?null:b)};d=Object.clone(d);var e=d.onComplete;d.onComplete=function(f,g){this.updateContent(f.responseText);Object.isFunction(e)&&e(f,g)}.bind(this);$super(c,d)},updateContent:function(a){var b=this.container[this.success()?"success":"failure"],c=this.options;c.evalScripts||(a=a.stripScripts());if(b=$(b))if(c.insertion)if(Object.isString(c.insertion)){var d=
{};d[c.insertion]=a;b.insert(d)}else c.insertion(b,a);else b.update(a)}});
Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,b,c,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=c;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 $(a){if(arguments.length>1){for(var b=0,c=[],d=arguments.length;b<d;b++)c.push($(arguments[b]));return c}if(Object.isString(a))a=document.getElementById(a);return Element.extend(a)}if(Prototype.BrowserFeatures.XPath)document._getElementsByXPath=function(a,b){for(var c=[],d=document.evaluate(a,$(b)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),e=0,f=d.snapshotLength;e<f;e++)c.push(Element.extend(d.snapshotItem(e)));return c};if(!window.Node)var Node={};
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(b,c){c=c||{};b=b.toLowerCase();var d=Element.cache;if(Prototype.Browser.IE&&c.name){b="<"+b+' name="'+c.name+'">';delete c.name;return Element.writeAttribute(document.createElement(b),c)}d[b]||(d[b]=Element.extend(document.createElement(b)));return Element.writeAttribute(d[b].cloneNode(false),c)};Object.extend(this.Element,a||{})}).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).style.display="none";return a},show:function(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(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();else if(!Object.isElement(b)){b=Object.toHTML(b);var c=a.ownerDocument.createRange();c.selectNode(a);b.evalScripts.bind(b).defer();b=c.createContextualFragment(b.stripScripts())}a.parentNode.replaceChild(b,a);return a},insert:function(a,b){a=$(a);if(Object.isString(b)||Object.isNumber(b)||Object.isElement(b)||b&&(b.toElement||b.toHTML))b={bottom:b};var c,d,e;for(var f in b){c=b[f];f=f.toLowerCase();d=Element._insertionTranslations[f];
if(c&&c.toElement)c=c.toElement();if(Object.isElement(c))d(a,c);else{c=Object.toHTML(c);e=(f=="before"||f=="after"?a.parentNode:a).tagName.toUpperCase();e=Element._getContentFromAnonymousElement(e,c.stripScripts());if(f=="top"||f=="after")e.reverse();e.each(d.curry(a));c.evalScripts.bind(c).defer()}}return a},wrap:function(a,b,c){a=$(a);if(Object.isElement(b))$(b).writeAttribute(c||{});else b=Object.isString(b)?new Element(b,c):new Element("div",b);a.parentNode&&a.parentNode.replaceChild(b,a);b.appendChild(a);
return b},inspect:function(a){a=$(a);var b="<"+a.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(c){var d=c.first();c=c.last();if(d=(a[d]||"").toString())b+=" "+c+"="+d.inspect(true)});return b+">"},recursivelyCollect:function(a,b){a=$(a);for(var c=[];a=a[b];)a.nodeType==1&&c.push(Element.extend(a));return c},ancestors:function(a){return $(a).recursivelyCollect("parentNode")},descendants:function(a){return $(a).select("*")},firstDescendant:function(a){for(a=$(a).firstChild;a&&
a.nodeType!=1;)a=a.nextSibling;return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild))return[];for(;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(a,b){if(Object.isString(b))b=new Selector(b);
return b.match($(a))},up:function(a,b,c){a=$(a);if(arguments.length==1)return $(a.parentNode);var d=a.ancestors();return Object.isNumber(b)?d[b]:Selector.findElement(d,b,c)},down:function(a,b,c){a=$(a);if(arguments.length==1)return a.firstDescendant();return Object.isNumber(b)?a.descendants()[b]:a.select(b)[c||0]},previous:function(a,b,c){a=$(a);if(arguments.length==1)return $(Selector.handlers.previousElementSibling(a));var d=a.previousSiblings();return Object.isNumber(b)?d[b]:Selector.findElement(d,
b,c)},next:function(a,b,c){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,c)},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(a){a=$(a);var b=a.readAttribute("id"),c=arguments.callee;if(b)return b;do b="anonymous_element_"+
c.counter++;while($(b));a.writeAttribute("id",b);return b},readAttribute:function(a,b){a=$(a);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b])return c.values[b](a,b);if(c.names[b])b=c.names[b];if(b.include(":"))return!a.attributes||!a.attributes[b]?null:a.attributes[b].value}return a.getAttribute(b)},writeAttribute:function(a,b,c){a=$(a);var d={},e=Element._attributeTranslations.write;if(typeof b=="object")d=b;else d[b]=Object.isUndefined(c)?true:c;for(var f in d){b=
e.names[f]||f;c=d[f];if(e.values[f])b=e.values[f](a,c);if(c===false||c===null)a.removeAttribute(b);else c===true?a.setAttribute(b,b):a.setAttribute(b,c)}return a},getHeight:function(a){return $(a).getDimensions().height},getWidth:function(a){return $(a).getDimensions().width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(a=$(a)){var c=a.className;return c.length>0&&(c==b||(new RegExp("(^|\\s)"+b+"(\\s|$)")).test(c))}},addClassName:function(a,b){if(a=$(a)){a.hasClassName(b)||
(a.className+=(a.className?" ":"")+b);return a}},removeClassName:function(a,b){if(a=$(a)){a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a}},toggleClassName:function(a,b){if(a=$(a))return a[a.hasClassName(b)?"removeClassName":"addClassName"](b)},cleanWhitespace:function(a){a=$(a);for(var b=a.firstChild;b;){var c=b.nextSibling;b.nodeType==3&&!/\S/.test(b.nodeValue)&&a.removeChild(b);b=c}return a},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(a,
b){a=$(a);var c=b=$(b);if(a.compareDocumentPosition)return(a.compareDocumentPosition(b)&8)===8;if(a.sourceIndex&&!Prototype.Browser.Opera){var d=a.sourceIndex,e=b.sourceIndex,f=b.nextSibling;if(!f){do b=b.parentNode;while(!(f=b.nextSibling)&&b.parentNode)}if(f&&f.sourceIndex)return d>e&&d<f.sourceIndex}for(;a=a.parentNode;)if(a==c)return true;return false},scrollTo:function(a){a=$(a);var b=a.cumulativeOffset();window.scrollTo(b[0],b[1]);return a},getStyle:function(a,b){a=$(a);b=b=="float"?"cssFloat":
b.camelize();var c=a.style[b];if(!c)c=(c=document.defaultView.getComputedStyle(a,null))?c[b]:null;if(b=="opacity")return c?parseFloat(c):1;return c=="auto"?null:c},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(a,b){a=$(a);var c=a.style;if(Object.isString(b)){a.style.cssText+=";"+b;return b.include("opacity")?a.setOpacity(b.match(/opacity:\s*(\d?\.?\d*)/)[1]):a}for(var d in b)if(d=="opacity")a.setOpacity(b[d]);else c[d=="float"||d=="cssFloat"?Object.isUndefined(c.styleFloat)?
"cssFloat":"styleFloat":d]=b[d];return a},setOpacity:function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;return a},getDimensions:function(a){a=$(a);var b=$(a).getStyle("display");if(b!="none"&&b!=null)return{width:a.offsetWidth,height:a.offsetHeight};b=a.style;var c=b.visibility,d=b.position,e=b.display;b.visibility="hidden";b.position="absolute";b.display="block";var f=a.clientWidth;a=a.clientHeight;b.display=e;b.position=d;b.visibility=c;return{width:f,height:a}},makePositioned:function(a){a=
$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(window.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(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;a=a.offsetParent}while(a);return Element._returnOffset(c,b)},positionedOffset:function(a){var b=0,c=0;do{b+=a.offsetTop||0;c+=a.offsetLeft||0;if(a=a.offsetParent){if(a.tagName=="BODY")break;if(Element.getStyle(a,"position")!=="static")break}}while(a);return Element._returnOffset(c,b)},
absolutize:function(a){a=$(a);if(a.getStyle("position")!="absolute"){var b=a.positionedOffset(),c=b[1];b=b[0];var d=a.clientWidth,e=a.clientHeight;a._originalLeft=b-parseFloat(a.style.left||0);a._originalTop=c-parseFloat(a.style.top||0);a._originalWidth=a.style.width;a._originalHeight=a.style.height;a.style.position="absolute";a.style.top=c+"px";a.style.left=b+"px";a.style.width=d+"px";a.style.height=e+"px";return a}},relativize:function(a){a=$(a);if(a.getStyle("position")!="relative"){a.style.position=
"relative";var b=parseFloat(a.style.top||0)-(a._originalTop||0),c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=b+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a}},cumulativeScrollOffset:function(a){var b=0,c=0;do{b+=a.scrollTop||0;c+=a.scrollLeft||0;a=a.parentNode}while(a);return Element._returnOffset(c,b)},getOffsetParent:function(a){if(a.offsetParent)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&
a!=document.body;)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)},viewportOffset:function(a){var b=0,c=0,d=a;do{b+=d.offsetTop||0;c+=d.offsetLeft||0;if(d.offsetParent==document.body&&Element.getStyle(d,"position")=="absolute")break}while(d=d.offsetParent);d=a;do if(!Prototype.Browser.Opera||d.tagName=="BODY"){b-=d.scrollTop||0;c-=d.scrollLeft||0}while(d=d.parentNode);return Element._returnOffset(c,b)},clonePosition:function(a,b,c){c=Object.extend({setLeft:true,setTop:true,
setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},c||{});b=$(b);var d=b.viewportOffset();a=$(a);var e=[0,0],f=null;if(Element.getStyle(a,"position")=="absolute"){f=a.getOffsetParent();e=f.viewportOffset()}if(f==document.body){e[0]-=document.body.offsetLeft;e[1]-=document.body.offsetTop}if(c.setLeft)a.style.left=d[0]-e[0]+c.offsetLeft+"px";if(c.setTop)a.style.top=d[1]-e[1]+c.offsetTop+"px";if(c.setWidth)a.style.width=b.offsetWidth+"px";if(c.setHeight)a.style.height=b.offsetHeight+"px";return a}};
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(a,b,c){switch(c){case "left":case "top":case "right":case "bottom":if(a(b,"position")==="static")return null;case "height":case "width":if(!Element.visible(b))return null;var d=parseInt(a(b,c),10);if(d!==b["offset"+c.capitalize()])return d+"px";return(c==="height"?["border-top-width","padding-top","padding-bottom","border-bottom-width"]:["border-left-width","padding-left","padding-right","border-right-width"]).inject(d,
function(e,f){var g=a(b,f);return g===null?e:e-parseInt(g,10)})+"px";default:return a(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(a,b,c){if(c==="title")return b.title;return a(b,c)})}else if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(a,b){b=$(b);var c=b.getStyle("position");if(c!=="static")return a(b);b.setStyle({position:"relative"});var d=a(b);b.setStyle({position:c});return d});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=
Element.Methods[a].wrap(function(b,c){c=$(c);var d=c.getStyle("position");if(d!=="static")return b(c);var e=c.getOffsetParent();e&&e.getStyle("position")==="fixed"&&e.setStyle({zoom:1});c.setStyle({position:"relative"});e=b(c);c.setStyle({position:d});return e})});Element.Methods.getStyle=function(a,b){a=$(a);b=b=="float"||b=="cssFloat"?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle)c=a.currentStyle[b];if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/))if(c[1])return parseFloat(c[1])/
100;return 1}if(c=="auto"){if((b=="width"||b=="height")&&a.getStyle("display")!="none")return a["offset"+b.capitalize()]+"px";return null}return c};Element.Methods.setOpacity=function(a,b){a=$(a);var c=a.currentStyle;if(c&&!c.hasLayout||!c&&a.style.zoom=="normal")a.style.zoom=1;c=a.getStyle("filter");var d=a.style;if(b==1||b===""){(c=c.replace(/alpha\([^\)]*\)/gi,""))?(d.filter=c):d.removeAttribute("filter");return a}else if(b<1.0E-5)b=0;d.filter=c.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+
b*100+")";return a};Element._attributeTranslations={read:{names:{"class":"className","for":"htmlFor"},values:{_getAttr:function(a,b){return a.getAttribute(b,2)},_getAttrNode:function(a,b){var c=a.getAttributeNode(b);return c?c.value:""},_getEv:function(a,b){return(b=a.getAttribute(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").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<1.0E-5?0:b;return a};else if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=b==1||b===""?"":b<1.0E-5?0:b;if(b==1)if(a.tagName=="IMG"&&a.width){a.width++;a.width--}else try{var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(d){}return a};Element.Methods.cumulativeOffset=function(a){var b=0,c=0;do{b+=a.offsetTop||
0;c+=a.offsetLeft||0;if(a.offsetParent==document.body)if(Element.getStyle(a,"position")=="absolute")break;a=a.offsetParent}while(a);return Element._returnOffset(c,b)}}
if(Prototype.Browser.IE||Prototype.Browser.Opera)Element.Methods.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);var c=a.tagName.toUpperCase();if(c in Element._insertionTranslations.tags){$A(a.childNodes).each(function(d){a.removeChild(d)});Element._getContentFromAnonymousElement(c,b.stripScripts()).each(function(d){a.appendChild(d)})}else a.innerHTML=b.stripScripts();b.evalScripts.bind(b).defer();return a};
if("outerHTML"in document.createElement("div"))Element.Methods.replace=function(a,b){a=$(a);if(b&&b.toElement)b=b.toElement();if(Object.isElement(b)){a.parentNode.replaceChild(b,a);return a}b=Object.toHTML(b);var c=a.parentNode,d=c.tagName.toUpperCase();if(Element._insertionTranslations.tags[d]){var e=a.next();d=Element._getContentFromAnonymousElement(d,b.stripScripts());c.removeChild(a);e?d.each(function(f){c.insertBefore(f,e)}):d.each(function(f){c.appendChild(f)})}else a.outerHTML=b.stripScripts();
b.evalScripts.bind(b).defer();return a};Element._returnOffset=function(a,b){var c=[a,b];c.left=a;c.top=b;return c};Element._getContentFromAnonymousElement=function(a,b){var c=new Element("div"),d=Element._insertionTranslations.tags[a];if(d){c.innerHTML=d[0]+b+d[1];d[2].times(function(){c=c.firstChild})}else c.innerHTML=b;return $A(c.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(a,b){b=Element._attributeTranslations.has[b]||b;var c=$(a).getAttributeNode(b);return c&&c.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 a={},b=Element.Methods.ByTag,c=Object.extend(function(d){if(!d||d._extendedByPrototype||d.nodeType!=1||d==window)return d;var e=Object.clone(a),f=d.tagName,g;b[f]&&Object.extend(e,b[f]);for(g in e){f=e[g];if(Object.isFunction(f)&&!(g in d))d[g]=f.methodize()}d._extendedByPrototype=Prototype.emptyFunction;return d},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,
Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});c.refresh();return c}();Element.hasAttribute=function(a,b){if(a.hasAttribute)return a.hasAttribute(b);return Element.Methods.Simulated.hasAttribute(a,b)};
Element.addMethods=function(a){function b(h){h=h.toUpperCase();Element.Methods.ByTag[h]||(Element.Methods.ByTag[h]={});Object.extend(Element.Methods.ByTag[h],a)}function c(h,l,k){k=k||false;for(var m in h){var n=h[m];if(Object.isFunction(n))if(!k||!(m in l))l[m]=n.methodize()}}function d(h){var l,k={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(k[h])l="HTML"+k[h]+"Element";if(window[l])return window[l];l="HTML"+h+"Element";if(window[l])return window[l];l="HTML"+h.capitalize()+"Element";if(window[l])return window[l];window[l]={};window[l].prototype=document.createElement(h).__proto__;
return window[l]}var e=Prototype.BrowserFeatures,f=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 g=a;a=arguments[1]}if(g)Object.isArray(g)?g.each(b):b(g);else Object.extend(Element.Methods,a||{});if(e.ElementExtensions){c(Element.Methods,
HTMLElement.prototype);c(Element.Methods.Simulated,HTMLElement.prototype,true)}if(e.SpecificElementExtensions)for(var j in Element.Methods.ByTag){e=d(j);Object.isUndefined(e)||c(f[j],e.prototype)}Object.extend(Element,Element.Methods);delete Element.ByTag;Element.extend.refresh&&Element.extend.refresh();Element.cache={}};
document.viewport={getDimensions:function(){var a={},b=Prototype.Browser;$w("width height").each(function(c){var d=c.capitalize();a[c]=b.WebKit&&!document.evaluate?self["inner"+d]:b.Opera?document.body["client"+d]: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();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(this.expression))return false;return true},compileMatcher:function(){if(this.shouldUseXPath())return this.compileXPathMatcher();var a=this.expression,b=Selector.patterns,c=Selector.criteria,
d,e;if(Selector._cache[a])this.matcher=Selector._cache[a];else{for(this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];a&&d!=a&&/\S/.test(a);){d=a;for(var f in b){e=b[f];if(e=a.match(e)){this.matcher.push(Object.isFunction(c[f])?c[f](e):(new Template(c[f])).evaluate(e));a=a.replace(e[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher}},compileXPathMatcher:function(){var a=
this.expression,b=Selector.patterns,c=Selector.xpath,d,e;if(Selector._cache[a])this.xpath=Selector._cache[a];else{for(this.matcher=[".//*"];a&&d!=a&&/\S/.test(a);){d=a;for(var f in b)if(e=a.match(b[f])){this.matcher.push(Object.isFunction(c[f])?c[f](e):(new Template(c[f])).evaluate(e));a=a.replace(e[0],"");break}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath}},findElements:function(a){a=a||document;if(this.xpath)return document._getElementsByXPath(this.xpath,a);return this.matcher(a)},
match:function(a){this.tokens=[];for(var b=this.expression,c=Selector.patterns,d=Selector.assertions,e,f;b&&e!==b&&/\S/.test(b);){e=b;for(var g in c){f=c[g];if(f=b.match(f))if(d[g]){this.tokens.push([g,Object.clone(f)]);b=b.replace(f[0],"")}else return this.findElements(document).include(a)}}b=true;for(g=0;d=this.tokens[g];g++){c=d[0];d=d[1];if(!Selector.assertions[c](a,d)){b=false;break}}return b},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 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(a){for(var b=a[6],c=Selector.patterns,d=Selector.xpath,e,f,g=[];b&&e!=b&&/\S/.test(b);){e=b;for(var j in c)if(a=b.match(c[j])){f=Object.isFunction(d[j])?d[j](a):(new Template(d[j])).evaluate(a);
g.push("("+f.substring(1,f.length-1)+")");b=b.replace(a[0],"");break}}return"[not("+g.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(a,b){var c,d=b[6];if(d=="even")d="2n+0";if(d=="odd")d="2n+1";if(c=d.match(/^(\d+)$/))return"["+a+"= "+c[1]+"]";if(c=d.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(c[1]=="-")c[1]=-1;d=c[1]?Number(c[1]):1;c=c[2]?Number(c[2]):0;return(new Template("[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]")).evaluate({fragment:a,
a:d,b:c})}}}},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]+)\]/,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(a,b){var c=Element.readAttribute(a,b[1]);return c&&Selector.operators[b[2]](c,b[5]||b[6])}},handlers:{concat:function(a,b){for(var c=0,d;d=b[c];c++)a.push(d);return a},mark:function(a){for(var b=Prototype.emptyFunction,c=0,d;d=a[c];c++)d._countedByPrototype=
b;return a},unmark:function(a){for(var b=0,c;c=a[b];b++)c._countedByPrototype=undefined;return a},index:function(a,b,c){a._countedByPrototype=Prototype.emptyFunction;if(b){a=a.childNodes;b=a.length-1;for(var d=1;b>=0;b--){var e=a[b];if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=d++}}else{b=0;d=1;for(a=a.childNodes;e=a[b];b++)if(e.nodeType==1&&(!c||e._countedByPrototype))e.nodeIndex=d++}},unique:function(a){if(a.length==0)return a;for(var b=[],c,d=0,e=a.length;d<e;d++)if(!(c=a[d])._countedByPrototype){c._countedByPrototype=
Prototype.emptyFunction;b.push(Element.extend(c))}return Selector.handlers.unmark(b)},descendant:function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)b.concat(d,e.getElementsByTagName("*"));return d},child:function(a){for(var b=0,c=[],d;d=a[b];b++)for(var e=0,f;f=d.childNodes[e];e++)f.nodeType==1&&f.tagName!="!"&&c.push(f);return c},adjacent:function(a){for(var b=0,c=[],d;d=a[b];b++)(d=this.nextElementSibling(d))&&c.push(d);return c},laterSibling:function(a){for(var b=Selector.handlers,c=
0,d=[],e;e=a[c];c++)b.concat(d,Element.nextSiblings(e));return d},nextElementSibling:function(a){for(;a=a.nextSibling;)if(a.nodeType==1)return a;return null},previousElementSibling:function(a){for(;a=a.previousSibling;)if(a.nodeType==1)return a;return null},tagName:function(a,b,c,d){var e=c.toUpperCase(),f=[],g=Selector.handlers;if(a){if(d){if(d=="descendant"){for(b=0;d=a[b];b++)g.concat(f,d.getElementsByTagName(c));return f}else a=this[d](a);if(c=="*")return a}for(b=0;d=a[b];b++)d.tagName.toUpperCase()===
e&&f.push(d);return f}else return b.getElementsByTagName(c)},id:function(a,b,c,d){c=$(c);var e=Selector.handlers;if(!c)return[];if(!a&&b==document)return[c];if(a){if(d)if(d=="child")for(b=0;d=a[b];b++){if(c.parentNode==d)return[c]}else if(d=="descendant")for(b=0;d=a[b];b++){if(Element.descendantOf(c,d))return[c]}else if(d=="adjacent")for(b=0;d=a[b];b++){if(Selector.handlers.previousElementSibling(c)==d)return[c]}else a=e[d](a);for(b=0;d=a[b];b++)if(d==c)return[c];return[]}return c&&Element.descendantOf(c,
b)?[c]:[]},className:function(a,b,c,d){if(a&&d)a=this[d](a);return Selector.handlers.byClassName(a,b,c)},byClassName:function(a,b,c){a||(a=Selector.handlers.descendant([b]));b=0;for(var d=[],e,f;e=a[b];b++){f=e.className;if(f.length!=0)if(f==c||(" "+f+" ").include(" "+c+" "))d.push(e)}return d},attrPresence:function(a,b,c,d){a||(a=b.getElementsByTagName("*"));if(a&&d)a=this[d](a);b=[];d=0;for(var e;e=a[d];d++)Element.hasAttribute(e,c)&&b.push(e);return b},attr:function(a,b,c,d,e,f){a||(a=b.getElementsByTagName("*"));
if(a&&f)a=this[f](a);b=Selector.operators[e];e=[];f=0;for(var g;g=a[f];f++){var j=Element.readAttribute(g,c);j!==null&&b(j,d)&&e.push(g)}return e},pseudo:function(a,b,c,d,e){if(a&&e)a=this[e](a);a||(a=d.getElementsByTagName("*"));return Selector.pseudos[b](a,c,d)}},pseudos:{"first-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.previousElementSibling(d)||c.push(d);return c},"last-child":function(a){for(var b=0,c=[],d;d=a[b];b++)Selector.handlers.nextElementSibling(d)||c.push(d);
return c},"only-child":function(a){for(var b=Selector.handlers,c=0,d=[],e;e=a[c];c++)!b.previousElementSibling(e)&&!b.nextElementSibling(e)&&d.push(e);return d},"nth-child":function(a,b,c){return Selector.pseudos.nth(a,b,c)},"nth-last-child":function(a,b,c){return Selector.pseudos.nth(a,b,c,true)},"nth-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,false,true)},"nth-last-of-type":function(a,b,c){return Selector.pseudos.nth(a,b,c,true,true)},"first-of-type":function(a,b,c){return Selector.pseudos.nth(a,
"1",c,false,true)},"last-of-type":function(a,b,c){return Selector.pseudos.nth(a,"1",c,true,true)},"only-of-type":function(a,b,c){var d=Selector.pseudos;return d["last-of-type"](d["first-of-type"](a,b,c),b,c)},getIndices:function(a,b,c){if(a==0)return b>0?[b]:[];return $R(1,c).inject([],function(d,e){0==(e-b)%a&&(e-b)/a>=0&&d.push(e);return d})},nth:function(a,b,c,d,e){if(a.length==0)return[];if(b=="even")b="2n+0";if(b=="odd")b="2n+1";c=Selector.handlers;var f=[],g=[],j;c.mark(a);for(var h=0;j=a[h];h++)if(!j.parentNode._countedByPrototype){c.index(j.parentNode,
d,e);g.push(j.parentNode)}if(b.match(/^\d+$/)){b=Number(b);for(h=0;j=a[h];h++)j.nodeIndex==b&&f.push(j)}else if(j=b.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-")j[1]=-1;h=j[1]?Number(j[1]):1;j=j[2]?Number(j[2]):0;b=Selector.pseudos.getIndices(h,j,a.length);h=0;for(d=b.length;j=a[h];h++)for(e=0;e<d;e++)j.nodeIndex==b[e]&&f.push(j)}c.unmark(a);c.unmark(g);return f},empty:function(a){for(var b=0,c=[],d;d=a[b];b++)d.tagName=="!"||d.firstChild&&!d.innerHTML.match(/^\s*$/)||c.push(d);return c},not:function(a,
b,c){var d=Selector.handlers;b=(new Selector(b)).findElements(c);d.mark(b);c=0;for(var e=[],f;f=a[c];c++)f._countedByPrototype||e.push(f);d.unmark(b);return e},enabled:function(a){for(var b=0,c=[],d;d=a[b];b++)d.disabled||c.push(d);return c},disabled:function(a){for(var b=0,c=[],d;d=a[b];b++)d.disabled&&c.push(d);return c},checked:function(a){for(var b=0,c=[],d;d=a[b];b++)d.checked&&c.push(d);return c}},operators:{"=":function(a,b){return a==b},"!=":function(a,b){return a!=b},"^=":function(a,b){return a.startsWith(b)},
"$=":function(a,b){return a.endsWith(b)},"*=":function(a,b){return a.include(b)},"~=":function(a,b){return(" "+a+" ").include(" "+b+" ")},"|=":function(a,b){return("-"+a.toUpperCase()+"-").include("-"+b.toUpperCase()+"-")}},split:function(a){var b=[];a.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){b.push(c[1].strip())});return b},matchElements:function(a,b){var c=$$(b),d=Selector.handlers;d.mark(c);for(var e=0,f=[],g;g=a[e];e++)g._countedByPrototype&&f.push(g);d.unmark(c);return f},
findElement:function(a,b,c){if(Object.isNumber(b)){c=b;b=false}return Selector.matchElements(a,b||"*")[c||0]},findChildElements:function(a,b){b=Selector.split(b.join(","));for(var c=[],d=Selector.handlers,e=0,f=b.length,g;e<f;e++){g=new Selector(b[e].strip());d.concat(c,g.findElements(a))}return f>1?d.unique(c):c}});
Prototype.Browser.IE&&Object.extend(Selector.handlers,{concat:function(a,b){for(var c=0,d;d=b[c];c++)d.tagName!=="!"&&a.push(d);return a},unmark:function(a){for(var b=0,c;c=a[b];b++)c.removeAttribute("_countedByPrototype");return a}});function $$(){return Selector.findChildElements(document,$A(arguments))}
var Form={reset:function(a){$(a).reset();return a},serializeElements:function(a,b){if(typeof b!="object")b={hash:!!b};else if(Object.isUndefined(b.hash))b.hash=true;var c,d,e=false,f=b.submit,g=a.inject({},function(j,h){if(!h.disabled&&h.name){c=h.name;d=$(h).getValue();if(d!=null&&(h.type!="submit"||!e&&f!==false&&(!f||c==f)&&(e=true)))if(c in j){Object.isArray(j[c])||(j[c]=[j[c]]);j[c].push(d)}else j[c]=d}return j});return b.hash?g:Object.toQueryString(g)}};
Form.Methods={serialize:function(a,b){return Form.serializeElements(Form.getElements(a),b)},getElements:function(a){return $A($(a).getElementsByTagName("*")).inject([],function(b,c){Form.Element.Serializers[c.tagName.toLowerCase()]&&b.push(Element.extend(c));return b})},getInputs:function(a,b,c){a=$(a);a=a.getElementsByTagName("input");if(!b&&!c)return $A(a).map(Element.extend);for(var d=0,e=[],f=a.length;d<f;d++){var g=a[d];b&&g.type!=b||c&&g.name!=c||e.push(Element.extend(g))}return e},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(a){a=$(a).getElements().findAll(function(c){return"hidden"!=c.type&&!c.disabled});var b=a.findAll(function(c){return c.hasAttribute("tabIndex")&&c.tabIndex>=0}).sortBy(function(c){return c.tabIndex}).first();return b?b:a.find(function(c){return["input","select","textarea"].include(c.tagName.toLowerCase())})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();
return a},request:function(a,b){a=$(a);b=Object.clone(b||{});var c=b.parameters,d=a.readAttribute("action")||"";if(d.blank())d=window.location.href;b.parameters=a.serialize(true);if(c){if(Object.isString(c))c=c.toQueryParams();Object.extend(b.parameters,c)}if(a.hasAttribute("method")&&!b.method)b.method=a.method;return new Ajax.Request(d,b)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};
Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},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.blur();a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element,$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(a,b){if(Object.isUndefined(b))return this[a.type=="select-one"?"selectOne":"selectMany"](a);
else for(var c,d,e=!Object.isArray(b),f=0,g=a.length;f<g;f++){c=a.options[f];d=this.optionValue(c);if(e){if(d==b){c.selected=true;return}}else c.selected=b.include(d)}},selectOne:function(a){var b=a.selectedIndex;return b>=0?this.optionValue(a.options[b]):null},selectMany:function(a){var b,c=a.length;if(!c)return null;var d=0;for(b=[];d<c;d++){var e=a.options[d];e.selected&&b.push(this.optionValue(e))}return b},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};
Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,b,c,d){$super(d,c);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();this.element.tagName.toLowerCase()=="form"?this.registerFormCallbacks():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(a){switch(a.type){case "mouseover":a=a.fromElement;break;case "mouseout":a=a.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(c,d){return c.button==b[d]}}else a=Prototype.Browser.WebKit?function(c,d){switch(d){case 0:return c.which==1&&!c.metaKey;case 1:return c.which==1&&c.metaKey;default:return false}}:function(c,d){return c.which?c.which===d+1:c.button===d};return{isLeftClick:function(c){return a(c,0)},isMiddleClick:function(c){return a(c,1)},isRightClick:function(c){return a(c,2)},element:function(c){c=Event.extend(c).target;return Element.extend(c.nodeType==
Node.TEXT_NODE?c.parentNode:c)},findElement:function(c,d){var e=Event.element(c);if(!d)return e;e=[e].concat(e.ancestors());return Selector.findElement(e,d,0)},pointer:function(c){return{x:c.pageX||c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft),y:c.pageY||c.clientY+(document.documentElement.scrollTop||document.body.scrollTop)}},pointerX:function(c){return Event.pointer(c).x},pointerY:function(c){return Event.pointer(c).y},stop:function(c){Event.extend(c);c.preventDefault();
c.stopPropagation();c.stopped=true}}}();
Event.extend=function(){var a=Object.keys(Event.Methods).inject({},function(b,c){b[c]=Event.Methods[c].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 c=Event.pointer(b);Object.extend(b,{target:b.srcElement,relatedTarget:Event.relatedTarget(b),
pageX:c.x,pageY:c.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(){function a(h){if(h._prototypeEventID)return h._prototypeEventID[0];arguments.callee.id=arguments.callee.id||1;return h._prototypeEventID=[++arguments.callee.id]}function b(h){if(h&&h.include(":"))return"dataavailable";return h}function c(h,l){var k=j[h]=j[h]||{};return k[l]=k[l]||[]}function d(h,l,k){var m=a(h);m=c(m,l);if(m.pluck("handler").include(k))return false;var n=function(o){if(!Event||!Event.extend||o.eventName&&o.eventName!=l)return false;Event.extend(o);k.call(h,
o)};n.handler=k;m.push(n);return n}function e(h,l,k){return c(h,l).find(function(m){return m.handler==k})}function f(h,l,k){var m=j[h]=j[h]||{};if(!m[l])return false;m[l]=m[l].without(e(h,l,k))}function g(){for(var h in j)for(var l in j[h])j[h][l]=null}var j=Event.cache;window.attachEvent&&window.attachEvent("onunload",g);return{observe:function(h,l,k){h=$(h);var m=b(l);l=d(h,l,k);if(!l)return h;h.addEventListener?h.addEventListener(m,l,false):h.attachEvent("on"+m,l);return h},stopObserving:function(h,
l,k){h=$(h);var m=a(h),n=b(l);if(!k&&l){c(m,l).each(function(p){h.stopObserving(l,p.handler)});return h}else if(!l){Object.keys(j[m]=j[m]||{}).each(function(p){h.stopObserving(p)});return h}var o=e(m,l,k);if(!o)return h;h.removeEventListener?h.removeEventListener(n,o,false):h.detachEvent("on"+n,o);f(m,l,k);return h},fire:function(h,l,k){h=$(h);if(h==document&&document.createEvent&&!h.dispatchEvent)h=document.documentElement;var m;if(document.createEvent){m=document.createEvent("HTMLEvents");m.initEvent("dataavailable",
true,true)}else{m=document.createEventObject();m.eventType="ondataavailable"}m.eventName=l;m.memo=k||{};document.createEvent?h.dispatchEvent(m):h.fireEvent(m.eventType,m);return Event.extend(m)}}}());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(){function a(){if(!document.loaded){b&&window.clearInterval(b);document.fire("dom:loaded");document.loaded=true}}var b;if(document.addEventListener)if(Prototype.Browser.WebKit){b=window.setInterval(function(){/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})}},$continue=new Error('"throw $continue" is deprecated, use "return" instead'),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(a,b,c){if(this.includeScrollOffsets)return this.withinIncludingScrolloffsets(a,b,c);this.xcomp=b;this.ycomp=c;this.offset=Element.cumulativeOffset(a);return c>=this.offset[1]&&c<this.offset[1]+a.offsetHeight&&b>=this.offset[0]&&b<this.offset[0]+a.offsetWidth},withinIncludingScrolloffsets:function(a,b,c){var d=Element.cumulativeScrollOffset(a);this.xcomp=b+d[0]-this.deltaX;this.ycomp=c+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(a);
return this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+a.offsetWidth},overlap:function(a,b){if(!a)return 0;if(a=="vertical")return(this.offset[1]+b.offsetHeight-this.ycomp)/b.offsetHeight;if(a=="horizontal")return(this.offset[0]+b.offsetWidth-this.xcomp)/b.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(a,b,c){c=c||{};return Element.clonePosition(b,a,c)}};
if(!document.getElementsByClassName)document.getElementsByClassName=function(a){function b(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}a.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,d){d=d.toString().strip();var e=/\s/.test(d)?$w(d).map(b).join(""):b(d);return e?document._getElementsByXPath(".//*"+e,c):[]}:function(c,d){d=d.toString().strip();var e=[],f=/\s/.test(d)?$w(d):null;if(!f&&!d)return e;for(var g=$(c).getElementsByTagName("*"),j=0,h,l;h=
g[j];j++)if(h.className&&(l=" "+h.className+" ")&&(l.include(" "+d+" ")||f&&f.all(function(k){return!k.toString().blank()&&l.include(" "+k+" ")})))e.push(Element.extend(h));return e};return function(c,d){return $(d||document.body).getElementsByClassName(c)}}(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){this.include(a)||this.set($A(this).concat(a).join(" "))},remove:function(a){this.include(a)&&this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();
var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function encode64(a){var b="",c,d,e,f,g,j,h=0;do{c=a.charCodeAt(h++);d=a.charCodeAt(h++);e=a.charCodeAt(h++);f=c>>2;c=(c&3)<<4|d>>4;g=(d&15)<<2|e>>6;j=e&63;if(isNaN(d))g=j=64;else if(isNaN(e))j=64;b=b+keyStr.charAt(f)+keyStr.charAt(c)+keyStr.charAt(g)+keyStr.charAt(j)}while(h<a.length);return b}
function decode64(a){var b="",c,d,e,f,g,j,h=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e=keyStr.indexOf(a.charAt(h++));f=keyStr.indexOf(a.charAt(h++));g=keyStr.indexOf(a.charAt(h++));j=keyStr.indexOf(a.charAt(h++));c=(f&15)<<4|g>>2;d=(g&3)<<6|j;b+=String.fromCharCode(e<<2|f>>4);if(g!=64)b+=String.fromCharCode(c);if(j!=64)b+=String.fromCharCode(d)}while(h<a.length);return b}
var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(a,b,c){a=a.toUpperCase();var d=document.createElement(this.NODEMAP[a]||"div");try{d.innerHTML="<"+a+"></"+a+">"}catch(e){}var f=d.firstChild||null;if(f&&f.tagName.toUpperCase()!=a)f=f.getElementsByTagName(a)[0];f||(f=document.createElement(a));if(f){if(b)if(this._isStringOrNumber(b)||
b instanceof Array||b.tagName)this._children(f,b);else{var g=this._attributes(b);if(g.length){try{d.innerHTML="<"+a+" "+g+"></"+a+">"}catch(j){}f=d.firstChild||null;if(!f){f=document.createElement(a);for(attr in b)f[attr=="class"?"className":attr]=b[attr]}if(f.tagName.toUpperCase()!=a)f=d.getElementsByTagName(a)[0]}}c&&this._children(f,c);return $(f)}},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var b=[];for(attribute in a)b.push((attribute in
this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"');return b.join(" ")},_children:function(a,b){if(b.tagName)a.appendChild(b);else if(typeof b=="object")b.flatten().each(function(c){if(typeof c=="object")a.appendChild(c);else Builder._isStringOrNumber(c)&&a.appendChild(Builder._text(c))});else Builder._isStringOrNumber(b)&&a.appendChild(Builder._text(b))},_isStringOrNumber:function(a){return typeof a=="string"||typeof a=="number"},build:function(a){var b=
this.node("div");$(b).update(a.strip());return b.down()},dump:function(a){if(typeof a!="object"&&typeof a!="function")a=window;"A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR".split(/\s+/).each(function(b){a[b]=
function(){return Builder.node.apply(Builder,[b].concat($A(arguments)))}})}};String.prototype.parseColor=function(a){var b="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(","),d=0;do b+=parseInt(c[d]).toColorPart();while(++d<3)}else if(this.slice(0,1)=="#"){if(this.length==4)for(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:a||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(c){return c.nodeType==3?c.nodeValue:c.hasChildNodes()&&!Element.hasClassName(c,b)?Element.collectTextNodesIgnoreClass(c,b):""}).flatten().join("")};
Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:b/100+"em"});Prototype.Browser.WebKit&&window.scrollBy(0,0);return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var b=document.createTextNode(" ");a.appendChild(b);a.removeChild(b)}catch(c){}};
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){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(a,b){return-Math.cos(a*((b||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(){return 0},full:function(){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(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(d){a.insertBefore((new Element("span",{style:b})).update(d==" "?String.fromCharCode(160):d),c)});Element.remove(c)}})},multiple:function(a,b,c){a=
(typeof a=="object"||Object.isFunction(a))&&a.length?a:$(a).childNodes;var d=Object.extend({speed:0.1,delay:0},c||{}),e=d.delay;$A(a).each(function(f,g){new b(f,Object.extend(d,{delay:g*d.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(a,b,c){a=$(a);b=(b||"appear").toLowerCase();return Effect[Effect.PAIRS[b][a.visible()?1:0]](a,Object.extend({queue:{position:"end",scope:a.id||"global",limit:1}},c||{}))}};
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(a){var b=(new Date).getTime();switch(Object.isString(a.options.queue)?a.options.queue:a.options.queue.position){case "front":this.effects.findAll(function(c){return c.state=="idle"}).each(function(c){c.startOn+=a.finishOn;c.finishOn+=a.finishOn});break;case "with-last":b=this.effects.pluck("startOn").max()||b;break;case "end":b=this.effects.pluck("finishOn").max()||
b;break}a.startOn+=b;a.finishOn+=b;if(!a.options.queue.limit||this.effects.length<a.options.queue.limit)this.effects.push(a);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(){for(var a=(new Date).getTime(),b=0,c=this.effects.length;b<c;b++)this.effects[b]&&this.effects[b].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){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*1E3;this.finishOn=this.startOn+this.options.duration*1E3;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 b(c,
d){c.options[d+"Internal"]&&c.options[d+"Internal"](c);c.options[d]&&c.options[d](c)}return function(c){if(this.state==="idle"){this.state="running";b(this,"beforeSetup");this.setup&&this.setup();b(this,"afterSetup")}if(this.state==="running"){this.position=c=this.options.transition(c)*this.fromToDelta+this.options.from;b(this,"beforeUpdate");this.update&&this.update(c);b(this,"afterUpdate")}}}();this.event("beforeStart");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");this.finish&&this.finish();this.event("afterFinish")}else{a=(a-this.startOn)/this.totalTime;var b=(a*this.totalFrames).round();if(b>this.currentFrame){this.render(a);this.currentFrame=b}}},cancel:function(){this.options.sync||Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this);this.state="finished"},
event:function(a){this.options[a+"Internal"]&&this.options[a+"Internal"](this);this.options[a]&&this.options[a](this)},inspect:function(){var a=$H();for(property in this)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,b){this.effects=a||[];this.start(b)},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");b.finish&&b.finish(a);b.event("afterFinish")})}});
Effect.Tween=Class.create(Effect.Base,{initialize:function(a,b,c){a=Object.isString(a)?$(a):a;var d=$A(arguments),e=d.last();d=d.length==5?d[3]:null;this.method=Object.isFunction(e)?e.bind(a):Object.isFunction(a[e])?a[e].bind(a):function(f){a[e]=f};this.start(Object.extend({from:b,to:c},d||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(a){this.start(Object.extend({duration:0},a||{}))},update:Prototype.emptyFunction});
Effect.Opacity=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&this.element.setStyle({zoom:1});this.start(Object.extend({from:this.element.getOpacity()||0,to:1},b||{}))},update:function(a){this.element.setOpacity(a)}});
Effect.Move=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({x:0,y:0,mode:"relative"},b||{}))},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.originalLeft;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(a,b,c,d){return new Effect.Move(a,Object.extend({x:c,y:b},d||{}))};
Effect.Scale=Class.create(Effect.Base,{initialize:function(a,b,c){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:b},c||{}))},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){a=this.options.scaleFrom/100+this.factor*a;this.options.scaleContent&&this.fontSize&&this.element.setStyle({fontSize:this.fontSize*a+this.fontSizeType});this.setDimensions(this.dims[0]*a,this.dims[1]*a)},finish:function(){this.restoreAfterFinish&&this.element.setStyle(this.originalStyle)},setDimensions:function(a,b){var c={};
if(this.options.scaleX)c.width=b.round()+"px";if(this.options.scaleY)c.height=a.round()+"px";if(this.options.scaleFromCenter){var d=(a-this.dims[0])/2,e=(b-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY)c.top=this.originalTop-d+"px";if(this.options.scaleX)c.left=this.originalLeft-e+"px"}else{if(this.options.scaleY)c.top=-d+"px";if(this.options.scaleX)c.left=-e+"px"}}this.element.setStyle(c)}});
Effect.Highlight=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;this.start(Object.extend({startcolor:"#ffff99"},b||{}))},setup:function(){if(this.element.getStyle("display")=="none")this.cancel();else{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,c,d){return b+
(this._base[d]+this._delta[d]*a).round().toColorPart()}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(a,b){var c=b||{},d=document.viewport.getScrollOffsets(),e=$(a).cumulativeOffset();if(c.offset)e[1]+=c.offset;return new Effect.Tween(null,d.top,e[1],c,function(f){scrollTo(d.left,f.round())})};
Effect.Fade=function(a,b){a=$(a);var c=a.getInlineOpacity(),d=Object.extend({from:a.getOpacity()||1,to:0,afterFinishInternal:function(e){e.options.to==0&&e.element.hide().setStyle({opacity:c})}},b||{});return new Effect.Opacity(a,d)};
Effect.Appear=function(a,b){a=$(a);var c=Object.extend({from:a.getStyle("display")=="none"?0:a.getOpacity()||0,to:1,afterFinishInternal:function(d){d.element.forceRerendering()},beforeSetup:function(d){d.element.setOpacity(d.options.from).show()}},b||{});return new Effect.Opacity(a,c)};
Effect.Puff=function(a,b){a=$(a);var c={opacity:a.getInlineOpacity(),position:a.getStyle("position"),top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};return new Effect.Parallel([new Effect.Scale(a,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(a,{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(c)}},
b||{}))};Effect.BlindUp=function(a,b){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},b||{}))};
Effect.BlindDown=function(a,b){a=$(a);var c=a.getDimensions();return new Effect.Scale(a,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(d){d.element.undoClipping()}},b||{}))};
Effect.SwitchOff=function(a,b){a=$(a);var c=a.getInlineOpacity();return new Effect.Appear(a,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:c})}})}},b||{}))};
Effect.DropOut=function(a,b){a=$(a);var c={top:a.getStyle("top"),left:a.getStyle("left"),opacity:a.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(a,{x:0,y:100,sync:true}),new Effect.Opacity(a,{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(c)}},b||{}))};
Effect.Shake=function(a,b){a=$(a);var c=Object.extend({distance:20,duration:0.5},b||{}),d=parseFloat(c.distance),e=parseFloat(c.duration)/10,f={top:a.getStyle("top"),left:a.getStyle("left")};return new Effect.Move(a,{x:d,y:0,duration:e,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-d*2,y:0,duration:e*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:d*2,y:0,duration:e*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-d*2,y:0,duration:e*2,afterFinishInternal:function(l){new Effect.Move(l.element,
{x:d*2,y:0,duration:e*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-d,y:0,duration:e,afterFinishInternal:function(m){m.element.undoPositioned().setStyle(f)}})}})}})}})}})}})};
Effect.SlideDown=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),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();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:c})}},b||{}))};
Effect.SlideUp=function(a,b){a=$(a).cleanWhitespace();var c=a.down().getStyle("bottom"),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();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:c})}},b||{}))};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(a,b){a=$(a);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},b||{}),d={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},e=a.getDimensions(),f,g,j,h;switch(c.direction){case "top-left":f=g=j=h=0;break;case "top-right":f=e.width;g=h=0;j=-e.width;break;case "bottom-left":f=j=0;g=e.height;h=-e.height;break;
case "bottom-right":f=e.width;g=e.height;j=-e.width;h=-e.height;break;case "center":f=e.width/2;g=e.height/2;j=-e.width/2;h=-e.height/2;break}return new Effect.Move(a,{x:f,y:g,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(l.element,{x:j,y:h,sync:true,transition:c.moveTransition}),new Effect.Scale(l.element,
100,{scaleMode:{originalHeight:e.height,originalWidth:e.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(k){k.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(k){k.effects[0].element.undoClipping().undoPositioned().setStyle(d)}},c))}})};
Effect.Shrink=function(a,b){a=$(a);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},b||{}),d={top:a.style.top,left:a.style.left,height:a.style.height,width:a.style.width,opacity:a.getInlineOpacity()},e=a.getDimensions(),f,g;switch(c.direction){case "top-left":f=g=0;break;case "top-right":f=e.width;g=0;break;case "bottom-left":f=0;g=e.height;break;case "bottom-right":f=e.width;g=
e.height;break;case "center":f=e.width/2;g=e.height/2;break}return new Effect.Parallel([new Effect.Opacity(a,{sync:true,to:0,from:1,transition:c.opacityTransition}),new Effect.Scale(a,window.opera?1:0,{sync:true,transition:c.scaleTransition,restoreAfterFinish:true}),new Effect.Move(a,{x:f,y:g,sync:true,transition:c.moveTransition})],Object.extend({beforeStartInternal:function(j){j.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(j){j.effects[0].element.hide().undoClipping().undoPositioned().setStyle(d)}},
c))};Effect.Pulsate=function(a,b){a=$(a);var c=b||{},d=a.getInlineOpacity(),e=c.transition||Effect.Transitions.linear;return new Effect.Opacity(a,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(f){f.element.setStyle({opacity:d})}},c),{transition:function(f){return 1-e(-Math.cos(f*(c.pulses||5)*2*Math.PI)/2+0.5)}}))};
Effect.Fold=function(a,b){a=$(a);var c={top:a.style.top,left:a.style.left,width:a.style.width,height:a.style.height};a.makeClipping();return new Effect.Scale(a,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(){new Effect.Scale(a,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(d){d.element.hide().undoClipping().setStyle(c)}})}},b||{}))};
Effect.Morph=Class.create(Effect.Base,{initialize:function(a,b){this.element=$(a);if(!this.element)throw Effect._elementDoesNotExistError;var c=Object.extend({style:{}},b||{});if(Object.isString(c.style))if(c.style.include(":"))this.style=c.style.parseStyle();else{this.element.addClassName(c.style);this.style=$H(this.element.getStyles());this.element.removeClassName(c.style);var d=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==d[e.key]});c.afterFinishInternal=function(e){e.element.addClassName(e.options.style);
e.transforms.each(function(f){e.element.style[f.style]=""})}}else this.style=$H(c.style);this.start(c)},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(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(b){var c=b[0];b=b[1];var d=null;if(b.parseColor("#zzzzzz")!="#zzzzzz"){b=b.parseColor();d="color"}else if(c=="opacity"){b=parseFloat(b);Prototype.Browser.IE&&!this.element.currentStyle.hasLayout&&
this.element.setStyle({zoom:1})}else if(Element.CSS_LENGTH.test(b)){d=b.match(/^([\+\-]?[0-9\.]+)(.*)$/);b=parseFloat(d[1]);d=d.length==3?d[2]:null}var e=this.element.getStyle(c);return{style:c.camelize(),originalValue:d=="color"?a(e):parseFloat(e||0),targetValue:d=="color"?a(b):b,unit:d}}.bind(this)).reject(function(b){return b.originalValue==b.targetValue||b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))})},update:function(a){for(var b={},c,d=this.transforms.length;d--;)b[(c=this.transforms[d]).style]=
c.unit=="color"?"#"+Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*a).toColorPart()+Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*a).toColorPart()+Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*a).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*a).toFixed(3)+(c.unit===null?"":c.unit);this.element.setStyle(b,true)}});
Effect.Transform=Class.create({initialize:function(a,b){this.tracks=[];this.options=b||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var b=a.get("ids"),c=a.get("effect"),d=a.get("options");return[$(b)||$$(b)].flatten().map(function(e){return new c(e,Object.extend({sync:true},
d))})}).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 a,b=$H();if(Prototype.Browser.WebKit)a=(new Element("div",{style:this})).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';a=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){a[c]&&b.set(c,a[c])});Prototype.Browser.IE&&this.include("opacity")&&b.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return b};
Element.getStyles=document.defaultView&&document.defaultView.getComputedStyle?function(a){var b=document.defaultView.getComputedStyle($(a),null);return Element.CSS_PROPERTIES.inject({},function(c,d){c[d]=b[d];return c})}:function(a){a=$(a);var b=a.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=b[e];return d});if(!c.opacity)c.opacity=a.getOpacity();return c};
Effect.Methods={morph:function(a,b,c){a=$(a);new Effect.Morph(a,Object.extend({style:b},c||{}));return a},visualEffect:function(a,b,c){a=$(a);b=b.dasherize().camelize();b=b.charAt(0).toUpperCase()+b.substring(1);new Effect[b](a,c);return a},highlight:function(a,b){a=$(a);new Effect.Highlight(a,b);return a}};
$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(b,c){b=$(b);Effect[a.charAt(0).toUpperCase()+a.substring(1)](b,c);return b}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);var hexcase=0,b64pad="",chrsz=8;
function hex_md5(a){return binl2hex(core_md5(str2binl(a),a.length*chrsz))}function b64_md5(a){return binl2b64(core_md5(str2binl(a),a.length*chrsz))}function str_md5(a){return binl2str(core_md5(str2binl(a),a.length*chrsz))}function hex_hmac_md5(a,b){return binl2hex(core_hmac_md5(a,b))}function b64_hmac_md5(a,b){return binl2b64(core_hmac_md5(a,b))}function str_hmac_md5(a,b){return binl2str(core_hmac_md5(a,b))}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}
function core_md5(a,b){a[b>>5]|=128<<b%32;a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,f=271733878,g,j,h,l,k=0;k<a.length;k+=16){g=c;j=d;h=e;l=f;c=md5_ff(c,d,e,f,a[k+0],7,-680876936);f=md5_ff(f,c,d,e,a[k+1],12,-389564586);e=md5_ff(e,f,c,d,a[k+2],17,606105819);d=md5_ff(d,e,f,c,a[k+3],22,-1044525330);c=md5_ff(c,d,e,f,a[k+4],7,-176418897);f=md5_ff(f,c,d,e,a[k+5],12,1200080426);e=md5_ff(e,f,c,d,a[k+6],17,-1473231341);d=md5_ff(d,e,f,c,a[k+7],22,-45705983);c=md5_ff(c,d,e,f,a[k+
8],7,1770035416);f=md5_ff(f,c,d,e,a[k+9],12,-1958414417);e=md5_ff(e,f,c,d,a[k+10],17,-42063);d=md5_ff(d,e,f,c,a[k+11],22,-1990404162);c=md5_ff(c,d,e,f,a[k+12],7,1804603682);f=md5_ff(f,c,d,e,a[k+13],12,-40341101);e=md5_ff(e,f,c,d,a[k+14],17,-1502002290);d=md5_ff(d,e,f,c,a[k+15],22,1236535329);c=md5_gg(c,d,e,f,a[k+1],5,-165796510);f=md5_gg(f,c,d,e,a[k+6],9,-1069501632);e=md5_gg(e,f,c,d,a[k+11],14,643717713);d=md5_gg(d,e,f,c,a[k+0],20,-373897302);c=md5_gg(c,d,e,f,a[k+5],5,-701558691);f=md5_gg(f,c,d,
e,a[k+10],9,38016083);e=md5_gg(e,f,c,d,a[k+15],14,-660478335);d=md5_gg(d,e,f,c,a[k+4],20,-405537848);c=md5_gg(c,d,e,f,a[k+9],5,568446438);f=md5_gg(f,c,d,e,a[k+14],9,-1019803690);e=md5_gg(e,f,c,d,a[k+3],14,-187363961);d=md5_gg(d,e,f,c,a[k+8],20,1163531501);c=md5_gg(c,d,e,f,a[k+13],5,-1444681467);f=md5_gg(f,c,d,e,a[k+2],9,-51403784);e=md5_gg(e,f,c,d,a[k+7],14,1735328473);d=md5_gg(d,e,f,c,a[k+12],20,-1926607734);c=md5_hh(c,d,e,f,a[k+5],4,-378558);f=md5_hh(f,c,d,e,a[k+8],11,-2022574463);e=md5_hh(e,f,
c,d,a[k+11],16,1839030562);d=md5_hh(d,e,f,c,a[k+14],23,-35309556);c=md5_hh(c,d,e,f,a[k+1],4,-1530992060);f=md5_hh(f,c,d,e,a[k+4],11,1272893353);e=md5_hh(e,f,c,d,a[k+7],16,-155497632);d=md5_hh(d,e,f,c,a[k+10],23,-1094730640);c=md5_hh(c,d,e,f,a[k+13],4,681279174);f=md5_hh(f,c,d,e,a[k+0],11,-358537222);e=md5_hh(e,f,c,d,a[k+3],16,-722521979);d=md5_hh(d,e,f,c,a[k+6],23,76029189);c=md5_hh(c,d,e,f,a[k+9],4,-640364487);f=md5_hh(f,c,d,e,a[k+12],11,-421815835);e=md5_hh(e,f,c,d,a[k+15],16,530742520);d=md5_hh(d,
e,f,c,a[k+2],23,-995338651);c=md5_ii(c,d,e,f,a[k+0],6,-198630844);f=md5_ii(f,c,d,e,a[k+7],10,1126891415);e=md5_ii(e,f,c,d,a[k+14],15,-1416354905);d=md5_ii(d,e,f,c,a[k+5],21,-57434055);c=md5_ii(c,d,e,f,a[k+12],6,1700485571);f=md5_ii(f,c,d,e,a[k+3],10,-1894986606);e=md5_ii(e,f,c,d,a[k+10],15,-1051523);d=md5_ii(d,e,f,c,a[k+1],21,-2054922799);c=md5_ii(c,d,e,f,a[k+8],6,1873313359);f=md5_ii(f,c,d,e,a[k+15],10,-30611744);e=md5_ii(e,f,c,d,a[k+6],15,-1560198380);d=md5_ii(d,e,f,c,a[k+13],21,1309151649);c=md5_ii(c,
d,e,f,a[k+4],6,-145523070);f=md5_ii(f,c,d,e,a[k+11],10,-1120210379);e=md5_ii(e,f,c,d,a[k+2],15,718787259);d=md5_ii(d,e,f,c,a[k+9],21,-343485551);c=safe_add(c,g);d=safe_add(d,j);e=safe_add(e,h);f=safe_add(f,l)}return[c,d,e,f]}function md5_cmn(a,b,c,d,e,f){return safe_add(bit_rol(safe_add(safe_add(b,a),safe_add(d,f)),e),c)}function md5_ff(a,b,c,d,e,f,g){return md5_cmn(b&c|~b&d,a,b,e,f,g)}function md5_gg(a,b,c,d,e,f,g){return md5_cmn(b&d|c&~d,a,b,e,f,g)}
function md5_hh(a,b,c,d,e,f,g){return md5_cmn(b^c^d,a,b,e,f,g)}function md5_ii(a,b,c,d,e,f,g){return md5_cmn(c^(b|~d),a,b,e,f,g)}function core_hmac_md5(a,b){var c=str2binl(a);if(c.length>16)c=core_md5(c,a.length*chrsz);for(var d=new Array(16),e=new Array(16),f=0;f<16;f++){d[f]=c[f]^909522486;e[f]=c[f]^1549556828}c=core_md5(d.concat(str2binl(b)),512+b.length*chrsz);return core_md5(e.concat(c),640)}function safe_add(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}
function bit_rol(a,b){return a<<b|a>>>32-b}function str2binl(a){for(var b=[],c=(1<<chrsz)-1,d=0;d<a.length*chrsz;d+=chrsz)b[d>>5]|=(a.charCodeAt(d/chrsz)&c)<<d%32;return b}function binl2str(a){for(var b="",c=(1<<chrsz)-1,d=0;d<a.length*32;d+=chrsz)b+=String.fromCharCode(a[d>>5]>>>d%32&c);return b}function binl2hex(a){for(var b=hexcase?"0123456789ABCDEF":"0123456789abcdef",c="",d=0;d<a.length*4;d++)c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15);return c}
function binl2b64(a){for(var b="",c,d,e=0;e<a.length*4;e+=3){c=(a[e>>2]>>8*(e%4)&255)<<16|(a[e+1>>2]>>8*((e+1)%4)&255)<<8|a[e+2>>2]>>8*((e+2)%4)&255;for(d=0;d<4;d++)b+=e*8+d*6>a.length*32?b64pad:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c>>6*(3-d)&63)}return b}var MICROSIS={};MICROSIS.util={};
MICROSIS.util.CustomEvent=Class.create({initialize:function(a,b){this.name=a;this.scope=b||window;this.subscribers=[];this.lastError=null},subscribe:function(a,b){if(!a)throw new Error("Invalid callback for "+this.name);this.subscribers.push(new MICROSIS.util.Subscriber(a,b))},unsubscribe:function(a,b){if(!a)return this.unsubscribeAll();var c=false;this.subscribers.each(function(d,e){if(d&&d.isComposedOf(a,b)){this._unset(e);c=true}}.bind(this));return c},unsubscribeAll:function(){var a=0;this.subscribers.each(function(b,
c){this._unset(c);a=c}.bind(this));this.subscribers=[];return a},fire:function(){var a=this.subscribers.length,b=$A(arguments),c=true,d=false;if(isNaN(a))return true;if(a==0)d=true;this.subscribers.each(function(e){try{c=e.method.call(this.scope,b.first(),e.obj)}catch(f){this.lastError=f}if(c===false)return false}.bind(this));if(d)this.subscribers=this.subscribers.compact();return true},_unset:function(a){var b=this.subscribers[a];if(b){delete b.method;delete b.obj}this.subscribers[a]=null}});
MICROSIS.util.Subscriber=Class.create({initialize:function(a,b){this.method=a;this.obj=b},isComposedOf:function(a,b){return b?this.method==a&&this.obj==b:this.method==a}});
MICROSIS.util.EventProvider={__events:null,__subscribers:null,subscribe:function(a,b,c){this.__events=this.__events||{};var d=this.__events[a];if(d)d.subscribe(b,c);else{d=this.__subscribers=this.__subscribers||{};d[a]||(d[a]=[]);d[a].push({method:b,obj:c})}},unsubscribe:function(a,b,c){var d=this.__events=this.__events||{};if(a){if(d=d[a])return d.unsubscribe(b,c)}else{a=true;var e=!!Object.prototype.hasOwnProperty,f=null;for(var g in d)if(f=e?d.hasOwnProperty(g):!Object.isUndefined(d[g])&&d.constructor.prototype[g]!==
d[g])a=a&&d[g].unsubscribe(b,c);return a}return false},unsubscribeAll:function(a){return this.unsubscribe(a)},createEvent:function(a,b){var c=this.__events=this.__events||{},d=this.__subscribers=this.__subscribers||{};if(Object.isUndefined(c[a])){var e=new MICROSIS.util.CustomEvent(a,b||this);c[a]=e;(d=d[a])&&d.each(function(f){e.subscribe(f.method,f.obj)})}return c[a]},fireEvent:function(a){var b=$A(arguments);a=b.shift();var c=(this.__events=this.__events||{})[a];if(Object.isUndefined(c))return null;
return c.fire.apply(c,b)}};
var SelectorBase=Class.create({wrapper:null,searchForm:null,searchElement:null,resultsElement:null,submitForm:null,submitIdElement:null,currentData:null,initialize:function(a){this.wrapper=$(a);this.searchForm=this.wrapper.select(".searchform").first();this.searchElement=this.searchForm.select("input").first();this.resultsElement=this.wrapper.select(".searchresults").first();this.searchForm.observe("submit",this.onSubmit.bind(this))},onSubmit:function(a){this.search(this.searchElement.value);a.stop()},
handleSearchResult:function(a){a=a.responseJSON;if(a!=null&&a.length>0){this.buildResults(a);this.currentData=a}else{a=(new Element("p")).update("Sorry, but your search didn&rsquo;t return any results");this.resultsElement.innerHTML="";this.resultsElement.appendChild(a);this.currentData={}}}});hexcase=0;b64pad="";chrsz=8;function hex_sha1(a){return binb2hex(core_sha1(str2binb(a),a.length*chrsz))}function b64_sha1(a){return binb2b64(core_sha1(str2binb(a),a.length*chrsz))}
function str_sha1(a){return binb2str(core_sha1(str2binb(a),a.length*chrsz))}function hex_hmac_sha1(a,b){return binb2hex(core_hmac_sha1(a,b))}function b64_hmac_sha1(a,b){return binb2b64(core_hmac_sha1(a,b))}function str_hmac_sha1(a,b){return binb2str(core_hmac_sha1(a,b))}function sha1_vm_test(){return hex_sha1("abc")=="a9993e364706816aba3e25717850c26c9cd0d89d"}
function core_sha1(a,b){a[b>>5]|=128<<24-b%32;a[(b+64>>9<<4)+15]=b;var c=new Array(80),d=1732584193,e=-271733879,f=-1732584194,g=271733878,j=-1009589776,h,l,k,m,n,o,p,q;for(h=0;h<a.length;h+=16){m=d;n=e;o=f;p=g;q=j;for(l=0;l<80;l++){c[l]=l<16?a[h+l]:rol(c[l-3]^c[l-8]^c[l-14]^c[l-16],1);k=safe_add(safe_add(rol(d,5),sha1_ft(l,e,f,g)),safe_add(safe_add(j,c[l]),sha1_kt(l)));j=g;g=f;f=rol(e,30);e=d;d=k}d=safe_add(d,m);e=safe_add(e,n);f=safe_add(f,o);g=safe_add(g,p);j=safe_add(j,q)}return[d,e,f,g,j]}
function sha1_ft(a,b,c,d){if(a<20)return b&c|~b&d;if(a<40)return b^c^d;if(a<60)return b&c|b&d|c&d;return b^c^d}function sha1_kt(a){return a<20?1518500249:a<40?1859775393:a<60?-1894007588:-899497514}function core_hmac_sha1(a,b){var c=str2binb(a);if(c.length>16)c=core_sha1(c,a.length*chrsz);for(var d=new Array(16),e=new Array(16),f=0;f<16;f++){d[f]=c[f]^909522486;e[f]=c[f]^1549556828}c=core_sha1(d.concat(str2binb(b)),512+b.length*chrsz);return core_sha1(e.concat(c),672)}
function safe_add(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}function rol(a,b){return a<<b|a>>>32-b}function str2binb(a){for(var b=[],c=(1<<chrsz)-1,d=0;d<a.length*chrsz;d+=chrsz)b[d>>5]|=(a.charCodeAt(d/chrsz)&c)<<32-chrsz-d%32;return b}function binb2str(a){for(var b="",c=(1<<chrsz)-1,d=0;d<a.length*32;d+=chrsz)b+=String.fromCharCode(a[d>>5]>>>32-chrsz-d%32&c);return b}
function binb2hex(a){for(var b=hexcase?"0123456789ABCDEF":"0123456789abcdef",c="",d=0;d<a.length*4;d++)c+=b.charAt(a[d>>2]>>(3-d%4)*8+4&15)+b.charAt(a[d>>2]>>(3-d%4)*8&15);return c}function binb2b64(a){for(var b="",c,d,e=0;e<a.length*4;e+=3){c=(a[e>>2]>>8*(3-e%4)&255)<<16|(a[e+1>>2]>>8*(3-(e+1)%4)&255)<<8|a[e+2>>2]>>8*(3-(e+2)%4)&255;for(d=0;d<4;d++)b+=e*8+d*6>a.length*32?b64pad:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c>>6*(3-d)&63)}return b}
Function.prototype.prependArg=function(a){var b=this;return function(){for(var c=[a],d=0;d<arguments.length;d++)c.push(arguments[d]);return b.apply(this,c)}};function $build(a,b){return new Strophe.Builder(a,b)}function $msg(a){return new Strophe.Builder("message",a)}function $iq(a){return new Strophe.Builder("iq",a)}function $pres(a){return new Strophe.Builder("presence",a)}
Strophe={NS:{HTTPBIND:"http://jabber.org/protocol/httpbind",CLIENT:"jabber:client",AUTH:"jabber:iq:auth",ROSTER:"jabber:iq:roster",PROFILE:"jabber:iq:profile",DISCO_INFO:"http://jabber.org/protocol/disco#info",DISCO_ITEMS:"http://jabber.org/protocol/disco#items",MUC:"http://jabber.org/protocol/muc",SASL:"urn:ietf:params:xml:ns:xmpp-sasl",STREAM:"http://etherx.jabber.org/streams",BIND:"urn:ietf:params:xml:ns:xmpp-bind",SESSION:"urn:ietf:params:xml:ns:xmpp-session"},Status:{ERROR:0,CONNECTING:1,CONNFAIL:2,
AUTHENTICATING:3,AUTHFAIL:4,CONNECTED:5,DISCONNECTED:6,DISCONNECTING:7},LogLevel:{DEBUG:0,INFO:1,WARN:2,ERROR:3,FATAL:4},ElementType:{NORMAL:1,TEXT:3},TIMEOUT:70,SECONDARY_TIMEOUT:7,forEachChild:function(a,b,c){var d,e;for(d=0;d<a.childNodes.length;d++){e=a.childNodes[d];if(e.nodeType==Strophe.ElementType.NORMAL&&(!b||this.isTagEqual(e,b)))c(e)}},isTagEqual:function(a,b){return a.tagName.toLowerCase()==b.toLowerCase()},xmlElement:function(a){if(!a)return null;var b=null;b=window.ActiveXObject?(new ActiveXObject("Microsoft.XMLDOM")).createElement(a):
document.createElement(a);b.tagName!=a&&b.setAttribute("_realname",a);var c,d;for(c=1;c<arguments.length;c++)if(arguments[c])if(typeof arguments[c]=="string"||typeof arguments[c]=="number")b.appendChild(Strophe.xmlTextNode(arguments[c]));else if(typeof arguments[c]=="object"&&typeof arguments[c].sort=="function")for(d=0;d<arguments[c].length;d++)typeof arguments[c][d]=="object"&&typeof arguments[c][d].sort=="function"&&b.setAttribute(arguments[c][d][0],arguments[c][d][1]);return b},xmlTextNode:function(a){return window.ActiveXObject?
(new ActiveXObject("Microsoft.XMLDOM")).createTextNode(a):document.createTextNode(a)},getText:function(a){if(!a)return null;var b="";if(a.childNodes.length===0&&a.nodeType==Strophe.ElementType.TEXT)b+=a.nodeValue;for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeType==Strophe.ElementType.TEXT)b+=a.childNodes[c].nodeValue;return b},copyElement:function(a){var b,c;if(a.nodeType==Strophe.ElementType.NORMAL){c=Strophe.xmlElement(a.tagName);for(b=0;b<a.attributes.length;b++)c.setAttribute(a.attributes[b].nodeName.toLowerCase(),
a.attributes[b].value);for(b=0;b<a.childNodes.length;b++)c.appendChild(Strophe.copyElement(a.childNodes[b]))}else if(a.nodeType==Strophe.ElementType.TEXT)c=Strophe.xmlTextNode(a.nodeValue);return c},escapeJid:function(a){a=a.split("@");var b=a.splice(a.length-1,1)[0];a=a.join("@").replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(/</g,"\\3c").replace(/>/g,"\\3e").replace(/@/g,
"\\40");return[a,b].join("@")},unescapeJid:function(a){return a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(a){if(a.indexOf("@")<0)return null;return this.escapeJid(a).split("@")[0]},getDomainFromJid:function(a){return this.escapeJid(this.getBareJidFromJid(a)).split("@")[1]},getResourceFromJid:function(a){a=
this.escapeJid(a).split("/");if(a.length<2)return null;return a[1]},getBareJidFromJid:function(a){return this.escapeJid(a).split("/")[0]},log:function(){},debug:function(a){this.log(this.LogLevel.DEBUG,a)},info:function(a){this.log(this.LogLevel.INFO,a)},warn:function(a){this.log(this.LogLevel.WARN,a)},error:function(a){this.log(this.LogLevel.ERROR,a)},fatal:function(a){this.log(this.LogLevel.FATAL,a)},serialize:function(a){var b;if(!a)return null;var c=a.nodeName,d,e;if(a.getAttribute("_realname")){c=
a.getAttribute("_realname");a.removeAttribute("_realname")}b="<"+c;for(d=0;d<a.attributes.length;d++)b+=" "+a.attributes[d].nodeName.toLowerCase()+"='"+a.attributes[d].value.replace("'","&#39;").replace("&","&#x26;")+"'";if(a.childNodes.length>0){b+=">";for(d=0;d<a.childNodes.length;d++){e=a.childNodes[d];if(e.nodeType==Strophe.ElementType.NORMAL)b+=Strophe.serialize(e);else if(e.nodeType==Strophe.ElementType.TEXT)b+=e.nodeValue}b+="</"+c+">"}else b+="/>";return b},_requestId:0};
Strophe.Builder=function(a,b){this.node=this.nodeTree=this._makeNode(a,b)};
Strophe.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return Strophe.serialize(this.nodeTree)},up:function(){this.node=this.node.parentNode;return this},attrs:function(a){for(var b in a)this.node.setAttribute(b,a[b]);return this},c:function(a,b){var c=this._makeNode(a,b);this.node.appendChild(c);this.node=c;return this},cnode:function(a){this.node.appendChild(a);this.node=a;return this},t:function(a){this.node.appendChild(Strophe.xmlTextNode(a));return this},_makeNode:function(a,
b){var c=Strophe.xmlElement(a);for(var d in b)c.setAttribute(d,b[d]);return c}};Strophe.Handler=function(a,b,c,d,e,f){this.handler=a;this.ns=b;this.name=c;this.type=d;this.id=e;this.from=f;this.active=false;this.user=true};
Strophe.Handler.prototype={isMatch:function(a){var b;if(!this.active)return false;b=false;if(this.ns){var c=this;Strophe.forEachChild(a,null,function(d){if(d.getAttribute("xmlns")==c.ns)b=true});b=b||a.getAttribute("xmlns")==this.ns}else b=true;if(b&&(!this.name||Strophe.isTagEqual(a,this.name))&&(!this.type||a.getAttribute("type")==this.type)&&(!this.id||a.getAttribute("id")==this.id)&&(!this.from||a.getAttribute("from")==this.from))return true;return false},run:function(a){var b=null;try{b=this.handler(a)}catch(c){if(c.sourceURL)Strophe.fatal("error: "+
this.handler+" "+c.sourceURL+":"+c.line+" - "+c.name+": "+c.message);else if(c.fileName){if(typeof console!="undefined"){console.trace();console.error(this.handler," - error - ",c,c.message)}Strophe.fatal("error: "+this.handler+" "+c.fileName+":"+c.lineNumber+" - "+c.name+": "+c.message)}else Strophe.fatal("error: "+this.handler);throw c;}return b},toString:function(){return"{Handler: "+this.handler+"("+this.name+")}"}};
Strophe.TimedHandler=function(a,b){this.period=a;this.handler=b;this.lastCalled=(new Date).getTime();this.active=false;this.user=true};Strophe.TimedHandler.prototype={run:function(){this.lastCalled=(new Date).getTime();return this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}};
Strophe.Request=function(a,b,c,d){this.id=++Strophe._requestId;this.data=a;this.func=this.origFunc=b;this.rid=c;this.date=NaN;this.sends=arguments.length>3?d:0;this.abort=false;this.dead=null;this.age=function(){if(!this.date)return 0;return(new Date-this.date)/1E3};this.timeDead=function(){if(!this.dead)return 0;return(new Date-this.dead)/1E3};this.xhr=this._newXHR()};
Strophe.Request.prototype={getResponse:function(){var a=null;if(this.xhr.responseXML&&this.xhr.responseXML.documentElement){a=this.xhr.responseXML.documentElement;if(a.tagName=="parsererror"){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);Strophe.error("responseXML: "+Strophe.serialize(this.xhr.responseXML));throw"parsererror";}}else if(this.xhr.responseText){Strophe.error("invalid response received");Strophe.error("responseText: "+this.xhr.responseText);
Strophe.error("responseXML: "+Strophe.serialize(this.xhr.responseXML))}return a},_newXHR:function(){var a=null;if(window.XMLHttpRequest){a=new XMLHttpRequest;a.overrideMimeType&&a.overrideMimeType("text/xml")}else if(window.ActiveXObject)a=new ActiveXObject("Microsoft.XMLHTTP");a.onreadystatechange=this.func.prependArg(this);return a}};
Strophe.Connection=function(a){this.service=a;this.jid="";this.resource=null;this.rid=Math.floor(Math.random()*4294967295);this.streamId=this.sid=null;this.do_bind=this.do_session=false;this.timedHandlers=[];this.handlers=[];this._disconnectTimeout=this._idleTimeout=null;this.connected=this.disconnecting=this.authenticated=false;this.errors=0;this.paused=false;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*1E4);this._idleTimeout=setTimeout(this._onIdle.bind(this),
100)};
Strophe.Connection.prototype={reset:function(){this.rid=Math.floor(Math.random()*4294967295);this.streamId=this.sid=null;this.do_bind=this.do_session=false;this.timedHandlers=[];this.handlers=[];this.connected=this.disconnecting=this.authenticated=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*1E4)},pause:function(){this.paused=true},resume:function(){this.paused=false},getUniqueId:function(a){return typeof a=="string"||typeof a=="number"?++this._uniqueId+":"+a:++this._uniqueId+
""},connect:function(a,b,c,d,e,f){this.jid=Strophe.getBareJidFromJid(a);this.pass=b;this.connect_callback=c;this.authenticated=this.connected=this.disconnecting=false;this.errors=0;d||(d=60);e||(e=1);if(f)this.window=f;this.domain=Strophe.getDomainFromJid(this.jid);if(a=Strophe.getResourceFromJid(a))this.resource=a;d=this._buildBody().attrs({to:this.domain,"xml:lang":"en",wait:d,hold:e,window:this.window});this.connect_callback(Strophe.Status.CONNECTING,null);this._requests.push(new Strophe.Request(d.toString(),
this._onRequestStateChange.bind(this).prependArg(this._connect_cb.bind(this)),d.tree().getAttribute("rid")));this._throttledRequestHandler()},rawInput:function(){},rawOutput:function(){},send:function(a){if(a!==null&&typeof a.sort=="function")for(var b=0;b<a.length;b++)this._data.push(a[b]);else this._data.push(a);this._throttledRequestHandler();clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)},addTimedHandler:function(a,b){var c=new Strophe.TimedHandler(a,
b);this.timedHandlers.push(c);return c},deleteTimedHandler:function(a){var b=[],c;for(c=0;c<this.timedHandlers.length;c++)this.timedHandlers[c]!=a&&b.push(this.timedHandlers[c]);this.timedHandlers=b},addHandler:function(a,b,c,d,e,f){a=new Strophe.Handler(a,b,c,d,e,f);this.handlers.push(a);return a},deleteHandler:function(a){for(var b=[],c=0;c<this.handlers.length;c++)this.handlers[c]!=a&&b.push(this.handlers[c]);this.handlers=b},disconnect:function(){Strophe.info("disconnect was called");if(this.connected){this._disconnectTimeout=
this._addSysTimedHandler(3E3,this._onDisconnectTimeout.bind(this));this._sendTerminate()}},_buildBody:function(){var a=$build("body",{rid:this.rid++,xmlns:Strophe.NS.HTTPBIND});this.sid!==null&&a.attrs({sid:this.sid});return a},_removeRequest:function(a){Strophe.debug("removing request");var b;for(b=this._requests.length-1;b>=0;b--)a==this._requests[b]&&this._requests.splice(b,1);a.xhr.onreadystatechange=function(){};this._throttledRequestHandler()},_restartRequest:function(a){var b=this._requests[a];
if(b.dead===null)b.dead=new Date;this._processRequest(a)},_processRequest:function(a){var b=this._requests[a],c=-1;try{if(b.xhr.readyState==4)c=b.xhr.status}catch(d){Strophe.error("caught an error in _requests["+a+"], reqStatus: "+c)}if(typeof c=="undefined")c=-1;var e=b.age();if(b.dead!==null&&b.timeDead()>Strophe.SECONDARY_TIMEOUT||!isNaN(e)&&e>Strophe.TIMEOUT||b.xhr.readyState==4&&(c<1||c>=500)){b.dead!==null&&b.timeDead()>Strophe.SECONDARY_TIMEOUT&&Strophe.error("Request "+this._requests[a].id+
" timed out (secondary), restarting");b.abort=true;b.xhr.abort();this._requests[a]=new Strophe.Request(b.data,b.origFunc,b.rid,b.sends)}if(b.xhr.readyState===0){Strophe.debug("request id "+b.id+"."+b.sends+" posting");b.date=new Date;try{b.xhr.open("POST",this.service,true)}catch(f){throw f;}b.xhr.send(b.data);b.sends++;this.rawOutput(b.data)}else Strophe.debug("_throttledRequestHandler: "+(a===0?"first":"second")+" request has readyState of "+b.xhr.readyState)},_throttledRequestHandler:function(){this._requests?
Strophe.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):Strophe.debug("_throttledRequestHandler called with undefined requests");if(!(!this._requests||this._requests.length===0)){this._requests.length>0&&this._processRequest(0);this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid)<this.window-1&&this._processRequest(1)}},_onRequestStateChange:function(a,b){Strophe.debug("request id "+b.id+"."+b.sends+" state changed to "+b.xhr.readyState);
if(b.abort)b.abort=false;else{var c;if(b.xhr.readyState==4){c=0;try{c=b.xhr.status}catch(d){}if(typeof c=="undefined")c=0;if(this.disconnecting)c>=400&&this._hitError(c);else{var e=this._requests[0]==b,f=this._requests[1]==b;if(c>0&&c<500||b.sends>5){this._removeRequest(b);Strophe.debug("request id "+b.id+" should now be removed")}if(c==200){if(f||e&&this._requests.length>0&&this._requests[0].age()>XMPP_SECONDARY_TIMEOUT)this._restartRequest(0);Strophe.debug("request id "+b.id+"."+b.sends+" got 200");
a(b);this.errors=0}else{Strophe.error("request id "+b.id+"."+b.sends+" error "+c+" happened");if(c===0||c>=400&&c<600||c>=12E3){this._hitError(c);c>=400&&c<500&&this.connect_callback(Strophe.Status.DISCONNECTING,null)}}c>0&&c<1E4||b.sends>5||this._throttledRequestHandler()}}}},_hitError:function(a){this.errors++;Strophe.warn("request errored, status: "+a+", number of errors: "+this.errors);this.errors>4&&this._onDisconnectTimeout()},_doDisconnect:function(){Strophe.info("_doDisconnect was called");
this.disconnecting=this.authenticated=false;this.streamId=this.sid=null;this.rid=Math.floor(Math.random()*4294967295);if(this.connected){this.connect_callback(Strophe.Status.DISCONNECTED,null);this.connected=false}this.handlers=[];this.timedHandlers=[]},_dataRecv:function(a){try{var b=a.getResponse()}catch(c){if(c!="parsererror")throw c;this.connect_callback(Strophe.Status.DISCONNECTING,"strophe-parsererror");this.disconnect()}if(b!==null){if(this.disconnecting&&this._requests.length==1){this.deleteTimedHandler(this._disconnectTimeout);
this._disconnectTimeout=null;this._doDisconnect()}this.rawInput(Strophe.serialize(b));a=b.getAttribute("type");if(a!==null&&a=="terminate"){a=b.getAttribute("condition");b=b.getElementsByTagName("conflict");if(a!==null){if(a=="remote-stream-error"&&b.length>0)a="conflict";this.connect_callback(Strophe.Status.CONNFAIL,a)}else this.connect_callback(Strophe.Status.CONNFAIL,"unknown");this._onDisconnectTimeout();this.connect_callback(Strophe.Status.DISCONNECTING,null)}else{var d,e,f,g;if(b.hasChildNodes())for(a=
0;a<b.childNodes.length;a++){d=b.childNodes[a];Strophe.debug("<child>"+Strophe.serialize(d)+"</child>");for(e=0;e<this.handlers.length;e++)this.handlers[e].active=true;f=[];for(e=0;e<this.handlers.length;e++){g=this.handlers[e];if(g.isMatch(d)&&(this.authenticated||!g.user))g.run(d)&&f.push(g);else f.push(g)}this.handlers=f}}}},_sendTerminate:function(){Strophe.info("_sendTerminate was called");var a=this._buildBody().attrs({type:"terminate"});this.authenticated&&a.c("presence",{xmlns:Strophe.NS.CLIENT,
type:"unavailable",from:Strophe.escapeJid(this.jid)+"/"+this.resource});this.disconnecting=true;var b=new Strophe.Request(a.toString(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),a.tree().getAttribute("rid"));for(a=0;a<this._requests.length;a++)this._requests[a].xhr.abort();b.xhr.open("POST",this.service,true);b.xhr.send(b.data);this.rawOutput(b.data)},_connect_cb:function(a){Strophe.info("_connect_cb was called");this.connected=true;var b=a.getResponse();if(b){this.rawInput(Strophe.serialize(b));
a=b.getAttribute("type");var c;if(a!==null&&a=="terminate"){a=b.getAttribute("condition");c=b.getElementsByTagName("conflict");if(a!==null){if(a=="remote-stream-error"&&c.length>0)a="conflict";this.connect_callback(Strophe.Status.CONNFAIL,a)}else this.connect_callback(Strophe.Status.CONNFAIL,"unknown")}else{this.sid=b.getAttribute("sid");this.stream_id=b.getAttribute("authid");var d=c=a=false;b=b.getElementsByTagName("mechanism");var e,f;if(b.length>0)for(e=0;e<b.length;e++){f=Strophe.getText(b[e]);
if(f=="DIGEST-MD5")c=true;else if(f=="PLAIN")a=true;else if(f=="ANONYMOUS")d=true}if(Strophe.getNodeFromJid(this.jid)===null&&d){this.connect_callback(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",null,null);this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"ANONYMOUS"}).tree())}else if(Strophe.getNodeFromJid(this.jid)===null){this.connect_callback(Strophe.Status.CONNFAIL,
null);this._onDisconnectTimeout()}else if(c){this.connect_callback(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._sasl_challenge1_cb.bind(this),null,"challenge",null,null);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"DIGEST-MD5"}).tree())}else if(a){a=Strophe.escapeJid(this.jid);a+="\u0000";a+=Strophe.getNodeFromJid(this.jid);a+="\u0000";a+=this.pass;this.connect_callback(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._sasl_success_cb.bind(this),null,"success",
null,null);this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);a=encode64(a);this.send($build("auth",{xmlns:Strophe.NS.SASL,mechanism:"PLAIN"}).t(a).tree())}else{this.connect_callback(Strophe.Status.AUTHENTICATING,null);this._addSysHandler(this._auth1_cb.bind(this),null,null,null,"_auth_1");this.send($iq({type:"get",to:this.domain,id:"_auth_1"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid)).tree())}}}},_sasl_challenge1_cb:function(a){var b=
/([a-z]+)=("[^"]+"|[^,"]+)(?:,|$)/,c=decode64(Strophe.getText(a));a=hex_md5(Math.random()*1234567890);for(var d="",e=null,f="",g;c.match(b);){g=c.match(b);c=c.replace(g[0],"");g[2]=g[2].replace(/^"(.+)"$/,"$1");switch(g[1]){case "realm":d=g[2];break;case "nonce":f=g[2];break;case "qop":break;case "host":e=g[2];break}}b="xmpp/"+d;if(e!==null)b=b+"/"+e;e=str_md5(Strophe.getNodeFromJid(this.jid)+":"+d+":"+this.pass)+":"+f+":"+a;c="AUTHENTICATE:"+b;g="";g+='username="'+Strophe.getNodeFromJid(this.jid)+
'",';g+='realm="'+d+'",';g+='nonce="'+f+'",';g+='cnonce="'+a+'",';g+='nc="00000001",';g+='qop="auth",';g+='digest-uri="'+b+'",';g+='response="'+hex_md5(hex_md5(e)+":"+f+":00000001:"+a+":auth:"+hex_md5(c))+'",';g+='charset="utf-8"';this._addSysHandler(this._sasl_challenge2_cb.bind(this),null,"challenge",null,null);this._addSysHandler(this._sasl_failure_cb.bind(this),null,"failure",null,null);this.send($build("response",{xmlns:Strophe.NS.SASL}).t(encode64(g)).tree());return false},_sasl_challenge2_cb:function(){this._addSysHandler(this._sasl_success_cb.bind(this),
null,"success",null,null);this.send($build("response",{xmlns:Strophe.NS.SASL}).tree());return false},_auth1_cb:function(a){var b=false;if(a.getAttribute("type")=="result")if(a=a.childNodes[0])if(a=a.getElementsByTagName("digest")[0])b=true;a=$iq({type:"set",id:"_auth_2"}).c("query",{xmlns:Strophe.NS.AUTH}).c("username",{}).t(Strophe.getNodeFromJid(this.jid));b?a.up().c("digest",{}).t(hex_sha1(this.stream_id+this.pass)):a.up().c("password",{}).t(this.pass);if(!this.resource){Strophe.info("Resource required for legacy authentication.");
this.connect_callback(Strophe.Status.AUTHFAIL,null);return false}a.up().c("resource",{}).t(this.resource);this._addSysHandler(this._auth2_cb.bind(this),null,null,null,"_auth_2");this.send(a.tree());return false},_sasl_success_cb:function(){Strophe.info("SASL authentication succeeded.");this._addSysHandler(this._sasl_auth1_cb.bind(this),null,"stream:features",null,null);this.send(null);return false},_sasl_auth1_cb:function(a){var b,c;for(b=0;b<a.childNodes.length;b++){c=a.childNodes[b];if(c.nodeName==
"bind")this.do_bind=true;if(c.nodeName=="session")this.do_session=true}if(this.do_bind){this._addSysHandler(this._sasl_bind_cb.bind(this),null,null,null,"_bind_auth_2");this.resource?this.send($iq({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:Strophe.NS.BIND}).c("resource",{}).t(this.resource).tree()):this.send($iq({type:"set",id:"_bind_auth_2"}).c("bind",{xmlns:Strophe.NS.BIND}).tree())}else{this.connect_callback(Strophe.Status.AUTHFAIL,null);return false}return false},_sasl_bind_cb:function(a){if(a.getAttribute("type")==
"error"){Strophe.info("SASL binding failed.");this.connect_callback(Strophe.Status.AUTHFAIL,null);return false}a=a.getElementsByTagName("bind");if(a.length>0){a=a[0].getElementsByTagName("jid");if(a.length>0){a=Strophe.getText(a[0]);a=a.split("/");this.resource=a[a.length-1];if(this.do_session){this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2");this.send($iq({type:"set",id:"_session_auth_2"}).c("session",{xmlns:Strophe.NS.SESSION}).tree())}}}else{Strophe.info("SASL binding failed.");
this.connect_callback(Strophe.Status.AUTHFAIL,null);return false}},_sasl_session_cb:function(a){if(a.getAttribute("type")=="result"){this.authenticated=true;this.connect_callback(Strophe.Status.CONNECTED,null)}else if(a.getAttribute("type")=="error"){Strophe.info("Session creation failed.");this.connect_callback(Strophe.Status.AUTHFAIL,null);return false}return false},_sasl_failure_cb:function(){this.connect_callback(Strophe.Status.AUTHFAIL,null);return false},_auth2_cb:function(a){if(a.getAttribute("type")==
"result"){this.authenticated=true;this.connect_callback(Strophe.Status.CONNECTED,null)}else a.getAttribute("type")=="error"&&this.connect_callback(Strophe.Status.AUTHFAIL,null);return false},_addSysTimedHandler:function(a,b){var c=new Strophe.TimedHandler(a,b);c.user=false;this.timedHandlers.push(c)},_addSysHandler:function(a,b,c,d,e){a=new Strophe.Handler(a,b,c,d,e);a.user=false;this.handlers.push(a)},_onDisconnectTimeout:function(){Strophe.info("_onDisconnectTimeout was called");for(var a=0;a<this._requests.length;a++)this._requests[a].xhr.abort();
this._requests=[];this._doDisconnect();return false},_onIdle:function(){var a,b,c;for(a=0;a<this.timedHandlers.length;a++)this.timedHandlers[a].active=true;var d=(new Date).getTime(),e=[];for(a=0;a<this.timedHandlers.length;a++){b=this.timedHandlers[a];if(b.active&&(this.authenticated||!b.user)){c=b.lastCalled+b.period;if(c-d<=0)b.run()&&e.push(b);else e.push(b)}}this.timedHandlers=e;if(this.authenticated&&this._requests.length===0&&this._data.length===0){Strophe.info("no requests during idle cycle, sending blank request");
this.send(null)}else{if(this._requests.length<2&&this._data.length>0&&!this.paused){b=this._buildBody();for(a=0;a<this._data.length;a++)this._data[a]!==null&&b.cnode(this._data[a]).up();delete this._data;this._data=[];this._requests.push(new Strophe.Request(b.toString(),this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)),b.tree().getAttribute("rid")));this._processRequest(this._requests.length-1)}if(this._requests.length>0){a=this._requests[0].age();this._requests[0].dead!==
null&&this._requests[0].timeDead()>Strophe.SECONDARY_TIMEOUT&&this._throttledRequestHandler();if(a>Strophe.TIMEOUT){Strophe.warn("Request "+this._requests[0].id+" timed out, over "+Strophe.TIMEOUT+" seconds since last activity");this._throttledRequestHandler()}}}clearTimeout(this._idleTimeout);this._idleTimeout=setTimeout(this._onIdle.bind(this),100)}};var Chat={};Chat.connections={};
Chat.Base=Class.create({current_user:null,server:null,debug:false,connection:null,connected:false,initialize:function(a,b,c){this.server=a;this.current_user=new Chat.User(b,c);this.onRecieveMessage=this.createEvent("onRecieveMessage");this.onConnect=this.createEvent("onConnect");this.onConnect.subscribe(this.handleConnected);if(Chat.connections[this.server]!=null){this.connection=Chat.connections[this.server];this.connected=true;this.onConnect.fire()}else{this.connection=new Strophe.Connection(this.server);
this.connection.resource="JavascriptPrivateChat"}},connect:function(){this.connected||this.connection.connect(this.current_user.handle,this.current_user.password,this.handleConnectionChange.bind(this))},disconnect:function(){this.connection.disconnect();Chat.connections[this.server]=null;this.connected=false},handleConnectionChange:function(a){switch(a){case Strophe.Status.CONNECTING:this.log("Connecting to server...");break;case Strophe.Status.CONNFAIL:this.log("Connection failed");break;case Strophe.Status.DISCONNECTING:this.log("Terminating connection...");
break;case Strophe.Status.DISCONNECTED:this.log("Connection terminated");break;case Strophe.Status.CONNECTED:this.log("Connected to server");this.connection.send($pres().tree());Chat.connections[this.server]=this.connection;this.onConnect.fire();break;default:this.log("Unknown response on connect: "+a)}},handleConnected:function(){this.connection.addHandler(this.recieve.bind(this),null,"message",null,null);this.connected=true},send:function(){},recieve:function(a){a.getAttribute("to");a.getAttribute("from");
var b=a.getAttribute("type");a=a.getElementsByTagName("body");b=="chat"&&a.length>0&&this.onRecieveMessage.fire(Strophe.getText(a[0]));return true},log:function(a){this.debug&&console.log(a)}});Chat.Private=Class.create(Chat.Base,{other_user:null,send:function(a){a=$build("body",{}).t(a).node;this.connection.send($msg({to:this.other_user.handle,from:this.current_user.handle,type:"chat"}).cnode(a).tree())},chatWith:function(a){this.other_user=new Chat.User(a)}});
Chat.User=Class.create({handle:null,password:null,initialize:function(a,b){this.handle=a;this.password=b}});Object.extend(Chat.Private.prototype,MICROSIS.util.EventProvider);
var FAQSelector=Class.create(SelectorBase,{initialize:function($super,b){$super(b);this.submitForm=this.wrapper.select(".faqAssignment").first();this.submitIdElement=this.wrapper.select(".faqId").first();this.apiURL="/faqs/search.json"},search:function(a){this.resultsElement.innerHTML="<p>Searching Knowledge Base&hellip;</p>";new Ajax.Request(this.apiURL+"?q="+escape(a),{method:"get",onSuccess:this.handleSearchResult.bind(this)})},handleSearchResult:function(a){a=a.responseJSON;if(a!=null&&a.length>
0){this.buildResults(a);this.currentData=a}else{a=(new Element("p")).update("Sorry, but your search didn&rsquo;t return any results");this.resultsElement.innerHTML="";this.resultsElement.appendChild(a);this.currentData={}}},buildResults:function(a){var b=new Element("ul",{"class":"ticket-list"});a.each(function(c){c=c.faq;var d=new Element("li"),e=(new Element("a",{href:"#",title:"Click to see the body of this article"})).update(c.title);e.observe("click",this.showPreview.bindAsEventListener(this,
e,c));var f=(new Element("a",{href:"#","class":"assign"})).update("Select This Article");f.observe("click",function(g,j){g.stop();this.assignArticle(j)}.bindAsEventListener(this,c));d.appendChild(e);d.appendChild(f);b.appendChild(d)}.bind(this));this.resultsElement.innerHTML="";this.resultsElement.appendChild(b)},showPreview:function(a,b,c){a.stop();a=b.up().select(".description").first();if(a!=null)a.visible()?a.hide():a.show();else{c=(new Element("div",{"class":"description"})).update(c.body);b.up().appendChild(c)}},
assignArticle:function(a){this.resultsElement.innerHTML="<p>Assigning your article..</p>";this.submitIdElement.value=a.id;this.submitForm.submit()}}),Highrise={init:function(a){this.user_id=a;this.getContactInfo();this.getNotes()},getContactInfo:function(){var a=$("highrise_contact_partial");new Ajax.Updater(a,this.url("contact"),{method:"get",onComplete:function(){a.removeClassName("loading");var b=a.down("#contact_details_block").remove();$("highrise_contact_details_partial").removeClassName("loading").update(b);
b.show()}})},getNotes:function(){var a=$("highrise_notes_partial");new Ajax.Updater(a,this.url("notes"),{method:"get",onComplete:function(){a.removeClassName("loading")}})},url:function(a){var b="/users/"+this.user_id;switch(a){case "notes":b+="/highrise_notes";break;case "contact":b+="/highrise_contact";break}return b}},Behavior={triggers:[],register:function(a){this.triggers.push(a)},start:function(){document.observe("dom:loaded",this.apply.bind(this,null))},apply:function(a){this.triggers.each(function(b){for(selector in b){var c=
a==null?$$(selector):$(a).select(selector);c&&c.each(function(d){b[selector](d)})}})}};Behavior.start();if(typeof Effect=="undefined")throw"controls.js requires including script.aculo.us' effects.js library";var Autocompleter={};
Autocompleter.Base=Class.create({baseInitialize:function(a,b,c){this.element=a=$(a);this.update=$(b);this.active=this.changed=this.hasFocus=false;this.entryCount=this.index=0;this.oldElementValue=this.element.value;if(this.setOptions)this.setOptions(c);else this.options=c||{};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(d,e){if(!e.style.position||e.style.position=="absolute"){e.style.position="absolute";Position.clone(d,e,{setHeight:false,offsetTop:d.offsetHeight})}Effect.Appear(e,{duration:0.15})};this.options.onHide=this.options.onHide||function(d,e){new Effect.Fade(e,{duration:0.15})};if(typeof this.options.tokens=="string")this.options.tokens=new Array(this.options.tokens);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(){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")}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();Element.getStyle(this.update,"display")!="none"&&this.options.onHide(this.element,this.update);this.iefix&&Element.hide(this.iefix)},startIndicator:function(){this.options.indicator&&Element.show(this.options.indicator)},
stopIndicator:function(){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.hasFocus=this.changed=true;this.observer&&clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1E3)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(a){var b=Event.findElement(a,"LI");if(this.index!=b.autocompleteIndex){this.index=b.autocompleteIndex;this.render()}Event.stop(a)},onClick:function(a){this.index=
Event.findElement(a,"LI").autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(){setTimeout(this.hide.bind(this),250);this.active=this.hasFocus=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(a){if(this.options.updateElement)this.options.updateElement(a);else{var b=
"";if(this.options.select){var c=$(a).select("."+this.options.select)||[];if(c.length>0)b=Element.collectTextNodes(c[0],this.options.select)}else b=Element.collectTextNodesIgnoreClass(a,"informal");c=this.getTokenBounds();if(c[0]!=-1){var d=this.element.value.substr(0,c[0]),e=this.element.value.substr(c[0]).match(/^\s+/);if(e)d+=e[0];this.element.value=d+b+this.element.value.substr(c[1])}else this.element.value=b;this.oldElementValue=this.element.value;this.element.focus();this.options.afterUpdateElement&&
this.options.afterUpdateElement(this.element,a)}},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(a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}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 a=this.element.value;if(a.strip().empty())return[-1,0];for(var b=arguments.callee.getFirstDifferencePos(a,this.oldElementValue),c=b==this.oldElementValue.length?1:0,d=-1,e=a.length,f,g=0,j=this.options.tokens.length;g<j;++g){f=a.lastIndexOf(this.options.tokens[g],b+c-1);if(f>d)d=f;f=a.indexOf(this.options.tokens[g],b+c);if(-1!=f&&f<e)e=f}return this.tokenBounds=[d+
1,e]}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(a,b){for(var c=Math.min(a.length,b.length),d=0;d<c;++d)if(a[d]!=b[d])return d;return c};
Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(a,b,c,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=c},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(a,b,c,d){this.baseInitialize(a,b,d);this.options.array=c},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(b){for(var c=[],d=[],e=b.getToken(),f=0;f<b.options.array.length&&c.length<b.options.choices;f++)for(var g=b.options.array[f],j=b.options.ignoreCase?
g.toLowerCase().indexOf(e.toLowerCase()):g.indexOf(e);j!=-1;){if(j==0&&g.length!=e.length){c.push("<li><strong>"+g.substr(0,e.length)+"</strong>"+g.substr(e.length)+"</li>");break}else if(e.length>=b.options.partialChars&&b.options.partialSearch&&j!=-1)if(b.options.fullSearch||/\s/.test(g.substr(j-1,1))){d.push("<li>"+g.substr(0,j)+"<strong>"+g.substr(j,e.length)+"</strong>"+g.substr(j+e.length)+"</li>");break}j=b.options.ignoreCase?g.toLowerCase().indexOf(e.toLowerCase(),j+1):g.indexOf(e,j+1)}if(d.length)c=
c.concat(d.slice(0,b.options.choices-c.length));return"<ul>"+c.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};
Ajax.InPlaceEditor=Class.create({initialize:function(a,b,c){this.url=b;this.element=a=$(a);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(c);Object.extend(this.options,c||{});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))if(Event.KEY_ESC==a.keyCode)this.handleFormCancellation(a);else Event.KEY_RETURN==a.keyCode&&this.handleFormSubmission(a)},createControl:function(a,b,c){var d=this.options[a+"Control"];b=this.options[a+"Text"];if("button"==d){c=document.createElement("input");c.type="submit";c.value=b;c.className="editor_"+a+"_button";if("cancel"==a)c.onclick=this._boundCancelHandler;this._form.appendChild(c);this._controls[a]=c}else if("link"==d){d=document.createElement("a");d.href=
"#";d.appendChild(document.createTextNode(b));d.onclick="cancel"==a?this._boundCancelHandler:this._boundSubmitHandler;d.className="editor_"+a+"_link";if(c)d.className+=" "+c;this._form.appendChild(d);this._controls[a]=d}},createEditField:function(){var a=this.options.loadTextURL?this.options.loadingText:this.getText(),b;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";var c=this.options.size||this.options.cols||0;if(0<c)b.size=c}else{b=document.createElement("textarea");
b.rows=1>=this.options.rows?this.options.autoRows:this.options.rows;b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=a;b.className="editor_field";if(this.options.submitOnBlur)b.onblur=this._boundSubmitHandler;this._controls.editor=b;this.options.loadTextURL&&this.loadExternalText();this._form.appendChild(this._controls.editor)},createForm:function(){function a(c,d){var e=b.options["text"+c+"Controls"];!e||d===false||b._form.appendChild(document.createTextNode(e))}var b=this;this._form=
$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();"textarea"==this._controls.editor.tagName.toLowerCase()&&this._form.appendChild(document.createElement("br"));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)){this._editing=true;this.triggerCallback("onEnterEditMode");this.options.externalControl&&this.options.externalControl.hide();
this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);this.options.loadTextURL||this.postProcessEditField();a&&Event.stop(a)}},enterHover:function(){this.options.hoverClassName&&this.element.addClassName(this.options.hoverClassName);this._saving||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();a&&Event.stop(a)},handleFormSubmission:function(a){var b=this._form,c=$F(this._controls.editor);this.prepareSubmission();b=this.options.callback(b,c)||"";if(Object.isString(b))b=b.toQueryParams();b.editorId=this.element.id;if(this.options.htmlResponse){c=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(c,{parameters:b,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});
new Ajax.Updater({success:this.element},this.url,c)}else{c=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(c,{parameters:b,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,c)}a&&Event.stop(a)},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();this.options.externalControl&&this.options.externalControl.show();
this._editing=this._saving=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(){this.options.hoverClassName&&this.element.removeClassName(this.options.hoverClassName);this._saving||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(b){this._form.removeClassName(this.options.loadingClassName);b=b.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;this.options.externalControlOnly||this.element.observe(b.key,a);this.options.externalControl&&this.options.externalControl.observe(b.key,a)}.bind(this))},removeForm:function(){if(this._form){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(a,
b){"function"==typeof this.options[a]&&this.options[a](this,b)},unregisterListeners:function(){$H(this._listeners).each(function(a){this.options.externalControlOnly||this.element.stopObserving(a.key,a.value);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,b,c,d){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(b,c,d)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];this.options.loadCollectionURL?this.loadCollection():this.checkForExternalText();this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);
this.showLoadingText(this.options.loadingCollectionText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){b=b.responseText.strip();if(!/^\[.*\]$/.test(b))throw"Server returned an invalid collection representation.";this._collection=eval(b);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,a)},
showLoadingText:function(a){this._controls.editor.disabled=true;var b=this._controls.editor.firstChild;if(!b){b=document.createElement("option");b.value="";this._controls.editor.appendChild(b);b.selected=true}b.update((a||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();this.options.loadTextURL?this.loadExternalText():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(d){return 2===d.length?d:[d,d].flatten()});var a="value"in this.options?this.options.value:this._text,
b=this._collection.any(function(d){return d[0]==a}.bind(this));this._controls.editor.update("");var c;this._collection.each(function(d,e){c=document.createElement("option");c.value=d[0];c.selected=b?d[0]==a:0==e;c.appendChild(document.createTextNode(d[1]));this._controls.editor.appendChild(c)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});
Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){function b(c,d){c in a||d===undefined||(a[c]=d)}if(a){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(a,b){new Effect.Highlight(b,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;a._effect&&a._effect.cancel()},onFailure:function(a){alert("Error communication with the server: "+
a.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(a,b,c){this.delay=b||0.5;this.element=$(a);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(){if(this.lastValue!=$F(this.element)){this.timer&&clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1E3);this.lastValue=$F(this.element)}},onTimerEvent:function(){this.timer=null;this.callback(this.element,
$F(this.element))}});
var Cookie={version:"0.7",cookies:{},_each:function(a){$H(this.cookies).each(a)},getAll:function(){this.cookies={};$A(document.cookie.split("; ")).each(function(a){var b=a.indexOf("=");this.cookies[a.substring(0,b)]=unescape(a.substring(b+1,a.length))}.bind(this));return this.cookies},read:function(){var a=$A(arguments),b=[];this.getAll();a.each(function(c){this.cookies[c]?b.push(this.cookies[c]):b.push(null)}.bind(this));return b.length>1?b:b[0]},write:function(a,b){if(a.constructor==Object&&a.name)a=
[a];if(a.constructor==Array)$A(a).each(function(c){this._write(c.name,c.value,c.expires,c.path,c.domain)}.bind(this));else{b=b||{expires:false,path:"",domain:""};for(name in a)this._write(name,a[name],b.expires,b.path,b.domain)}},_write:function(a,b,c,d,e){if(a.indexOf("=")==-1){a=a+"="+escape(b);if(c)a+="; expires="+c.toGMTString();if(d)a+="; path="+d;if(e)a+="; domain="+e;document.cookie=a}},erase:function(){var a={};$A(arguments).each(function(b){a[b]=""});this.write(a,{expires:new Date((new Date).getTime()-
1E11),path:"/"});this.getAll()},eraseAll:function(){this.erase.apply(this,$H(this.getAll()).keys())}};Object.extend(Cookie,{get:Cookie.read,set:Cookie.write,add:Cookie.read,remove:Cookie.erase,removeAll:Cookie.eraseAll,wipe:Cookie.erase,wipeAll:Cookie.eraseAll,destroy:Cookie.erase,destroyAll:Cookie.eraseAll});
var DateFormat={autoParse:function(){$$("span.timestamp").each(function(a){if(!a.hasClassName("parsed")){var b=Date.parseUTC(a.innerHTML),c=a.getAttribute("rel");if(c=="words")b=b.timeAgoInWords();else if(c=="words_old"){b=b.timeAgoInWords();b.replace("ago","old")}else b=b.strftime(c);a.update(b).addClassName("parsed")}})}};
Object.extend(Date.prototype,{strftime:function(a){function b(j){return j.toPaddedString(2)}function c(j){if(j=="00")return"12";if(j=="0")return"12";return j}var d=this.getDay(),e=this.getMonth(),f=this.getHours(),g=this.getMinutes();return a.gsub(/\%([aAbBcdHImMpSwyY])/,function(j){switch(j[1]){case "a":return $w("Sun Mon Tue Wed Thu Fri Sat")[d];case "A":return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[d];case "b":return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[e];
case "B":return $w("January February March April May June July August September October November December")[e];case "c":return this.toString();case "d":return b(this.getDate());case "H":return b(f);case "I":return c(b((f+12)%12));case "m":return c(b(e+1));case "M":return b(g);case "p":return f>11?"PM":"AM";case "S":return b(this.getSeconds());case "w":return d+1;case "y":return b(this.getFullYear()%100);case "Y":return this.getFullYear().toString()}}.bind(this))},timeAgoInWords:function(){return Date.distanceOfTimeInWords(this,
arguments.length>0?arguments[1]:new Date,arguments[2])}});
Object.extend(Date,{strftimeFormats:{time:"%I:%M %p",day:"%B %d",compact:"%b %d",dayName:"%A"},differenceFromNow:function(a){a=Math.ceil(((new Date).getTime()-a.getTime())/1E3);var b=Math.floor(a/3600).toPaddedString(2);a=Math.floor(a%3600);var c=Math.floor(a/60).toPaddedString(2);a=(a%60).toPaddedString(2);return[b,c,a]},parseUTC:function(a){a=new Date(a);a=Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds());return new Date(a)},distanceOfTimeInWords:function(a,
b,c){var d=parseInt((b.getTime()-a.getTime())/1E3);if(d<60)return"less than a minute ago";else if(d<120)return"about a minute ago";else if(d<2700)return parseInt(d/60).toString()+" minutes ago";else if(d<7200)return"about an hour ago";else if(d<86400)return"about "+parseInt(d/3600).toString()+" hours ago";else if(d<172800)return"1 day ago";else{d=parseInt(d/86400).toString();if(d>5){d="%B %d";if(b.getYear()!=a.getYear())d+=", %Y";if(c)d+=" %I:%M %p";return a.strftime(d)}else return d+" days ago"}}});
Object.extend(Number.prototype,{seconds:function(){return this*1E3},minutes:function(){return this*(60).seconds()},hours:function(){return this*(60).minutes()},days:function(){return this*(24).hours()},weeks:function(){return this*(7).days()},fortnights:function(){return this*(2).weeks()},months:function(){return this*(30).days()},years:function(){return parseInt(this*(365.25).days())},since:function(a){a=a||new Date;if(a instanceof Date)a=a.getTime();return this+a},ago:function(a){a=a||new Date;
if(a instanceof Date)a=a.getTime();return a-this},toDate:function(){var a=new Date;a.setTime(this);return a}});Object.extend(Number.prototype,{second:Number.prototype.seconds,minute:Number.prototype.minutes,hour:Number.prototype.hours,day:Number.prototype.days,week:Number.prototype.weeks,fortnight:Number.prototype.fortnights,month:Number.prototype.months,year:Number.prototype.years,from_now:Number.prototype.since,fromNow:Number.prototype.since,until:Number.prototype.ago});
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(a,b){a=$(a);var c=Object.extend({greedy:true,hoverclass:null,tree:false},b||{});if(c.containment){c._containers=[];var d=c.containment;Object.isArray(d)?d.each(function(e){c._containers.push($(e))}):c._containers.push($(d))}if(c.accept)c.accept=[c.accept].flatten();Element.makePositioned(a);c.element=a;this.drops.push(c)},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(a,b){var c;c=b.tree?a.treeNode:a.parentNode;return b._containers.detect(function(d){return c==d})},isAffected:function(a,b,c){return c.element!=b&&(!c._containers||this.isContained(b,c))&&(!c.accept||Element.classNames(b).detect(function(d){return c.accept.include(d)}))&&Position.within(c.element,a[0],a[1])},deactivate:function(a){a.hoverclass&&Element.removeClassName(a.element,a.hoverclass);this.last_active=null},activate:function(a){a.hoverclass&&
Element.addClassName(a.element,a.hoverclass);this.last_active=a},show:function(a,b){if(this.drops.length){var c,d=[];this.drops.each(function(e){Droppables.isAffected(a,b,e)&&d.push(e)});if(d.length>0)c=Droppables.findDeepestChild(d);this.last_active&&this.last_active!=c&&this.deactivate(this.last_active);if(c){Position.within(c.element,a[0],a[1]);c.onHover&&c.onHover(b,c.element,Position.overlap(c.overlap,c.element));c!=this.last_active&&Droppables.activate(c)}}},fire:function(a,b){if(this.last_active){Position.prepare();
if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active))if(this.last_active.onDrop){this.last_active.onDrop(b,this.last_active.element,a);return true}}},reset:function(){this.last_active&&this.deactivate(this.last_active)}},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){var b=[Event.pointerX(a),Event.pointerY(a)];if(!(this._lastPointer&&this._lastPointer.inspect()==b.inspect())){this._lastPointer=b;this.activeDraggable.updateDrag(a,b)}}},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=
null}if(this.activeDraggable){this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null}},keyPress:function(a){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(a,b,c){this[a+"Count"]>0&&this.observers.each(function(d){d[a]&&d[a](a,b,c)});b.options[a]&&
b.options[a](b,c)},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}},Draggable=Class.create({initialize:function(a,b){var c={handle:false,reverteffect:function(d,e,f){new Effect.Move(d,{x:-f,y:-e,duration:Math.sqrt(Math.abs(e^2)+Math.abs(f^2))*0.02,queue:{scope:"_draggable",position:"end"}})},endeffect:function(d){var e=Object.isNumber(d._opacity)?d._opacity:1;new Effect.Opacity(d,
{duration:0.2,from:0.7,to:e,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[d]=false}})},zindex:1E3,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!b||Object.isUndefined(b.endeffect))Object.extend(c,{starteffect:function(d){d._opacity=Element.getOpacity(d);Draggable._dragging[d]=true;new Effect.Opacity(d,{duration:0.2,from:d._opacity,to:0.7})}});c=Object.extend(c,b||{});this.element=$(a);if(c.handle&&Object.isString(c.handle))this.handle=
this.element.down("."+c.handle,0);if(!this.handle)this.handle=$(c.handle);if(!this.handle)this.handle=this.element;if(c.scroll&&!c.scroll.scrollTo&&!c.scroll.outerHTML){c.scroll=$(c.scroll);this._isScrollChild=Element.childOf(this.element,c.scroll)}Element.makePositioned(this.element);this.options=c;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(a){if(!(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]))if(Event.isLeftClick(a))if(!((tag_name=Event.element(a).tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA"))){var b=
[Event.pointerX(a),Event.pointerY(a)],c=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(d){return b[d]-c[d]});Draggables.activate(this);Event.stop(a)}},startDrag:function(a){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.element._originallyAbsolute=
this.element.getStyle("position")=="absolute";this.element._originallyAbsolute||Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll)if(this.options.scroll==window){var b=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=b.left;this.originalScrollTop=b.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}Draggables.notify("onStart",this,a);this.options.starteffect&&
this.options.starteffect(this.element)},updateDrag:function(a,b){this.dragging||this.startDrag(a);if(!this.options.quiet){Position.prepare();Droppables.show(b,this.element)}Draggables.notify("onDrag",this,a);this.draw(b);this.options.change&&this.options.change(this);if(this.options.scroll){this.stopScrolling();var c;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll))c=[left,top,left+width,top+height];else{c=Position.page(this.options.scroll);c[0]+=this.options.scroll.scrollLeft+
Position.deltaX;c[1]+=this.options.scroll.scrollTop+Position.deltaY;c.push(c[0]+this.options.scroll.offsetWidth);c.push(c[1]+this.options.scroll.offsetHeight)}var d=[0,0];if(b[0]<c[0]+this.options.scrollSensitivity)d[0]=b[0]-(c[0]+this.options.scrollSensitivity);if(b[1]<c[1]+this.options.scrollSensitivity)d[1]=b[1]-(c[1]+this.options.scrollSensitivity);if(b[0]>c[2]-this.options.scrollSensitivity)d[0]=b[0]-(c[2]-this.options.scrollSensitivity);if(b[1]>c[3]-this.options.scrollSensitivity)d[1]=b[1]-
(c[3]-this.options.scrollSensitivity);this.startScrolling(d)}Prototype.Browser.WebKit&&window.scrollBy(0,0);Event.stop(a)},finishDrag:function(a,b){this.dragging=false;if(this.options.quiet){Position.prepare();var c=[Event.pointerX(a),Event.pointerY(a)];Droppables.show(c,this.element)}if(this.options.ghosting){this.element._originallyAbsolute||Position.relativize(this.element);delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null}c=false;if(b)(c=Droppables.fire(a,this.element))||
(c=false);c&&this.options.onDropped&&this.options.onDropped(this.element);Draggables.notify("onEnd",this,a);var d=this.options.revert;if(d&&Object.isFunction(d))d=d(this.element);var e=this.currentDelta();if(d&&this.options.reverteffect){if(c==0||d!="failure")this.options.reverteffect(this.element,e[1]-this.delta[1],e[0]-this.delta[0])}else this.delta=e;if(this.options.zindex)this.element.style.zIndex=this.originalZ;this.options.endeffect&&this.options.endeffect(this.element);Draggables.deactivate(this);
Droppables.reset()},keyPress:function(a){if(a.keyCode==Event.KEY_ESC){this.finishDrag(a,false);Event.stop(a)}},endDrag:function(a){if(this.dragging){this.stopScrolling();this.finishDrag(a,true);Event.stop(a)}},draw:function(a){var b=Position.cumulativeOffset(this.element);if(this.options.ghosting){var c=Position.realOffset(this.element);b[0]+=c[0]-Position.deltaX;b[1]+=c[1]-Position.deltaY}c=this.currentDelta();b[0]-=c[0];b[1]-=c[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}c=[0,1].map(function(e){return a[e]-b[e]-this.offset[e]}.bind(this));if(this.options.snap)c=Object.isFunction(this.options.snap)?this.options.snap(c[0],c[1],this):Object.isArray(this.options.snap)?c.map(function(e,f){return(e/this.options.snap[f]).round()*this.options.snap[f]}.bind(this)):c.map(function(e){return(e/this.options.snap).round()*this.options.snap}.bind(this));var d=this.element.style;
if(!this.options.constraint||this.options.constraint=="horizontal")d.left=c[0]+"px";if(!this.options.constraint||this.options.constraint=="vertical")d.top=c[1]+"px";if(d.visibility=="hidden")d.visibility=""},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(a[0]||a[1]){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 a=new Date,b=a-this.lastScrolled;this.lastScrolled=a;if(this.options.scroll==window)with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){a=b/1E3;this.options.scroll.scrollTo(left+a*this.scrollSpeed[0],top+a*this.scrollSpeed[1])}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*b/1E3;this.options.scroll.scrollTop+=this.scrollSpeed[1]*b/1E3}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]*b/1E3;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*b/1E3;if(Draggables._lastScrollPointer[0]<0)Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer)}this.options.change&&this.options.change(this)},
_getWindowScroll:function(a){var b,c,d;with(a.document){if(a.document.documentElement&&documentElement.scrollTop){b=documentElement.scrollTop;c=documentElement.scrollLeft}else if(a.document.body){b=body.scrollTop;c=body.scrollLeft}if(a.innerWidth){d=a.innerWidth;a=a.innerHeight}else if(a.document.documentElement&&documentElement.clientWidth){d=documentElement.clientWidth;a=documentElement.clientHeight}else{d=body.offsetWidth;a=body.offsetHeight}}return{top:b,left:c,width:d,height:a}}});
Draggable._dragging={};
var SortableObserver=Class.create({initialize:function(a,b){this.element=$(a);this.observer=b;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();this.lastValue!=Sortable.serialize(this.element)&&this.observer(this.element)}}),Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){for(;a.tagName.toUpperCase()!="BODY";){if(a.id&&Sortable.sortables[a.id])return a;
a=a.parentNode}},options:function(a){if(a=Sortable._findRootElement($(a)))return Sortable.sortables[a.id]},destroy:function(a){if(a=Sortable.options(a)){Draggables.removeObserver(a.element);a.droppables.each(function(b){Droppables.remove(b)});a.draggables.invoke("destroy");delete Sortable.sortables[a.element.id]}},create:function(a,b){a=$(a);var c=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},b||{});this.destroy(a);var d={revert:true,quiet:c.quiet,scroll:c.scroll,scrollSpeed:c.scrollSpeed,scrollSensitivity:c.scrollSensitivity,delay:c.delay,ghosting:c.ghosting,constraint:c.constraint,handle:c.handle};if(c.starteffect)d.starteffect=c.starteffect;if(c.reverteffect)d.reverteffect=
c.reverteffect;else if(c.ghosting)d.reverteffect=function(g){g.style.top=0;g.style.left=0};if(c.endeffect)d.endeffect=c.endeffect;if(c.zindex)d.zindex=c.zindex;var e={overlap:c.overlap,containment:c.containment,tree:c.tree,hoverclass:c.hoverclass,onHover:Sortable.onHover},f={onHover:Sortable.onEmptyHover,overlap:c.overlap,containment:c.containment,hoverclass:c.hoverclass};Element.cleanWhitespace(a);c.draggables=[];c.droppables=[];if(c.dropOnEmpty||c.tree){Droppables.add(a,f);c.droppables.push(a)}(c.elements||
this.findElements(a,c)||[]).each(function(g,j){var h=c.handles?$(c.handles[j]):c.handle?$(g).select("."+c.handle)[0]:g;c.draggables.push(new Draggable(g,Object.extend(d,{handle:h})));Droppables.add(g,e);if(c.tree)g.treeNode=a;c.droppables.push(g)});if(c.tree)(Sortable.findTreeElements(a,c)||[]).each(function(g){Droppables.add(g,f);g.treeNode=a;c.droppables.push(g)});this.sortables[a.id]=c;Draggables.addObserver(new SortableObserver(a,c.onUpdate))},findElements:function(a,b){return Element.findChildren(a,
b.only,b.tree?true:false,b.tag)},findTreeElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.treeTag)},onHover:function(a,b,c){if(!Element.isParent(b,a))if(!(c>0.33&&c<0.66&&Sortable.options(b).tree))if(c>0.5){Sortable.mark(b,"before");if(b.previousSibling!=a){c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,b);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}else{Sortable.mark(b,"after");var d=b.nextSibling||
null;if(d!=a){c=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,d);b.parentNode!=c&&Sortable.options(c).onChange(a);Sortable.options(b.parentNode).onChange(a)}}},onEmptyHover:function(a,b,c){var d=a.parentNode,e=Sortable.options(b);if(!Element.isParent(b,a)){var f=Sortable.findElements(b,{tag:e.tag,only:e.only}),g=null;if(f){var j=Element.offsetSize(b,e.overlap)*(1-c);for(c=0;c<f.length;c+=1)if(j-Element.offsetSize(f[c],e.overlap)>=0)j-=Element.offsetSize(f[c],e.overlap);else{g=
j-Element.offsetSize(f[c],e.overlap)/2>=0?c+1<f.length?f[c+1]:null:f[c];break}}b.insertBefore(a,g);Sortable.options(d).onChange(a);e.onChange(a)}},unmark:function(){Sortable._marker&&Sortable._marker.hide()},mark:function(a,b){var c=Sortable.options(a.parentNode);if(!(c&&!c.ghosting)){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 d=
Position.cumulativeOffset(a);Sortable._marker.setStyle({left:d[0]+"px",top:d[1]+"px"});if(b=="after")c.overlap=="horizontal"?Sortable._marker.setStyle({left:d[0]+a.clientWidth+"px"}):Sortable._marker.setStyle({top:d[1]+a.clientHeight+"px"});Sortable._marker.show()}},_tree:function(a,b,c){for(var d=Sortable.findElements(a,b)||[],e=0;e<d.length;++e){var f=d[e].id.match(b.format);if(f){f={id:encodeURIComponent(f?f[1]:null),element:a,parent:c,children:[],position:c.children.length,container:$(d[e]).down(b.treeTag)};
f.container&&this._tree(f.container,b,f);c.children.push(f)}}return c},tree:function(a,b){a=$(a);var c=this.options(a);c=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:a.id,format:c.format},b||{});return Sortable._tree(a,c,{id:null,parent:null,children:[],container:a,position:0})},_constructIndex:function(a){var b="";do if(a.id)b="["+a.position+"]"+b;while((a=a.parent)!=null);return b},sequence:function(a,b){a=$(a);var c=Object.extend(this.options(a),b||{});return $(this.findElements(a,
c)||[]).map(function(d){return d.id.match(c.format)?d.id.match(c.format)[1]:""})},setSequence:function(a,b,c){a=$(a);var d=Object.extend(this.options(a),c||{}),e={};this.findElements(a,d).each(function(f){if(f.id.match(d.format))e[f.id.match(d.format)[1]]=[f,f.parentNode];f.parentNode.removeChild(f)});b.each(function(f){var g=e[f];if(g){g[1].appendChild(g[0]);delete e[f]}})},serialize:function(a,b){a=$(a);var c=Object.extend(Sortable.options(a),b||{}),d=encodeURIComponent(b&&b.name?b.name:a.id);return c.tree?
Sortable.tree(a,b).children.map(function(e){return[d+Sortable._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))}).flatten().join("&"):Sortable.sequence(a,b).map(function(e){return d+"[]="+encodeURIComponent(e)}).join("&")}};Element.isParent=function(a,b){if(!a.parentNode||a==b)return false;if(a.parentNode==b)return true;return Element.isParent(a.parentNode,b)};
Element.findChildren=function(a,b,c,d){if(!a.hasChildNodes())return null;d=d.toUpperCase();if(b)b=[b].flatten();var e=[];$A(a.childNodes).each(function(f){if(f.tagName&&f.tagName.toUpperCase()==d&&(!b||Element.classNames(f).detect(function(g){return b.include(g)})))e.push(f);if(c)(f=Element.findChildren(f,b,c,d))&&e.push(f)});return e.length>0?e.flatten():[]};Element.offsetSize=function(a,b){return a["offset"+(b=="vertical"||b=="height"?"Height":"Width")]};
Element.addMethods({replaceClassName:function(a,b,c){a=$(a);a.removeClassName(b);a.addClassName(c);return a}});
var PopBox=Class.create({initialize:function(a){a=Builder.node("div",{"class":"popbox-inner"},a);this.element=Builder.node("div",{"class":"popbox-container"},a)},element:null,options:{}}),PopManager={startZ:101,activeBoxes:[],modalized:false,createPop:function(a,b){b==null&&(b={});b.modal=b.modal==null?true:b.modal;b.positionMode=b.positionMode==null?"center":b.positionMode;if(typeof a=="object"){this.activeBoxes.push(a);b.modal&&this._createOverlay();this.enableKeys();var c=$(a.element);c.setOpacity(0);
var d=Builder.node("span",{"class":"close-btn"},"Close");c.insert(d);document.body.appendChild(c);d=this.startZ;d=d=="auto"?this.startZ+1:d++;c.setStyle({zIndex:d});c.setOpacity(1);c.select(".close-btn")[0].observe("click",function(){PopManager.removePop(a)});this.activeBoxes.last();b.positionMode=="center"&&this.enableAutoCenter();Behavior.apply(c)}},removePop:function(a){if(!(typeof a!="object"||a==null)){a.options.onClose!=null&&a.options.onClose();a.element.down("span.close-btn").remove();a.element.remove();
this.activeBoxes=this.activeBoxes.without(a);if(this.modalized&&this.activeBoxes.length==0){this._removeOverlay();this.disableKeys()}}},ajaxCreate:function(a,b){b=$H(b||{});var c=b.get("method")||"get",d=b.unset("onComplete"),e=Builder.node("div"),f=$H({onLoading:function(){e.setStyle({"min-height":"300px"});e.innerHTML="<h1>Loading...</h1>"}});e.innerHTML="<h1>Loading...</h1>";var g=new PopBox(e);PopManager.createPop(g);f=f.merge({method:c,parameters:b.get("parameters"),onComplete:function(j,h){e.innerHTML=
h.responseText;Object.isUndefined(d)||d.call(j,h);this._center(j.element);this.setupAjaxPagination(e,f)}.bind(this,g)}).merge(b);new Ajax.Request(a,f.toObject())},setupAjaxPagination:function(a,b){a=$(a);a.select("div.pagination.ajax a").each(function(c){c.observe("click",function(d){d.stop();d=this.readAttribute("href");new Ajax.Request(d,b.toObject())})})},removeLast:function(){this.activeBoxes.length<1||this.removePop(this.activeBoxes.last())},centerLast:function(){this.activeBoxes.length>0&&this._center(this.activeBoxes.last().element)},
enableAutoCenter:function(){setTimeout(function(){this._center(this.activeBoxes.last().element)}.bind(this),100)},disableAutoCenter:function(){},enableKeys:function(){$(document).observe("keypress",this._kbdInput.bind(this))},disableKeys:function(){$(document).observe("keypress",this._kbdInput.bind(this))},_kbdInput:function(a){(a.keyCode||a.which)==Event.KEY_ESC&&this.removePop(this.activeBoxes.last())},_createOverlay:function(){var a=$(Builder.node("iframe",{id:"popbox_iframe","class":"popbox-iframe"}));
$(document.body).insert(a);a=$(Builder.node("div",{id:"popbox_overlay","class":"popbox-overlay"}));$(document.body).insert(a);this._resizeOverlay();this.modalized=true},_removeOverlay:function(){$("popbox_overlay").remove();$("popbox_iframe").remove();this.modalized=false},_resizeOverlay:function(){$("popbox_overlay").setStyle({height:document.body.scrollHeight+"px",width:$(document.body).getDimensions().width+"px"});$("popbox_iframe").setStyle({height:document.body.scrollHeight+"px",width:$(document.body).getDimensions().width+
"px"})},_center:function(a){if(a){var b=a.getDimensions(),c=0;if(document.viewport.getHeight()<b.height)c=50;else{c=document.viewport.getHeight()-b.height;c=parseInt(c/2)}var d=document.viewport.getScrollOffsets().top;c+=d;if(d+b.height>document.viewport.getHeight())c=d;a.setStyle({position:"absolute",top:c+"px",left:"50%"});b=parseInt(a.getStyle("width"))+parseInt(a.getStyle("padding-left"))+parseInt(a.getStyle("padding-right"));a.setStyle({marginLeft:parseInt(-1*b/2)+"px"})}}},Tabs=Class.create({triggers:[],
containers:{},selectedContainer:null,initialize:function(a){this.triggers=$(a).select("a");var b;this.triggers.each(function(c){var d=c.getAttribute("href").getAnchor(),e=$(d);if(e!=null){c.observe("click",this.click.bindAsEventListener(this,c));this.containers[d]=e;if(c.hasClassName("selected"))b=c}}.bind(this));this.click(null,b?b:this.triggers.first())},click:function(a,b){var c=b.getAttribute("href").getAnchor();this.selectedContainer!=null&&this.selectedContainer.hide();this.selectedContainer=
this.containers[c].show();this.triggers.each(function(d){d.removeClassName("selected")});b.addClassName("selected");a&&a.stop()}});Object.extend(Tabs,{autoActivate:function(){var a=$$(".tabs");a.length>0&&$$(".tab-content").each(Element.hide);a.each(function(b){new Tabs(b)})}});String.prototype.getAnchor=function(){return/#([a-z][\w.:-]*)$/i.exec(this)[1]};
document.observe("dom:loaded",function(){$$(".autosuggest li.knowledgebase-article h4 a, p.rlinks a.readmore").each(function(a){a.observe("click",function(b){b.stop();this.up("li").down(".article").toggle();this.classNames().include("readmore")&&this.up("div.body").hide()})})});
var DiscussionAction=Class.create({wrapper:null,initialize:function(a){var b=a.getAttribute("confirm_message");if(b!=null&&b!="")if(!confirm(b))return;this.element=$(a);this.wrapper=a.up(".admin-functions");if(!this.wrapper.hasClassName("acting")){this.wrapper.addClassName("acting");this.loader=this.wrapper.down("span.loader");if(this.loader==null)this.loader=new Element("span",{"class":"loader"});this.wrapper.insert(this.loader);this.sendRequest()}},sendRequest:function(a){a&&a.stop();this.loader.removeClassName("loader-success").removeClassName("loader-error").update("Sending request...");
new Ajax.Request(this.url,{method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),parameters:{authenticity_token:getAuthKey()}})},onSuccess:function(){this.wrapper.removeClassName("acting");this.succeed()},onFailure:function(){this.wrapper.removeClassName("acting");this.fail()},fail:function(){this.loader.addClassName("loader-error");this.loader.update("There was a problem with your request. <a href='#' class='retry'>Retry?</a> or <a href='#' class='cancel'>Cancel</a>");
this.loader.down(".retry").observe("click",this.sendRequest.bind(this));this.loader.down(".cancel").observe("click",function(a){a&&a.stop();this.loader.remove()}.bind(this))},succeed:function(){this.loader.hide()}});DiscussionAction.ToggleQueue=function(a){if(a.up("li").hasClassName("in-queue"))new DiscussionAction.RemoveFromQueue(a);else new DiscussionAction.AddToQueue(a)};
DiscussionAction.AddToQueue=Class.create(DiscussionAction,{initialize:function($super,b){this.url=b.getAttribute("add_path");$super(b)},sendRequest:function(){this.loader.removeClassName("loader-success").removeClassName("loader-error").update("Sending request...");new Ajax.Request(this.url,{method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),parameters:{authenticity_token:getAuthKey(),_method:"put"}})},succeed:function($super){$super();this.loader.addClassName("loader-success");
this.loader.update("Discussion added to queue!");this.loader.show();this.element.up("li").addClassName("in-queue");setTimeout(function(){this.loader.hide()}.bind(this),1500)}});
DiscussionAction.RemoveFromQueue=Class.create(DiscussionAction,{initialize:function($super,b){this.url=b.getAttribute("remove_path");$super(b)},sendRequest:function(){this.loader.removeClassName("loader-success").removeClassName("loader-error").update("Sending request...");new Ajax.Request(this.url,{method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this),parameters:{authenticity_token:getAuthKey(),_method:"put"}})},succeed:function($super){$super();this.loader.addClassName("loader-success");
this.loader.update("Discussion removed from queue!");this.loader.show();this.element.up("li").removeClassName("in-queue");setTimeout(function(){this.loader.hide()}.bind(this),1500)}});
DiscussionAction.AcknowledgeUpdate=Class.create(DiscussionAction,{initialize:function($super,b){this.url=b.getAttribute("href");$super(b)},succeed:function($super){$super();this.loader.addClassName("loader-success");this.loader.update("This update has been acknowledged");this.loader.show();this.element.update("Acknowledged");this.element.onclick=function(){return false};setTimeout(function(){this.loader.hide()}.bind(this),1500)}});
var LighthouseTicketSelector=Class.create({wrapper:null,searchForm:null,searchElement:null,resultsElement:null,submitForm:null,submitIdElements:null,submitTrackerIdElements:null,currentData:null,initialize:function(a){this.wrapper=$(a);this.searchForm=this.wrapper.select(".searchform").first();this.searchElement=this.searchForm.select("input").first();this.resultsElement=this.wrapper.select(".searchresults").first();this.submitForm=this.wrapper.select(".ticketAssignment").first();this.submitIdElements=
this.wrapper.select(".ticketId");this.submitTrackerIdElements=this.wrapper.select(".trackerId");this.searchForm.observe("submit",this.onSubmit.bind(this));this.callbackFunction="response"+Math.ceil(Math.random()*1E4);LighthouseTicketSelector[this.callbackFunction]=this.handleSearchResult.bind(this);(a=$$(".show-ticket-form-button")[0])&&a.observe("click",function(){setTimeout(function(){typeof(PopManager!="undefined")&&PopManager.centerLast()},100)})},apiURL:function(){return this.projectURL()+"/tickets.json?callback=LighthouseTicketSelector."+
this.callbackFunction},projectURL:function(){return"http://"+LighthouseTicketSelector.hostName+"/projects/"+LighthouseTicketSelector.projectId},ticketURL:function(a){return this.projectURL()+"/tickets/"+a.number},onSubmit:function(a){a.stop();this.search(this.searchElement.value)},search:function(a){this.resultsElement.innerHTML="<p>Searching Lighthouse&hellip;</p>";this._scriptTag(this.apiURL()+"&q="+escape(a)+"&_token="+LighthouseTicketSelector.apiToken)},handleSearchResult:function(a){if(a.tickets!=
null){this.buildResults(a.tickets);this.currentData=a.tickets}else{a=(new Element("p")).update("Sorry, but your search didn&rsquo;t return any results");this.resultsElement.innerHTML="";this.resultsElement.appendChild(a);this.currentData={}}},buildResults:function(a){var b=new Element("ul",{"class":"ticket-list"});a.each(function(c){c=c.ticket;var d=new Element("li",{"class":c.state}),e=(new Element("a",{href:this.ticketURL(c),title:"Click to see the ticket"})).update("#"+c.number),f=new Element("span",
{"class":"num"}),g=(new Element("a",{href:"#",title:"Click to see the body of this ticket"})).update(c.title);g.observe("click",this.showPreview.bindAsEventListener(this,g,c));var j=(new Element("span",{"class":"note"})).update("("+c.state+")"),h=(new Element("a",{href:"#","class":"assign"})).update("Select This Ticket");h.observe("click",function(l,k){l.stop();this.assignTicket(k)}.bindAsEventListener(this,c));f.appendChild(e);d.appendChild(f);d.appendChild(g);d.appendChild(j);d.appendChild(h);b.appendChild(d)}.bind(this));
this.resultsElement.innerHTML="";this.resultsElement.appendChild(b);typeof(PopManager!="undefined")&&PopManager.centerLast()},showPreview:function(a,b,c){a.stop();a=b.up().select(".description").first();if(a!=null)a.visible()?a.hide():a.show();else{c=(new Element("div",{"class":"description"})).update(c.original_body_html);b.up().appendChild(c)}},assignTicket:function(a){this.resultsElement.innerHTML="<p>Assigning your ticket..</p>";this.submitIdElements.each(function(b){b.value=LighthouseTicketSelector.projectId+
"-"+a.number});this.submitForm.submit()},_scriptTag:function(a){var b=document.createElement("script");$(b).writeAttribute("type","text/javascript");$(b).writeAttribute("charset","utf-8");$(b).writeAttribute("src",a);$$("head").first().appendChild(b)}}),MemberInviter=Class.create({createaccountForm:null,loginForm:null,inviteForms:null,inviteOptions:null,backButton:null,initialize:function(a){a=$(a);var b=$("confirmation_form").hide(),c=$("login_form").hide(),d=$("createaccount_form").hide(),e=$("invite_forms").hide(),
f=$("invite_options");this.createAccountForm=d;this.confirmationForm=b;this.loginForm=c;this.inviteForms=e;this.inviteOptions=f;this.backButton=$("back");f.select("a").each(function(g){$(g).observe("click",function(j){switch(this.href.getAnchor()){case "createaccount_form":d.show();break;case "login_form":c.show();break;case "confirmation_form":b.show();break}e.show();f.hide();j.stop()})});$("back").observe("click",function(g){e.hide();f.show();d.hide();b.hide();c.hide();g.stop()})}}),MultiFileWidget=
Class.create({field:null,list:null,listWrapper:null,counter:0,initialize:function(a,b){this.field=$(a);this.list=$(b);this.listWrapper=this.list.up(".files").hide();this.field.observe("change",this.handleFieldChange.bind(this))},handleFieldChange:function(){this.field.value!=""&&this.addFile(this.field.value)},handleRemoveFile:function(a){a&&a.stop();this.removeFile($(a.target).up("li"))},addFile:function(a){a=(new Element("li")).update(a);var b=(new Element("a",{href:"#"})).update("Remove");b.observe("click",
this.handleRemoveFile.bind(this));a.appendChild(b);this.list.appendChild(a);this.listWrapper.show();b=new Element("input",{type:"file",name:"assets[]",id:"assets_"+this.counter});b.observe("change",this.handleFieldChange.bind(this));$(this.field.parentNode).insert({top:b});a.appendChild(this.field.hide().remove());this.field=b;this.counter++},removeFile:function(a){a.remove()}}),SearchPage={init:function(){this.activateToggler()},activateToggler:function(){if(this.toggle=$$(".search-title .toggle")[0]){this.massEditBar=
$("bulk_edit_bar").hide();this.searchResults=$("search_results");this.standardToggle=this.toggle.down(".standalone").addClassName("selected");this.massEditToggle=this.toggle.down(".bulkedit");this.standardToggle.observe("click",function(a){a.stop();this.toStandard()}.bind(this));this.massEditToggle.observe("click",function(a){a.stop();this.toMassEdit()}.bind(this));this.activateAddToQueue();this.activateBigClickArea();this.activateCheckAll();this.massEditing=false;this.toggle.getAttribute("mode")==
"bulk_edit"&&this.toMassEdit()}},toStandard:function(){this.massEditToggle.removeClassName("selected");this.standardToggle.addClassName("selected");this.massEditBar.hide();this.searchResults.removeClassName("mass-editing");this.massEditing=false},toMassEdit:function(){this.massEditToggle.addClassName("selected");this.standardToggle.removeClassName("selected");this.massEditBar.show();this.searchResults.addClassName("mass-editing");this.massEditing=true},activateAddToQueue:function(){this.queueSelect=
this.massEditBar.down(".queue-choice").hide();this.massEditBar.down("select.selected-action").observe("change",function(a){a.element().value.match(/queue/)?this.queueSelect.show():this.queueSelect.hide()}.bind(this))},activateBigClickArea:function(){this.searchResults.select("li").each(function(a){var b=a.down(".check input");b&&b.observe("change",function(){b.checked?a.addClassName("checked"):a.removeClassName("checked")});a.observe("click",function(c){if(this.massEditing){c=c.element();if(c.tagName.toLowerCase()!=
"a")if(c.tagName.toLowerCase()!="input"){if(c.tagName.toLowerCase()!="li")c=c.up("li");if(b){b.checked=!b.checked;b.checked?c.addClassName("checked"):c.removeClassName("checked")}}}}.bind(this));b&&b.checked?a.addClassName("checked"):a.removeClassName("checked")}.bind(this))},activateCheckAll:function(){var a=this.searchResults.select(".check input");$("check_all_checkbox").observe("change",function(b){var c=b.element();a.each(function(d){d.checked=c.checked;d.checked?d.up("li").addClassName("checked"):
d.up("li").removeClassName("checked")})})}},StickyQueue=Class.create({url:null,request:null,data:null,queue_id:null,toggle:null,initialize:function(a){if(Tender.logged_in){this.url=a;this.toggle=this.createToggle();this.toggle.observe("click",this.handleToggleClick.bind(this));Cookie.set({queueURL:this.url},{path:"/",expires:new Date(2038,1,1)});this.request=new Ajax.Request(this.url,{method:"get",onSuccess:this.handleRequest.bind(this),onFailure:this.handleFailure.bind(this)})}},handleRequest:function(a){this.data=
a.responseJSON;this.queue_id=this.data.id;this.updateToggle()},handleFailure:function(){$("header").down(".sticky_queue .toggle").update("Error Loading Queue")},createToggle:function(){$$("#header .sticky_queue").each(Element.remove);var a=new Element("div",{"class":"sticky_queue"}),b=(new Element("span",{"class":"remove-toggle"})).update("Remove");b.observe("click",function(){StickyQueue.unstick()});a.insert(b);b=new Element("span",{"class":"toggle"});b.update("<strong>Loading Queue...</strong>");
a.insert(b);$("header").insert({top:a});return b},updateToggle:function(){this.toggle.update("<strong>"+this.data.name+":</strong> "+this.data.discussions.length+(this.data.discussions.length==1?" Issue":" Issues"))},handleToggleClick:function(){this.showQueueBox()},showQueueBox:function(){if(this.queueBox==null)this.queueBox=this.createQueueBox();PopManager.createPop(this.queueBox,{modal:false,positionMode:"fixed"});this.toggle.hide()},hideQueueBox:function(){this.toggle.show()},createQueueBox:function(){var a=
new Element("div"),b=(new Element("h1")).update(this.data.name+" <em>("+this.data.discussions.length+")</em>"),c=new Element("div",{"class":"rule"}),d=new Element("ul",{"class":"stickyqueue"});this.data.discussions.each(function(e){var f=e.title.escapeHTML(),g=new Element("li",{"class":"unread"});f=(new Element("h4")).update('<a href="'+e.link+'">'+f+"</a>");e=(new Element("p",{"class":"meta"})).update("Updated by "+e.last_user_name);g.insert(f);g.insert(e);d.insert(g)});a.insert(b);a.insert(c);a.insert(d);
a=new StickyQueueBox(a);a.options.onClose=this.hideQueueBox.bind(this);return a},clear:function(){this.toggle.remove();PopManager.removePop(this.queueBox)}});StickyQueue.activeQueue=null;StickyQueue.stick=function(a){this.activeQueue&&this.activeQueue.clear();this.activeQueue=new StickyQueue(a)};StickyQueue.unstick=function(){$("header").down(".sticky_queue").remove();Cookie.erase("queueURL");this.activeQueue=null};StickyQueue.activateRemembered=function(){var a=Cookie.get("queueURL");a!=null&&StickyQueue.stick(a)};
var StickyQueueBox=Class.create(PopBox,{initialize:function($super,b){$super(b);this.element.addClassName("sticky-queue-box")}}),WatcherWidget=Class.create({initialize:function(a){this.container=a;this.watcherForm=$("add-watcher-form");this.emailField=$("wemail");this.subscribeBtn=$("btn-subscribe");this.anonSubscribeBtn=$("btn-notify");this.watcherCount=this.container.down(".bignum");this.anonList=$("anon-list");this.emptyItem=$("empty-item");this.loader=new Element("img",{src:"/images/ajax-loader.gif",
className:"loader"});this.subscribeBtn&&this.subscribeBtn.observe("click",this.onSubscribeBtnClick.bind(this));this.anonSubscribeBtn&&this.anonSubscribeBtn.observe("click",this.onAnonSubscribeBtnClick.bind(this));this.watcherCount.up("a")&&this.watcherCount.up("a").observe("click",this.onWatchersPopupShow.bind(this));this.watcherForm&&this.watcherForm.observe("submit",this.onWatcherFormSubmit.bind(this))},onSubscribeBtnClick:function(a){a.stop();a=a.element();new Ajax.Request(a.up("form").readAttribute("action"),
{method:"post",parameters:{authenticity_token:getAuthKey()},onCreate:this.onSubscriptionStart.bind(this),onComplete:this.onSubscriptionComplete.bind(this),onError:this.onSubscriptionError.bind(this)})},onSubscriptionStart:function(){this.subscribeBtn.insert(this.loader)},onSubscriptionComplete:function(){this.loader.remove();var a=Number(this.watcherCount.innerHTML),b=this.subscribeBtn;if(b.hasClassName("watch")){a+=1;b.update("Unsubscribe from Updates");b.replaceClassName("watch","unwatch")}else{a-=
1;b.update("Subscribe to Updates");b.replaceClassName("unwatch","watch")}this.watcherCount.update(a)},onSubscriptionError:function(a){console.log("ERROR");console.log(a)},onAnonSubscribeBtnClick:function(a){a.stop();a=a.element().up("form");new Ajax.Request(a.readAttribute("action"),{method:"post",parameters:a.serialize(),onCreate:this.onAnonSubscriptionStart.bind(this),onComplete:this.onAnonSubscriptionComplete.bind(this),onError:this.onSubscriptionError.bind(this)})},onAnonSubscriptionStart:function(){var a=
this.emptyItem.readAttribute("id"),b=this.emptyItem.classNames();a=(new Element("li",{id:a,className:b})).update("<p> Adding Watcher...</p>");a.down("p").insert({top:this.loader});b=this.emptyItem.up("ul");this.emptyItem.remove();b.insert(a)},onAnonSubscriptionComplete:function(){this.anonList.down("li").remove();this.anonList.insert(this.emptyItem);var a=Number(this.watcherCount.innerHTML);this.watcherCount.update(++a)},onWatcherFormSubmit:function(a){a.stop();a=a.element();var b=$H({watcher:$F(this.emailField),
authenticity_token:getAuthKey()});new Ajax.Request(a.readAttribute("action"),{method:"post",parameters:b,onComplete:function(){}})},onWatchersPopupShow:function(a){a.stop();var b=a.element();if(b.tagName.toLowerCase()!="a")b=a.findElement("a");a=b.readAttribute("href");var c=Builder.node("div");c.innerHTML="<h1>Loading...</h1>";b=new PopBox(c);PopManager.createPop(b);new Ajax.Request(a,{method:"get",parameters:{authenticity_token:getAuthKey()},onComplete:function(d){c.innerHTML=d.responseText}})}});
document.observe("dom:loaded",function(){var a=$$(".watcher-widget").first();a&&new WatcherWidget(a)});
var globalTriggers=function(){Tabs.autoActivate();DateFormat.autoParse();$$(".requires-js").each(function(b){b.removeClassName("requires-js")});if(window.location.hash&&$$(window.location.hash)){var a=$$(window.location.hash)[0];a&&a.highlight&&a.highlight()}},Placeholder=Class.create({initialize:function(a){if(!(a.getAttribute("placeholder")==""||a.getAttribute("placeholder")==null)){a.onfocus=function(){if(this.value==this.getAttribute("placeholder")){this.value="";$(this).removeClassName("placeholder")}};
a.onblur=function(){if(this.value==""){this.value=this.getAttribute("placeholder");$(this).addClassName("placeholder")}};if(a.value==""||a.value==a.getAttribute("placeholder")){a.value=a.getAttribute("placeholder");$(a).addClassName("placeholder")}}}}),rules={"#wrapper":function(){StickyQueue.activateRemembered();SearchPage.init();globalTriggers()},"#user_company_name":function(a){a.onfocus=function(){$("user_company_list_button").show()};a.onblur=function(){$("user_company_list_button").hide()};
new Autocompleter.Local("user_company_name","user_company_list",Tender.company_list,{minChars:0})},"#edit-company-info":function(a){var b=$("edit-company").innerHTML;$("edit-company").remove();$(a).observe("click",function(c){c.stop();c=Builder.node("div");c.innerHTML=b;c=new PopBox(c);PopManager.createPop(c)})},"#invite-company":function(a){var b=$("invite-form");b.hide();$(a).observe("click",function(c){c.stop();c=new PopBox(b);PopManager.createPop(c);b.show()})},"ul.tab-activated":function(a){new Tabs(a)},
"a.toggler":function(a){var b=$(a.getAttribute("toggle"));a.observe("click",function(c){c.stop();b.toggle()})},"input#add_watchers":function(a){a.observe("click",function(){if(a.checked){var b=$("discussion_private");b&&b.checked==false&&b.click()}})},"input#comment_internal":function(a){var b=function(){$(a).checked?$("discussion-reply-form").addClassName("internal"):$("discussion-reply-form").removeClassName("internal")};$(a).observe("click",b);b()},"input#discussion_private":function(a){var b=
function(){$(a).checked?$("new_discussion").up(".new-issue-form").addClassName("internal"):$("new_discussion").up(".new-issue-form").removeClassName("internal")};$(a).observe("click",b);b()},".watchers-toggle":function(a){var b=a.down("input.optional-toggle"),c=a.down(".watchers-toggle-content"),d=c.down("input.textfield");b.observe("click",function(){if(b.checked){c.show();d.focus();a.addClassName("selected")}else{c.hide();d.value="";a.removeClassName("selected")}})},".discussion-form":function(a){a.down(".fields:last-child").addClassName("last-child")},
"#member_invite":function(a){new MemberInviter(a)},".word_stats":function(a){new WordStats(a)},"a.popbox":function(a){$(a.observe("click",function(b){b.stop();Ajax.activeRequestCount==0&&new Ajax.Request(this.href,{method:"get",onComplete:function(c){c.responseText.evalScripts();var d=Builder.node("div");d.innerHTML=c.responseText;c=new PopBox(d);PopManager.createPop(c);if(a.hasClassName("split")){c=$("discussion_title");c.setAttribute("placeholder",c.value);new Placeholder(c)}},evalScripts:false})}))},
input:function(a){new Placeholder(a)},"dl.form":function(a){if(!(a.getAttribute("maxlength")==""||a.getAttribute("maxlength")==null)){var b=a.down("textarea"),c=a.down("p.validate-note"),d=a.getAttribute("maxlength");b.observe("keyup",function(){var e=b.value.length;if(e>d){c.setStyle({color:"#ff0000"});c.show();b.value=b.value.substring(0,d)}else if(e>d*0.9){c.setStyle({color:""});c.show()}else{c.hide();c.setStyle({color:""})}})}},".lighthouse-selector":function(a){LighthouseTicketSelector.instance=
new LighthouseTicketSelector(a)},".faq-selector":function(a){faqselect=new FAQSelector(a)},".domainsetup":function(a){$(a).down(".availability").hide()},"div.alert":function(a){a=$(a);var b=Cookie.get("hiddenAnnouncements");b=b==null?[]:b.split(",");b.indexOf(a.id)!=-1&&a.hide();a.down("a.close").observe("click",function(c){c&&c.stop();b.push(a.id);Cookie.set({hiddenAnnouncements:b.join(",")},{path:"/",expires:new Date(2038,1,1)});a.hide()})},"a.form-partial-toggle":function(a){var b=$(a.getAttribute("href").getAnchor());
if(b!=null){b.hide();$(a).observe("click",function(c){c&&c.stop();b.toggle()})}},"#new-discussion-category-dropdown":function(a){if($("new-discussion-form")){var b=function(c){var d=$("new-discussion-form");c.options[c.selectedIndex].text.match(/\[private\]$/)?d.addClassName("private-category-form"):d.removeClassName("private-category-form")};b(a);$(a).observe("change",function(){b(this)})}},"form.ticketCreation":function(a){var b=$("ticket_title"),c=$("ticket_body"),d=$$("h1")[0].innerHTML.replace("<strong>Subject:</strong> ",
"");b.value="Via Tender: "+d;c.value="As reported in Tender:\n\n<blockquote>"+$$(".original-post")[0].down("div").next("div").innerHTML+"</blockquote>";a.onsubmit=function(){var e=b.value,f=c.value;if(e==null||e==""){alert("Oops! You need to fill out the title");return false}if(f==null||f==""){alert("Oops! You need to fill out the body");return false}return true}},"a.preview-link":function(a){$(a).observe("click",function(b){b&&b.stop();b=$(a.getAttribute("preview")).value;new Ajax.Request(this.href,
{method:"post",parameters:{authenticity_token:getAuthKey(),body:b},onComplete:function(c){c.responseText.evalScripts();var d=Builder.node("div");d.innerHTML=c.responseText;c=new PopBox(d);PopManager.createPop(c)},evalScripts:false})})},".attach_files":function(a){var b=$(a).down("input[type=file]");a=$(a).down("ul.filelist");new MultiFileWidget(b,a)},".editable_by_current_user":function(a){!Tender.is_supporter&&Tender.logged_in&&Tender.discussion_editable&&a.toggle()},".admin-functions":function(a){if(!(Tender.is_supporter||
!Tender.logged_in)){var b=a.id.match(/^admin\_functions_user\-(\d+)\_comment\_/);b&&b[1]==Tender.user_id.toString()&&a.toggle()}},".admin-functions ul.actions ul":function(a){var b=$(a).hide();b.previous("a").observe("click",function(c){c.stop();b.toggle()})},".admin-functions ul.actions ul.queues a":function(a){var b=$(a);b.observe("click",function(c){c.stop();DiscussionAction.ToggleQueue(a)});b.next(".sticky").observe("click",function(){StickyQueue.stick(this.getAttribute("json"))})},".admin-functions ul.actions li.acknowledge a":function(a){$(a).observe("click",
function(b){b.stop();new DiscussionAction.AcknowledgeUpdate(a)})},"#check-email":function(a){$(a).observe("click",function(b){b.stop();$$(".flash-error").invoke("hide");a.hide();$("apply-flash").hide();$("check-email-loading").show();a.form.onsubmit()})},".toggle-private-public":function(a){var b=$("private-or-public"),c=false,d=function(){b.hasClassName("public")?b.removeClassName("public").addClassName("private"):b.removeClassName("private").addClassName("public");$("toggle_access_loader").remove();
c=false};a.observe("click",function(e){e&&e.stop();if(!c){c=true;e=(new Element("p",{"class":"loading",id:"toggle_access_loader"})).update("Toggling discussion&hellip;");b.appendChild(e);new Ajax.Request(a.href,{method:"post",parameters:{authenticity_token:getAuthKey()},onComplete:d})}})},"#for-public-form":function(a){a.hide();$("for-public-link").show()},"#for-private-form":function(a){a.hide();$("for-private-link").show()},".ajaxpop":function(a){a.observe("click",function(b){b.stop();b=a.readAttribute("href");
PopManager.ajaxCreate(b,{parameters:{authenticity_token:getAuthKey()}})})},"#faqsections":function(a){a.select("li.faqitem").each(function(b,c){c+=1;c%2!=0&&c!=0&&b.addClassName("odd")})}};Behavior.register(rules);(function(){var a=(new Date).getTimezoneOffset();Cookie.set({tzoffset:a})})();String.prototype.getAnchor=function(){return/#([a-z][\w.:-]*)$/i.exec(this)[1]};
var HistoryManager={callbacks:{},addStateCallback:function(a,b){this.callbacks[document.location.hash]=a;this._changeLocation(b)},listen:function(){var a=document.location.hash;a!=this.currentPath&&HistoryManager.goTo(a)},goTo:function(a){this.callbacks[a]&&this.callbacks[a]()},_changeLocation:function(a){this.currentPath=a;document.location.hash=a}};setInterval(HistoryManager.listen,100);
