var Prototype={Version:"1.6.1",Browser:(function(){var c=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:c.indexOf("AppleWebKit/")>-1,Gecko:c.indexOf("Gecko")>-1&&c.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(c)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var e=document.createElement("div");var c=document.createElement("form");var a=false;if(e.__proto__&&(e.__proto__!==c.__proto__)){a=true}e=c=null;return a})()},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 Abstract={};var Try={these:function(){var f;for(var c=0,g=arguments.length;c<g;c++){var a=arguments[c];try{f=a();break}catch(h){}}return f}};var Class=(function(){function a(){}function c(){var j=null,h=$A(arguments);if(Object.isFunction(h[0])){j=h.shift()}function f(){this.initialize.apply(this,arguments)}Object.extend(f,Class.Methods);f.superclass=j;f.subclasses=[];if(j){a.prototype=j.prototype;f.prototype=new a;j.subclasses.push(f)}for(var g=0;g<h.length;g++){f.addMethods(h[g])}if(!f.prototype.initialize){f.prototype.initialize=Prototype.emptyFunction}f.prototype.constructor=f;return f}function e(n){var h=this.superclass&&this.superclass.prototype;var g=Object.keys(n);if(!Object.keys({toString:true}).length){if(n.toString!=Object.prototype.toString){g.push("toString")}if(n.valueOf!=Object.prototype.valueOf){g.push("valueOf")}}for(var f=0,j=g.length;f<j;f++){var m=g[f],l=n[m];if(h&&Object.isFunction(l)&&l.argumentNames().first()=="$super"){var o=l;l=(function(p){return function(){return h[p].apply(this,arguments)}})(m).wrap(o);l.valueOf=o.valueOf.bind(o);l.toString=o.toString.bind(o)}this.prototype[m]=l}return this}return{create:c,Methods:{addMethods:e}}})();(function(){var f=Object.prototype.toString;function m(w,y){for(var x in y){w[x]=y[x]}return w}function p(w){try{if(g(w)){return"undefined"}if(w===null){return"null"}return w.inspect?w.inspect():String(w)}catch(x){if(x instanceof RangeError){return"..."}throw x}}function o(w){var y=typeof w;switch(y){case"undefined":case"function":case"unknown":return;case"boolean":return w.toString()}if(w===null){return"null"}if(w.toJSON){return w.toJSON()}if(l(w)){return}var x=[];for(var A in w){var z=o(w[A]);if(!g(z)){x.push(A.toJSON()+": "+z)}}return"{"+x.join(", ")+"}"}function e(w){return $H(w).toQueryString()}function h(w){return w&&w.toHTML?w.toHTML():String.interpret(w)}function u(w){var x=[];for(var y in w){x.push(y)}return x}function q(w){var x=[];for(var y in w){x.push(w[y])}return x}function n(w){return m({},w)}function l(w){return !!(w&&w.nodeType==1)}function j(w){return f.call(w)=="[object Array]"}function v(w){return w instanceof Hash}function c(w){return typeof w==="function"}function a(w){return f.call(w)=="[object String]"}function r(w){return f.call(w)=="[object Number]"}function g(w){return typeof w==="undefined"}m(Object,{extend:m,inspect:p,toJSON:o,toQueryString:e,toHTML:h,keys:u,values:q,clone:n,isElement:l,isArray:j,isHash:v,isFunction:c,isString:a,isNumber:r,isUndefined:g})})();Object.extend(Function.prototype,(function(){var o=Array.prototype.slice;function f(u,p){var r=u.length,q=p.length;while(q--){u[r+q]=p[q]}return u}function m(q,p){q=o.call(q,0);return f(q,p)}function j(){var p=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return p.length==1&&!p[0]?[]:p}function l(r){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var p=this,q=o.call(arguments,1);return function(){var u=m(q,arguments);return p.apply(r,u)}}function h(r){var p=this,q=o.call(arguments,1);return function(v){var u=f([v||window.event],q);return p.apply(r,u)}}function n(){if(!arguments.length){return this}var p=this,q=o.call(arguments,0);return function(){var r=m(q,arguments);return p.apply(this,r)}}function g(r){var p=this,q=o.call(arguments,1);r=r*1000;return window.setTimeout(function(){return p.apply(p,q)},r)}function a(){var p=f([0.01],arguments);return this.delay.apply(this,p)}function e(q){var p=this;return function(){var r=f([p.bind(this)],arguments);return q.apply(this,r)}}function c(){if(this._methodized){return this._methodized}var p=this;return this._methodized=function(){var q=f([this],arguments);return p.apply(null,q)}}return{argumentNames:j,bind:l,bindAsEventListener:h,curry:n,delay:g,defer:a,wrap:e,methodize:c}})());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"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(c,a){this.callback=c;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,c){this.template=a.toString();this.pattern=c||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(f){if(a==null){return(f[1]+"")}var h=f[1]||"";if(h=="\\"){return f[2]}var c=a,j=f[3];var g=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;f=g.exec(j);if(f==null){return h}while(f!=null){var e=f[1].startsWith("[")?f[2].replace(/\\\\]/g,"]"):f[1];c=c[e];if(null==c||""==f[3]){break}j=j.substring("["==f[3]?f[1].length:f[0].length);f=g.exec(j)}return h+String.interpret(c)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function e(E,D){var C=0;try{this._each(function(G){E.call(D,G,C++)})}catch(F){if(F!=$break){throw F}}return this}function x(F,E,D){var C=-F,G=[],H=this.toArray();if(F<1){return H}while((C+=F)<H.length){G.push(H.slice(C,C+F))}return G.collect(E,D)}function c(E,D){E=E||Prototype.K;var C=true;this.each(function(G,F){C=C&&!!E.call(D,G,F);if(!C){throw $break}});return C}function m(E,D){E=E||Prototype.K;var C=false;this.each(function(G,F){if(C=!!E.call(D,G,F)){throw $break}});return C}function n(E,D){E=E||Prototype.K;var C=[];this.each(function(G,F){C.push(E.call(D,G,F))});return C}function z(E,D){var C;this.each(function(G,F){if(E.call(D,G,F)){C=G;throw $break}});return C}function l(E,D){var C=[];this.each(function(G,F){if(E.call(D,G,F)){C.push(G)}});return C}function j(F,E,D){E=E||Prototype.K;var C=[];if(Object.isString(F)){F=new RegExp(RegExp.escape(F))}this.each(function(H,G){if(F.match(H)){C.push(E.call(D,H,G))}});return C}function a(C){if(Object.isFunction(this.indexOf)){if(this.indexOf(C)!=-1){return true}}var D=false;this.each(function(E){if(E==C){D=true;throw $break}});return D}function w(D,C){C=Object.isUndefined(C)?null:C;return this.eachSlice(D,function(E){while(E.length<D){E.push(C)}return E})}function p(C,E,D){this.each(function(G,F){C=E.call(D,C,G,F)});return C}function B(D){var C=$A(arguments).slice(1);return this.map(function(E){return E[D].apply(E,C)})}function v(E,D){E=E||Prototype.K;var C;this.each(function(G,F){G=E.call(D,G,F);if(C==null||G>=C){C=G}});return C}function r(E,D){E=E||Prototype.K;var C;this.each(function(G,F){G=E.call(D,G,F);if(C==null||G<C){C=G}});return C}function g(F,D){F=F||Prototype.K;var E=[],C=[];this.each(function(H,G){(F.call(D,H,G)?E:C).push(H)});return[E,C]}function h(D){var C=[];this.each(function(E){C.push(E[D])});return C}function f(E,D){var C=[];this.each(function(G,F){if(!E.call(D,G,F)){C.push(G)}});return C}function q(D,C){return this.map(function(F,E){return{value:F,criteria:D.call(C,F,E)}}).sort(function(H,G){var F=H.criteria,E=G.criteria;return F<E?-1:F>E?1:0}).pluck("value")}function u(){return this.map()}function y(){var D=Prototype.K,C=$A(arguments);if(Object.isFunction(C.last())){D=C.pop()}var E=[this].concat(C).map($A);return this.map(function(G,F){return D(E.pluck(F))})}function o(){return this.toArray().length}function A(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:e,eachSlice:x,all:c,every:c,any:m,some:m,collect:n,map:n,detect:z,findAll:l,select:l,filter:l,grep:j,include:a,member:a,inGroupsOf:w,inject:p,invoke:B,max:v,min:r,partition:g,pluck:h,reject:f,sortBy:q,toArray:u,entries:u,zip:y,size:o,inspect:A,find:z}})();function $A(e){if(!e){return[]}if("toArray" in Object(e)){return e.toArray()}var c=e.length||0,a=new Array(c);while(c--){a[c]=e[c]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var y=Array.prototype,q=y.slice,u=y.forEach;function c(C){for(var B=0,D=this.length;B<D;B++){C(this[B])}}if(!u){u=c}function p(){this.length=0;return this}function f(){return this[0]}function j(){return this[this.length-1]}function m(){return this.select(function(B){return B!=null})}function A(){return this.inject([],function(C,B){if(Object.isArray(B)){return C.concat(B.flatten())}C.push(B);return C})}function l(){var B=q.call(arguments,0);return this.select(function(C){return !B.include(C)})}function h(B){return(B!==false?this:this.toArray())._reverse()}function o(B){return this.inject([],function(E,D,C){if(0==C||(B?E.last()!=D:!E.include(D))){E.push(D)}return E})}function v(B){return this.uniq().findAll(function(C){return B.detect(function(D){return C===D})})}function w(){return q.call(this,0)}function n(){return this.length}function z(){return"["+this.map(Object.inspect).join(", ")+"]"}function x(){var B=[];this.each(function(C){var D=Object.toJSON(C);if(!Object.isUndefined(D)){B.push(D)}});return"["+B.join(", ")+"]"}function a(D,B){B||(B=0);var C=this.length;if(B<0){B=C+B}for(;B<C;B++){if(this[B]===D){return B}}return -1}function r(C,B){B=isNaN(B)?this.length:(B<0?this.length+B:B)+1;var D=this.slice(0,B).reverse().indexOf(C);return(D<0)?D:B-D-1}function e(){var G=q.call(this,0),E;for(var C=0,D=arguments.length;C<D;C++){E=arguments[C];if(Object.isArray(E)&&!("callee" in E)){for(var B=0,F=E.length;B<F;B++){G.push(E[B])}}else{G.push(E)}}return G}Object.extend(y,Enumerable);if(!y._reverse){y._reverse=y.reverse}Object.extend(y,{_each:u,clear:p,first:f,last:j,compact:m,flatten:A,without:l,reverse:h,uniq:o,intersect:v,clone:w,toArray:w,size:n,inspect:z,toJSON:x});var g=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(g){y.concat=e}if(!y.indexOf){y.indexOf=a}if(!y.lastIndexOf){y.lastIndexOf=r}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function g(w){this._object=Object.isHash(w)?w.toObject():Object.clone(w)}function h(x){for(var w in this._object){var y=this._object[w],z=[w,y];z.key=w;z.value=y;x(z)}}function o(w,x){return this._object[w]=x}function e(w){if(this._object[w]!==Object.prototype[w]){return this._object[w]}}function r(w){var x=this._object[w];delete this._object[w];return x}function v(){return Object.clone(this._object)}function u(){return this.pluck("key")}function q(){return this.pluck("value")}function j(x){var w=this.detect(function(y){return y.value===x});return w&&w.key}function m(w){return this.clone().update(w)}function f(w){return new Hash(w).inject(this,function(x,y){x.set(y.key,y.value);return x})}function c(w,x){if(Object.isUndefined(x)){return w}return w+"="+encodeURIComponent(String.interpret(x))}function a(){return this.inject([],function(y,z){var x=encodeURIComponent(z.key),w=z.value;if(w&&typeof w=="object"){if(Object.isArray(w)){return y.concat(w.map(c.curry(x)))}}else{y.push(c(x,w))}return y}).join("&")}function p(){return"#<Hash:{"+this.map(function(w){return w.map(Object.inspect).join(": ")}).join(", ")+"}>"}function n(){return Object.toJSON(this.toObject())}function l(){return new Hash(this)}return{initialize:g,_each:h,set:o,get:e,unset:r,toObject:v,toTemplateReplacements:v,keys:u,values:q,index:j,merge:m,update:f,toQueryString:a,inspect:p,toJSON:n,clone:l}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function f(){return this.toPaddedString(2,16)}function g(){return this+1}function a(o,n){$R(0,this,true).each(o,n);return this}function c(p,o){var n=this.toString(o||10);return"0".times(p-n.length)+n}function h(){return isFinite(this)?this.toString():"null"}function m(){return Math.abs(this)}function l(){return Math.round(this)}function j(){return Math.ceil(this)}function e(){return Math.floor(this)}return{toColorPart:f,succ:g,times:a,toPaddedString:c,toJSON:h,abs:m,round:l,ceil:j,floor:e}})());function $R(e,a,c){return new ObjectRange(e,a,c)}var ObjectRange=Class.create(Enumerable,(function(){function c(h,f,g){this.start=h;this.end=f;this.exclusive=g}function e(f){var g=this.start;while(this.include(g)){f(g);g=g.succ()}}function a(f){if(f<this.start){return false}if(this.exclusive){return f<this.end}return f<=this.end}return{initialize:c,_each:e,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(f,c,e,a){this.each(function(g){if(Object.isFunction(g[f])){try{g[f].apply(g,[c,e,a])}catch(h){}}})}};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,c,a){$super(a);this.transport=Ajax.getTransport();this.request(c)},request:function(c){this.url=c;this.method=this.options.method;var g=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){g._method=this.method;this.method="post"}this.parameters=g;if(g=Object.toQueryString(g)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+g}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){g+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||g):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(f){this.dispatchException(f)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var g={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){g["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){g.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var e=this.options.requestHeaders;if(Object.isFunction(e.push)){for(var c=0,f=e.length;c<f;c+=2){g[e[c]]=e[c+1]}}else{$H(e).each(function(h){g[h.key]=h.value})}}for(var a in g){this.transport.setRequestHeader(a,g[a])}},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){var f=Ajax.Request.Events[a],c=new Ajax.Response(this);if(f=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(g){this.dispatchException(g)}var h=c.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&h&&h.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+f]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+f,this,c,c.headerJSON)}catch(g){this.dispatchException(g)}if(f=="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(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(e){this.request=e;var f=this.transport=e.transport,a=this.readyState=f.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(f.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var c=f.responseXML;this.responseXML=Object.isUndefined(c)?null:c;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(c){this.request.dispatchException(c)}},_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(c){this.request.dispatchException(c)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,e,c){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};c=Object.clone(c);var f=c.onComplete;c.onComplete=(function(g,h){this.updateContent(g.responseText);if(Object.isFunction(f)){f(g,h)}}).bind(this);$super(e,c)},updateContent:function(f){var e=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){f=f.stripScripts()}if(e=$(e)){if(a.insertion){if(Object.isString(a.insertion)){var c={};c[a.insertion]=f;e.insert(c)}else{a.insertion(e,f)}}else{e.update(f)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,e,c){$super(c);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=e;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 $(c){if(arguments.length>1){for(var a=0,f=[],e=arguments.length;a<e;a++){f.push($(arguments[a]))}return f}if(Object.isString(c)){c=document.getElementById(c)}return Element.extend(c)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(h,a){var e=[];var g=document.evaluate(h,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var c=0,f=g.snapshotLength;c<f;c++){e.push(Element.extend(g.snapshotItem(c)))}return e}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(e){var c=(function(){var h=document.createElement("form");var g=document.createElement("input");var f=document.documentElement;g.setAttribute("name","test");h.appendChild(g);f.appendChild(h);var j=h.elements?(typeof h.elements.test=="undefined"):null;f.removeChild(h);h=g=null;return j})();var a=e.Element;e.Element=function(h,g){g=g||{};h=h.toLowerCase();var f=Element.cache;if(c&&g.name){h="<"+h+' name="'+g.name+'">';delete g.name;return Element.writeAttribute(document.createElement(h),g)}if(!f[h]){f[h]=Element.extend(document.createElement(h))}return Element.writeAttribute(f[h].cloneNode(false),g)};Object.extend(e.Element,a||{});if(a){e.Element.prototype=a.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var c=(function(){var g=document.createElement("select"),h=true;g.innerHTML='<option value="test">test</option>';if(g.options&&g.options[0]){h=g.options[0].nodeName.toUpperCase()!=="OPTION"}g=null;return h})();var a=(function(){try{var g=document.createElement("table");if(g&&g.tBodies){g.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var j=typeof g.tBodies[0]=="undefined";g=null;return j}}catch(h){return true}})();var f=(function(){var g=document.createElement("script"),j=false;try{g.appendChild(document.createTextNode(""));j=!g.firstChild||g.firstChild&&g.firstChild.nodeType!==3}catch(h){j=true}g=null;return j})();function e(h,j){h=$(h);if(j&&j.toElement){j=j.toElement()}if(Object.isElement(j)){return h.update().insert(j)}j=Object.toHTML(j);var g=h.tagName.toUpperCase();if(g==="SCRIPT"&&f){h.text=j;return h}if(c||a){if(g in Element._insertionTranslations.tags){while(h.firstChild){h.removeChild(h.firstChild)}Element._getContentFromAnonymousElement(g,j.stripScripts()).each(function(l){h.appendChild(l)})}else{h.innerHTML=j.stripScripts()}}else{h.innerHTML=j.stripScripts()}j.evalScripts.bind(j).defer();return h}return e})(),replace:function(c,e){c=$(c);if(e&&e.toElement){e=e.toElement()}else{if(!Object.isElement(e)){e=Object.toHTML(e);var a=c.ownerDocument.createRange();a.selectNode(c);e.evalScripts.bind(e).defer();e=a.createContextualFragment(e.stripScripts())}}c.parentNode.replaceChild(e,c);return c},insert:function(e,g){e=$(e);if(Object.isString(g)||Object.isNumber(g)||Object.isElement(g)||(g&&(g.toElement||g.toHTML))){g={bottom:g}}var f,h,c,j;for(var a in g){f=g[a];a=a.toLowerCase();h=Element._insertionTranslations[a];if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){h(e,f);continue}f=Object.toHTML(f);c=((a=="before"||a=="after")?e.parentNode:e).tagName.toUpperCase();j=Element._getContentFromAnonymousElement(c,f.stripScripts());if(a=="top"||a=="after"){j.reverse()}j.each(h.curry(e));f.evalScripts.bind(f).defer()}return e},wrap:function(c,e,a){c=$(c);if(Object.isElement(e)){$(e).writeAttribute(a||{})}else{if(Object.isString(e)){e=new Element(e,a)}else{e=new Element("div",e)}}if(c.parentNode){c.parentNode.replaceChild(e,c)}e.appendChild(c);return e},inspect:function(c){c=$(c);var a="<"+c.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(h){var g=h.first(),e=h.last();var f=(c[g]||"").toString();if(f){a+=" "+e+"="+f.inspect(true)}});return a+">"},recursivelyCollect:function(a,e){a=$(a);var c=[];while(a=a[e]){if(a.nodeType==1){c.push(Element.extend(a))}}return c},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(c,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(c))},up:function(c,f,a){c=$(c);if(arguments.length==1){return $(c.parentNode)}var e=Element.ancestors(c);return Object.isNumber(f)?e[f]:Selector.findElement(e,f,a)},down:function(c,e,a){c=$(c);if(arguments.length==1){return Element.firstDescendant(c)}return Object.isNumber(e)?Element.descendants(c)[e]:Element.select(c,e)[a||0]},previous:function(c,f,a){c=$(c);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(c))}var e=Element.previousSiblings(c);return Object.isNumber(f)?e[f]:Selector.findElement(e,f,a)},next:function(e,f,c){e=$(e);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(e))}var a=Element.nextSiblings(e);return Object.isNumber(f)?a[f]:Selector.findElement(a,f,c)},select:function(c){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(c,a)},adjacent:function(c){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(c.parentNode,a).without(c)},identify:function(a){a=$(a);var c=Element.readAttribute(a,"id");if(c){return c}do{c="anonymous_element_"+Element.idCounter++}while($(c));Element.writeAttribute(a,"id",c);return c},readAttribute:function(e,a){e=$(e);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[a]){return c.values[a](e,a)}if(c.names[a]){a=c.names[a]}if(a.include(":")){return(!e.attributes||!e.attributes[a])?null:e.attributes[a].value}}return e.getAttribute(a)},writeAttribute:function(g,e,h){g=$(g);var c={},f=Element._attributeTranslations.write;if(typeof e=="object"){c=e}else{c[e]=Object.isUndefined(h)?true:h}for(var a in c){e=f.names[a]||a;h=c[a];if(f.values[a]){e=f.values[a](g,h)}if(h===false||h===null){g.removeAttribute(e)}else{if(h===true){g.setAttribute(e,e)}else{g.setAttribute(e,h)}}}return g},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,c){if(!(a=$(a))){return}var e=a.className;return(e.length>0&&(e==c||new RegExp("(^|\\s)"+c+"(\\s|$)").test(e)))},addClassName:function(a,c){if(!(a=$(a))){return}if(!Element.hasClassName(a,c)){a.className+=(a.className?" ":"")+c}return a},removeClassName:function(a,c){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,c){if(!(a=$(a))){return}return Element[Element.hasClassName(a,c)?"removeClassName":"addClassName"](a,c)},cleanWhitespace:function(c){c=$(c);var e=c.firstChild;while(e){var a=e.nextSibling;if(e.nodeType==3&&!/\S/.test(e.nodeValue)){c.removeChild(e)}e=a}return c},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(c,a){c=$(c),a=$(a);if(c.compareDocumentPosition){return(c.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(c)&&a!==c}while(c=c.parentNode){if(c==a){return true}}return false},scrollTo:function(a){a=$(a);var c=Element.cumulativeOffset(a);window.scrollTo(c[0],c[1]);return a},getStyle:function(c,e){c=$(c);e=e=="float"?"cssFloat":e.camelize();var f=c.style[e];if(!f||f=="auto"){var a=document.defaultView.getComputedStyle(c,null);f=a?a[e]:null}if(e=="opacity"){return f?parseFloat(f):1}return f=="auto"?null:f},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(c,e){c=$(c);var g=c.style,a;if(Object.isString(e)){c.style.cssText+=";"+e;return e.include("opacity")?c.setOpacity(e.match(/opacity:\s*(\d?\.?\d*)/)[1]):c}for(var f in e){if(f=="opacity"){c.setOpacity(e[f])}else{g[(f=="float"||f=="cssFloat")?(Object.isUndefined(g.styleFloat)?"cssFloat":"styleFloat"):f]=e[f]}}return c},setOpacity:function(a,c){a=$(a);a.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;return a},getDimensions:function(e){e=$(e);var j=Element.getStyle(e,"display");if(j!="none"&&j!=null){return{width:e.offsetWidth,height:e.offsetHeight}}var c=e.style;var h=c.visibility;var f=c.position;var a=c.display;c.visibility="hidden";if(f!="fixed"){c.position="absolute"}c.display="block";var l=e.clientWidth;var g=e.clientHeight;c.display=a;c.position=f;c.visibility=h;return{width:l,height:g}},makePositioned:function(a){a=$(a);var c=Element.getStyle(a,"position");if(c=="static"||!c){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(c){var a=0,e=0;do{a+=c.offsetTop||0;e+=c.offsetLeft||0;c=c.offsetParent}while(c);return Element._returnOffset(e,a)},positionedOffset:function(c){var a=0,f=0;do{a+=c.offsetTop||0;f+=c.offsetLeft||0;c=c.offsetParent;if(c){if(c.tagName.toUpperCase()=="BODY"){break}var e=Element.getStyle(c,"position");if(e!=="static"){break}}}while(c);return Element._returnOffset(f,a)},absolutize:function(c){c=$(c);if(Element.getStyle(c,"position")=="absolute"){return c}var f=Element.positionedOffset(c);var h=f[1];var g=f[0];var e=c.clientWidth;var a=c.clientHeight;c._originalLeft=g-parseFloat(c.style.left||0);c._originalTop=h-parseFloat(c.style.top||0);c._originalWidth=c.style.width;c._originalHeight=c.style.height;c.style.position="absolute";c.style.top=h+"px";c.style.left=g+"px";c.style.width=e+"px";c.style.height=a+"px";return c},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a}a.style.position="relative";var e=parseFloat(a.style.top||0)-(a._originalTop||0);var c=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=e+"px";a.style.left=c+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(c){var a=0,e=0;do{a+=c.scrollTop||0;e+=c.scrollLeft||0;c=c.parentNode}while(c);return Element._returnOffset(e,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(f){var a=0,e=0;var c=f;do{a+=c.offsetTop||0;e+=c.offsetLeft||0;if(c.offsetParent==document.body&&Element.getStyle(c,"position")=="absolute"){break}}while(c=c.offsetParent);c=f;do{if(!Prototype.Browser.Opera||(c.tagName&&(c.tagName.toUpperCase()=="BODY"))){a-=c.scrollTop||0;e-=c.scrollLeft||0}}while(c=c.parentNode);return Element._returnOffset(e,a)},clonePosition:function(c,f){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});f=$(f);var g=Element.viewportOffset(f);c=$(c);var h=[0,0];var e=null;if(Element.getStyle(c,"position")=="absolute"){e=Element.getOffsetParent(c);h=Element.viewportOffset(e)}if(e==document.body){h[0]-=document.body.offsetLeft;h[1]-=document.body.offsetTop}if(a.setLeft){c.style.left=(g[0]-h[0]+a.offsetLeft)+"px"}if(a.setTop){c.style.top=(g[1]-h[1]+a.offsetTop)+"px"}if(a.setWidth){c.style.width=f.offsetWidth+"px"}if(a.setHeight){c.style.height=f.offsetHeight+"px"}return c}};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(f,c,e){switch(e){case"left":case"top":case"right":case"bottom":if(f(c,"position")==="static"){return null}case"height":case"width":if(!Element.visible(c)){return null}var g=parseInt(f(c,e),10);if(g!==c["offset"+e.capitalize()]){return g+"px"}var a;if(e==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(g,function(h,j){var l=f(c,j);return l===null?h:h-parseInt(l,10)})+"px";default:return f(c,e)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(e,a,c){if(c==="title"){return a.title}return e(a,c)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(f,c){c=$(c);try{c.offsetParent}catch(h){return $(document.body)}var a=c.getStyle("position");if(a!=="static"){return f(c)}c.setStyle({position:"relative"});var g=f(c);c.setStyle({position:a});return g});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(h,f){f=$(f);try{f.offsetParent}catch(l){return Element._returnOffset(0,0)}var c=f.getStyle("position");if(c!=="static"){return h(f)}var g=f.getOffsetParent();if(g&&g.getStyle("position")==="fixed"){g.setStyle({zoom:1})}f.setStyle({position:"relative"});var j=h(f);f.setStyle({position:c});return j})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(c,a){try{a.offsetParent}catch(f){return Element._returnOffset(0,0)}return c(a)});Element.Methods.getStyle=function(a,c){a=$(a);c=(c=="float"||c=="cssFloat")?"styleFloat":c.camelize();var e=a.style[c];if(!e&&a.currentStyle){e=a.currentStyle[c]}if(c=="opacity"){if(e=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(e[1]){return parseFloat(e[1])/100}}return 1}if(e=="auto"){if((c=="width"||c=="height")&&(a.getStyle("display")!="none")){return a["offset"+c.capitalize()]+"px"}return null}return e};Element.Methods.setOpacity=function(c,g){function h(j){return j.replace(/alpha\([^\)]*\)/gi,"")}c=$(c);var a=c.currentStyle;if((a&&!a.hasLayout)||(!a&&c.style.zoom=="normal")){c.style.zoom=1}var f=c.getStyle("filter"),e=c.style;if(g==1||g===""){(f=h(f))?e.filter=f:e.removeAttribute("filter");return c}else{if(g<0.00001){g=0}}e.filter=h(f)+"alpha(opacity="+(g*100)+")";return c};Element._attributeTranslations=(function(){var c="className";var a="for";var e=document.createElement("div");e.setAttribute(c,"x");if(e.className!=="x"){e.setAttribute("class","x");if(e.className==="x"){c="class"}}e=null;e=document.createElement("label");e.setAttribute(a,"x");if(e.htmlFor!=="x"){e.setAttribute("htmlFor","x");if(e.htmlFor==="x"){a="htmlFor"}}e=null;return{read:{names:{"class":c,className:c,"for":a,htmlFor:a},values:{_getAttr:function(f,g){return f.getAttribute(g)},_getAttr2:function(f,g){return f.getAttribute(g,2)},_getAttrNode:function(f,h){var g=f.getAttributeNode(h);return g?g.value:""},_getEv:(function(){var g=document.createElement("div");g.onclick=Prototype.emptyFunction;var j=g.getAttribute("onclick");var h;if(String(j).indexOf("{")>-1){h=function(f,l){l=f.getAttribute(l);if(!l){return null}l=l.toString();l=l.split("{")[1];l=l.split("}")[0];return l.strip()}}else{if(j===""){h=function(f,l){l=f.getAttribute(l);if(!l){return null}return l.strip()}}}g=null;return h})(),_flag:function(f,g){return $(f).hasAttribute(g)?g:null},style:function(f){return f.style.cssText.toLowerCase()},title:function(f){return f.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,c){a.checked=!!c},style:function(a,c){a.style.cssText=c?c:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,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);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(g){var c=g.getElementsByTagName("*"),f=[];for(var e=0,h;h=c[e];e++){if(h.tagName!=="!"){f.push(h)}}return f}Element.Methods.down=function(e,f,c){e=$(e);if(arguments.length==1){return e.firstDescendant()}return Object.isNumber(f)?a(e)[f]:Element.select(e,f)[c||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,c){a=$(a);a.style.opacity=(c==1)?0.999999:(c==="")?"":(c<0.00001)?0:c;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,c){a=$(a);a.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;if(c==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var g=document.createTextNode(" ");a.appendChild(g);a.removeChild(g)}catch(f){}}}return a};Element.Methods.cumulativeOffset=function(c){var a=0,e=0;do{a+=c.offsetTop||0;e+=c.offsetLeft||0;if(c.offsetParent==document.body){if(Element.getStyle(c,"position")=="absolute"){break}}c=c.offsetParent}while(c);return Element._returnOffset(e,a)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(e,g){e=$(e);if(g&&g.toElement){g=g.toElement()}if(Object.isElement(g)){e.parentNode.replaceChild(g,e);return e}g=Object.toHTML(g);var f=e.parentNode,c=f.tagName.toUpperCase();if(Element._insertionTranslations.tags[c]){var h=e.next();var a=Element._getContentFromAnonymousElement(c,g.stripScripts());f.removeChild(e);if(h){a.each(function(j){f.insertBefore(j,h)})}else{a.each(function(j){f.appendChild(j)})}}else{e.outerHTML=g.stripScripts()}g.evalScripts.bind(g).defer();return e}}Element._returnOffset=function(c,e){var a=[c,e];a.left=c;a.top=e;return a};Element._getContentFromAnonymousElement=function(e,c){var f=new Element("div"),a=Element._insertionTranslations.tags[e];if(a){f.innerHTML=a[0]+c+a[1];a[2].times(function(){f=f.firstChild})}else{f.innerHTML=c}return $A(f.childNodes)};Element._insertionTranslations={before:function(a,c){a.parentNode.insertBefore(c,a)},top:function(a,c){a.insertBefore(c,a.firstChild)},bottom:function(a,c){a.appendChild(c)},after:function(a,c){a.parentNode.insertBefore(c,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(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,e){e=Element._attributeTranslations.has[e]||e;var c=$(a).getAttributeNode(e);return !!(c&&c.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function e(j){if(typeof window.Element!="undefined"){var m=window.Element.prototype;if(m){var o="_"+(Math.random()+"").slice(2);var l=document.createElement(j);m[o]="x";var n=(l[o]!=="x");delete m[o];l=null;return n}}return false}function c(l,j){for(var n in j){var m=j[n];if(Object.isFunction(m)&&!(n in l)){l[n]=m.methodize()}}}var f=e("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(f){return function(l){if(l&&typeof l._extendedByPrototype=="undefined"){var j=l.tagName;if(j&&(/^(?:object|applet|embed)$/i.test(j))){c(l,Element.Methods);c(l,Element.Methods.Simulated);c(l,Element.Methods.ByTag[j.toUpperCase()])}}return l}}return Prototype.K}var a={},g=Element.Methods.ByTag;var h=Object.extend(function(m){if(!m||typeof m._extendedByPrototype!="undefined"||m.nodeType!=1||m==window){return m}var j=Object.clone(a),l=m.tagName.toUpperCase();if(g[l]){Object.extend(j,g[l])}c(m,j);m._extendedByPrototype=Prototype.emptyFunction;return m},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});h.refresh();return h})();Element.hasAttribute=function(a,c){if(a.hasAttribute){return a.hasAttribute(c)}return Element.Methods.Simulated.hasAttribute(a,c)};Element.addMethods=function(e){var m=Prototype.BrowserFeatures,f=Element.Methods.ByTag;if(!e){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 c=e;e=arguments[1]}if(!c){Object.extend(Element.Methods,e||{})}else{if(Object.isArray(c)){c.each(j)}else{j(c)}}function j(o){o=o.toUpperCase();if(!Element.Methods.ByTag[o]){Element.Methods.ByTag[o]={}}Object.extend(Element.Methods.ByTag[o],e)}function a(q,p,o){o=o||false;for(var u in q){var r=q[u];if(!Object.isFunction(r)){continue}if(!o||!(u in p)){p[u]=r.methodize()}}}function g(r){var o;var q={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(q[r]){o="HTML"+q[r]+"Element"}if(window[o]){return window[o]}o="HTML"+r+"Element";if(window[o]){return window[o]}o="HTML"+r.capitalize()+"Element";if(window[o]){return window[o]}var p=document.createElement(r);var u=p.__proto__||p.constructor.prototype;p=null;return u}var l=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(m.ElementExtensions){a(Element.Methods,l);a(Element.Methods.Simulated,l,true)}if(m.SpecificElementExtensions){for(var n in Element.Methods.ByTag){var h=g(n);if(Object.isUndefined(h)){continue}a(f[n],h.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(c){var j=Prototype.Browser,g=document,e,f={};function a(){if(j.WebKit&&!g.evaluate){return document}if(j.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function h(l){if(!e){e=a()}f[l]="client"+l;c["get"+l]=function(){return e[f[l]]};return c["get"+l]()}c.getWidth=h.curry("Width");c.getHeight=h.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(c){if(!(c=$(c))){return}var a;if(c===window){a=0}else{if(typeof c._prototypeUID==="undefined"){c._prototypeUID=[Element.Storage.UID++]}a=c._prototypeUID[0]}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(c,a,e){if(!(c=$(c))){return}if(arguments.length===2){Element.getStorage(c).update(a)}else{Element.getStorage(c).set(a,e)}return c},retrieve:function(e,c,a){if(!(e=$(e))){return}var g=Element.getStorage(e),f=g.get(c);if(Object.isUndefined(f)){g.set(c,a);f=a}return f},clone:function(e,a){if(!(e=$(e))){return}var g=e.cloneNode(a);g._prototypeUID=void 0;if(a){var f=Element.select(g,"*"),c=f.length;while(c--){f[c]._prototypeUID=void 0}}return Element.extend(g)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var a=(function(){var g=false;if(document.evaluate&&window.XPathResult){var f=document.createElement("div");f.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var e=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var c=document.evaluate(e,f,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);g=(c.snapshotLength!==2);f=null}return g})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var c=this.expression;if(Prototype.Browser.WebKit&&(c.include("-of-type")||c.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(c)){return false}if(a){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var l=this.expression,n=Selector.patterns,f=Selector.xpath,j,c,a=n.length,g;if(Selector._cache[l]){this.xpath=Selector._cache[l];return}this.matcher=[".//*"];while(l&&j!=l&&(/\S/).test(l)){j=l;for(var h=0;h<a;h++){g=n[h].name;if(c=l.match(n[h].re)){this.matcher.push(Object.isFunction(f[g])?f[g](c):new Template(f[g]).evaluate(c));l=l.replace(c[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var f=this.expression,c;switch(this.mode){case"selectorsAPI":if(a!==document){var g=a.id,h=$(a).identify();h=h.replace(/([\.:])/g,"\\$1");f="#"+h+" "+f}c=$A(a.querySelectorAll(f)).map(Element.extend);a.id=g;return c;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(o){this.tokens=[];var v=this.expression,a=Selector.patterns,h=Selector.assertions;var c,g,j,u=a.length,f;while(v&&c!==v&&(/\S/).test(v)){c=v;for(var n=0;n<u;n++){g=a[n].re;f=a[n].name;if(j=v.match(g)){if(h[f]){this.tokens.push([f,Object.clone(j)]);v=v.replace(j[0],"")}else{return this.findElements(document).include(o)}}}}var r=true,f,q;for(var n=0,l;l=this.tokens[n];n++){f=l[0],q=l[1];if(!Selector.assertions[f](o,q)){r=false;break}}return r},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var e=document.createElement("div"),a=document.createElement("span");e.id="prototype_test_id";a.className="Test";e.appendChild(a);var c=(e.querySelector("#prototype_test_id .test")!==null);e=a=null;return c})()}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 c=Selector.xpath.pseudos[a[1]];if(!c){return""}if(Object.isFunction(c)){return c(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(h){var n=h[6],f=Selector.patterns,o=Selector.xpath,a,q,l=f.length,c;var g=[];while(n&&a!=n&&(/\S/).test(n)){a=n;for(var j=0;j<l;j++){c=f[j].name;if(h=n.match(f[j].re)){q=Object.isFunction(o[c])?o[c](h):new Template(o[c]).evaluate(h);g.push("("+q.substring(1,q.length-1)+")");n=n.replace(h[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 c=Selector.xpath.pseudos;return c["first-of-type"](a)+c["last-of-type"](a)},nth:function(h,f){var j,l=f[6],e;if(l=="even"){l="2n+0"}if(l=="odd"){l="2n+1"}if(j=l.match(/^(\d+)$/)){return"["+h+"= "+j[1]+"]"}if(j=l.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-"){j[1]=-1}var g=j[1]?Number(j[1]):1;var c=j[2]?Number(j[2]):0;e="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(e).evaluate({fragment:h,a:g,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:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,c){return c[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,c){return Element.hasClassName(a,c[1])},id:function(a,c){return a.id===c[1]},attrPresence:function(a,c){return Element.hasAttribute(a,c[1])},attr:function(c,e){var a=Element.readAttribute(c,e[1]);return a&&Selector.operators[e[2]](a,e[5]||e[6])}},handlers:{concat:function(e,c){for(var f=0,g;g=c[f];f++){e.push(g)}return e},mark:function(a){var f=Prototype.emptyFunction;for(var c=0,e;e=a[c];c++){e._countedByPrototype=f}return a},unmark:(function(){var a=(function(){var c=document.createElement("div"),g=false,f="_countedByPrototype",e="x";c[f]=e;g=(c.getAttribute(f)===e);c=null;return g})();return a?function(c){for(var e=0,f;f=c[e];e++){f.removeAttribute("_countedByPrototype")}return c}:function(c){for(var e=0,f;f=c[e];e++){f._countedByPrototype=void 0}return c}})(),index:function(a,f,l){a._countedByPrototype=Prototype.emptyFunction;if(f){for(var c=a.childNodes,g=c.length-1,e=1;g>=0;g--){var h=c[g];if(h.nodeType==1&&(!l||h._countedByPrototype)){h.nodeIndex=e++}}}else{for(var g=0,e=1,c=a.childNodes;h=c[g];g++){if(h.nodeType==1&&(!l||h._countedByPrototype)){h.nodeIndex=e++}}}},unique:function(c){if(c.length==0){return c}var f=[],g;for(var e=0,a=c.length;e<a;e++){if(typeof(g=c[e])._countedByPrototype=="undefined"){g._countedByPrototype=Prototype.emptyFunction;f.push(Element.extend(g))}}return Selector.handlers.unmark(f)},descendant:function(a){var f=Selector.handlers;for(var e=0,c=[],g;g=a[e];e++){f.concat(c,g.getElementsByTagName("*"))}return c},child:function(a){var g=Selector.handlers;for(var f=0,e=[],l;l=a[f];f++){for(var c=0,m;m=l.childNodes[c];c++){if(m.nodeType==1&&m.tagName!="!"){e.push(m)}}}return e},adjacent:function(a){for(var e=0,c=[],g;g=a[e];e++){var f=this.nextElementSibling(g);if(f){c.push(f)}}return c},laterSibling:function(a){var f=Selector.handlers;for(var e=0,c=[],g;g=a[e];e++){f.concat(c,Element.nextSiblings(g))}return c},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,m,e,c){var n=e.toUpperCase();var g=[],l=Selector.handlers;if(a){if(c){if(c=="descendant"){for(var j=0,f;f=a[j];j++){l.concat(g,f.getElementsByTagName(e))}return g}else{a=this[c](a)}if(e=="*"){return a}}for(var j=0,f;f=a[j];j++){if(f.tagName.toUpperCase()===n){g.push(f)}}return g}else{return m.getElementsByTagName(e)}},id:function(a,o,c,e){var n=$(c),m=Selector.handlers;if(o==document){if(!n){return[]}if(!a){return[n]}}else{if(!o.sourceIndex||o.sourceIndex<1){var a=o.getElementsByTagName("*");for(var g=0,f;f=a[g];g++){if(f.id===c){return[f]}}}}if(a){if(e){if(e=="child"){for(var l=0,f;f=a[l];l++){if(n.parentNode==f){return[n]}}}else{if(e=="descendant"){for(var l=0,f;f=a[l];l++){if(Element.descendantOf(n,f)){return[n]}}}else{if(e=="adjacent"){for(var l=0,f;f=a[l];l++){if(Selector.handlers.previousElementSibling(n)==f){return[n]}}}else{a=m[e](a)}}}}for(var l=0,f;f=a[l];l++){if(f==n){return[n]}}return[]}return(n&&Element.descendantOf(n,o))?[n]:[]},className:function(c,a,e,f){if(c&&f){c=this[f](c)}return Selector.handlers.byClassName(c,a,e)},byClassName:function(e,c,h){if(!e){e=Selector.handlers.descendant([c])}var l=" "+h+" ";for(var g=0,f=[],j,a;j=e[g];g++){a=j.className;if(a.length==0){continue}if(a==h||(" "+a+" ").include(l)){f.push(j)}}return f},attrPresence:function(e,c,a,j){if(!e){e=c.getElementsByTagName("*")}if(e&&j){e=this[j](e)}var g=[];for(var f=0,h;h=e[f];f++){if(Element.hasAttribute(h,a)){g.push(h)}}return g},attr:function(a,m,l,n,e,c){if(!a){a=m.getElementsByTagName("*")}if(a&&c){a=this[c](a)}var o=Selector.operators[e],h=[];for(var g=0,f;f=a[g];g++){var j=Element.readAttribute(f,l);if(j===null){continue}if(o(j,n)){h.push(f)}}return h},pseudo:function(c,e,g,a,f){if(c&&f){c=this[f](c)}if(!c){c=a.getElementsByTagName("*")}return Selector.pseudos[e](c,g,a)}},pseudos:{"first-child":function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(Selector.handlers.previousElementSibling(g)){continue}e.push(g)}return e},"last-child":function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(Selector.handlers.nextElementSibling(g)){continue}e.push(g)}return e},"only-child":function(c,l,a){var g=Selector.handlers;for(var f=0,e=[],j;j=c[f];f++){if(!g.previousElementSibling(j)&&!g.nextElementSibling(j)){e.push(j)}}return e},"nth-child":function(c,e,a){return Selector.pseudos.nth(c,e,a)},"nth-last-child":function(c,e,a){return Selector.pseudos.nth(c,e,a,true)},"nth-of-type":function(c,e,a){return Selector.pseudos.nth(c,e,a,false,true)},"nth-last-of-type":function(c,e,a){return Selector.pseudos.nth(c,e,a,true,true)},"first-of-type":function(c,e,a){return Selector.pseudos.nth(c,"1",a,false,true)},"last-of-type":function(c,e,a){return Selector.pseudos.nth(c,"1",a,true,true)},"only-of-type":function(c,f,a){var e=Selector.pseudos;return e["last-of-type"](e["first-of-type"](c,f,a),f,a)},getIndices:function(e,c,f){if(e==0){return c>0?[c]:[]}return $R(1,f).inject([],function(a,g){if(0==(g-c)%e&&(g-c)/e>=0){a.push(g)}return a})},nth:function(c,w,y,v,f){if(c.length==0){return[]}if(w=="even"){w="2n+0"}if(w=="odd"){w="2n+1"}var u=Selector.handlers,r=[],e=[],n;u.mark(c);for(var q=0,g;g=c[q];q++){if(!g.parentNode._countedByPrototype){u.index(g.parentNode,v,f);e.push(g.parentNode)}}if(w.match(/^\d+$/)){w=Number(w);for(var q=0,g;g=c[q];q++){if(g.nodeIndex==w){r.push(g)}}}else{if(n=w.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(n[1]=="-"){n[1]=-1}var z=n[1]?Number(n[1]):1;var x=n[2]?Number(n[2]):0;var A=Selector.pseudos.getIndices(z,x,c.length);for(var q=0,g,o=A.length;g=c[q];q++){for(var p=0;p<o;p++){if(g.nodeIndex==A[p]){r.push(g)}}}}}u.unmark(c);u.unmark(e);return r},empty:function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(g.tagName=="!"||g.firstChild){continue}e.push(g)}return e},not:function(a,f,o){var l=Selector.handlers,p,e;var n=new Selector(f).findElements(o);l.mark(n);for(var j=0,g=[],c;c=a[j];j++){if(!c._countedByPrototype){g.push(c)}}l.unmark(n);return g},enabled:function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(!g.disabled&&(!g.type||g.type!=="hidden")){e.push(g)}}return e},disabled:function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(g.disabled){e.push(g)}}return e},checked:function(c,h,a){for(var f=0,e=[],g;g=c[f];f++){if(g.checked){e.push(g)}}return e}},operators:{"=":function(c,a){return c==a},"!=":function(c,a){return c!=a},"^=":function(c,a){return c==a||c&&c.startsWith(a)},"$=":function(c,a){return c==a||c&&c.endsWith(a)},"*=":function(c,a){return c==a||c&&c.include(a)},"~=":function(c,a){return(" "+c+" ").include(" "+a+" ")},"|=":function(c,a){return("-"+(c||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(c){var a=[];c.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(e){a.push(e[1].strip())});return a},matchElements:function(j,l){var g=$$(l),f=Selector.handlers;f.mark(g);for(var e=0,c=[],a;a=j[e];e++){if(a._countedByPrototype){c.push(a)}}f.unmark(g);return c},findElement:function(c,e,a){if(Object.isNumber(e)){a=e;e=false}return Selector.matchElements(c,e||"*")[a||0]},findChildElements:function(g,m){m=Selector.split(m.join(","));var f=[],j=Selector.handlers;for(var e=0,c=m.length,a;e<c;e++){a=new Selector(m[e].strip());j.concat(f,a.findElements(g))}return(c>1)?j.unique(f):f}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(e,c){for(var f=0,g;g=c[f];f++){if(g.tagName!=="!"){e.push(g)}}return e}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(j,c){if(typeof c!="object"){c={hash:!!c}}else{if(Object.isUndefined(c.hash)){c.hash=true}}var e,h,a=false,g=c.submit;var f=j.inject({},function(l,m){if(!m.disabled&&m.name){e=m.name;h=$(m).getValue();if(h!=null&&m.type!="file"&&(m.type!="submit"||(!a&&g!==false&&(!g||e==g)&&(a=true)))){if(e in l){if(!Object.isArray(l[e])){l[e]=[l[e]]}l[e].push(h)}else{l[e]=h}}}return l});return c.hash?f:Object.toQueryString(f)}};Form.Methods={serialize:function(c,a){return Form.serializeElements(Form.getElements(c),a)},getElements:function(g){var h=$(g).getElementsByTagName("*"),f,a=[],e=Form.Element.Serializers;for(var c=0;f=h[c];c++){a.push(f)}return a.inject([],function(j,l){if(e[l.tagName.toLowerCase()]){j.push(Element.extend(l))}return j})},getInputs:function(j,e,f){j=$(j);var a=j.getElementsByTagName("input");if(!e&&!f){return $A(a).map(Element.extend)}for(var g=0,l=[],h=a.length;g<h;g++){var c=a[g];if((e&&c.type!=e)||(f&&c.name!=f)){continue}l.push(Element.extend(c))}return l},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(c){var e=$(c).getElements().findAll(function(f){return"hidden"!=f.type&&!f.disabled});var a=e.findAll(function(f){return f.hasAttribute("tabIndex")&&f.tabIndex>=0}).sortBy(function(f){return f.tabIndex}).first();return a?a:e.find(function(f){return/^(?:input|select|textarea)$/i.test(f.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(c,a){c=$(c),a=Object.clone(a||{});var f=a.parameters,e=c.readAttribute("action")||"";if(e.blank()){e=window.location.href}a.parameters=c.serialize(true);if(f){if(Object.isString(f)){f=f.toQueryParams()}Object.extend(a.parameters,f)}if(c.hasAttribute("method")&&!a.method){a.method=c.method}return new Ajax.Request(e,a)}};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 c=a.getValue();if(c!=undefined){var e={};e[a.name]=c;return Object.toQueryString(e)}}return""},getValue:function(a){a=$(a);var c=a.tagName.toLowerCase();return Form.Element.Serializers[c](a)},setValue:function(a,c){a=$(a);var e=a.tagName.toLowerCase();Form.Element.Serializers[e](a,c);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)$/i.test(a.type)))){a.select()}}catch(c){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,c){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,c);default:return Form.Element.Serializers.textarea(a,c)}},inputSelector:function(a,c){if(Object.isUndefined(c)){return a.checked?a.value:null}else{a.checked=!!c}},textarea:function(a,c){if(Object.isUndefined(c)){return a.value}else{a.value=c}},select:function(e,h){if(Object.isUndefined(h)){return this[e.type=="select-one"?"selectOne":"selectMany"](e)}else{var c,f,j=!Object.isArray(h);for(var a=0,g=e.length;a<g;a++){c=e.options[a];f=this.optionValue(c);if(j){if(f==h){c.selected=true;return}}else{c.selected=h.include(f)}}}},selectOne:function(c){var a=c.selectedIndex;return a>=0?this.optionValue(c.options[a]):null},selectMany:function(f){var a,g=f.length;if(!g){return null}for(var e=0,a=[];e<g;e++){var c=f.options[e];if(c.selected){a.push(this.optionValue(c))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,c,e){$super(e,c);this.element=$(a);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,c){this.element=$(a);this.callback=c;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var B={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:{}};var g=document.documentElement;var C="onmouseenter" in g&&"onmouseleave" in g;var u;if(Prototype.Browser.IE){var l={0:1,1:4,2:2};u=function(E,D){return E.button===l[D]}}else{if(Prototype.Browser.WebKit){u=function(E,D){switch(D){case 0:return E.which==1&&!E.metaKey;case 1:return E.which==1&&E.metaKey;default:return false}}}else{u=function(E,D){return E.which?(E.which===D+1):(E.button===D)}}}function x(D){return u(D,0)}function w(D){return u(D,1)}function o(D){return u(D,2)}function e(F){F=B.extend(F);var E=F.target,D=F.type,G=F.currentTarget;if(G&&G.tagName){if(D==="load"||D==="error"||(D==="click"&&G.tagName.toLowerCase()==="input"&&G.type==="radio")){E=G}}if(E.nodeType==Node.TEXT_NODE){E=E.parentNode}return Element.extend(E)}function q(E,G){var D=B.element(E);if(!G){return D}var F=[D].concat(D.ancestors());return Selector.findElement(F,G,0)}function v(D){return{x:c(D),y:a(D)}}function c(F){var E=document.documentElement,D=document.body||{scrollLeft:0};return F.pageX||(F.clientX+(E.scrollLeft||D.scrollLeft)-(E.clientLeft||0))}function a(F){var E=document.documentElement,D=document.body||{scrollTop:0};return F.pageY||(F.clientY+(E.scrollTop||D.scrollTop)-(E.clientTop||0))}function r(D){B.extend(D);D.preventDefault();D.stopPropagation();D.stopped=true}B.Methods={isLeftClick:x,isMiddleClick:w,isRightClick:o,element:e,findElement:q,pointer:v,pointerX:c,pointerY:a,stop:r};var z=Object.keys(B.Methods).inject({},function(D,E){D[E]=B.Methods[E].methodize();return D});if(Prototype.Browser.IE){function j(E){var D;switch(E.type){case"mouseover":D=E.fromElement;break;case"mouseout":D=E.toElement;break;default:return null}return Element.extend(D)}Object.extend(z,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});B.extend=function(E,D){if(!E){return false}if(E._extendedByPrototype){return E}E._extendedByPrototype=Prototype.emptyFunction;var F=B.pointer(E);Object.extend(E,{target:E.srcElement||D,relatedTarget:j(E),pageX:F.x,pageY:F.y});return Object.extend(E,z)}}else{B.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(B.prototype,z);B.extend=Prototype.K}function p(H,G,I){var F=Element.retrieve(H,"prototype_event_registry");if(Object.isUndefined(F)){f.push(H);F=Element.retrieve(H,"prototype_event_registry",$H())}var D=F.get(G);if(Object.isUndefined(D)){D=[];F.set(G,D)}if(D.pluck("handler").include(I)){return false}var E;if(G.include(":")){E=function(J){if(Object.isUndefined(J.eventName)){return false}if(J.eventName!==G){return false}B.extend(J,H);I.call(H,J)}}else{if(!C&&(G==="mouseenter"||G==="mouseleave")){if(G==="mouseenter"||G==="mouseleave"){E=function(K){B.extend(K,H);var J=K.relatedTarget;while(J&&J!==H){try{J=J.parentNode}catch(L){J=H}}if(J===H){return}I.call(H,K)}}}else{E=function(J){B.extend(J,H);I.call(H,J)}}}E.handler=I;D.push(E);return E}function h(){for(var D=0,E=f.length;D<E;D++){B.stopObserving(f[D]);f[D]=null}}var f=[];if(Prototype.Browser.IE){window.attachEvent("onunload",h)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var n=Prototype.K;if(!C){n=function(E){var D={mouseenter:"mouseover",mouseleave:"mouseout"};return E in D?D[E]:E}}function y(G,F,H){G=$(G);var E=p(G,F,H);if(!E){return G}if(F.include(":")){if(G.addEventListener){G.addEventListener("dataavailable",E,false)}else{G.attachEvent("ondataavailable",E);G.attachEvent("onfilterchange",E)}}else{var D=n(F);if(G.addEventListener){G.addEventListener(D,E,false)}else{G.attachEvent("on"+D,E)}}return G}function m(I,G,J){I=$(I);var F=Element.retrieve(I,"prototype_event_registry");if(Object.isUndefined(F)){return I}if(G&&!J){var H=F.get(G);if(Object.isUndefined(H)){return I}H.each(function(K){Element.stopObserving(I,G,K.handler)});return I}else{if(!G){F.each(function(M){var K=M.key,L=M.value;L.each(function(N){Element.stopObserving(I,K,N.handler)})});return I}}var H=F.get(G);if(!H){return}var E=H.find(function(K){return K.handler===J});if(!E){return I}var D=n(G);if(G.include(":")){if(I.removeEventListener){I.removeEventListener("dataavailable",E,false)}else{I.detachEvent("ondataavailable",E);I.detachEvent("onfilterchange",E)}}else{if(I.removeEventListener){I.removeEventListener(D,E,false)}else{I.detachEvent("on"+D,E)}}F.set(G,H.without(E));return I}function A(G,F,E,D){G=$(G);if(Object.isUndefined(D)){D=true}if(G==document&&document.createEvent&&!G.dispatchEvent){G=document.documentElement}var H;if(document.createEvent){H=document.createEvent("HTMLEvents");H.initEvent("dataavailable",true,true)}else{H=document.createEventObject();H.eventType=D?"ondataavailable":"onfilterchange"}H.eventName=F;H.memo=E||{};if(document.createEvent){G.dispatchEvent(H)}else{G.fireEvent(H.eventType,H)}return B.extend(H)}Object.extend(B,B.Methods);Object.extend(B,{fire:A,observe:y,stopObserving:m});Element.addMethods({fire:A,observe:y,stopObserving:m});Object.extend(document,{fire:A.methodize(),observe:y.methodize(),stopObserving:m.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,B)}else{window.Event=B}})();(function(){var f;function a(){if(document.loaded){return}if(f){window.clearTimeout(f)}document.loaded=true;document.fire("dom:loaded")}function e(){if(document.readyState==="complete"){document.stopObserving("readystatechange",e);a()}}function c(){try{document.documentElement.doScroll("left")}catch(g){f=c.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",e);if(window==top){f=c.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,c){return Element.insert(a,{before:c})},Top:function(a,c){return Element.insert(a,{top:c})},Bottom:function(a,c){return Element.insert(a,{bottom:c})},After:function(a,c){return Element.insert(a,{after:c})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(c,a,e){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(c,a,e)}this.xcomp=a;this.ycomp=e;this.offset=Element.cumulativeOffset(c);return(e>=this.offset[1]&&e<this.offset[1]+c.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+c.offsetWidth)},withinIncludingScrolloffsets:function(c,a,f){var e=Element.cumulativeScrollOffset(c);this.xcomp=a+e[0]-this.deltaX;this.ycomp=f+e[1]-this.deltaY;this.offset=Element.cumulativeOffset(c);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+c.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+c.offsetWidth)},overlap:function(c,a){if(!c){return 0}if(c=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(c=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(c,e,a){a=a||{};return Element.clonePosition(e,c,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(c){function a(e){return e.blank()?null:"[contains(concat(' ', @class, ' '), ' "+e+" ')]"}c.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(e,g){g=g.toString().strip();var f=/\s/.test(g)?$w(g).map(a).join(""):a(g);return f?document._getElementsByXPath(".//*"+f,e):[]}:function(g,h){h=h.toString().strip();var j=[],l=(/\s/.test(h)?$w(h):null);if(!l&&!h){return j}var e=$(g).getElementsByTagName("*");h=" "+h+" ";for(var f=0,n,m;n=e[f];f++){if(n.className&&(m=" "+n.className+" ")&&(m.include(h)||(l&&l.all(function(o){return !o.toString().blank()&&m.include(" "+o+" ")})))){j.push(Element.extend(n))}}return j};return function(f,e){return $(e||document.body).getElementsByClassName(f)}}(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(c){return c.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var e=this.slice(4,this.length-1).split(",");var c=0;do{a+=parseInt(e[c]).toColorPart()}while(++c<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var c=1;c<4;c++){a+=(this.charAt(c)+this.charAt(c)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:(c.hasChildNodes()?Element.collectTextNodes(c):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,c){return $A($(a).childNodes).collect(function(e){return(e.nodeType==3?e.nodeValue:((e.hasChildNodes()&&!Element.hasClassName(e,c))?Element.collectTextNodesIgnoreClass(e,c):""))}).flatten().join("")};Element.setContentZoom=function(a,c){a=$(a);a.setStyle({fontSize:(c/100)+"em"});if(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 f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}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){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(c,a){return(-Math.cos((c*((a||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var c="position:relative";if(Prototype.Browser.IE){c+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(e){if(e.nodeType==3){e.nodeValue.toArray().each(function(f){a.insertBefore(new Element("span",{style:c}).update(f==" "?String.fromCharCode(160):f),e)});Element.remove(e)}})},multiple:function(c,e){var g;if(((typeof c=="object")||Object.isFunction(c))&&(c.length)){g=c}else{g=$(c).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var f=a.delay;$A(g).each(function(j,h){new e(j,Object.extend(a,{delay:h*a.speed+f}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(c,e,a){c=$(c);e=(e||"appear").toLowerCase();return Effect[Effect.PAIRS[e][c.visible()?1:0]](c,Object.extend({queue:{position:"end",scope:(c.id||"global"),limit:1}},a||{}))}};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(c){var e=new Date().getTime();var a=Object.isString(c.options.queue)?c.options.queue:c.options.queue.position;switch(a){case"front":this.effects.findAll(function(f){return f.state=="idle"}).each(function(f){f.startOn+=c.finishOn;f.finishOn+=c.finishOn});break;case"with-last":e=this.effects.pluck("startOn").max()||e;break;case"end":e=this.effects.pluck("finishOn").max()||e;break}c.startOn+=e;c.finishOn+=e;if(!c.options.queue.limit||(this.effects.length<c.options.queue.limit)){this.effects.push(c)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(c){return c==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var e=new Date().getTime();for(var c=0,a=this.effects.length;c<a;c++){this.effects[c]&&this.effects[c].loop(e)}}});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*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function c(f,e){if(f.options[e+"Internal"]){f.options[e+"Internal"](f)}if(f.options[e]){f.options[e](f)}}return function(e){if(this.state==="idle"){this.state="running";c(this,"beforeSetup");if(this.setup){this.setup()}c(this,"afterSetup")}if(this.state==="running"){e=(this.options.transition(e)*this.fromToDelta)+this.options.from;this.position=e;c(this,"beforeUpdate");if(this.update){this.update(e)}c(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(e){if(e>=this.startOn){if(e>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var c=(e-this.startOn)/this.totalTime,a=(c*this.totalFrames).round();if(a>this.currentFrame){this.render(c);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(c){c.render(1);c.cancel();c.event("beforeFinish");if(c.finish){c.finish(a)}c.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(e,h,g){e=Object.isString(e)?$(e):e;var c=$A(arguments),f=c.last(),a=c.length==5?c[3]:null;this.method=Object.isFunction(f)?f.bind(e):Object.isFunction(e[f])?e[f].bind(e):function(j){e[f]=j};this.start(Object.extend({from:h,to:g},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(c,a,e){return new Effect.Move(c,Object.extend({x:e,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(c,e){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:e},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(c){this.originalStyle[c]=this.element.style[c]}.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(c){if(a.indexOf(c)>0){this.fontSize=parseFloat(a);this.fontSizeType=c}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var c=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*c+this.fontSizeType})}this.setDimensions(this.dims[0]*c,this.dims[1]*c)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,f){var g={};if(this.options.scaleX){g.width=f.round()+"px"}if(this.options.scaleY){g.height=a.round()+"px"}if(this.options.scaleFromCenter){var e=(a-this.dims[0])/2;var c=(f-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){g.top=this.originalTop-e+"px"}if(this.options.scaleX){g.left=this.originalLeft-c+"px"}}else{if(this.options.scaleY){g.top=-e+"px"}if(this.options.scaleX){g.left=-c+"px"}}}this.element.setStyle(g)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,e,f){return c+((this._base[f]+(this._delta[f]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(e){var c=arguments[1]||{},a=document.viewport.getScrollOffsets(),f=$(e).cumulativeOffset();if(c.offset){f[1]+=c.offset}return new Effect.Tween(null,a.top,f[1],c,function(g){scrollTo(a.left,g.round())})};Effect.Fade=function(e){e=$(e);var a=e.getInlineOpacity();var c=Object.extend({from:e.getOpacity()||1,to:0,afterFinishInternal:function(f){if(f.options.to!=0){return}f.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(e,c)};Effect.Appear=function(c){c=$(c);var a=Object.extend({from:(c.getStyle("display")=="none"?0:c.getOpacity()||0),to:1,afterFinishInternal:function(e){e.element.forceRerendering()},beforeSetup:function(e){e.element.setOpacity(e.options.from).show()}},arguments[1]||{});return new Effect.Opacity(c,a)};Effect.Puff=function(c){c=$(c);var a={opacity:c.getInlineOpacity(),position:c.getStyle("position"),top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};return new Effect.Parallel([new Effect.Scale(c,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(e){Position.absolutize(e.effects[0].element)},afterFinishInternal:function(e){e.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(c){c=$(c);var a=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(e){e.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(c){c=$(c);var a=c.getInlineOpacity();return new Effect.Appear(c,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(e){new Effect.Scale(e.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(f){f.element.makePositioned().makeClipping()},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(c){c=$(c);var a={top:c.getStyle("top"),left:c.getStyle("left"),opacity:c.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(c,{x:0,y:100,sync:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(e){e.effects[0].element.makePositioned()},afterFinishInternal:function(e){e.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(f){f=$(f);var c=Object.extend({distance:20,duration:0.5},arguments[1]||{});var g=parseFloat(c.distance);var e=parseFloat(c.duration)/10;var a={top:f.getStyle("top"),left:f.getStyle("left")};return new Effect.Move(f,{x:g,y:0,duration:e,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-g*2,y:0,duration:e*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:g*2,y:0,duration:e*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:-g*2,y:0,duration:e*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:g*2,y:0,duration:e*2,afterFinishInternal:function(n){new Effect.Move(n.element,{x:-g,y:0,duration:e,afterFinishInternal:function(o){o.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(e){e=$(e).cleanWhitespace();var a=e.down().getStyle("bottom");var c=e.getDimensions();return new Effect.Scale(e,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();if(window.opera){f.element.setStyle({top:""})}f.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:(f.dims[0]-f.element.clientHeight)+"px"})},afterFinishInternal:function(f){f.element.undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(e){e=$(e).cleanWhitespace();var a=e.down().getStyle("bottom");var c=e.getDimensions();return new Effect.Scale(e,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(f){f.element.makePositioned();f.element.down().makePositioned();if(window.opera){f.element.setStyle({top:""})}f.element.makeClipping().show()},afterUpdateInternal:function(f){f.element.down().setStyle({bottom:(f.dims[0]-f.element.clientHeight)+"px"})},afterFinishInternal:function(f){f.element.hide().undoClipping().undoPositioned();f.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(c){c.element.makeClipping()},afterFinishInternal:function(c){c.element.hide().undoClipping()}})};Effect.Grow=function(e){e=$(e);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var j=e.getDimensions();var l,h;var g,f;switch(c.direction){case"top-left":l=h=g=f=0;break;case"top-right":l=j.width;h=f=0;g=-j.width;break;case"bottom-left":l=g=0;h=j.height;f=-j.height;break;case"bottom-right":l=j.width;h=j.height;g=-j.width;f=-j.height;break;case"center":l=j.width/2;h=j.height/2;g=-j.width/2;f=-j.height/2;break}return new Effect.Move(e,{x:l,y:h,duration:0.01,beforeSetup:function(m){m.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(m){new Effect.Parallel([new Effect.Opacity(m.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(m.element,{x:g,y:f,sync:true,transition:c.moveTransition}),new Effect.Scale(m.element,100,{scaleMode:{originalHeight:j.height,originalWidth:j.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(n){n.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(n){n.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},c))}})};Effect.Shrink=function(e){e=$(e);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:e.style.top,left:e.style.left,height:e.style.height,width:e.style.width,opacity:e.getInlineOpacity()};var h=e.getDimensions();var g,f;switch(c.direction){case"top-left":g=f=0;break;case"top-right":g=h.width;f=0;break;case"bottom-left":g=0;f=h.height;break;case"bottom-right":g=h.width;f=h.height;break;case"center":g=h.width/2;f=h.height/2;break}return new Effect.Parallel([new Effect.Opacity(e,{sync:true,to:0,from:1,transition:c.opacityTransition}),new Effect.Scale(e,window.opera?1:0,{sync:true,transition:c.scaleTransition,restoreAfterFinish:true}),new Effect.Move(e,{x:g,y:f,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(a)}},c))};Effect.Pulsate=function(e){e=$(e);var c=arguments[1]||{},a=e.getInlineOpacity(),g=c.transition||Effect.Transitions.linear,f=function(h){return 1-g((-Math.cos((h*(c.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(e,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(h){h.element.setStyle({opacity:a})}},c),{transition:f}))};Effect.Fold=function(c){c=$(c);var a={top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};c.makeClipping();return new Effect.Scale(c,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(e){new Effect.Scale(c,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(f){f.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(e){this.element=$(e);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var c=this.element.getStyles();this.style=this.style.reject(function(f){return f.value==c[f.key]});a.afterFinishInternal=function(f){f.element.addClassName(f.options.style);f.transforms.each(function(g){f.element.style[g.style]=""})}}}this.start(a)},setup:function(){function a(c){if(!c||["rgba(0, 0, 0, 0)","transparent"].include(c)){c="#ffffff"}c=c.parseColor();return $R(0,2).map(function(e){return parseInt(c.slice(e*2+1,e*2+3),16)})}this.transforms=this.style.map(function(j){var h=j[0],g=j[1],f=null;if(g.parseColor("#zzzzzz")!="#zzzzzz"){g=g.parseColor();f="color"}else{if(h=="opacity"){g=parseFloat(g);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(g)){var e=g.match(/^([\+\-]?[0-9\.]+)(.*)$/);g=parseFloat(e[1]);f=(e.length==3)?e[2]:null}}}var c=this.element.getStyle(h);return{style:h.camelize(),originalValue:f=="color"?a(c):parseFloat(c||0),targetValue:f=="color"?a(g):g,unit:f}}.bind(this)).reject(function(c){return((c.originalValue==c.targetValue)||(c.unit!="color"&&(isNaN(c.originalValue)||isNaN(c.targetValue))))})},update:function(a){var f={},c,e=this.transforms.length;while(e--){f[(c=this.transforms[e]).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(f,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(c){c=$H(c);var e=c.values().first();this.tracks.push($H({ids:c.keys().first(),effect:Effect.Morph,options:{style:e}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var f=a.get("ids"),e=a.get("effect"),c=a.get("options");var g=[$(f)||$$(f)].flatten();return g.map(function(h){return new e(h,Object.extend({sync:true},c))})}).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 c,a=$H();if(Prototype.Browser.WebKit){c=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';c=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(e){if(c[e]){a.set(e,c[e])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(c){var a=document.defaultView.getComputedStyle($(c),null);return Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=a[f];return e})}}else{Element.getStyles=function(c){c=$(c);var a=c.currentStyle,e;e=Element.CSS_PROPERTIES.inject({},function(f,g){f[g]=a[g];return f});if(!e.opacity){e.opacity=c.getOpacity()}return e}}Effect.Methods={morph:function(a,c){a=$(a);new Effect.Morph(a,Object.extend({style:c},arguments[2]||{}));return a},visualEffect:function(e,g,c){e=$(e);var f=g.dasherize().camelize(),a=f.charAt(0).toUpperCase()+f.substring(1);new Effect[a](e,c);return e},highlight:function(c,a){c=$(c);new Effect.Highlight(c,a);return c}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(e,c){e=$(e);Effect[a.charAt(0).toUpperCase()+a.substring(1)](e,c);return e}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(!Control){var Control={}}Control.Slider=Class.create({initialize:function(f,a,c){var e=this;if(Object.isArray(f)){this.handles=f.collect(function(g){return $(g)})}else{this.handles=[$(f)]}this.track=$(a);this.options=c||{};this.axis=this.options.axis||"horizontal";this.increment=this.options.increment||1;this.step=parseInt(this.options.step||"1");this.range=this.options.range||$R(0,1);this.value=0;this.values=this.handles.map(function(){return 0});this.spans=this.options.spans?this.options.spans.map(function(g){return $(g)}):false;this.options.startSpan=$(this.options.startSpan||null);this.options.endSpan=$(this.options.endSpan||null);this.restricted=this.options.restricted||false;this.maximum=this.options.maximum||this.range.end;this.minimum=this.options.minimum||this.range.start;this.alignX=parseInt(this.options.alignX||"0");this.alignY=parseInt(this.options.alignY||"0");this.trackLength=this.maximumOffset()-this.minimumOffset();this.handleLength=this.isVertical()?(this.handles[0].offsetHeight!=0?this.handles[0].offsetHeight:this.handles[0].style.height.replace(/px$/,"")):(this.handles[0].offsetWidth!=0?this.handles[0].offsetWidth:this.handles[0].style.width.replace(/px$/,""));this.active=false;this.dragging=false;this.disabled=false;if(this.options.disabled){this.setDisabled()}this.allowedValues=this.options.values?this.options.values.sortBy(Prototype.K):false;if(this.allowedValues){this.minimum=this.allowedValues.min();this.maximum=this.allowedValues.max()}this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.handles.each(function(j,g){g=e.handles.length-1-g;e.setValue(parseFloat((Object.isArray(e.options.sliderValue)?e.options.sliderValue[g]:e.options.sliderValue)||e.range.start),g);j.makePositioned().observe("mousedown",e.eventMouseDown)});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var a=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(c){Event.stopObserving(c,"mousedown",a.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(a){if(this.allowedValues){if(a>=this.allowedValues.max()){return(this.allowedValues.max())}if(a<=this.allowedValues.min()){return(this.allowedValues.min())}var e=Math.abs(this.allowedValues[0]-a);var c=this.allowedValues[0];this.allowedValues.each(function(f){var g=Math.abs(f-a);if(g<=e){c=f;e=g}});return c}if(a>this.range.end){return this.range.end}if(a<this.range.start){return this.range.start}return a},setValue:function(c,a){if(!this.active){this.activeHandleIdx=a||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}a=a||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((a>0)&&(c<this.values[a-1])){c=this.values[a-1]}if((a<(this.handles.length-1))&&(c>this.values[a+1])){c=this.values[a+1]}}c=this.getNearestValue(c);this.values[a]=c;this.value=this.values[0];this.handles[a].style[this.isVertical()?"top":"left"]=this.translateToPx(c);this.drawSpans();if(!this.dragging||!this.event){this.updateFinished()}},setValueBy:function(c,a){this.setValue(this.values[a||this.activeHandleIdx||0]+c,a||this.activeHandleIdx||0)},translateToPx:function(a){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(a-this.range.start))+"px"},translateToValue:function(a){return((a/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)},getRange:function(c){var a=this.values.sortBy(Prototype.K);c=c||0;return $R(a[c],a[c+1])},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX)},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var a=this;if(this.spans){$R(0,this.spans.length-1).each(function(c){a.setSpan(a.spans[c],a.getRange(c))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(c,a){if(this.isVertical()){c.style.top=this.translateToPx(a.start);c.style.height=this.translateToPx(a.end-a.start+this.range.start)}else{c.style.left=this.translateToPx(a.start);c.style.width=this.translateToPx(a.end-a.start+this.range.start)}},updateStyles:function(){this.handles.each(function(a){Element.removeClassName(a,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(e){if(Event.isLeftClick(e)){if(!this.disabled){this.active=true;var f=Event.element(e);var g=[Event.pointerX(e),Event.pointerY(e)];var a=f;if(a==this.track){var c=this.track.cumulativeOffset();this.event=e;this.setValue(this.translateToValue((this.isVertical()?g[1]-c[1]:g[0]-c[0])-(this.handleLength/2)));var c=this.activeHandle.cumulativeOffset();this.offsetX=(g[0]-c[0]);this.offsetY=(g[1]-c[1])}else{while((this.handles.indexOf(f)==-1)&&f.parentNode){f=f.parentNode}if(this.handles.indexOf(f)!=-1){this.activeHandle=f;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var c=this.activeHandle.cumulativeOffset();this.offsetX=(g[0]-c[0]);this.offsetY=(g[1]-c[1])}}}Event.stop(e)}},update:function(a){if(this.active){if(!this.dragging){this.dragging=true}this.draw(a);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(a)}},draw:function(c){var e=[Event.pointerX(c),Event.pointerY(c)];var a=this.track.cumulativeOffset();e[0]-=this.offsetX+a[0];e[1]-=this.offsetY+a[1];this.event=c;this.setValue(this.translateToValue(this.isVertical()?e[1]:e[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(a){if(this.active&&this.dragging){this.finishDrag(a,true);Event.stop(a)}this.active=false;this.dragging=false},finishDrag:function(a,c){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}});if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(c,e,a){c=$(c);this.element=c;this.update=$(e);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions){this.setOptions(a)}else{this.options=a||{}}this.options.scrollIntoView=this.options.scrollIntoView||true;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(f,g){if(!g.style.position||g.style.position=="absolute"){g.style.position="absolute";Position.clone(f,g,{setHeight:false,offsetTop:f.offsetHeight})}Effect.Appear(g,{duration:0.15})};this.options.onHide=this.options.onHide||function(f,g){new Effect.Fade(g,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(c){var a=Event.findElement(c,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(c)},onClick:function(c){var a=Event.findElement(c,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}},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(h){if(this.options.updateElement){this.options.updateElement(h);return}var f="";if(this.options.select){var a=$(h).select("."+this.options.select)||[];if(a.length>0){f=Element.collectTextNodes(a[0],this.options.select)}}else{f=Element.collectTextNodesIgnoreClass(h,"informal")}var e=this.getTokenBounds();if(e[0]!=-1){var g=this.element.value.substr(0,e[0]);var c=this.element.value.substr(e[0]).match(/^\s+/);if(c){g+=c[0]}this.element.value=g+f+this.element.value.substr(e[1])}else{this.element.value=f}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,h)}},updateChoices:function(e){if(!this.changed&&this.hasFocus){this.update.innerHTML=e;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var c=this.getEntry(a);c.autocompleteIndex=a;this.addObservers(c)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var g=this.element.value;if(g.strip().empty()){return[-1,0]}var h=arguments.callee.getFirstDifferencePos(g,this.oldElementValue);var m=(h==this.oldElementValue.length?1:0);var f=-1,e=g.length;var j;for(var c=0,a=this.options.tokens.length;c<a;++c){j=g.lastIndexOf(this.options.tokens[c],h+m-1);if(j>f){f=j}j=g.indexOf(this.options.tokens[c],h+m);if(-1!=j&&j<e){e=j}}return(this.tokenBounds=[f+1,e])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(e,a){var f=Math.min(e.length,a.length);for(var c=0;c<f;++c){if(e[c]!=a[c]){return c}}return f};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(e,f,c,a){this.baseInitialize(e,f,a);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(c,f,e,a){this.baseInitialize(c,f,a);this.options.array=e},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(c){var f=[];var e=[];var l=c.getToken();var j=0;for(var g=0;g<c.options.array.length&&f.length<c.options.choices;g++){var h=c.options.array[g];var m=c.options.ignoreCase?h.toLowerCase().indexOf(l.toLowerCase()):h.indexOf(l);while(m!=-1){if(m==0&&h.length!=l.length){f.push("<li><strong>"+h.substr(0,l.length)+"</strong>"+h.substr(l.length)+"</li>");break}else{if(l.length>=c.options.partialChars&&c.options.partialSearch&&m!=-1){if(c.options.fullSearch||/\s/.test(h.substr(m-1,1))){e.push("<li>"+h.substr(0,m)+"<strong>"+h.substr(m,l.length)+"</strong>"+h.substr(m+l.length)+"</li>");break}}}m=c.options.ignoreCase?h.toLowerCase().indexOf(l.toLowerCase(),m+1):h.indexOf(l,m+1)}}if(e.length){f=f.concat(e.slice(0,c.options.choices-f.length))}return"<ul>"+f.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(e,c,a){this.url=c;this.element=e=$(e);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(a);Object.extend(this.options,a||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=""}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}if(!this.options.externalControl){this.options.externalControlOnly=false}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey){return}if(Event.KEY_ESC==a.keyCode){this.handleFormCancellation(a)}else{if(Event.KEY_RETURN==a.keyCode){this.handleFormSubmission(a)}}},createControl:function(j,e,c){var g=this.options[j+"Control"];var h=this.options[j+"Text"];if("button"==g){var a=document.createElement("input");a.type="submit";a.value=h;a.className="editor_"+j+"_button";if("cancel"==j){a.onclick=this._boundCancelHandler}this._form.appendChild(a);this._controls[j]=a}else{if("link"==g){var f=document.createElement("a");f.href="#";f.appendChild(document.createTextNode(h));f.onclick="cancel"==j?this._boundCancelHandler:this._boundSubmitHandler;f.className="editor_"+j+"_link";if(c){f.className+=" "+c}this._form.appendChild(f);this._controls[j]=f}}},createEditField:function(){var e=(this.options.loadTextURL?this.options.loadingText:this.getText());var c;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){c=document.createElement("input");c.type="text";var a=this.options.size||this.options.cols||0;if(0<a){c.size=a}}else{c=document.createElement("textarea");c.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);c.cols=this.options.cols||40}c.name=this.options.paramName;c.value=e;c.className="editor_field";if(this.options.submitOnBlur){c.onblur=this._boundSubmitHandler}this._controls.editor=c;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var c=this;function a(f,g){var e=c.options["text"+f+"Controls"];if(!e||g===false){return}c._form.appendChild(document.createTextNode(e))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)}a("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);a("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");a("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML}this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(this._saving||this._editing){return}this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(a){Event.stop(a)}},enterHover:function(a){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();if(a){Event.stop(a)}},handleFormSubmission:function(g){var c=this._form;var f=$F(this._controls.editor);this.prepareSubmission();var h=this.options.callback(c,f)||"";if(Object.isString(h)){h=h.toQueryParams()}h.editorId=this.element.id;if(this.options.htmlResponse){var a=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(a,{parameters:h,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,a)}else{var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:h,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,a)}if(g){Event.stop(g)}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show()}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(a){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(e){this._form.removeClassName(this.options.loadingClassName);var c=e.responseText;if(this.options.stripLoadedTextTags){c=c.stripTags()}this._controls.editor.value=c;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(c){a=this[c.value].bind(this);this._listeners[c.key]=a;if(!this.options.externalControlOnly){this.element.observe(c.key,a)}if(this.options.externalControl){this.options.externalControl.observe(c.key,a)}}.bind(this))},removeForm:function(){if(!this._form){return}this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(c,a){if("function"==typeof this.options[c]){this.options[c](this,a)}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly){this.element.stopObserving(a.key,a.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(a.key,a.value)}}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,e,c,a){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(e,c,a)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];if(this.options.loadCollectionURL){this.loadCollection()}else{this.checkForExternalText()}this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js)){throw ("Server returned an invalid collection representation.")}this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(c){this._controls.editor.disabled=true;var a=this._controls.editor.firstChild;if(!a){a=document.createElement("option");a.value="";this._controls.editor.appendChild(a);a.selected=true}a.update((c||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(c){this._text=c.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(f){return 2===f.length?f:[f,f].flatten()});var c=("value" in this.options)?this.options.value:this._text;var a=this._collection.any(function(f){return f[0]==c}.bind(this));this._controls.editor.update("");var e;this._collection.each(function(g,f){e=document.createElement("option");e.value=g[0];e.selected=a?g[0]==c:0==f;e.appendChild(document.createTextNode(g[1]));this._controls.editor.appendChild(e)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){if(!a){return}function c(e,f){if(e in a||f===undefined){return}a[e]=f}c("cancelControl",(a.cancelLink?"link":(a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined)));c("okControl",(a.okLink?"link":(a.okButton?"button":a.okLink==a.okButton==false?false:undefined)));c("highlightColor",a.highlightcolor);c("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(c,a){new Effect.Highlight(a,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;if(a._effect){a._effect.cancel()}},onFailure:function(c,a){alert("Error communication with the server: "+c.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(c,a,e){this.delay=a||0.5;this.element=$(c);this.callback=e;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});var FastInit={onload:function(){if(FastInit.done){return}FastInit.done=true;for(var a=0,c=FastInit.f.length;a<c;a++){FastInit.f[a]()}},addOnLoad:function(){var e=arguments;for(var c=0,f=e.length;c<f;c++){if(typeof e[c]==="function"){if(FastInit.done){e[c]()}else{FastInit.f.push(e[c])}}}},listen:function(){if(/WebKit|khtml/i.test(navigator.userAgent)){FastInit.timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(FastInit.timer);delete FastInit.timer;FastInit.onload()}},10)}else{if(document.addEventListener){document.addEventListener("DOMContentLoaded",FastInit.onload,false)}else{if(!FastInit.iew32){if(window.addEventListener){window.addEventListener("load",FastInit.onload,false)}else{if(window.attachEvent){return window.attachEvent("onload",FastInit.onload)}}}}}},f:[],done:false,timer:null,iew32:false};
/*@cc_on @*/
/*@if (@_win32)
FastInit.iew32 = true;
document.write('<script id="__ie_onload" defer src="' + ((location.protocol == 'https:') ? '//0' : 'javascript:void(0)') + '"><\/script>');
document.getElementById('__ie_onload').onreadystatechange = function(){if (this.readyState == 'complete') { FastInit.onload(); }};
/*@end @*/
FastInit.listen();function OXH(){this._ox=OX();this._contentTopics={};this._customVariables={};this._adsFetched=false;this.addContentTopic=function(c,a){this._contentTopics[c]=a;this._ox.addContentTopic(c)};this.addVariable=function(c,a){this._customVariables[c]=a;this._ox.addVariable(c,a)};this.contentTopics=function(){return this._contentTopics};this.customVariables=function(){return this._customVariables};this.addGroups=function(a){$A(a).each(function(c){this._ox.addPage(c)}.bind(this))};this.addUnits=function(a){$A(a).each(function(c){this._ox.addAdUnit(c)}.bind(this))};this.showAd=function(a){if(this._adsFetched){this._ox.showAdUnit(a)}};this.fetchAds=function(){this._ox.fetchAds();this._adsFetched=true}}if(typeof(SBN)=="undefined"){SBN=new Object()}if(SBN.Admin==undefined){SBN.Admin=new Object()}if(SBN.Special==undefined){SBN.Special=new Object()}if(SBN.Yahoo==undefined){SBN.Yahoo=new Object()}SBN.CurrentContext=new Object();SBN.Yahoo.referringUrl=null;SBN.Yahoo.goBack=function(){if(SBN.Yahoo.referringUrl){location.href=SBN.Yahoo.referringUrl}else{location.href="http://sports.yahoo.com/"}};SBN.Yahoo.isYahooReferral=function(a){if(SBN.Yahoo.referringUrl==null){if(document.referrer!=undefined&&document.referrer.match(a)){SBN.Yahoo.referringUrl=document.referrer}else{SBN.Yahoo.referringUrl=SBN.readCookie("referred_from_yahoo")}}if(SBN.Yahoo.referringUrl){SBN.createCookie("referred_from_yahoo",SBN.Yahoo.referringUrl,1);return true}else{return false}};SBN.blogLayouts=$A(["narrow_layout","wide_layout"]);SBN.changeBlogLayout=function(c){var a=$(document.body);SBN.blogLayouts.each(function(e){a.removeClassName(e)});a.addClassName(c);new Ajax.Request("/communities/change_layout/?layout="+encodeURI(c),{asynchronous:true,evalScripts:true})};SBN.formatTime=function(f){var c=f.getHours();var e=f.getMinutes();var a=(c<12)?"AM":"PM";if(c==0){c=12}else{if(c>12){c=c-12}}if(e<10){e="0"+e}return c+":"+e+" "+a};SBN.createCookie=function(e,f,g){if(g){var c=new Date();c.setTime(c.getTime()+(g*24*60*60*1000));var a="; expires="+c.toGMTString()}else{a=""}document.cookie=e+"="+f+a+"; path=/"};SBN.readCookie=function(e){var g=e+"=";var a=document.cookie.split(";");for(var f=0;f<a.length;f++){var h=a[f];while(h.charAt(0)==" "){h=h.substring(1,h.length)}if(h.indexOf(g)==0){return h.substring(g.length,h.length)}}return null};SBN.ajaxSuccess=function(a){return !a.status||(a.status>=200&&a.status<300)};SBN.hideSpinner=function(a){if(a==undefined){var a="spinner"}if($(a)){$(a).hide()}};SBN.showSpinner=function(a){if(a==undefined){var a="spinner"}if($(a)){$(a).show()}};SBN.toggleSubmit=function(c){var a=$(c);a.disabled=!a.disabled;a.value=a.disabled?"Saving...":"Save Changes"};SBN.clearChildren=function(a){$(a).childElements().each(function(c){c.remove()});a.innerHTML=""};SBN.appendUrlParam=function(a,c){if(a.include("?")){return a+"&"+c}else{return a+"?"+c}};SBN.openWindow=function(a){window.open(a,"","height=500,width=800,menubar=no,status=no,scrollbars=yes,resizable=yes")};SBN.openModal=function(e,c){var a=SBN.openModalWithContents('<div class="modal-loading" style="padding:10px">Loading<blink>...</blink></div>',c);new Ajax.Request(e,{onComplete:function(f){a.container.innerHTML=f.responseText;SBN.alignModal(a)}});return a};SBN.alignModal=function(a){a.position();a.position();a.position()};SBN.openIframeModal=function(g,f){var e=null;var c={iframe:true,width:700,height:400,includeCloseLink:false};f=Object.extend(c,f||{});var h=Control.Window.iframeTemplate;if(f.includeCloseLink){Control.Window.iframeTemplate=new Template('<div class="modal-topbar"></div><div id="modal-close"><a href="#" onclick="Control.Modal.close();return false">X</a></div><iframe src="#{href}" width="100%" height="'+(f.height-24)+'" frameborder="0" scrolling="auto" style="overflow-x: hidden; overflow-y: scroll;" id="modal_iframe"></iframe>')}else{Control.Window.iframeTemplate=new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0" scrolling="auto" style="overflow-x: hidden; overflow-y: scroll;" id="modal_iframe"></iframe>')}var a=new Control.Modal(g,f);a.open();Control.Window.iframeTemplate=h;return a};SBN.openCloseableModalWithContents=function(e,c){SBN.initModalContainer('<div id="modal-close"><a href="#" onclick="Control.Modal.close();return false">X</a></div><div class="modal-content">'+e+"</div>");var a=new Control.Modal(this.modalContainer,c);a.open();return a};SBN.openModalWithContents=function(e,c){SBN.initModalContainer('<div class="modal-content" style="text-align:center">'+e+"</div>");var a=new Control.Modal(this.modalContainer,c);a.open();return a};SBN.initModalContainer=function(a){if(!this.modalContainer){this.modalContainer=$(document.createElement("div"));this.modalContainer.id="modal_container";this.modalContainer.hide();$(document.body).appendChild(this.modalContainer)}this.modalContainer.innerHTML=a};SBN.activateRedStarMenus=function(){$$(".blog-hover-link").each(function(a){new HoverMenu(a.id)})};SBN.equalizeColumnHeights=function(){if($("col-side-1")&&$("entries")){var c=$("col-side-1").getHeight();var a=$("entries").getHeight();if(a<c){padding=c-a;$("entries").setStyle({paddingBottom:padding+"px"})}}};SBN.callOnParent=function(a){setTimeout(a,100)};SBN.submitForm=function(a){if($(a).onsubmit()){$(a).submit()}};SBN.NetworkBar=function(){};SBN.NetworkBar.toggleLogin=function(){Effect.toggle("network_bar_login","blind",{duration:0.5})};SBN.NetworkBar.toggleOpenId=function(){var e=$("openid_login");if(e.visible()){var c="openid_login";var a="standard_login"}else{var c="standard_login";var a="openid_login"}Effect.toggle(c,"slide",{duration:0.3});Effect.toggle(a,"slide",{delay:0.3,duration:0.3})};SBN.UserFlags={create:function(a){this.updateFlag(a,"create")},destroy:function(a){this.updateFlag(a,"destroy")},updateFlag:function(e,a){var c=$H({name:e}).toQueryString();new Ajax.Request("/user_flags/"+a,{parameters:c,asynchronous:true,evalScripts:true})}};SBN.Assets=function(){};SBN.Assets.addUploadField=function(){var c=$("asset_list");var a=$("initial_asset_field").innerHTML;new Insertion.Bottom(c,a)};function rate(a,c,e){new Ajax.Updater("options","/posts/rate/"+a+"/"+c+"/"+e,{asynchronous:true,evalScripts:true})}var openModal=function(a){SBN.openModal(a)};SBN.Blogroll=function(){};SBN.Blogroll.toggleLeague=function(a){var c=$(a);var e=$(a+"_head");if(c.visible()){Effect.BlindUp(c,{duration:0.5});e.removeClassName("expanded")}else{Effect.BlindDown(c,{duration:0.5});e.addClassName("expanded")}};SBN.Links={};SBN.Links.disable=function(c){var a=$(c);if(!a.oldOnclick){a.oldOnclick=a.getAttribute("onclick");a.setAttribute("onclick","return false;");a.addClassName("disabled_link")}};SBN.Links.enable=function(c){var a=$(c);if(a.oldOnclick){a.setAttribute("onclick",a.oldOnclick);a.oldOnclick=null;a.removeClassName("disabled_link")}};SBN.Ads={showOnLoad:function(a,c){document.observe("dom:loaded",this.show.bind(this,a,c));Event.observe(window,"load",function(){setTimeout(function(){SBN.Ads.show(a,c)},1500)})},show:function(c,e){c=$(c);if(c){var a=c.getHeight();if(!(a!=null&&a<e)){c.show()}}}};SBN.Tables=function(){};SBN.Tables.zebra=function(a){Selector.findChildElements(a,["tr"]).findAll(function(e,c){return c%2==0}).invoke("addClassName","even")};SBN.disableSelection=function(a){a.onselectstart=function(){return false};a.unselectable="on";a.style.MozUserSelect="none";a.style.cursor="default"};FastInit.addOnLoad(function(){$$("table.zebra tbody").each(function(a){SBN.Tables.zebra(a)})});function resetField(e,c){var a=e.defaultValue;if(e.value==(c?"":a)){e.value=(c?a:"")}}SBN.adjustCalendarTime=function(a,c){if((a.getMinutes()%c)!=0){a.setMinutes(0)}$$(".cds_buttons a").each(function(f){if(f.innerHTML=="Now"){f.hide()}})};SBN.preventFutureDate=function(c){var a=new Date();if(c.selected_date>a){c.today(true)}};SBN.Dates={};SBN.Dates.lastDateValues={};SBN.Dates.updateDate=function(f){var e=$F(f+"_freeform");if(e==""){$(f+"_english").innerHTML="";$(f).value=""}else{if(e!=this.lastDateValues[f]){var c=null;var a=Date.parse(e);if(a){c=a.toString("ddd, MMM d, yyyy");$(f).value=a.toISOString().replace(/"/g,"")}else{c="Enter a valid date."}$(f+"_english").innerHTML=c;this.lastDateValues[f]=e}}};SBN.AjaxOverlay={apply:function(f){var a=$(f);var g=a.cumulativeOffset();var c="top: "+g[1]+"px; left:"+g[0]+"px; width: "+a.offsetWidth+"px; height: "+a.offsetHeight+"px;";Element.insert(document.body,'<div class="ajax_overlay" style="position: absolute; '+c+'"></div>')},remove:function(){$$(".ajax_overlay").each(function(a){$(a).up().removeChild(a)})}};SBN.Page={};SBN.Page.getDimensions=function(){var f,a;if(window.innerHeight&&window.scrollMaxY){f=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){f=document.body.scrollWidth;a=document.body.scrollHeight}else{f=document.body.offsetWidth;a=document.body.offsetHeight}}var e,g;if(self.innerHeight){if(document.documentElement.clientWidth){e=document.documentElement.clientWidth}else{e=self.innerWidth}g=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){e=document.documentElement.clientWidth;g=document.documentElement.clientHeight}else{if(document.body){e=document.body.clientWidth;g=document.body.clientHeight}}}if(a<g){pageHeight=g}else{pageHeight=a}if(f<e){pageWidth=f}else{pageWidth=e}var c={};c.width=pageWidth;c.height=pageHeight;c.windowWidth=e;c.windowHeight=g;return c};function $RF(c,a){if($(c).type&&$(c).type.toLowerCase()=="radio"){var a=$(c).name;var c=$(c).form}else{if($(c).tagName.toLowerCase()!="form"){return false}}var e=$(c).getInputs("radio",a).find(function(f){return f.checked});return(e)?$F(e):null}function resetField(e,c){var a=e.defaultValue;if(e.value==(c?"":a)){e.value=(c?a:"")}}var addthis_config={data_use_flash:false};SBN.CDC={hub_host:"/",listenerLoaded:function(a,c){SBN.CDC.hub_host="http://"+a;arg_pos=c.indexOf("?");args=undefined;command=c;if(arg_pos>0){command=c.substring(0,arg_pos);args=c.substring(arg_pos+1)}if(SBN.CDC[command]!=undefined){SBN.CDC[command].call(SBN.CDC,args)}},authenticate:function(a){url=SBN.CDC.hub_host+"/account/authenticate_facebook_id?"+a;window.location.href=url},logout:function(){window.location.href=SBN.CDC.hub_host+"/account/logout"},cancel:function(){Control.Modal.close()},facebookModalInitialized:function(){SBN.Facebook.Connect.displayModal()}};SBN.Util={stripNewLines:function(a){var c=/\r?\n/gi;s=new String(a);s=s.replace(c,"");return s}};SBN.ContentModule={looper:function(a,e){options={loops:2,display:3};Object.extend(options,e||{});var c=0;var f=new PeriodicalExecuter(function(){var j=$$(a);if(j.length<=options.display){return}if(c==((options.loops*j.length)-1)){f.stop()}var g=options.display;var h=j[0];var l=j[g];new Effect.Parallel([new Effect.SlideUp(h,{sync:true}),new Effect.BlindDown(l,{sync:true,afterFinish:function(){var m=$(h.parentNode);h=h.remove();m.insert(h,{position:"bottom"});h.hide()}})],{duration:0.8});c+=1},5);return f}};SBN.PopUp=(function(){return function(a){var c={init:function(e){this.cookieName=e.cookiePrefix+"-pop-up-1";this.popUp=$(e.wrapperId);this.centerIt=(e.center||false);this.closeEl=this.popUp.down((e.closeClass||".campaigns-pop-up-close"));if(this.closeEl){this.closeEl.observe("click",this.hide.bind(this))}this.preview=(e.preview||false);this.slideOpts={duration:(e.duration||1)};this.startSec=(e.startIn||15);this.hideSec=(e.hideAfter||15);this.componentTrackerInstaller=e.componentTrackerInstaller;this.trackingImages=(e.trackingImages||[]);this.trackImagesEl=this.popUp.down(".tracking-images");this.pendingTimeouts=[];Event.observe(window,"resize",this.resizeHandler.bind(this));this.hide();this.resizeTimeout=false},resizeHandler:function(f){if(!this.resizeTimeout){this.resizeTimeout=setTimeout(this.resize.bind(this),100)}},resize:function(){var e=this.position();this.popUp.setStyle({left:e.x+"px",top:e.y+"px"});this.resizeTimeout=false},position:function(){var e=document.viewport.getDimensions().width;var f=this.popUp.getWidth();if(e==f||f>e){return}var j=e-f;var g=j/2;if(this.state=="hide"){var h=document.viewport.getHeight()+this.popUp.getHeight();return{x:g,y:h}}else{var h=document.viewport.getHeight()-this.popUp.getHeight();return{x:g,y:h}}},hide:function(f){this.state="hide";var g=this.position();new Effect.Move(this.popUp,{x:g.x,y:g.y,mode:"absolute"});this.pendingTimeouts.each(function(e){clearTimeout(e)});this.pendingTimeouts.clear();if(f){f.stop()}return false},showPopUp:function(){var e=document.cookie.split(";").invoke("strip").invoke("split","=",2).find(function(f){return f[0]==this.cookieName}.bind(this));if(e!=undefined&&e.length>0){if(window.location.search.parseQuery().resetPopUp!=undefined){return this.resetCookie()}if(this.preview||window.location.search.parseQuery().firePopUp!=undefined){return true}return false}this.setCookie();return true},resetCookie:function(){document.cookie=this.cookieName+"=true; expires="+new Date(new Date().getTime()-86400000).toGMTString()+"; path=/";return true},setCookie:function(){document.cookie=this.cookieName+"=true; expires="+new Date(new Date().getTime()+14400000).toGMTString()+"; path=/"},insertTrackingImages:function(){if(this.componentTrackerInstaller){this.componentTrackerInstaller()}this.trackingImages.each(function(f){var e=new Image();e.height="1";e.width="1";e.src=f;this.trackImagesEl.insert(e)}.bind(this))},show:function(){this.state="show";var f=this.position();var e=Object.extend({x:f.x,y:f.y,mode:"absolute",afterFinish:this.hideAfter.bind(this)},this.slideOpts);this.insertTrackingImages();this.popUp.show();new Effect.Move(this.popUp,e)},start:function(){if(!this.showPopUp()){return}this.pendingTimeouts.push(setTimeout(this.show.bind(this),this.startSec*1000))},hideAfter:function(){this.pendingTimeouts.push(setTimeout(this.hide.bind(this),this.hideSec*1000))}};c.init(a);return c}})();SBN.DraftPicker=(function(f){var f=f;var g=$("draft-pick-form");var e=$("valvoline-registration");var h=f.players.map(function(j){return{name:j.name,id:j.id}});var a=function(j){};var c={init:function(j){this.options=j;if(this.options.isEmail){e.observe("blur",this.validateEmail.bind(this))}g.observe("submit",this.submit.bind(this));this.setupPlayerPicks()},getPickEl:function(j){if(j.tagName=="li"||j.tagName=="LI"){return j}else{return j.up("li")}},pickClicked:function(m){var l=this.getPickEl(m.element());if(!l){return}else{this.pickEl=l}var j="player-select-"+l.id;l.childElements().invoke("remove");l.update('<span><input type="text" id="'+j+'" /></span>');this.autocompleter=new Autocompleter.Local(j,"player-autocomplete",h,{choices:30,selector:this.selector.bind(this),updateElement:this.updateElement.bind(this),scrollIntoView:false,onShow:function(n,o){if(!o.style.position||o.style.position=="absolute"){o.style.position="absolute";Position.clone(n,o,{setHeight:false,setWidth:false,offsetTop:n.offsetHeight})}Effect.Appear(o,{duration:0.15})}});$(j).observe("blur",this.pickBlurred.bind(this));$(j).focus()},updateElement:function(l){var n=l.getAttribute("data-player-id");var m=this.options.players.detect(function(o){if(o.id==n){o.selected=true;return true}else{return false}});if(!this.pickEl){return}if(m){this.pickEl.removeClassName("pick-error");this.pickEl.setAttribute("data-player-id",m.id);this.pickEl.addClassName("player-picked")}try{this.pickEl.childElements().invoke("remove");this.pickEl.update("<span class='pick-player'><strong>"+m.name+"</strong></span>&nbsp;<span class='edit-link pick-player'>Edit</span>")}catch(j){}this.setupPlayerPicks();this.pickEl=null},pickBlurred:function(m){this.removePlayerPickListener();var j=this.getPickEl(m.element());j.childElements().invoke("remove");if(j.getAttribute("data-player-id")){var n=j.getAttribute("data-player-id");var l=this.options.players.detect(function(o){return n==o.id});j.update("<span class='pick-player'><strong>"+l.name+"</strong></span>&nbsp;<span class='edit-link pick-player'>Edit</span>")}else{j.update('<span class="pick-player">Pick a player</span>')}this.setupPlayerPicks();m.stop();return false},removePlayerPickListener:function(){if(this.pickListener){$$(".pick-player").each(function(j){j.stopObserving("click",this.pickListener)}.bind(this))}},setupPlayerPicks:function(){this.removePlayerPickListener();this.pickListener=this.pickClicked.bindAsEventListener(this);$$(".pick-player").each(function(j){j.observe("click",this.pickListener)}.bind(this))},validateEmail:function(l){var m="^[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&'*+\\/0-9=?A-Z^_`a-z{|}~]+.[-!#$%&'*+\\./0-9=?A-Z^_`a-z{|}~]+$";var j=e.getValue();$("error-email").hide();if(!new RegExp(m).test(j)){$("error-email").show();l.stop();return false}return true},validatePlayers:function(l){if($("missing-players")){$("missing-players").hide()}var m=false;ids=[];var j=$$("li.pick-player");j.each(function(o){var n=parseInt(o.id.replace("pick-",""));o.removeClassName("pick-error");if(!o.getAttribute("data-player-id")){o.addClassName("pick-error");if($("missing-players")){$("missing-players").show()}m=true}else{ids[n]=o.getAttribute("data-player-id")}}.bind(this));if(m){return false}else{return ids}},submit:function(n){var p,m,l;$("dp-errors").hide();m=this.validatePlayers();if(this.options.isEmail){l=this.validateEmail(n)}else{l=true}if(this.options.isEmail&&$("valvoline-name").getValue().strip().empty()){var j=false;$("error-name").show()}else{var j=true;if($("error-name")){$("error-name").hide()}}if(!l||!m||!j){n.stop();return false}if(this.options.editToken){p=this.options.editToken}var m=this.validatePlayers();if(!m){n.stop();return false}else{$("player_ids").value=m.join(",")}var o=g.serialize();if(p){o=o+"&edit_token="+p}$("dp-loading").show();new Ajax.Request("/partners/valvoline-nfl-draft-picker/save",{method:"POST",parameters:o,onSuccess:function(r){var q=r.responseJSON;if(!q.success){$("dp-loading").hide();$("dp-errors").update(q.errorMsg);$("dp-errors").show();return false}else{window.location=q.redirectURL}}});n.stop();return false},selector:function(u){var p=[];var q=[];var r=u.getToken();var o=0;var n=$$(".pick-player").map(function(x){return x.getAttribute("data-player-id")});for(var m=0;m<this.options.players.length&&p.length<this.options.players.length;m++){var j=this.options.players[m];if(n.indexOf(j.id)>-1){continue}var l=j.name;var v=" data-player-id='"+j.id+"' ";var w=u.options.ignoreCase?l.toLowerCase().indexOf(r.toLowerCase()):l.indexOf(r);while(w!=-1){if(w==0&&l.length!=r.length){p.push("<li"+v+"><strong>"+l.substr(0,r.length)+"</strong>"+l.substr(r.length)+"</li>");break}else{if(r.length>=u.options.partialChars&&u.options.partialSearch&&w!=-1){if(u.options.fullSearch||/\s/.test(l.substr(w-1,1))){q.push("<li "+v+">"+l.substr(0,w)+"<strong>"+l.substr(w,r.length)+"</strong>"+l.substr(w+r.length)+"</li>");break}}}w=u.options.ignoreCase?l.toLowerCase().indexOf(r.toLowerCase(),w+1):l.indexOf(r,w+1)}}if(q.length){p=p.concat(q.slice(0,u.options.choices-p.length))}return"<ul>"+p.join("")+"</ul>"}};c.init(f);return c});SBN.loadScriptAsync=function(a){var e=document.createElement("SCRIPT"),c=document.getElementsByTagName("SCRIPT")[0];e.type="text/javascript";e.async=true;e.src=a;c.parentNode.insertBefore(e,c)};if(typeof(Control)=="undefined"){Control={}}var $proc=function(a){return typeof(a)=="function"?a:function(){return a}};var $value=function(a){return typeof(a)=="function"?a():a};Object.Event={extend:function(a){a._objectEventSetup=function(c){this._observers=this._observers||{};this._observers[c]=this._observers[c]||[]};a.observe=function(g,c){if(typeof(g)=="string"&&typeof(c)!="undefined"){this._objectEventSetup(g);if(!this._observers[g].include(c)){this._observers[g].push(c)}}else{for(var f in g){this.observe(f,g[f])}}};a.stopObserving=function(e,c){this._objectEventSetup(e);if(e&&c){this._observers[e]=this._observers[e].without(c)}else{if(e){this._observers[e]=[]}else{this._observers={}}}};a.observeOnce=function(f,e){var c=function(){e.apply(this,arguments);this.stopObserving(f,c)}.bind(this);this._objectEventSetup(f);this._observers[f].push(c)};a.notify=function(j){this._objectEventSetup(j);var g=[];var c=$A(arguments).slice(1);try{for(var f=0;f<this._observers[j].length;++f){g.push(this._observers[j][f].apply(this._observers[j][f],c)||null)}}catch(h){if(h==$break){return false}else{throw h}}return g};if(a.prototype){a.prototype._objectEventSetup=a._objectEventSetup;a.prototype.observe=a.observe;a.prototype.stopObserving=a.stopObserving;a.prototype.observeOnce=a.observeOnce;a.prototype.notify=function(j){if(a.notify){var c=$A(arguments).slice(1);c.unshift(this);c.unshift(j);a.notify.apply(a,c)}this._objectEventSetup(j);var c=$A(arguments).slice(1);var g=[];try{if(this.options&&this.options[j]&&typeof(this.options[j])=="function"){g.push(this.options[j].apply(this,c)||null)}for(var f=0;f<this._observers[j].length;++f){g.push(this._observers[j][f].apply(this._observers[j][f],c)||null)}}catch(h){if(h==$break){return false}else{throw h}}return g}}}};Element.addMethods({observeOnce:function(e,f,c){var a=function(){c.apply(this,arguments);Element.stopObserving(e,f,a)};Element.observe(e,f,a)}});Object.extend(Event,(function(){var c=Event.cache;function e(n){if(n._prototypeEventID){return n._prototypeEventID[0]}arguments.callee.id=arguments.callee.id||1;return n._prototypeEventID=[++arguments.callee.id]}function j(n){if(n&&n.include(":")){return"dataavailable"}if(!Prototype.Browser.IE){n={mouseenter:"mouseover",mouseleave:"mouseout"}[n]||n}return n}function a(n){return c[n]=c[n]||{}}function h(p,n){var o=a(p);return o[n]=o[n]||[]}function l(o,n,p){var u=e(o);var r=h(u,n);if(r.pluck("handler").include(p)){return false}var q=function(v){if(!Event||!Event.extend||(v.eventName&&v.eventName!=n)){return false}Event.extend(v);p.call(o,v)};if(!(Prototype.Browser.IE)&&["mouseenter","mouseleave"].include(n)){q=q.wrap(function(x,w){var v=w.relatedTarget;var y=w.currentTarget;if(v&&v.nodeType==Node.TEXT_NODE){v=v.parentNode}if(v&&v!=y&&!v.descendantOf(y)){return x(w)}})}q.handler=p;r.push(q);return q}function m(q,n,o){var p=h(q,n);return p.find(function(r){return r.handler==o})}function f(q,n,o){var p=a(q);if(!p[n]){return false}p[n]=p[n].without(m(q,n,o))}function g(){for(var o in c){for(var n in c[o]){c[o][n]=null}}}if(window.attachEvent){window.attachEvent("onunload",g)}return{observe:function(p,n,q){p=$(p);var o=j(n);var r=l(p,n,q);if(!r){return p}if(p.addEventListener){p.addEventListener(o,r,false)}else{p.attachEvent("on"+o,r)}return p},stopObserving:function(p,n,q){p=$(p);var u=e(p),o=j(n);if(!q&&n){h(u,n).each(function(v){p.stopObserving(n,v.handler)});return p}else{if(!n){Object.keys(a(u)).each(function(v){p.stopObserving(v)});return p}}var r=m(u,n,q);if(!r){return p}if(p.removeEventListener){p.removeEventListener(o,r,false)}else{p.detachEvent("on"+o,r)}f(u,n,q);return p},fire:function(p,o,n){p=$(p);if(p==document&&document.createEvent&&!p.dispatchEvent){p=document.documentElement}var q;if(document.createEvent){q=document.createEvent("HTMLEvents");q.initEvent("dataavailable",true,true)}else{q=document.createEventObject();q.eventType="ondataavailable"}q.eventName=o;q.memo=n||{};if(document.createEvent){p.dispatchEvent(q)}else{p.fireEvent(q.eventType,q)}return Event.extend(q)}}})());Object.extend(Event,Event.Methods);Element.addMethods({fire:Event.fire,observe:Event.observe,stopObserving:Event.stopObserving});Object.extend(document,{fire:Element.Methods.fire.methodize(),observe:Element.Methods.observe.methodize(),stopObserving:Element.Methods.stopObserving.methodize()});(function(){function a(e){var f;if(e.wheelDelta){f=e.wheelDelta/120}else{if(e.detail){f=-e.detail/3}}if(!f){return}var c=Event.element(e).fire("mouse:wheel",{delta:f});if(c.stopped){Event.stop(e);return false}}document.observe("mousewheel",a);document.observe("DOMMouseScroll",a)})();var IframeShim=Class.create({initialize:function(){this.element=new Element("iframe",{style:"position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);display:none",src:"javascript:void(0);",frameborder:0});$(document.body).insert(this.element)},hide:function(){this.element.hide();return this},show:function(){this.element.show();return this},positionUnder:function(a){var a=$(a);var e=a.cumulativeOffset();var c=a.getDimensions();this.element.setStyle({left:e[0]+"px",top:e[1]+"px",width:c.width+"px",height:c.height+"px",zIndex:a.getStyle("zIndex")-1}).show();return this},setBounds:function(a){for(prop in a){a[prop]+="px"}this.element.setStyle(a);return this},destroy:function(){if(this.element){this.element.remove()}return this}});if(typeof(Draggable)!="undefined"){Draggable.prototype.draw=function(m){var l=Position.cumulativeOffset(this.element);if(this.options.ghosting){var a=Position.realOffset(this.element);l[0]+=a[0]-Position.deltaX;l[1]+=a[1]-Position.deltaY}var j=this.currentDelta();l[0]-=j[0];l[1]-=j[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){l[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;l[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var e=[0,1].map(function(p){return(m[p]-l[p]-this.offset[p])}.bind(this));if(this.options.snap){if(typeof this.options.snap=="function"){e=this.options.snap(e[0],e[1],this)}else{if(this.options.snap instanceof Array){e=e.map(function(p,q){return Math.round(p/this.options.snap[q])*this.options.snap[q]}.bind(this))}else{e=e.map(function(p){return Math.round(p/this.options.snap)*this.options.snap}.bind(this))}}}if(this.options.onDraw){this.options.onDraw.bind(this)(e)}else{var c=this.element.style;if(this.options.constrainToViewport){var o=document.viewport.getDimensions();var g=this.element.getDimensions();var h=parseInt(this.element.getStyle("margin-top"));var n=parseInt(this.element.getStyle("margin-left"));var f=[[0-n,0-h],[(o.width-g.width)-n,(o.height-g.height)-h]];if((!this.options.constraint)||(this.options.constraint=="horizontal")){if((e[0]>=f[0][0])&&(e[0]<=f[1][0])){this.element.style.left=e[0]+"px"}else{this.element.style.left=((e[0]<f[0][0])?f[0][0]:f[1][0])+"px"}}if((!this.options.constraint)||(this.options.constraint=="vertical")){if((e[1]>=f[0][1])&&(e[1]<=f[1][1])){this.element.style.top=e[1]+"px"}else{this.element.style.top=((e[1]<=f[0][1])?f[0][1]:f[1][1])+"px"}}}else{if((!this.options.constraint)||(this.options.constraint=="horizontal")){c.left=e[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){c.top=e[1]+"px"}}if(c.visibility=="hidden"){c.visibility=""}}}}if(typeof(Prototype)=="undefined"){throw"Control.Window requires Prototype to be loaded."}if(typeof(IframeShim)=="undefined"){throw"Control.Window requires IframeShim to be loaded."}if(typeof(Object.Event)=="undefined"){throw"Control.Window requires Object.Event to be loaded."}Control.Window=Class.create({initialize:function(c,e){Control.Window.windows.push(this);this.container=false;this.isOpen=false;this.href=false;this.sourceContainer=false;this.ajaxRequest=false;this.remoteContentLoaded=false;this.numberInSequence=Control.Window.windows.length+1;this.indicator=false;this.effects={fade:false,appear:false};this.indicatorEffects={fade:false,appear:false};this.options=Object.extend({beforeOpen:Prototype.emptyFunction,afterOpen:Prototype.emptyFunction,beforeClose:Prototype.emptyFunction,afterClose:Prototype.emptyFunction,height:null,width:null,className:false,position:"center",offsetLeft:0,offsetTop:0,iframe:false,hover:false,indicator:false,closeOnClick:false,iframeshim:true,fade:false,fadeDuration:0.75,draggable:false,onDrag:Prototype.emptyFunction,resizable:false,minHeight:false,minWidth:false,maxHeight:false,maxWidth:false,onResize:Prototype.emptyFunction,constrainToViewport:false,method:"post",parameters:{},onComplete:Prototype.emptyFunction,onSuccess:Prototype.emptyFunction,onFailure:Prototype.emptyFunction,onException:Prototype.emptyFunction,onRemoteContentLoaded:Prototype.emptyFunction,insertRemoteContentAt:false},e||{});this.indicator=this.options.indicator?$(this.options.indicator):false;if(c){if(typeof(c)=="string"&&c.match(Control.Window.uriRegex)){this.href=c}else{this.container=$(c);this.createDefaultContainer(c);if(this.container&&((this.container.readAttribute("href")&&this.container.readAttribute("href")!="")||(this.options.hover&&this.options.hover!==true))){if(this.options.hover&&this.options.hover!==true){this.sourceContainer=$(this.options.hover)}else{this.sourceContainer=this.container;this.href=this.container.readAttribute("href");var a=this.href.match(/^#(.+)$/);if(a&&a[1]){this.container=$(a[1]);this.href=false}else{this.container=false}}this.sourceContainerOpenHandler=function(g){this.open(g);g.stop();return false}.bindAsEventListener(this);this.sourceContainerCloseHandler=function(g){this.close(g)}.bindAsEventListener(this);this.sourceContainerMouseMoveHandler=function(g){this.position(g)}.bindAsEventListener(this);if(this.options.hover){this.sourceContainer.observe("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.observe("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.observe("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.observe("click",this.sourceContainerOpenHandler)}}}}this.createDefaultContainer(c);if(this.options.insertRemoteContentAt===false){this.options.insertRemoteContentAt=this.container}var f={margin:0,position:"absolute",zIndex:Control.Window.initialZIndexForWindow()};if(this.options.width){f.width=$value(this.options.width)+"px"}if(this.options.height){f.height=$value(this.options.height)+"px"}this.container.setStyle(f);if(this.options.className){this.container.addClassName(this.options.className)}this.positionHandler=this.position.bindAsEventListener(this);this.outOfBoundsPositionHandler=this.ensureInBounds.bindAsEventListener(this);this.bringToFrontHandler=this.bringToFront.bindAsEventListener(this);this.container.observe("mousedown",this.bringToFrontHandler);this.container.hide();this.closeHandler=this.close.bindAsEventListener(this);if(this.options.iframeshim){this.iFrameShim=new IframeShim();this.iFrameShim.hide()}this.applyResizable();this.applyDraggable();Event.observe(window,"resize",this.outOfBoundsPositionHandler);this.notify("afterInitialize")},open:function(e){if(this.isOpen){this.bringToFront();return false}if(this.notify("beforeOpen")===false){return false}if(this.options.closeOnClick){if(this.options.closeOnClick===true){this.closeOnClickContainer=$(document.body)}else{if(this.options.closeOnClick=="container"){this.closeOnClickContainer=this.container}else{if(this.options.closeOnClick=="overlay"){Control.Overlay.load();this.closeOnClickContainer=Control.Overlay.container}else{this.closeOnClickContainer=$(this.options.closeOnClick)}}}this.closeOnClickContainer.observe("click",this.closeHandler)}if(this.href&&!this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.href.match(/\.(jpe?g|gif|png|tiff?)$/i)){var a=new Element("img");a.observe("load",function(f){this.getRemoteContentInsertionTarget().insert(f);this.position();if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this,a));a.writeAttribute("src",this.href)}else{if(!this.ajaxRequest){if(this.options.indicator){this.showIndicator()}this.ajaxRequest=new Ajax.Request(this.href,{method:this.options.method,parameters:this.options.parameters,onComplete:function(f){this.notify("onComplete",f);this.ajaxRequest=false}.bind(this),onSuccess:function(f){this.getRemoteContentInsertionTarget().insert(f.responseText);this.notify("onSuccess",f);if(this.notify("onRemoteContentLoaded")!==false){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}}.bind(this),onFailure:function(f){this.notify("onFailure",f);if(this.options.indicator){this.hideIndicator()}}.bind(this),onException:function(f,g){this.notify("onException",f,g);if(this.options.indicator){this.hideIndicator()}}.bind(this)})}}return true}else{if(this.options.iframe&&!this.remoteContentLoaded){this.remoteContentLoaded=true;if(this.options.indicator){this.showIndicator()}this.getRemoteContentInsertionTarget().insert(Control.Window.iframeTemplate.evaluate({href:this.href}));var c=this.container.down("iframe");c.onload=function(){this.notify("onRemoteContentLoaded");if(this.options.indicator){this.hideIndicator()}c.onload=null}.bind(this)}}this.finishOpen(e);return true},close:function(a){if(!this.isOpen||this.notify("beforeClose",a)===false){return false}if(this.options.closeOnClick){this.closeOnClickContainer.stopObserving("click",this.closeHandler)}if(this.options.fade){this.effects.fade=new Effect.Fade(this.container,{queue:{position:"front",scope:"Control.Window"+this.numberInSequence},from:1,to:0,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.iFrameShim.hide()}this.isOpen=false;this.notify("afterClose")}.bind(this)})}else{this.container.hide();if(this.iFrameShim){this.iFrameShim.hide()}}if(this.ajaxRequest){this.ajaxRequest.transport.abort()}if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.stopObserving(window,"resize",this.positionHandler)}if(!this.options.draggable&&this.options.position=="center"){Event.stopObserving(window,"scroll",this.positionHandler)}if(this.options.indicator){this.hideIndicator()}if(!this.options.fade){this.isOpen=false;this.notify("afterClose")}return true},position:function(f){if(this.options.position=="mouse"){var j=[Event.pointerX(f),Event.pointerY(f)];this.container.setStyle({top:j[1]+$value(this.options.offsetTop)+"px",left:j[0]+$value(this.options.offsetLeft)+"px"});return}var l=this.container.getDimensions();var e=document.viewport.getDimensions();Position.prepare();var c=(Position.deltaX+Math.floor((e.width-l.width)/2));var a=(Position.deltaY+((e.height>l.height)?Math.floor((e.height-l.height)/2):0));if(this.options.position=="center"){this.container.setStyle({top:(l.height<=e.height)?((a!=null&&a>0)?a:0)+"px":0,left:(l.width<=e.width)?((c!=null&&c>0)?c:0)+"px":0})}else{if(this.options.position=="relative"){var j=this.sourceContainer.cumulativeOffset();var h=j[1]+$value(this.options.offsetTop);var g=j[0]+$value(this.options.offsetLeft);this.container.setStyle({top:(l.height<=e.height)?(this.options.constrainToViewport?Math.max(0,Math.min(e.height-(l.height),h)):h)+"px":0,left:(l.width<=e.width)?(this.options.constrainToViewport?Math.max(0,Math.min(e.width-(l.width),g)):g)+"px":0})}else{if(this.options.position.length){var h=$value(this.options.position[1])+$value(this.options.offsetTop);var g=$value(this.options.position[0])+$value(this.options.offsetLeft);this.container.setStyle({top:(l.height<=e.height)?(this.options.constrainToViewport?Math.max(0,Math.min(e.height-(l.height),h)):h)+"px":0,left:(l.width<=e.width)?(this.options.constrainToViewport?Math.max(0,Math.min(e.width-(l.width),g)):g)+"px":0})}}}if(this.iFrameShim){this.updateIFrameShimZIndex()}},ensureInBounds:function(){if(!this.isOpen){return}var a=document.viewport.getDimensions();var e=this.container.cumulativeOffset();var c=this.container.getDimensions();if(e.left+c.width>a.width){this.container.setStyle({left:(Math.max(0,a.width-c.width))+"px"})}if(e.top+c.height>a.height){this.container.setStyle({top:(Math.max(0,a.height-c.height))+"px"})}},bringToFront:function(){Control.Window.bringToFront(this);this.notify("bringToFront")},destroy:function(){this.container.stopObserving("mousedown",this.bringToFrontHandler);if(this.draggable){Draggables.removeObserver(this.container);this.draggable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.draggable.destroy()}if(this.resizable){Resizables.removeObserver(this.container);this.resizable.handle.stopObserving("mousedown",this.bringToFrontHandler);this.resizable.destroy()}if(this.container&&!this.sourceContainer){this.container.remove()}if(this.sourceContainer){if(this.options.hover){this.sourceContainer.stopObserving("mouseenter",this.sourceContainerOpenHandler);this.sourceContainer.stopObserving("mouseleave",this.sourceContainerCloseHandler);if(this.options.position=="mouse"){this.sourceContainer.stopObserving("mousemove",this.sourceContainerMouseMoveHandler)}}else{this.sourceContainer.stopObserving("click",this.sourceContainerOpenHandler)}}if(this.iFrameShim){this.iFrameShim.destroy()}Event.stopObserving(window,"resize",this.outOfBoundsPositionHandler);Control.Window.windows=Control.Window.windows.without(this);this.notify("afterDestroy")},applyResizable:function(){if(this.options.resizable){if(typeof(Resizable)=="undefined"){throw"Control.Window requires resizable.js to be loaded."}var a=null;if(this.options.resizable===true){a=new Element("div",{className:"resizable_handle"});this.container.insert(a)}else{a=$(this.options.resziable)}this.resizable=new Resizable(this.container,{handle:a,minHeight:this.options.minHeight,minWidth:this.options.minWidth,maxHeight:this.options.constrainToViewport?function(c){return(document.viewport.getDimensions().height-parseInt(c.style.top||0))-(c.getHeight()-parseInt(c.style.height||0))}:this.options.maxHeight,maxWidth:this.options.constrainToViewport?function(c){return(document.viewport.getDimensions().width-parseInt(c.style.left||0))-(c.getWidth()-parseInt(c.style.width||0))}:this.options.maxWidth});this.resizable.handle.observe("mousedown",this.bringToFrontHandler);Resizables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onResize")}.bind(this)))}},applyDraggable:function(){if(this.options.draggable){if(typeof(Draggables)=="undefined"){throw"Control.Window requires dragdrop.js to be loaded."}var a=null;if(this.options.draggable===true){a=new Element("div",{className:"draggable_handle"});this.container.insert(a)}else{a=$(this.options.draggable)}this.draggable=new Draggable(this.container,{handle:a,constrainToViewport:this.options.constrainToViewport,zindex:this.container.getStyle("z-index"),starteffect:function(){if(Prototype.Browser.IE){this.old_onselectstart=document.onselectstart;document.onselectstart=function(){return false}}}.bind(this),endeffect:function(){document.onselectstart=this.old_onselectstart}.bind(this)});this.draggable.handle.observe("mousedown",this.bringToFrontHandler);Draggables.addObserver(new Control.Window.LayoutUpdateObserver(this,function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.notify("onDrag")}.bind(this)))}},createDefaultContainer:function(a){if(!this.container){this.container=new Element("div",{id:"control_window_"+this.numberInSequence});$(document.body).insert(this.container);if(typeof(a)=="string"&&$(a)==null&&!a.match(/^#(.+)$/)&&!a.match(Control.Window.uriRegex)){this.container.update(a)}}},finishOpen:function(a){this.bringToFront();if(this.options.fade){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(this.effects.fade){this.effects.fade.cancel()}this.effects.appear=new Effect.Appear(this.container,{queue:{position:"end",scope:"Control.Window."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2,afterFinish:function(){if(this.iFrameShim){this.updateIFrameShimZIndex()}this.isOpen=true;this.notify("afterOpen")}.bind(this)})}else{this.container.show()}this.position(a);if(!(this.options.draggable||this.options.resizable)&&this.options.position=="center"){Event.observe(window,"resize",this.positionHandler,false)}if(!this.options.draggable&&this.options.position=="center"){Event.observe(window,"scroll",this.positionHandler,false)}if(!this.options.fade){this.isOpen=true;this.notify("afterOpen")}return true},showIndicator:function(){this.showIndicatorTimeout=window.setTimeout(function(){if(this.options.fade){this.indicatorEffects.appear=new Effect.Appear(this.indicator,{queue:{position:"front",scope:"Control.Window.indicator."+this.numberInSequence},from:0,to:1,duration:this.options.fadeDuration/2})}else{this.indicator.show()}}.bind(this),Control.Window.indicatorTimeout)},hideIndicator:function(){if(this.showIndicatorTimeout){window.clearTimeout(this.showIndicatorTimeout)}this.indicator.hide()},getRemoteContentInsertionTarget:function(){return typeof(this.options.insertRemoteContentAt)=="string"?this.container.down(this.options.insertRemoteContentAt):$(this.options.insertRemoteContentAt)},updateIFrameShimZIndex:function(){if(this.iFrameShim){this.iFrameShim.positionUnder(this.container)}}});Object.extend(Control.Window,{windows:[],baseZIndex:9999,indicatorTimeout:250,iframeTemplate:new Template('<iframe src="#{href}" width="100%" height="100%" frameborder="0"></iframe>'),uriRegex:/^(\/|\#|https?\:\/\/|[\w]+\/)/,bringToFront:function(a){Control.Window.windows=Control.Window.windows.without(a);Control.Window.windows.push(a);Control.Window.windows.each(function(e,f){var c=Control.Window.baseZIndex+f;e.container.setStyle({zIndex:c});if(e.isOpen){if(e.iFrameShim){e.updateIFrameShimZIndex()}}if(e.options.draggable){e.draggable.options.zindex=c}})},open:function(c,e){var a=new Control.Window(c,e);a.open();return a},initialZIndexForWindow:function(a){return Control.Window.baseZIndex+(Control.Window.windows.length-1)}});Object.Event.extend(Control.Window);Control.Window.LayoutUpdateObserver=Class.create({initialize:function(a,c){this.w=a;this.element=$(a.container);this.observer=c},onStart:Prototype.emptyFunction,onEnd:function(c,a){if(a.element==this.element&&this.iFrameShim){this.w.updateIFrameShimZIndex()}},onResize:function(c,a){if(a.element==this.element){this.observer(this.element)}},onDrag:function(c,a){if(a.element==this.element){this.observer(this.element)}}});Control.Overlay={id:"control_overlay",loaded:false,container:false,lastOpacity:0,styles:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:9998},ieStyles:{position:"absolute",top:0,left:0,zIndex:9998},effects:{fade:false,appear:false},load:function(){if(Control.Overlay.loaded){return false}Control.Overlay.loaded=true;Control.Overlay.container=new Element("div",{id:Control.Overlay.id});$(document.body).insert(Control.Overlay.container);if(Prototype.Browser.IE){Control.Overlay.container.setStyle(Control.Overlay.ieStyles);Event.observe(window,"scroll",Control.Overlay.positionOverlay);Event.observe(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.observe("beforeShow",Control.Overlay.positionOverlay)}else{Control.Overlay.container.setStyle(Control.Overlay.styles)}Control.Overlay.iFrameShim=new IframeShim();Control.Overlay.iFrameShim.hide();Event.observe(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.container.hide();return true},unload:function(){if(!Control.Overlay.loaded){return false}Event.stopObserving(window,"resize",Control.Overlay.positionOverlay);Control.Overlay.stopObserving("beforeShow",Control.Overlay.positionOverlay);Event.stopObserving(window,"resize",Control.Overlay.positionIFrameShim);Control.Overlay.iFrameShim.destroy();Control.Overlay.container.remove();Control.Overlay.loaded=false;return true},show:function(a,c){if(Control.Overlay.notify("beforeShow")===false){return false}Control.Overlay.lastOpacity=a;Control.Overlay.positionIFrameShim();Control.Overlay.iFrameShim.show();if(c){if(typeof(Effect)=="undefined"){throw"Control.Window requires effects.js to be loaded."}if(Control.Overlay.effects.fade){Control.Overlay.effects.fade.cancel()}Control.Overlay.effects.appear=new Effect.Appear(Control.Overlay.container,{queue:{position:"end",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterShow")},from:0,to:Control.Overlay.lastOpacity,duration:(c===true?0.75:c)/2})}else{Control.Overlay.container.setStyle({opacity:a||1});Control.Overlay.container.show();Control.Overlay.notify("afterShow")}return true},hide:function(a){if(Control.Overlay.notify("beforeHide")===false){return false}if(Control.Overlay.effects.appear){Control.Overlay.effects.appear.cancel()}Control.Overlay.iFrameShim.hide();if(a){Control.Overlay.effects.fade=new Effect.Fade(Control.Overlay.container,{queue:{position:"front",scope:"Control.Overlay"},afterFinish:function(){Control.Overlay.notify("afterHide")},from:Control.Overlay.lastOpacity,to:0,duration:(a===true?0.75:a)/2})}else{Control.Overlay.container.hide();Control.Overlay.notify("afterHide")}return true},positionIFrameShim:function(){if(Control.Overlay.container.visible()){Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container)}},positionOverlay:function(){Control.Overlay.container.setStyle({width:document.body.clientWidth+"px",height:document.body.clientHeight+"px"})}};Object.Event.extend(Control.Overlay);Control.ToolTip=Class.create(Control.Window,{initialize:function($super,a,e,c){$super(e,Object.extend(Object.extend(Object.clone(Control.ToolTip.defaultOptions),c||{}),{position:"mouse",hover:a}))}});Object.extend(Control.ToolTip,{defaultOptions:{offsetLeft:10}});Control.Modal=Class.create(Control.Window,{initialize:function($super,a,c){Control.Modal.InstanceMethods.beforeInitialize.bind(this)();$super(a,Object.extend(Object.clone(Control.Modal.defaultOptions),c||{}))}});Object.extend(Control.Modal,{defaultOptions:{overlayOpacity:0.5,closeOnClick:"overlay"},current:false,open:function(a,c){var e=new Control.Modal(a,c);e.open();return e},close:function(){if(Control.Modal.current){Control.Modal.current.close()}},InstanceMethods:{beforeInitialize:function(){Control.Overlay.load();this.overlayFinishedOpening=false;this.observe("beforeOpen",Control.Modal.Observers.beforeOpen.bind(this));this.observe("afterOpen",Control.Modal.Observers.afterOpen.bind(this));this.observe("afterClose",Control.Modal.Observers.afterClose.bind(this))}},Observers:{beforeOpen:function(){if(!this.overlayFinishedOpening){Control.Overlay.observeOnce("afterShow",function(){this.overlayFinishedOpening=true;this.open()}.bind(this));Control.Overlay.show(this.options.overlayOpacity,this.options.fade?this.options.fadeDuration:false);throw $break}else{Control.Window.windows.without(this).invoke("close")}},afterOpen:function(){Control.Modal.current=this},afterClose:function(){Control.Overlay.hide(this.options.fade?this.options.fadeDuration:false);Control.Modal.current=false;this.overlayFinishedOpening=false}}});Control.LightBox=Class.create(Control.Window,{initialize:function($super,a,c){this.allImagesLoaded=false;if(c.modal){var c=Object.extend(Object.clone(Control.LightBox.defaultOptions),c||{});c=Object.extend(Object.clone(Control.Modal.defaultOptions),c);c=Control.Modal.InstanceMethods.beforeInitialize.bind(this)(c);$super(a,c)}else{$super(a,Object.extend(Object.clone(Control.LightBox.defaultOptions),c||{}))}this.hasRemoteContent=this.href&&!this.options.iframe;if(this.hasRemoteContent){this.observe("onRemoteContentLoaded",Control.LightBox.Observers.onRemoteContentLoaded.bind(this))}else{this.applyImageObservers()}this.observe("beforeOpen",Control.LightBox.Observers.beforeOpen.bind(this))},applyImageObservers:function(){var a=this.getImages();this.numberImagesToLoad=a.length;this.numberofImagesLoaded=0;a.each(function(c){c.observe("load",function(e){++this.numberofImagesLoaded;if(this.numberImagesToLoad==this.numberofImagesLoaded){this.allImagesLoaded=true;this.onAllImagesLoaded()}}.bind(this,c));c.hide()}.bind(this))},onAllImagesLoaded:function(){this.getImages().each(function(a){this.showImage(a)}.bind(this));if(this.hasRemoteContent){if(this.options.indicator){this.hideIndicator()}this.finishOpen()}else{this.open()}},getImages:function(){return this.container.select(Control.LightBox.imageSelector)},showImage:function(a){a.show()}});Object.extend(Control.LightBox,{imageSelector:"img",defaultOptions:{},Observers:{beforeOpen:function(){if(!this.hasRemoteContent&&!this.allImagesLoaded){throw $break}},onRemoteContentLoaded:function(){this.applyImageObservers();if(!this.allImagesLoaded){throw $break}}}});if(typeof(Prototype)=="undefined"){throw"Control.Tabs requires Prototype to be loaded."}if(typeof(Object.Event)=="undefined"){throw"Control.Tabs requires Object.Event to be loaded."}Control.Tabs=Class.create({initialize:function(e,c){if(!$(e)){throw"Control.Tabs could not find the element: "+e}this.activeContainer=false;this.activeLink=false;this.containers=$H({});this.links=[];Control.Tabs.instances.push(this);this.options={beforeChange:Prototype.emptyFunction,afterChange:Prototype.emptyFunction,hover:false,linkSelector:"li a",setClassOnContainer:false,activeClassName:"active",defaultTab:"first",autoLinkExternal:true,targetRegExp:/#(.+)$/,showFunction:Element.show,hideFunction:Element.hide};Object.extend(this.options,c||{});(typeof(this.options.linkSelector=="string")?$(e).select(this.options.linkSelector):this.options.linkSelector($(e))).findAll(function(g){var h=Prototype.Browser.WebKit?decodeURIComponent(g.href):g.href;var f=Prototype.Browser.WebKit?decodeURIComponent(window.location.href):window.location.href;return(/^#/).exec((h).replace(f.split("#")[0],""))}).each(function(f){this.addTab(f)}.bind(this));this.containers.values().each(Element.hide);if(this.options.defaultTab=="first"){this.setActiveTab(this.links.first())}else{if(this.options.defaultTab=="last"){this.setActiveTab(this.links.last())}else{this.setActiveTab(this.options.defaultTab)}}var a=this.options.targetRegExp.exec(window.location);if(a&&a[1]){a[1].split(",").each(function(f){this.setActiveTab(this.links.find(function(g){return g.key==f}))}.bind(this))}if(this.options.autoLinkExternal){$A(document.getElementsByTagName("a")).each(function(f){if(!this.links.include(f)){var g=f.href.replace(window.location.href.split("#")[0],"");if(g.substring(0,1)=="#"){if(this.containers.keys().include(g.substring(1))){$(f).observe("click",function(j,h){this.setActiveTab(h.substring(1))}.bindAsEventListener(this,g))}}}}.bind(this))}},addTab:function(c){this.links.push(c);c.key=c.getAttribute("href").replace(window.location.href.split("#")[0],"").split("#").last().replace(/#/,"");var a=$(c.key);if(!a){throw"Control.Tabs: #"+c.key+" was not found on the page."}this.containers.set(c.key,a);c[this.options.hover?"onmouseover":"onclick"]=function(e){if(window.event){Event.stop(window.event)}this.setActiveTab(e);return false}.bind(this,c)},setActiveTab:function(a){if(!a&&typeof(a)=="undefined"){return}if(typeof(a)=="string"){this.setActiveTab(this.links.find(function(c){return c.key==a}))}else{if(typeof(a)=="number"){this.setActiveTab(this.links[a])}else{if(this.notify("beforeChange",this.activeContainer,this.containers.get(a.key))===false){return}if(this.activeContainer){this.options.hideFunction(this.activeContainer)}this.links.each(function(c){(this.options.setClassOnContainer?$(c.parentNode):c).removeClassName(this.options.activeClassName)}.bind(this));(this.options.setClassOnContainer?$(a.parentNode):a).addClassName(this.options.activeClassName);this.activeContainer=this.containers.get(a.key);this.activeLink=a;this.options.showFunction(this.containers.get(a.key));this.notify("afterChange",this.containers.get(a.key))}}},next:function(){this.links.each(function(c,a){if(this.activeLink==c&&this.links[a+1]){this.setActiveTab(this.links[a+1]);throw $break}}.bind(this))},previous:function(){this.links.each(function(c,a){if(this.activeLink==c&&this.links[a-1]){this.setActiveTab(this.links[a-1]);throw $break}}.bind(this))},first:function(){this.setActiveTab(this.links.first())},last:function(){this.setActiveTab(this.links.last())}});Object.extend(Control.Tabs,{instances:[],findByTabId:function(a){return Control.Tabs.instances.find(function(c){return c.links.find(function(e){return e.key==a})})}});Object.Event.extend(Control.Tabs);HoverMenu=Class.create();HoverMenu.menus=new Array();HoverMenu.hideAll=function(){HoverMenu.menus.each(function(a){Element.hide(a.menu)})};HoverMenu.prototype={initialize:function(a){this.link=$(a);this.menu=$(this.menuId(this.link.id));this.head=$(this.headId(this.link.id));HoverMenu.menus.push(this);Event.observe(this.link.id,"mouseover",this.linkOver.bindAsEventListener(this));Event.observe(this.link.id,"mouseout",this.mouseOut.bindAsEventListener(this));Event.observe(this.menu.id,"mouseout",this.mouseOut.bindAsEventListener(this))},menuId:function(a){return a+"_menu"},headId:function(a){return this.menuId(a)+"_head"},linkOver:function(a){HoverMenu.menus.each(function(c){if(c!=this){Element.hide(c.menu)}});this.menu.show()},mouseOut:function(a){if(!Position.within(this.menu,Event.pointerX(a),Event.pointerY(a))&&(this.head==null||!Position.within(this.head,Event.pointerX(a),Event.pointerY(a)))&&!Position.within(this.link,Event.pointerX(a),Event.pointerY(a))){this.menu.hide()}}};SBN.Facebook={SDK:{init:function(a){window.fbAsyncInit=function(){FB.init({appId:a,xfbml:true})};(function(){var c=document.createElement("script");c.async=true;c.src=document.location.protocol+"//connect.facebook.net/en_US/all.js";document.getElementById("fb-root").appendChild(c)}())}},Connect:{initModal:function(a,e){e=Object.extend({overlayOpacity:0.5},e||{});var c=new Control.Modal(null,e);c.container.insert('<iframe class="sbn_facebook_iframe" frameborder="0" width="100%" height="100%" allowtransparency="true" src="'+a+'" style="overflow:hidden;display:none"></iframe>');c.open();$("control_overlay").innerHTML='<div class="control_overlay_spinner"></div>'},displayModal:function(){$$(".sbn_facebook_iframe").each(function(a){a.show()});setTimeout(function(){$("control_overlay").innerHTML=""},1000)}}};shortcut={all_shortcuts:{},add:function(c,l,f){var j={type:"keydown",propagate:false,disable_in_input:false,target:document,keycode:false};if(!f){f=j}else{for(var a in j){if(typeof f[a]=="undefined"){f[a]=j[a]}}}var h=f.target;if(typeof f.target=="string"){h=document.getElementById(f.target)}var e=this;c=c.toLowerCase();var g=function(q){q=q||window.event;if(f.disable_in_input){var n;if(q.target){n=q.target}else{if(q.srcElement){n=q.srcElement}}if(n.nodeType==3){n=n.parentNode}if(n.tagName=="INPUT"||n.tagName=="TEXTAREA"){return}}if(q.keyCode){code=q.keyCode}else{if(q.which){code=q.which}}var p=String.fromCharCode(code).toLowerCase();if(code==188){p=","}if(code==190){p="."}var w=c.split("+");var v=0;var r={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};var o={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123};var u={shift:{wanted:false,pressed:false},ctrl:{wanted:false,pressed:false},alt:{wanted:false,pressed:false},meta:{wanted:false,pressed:false}};if(q.ctrlKey){u.ctrl.pressed=true}if(q.shiftKey){u.shift.pressed=true}if(q.altKey){u.alt.pressed=true}if(q.metaKey){u.meta.pressed=true}for(var m=0;k=w[m],m<w.length;m++){if(k=="ctrl"||k=="control"){v++;u.ctrl.wanted=true}else{if(k=="shift"){v++;u.shift.wanted=true}else{if(k=="alt"){v++;u.alt.wanted=true}else{if(k=="meta"){v++;u.meta.wanted=true}else{if(k.length>1){if(o[k]==code){v++}}else{if(f.keycode){if(f.keycode==code){v++}}else{if(p==k){v++}else{if(r[p]&&q.shiftKey){p=r[p];if(p==k){v++}}}}}}}}}}if(v==w.length&&u.ctrl.pressed==u.ctrl.wanted&&u.shift.pressed==u.shift.wanted&&u.alt.pressed==u.alt.wanted&&u.meta.pressed==u.meta.wanted){l(q);if(!f.propagate){q.cancelBubble=true;q.returnValue=false;if(q.stopPropagation){q.stopPropagation();q.preventDefault()}return false}}};this.all_shortcuts[c]={callback:g,target:h,event:f.type};if(h.addEventListener){h.addEventListener(f.type,g,false)}else{if(h.attachEvent){h.attachEvent("on"+f.type,g)}else{h["on"+f.type]=g}}},remove:function(a){a=a.toLowerCase();var f=this.all_shortcuts[a];delete (this.all_shortcuts[a]);if(!f){return}var c=f.event;var e=f.target;var g=f.callback;if(e.detachEvent){e.detachEvent("on"+c,g)}else{if(e.removeEventListener){e.removeEventListener(c,g,false)}else{e["on"+c]=false}}}};SBN.Poll=Class.create();SBN.Poll.prototype={initialize:function(a){this.poll_container=$(a);this.max_width=this.poll_container.getWidth();this.update_interval=13;this.duration=2000;this.options=[];this.poll_background_image_length=800},animateResults:function(e){e=Object.extend({renderImmediately:false},e);if(e.renderImmediately){this.duration=0}var c=[];var a=Selector.findChildElements(this.poll_container,[".poll_option"]);a.each(function(f){var g=Selector.findChildElements(f,[".poll_option_bar"]).first();g.poll_option_percentage=Selector.findChildElements(f,[".poll_option_percentage"]).first();g.percentage=g.poll_option_percentage.innerHTML.replace("%","");g.max_width=this.max_width*g.percentage/100;g.vote_count_container=Selector.findChildElements(f,[".vote_count"]).first();g.vote_count=g.vote_count_container.innerHTML;this.options.push(g);g.poll_option_percentage.innerHTML="0%";g.poll_option_percentage.show()}.bind(this));this.startTime=new Date().getTime();this.from=0;this.to=1;this.timer=setInterval(this.step.bind(this),this.update_interval)},step:function(){var h=new Date().getTime();if(h>=this.duration+this.startTime){clearInterval(this.timer);this.timer=null;this.now=this.to;this.options.each(function(l){l.poll_option_percentage.innerHTML=l.percentage+"%";l.vote_count_container.innerHTML=l.vote_count;var j=(l.percentage/100*this.max_width)-this.poll_background_image_length;l.style.backgroundPosition=j+"px"}.bind(this))}else{var e=(h-this.startTime)/(this.duration);var a=((-Math.cos(e*Math.PI)/2)+0.5)*(this.to-this.from)+this.from;for(var f=0;f<this.options.length;++f){var g=this.options[f];g.poll_option_percentage.innerHTML=Math.round((a*g.percentage))+"%";g.vote_count_container.innerHTML=Math.round(a*g.vote_count);var c=(a*g.max_width)-this.poll_background_image_length;g.style.backgroundPosition=c+"px"}}}};if(!SBN){var SBN={}}SBN.Comments={};SBN.Comments.UPDATE_INTERVAL=20;SBN.Comments.SLOW_UPDATE_INTERVAL=60;SBN.Comments.current_update_interval=SBN.Comments.UPDATE_INTERVAL;SBN.Comments.auto_updater=null;SBN.Comments.scrollOffset=-200;SBN.Comments.previewDisabled=new Hash();SBN.Comments.empty_count=0;SBN.Comments.lastRequestId=0;SBN.Comments.nodeId=0;SBN.Comments.Cycle={};SBN.Comments.Cycle.list=new Array();SBN.Comments.Cycle.index=-1;SBN.Comments.Cycle.lookingAtComment=true;SBN.Comments.convertDates=function(){var c=$$("a.tz-convert");for(var a=0;a<c.length;a++){b=c[a];t=b.innerHTML;d=new Date(t);b.innerHTML=SBN.Comments.convertTime(SBN.Comments.user_tz,d);b.removeClassName("tz-convert")}};Date.prototype.getAMPMHour=function(){var a=this.getHours();return(a==0)?12:(a>12?a-12:a)};Date.prototype.getAMPM=function(){return(this.getHours()<12)?"AM":"PM"};Date.padded2=function(a){var c=parseInt(a,10);if(a<10){c="0"+c}return c};Date.prototype.getPaddedMinutes=function(){return Date.padded2(this.getMinutes())};SBN.Comments.convertTime=function(a,c){offset=a[1];tz=a[0];utc=c.getTime()+(c.getTimezoneOffset()*60000);nd=new Date(utc+(3600000*offset));months=$w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");month=months[nd.getMonth()];s=month+" "+nd.getDate()+", "+nd.getFullYear()+" "+nd.getAMPMHour()+":"+nd.getPaddedMinutes()+" "+nd.getAMPM()+" "+tz;return s};SBN.Comments.checkInterval=function(a){slow_mode=(SBN.Comments.current_update_interval==SBN.Comments.SLOW_UPDATE_INTERVAL);if(!slow_mode&&(SBN.Comments.current_update_interval!=a)){SBN.Comments.current_update_interval=a;SBN.Comments.start_auto_update()}};SBN.Comments.checkEmptyCount=function(a){SBN.Comments.empty_count=a;var c=false;if(a==0&&(SBN.Comments.current_update_interval!=SBN.Comments.UPDATE_INTERVAL)){SBN.Comments.current_update_interval=SBN.Comments.UPDATE_INTERVAL;c=true}else{if(SBN.Comments.empty_count==5){SBN.Comments.current_update_interval=SBN.Comments.SLOW_UPDATE_INTERVAL;c=true}}if(c){SBN.Comments.start_auto_update()}};SBN.Comments.Cycle.previous=function(){if(!SBN.Comments.Cycle.lookingAtComment){++SBN.Comments.Cycle.index}var a=(SBN.Comments.Cycle.index<=0)?SBN.Comments.Cycle.list.length-1:SBN.Comments.Cycle.index-1;SBN.Comments.Cycle.goToIndex(a)};SBN.Comments.Cycle.next=function(){var a=(SBN.Comments.Cycle.index>=SBN.Comments.Cycle.list.length-1)?0:SBN.Comments.Cycle.index+1;SBN.Comments.Cycle.goToIndex(a)};SBN.Comments.Cycle.remove=function(){if(!SBN.Comments.Cycle.lookingAtComment){return}else{var c=SBN.Comments.Cycle.currentComment();if(c==null){return}else{SBN.Comments.Cycle.notCurrent(c);SBN.Comments.Cycle.list.splice(SBN.Comments.Cycle.index,1);c.removeClassName("new");var a=$(c.id.replace("inner","auto_update_link"));if(a){a.remove()}SBN.Comments.Cycle.lookingAtComment=false;--SBN.Comments.Cycle.index;if($("new_comments_list")&&$("new_comments_list").innerHTML.strip()==""){$("autoupdate_info").hide()}}}};SBN.Comments.Cycle.removeAll=function(){if(SBN.Comments.Cycle.list.size()>=50){SBN.openModalWithContents("Unmarking "+SBN.Comments.Cycle.list.size()+" comments.",{overlayDisplay:false,fade:true,fadeDuration:0});setTimeout(SBN.Comments.doRemoveAll,100)}else{SBN.Comments.doRemoveAll()}};SBN.Comments.doRemoveAll=function(){$("autoupdate_info").hide();var c=SBN.Comments.Cycle.currentComment();var a=SBN.Comments.Cycle.list;SBN.Comments.Cycle.list=new Array();if(c!=null){SBN.Comments.Cycle.notCurrent(c)}a.each(function(f){var e=$(f);e.removeClassName("new")});setTimeout(Control.Modal.close,100)};SBN.Comments.Cycle.currentComment=function(){if(SBN.Comments.Cycle.index<0||SBN.Comments.Cycle.index>=SBN.Comments.Cycle.list.length){return null}else{return $(SBN.Comments.Cycle.list[SBN.Comments.Cycle.index])}};SBN.Comments.Cycle.goToComment=function(a){SBN.Comments.Cycle.goToIndex(SBN.Comments.Cycle.list.indexOf(a))};SBN.Comments.Cycle.goToIndex=function(a){if(SBN.Comments.Cycle.list.length==0){return}else{var e=SBN.Comments.Cycle.currentComment();if(e!=null){SBN.Comments.Cycle.notCurrent(e)}SBN.Comments.Cycle.index=a;var c=SBN.Comments.Cycle.currentComment();SBN.Comments.Cycle.current(c);SBN.Comments.scrollToComment(c);SBN.Comments.Cycle.lookingAtComment=true}};SBN.Comments.Cycle.current=function(a){a.addClassName("cfocus")};SBN.Comments.Cycle.notCurrent=function(a){a.removeClassName("cfocus")};SBN.Comments.Cycle.reply=function(){var a=SBN.Comments.Cycle.currentComment();replyLink=$(a.id.replace("inner","reply"));if(replyLink){replyLink.onclick()}};SBN.Comments.Cycle.refresh=function(){var a=SBN.Comments.Cycle.currentComment();var c=SBN.Comments.Cycle.index;SBN.Comments.Cycle.list=$$("#"+SBN.Comments.nodeId+"_comments_list .new").collect(function(f){return f.id});if(a){SBN.Comments.Cycle.index=SBN.Comments.Cycle.list.indexOf(a.id);if(SBN.Comments.Cycle.index>c){SBN.Comments.scrollToComment(a,{duration:0})}}};SBN.Comments.cancelMainForm=function(){$(SBN.Comments.nodeId+"_main_form_cancel").hide();Element.update(SBN.Comments.nodeId+"_comment_preview","")};SBN.Comments.toggleComment=function(f,e){var e=Object.extend({force:"none"},e);var a=$(f);var c=(e.force=="expanded")||(e.force!="collapsed"&&!a.visible());if(c){a.show()}else{a.hide()}};SBN.Comments.loadModeratorTools=function(a){new Ajax.Request("/posts/load_comment_moderator_tools/"+a,{asynchronous:true,evalScripts:true})};SBN.Comments.loadTools=function(a){new Ajax.Request("/posts/load_comment_tools/"+a,{asynchronous:true,evalScripts:true})};SBN.Comments.scrollToComment=function(c,a){a=Object.extend({duration:0.2,offset:SBN.Comments.scrollOffset},a||{});new Effect.ScrollTo(c,a)};SBN.Comments.scrollTo=function(a){new Effect.ScrollTo(a,{duration:0.2})};SBN.Comments.scrollToCommentAndHighlight=function(a){SBN.Comments.scrollToComment(a);SBN.Comments.highlight(a)};SBN.Comments.registerPreviewDisableHandler=function(a,f,c){var e=function(){SBN.Comments.disablePreview(f,c)};a.each(function(h){Event.observe(h,"keypress",e);var g=$(h);Object.Event.extend(g);g.observe("afterTagInsert",e)})};SBN.Comments.disablePreview=function(f,c){if(SBN.Comments.previewDisabled.get(f)){return}else{var e=$(f);var a=$(c);if(a&&!a.disabled){a.disabled=true;a.className=a.className+" disabled";e.childElements().first().addClassName("disabled");SBN.Comments.previewDisabled.set(f,true)}}};SBN.Comments.highlight=function(a){new Effect.Highlight(a,{duration:1})};SBN.Comments.initTextEditor=function(){SBN.TextEditor.init({})};SBN.Comments.updateCommentCountIndicator=function(){var a=$$(".citem").length;$$(".update-with-count").each(function(c){c.update(a)})};SBN.Comments.check_for_updates=function(){SBN.Comments.updateCommentCountIndicator();new Ajax.Request("/posts/ajax_comments_update/"+post_id+"?last_version="+post_version+"&last_id="+SBN.Comments.lastId+"&type=Entry&request_id="+ ++SBN.Comments.lastRequestId,{asynchronous:true,evalScripts:true})};SBN.Comments.start_auto_update=function(){SBN.Comments.stop_auto_update();SBN.Comments.auto_updater=new PeriodicalExecuter(function(){SBN.Comments.check_for_updates()},SBN.Comments.current_update_interval)};SBN.Comments.stop_auto_update=function(){if(SBN.Comments.auto_updater){SBN.Comments.auto_updater.stop();SBN.Comments.auto_updater=null}};SBN.Comments.toggleAutoUpdate=function(){if($("auto_update_comments").checked){SBN.Comments.start_auto_update(true)}else{SBN.Comments.stop_auto_update()}new Ajax.Request("/posts/toggle_auto_refresh_comments/?toggle="+$("auto_update_comments").checked,{asynchronous:true,evalScripts:true})};SBN.Comments.toggleExpanded=function(){var a=$F("expanded_comments")=="true"?"expanded":"collapsed";$$(".cbody").each(function(c){SBN.Comments.toggleComment(c,{force:a})})};SBN.Comments.previewComment=function(a){new Ajax.Request("/posts/preview_comment",{asynchronous:true,evalScripts:true,parameters:Form.serialize(a),onFailure:function(c){alert("Oops, your comment couldn't be previewed. Please wait a few seconds and then try again.")}});return false};SBN.Comments.hideCommentForm=function(a){SBN.clearChildren("comment_form_container_"+a)};SBN.Comments.postComment=function(c,a){if(a==null){if(Prototype.BrowserFeatures.SelectorsAPI){a=$(c).querySelector("input[type='submit']")}else{a=$(c).getElementsBySelector("input[type='submit']")[0]}}if(a){SBN.Comments.disableButton(a)}new Ajax.Request("/posts/comment",{asynchronous:true,evalScripts:true,parameters:Form.serialize(c),onFailure:function(e){alert("Oops, your comment couldn't be posted. Please wait a few seconds and then try again.");SBN.Comments.enableButton(a)}});return false};SBN.Comments.disableButton=function(a){a=$(a);a.disabled=true;a.addClassName("disabled");a.value="Posting"};SBN.Comments.enableButton=function(a){a=$(a);a.disabled=false;a.removeClassName("disabled");a.value="Post"};SBN.Comments.showFormattingGuide=function(){Effect.BlindDown("comment_formatting_guide",{duration:0.2});$("show_formatting_guide_link").hide();$("hide_formatting_guide_link").show()};SBN.Comments.hideFormattingGuide=function(){Effect.BlindUp("comment_formatting_guide",{duration:0.2});$("hide_formatting_guide_link").hide();$("show_formatting_guide_link").show()};SBN.Comments.displayReplyForm=function(a,h){if(SBN.TextEditor.currentCommentForm!=undefined){SBN.Comments.hideCommentForm(SBN.TextEditor.currentCommentForm)}if($("comment_reply_form_"+h)){return}var e="comment_for_preview";var m=e+"_title_"+h;var n=e+"_body_"+h;var l=e+"_submit_"+h;var c=e+"_cancel_"+h;var p="comment_preview_"+h;var j="comment_preview_"+h+"_post_button";var o="comment_without_preview_button_"+h;var g='<div id="comment_preview_'+h+'"></div>';g+='<div class="creply" id="comment_reply_form_'+h+'">';g+='<div class="comment cform clearfix">';g+="<h3>Post a Reply</h3>";g+='<form action="/posts/preview_comment" id="comment_reply_form_'+a+'" method="post" onsubmit="SBN.Comments.previewComment(this);return false;">';g+='<input type="hidden" name="id" value="'+a+'" />';g+='<input type="hidden" name="comment_for_preview[parent_id]" value="'+h+'">';if(!SBN.Comments.disableTitles){g+='<input id="'+m+'" tabindex="22" name="comment_for_preview[title]" size="50" maxlength="255" type="text" class="reply-title" />'}g+=SBN.Comments.getBasicEditorButtons(h);g+='<textarea cols="64" id="'+n+'" name="comment_for_preview[body]" rows="8" tabindex="23"></textarea>';g+='<p class="center submit"><input name="commit" id="'+l+'" type="submit" value="preview" tabindex="24" class="button big black"/>';g+='<input id="'+o+'" onclick="SBN.Comments.postComment(this.form, this);" tabindex="25" type="button" value="post" class="button big"/>';g+='<input name="cancel" type="button" value="cancel" id="'+c+'" tabindex="26" class="button big black" onclick="SBN.Comments.hideCommentForm(\''+h+"')\" />";g+="</p>";g+="</div>";$("comment_form_container_"+h).innerHTML+=g;SBN.TextEditor.currentCommentForm=h;if(SBN.Comments.disableTitles){$(n).focus();SBN.Comments.registerPreviewDisableHandler([n],p,j)}else{$(m).focus();SBN.Comments.registerPreviewDisableHandler([m,n],p,j)}};SBN.Comments.initializeKeyboardShortcuts=function(){shortcut.add("Shift+a",function(){SBN.Comments.Cycle.removeAll()},{disable_in_input:true});shortcut.add("Shift+c",function(){SBN.Comments.Cycle.previous()},{disable_in_input:true});shortcut.add("c",function(){SBN.Comments.Cycle.next()},{disable_in_input:true});shortcut.add("j",function(){SBN.Comments.Cycle.next()},{disable_in_input:true});shortcut.add("k",function(){SBN.Comments.Cycle.previous()},{disable_in_input:true});shortcut.add("x",function(){SBN.Comments.Cycle.remove()},{disable_in_input:true});shortcut.add("z",function(){SBN.Comments.Cycle.remove();SBN.Comments.Cycle.next()},{disable_in_input:true});shortcut.add("r",function(){SBN.Comments.Cycle.reply()},{disable_in_input:true})};document.observe("dom:loaded",function(){$$(".has-data-cap").each(function(c){var e=c.readAttribute("data-cap");if(e!=null){c.update(e)}});if($("byline-prerender")!==null){var a=$("byline-prerender").innerHTML;$("byline-prerender").remove();$("byline-postrender").innerHTML=a}});SBN.Comments.resetPreviewForm=function(a){$(a+"_comment_for_preview_body").value="";if($("send-to-facebook")){$("send-to-facebook").checked=false}if(SBN.Comments.disableTitles){$(a+"_comment_for_preview_body").focus()}else{$(a+"_comment_for_preview_title").value="";$(a+"_comment_for_preview_title").focus()}};SBN.Comments.getCommentToolsElement=function(a){comment_element=$("comment_tools_"+a);return comment_element};SBN.Comments.flagged=function(e,a,c){comment_element=SBN.Comments.getCommentToolsElement(e);if(a=="recommended"){comment_element.addClassName("user-recommended");comment_element.removeClassName("user-flagged");SBN.Comments.updateRecCount(e,c)}else{comment_element.removeClassName("user-recommended");comment_element.addClassName("user-flagged")}};SBN.Comments.updateRecCount=function(c,a){rec_count_element=$("comment_rec-count_"+c);if(parseInt(a,10)>0){rec_count_element.innerHTML="("+a+")"}else{rec_count_element.innerHTML=""}};SBN.Comments.unflagged=function(c,a){comment_element=SBN.Comments.getCommentToolsElement(c);comment_element.removeClassName("user-recommended");comment_element.removeClassName("user-flagged");SBN.Comments.updateRecCount(c,a)};SBN.Comments.unflag=function(c){var e=new Hash();e.set("type","Comment");e.set("id",c);var a="/flags/unflag/";new Ajax.Request(a,{parameters:e.toQueryString()})};SBN.Comments.flag=function(a){if(SBN.Comments.commentIsFlagged(a)){SBN.Comments.unflag(a)}else{SBN.openModal("/flags/flag/"+a+"?type=Comment")}return false};SBN.Comments.commentIsFlagged=function(a){comment_element=SBN.Comments.getCommentToolsElement(a);return comment_element.hasClassName("user-recommended")||comment_element.hasClassName("user-flagged")};SBN.Comments.recommend=function(c){if(SBN.Comments.commentIsFlagged(c)){SBN.Comments.unflag(c)}else{var e=new Hash();e.set("type","Comment");e.set("id",c);e.set("format","json");var a="/flags/recommend/";element="rec_link_"+c;icon_element="rec_icon_"+c;new Ajax.Request(a,{parameters:e.toQueryString()})}return false};SBN.Comments.hideAutoUpdateInfo=function(){$("autoupdate_info").hide()};SBN.FanConPoll={setSlideOutput:function(a){$("fancon-value").update(a)},setVote:function(a){$("fan_con_vote_value").value=a},init:function(){document.observe("dom:loaded",function(){this.handleWidth=$("fancon-slider-handle").getWidth();this.barWidth=$("fancon-slider-bar").getWidth();this.slider=new Control.Slider("fancon-slider-handle","fancon-slider-bar",{range:$R(1,10),sliderValue:5,values:$R(1,10),onSlide:function(a){this.setSlideOutput(a*10);this.setVote(a*10)}.bind(this),onChange:function(a){this.setSlideOutput(a*10);this.setVote(a*10)}.bind(this)});this.setVote(50);this.setSlideOutput(this.slider.value)}.bind(this))}};if(!("console" in window)){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i){window.console[names[i]]=function(){}}}Element.Methods.selectFirst=function(c,a){var e=c.getElementsBySelector(a);return e.size()>0?e[0]:null};Object.extend(Ajax.InPlaceEditor.prototype,{getText:function(){if(this.options.getTextCallback){return this.options.getTextCallback()}else{return this.element.innerHTML.unescapeHTML()}}});Object.extend(Number.prototype,{format:function(){var g=new Number(this)+"";var a=g.split(".");var f=a[0];var c=a.length>1?"."+a[1]:"";var e=/(\d+)(\d{3})/;while(e.test(f)){f=f.replace(e,"$1,$2")}return f+c},toPercentage:function(c){if(c==undefined){c=2}if(isNaN(this)){a=0}else{var e=this*100;var a=e.toFixed(c);if(a==Math.round(e)){a=e}}return a.toString()+"%"},isDecimal:function(){return Math.round(this)!=this}});Carousel=Class.create();Carousel.prototype=Object.extend(Abstract,{initialize:function(a,f,c,e){this.scrolling=false;this.scroller=$(a);this.slides=f;this.controls=c;this.disabled=false;this.options=Object.extend({duration:1,auto:false,frequency:3,visibleSlides:1,controlClassName:"carousel-control",jumperClassName:"carousel-jumper",disabledClassName:"carousel-disabled",selectedClassName:"carousel-selected",circular:false,wheel:true,effect:"scroll",transition:"sinoidal"},e||{});if(this.options.effect=="fade"){this.options.circular=true}this.slides.each(function(h,j){h._index=j});if(this.controls){this.controls.invoke("observe","click",this.click.bind(this))}if(this.options.wheel){this.scroller.observe("mousewheel",this.wheel.bindAsEventListener(this)).observe("DOMMouseScroll",this.wheel.bindAsEventListener(this))}if(this.options.auto){this.start()}if(this.options.initial){var g=this.slides.indexOf($(this.options.initial));if(g>(this.options.visibleSlides-1)&&this.options.visibleSlides>1){if(g>this.slides.length-(this.options.visibleSlides+1)){g=this.slides.length-this.options.visibleSlides}}this.moveTo(this.slides[g])}},click:function(event){if(this.disabled){Event.stop(event);return true}this.stop();var element=Event.findElement(event,"a");if(!element.hasClassName(this.options.disabledClassName)){if(element.hasClassName(this.options.controlClassName)){eval("this."+element.rel+"()")}else{if(element.hasClassName(this.options.jumperClassName)){this.moveTo(element.rel);if(this.options.selectedClassName){this.controls.invoke("removeClassName",this.options.selectedClassName);element.addClassName(this.options.selectedClassName)}}}}this.deactivateControls();Event.stop(event)},moveTo:function(c){if(this.options.beforeMove&&(typeof this.options.beforeMove=="function")){this.options.beforeMove()}this.previous=this.current?this.current:this.slides[0];this.current=$(c);var e=Position.cumulativeOffset(this.scroller);var a=Position.cumulativeOffset(this.current);if(this.scrolling){this.scrolling.cancel()}switch(this.options.effect){case"fade":this.scrolling=new Effect.Opacity(this.scroller,{from:1,to:0,duration:this.options.duration,afterFinish:(function(){this.scroller.scrollLeft=a[0]-e[0];this.scroller.scrollTop=a[1]-e[1];new Effect.Opacity(this.scroller,{from:0,to:1,duration:this.options.duration,afterFinish:(function(){if(this.controls){this.activateControls()}if(this.options.afterMove&&(typeof this.options.afterMove=="function")){this.options.afterMove()}}).bind(this)})}).bind(this)});break;case"scroll":default:var f;switch(this.options.transition){case"spring":f=Effect.Transitions.spring;break;case"sinoidal":default:f=Effect.Transitions.sinoidal;break}this.scrolling=new Effect.SmoothScroll(this.scroller,{duration:this.options.duration,x:(a[0]-e[0]),y:(a[1]-e[1]),transition:f,afterFinish:(function(){if(this.controls){this.activateControls()}if(this.options.afterMove&&(typeof this.options.afterMove=="function")){this.options.afterMove()}this.scrolling=false}).bind(this)});break}return false},prev:function(){if(this.current){var a=this.current._index;var c=(a==0)?(this.options.circular?this.slides.length-1:0):a-1}else{var c=(this.options.circular?this.slides.length-1:0)}if(c==(this.slides.length-1)&&this.options.circular&&this.options.effect!="fade"){this.scroller.scrollLeft=(this.slides.length-1)*this.slides.first().getWidth();this.scroller.scrollTop=(this.slides.length-1)*this.slides.first().getHeight();c=this.slides.length-2}this.moveTo(this.slides[c])},next:function(){if(this.current){var c=this.current._index;var a=(this.slides.length-1==c)?(this.options.circular?0:c):c+1}else{var a=1}if(a==0&&this.options.circular&&this.options.effect!="fade"){this.scroller.scrollLeft=0;this.scroller.scrollTop=0;a=1}if(a>this.slides.length-(this.options.visibleSlides+1)){a=this.slides.length-this.options.visibleSlides}this.moveTo(this.slides[a])},first:function(){this.moveTo(this.slides[0])},last:function(){this.moveTo(this.slides[this.slides.length-1])},toggle:function(){if(this.previous){this.moveTo(this.slides[this.previous._index])}else{return false}},stop:function(){if(this.timer){clearTimeout(this.timer)}},start:function(){this.periodicallyUpdate()},pause:function(){this.stop();this.activateControls()},resume:function(a){if(a){var c=a.relatedTarget||a.toElement;if(!c||(!this.slides.include(c)&&!this.slides.any(function(e){return c.descendantOf(e)}))){this.start()}}else{this.start()}},periodicallyUpdate:function(){if(this.timer!=null){clearTimeout(this.timer);this.next()}this.timer=setTimeout(this.periodicallyUpdate.bind(this),this.options.frequency*1000)},wheel:function(a){a.cancelBubble=true;a.stop();var c=0;if(!a){a=window.event}if(a.wheelDelta){c=a.wheelDelta/120}else{if(a.detail){c=-a.detail/3}}if(!this.scrolling){this.deactivateControls();if(c>0){this.prev()}else{this.next()}}return Math.round(c)},deactivateControls:function(){this.controls.invoke("addClassName",this.options.disabledClassName)},activateControls:function(){this.controls.invoke("removeClassName",this.options.disabledClassName)}});Effect.SmoothScroll=Class.create();Object.extend(Object.extend(Effect.SmoothScroll.prototype,Effect.Base.prototype),{initialize:function(c){this.element=$(c);var a=Object.extend({x:0,y:0,mode:"absolute"},arguments[1]||{});this.start(a)},setup:function(){if(this.options.continuous&&!this.element._ext){this.element.cleanWhitespace();this.element._ext=true;this.element.appendChild(this.element.firstChild)}this.originalLeft=this.element.scrollLeft;this.originalTop=this.element.scrollTop;if(this.options.mode=="absolute"){this.options.x-=this.originalLeft;this.options.y-=this.originalTop}},update:function(a){this.element.scrollLeft=this.options.x*a+this.originalLeft;this.element.scrollTop=this.options.y*a+this.originalTop}});SBN.AccessNotifier=Class.create({initialize:function(a,c){if(Object.isUndefined(arguments[0])||Object.isUndefined(arguments[1])){throw"name and callback are required arguments!"}if(!Object.isString(arguments[0])){throw"name must be a string!"}if(!Object.isFunction(arguments[1])){throw"callback must be a function!"}var a=a.strip();if(a==""){throw"name can't be empty!"}this.name=a;this.url="/accesses/#{name}".interpolate({name:this.name});this.callback=c;this.request=null;this.currentUsers=[];this.executer=new PeriodicalExecuter(this.onExecute.bind(this),5);Event.observe(window,"beforeunload",this.onUnload.bind(this));this.start()},onExecute:function(){this.notify()},onUnload:function(){this.stop()},start:function(){this.executer.stop();this.executer.onTimerEvent();this.executer.registerCallback()},stop:function(){this.executer.stop();if(this.request){this.request.transport.abort();this.request=null}new Ajax.Request(this.url,{method:"delete"})},notify:function(){this.request=new Ajax.Request(this.url,{method:"post",onSuccess:this.onNotifySuccess.bind(this),onFailure:this.onNotifyFailure.bind(this)})},onNotifySuccess:function(e){var c=this.currentUsers;var a=$A(e.responseJSON||[]);var f=this._buildUserChangeSet(c,a);this.currentUsers=a;if(f.hasChanges){this.callback(f)}},onNotifyFailure:function(a){console.log("SBN.AccessNotifier unable to notify server")},_buildUserChangeSet:function(j,f){var e=function(n,m){n[m.id]=m;return n};var l=j.inject({},e);var h=f.inject({},e);var c=j.findAll(function(m){return !h[m.id]});var g=f.findAll(function(m){return !l[m.id]});var a=(c.length>0)||(g.length>0);return{all:f,added:g,removed:c,hasChanges:a}}});SBN.Alerts={rotateHeadlines:function(a){$("absolut_headline").update(a[0]);currentHeadline=1;window.setInterval(function(){$("absolut_headline").update(a[currentHeadline]);currentHeadline++;if(currentHeadline>=a.length){currentHeadline=0}},8000)},startCountdown:function(e,c){function a(f,g){var h=f+"";while(h.length<g){h="0"+h}return h}e-=1;window.setInterval(function(){curTime=e;$(c+"_hrs").update(Math.floor(curTime/3600));curTime=curTime%3600;$(c+"_mins").update(a(Math.floor(curTime/60),2));curTime=curTime%60;$(c+"_secs").update(a(curTime,2));e-=1},1000)}};SBN.Newsletter={alreadySubscribed:false,cookieIgnore:false,startHeight:300,signupBarShowing:false,listId:0,teamId:0,defaultText:"",showSignupBar:function(){if(!SBN.Newsletter.signupBarShowing&&(SBN.Newsletter.cookieIgnore||SBN.Newsletter.cookieRead()!="true")){SBN.Newsletter.signupBarShowing=true;Effect.SlideDown($("newsletter-slide"),{duration:0.2})}},closeSignupBar:function(){SBN.Newsletter.cookieSet();SBN.Newsletter.cookieIgnore=false;if(SBN.Newsletter.signupBarShowing){SBN.Newsletter.signupBarShowing=false;Effect.SlideUp($("newsletter-slide"),{duration:0.2})}},cookieName:function(){return"newsletterIgnore-"+SBN.Newsletter.listId+"-"+SBN.Newsletter.teamId},cookieSet:function(){var c=new Date();var a=new Date(c.getTime()+86400000*365*2);document.cookie=SBN.Newsletter.cookieName()+"=true; expires= "+a.toGMTString()+"; path=/"},cookieReset:function(){document.cookie=SBN.Newsletter.cookieName()+"=;"},cookieRead:function(){var c=""+document.cookie;var f=SBN.Newsletter.cookieName();var e=c.indexOf(f);if(e==-1||f===""){return""}var a=c.indexOf(";",e);if(a==-1){a=c.length}return unescape(c.substring(e+f.length+1,a))},expandSignupBar:function(){$("newsletter-more-wrapper").setStyle("display:");Effect.SlideDown($("newsletter-more-wrapper"),{duration:0.2});$("newsletter-show-more").hide()},resetField:function(c,a){if(c.value==SBN.Newsletter.postFailMessage||c.value==SBN.Newsletter.postWinMessage||c.value==SBN.Newsletter.postDuplicateMessage||c.value=="Email Address"){c.value="";SBN.Newsletter.setState()}},postDuplicate:function(){$("email").enable();$("email").value=SBN.Newsletter.postDuplicateMessage;SBN.Newsletter.setState("error")},postFail:function(){$("email").enable();$("email").value=SBN.Newsletter.postFailMessage;SBN.Newsletter.setState("error")},postWin:function(){$("email").enable();$("email").value=SBN.Newsletter.postWinMessage;setTimeout(SBN.Newsletter.closeSignupBar,4000);SBN.Newsletter.setState("success")},setState:function(c){var a=$("newsletter-slide");a.removeClassName("error-newsletter");a.removeClassName("working");a.removeClassName("success");switch(c){case"error":a.addClassName("error-newsletter");break;case"working":a.addClassName("working");break;case"success":a.addClassName("success");break;default:break}},postDuplicateMessage:"Already signed up!",postFailMessage:"Invalid email!",postWinMessage:"Thanks for signing up!",Manager:{collectSelected:function(){var a=[];var c=[];$$('ul[id="selected-newsletters"] li').each(function(e){a.push(e.readAttribute("data-list_id"));c.push(e.readAttribute("data-team_id"))});$("lists_").value=a;$("team_ids_").value=c},findClone:function(f){var h=f.readAttribute("data-list_id");var e=f.readAttribute("data-team_id");var c=f.className;var g=$$("li[data-list_id = '"+h+"'][data-team_id = '"+e+"'][class!='"+c+"']");var a;if(typeof g=="undefined"){return[]}else{return g[0]}},setState:function(c){var a=$("newsletter-manager");a.removeClassName("error-newsletter");a.removeClassName("working");a.removeClassName("success");switch(c){case"error":a.addClassName("error-newsletter");break;case"working":a.addClassName("working");break;case"success":a.addClassName("success");break;default:break}},resetField:function(c,a){if(c.value==SBN.Newsletter.Manager.postBadEmailMessage||c.value==SBN.Newsletter.Manager.postWinMessage||c.value==SBN.Newsletter.Manager.postEmptyMessage||c.value=="Email Address"){c.value="";SBN.Newsletter.Manager.setState()}},postBadEmail:function(){$("email").enable();$("email").value=SBN.Newsletter.Manager.postBadEmailMessage;SBN.Newsletter.Manager.setState("error")},postEmpty:function(){$("email").enable();$("email").value=SBN.Newsletter.Manager.postEmptyMessage;SBN.Newsletter.Manager.setState("error")},postWin:function(){$("email").enable();if($$(".selected").length===0){$("email").value=SBN.Newsletter.Manager.postWinEmptyMessage}else{$("email").value=SBN.Newsletter.Manager.postWinMessage}SBN.Newsletter.Manager.setState("success")},postBadEmailMessage:"Invalid email!",postEmptyMessage:"No newsletters selected!",postWinMessage:"Thanks for signing up!",postWinEmptyMessage:"Unsubscribed from all!"}};Event.observe(window,"scroll",function(){if(window.XMLHttpRequest&&$("newsletter-slide")!==null&&(!SBN.Newsletter.alreadySubscribed)){if(document.documentElement.scrollTop>SBN.Newsletter.startHeight||self.pageYOffset>SBN.Newsletter.startHeight){SBN.Newsletter.showSignupBar()}}});Event.observe(window,"load",function(){if($("newsletter-slide")!==null){Effect.SlideUp($("newsletter-more-wrapper"),{duration:0.01});$("newsletter-close").observe("click",SBN.Newsletter.closeSignupBar);$("newsletter-more-close").observe("click",SBN.Newsletter.closeSignupBar);$("newsletter-show-more").observe("click",SBN.Newsletter.expandSignupBar);$("email").value=$("email").defaultValue;if($("email")){$("email").focus();$("email").blur()}if($("newsletter-widget")!==null){$("newsletter-widget").observe("click",function(){Effect.SlideDown($("newsletter-more-wrapper"),{duration:0.001});$("newsletter-more-wrapper").setStyle("display:");$("newsletter-show-more").hide();SBN.Newsletter.cookieIgnore=true;SBN.Newsletter.showSignupBar();return false})}$("newsletter-slide").setStyle("display:")}if($("newsletter-manager")!==null){$("email").value=$("email").defaultValue;$$(".newsletter-selectable").each(function(a){a.observe("click",function(){if(a.hasClassName("selected")){a.removeClassName("selected");SBN.Newsletter.Manager.findClone(a).remove()}else{var c=Element.clone(a,true).removeClassName("newsletter-selectable").addClassName("selected-newsletter");c.observe("click",function(){c.remove();a.removeClassName("selected")});$("selected-newsletters").insert(c);a.addClassName("selected")}SBN.Newsletter.Manager.setState()})});$$(".selected-newsletter").each(function(a){a.observe("click",function(){SBN.Newsletter.Manager.findClone(a).removeClassName("selected");a.remove();SBN.Newsletter.Manager.setState()})});if($("newsletter-nfl-show")!==null){$("newsletter-nfl-show").observe("click",function(){$("newsletter-nfl-list").setStyle("display:");Effect.SlideUp($("newsletter-nfl-list"),{duration:0.02});Effect.SlideDown($("newsletter-nfl-list"),{duration:0.2});$("newsletter-nfl-show").remove()})}}});if(typeof(SBN)=="undefined"){SBN={}}if(SBN.Campaigns==undefined){SBN.Campaigns={}}SBN.Campaigns.Components={clickUrls:{},queuedClicks:{},activatedComponents:$A(),componentProperties:$A(["campaign_id","component_id","component_type"]),callbacks:{},installTracker:function(c,a,f){var g=this.callbackName(f);this.callbacks[g]=function(h){this.completeInstallTracker(f,h)}.bind(this);var e=function(){var h=document.createElement("script");h.type="text/javascript";h.src="http://"+c+"/w/1.0/arj?auid="+encodeURIComponent(a)+"&c.component_tracker_id="+encodeURIComponent(f)+"&jsonp="+encodeURIComponent("SBN.Campaigns.Components.callbacks."+g);(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(h)}.bind(this);$(document).observe("dom:loaded",e)},callbackName:function(c){var a="cb"+c;a=a.replace(new RegExp("-|_","g"),"");return a},completeInstallTracker:function(e,g){if(g.ads["ad"][0]){var c=g.ads["ad"][0];var j=c.html;var f=c.creative[0]["tracking"]["click"];var h=$(document.createElement("div"));h.id=e+"-container";h.innerHTML=j;var a=document.getElementsByTagName("body")[0];a.appendChild(h);this.clickUrls[e]=f;setTimeout(function(){if(this.queuedClicks[e]){var l=this.queuedClicks[e];this.queuedClicks[e]=null;this.click(e,this.queuedClicks[e].opts)}}.bind(this),1000)}},click:function(e,c){c=Object.extend({newWindowName:null},c||{});var a=this.clickUrls[e];if(a){if(c.newWindowName!=null){window.open(a,c.newWindowName)}else{window.location=a}}else{this.queuedClicks[e]={opts:c}}},logActivation:function(e,a,c){this.activatedComponents.push({component_id:e,campaign_id:a,component_type:c})},activeComponentContext:function(){var a=$H();this.componentProperties.each(function(e){var c=this.activatedComponents.collect(function(f){return f[e]}.bind(this)).uniq();if(c.size()>0){a.set(e,c)}}.bind(this));return a}};(function(){function a(){var e=document.createElement("script");e.type="text/javascript";e.async=true;e.src=("https:"==location.protocol?"https://dyrkrau635c04.cloudfront.net":"http://cdn.sailthru.com")+"/horizon/v1.js";var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(e,c)}a();Event.observe(window,"load",function(){Sailthru.setup({domain:"horizon.sbnation.com"})})})();(function(a){a.fn.scrollPane=function(c){var p={easing:"easeInQuad",speed:400,prevSelector:".prev",nextSelector:".next",paneSelector:".pane",sliderSelector:".slider",sectionSelector:".section",sectionsPerPage:5,enabledClass:"enabled",disabledClass:"disabled"};var e,h,l,f,o,m,n;var j={init:function(q){return this.each(function(){if(q){a.extend(p,q)}e=a(this);e.data("options",p);h=e.find(p.prevSelector);l=e.find(p.nextSelector);f=e.find(p.paneSelector);o=e.find(p.sliderSelector);m=e.find(p.sectionSelector);var v=m.length%p.sectionsPerPage;var u=m.length/p.sectionsPerPage;var r=(v>0)?Math.ceil(u):Math.floor(u);e.data("page",{on:1,count:r});g.activateControls();n=g.calculatePaneWidth();g.setSliderWidth();if(!e.data("reference")){e.data("reference",{target:e})}e.find(h).bind("click",g.moveSlider);e.find(l).bind("click",g.moveSlider);e.bind("resetSlider",g.reset)})}};var g={moveSlider:function(){var r=a(this);if(r.hasClass(p.enabledClass)&&!r.data("freeze")){r.data("freeze",true);var u=r.is(l)?p.sectionsPerPage*e.data("page").on:p.sectionsPerPage*(e.data("page").on-2);var q=m.eq(u).position().left*-1;o.animate({left:q},p.speed,p.easing,function(){var w=e.data("page").on;var v=(r.is(l))?w+1:w-1;e.data("page").on=v;g.activateControls();r.removeData("freeze")})}return false},activateControls:function(){var q=e.data("page");q.count>q.on?l.addClass(p.enabledClass).removeClass(p.disabledClass):l.removeClass(p.enabledClass).addClass(p.disabledClass);q.on>1?h.addClass(p.enabledClass).removeClass(p.disabledClass):h.removeClass(p.enabledClass).addClass(p.disabledClass)},calculatePaneWidth:function(){return e.find(f).width()},setSliderWidth:function(){var q=0;m.each(function(){q+=a(this).outerWidth()});o.width(q)},reset:function(){o.css("left","0");h.addClass(p.disabledClass).removeClass(p.enabledClass);l.removeClass(p.disabledClass).addClass(p.enabledClass)}};if(j[c]&&c.toLowerCase()!="init"){return j[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return j.init.apply(this,arguments)}else{$.error('Method "'+c+'" does not exist in the scrollPane plugin!')}}}})(jQuery);(function(a){a.fn.gallery=function(c){var n={mainSelector:".photo-gallery-main-pic img",thumbsObj:"#photo-gallery-thumbs-slider",thumbSelector:".photo-gallery-nav li",picNavPrev:".photo-gallery-previous",picNavNext:".photo-gallery-next",permalinks:true,hardLoad:false,trackImageViews:true};var e,h,g,l,m;var j={init:function(o){return this.each(function(){if(o){a.extend(n,o)}e=a(this);n.thumbsObj=a(n.thumbsObj);h=e.find(n.thumbSelector);g=e.find(n.mainSelector);l=e.find(n.picNavPrev);m=e.find(n.picNavNext);h.unbind("click",f.updateMainPic).bind("click",f.updateMainPic);l.unbind("click",f.prevPicture).bind("click",f.prevPicture).addClass("disabled");m.unbind("click",f.nextPicture).bind("click",f.nextPicture).addClass("enabled");e.data("first-load",true);if(n.inline){g.bind("click",f.nextPicture).addClass("enabled")}if(n.permalinks||n.hardLoad){a.history.init(f.processHash)}else{h.filter(":first").trigger("click")}})}};var f={processHash:function(o){if(o){h.filter('[data-id="'+o+'"]').trigger("click")}else{h.filter(":first").trigger("click")}},prevPicture:function(){if(a(this).hasClass("enabled")){h.filter(".selected").prev().trigger("click")}return false;return false},nextPicture:function(){if(a(this).hasClass("enabled")){h.filter(".selected").next().trigger("click")}return false},resetControls:function(){l.removeClass("disabled").addClass("enabled");m.removeClass("disabled").addClass("enabled");if(n.inline){g.removeClass("disabled").addClass("enabled")}var o=h.index(h.filter(".selected"));if(o==0){l.addClass("disabled").removeClass("enabled")}else{if(o==h.length-1){m.addClass("disabled").removeClass("enabled");if(n.inline){g.addClass("disabled").removeClass("enabled")}}}var r=n.thumbsObj.data("page").on;var q=n.thumbsObj.data("options").sectionsPerPage;o+=1;var p=Math.ceil(o/q);if(r<p){n.thumbsObj.data("page").on=p-1;n.thumbsObj.find(n.thumbsObj.data("options").nextSelector).trigger("click")}else{if(r>p){n.thumbsObj.data("page").on=p+1;n.thumbsObj.find(n.thumbsObj.data("options").prevSelector).trigger("click")}}},updateMainPic:function(q){h.removeClass("selected");var r=h.filter(this),p=r.data("src");function o(u){u.addClass("selected");g.attr("src",p);f.resetControls();if(n.trackImageViews){if(_gaq){_gaq.push(["_trackEvent","Photos","View",r.data("id")])}}}if(e.data("first-load")&&(n.permalinks||n.hardLoad)){document.location.hash=r.data("id");o(r);e.data("first-load",false)}else{if(n.permalinks||n.hardLoad){if(document.location.href.indexOf("#")!=-1){a.history.load(r.data("id"))}if(n.hardLoad){window.location.reload(true)}else{o(r)}}else{o(r)}}}};if(j[c]&&c.toLowerCase()!="init"){return j[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return j.init.apply(this,arguments)}else{$.error('Method "'+c+'" does not exist in the gallery plugin!')}}}})(jQuery);(function(h){function m(o){function a(e){var p=new RegExp(h.map(e,encodeURIComponent).join("|"),"ig");return function(c){return c.replace(p,decodeURIComponent)}}function f(c){if(c===true){return function(e){return e}}if(typeof c=="string"&&(c=a(c.split("")))||typeof c=="function"){return function(e){return c(encodeURIComponent(e))}}return encodeURIComponent}o=h.extend({unescape:false},o||{});g.encoder=f(o.unescape)}var g={put:function(e,c){(c||window).location.hash=this.encoder(e)},get:function(a){var f=(a||window).location.hash.replace(/^#/,"");try{return h.browser.mozilla?f:decodeURIComponent(f)}catch(e){return f}},encoder:encodeURIComponent};var n={id:"__jQuery_history",init:function(){var a='<iframe id="'+this.id+'" style="display:none" src="javascript:false;" />';h("body").prepend(a);return this},_document:function(){return h("#"+this.id)[0].contentWindow.document},put:function(e){var f=this._document();f.open();f.close();g.put(e,f)},get:function(){return g.get(this._document())}};var l={};l.base={callback:undefined,type:undefined,check:function(){},load:function(c){},init:function(e,c){m(c);j.callback=e;j._options=c;j._init()},_init:function(){},_options:{}};l.timer={_appState:undefined,_init:function(){var c=g.get();j._appState=c;j.callback(c);setInterval(j.check,100)},check:function(){var c=g.get();if(c!=j._appState){j._appState=c;j.callback(c)}},load:function(c){if(c!=j._appState){g.put(c);j._appState=c;j.callback(c)}}};l.iframeTimer={_appState:undefined,_init:function(){var c=g.get();j._appState=c;n.init().put(c);j.callback(c);setInterval(j.check,100)},check:function(){var c=n.get(),e=g.get();if(e!=c){if(e==j._appState){j._appState=c;g.put(c);j.callback(c)}else{j._appState=e;n.put(e);j.callback(e)}}},load:function(c){if(c!=j._appState){g.put(c);n.put(c);j._appState=c;j.callback(c)}}};l.hashchangeEvent={_init:function(){j.callback(g.get());h(window).bind("hashchange",j.check)},check:function(){j.callback(g.get())},load:function(c){g.put(c)}};var j=h.extend({},l.base);if(h.browser.msie&&(h.browser.version<8||document.documentMode<8)){j.type="iframeTimer"}else{if("onhashchange" in window){j.type="hashchangeEvent"}else{j.type="timer"}}h.extend(j,l[j.type]);h.history=j})(jQuery);
