/*** prototype.js - 72.0 kb ***/ var Prototype={Version:"1.6.0.2",Browser:{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/)},BrowserFeatures:{XPath:!!document.evaluate,ElementExtensions:!!window.HTMLElement,SpecificElementExtensions:document.createElement("div").__proto__&&document.createElement("div").__proto__!==document.createElement("form").__proto__},ScriptFragment:"]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(B){return B}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Class={create:function(){var G=null,H=$A(arguments);if(Object.isFunction(H[0])){G=H.shift()}function F(){this.initialize.apply(this,arguments)}Object.extend(F,Class.Methods);F.superclass=G;F.subclasses=[];if(G){var J=function(){};J.prototype=G.prototype;F.prototype=new J;G.subclasses.push(F)}for(var I=0;I0){if(J=H.match(G)){F+=H.slice(0,J.index);F+=String.interpret(I(J));H=H.slice(J.index+J[0].length)}else{F+=H,H=""}}return F},sub:function(E,D,F){D=this.gsub.prepareReplacement(D);F=Object.isUndefined(F)?1:F;return this.gsub(E,function(A){if(--F<0){return A[0]}return D(A)})},scan:function(D,C){this.gsub(D,C);return String(this)},truncate:function(D,C){D=D||30;C=Object.isUndefined(C)?"...":C;return this.length>D?this.slice(0,D-C.length)+C:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var D=new RegExp(Prototype.ScriptFragment,"img");var C=new RegExp(Prototype.ScriptFragment,"im");return(this.match(D)||[]).map(function(A){return(A.match(C)||["",""])[1]})},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)})},escapeHTML:function(){var B=arguments.callee;B.text.data=this;return B.div.innerHTML},unescapeHTML:function(){var B=new Element("div");B.innerHTML=this.stripTags();return B.childNodes[0]?(B.childNodes.length>1?$A(B.childNodes).inject("",function(D,A){return D+A.nodeValue}):B.childNodes[0].nodeValue):""},toQueryParams:function(D){var C=this.strip().match(/([^?#]*)(#.*)?$/);if(!C){return{}}return C[1].split(D||"&").inject({},function(B,A){if((A=A.split("="))[0]){var H=decodeURIComponent(A.shift());var G=A.length>1?A.join("="):A[0];if(G!=undefined){G=decodeURIComponent(G)}if(H in B){if(!Object.isArray(B[H])){B[H]=[B[H]]}B[H].push(G)}else{B[H]=G}}return B})},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(B){return B<1?"":new Array(B+1).join(this)},camelize:function(){var F=this.split("-"),E=F.length;if(E==1){return F[0]}var G=this.charAt(0)=="-"?F[0].charAt(0).toUpperCase()+F[0].substring(1):F[0];for(var H=1;H-1},startsWith:function(B){return this.indexOf(B)===0},endsWith:function(C){var D=this.length-C.length;return D>=0&&this.lastIndexOf(C)===D},empty:function(){return this==""},blank:function(){return/^\s*$/.test(this)},interpolate:function(C,D){return new Template(this,D).evaluate(C)}});if(Prototype.Browser.WebKit||Prototype.Browser.IE){Object.extend(String.prototype,{escapeHTML:function(){return this.replace(/&/g,"&").replace(//g,">")},unescapeHTML:function(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}})}String.prototype.gsub.prepareReplacement=function(D){if(Object.isFunction(D)){return D}var C=new Template(D);return function(A){return C.evaluate(A)}};String.prototype.parseQuery=String.prototype.toQueryParams;Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});with(String.prototype.escapeHTML){div.appendChild(text)}var Template=Class.create({initialize:function(C,D){this.template=C.toString();this.pattern=D||Template.Pattern},evaluate:function(B){if(Object.isFunction(B.toTemplateReplacements)){B=B.toTemplateReplacements()}return this.template.gsub(this.pattern,function(J){if(B==null){return""}var H=J[1]||"";if(H=="\\"){return J[2]}var L=B,A=J[3];var I=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;J=I.exec(A);if(J==null){return H}while(J!=null){var K=J[1].startsWith("[")?J[2].gsub("\\\\]","]"):J[1];L=L[K];if(null==L||""==J[3]){break}A=A.substring("["==J[3]?J[1].length:J[0].length);J=I.exec(A)}return H+String.interpret(L)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable={each:function(G,H){var E=0;G=G.bind(H);try{this._each(function(A){G(A,E++)})}catch(F){if(F!=$break){throw F}}return this},eachSlice:function(J,K,L){K=K?K.bind(L):Prototype.K;var G=-J,I=[],H=this.toArray();while((G+=J)=D){D=A}});return D},min:function(E,F){E=E?E.bind(F):Prototype.K;var D;this.each(function(A,B){A=E(A,B);if(D==null||AH?1:0}).pluck("value")},toArray:function(){return this.map()},zip:function(){var F=Prototype.K,D=$A(arguments);if(Object.isFunction(D.last())){F=D.pop()}var E=[this].concat(D).map($A);return this.map(function(A,B){return F(E.pluck(B))})},size:function(){return this.toArray().length},inspect:function(){return"#"}};Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,filter:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray,every:Enumerable.all,some:Enumerable.any});function $A(E){if(!E){return[]}if(E.toArray){return E.toArray()}var F=E.length||0,D=new Array(F);while(F--){D[F]=E[F]}return D}if(Prototype.Browser.WebKit){$A=function(E){if(!E){return[]}if(!(Object.isFunction(E)&&E=="[object NodeList]")&&E.toArray){return E.toArray()}var F=E.length||0,D=new Array(F);while(F--){D[F]=E[F]}return D}}Array.from=$A;Object.extend(Array.prototype,Enumerable);if(!Array.prototype._reverse){Array.prototype._reverse=Array.prototype.reverse}Object.extend(Array.prototype,{_each:function(F){for(var D=0,E=this.length;D1?this:this[0]},uniq:function(B){return this.inject([],function(A,E,F){if(0==F||(B?A.last()!=E:!A.include(E))){A.push(E)}return A})},intersect:function(B){return this.uniq().findAll(function(A){return B.detect(function(D){return A===D})})},clone:function(){return[].concat(this)},size:function(){return this.length},inspect:function(){return"["+this.map(Object.inspect).join(", ")+"]"},toJSON:function(){var B=[];this.each(function(D){var A=Object.toJSON(D);if(!Object.isUndefined(A)){B.push(A)}});return"["+B.join(", ")+"]"}});if(Object.isFunction(Array.prototype.forEach)){Array.prototype._each=Array.prototype.forEach}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(E,D){D||(D=0);var F=this.length;if(D<0){D=F+D}for(;D"},toJSON:function(){return Object.toJSON(this.toObject())},clone:function(){return new Hash(this)}}})());Hash.prototype.toTemplateReplacements=Hash.prototype.toObject;Hash.from=$H;var ObjectRange=Class.create(Enumerable,{initialize:function(E,D,F){this.start=E;this.end=D;this.exclusive=F},_each:function(C){var D=this.start;while(this.include(D)){C(D);D=D.succ()}},include:function(B){if(B1&&!((B==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 I=this.options.requestHeaders;if(Object.isFunction(I.push)){for(var J=0,H=I.length;J=200&&B<300)},getStatus:function(){try{return this.transport.status||0}catch(B){return 0}},respondToReadyState:function(F){var I=Ajax.Request.Events[F],J=new Ajax.Response(this);if(I=="Complete"){try{this._complete=true;(this.options["on"+J.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(J,J.headerJSON)}catch(H){this.dispatchException(H)}var G=J.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&G&&G.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+I]||Prototype.emptyFunction)(J,J.headerJSON);Ajax.Responders.dispatch("on"+I,this,J,J.headerJSON)}catch(H){this.dispatchException(H)}if(I=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var B=this.url.match(/^\s*https?:\/\/[^\/]*/);return !B||(B[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(C){try{return this.transport.getResponseHeader(C)||null}catch(D){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(B){(this.options.onException||Prototype.emptyFunction)(this,B);Ajax.Responders.dispatch("onException",this,B)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(G){this.request=G;var F=this.transport=G.transport,E=this.readyState=F.readyState;if((E>2&&!Prototype.Browser.IE)||E==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(F.responseText);this.headerJSON=this._getHeaderJSON()}if(E==4){var H=F.responseXML;this.responseXML=Object.isUndefined(H)?null:H;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(B){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(B){return null}},getResponseHeader:function(B){return this.transport.getResponseHeader(B)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var C=this.getHeader("X-JSON");if(!C){return null}C=decodeURIComponent(escape(C));try{return C.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(D){this.request.dispatchException(D)}},_getResponseJSON:function(){var C=this.request.options;if(!C.evalJSON||(C.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(C.sanitizeJSON||!this.request.isSameOrigin())}catch(D){this.request.dispatchException(D)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,E,G,H){this.container={success:(E.success||E),failure:(E.failure||(E.success?null:E))};H=Object.clone(H);var F=H.onComplete;H.onComplete=(function(B,A){this.updateContent(B.responseText);if(Object.isFunction(F)){F(B,A)}}).bind(this);$super(G,H)},updateContent:function(F){var G=this.container[this.success()?"success":"failure"],E=this.options;if(!E.evalScripts){F=F.stripScripts()}if(G=$(G)){if(E.insertion){if(Object.isString(E.insertion)){var H={};H[E.insertion]=F;G.insert(H)}else{E.insertion(G,F)}}else{G.update(F)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,D,E,F){$super(F);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=D;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(B){if(this.options.decay){this.decay=(B.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=B.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 $(H){if(arguments.length>1){for(var E=0,F=[],G=arguments.length;E';delete E.name;return Element.writeAttribute(document.createElement(A),E)}if(!F[A]){F[A]=Element.extend(document.createElement(A))}return Element.writeAttribute(F[A].cloneNode(false),E)};Object.extend(this.Element,B||{})}).call(window);Element.cache={};Element.Methods={visible:function(B){return $(B).style.display!="none"},toggle:function(B){B=$(B);Element[Element.visible(B)?"hide":"show"](B);return B},hide:function(B){$(B).style.display="none";return B},show:function(B){$(B).style.display="";return B},remove:function(B){B=$(B);B.parentNode.removeChild(B);return B},update:function(C,D){C=$(C);if(D&&D.toElement){D=D.toElement()}if(Object.isElement(D)){return C.update().insert(D)}D=Object.toHTML(D);C.innerHTML=D.stripScripts();D.evalScripts.bind(D).defer();return C},replace:function(F,E){F=$(F);if(E&&E.toElement){E=E.toElement()}else{if(!Object.isElement(E)){E=Object.toHTML(E);var D=F.ownerDocument.createRange();D.selectNode(F);E.evalScripts.bind(E).defer();E=D.createContextualFragment(E.stripScripts())}}F.parentNode.replaceChild(E,F);return F},insert:function(M,K){M=$(M);if(Object.isString(K)||Object.isNumber(K)||Object.isElement(K)||(K&&(K.toElement||K.toHTML))){K={bottom:K}}var L,J,N,I;for(var H in K){L=K[H];H=H.toLowerCase();J=Element._insertionTranslations[H];if(L&&L.toElement){L=L.toElement()}if(Object.isElement(L)){J(M,L);continue}L=Object.toHTML(L);N=((H=="before"||H=="after")?M.parentNode:M).tagName.toUpperCase();I=Element._getContentFromAnonymousElement(N,L.stripScripts());if(H=="top"||H=="after"){I.reverse()}I.each(J.curry(M));L.evalScripts.bind(L).defer()}return M},wrap:function(F,E,D){F=$(F);if(Object.isElement(E)){$(E).writeAttribute(D||{})}else{if(Object.isString(E)){E=new Element(E,D)}else{E=new Element("div",E)}}if(F.parentNode){F.parentNode.replaceChild(E,F)}E.appendChild(F);return E},inspect:function(D){D=$(D);var C="<"+D.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(A){var B=A.first(),H=A.last();var G=(D[B]||"").toString();if(G){C+=" "+H+"="+G.inspect(true)}});return C+">"},recursivelyCollect:function(D,E){D=$(D);var F=[];while(D=D[E]){if(D.nodeType==1){F.push(Element.extend(D))}}return F},ancestors:function(B){return $(B).recursivelyCollect("parentNode")},descendants:function(B){return $(B).select("*")},firstDescendant:function(B){B=$(B).firstChild;while(B&&B.nodeType!=1){B=B.nextSibling}return $(B)},immediateDescendants:function(B){if(!(B=$(B).firstChild)){return[]}while(B&&B.nodeType!=1){B=B.nextSibling}if(B){return[B].concat($(B).nextSiblings())}return[]},previousSiblings:function(B){return $(B).recursivelyCollect("previousSibling")},nextSiblings:function(B){return $(B).recursivelyCollect("nextSibling")},siblings:function(B){B=$(B);return B.previousSiblings().reverse().concat(B.nextSiblings())},match:function(D,C){if(Object.isString(C)){C=new Selector(C)}return C.match($(D))},up:function(H,F,E){H=$(H);if(arguments.length==1){return $(H.parentNode)}var G=H.ancestors();return Object.isNumber(F)?G[F]:Selector.findElement(G,F,E)},down:function(F,E,D){F=$(F);if(arguments.length==1){return F.firstDescendant()}return Object.isNumber(E)?F.descendants()[E]:F.select(E)[D||0]},previous:function(H,F,E){H=$(H);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(H))}var G=H.previousSiblings();return Object.isNumber(F)?G[F]:Selector.findElement(G,F,E)},next:function(G,F,H){G=$(G);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(G))}var E=G.nextSiblings();return Object.isNumber(F)?E[F]:Selector.findElement(E,F,H)},select:function(){var C=$A(arguments),D=$(C.shift());return Selector.findChildElements(D,C)},adjacent:function(){var C=$A(arguments),D=$(C.shift());return Selector.findChildElements(D.parentNode,C).without(D)},identify:function(F){F=$(F);var E=F.readAttribute("id"),D=arguments.callee;if(E){return E}do{E="anonymous_element_"+D.counter++}while($(E));F.writeAttribute("id",E);return E},readAttribute:function(E,D){E=$(E);if(Prototype.Browser.IE){var F=Element._attributeTranslations.read;if(F.values[D]){return F.values[D](E,D)}if(F.names[D]){D=F.names[D]}if(D.include(":")){return(!E.attributes||!E.attributes[D])?null:E.attributes[D].value}}return E.getAttribute(D)},writeAttribute:function(I,K,H){I=$(I);var L={},J=Element._attributeTranslations.write;if(typeof K=="object"){L=K}else{L[K]=Object.isUndefined(H)?true:H}for(var G in L){K=J.names[G]||G;H=L[G];if(J.values[G]){K=J.values[G](I,H)}if(H===false||H===null){I.removeAttribute(K)}else{if(H===true){I.setAttribute(K,K)}else{I.setAttribute(K,H)}}}return I},getHeight:function(B){return $(B).getDimensions().height},getWidth:function(B){return $(B).getDimensions().width},classNames:function(B){return new Element.ClassNames(B)},hasClassName:function(D,F){if(!(D=$(D))){return }var E=D.className;return(E.length>0&&(E==F||new RegExp("(^|\\s)"+F+"(\\s|$)").test(E)))},addClassName:function(C,D){if(!(C=$(C))){return }if(!C.hasClassName(D)){C.className+=(C.className?" ":"")+D}return C},removeClassName:function(C,D){if(!(C=$(C))){return }C.className=C.className.replace(new RegExp("(^|\\s+)"+D+"(\\s+|$)")," ").strip();return C},toggleClassName:function(C,D){if(!(C=$(C))){return }return C[C.hasClassName(D)?"removeClassName":"addClassName"](D)},cleanWhitespace:function(F){F=$(F);var E=F.firstChild;while(E){var D=E.nextSibling;if(E.nodeType==3&&!/\S/.test(E.nodeValue)){F.removeChild(E)}E=D}return F},empty:function(B){return $(B).innerHTML.blank()},descendantOf:function(J,K){J=$(J),K=$(K);var H=K;if(J.compareDocumentPosition){return(J.compareDocumentPosition(K)&8)===8}if(J.sourceIndex&&!Prototype.Browser.Opera){var I=J.sourceIndex,L=K.sourceIndex,G=K.nextSibling;if(!G){do{K=K.parentNode}while(!(G=K.nextSibling)&&K.parentNode)}if(G&&G.sourceIndex){return(I>L&&I","",1],TBODY:["","
",2],TR:["","
",3],TD:["
","
",4],SELECT:["",1]}};(function(){Object.extend(this.tags,{THEAD:this.tags.TBODY,TFOOT:this.tags.TBODY,TH:this.tags.TD})}).call(Element._insertionTranslations);Element.Methods.Simulated={hasAttribute:function(D,E){E=Element._attributeTranslations.has[E]||E;var F=$(D).getAttributeNode(E);return F&&F.specified}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);if(!Prototype.BrowserFeatures.ElementExtensions&&document.createElement("div").__proto__){window.HTMLElement={};window.HTMLElement.prototype=document.createElement("div").__proto__;Prototype.BrowserFeatures.ElementExtensions=true}Element.extend=(function(){if(Prototype.BrowserFeatures.SpecificElementExtensions){return Prototype.K}var D={},F=Element.Methods.ByTag;var E=Object.extend(function(C){if(!C||C._extendedByPrototype||C.nodeType!=1||C==window){return C}var J=Object.clone(D),I=C.tagName,A,B;if(F[I]){Object.extend(J,F[I])}for(A in J){B=J[A];if(Object.isFunction(B)&&!(A in C)){C[A]=B.methodize()}}C._extendedByPrototype=Prototype.emptyFunction;return C},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(D,Element.Methods);Object.extend(D,Element.Methods.Simulated)}}});E.refresh();return E})();Element.hasAttribute=function(C,D){if(C.hasAttribute){return C.hasAttribute(D)}return Element.Methods.Simulated.hasAttribute(C,D)};Element.addMethods=function(K){var O=Prototype.BrowserFeatures,F=Element.Methods.ByTag;if(!K){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 L=K;K=arguments[1]}if(!L){Object.extend(Element.Methods,K||{})}else{if(Object.isArray(L)){L.each(P)}else{P(L)}}function P(A){A=A.toUpperCase();if(!Element.Methods.ByTag[A]){Element.Methods.ByTag[A]={}}Object.extend(Element.Methods.ByTag[A],K)}function M(A,B,C){C=C||false;for(var D in A){var E=A[D];if(!Object.isFunction(E)){continue}if(!C||!(D in B)){B[D]=E.methodize()}}}function R(A){var C;var B={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(B[A]){C="HTML"+B[A]+"Element"}if(window[C]){return window[C]}C="HTML"+A+"Element";if(window[C]){return window[C]}C="HTML"+A.capitalize()+"Element";if(window[C]){return window[C]}window[C]={};window[C].prototype=document.createElement(A).__proto__;return window[C]}if(O.ElementExtensions){M(Element.Methods,HTMLElement.prototype);M(Element.Methods.Simulated,HTMLElement.prototype,true)}if(O.SpecificElementExtensions){for(var N in Element.Methods.ByTag){var Q=R(N);if(Object.isUndefined(Q)){continue}M(F[N],Q.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){var B={};var D=Prototype.Browser;$w("width height").each(function(A){var C=A.capitalize();B[A]=(D.WebKit&&!document.evaluate)?self["inner"+C]:(D.Opera)?document.body["client"+C]:document.documentElement["client"+C]});return B},getWidth:function(){return this.getDimensions().width},getHeight:function(){return this.getDimensions().height},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};var Selector=Class.create({initialize:function(B){this.expression=B.strip();this.compileMatcher()},shouldUseXPath:function(){if(!Prototype.BrowserFeatures.XPath){return false}var B=this.expression;if(Prototype.Browser.WebKit&&(B.include("-of-type")||B.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(this.expression)){return false}return true},compileMatcher:function(){if(this.shouldUseXPath()){return this.compileXPathMatcher()}var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m;if(Selector._cache[e]){this.matcher=Selector._cache[e];return }this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i in ps){p=ps[i];if(m=e.match(p)){this.matcher.push(Object.isFunction(c[i])?c[i](m):new Template(c[i]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var I=this.expression,H=Selector.patterns,L=Selector.xpath,J,G;if(Selector._cache[I]){this.xpath=Selector._cache[I];return }this.matcher=[".//*"];while(I&&J!=I&&(/\S/).test(I)){J=I;for(var K in H){if(G=I.match(H[K])){this.matcher.push(Object.isFunction(L[K])?L[K](G):new Template(L[K]).evaluate(G));I=I.replace(G[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(B){B=B||document;if(this.xpath){return document._getElementsByXPath(this.xpath,B)}return this.matcher(B)},match:function(U){this.tokens=[];var Q=this.expression,P=Selector.patterns,X=Selector.assertions;var O,M,W;while(Q&&O!==Q&&(/\S/).test(Q)){O=Q;for(var T in P){M=P[T];if(W=Q.match(M)){if(X[T]){this.tokens.push([T,Object.clone(W)]);Q=Q.replace(W[0],"")}else{return this.findElements(document).include(U)}}}}var R=true,N,S;for(var T=0,V;V=this.tokens[T];T++){N=V[0],S=V[1];if(!Selector.assertions[N](U,S)){R=false;break}}return R},toString:function(){return this.expression},inspect:function(){return"#"}});Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(B){if(B[1]=="*"){return""}return"[local-name()='"+B[1].toLowerCase()+"' or local-name()='"+B[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(B){B[1]=B[1].toLowerCase();return new Template("[@#{1}]").evaluate(B)},attr:function(B){B[1]=B[1].toLowerCase();B[3]=B[5]||B[6];return new Template(Selector.xpath.operators[B[2]]).evaluate(B)},pseudo:function(C){var D=Selector.xpath.pseudos[C[1]];if(!D){return""}if(Object.isFunction(D)){return D(C)}return new Template(Selector.xpath.pseudos[C[1]]).evaluate(C)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",checked:"[@checked]",disabled:"[@disabled]",enabled:"[not(@disabled)]",not:function(P){var J=P[6],K=Selector.patterns,I=Selector.xpath,M,O;var L=[];while(J&&M!=J&&(/\S/).test(J)){M=J;for(var N in K){if(P=J.match(K[N])){O=Object.isFunction(I[N])?I[N](P):new Template(I[N]).evaluate(P);L.push("("+O.substring(1,O.length-1)+")");J=J.replace(P[0],"");break}}}return"[not("+L.join(" and ")+")]"},"nth-child":function(B){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",B)},"nth-last-child":function(B){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",B)},"nth-of-type":function(B){return Selector.xpath.pseudos.nth("position() ",B)},"nth-last-of-type":function(B){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",B)},"first-of-type":function(B){B[6]="1";return Selector.xpath.pseudos["nth-of-type"](B)},"last-of-type":function(B){B[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](B)},"only-of-type":function(C){var D=Selector.xpath.pseudos;return D["first-of-type"](C)+D["last-of-type"](C)},nth:function(K,M){var J,I=M[6],N;if(I=="even"){I="2n+0"}if(I=="odd"){I="2n+1"}if(J=I.match(/^(\d+)$/)){return"["+K+"= "+J[1]+"]"}if(J=I.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(J[1]=="-"){J[1]=-1}var L=J[1]?Number(J[1]):1;var H=J[2]?Number(J[2]):0;N="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(N).evaluate({fragment:K,a:L,b:H})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c); c = false;',className:'n = h.className(n, r, "#{1}", c); c = false;',id:'n = h.id(n, r, "#{1}", c); c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(B){B[3]=(B[5]||B[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(B)},pseudo:function(B){if(B[6]){B[6]=B[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(B)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:{laterSibling:/^\s*~\s*/,child:/^\s*>\s*/,adjacent:/^\s*\+\s*/,descendant:/^\s/,tagName:/^\s*(\*|[\w\-]+)(\b|$)?/,id:/^#([\w\-\*]+)(\b|$)/,className:/^\.([\w\-\*]+)(\b|$)/,pseudo:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,attrPresence:/^\[([\w]+)\]/,attr:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/},assertions:{tagName:function(C,D){return D[1].toUpperCase()==C.tagName.toUpperCase()},className:function(C,D){return Element.hasClassName(C,D[1])},id:function(C,D){return C.id===D[1]},attrPresence:function(C,D){return Element.hasAttribute(C,D[1])},attr:function(F,E){var D=Element.readAttribute(F,E[1]);return D&&Selector.operators[E[2]](D,E[5]||E[6])}},handlers:{concat:function(H,E){for(var G=0,F;F=E[G];G++){H.push(F)}return H},mark:function(E){var F=Prototype.emptyFunction;for(var H=0,G;G=E[H];H++){G._countedByPrototype=F}return E},unmark:function(D){for(var F=0,E;E=D[F];F++){E._countedByPrototype=undefined}return D},index:function(H,L,I){H._countedByPrototype=Prototype.emptyFunction;if(L){for(var N=H.childNodes,K=N.length-1,M=1;K>=0;K--){var J=N[K];if(J.nodeType==1&&(!I||J._countedByPrototype)){J.nodeIndex=M++}}}else{for(var K=0,M=1,N=H.childNodes;J=N[K];K++){if(J.nodeType==1&&(!I||J._countedByPrototype)){J.nodeIndex=M++}}}},unique:function(J){if(J.length==0){return J}var H=[],G;for(var I=0,F=J.length;I0?[D]:[]}return $R(1,E).inject([],function(B,A){if(0==(A-D)%F&&(A-D)/F>=0){B.push(A)}return B})},nth:function(T,Y,W,Z,R){if(T.length==0){return[]}if(Y=="even"){Y="2n+0"}if(Y=="odd"){Y="2n+1"}var a=Selector.handlers,b=[],S=[],f;a.mark(T);for(var c=0,Q;Q=T[c];c++){if(!Q.parentNode._countedByPrototype){a.index(Q.parentNode,Z,R);S.push(Q.parentNode)}}if(Y.match(/^\d+$/)){Y=Number(Y);for(var c=0,Q;Q=T[c];c++){if(Q.nodeIndex==Y){b.push(Q)}}}else{if(f=Y.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(f[1]=="-"){f[1]=-1}var V=f[1]?Number(f[1]):1;var X=f[2]?Number(f[2]):0;var U=Selector.pseudos.getIndices(V,X,T.length);for(var c=0,Q,e=U.length;Q=T[c];c++){for(var d=0;d+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(A){C.push(A[1].strip())});return C},matchElements:function(J,I){var K=$$(I),L=Selector.handlers;L.mark(K);for(var M=0,N=[],H;H=J[M];M++){if(H._countedByPrototype){N.push(H)}}L.unmark(K);return N},findElement:function(F,E,D){if(Object.isNumber(E)){D=E;E=false}return Selector.matchElements(F,E||"*")[D||0]},findChildElements:function(K,I){I=Selector.split(I.join(","));var L=[],J=Selector.handlers;for(var M=0,N=I.length,H;M1)?J.unique(L):L}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(H,E){for(var G=0,F;F=E[G];G++){if(F.tagName!=="!"){H.push(F)}}return H},unmark:function(D){for(var F=0,E;E=D[F];F++){E.removeAttribute("_countedByPrototype")}return D}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(B){$(B).reset();return B},serializeElements:function(I,N){if(typeof N!="object"){N={hash:!!N}}else{if(Object.isUndefined(N.hash)){N.hash=true}}var M,J,H=false,K=N.submit;var L=I.inject({},function(B,A){if(!A.disabled&&A.name){M=A.name;J=$(A).getValue();if(J!=null&&(A.type!="submit"||(!H&&K!==false&&(!K||M==K)&&(H=true)))){if(M in B){if(!Object.isArray(B[M])){B[M]=[B[M]]}B[M].push(J)}else{B[M]=J}}}return B});return N.hash?L:Object.toQueryString(L)}};Form.Methods={serialize:function(D,C){return Form.serializeElements(Form.getElements(D),C)},getElements:function(B){return $A($(B).getElementsByTagName("*")).inject([],function(D,A){if(Form.Element.Serializers[A.tagName.toLowerCase()]){D.push(Element.extend(A))}return D})},getInputs:function(K,O,N){K=$(K);var I=K.getElementsByTagName("input");if(!O&&!N){return $A(I).map(Element.extend)}for(var M=0,J=[],L=I.length;M=0}).sortBy(function(A){return A.tabIndex}).first();return D?D:E.find(function(A){return["input","select","textarea"].include(A.tagName.toLowerCase())})},focusFirstElement:function(B){B=$(B);B.findFirstElement().activate();return B},request:function(H,E){H=$(H),E=Object.clone(E||{});var F=E.parameters,G=H.readAttribute("action")||"";if(G.blank()){G=window.location.href}E.parameters=H.serialize(true);if(F){if(Object.isString(F)){F=F.toQueryParams()}Object.extend(E.parameters,F)}if(H.hasAttribute("method")&&!E.method){E.method=H.method}return new Ajax.Request(G,E)}};Form.Element={focus:function(B){$(B).focus();return B},select:function(B){$(B).select();return B}};Form.Element.Methods={serialize:function(D){D=$(D);if(!D.disabled&&D.name){var F=D.getValue();if(F!=undefined){var E={};E[D.name]=F;return Object.toQueryString(E)}}return""},getValue:function(C){C=$(C);var D=C.tagName.toLowerCase();return Form.Element.Serializers[D](C)},setValue:function(D,F){D=$(D);var E=D.tagName.toLowerCase();Form.Element.Serializers[E](D,F);return D},clear:function(B){$(B).value="";return B},present:function(B){return $(B).value!=""},activate:function(C){C=$(C);try{C.focus();if(C.select&&(C.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(C.type))){C.select()}}catch(D){}return C},disable:function(B){B=$(B);B.blur();B.disabled=true;return B},enable:function(B){B=$(B);B.disabled=false;return B}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(C,D){switch(C.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(C,D);default:return Form.Element.Serializers.textarea(C,D)}},inputSelector:function(C,D){if(Object.isUndefined(D)){return C.checked?C.value:null}else{C.checked=!!D}},textarea:function(C,D){if(Object.isUndefined(D)){return C.value}else{C.value=D}},select:function(L,H){if(Object.isUndefined(H)){return this[L.type=="select-one"?"selectOne":"selectMany"](L)}else{var M,J,I=!Object.isArray(H);for(var N=0,K=L.length;N=0?this.optionValue(D.options[C]):null},selectMany:function(H){var F,G=H.length;if(!G){return null}for(var I=0,F=[];I<\/script>");$("__onDOMContentLoaded").onreadystatechange=function(){if(this.readyState=="complete"){this.onreadystatechange=null;C()}}}})();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(C,D){return Element.insert(C,{before:D})},Top:function(C,D){return Element.insert(C,{top:D})},Bottom:function(C,D){return Element.insert(C,{bottom:D})},After:function(C,D){return Element.insert(C,{after:D})}};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(F,D,E){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(F,D,E)}this.xcomp=D;this.ycomp=E;this.offset=Element.cumulativeOffset(F);return(E>=this.offset[1]&&E=this.offset[0]&&D=this.offset[1]&&this.ycomp=this.offset[0]&&this.xcomp0})._each(B)},set:function(B){this.element.className=B},add:function(B){if(this.include(B)){return }this.set($A(this).concat(B).join(" "))},remove:function(B){if(!this.include(B)){return }this.set($A(this).without(B).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);Element.addMethods();function callInProgress(B){switch(B.readyState){case 1:case 2:case 3:return true;break;default:return false;break}}Ajax.PendingRequests=new Array();Ajax.Responders.register({onCreate:function(F){if(Ajax.activeRequestCount>=1){try{var D=Ajax.PendingRequest[0];D.transport.abort();console.log("abort")}catch(E){}}Ajax.PendingRequests[Ajax.activeRequestCount-1]=F},onComplete:function(B){}});Array.prototype.remove=function(E,F){var D=this.slice((F||E)+1||this.length);this.length=E<0?this.length+E:E;return this.push.apply(this,D)}; /*** scriptaculous.js - 82.0 kb ***/ var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(F){F=F.toUpperCase();var E=this.NODEMAP[F]||"div";var A=document.createElement(E);try{A.innerHTML="<"+F+">"}catch(D){}var C=A.firstChild||null;if(C&&(C.tagName.toUpperCase()!=F)){C=C.getElementsByTagName(F)[0]}if(!C){C=document.createElement(F)}if(!C){return }if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(C,arguments[1])}else{var B=this._attributes(arguments[1]);if(B.length){try{A.innerHTML="<"+F+" "+B+">"}catch(D){}C=A.firstChild||null;if(!C){C=document.createElement(F);for(attr in arguments[1]){C[attr=="class"?"className":attr]=arguments[1][attr]}}if(C.tagName.toUpperCase()!=F){C=A.getElementsByTagName(F)[0]}}}}if(arguments[2]){this._children(C,arguments[2])}return C},_text:function(A){return document.createTextNode(A)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(B){var A=[];for(attribute in B){A.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+B[attribute].toString().escapeHTML().gsub(/"/,""")+'"')}return A.join(" ")},_children:function(A,B){if(B.tagName){A.appendChild(B);return }if(typeof B=="object"){B.flatten().each(function(C){if(typeof C=="object"){A.appendChild(C)}else{if(Builder._isStringOrNumber(C)){A.appendChild(Builder._text(C))}}})}else{if(Builder._isStringOrNumber(B)){A.appendChild(Builder._text(B))}}},_isStringOrNumber:function(A){return(typeof A=="string"||typeof A=="number")},build:function(A){var B=this.node("div");$(B).update(A.strip());return B.down()},dump:function(A){if(typeof A!="object"&&typeof A!="function"){A=window}var B=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);B.each(function(C){A[C]=function(){return Builder.node.apply(Builder,[C].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var C="#";if(this.slice(0,4)=="rgb("){var B=this.slice(4,this.length-1).split(",");var A=0;do{C+=parseInt(B[A]).toColorPart()}while(++A<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var A=1;A<4;A++){C+=(this.charAt(A)+this.charAt(A)).toLowerCase()}}if(this.length==7){C=this.toLowerCase()}}}return(C.length==7?C:(arguments[0]||this))};Element.collectTextNodes=function(A){return $A($(A).childNodes).collect(function(B){return(B.nodeType==3?B.nodeValue:(B.hasChildNodes()?Element.collectTextNodes(B):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(B,A){return $A($(B).childNodes).collect(function(C){return(C.nodeType==3?C.nodeValue:((C.hasChildNodes()&&!Element.hasClassName(C,A))?Element.collectTextNodesIgnoreClass(C,A):""))}).flatten().join("")};Element.setContentZoom=function(B,A){B=$(B);B.setStyle({fontSize:(A/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return B};Element.getInlineOpacity=function(A){return $(A).style.opacity||""};Element.forceRerendering=function(C){try{C=$(C);var B=document.createTextNode(" ");C.appendChild(B);C.removeChild(B)}catch(A){}};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(A,B){B=B||5;return(((A%(1/B))*B).round()==0?((A*B*2)-(A*B*2).floor()):1-((A*B*2)-(A*B*2).floor()))},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(B){var A="position:relative";if(Prototype.Browser.IE){A+=";zoom:1"}B=$(B);$A(B.childNodes).each(function(C){if(C.nodeType==3){C.nodeValue.toArray().each(function(D){B.insertBefore(new Element("span",{style:A}).update(D==" "?String.fromCharCode(160):D),C)});Element.remove(C)}})},multiple:function(A,B){var D;if(((typeof A=="object")||Object.isFunction(A))&&(A.length)){D=A}else{D=$(A).childNodes}var E=Object.extend({speed:0.1,delay:0},arguments[2]||{});var C=E.delay;$A(D).each(function(F,G){new B(F,Object.extend(E,{delay:G*E.speed+C}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(A,B){A=$(A);B=(B||"appear").toLowerCase();var C=Object.extend({queue:{position:"end",scope:(A.id||"global"),limit:1}},arguments[2]||{});Effect[A.visible()?Effect.PAIRS[B][1]:Effect.PAIRS[B][0]](A,C)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(A){this.effects._each(A)},add:function(A){var B=new Date().getTime();var C=Object.isString(A.options.queue)?A.options.queue:A.options.queue.position;switch(C){case"front":this.effects.findAll(function(D){return D.state=="idle"}).each(function(D){D.startOn+=A.finishOn;D.finishOn+=A.finishOn});break;case"with-last":B=this.effects.pluck("startOn").max()||B;break;case"end":B=this.effects.pluck("finishOn").max()||B;break}A.startOn+=B;A.finishOn+=B;if(!A.options.queue.limit||(this.effects.length=this.startOn){if(B>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return }var A=(B-this.startOn)/this.totalTime,C=(A*this.totalFrames).round();if(C>this.currentFrame){this.render(A);this.currentFrame=C}}},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.Parallel=Class.create(Effect.Base,{initialize:function(A){this.effects=A||[];this.start(arguments[1])},update:function(A){this.effects.invoke("render",A)},finish:function(A){this.effects.each(function(B){B.render(1);B.cancel();B.event("beforeFinish");if(B.finish){B.finish(A)}B.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(B,E,D){B=Object.isString(B)?$(B):B;var A=$A(arguments),C=A.last(),F=A.length==5?A[3]:null;this.method=Object.isFunction(C)?C.bind(B):Object.isFunction(B[C])?B[C].bind(B):function(G){B[C]=G};this.start(Object.extend({from:E,to:D},F||{}))},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(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var B=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(B)},update:function(A){this.element.setOpacity(A)}});Effect.Move=Class.create(Effect.Base,{initialize:function(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}var B=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(B)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.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(A,C,B){return new Effect.Move(A,Object.extend({x:B,y:C},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(A,B){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:B},arguments[2]||{});this.start(C)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(B){this.originalStyle[B]=this.element.style[B]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var A=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(B){if(A.indexOf(B)>0){this.fontSize=parseFloat(A);this.fontSizeType=B}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(B){var A=(this.options.scaleFrom/100)+(this.factor*B);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*A+this.fontSizeType})}this.setDimensions(this.dims[0]*A,this.dims[1]*A)},finish:function(A){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(E,C){var D={};if(this.options.scaleX){D.width=C.round()+"px"}if(this.options.scaleY){D.height=E.round()+"px"}if(this.options.scaleFromCenter){var B=(E-this.dims[0])/2;var A=(C-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){D.top=this.originalTop-B+"px"}if(this.options.scaleX){D.left=this.originalLeft-A+"px"}}else{if(this.options.scaleY){D.top=-B+"px"}if(this.options.scaleX){D.left=-A+"px"}}}this.element.setStyle(D)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}var B=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(B)},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,D,B){return C+((this._base[B]+(this._delta[B]*A)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(C){var B=arguments[1]||{},A=document.viewport.getScrollOffsets(),D=$(C).cumulativeOffset(),E=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(B.offset){D[1]+=B.offset}return new Effect.Tween(null,A.top,D[1]>E?E:D[1],B,function(F){scrollTo(A.left,F.round())})};Effect.Fade=function(B){B=$(B);var C=B.getInlineOpacity();var A=Object.extend({from:B.getOpacity()||1,to:0,afterFinishInternal:function(D){if(D.options.to!=0){return }D.element.hide().setStyle({opacity:C});if(typeof (D.options.onFinish)=="function"){D.options.onFinish()}}},arguments[1]||{});return new Effect.Opacity(B,A)};Effect.Appear=function(A){A=$(A);var B=Object.extend({from:(A.getStyle("display")=="none"?0:A.getOpacity()||0),to:1,afterFinishInternal:function(C){},beforeSetup:function(C){C.element.setOpacity(C.options.from).show()}},arguments[1]||{});return new Effect.Opacity(A,B)};Effect.Puff=function(A){A=$(A);var B={opacity:A.getInlineOpacity(),position:A.getStyle("position"),top:A.style.top,left:A.style.left,width:A.style.width,height:A.style.height};return new Effect.Parallel([new Effect.Scale(A,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(A,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(C){Position.absolutize(C.effects[0].element)},afterFinishInternal:function(C){C.effects[0].element.hide().setStyle(B)}},arguments[1]||{}))};Effect.BlindUp=function(A){A=$(A);A.makeClipping();return new Effect.Scale(A,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(B){B.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(A){A=$(A);var B=A.getDimensions();return new Effect.Scale(A,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:B.height,originalWidth:B.width},restoreAfterFinish:true,afterSetup:function(C){C.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(C){C.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(A){A=$(A);var B=A.getInlineOpacity();return new Effect.Appear(A,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(C){new Effect.Scale(C.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(D){D.element.makePositioned().makeClipping()},afterFinishInternal:function(D){D.element.hide().undoClipping().undoPositioned().setStyle({opacity:B})}})}},arguments[1]||{}))};Effect.DropOut=function(A){A=$(A);var B={top:A.getStyle("top"),left:A.getStyle("left"),opacity:A.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(A,{x:0,y:100,sync:true}),new Effect.Opacity(A,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(C){C.effects[0].element.makePositioned()},afterFinishInternal:function(C){C.effects[0].element.hide().undoPositioned().setStyle(B)}},arguments[1]||{}))};Effect.Shake=function(C){C=$(C);var A=Object.extend({distance:20,duration:0.5},arguments[1]||{});var D=parseFloat(A.distance);var B=parseFloat(A.duration)/10;var E={top:C.getStyle("top"),left:C.getStyle("left")};return new Effect.Move(C,{x:D,y:0,duration:B,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-D*2,y:0,duration:B*2,afterFinishInternal:function(G){new Effect.Move(G.element,{x:D*2,y:0,duration:B*2,afterFinishInternal:function(H){new Effect.Move(H.element,{x:-D*2,y:0,duration:B*2,afterFinishInternal:function(I){new Effect.Move(I.element,{x:D*2,y:0,duration:B*2,afterFinishInternal:function(J){new Effect.Move(J.element,{x:-D,y:0,duration:B,afterFinishInternal:function(K){K.element.undoPositioned().setStyle(E)}})}})}})}})}})}})};Effect.SlideDown=function(B){B=$(B).cleanWhitespace();var C=B.down().getStyle("bottom");var A=B.getDimensions();return new Effect.Scale(B,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(D){D.element.makePositioned();D.element.down().makePositioned();if(window.opera){D.element.setStyle({top:""})}D.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(D){D.element.down().setStyle({bottom:(D.dims[0]-D.element.clientHeight)+"px"})},afterFinishInternal:function(D){D.element.undoClipping().undoPositioned();D.element.down().undoPositioned().setStyle({bottom:C})}},arguments[1]||{}))};Effect.SlideUp=function(B){B=$(B).cleanWhitespace();var C=B.down().getStyle("bottom");var A=B.getDimensions();return new Effect.Scale(B,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(D){D.element.makePositioned();D.element.down().makePositioned();if(window.opera){D.element.setStyle({top:""})}D.element.makeClipping().show()},afterUpdateInternal:function(D){D.element.down().setStyle({bottom:(D.dims[0]-D.element.clientHeight)+"px"})},afterFinishInternal:function(D){D.element.hide().undoClipping().undoPositioned();D.element.down().undoPositioned().setStyle({bottom:C})}},arguments[1]||{}))};Effect.Squish=function(A){return new Effect.Scale(A,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(B){B.element.makeClipping()},afterFinishInternal:function(B){B.element.hide().undoClipping()}})};Effect.Grow=function(F){F=$(F);var E=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var D={top:F.style.top,left:F.style.left,height:F.style.height,width:F.style.width,opacity:F.getInlineOpacity()};var B=F.getDimensions();var C,A;var H,G;switch(E.direction){case"top-left":C=A=H=G=0;break;case"top-right":C=B.width;A=G=0;H=-B.width;break;case"bottom-left":C=H=0;A=B.height;G=-B.height;break;case"bottom-right":C=B.width;A=B.height;H=-B.width;G=-B.height;break;case"center":C=B.width/2;A=B.height/2;H=-B.width/2;G=-B.height/2;break}return new Effect.Move(F,{x:C,y:A,duration:0.01,beforeSetup:function(I){I.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(I){new Effect.Parallel([new Effect.Opacity(I.element,{sync:true,to:1,from:0,transition:E.opacityTransition}),new Effect.Move(I.element,{x:H,y:G,sync:true,transition:E.moveTransition}),new Effect.Scale(I.element,100,{scaleMode:{originalHeight:B.height,originalWidth:B.width},sync:true,scaleFrom:window.opera?1:0,transition:E.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(J){J.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(J){J.effects[0].element.undoClipping().undoPositioned().setStyle(D)}},E))}})};Effect.Shrink=function(B){B=$(B);var A=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var F={top:B.style.top,left:B.style.left,height:B.style.height,width:B.style.width,opacity:B.getInlineOpacity()};var E=B.getDimensions();var D,C;switch(A.direction){case"top-left":D=C=0;break;case"top-right":D=E.width;C=0;break;case"bottom-left":D=0;C=E.height;break;case"bottom-right":D=E.width;C=E.height;break;case"center":D=E.width/2;C=E.height/2;break}return new Effect.Parallel([new Effect.Opacity(B,{sync:true,to:0,from:1,transition:A.opacityTransition}),new Effect.Scale(B,window.opera?1:0,{sync:true,transition:A.scaleTransition,restoreAfterFinish:true}),new Effect.Move(B,{x:D,y:C,sync:true,transition:A.moveTransition})],Object.extend({beforeStartInternal:function(G){G.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(G){G.effects[0].element.hide().undoClipping().undoPositioned().setStyle(F)}},A))};Effect.Pulsate=function(B){B=$(B);var A=arguments[1]||{};var E=B.getInlineOpacity();var D=A.transition||Effect.Transitions.sinoidal;var C=function(F){return D(1-Effect.Transitions.pulse(F,A.pulses))};C.bind(D);return new Effect.Opacity(B,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(F){F.element.setStyle({opacity:E})}},A),{transition:C}))};Effect.Fold=function(A){A=$(A);var B={top:A.style.top,left:A.style.left,width:A.style.width,height:A.style.height};A.makeClipping();return new Effect.Scale(A,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(C){new Effect.Scale(A,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(D){D.element.hide().undoClipping().setStyle(B)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(B){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(C.style)){this.style=$H(C.style)}else{if(C.style.include(":")){this.style=C.style.parseStyle()}else{this.element.addClassName(C.style);this.style=$H(this.element.getStyles());this.element.removeClassName(C.style);var A=this.element.getStyles();this.style=this.style.reject(function(D){return D.value==A[D.key]});C.afterFinishInternal=function(D){D.element.addClassName(D.options.style);D.transforms.each(function(E){D.element.style[E.style]=""})}}}this.start(C)},setup:function(){function A(B){if(!B||["rgba(0, 0, 0, 0)","transparent"].include(B)){B="#ffffff"}B=B.parseColor();return $R(0,2).map(function(C){return parseInt(B.slice(C*2+1,C*2+3),16)})}this.transforms=this.style.map(function(C){var G=C[0],F=C[1],E=null;if(F.parseColor("#zzzzzz")!="#zzzzzz"){F=F.parseColor();E="color"}else{if(G=="opacity"){F=parseFloat(F);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(F)){var D=F.match(/^([\+\-]?[0-9\.]+)(.*)$/);F=parseFloat(D[1]);E=(D.length==3)?D[2]:null}}}var B=this.element.getStyle(G);return{style:G.camelize(),originalValue:E=="color"?A(B):parseFloat(B||0),targetValue:E=="color"?A(F):F,unit:E}}.bind(this)).reject(function(B){return((B.originalValue==B.targetValue)||(B.unit!="color"&&(isNaN(B.originalValue)||isNaN(B.targetValue))))})},update:function(D){var C={},A,B=this.transforms.length;while(B--){C[(A=this.transforms[B]).style]=A.unit=="color"?"#"+(Math.round(A.originalValue[0]+(A.targetValue[0]-A.originalValue[0])*D)).toColorPart()+(Math.round(A.originalValue[1]+(A.targetValue[1]-A.originalValue[1])*D)).toColorPart()+(Math.round(A.originalValue[2]+(A.targetValue[2]-A.originalValue[2])*D)).toColorPart():(A.originalValue+(A.targetValue-A.originalValue)*D).toFixed(3)+(A.unit===null?"":A.unit)}this.element.setStyle(C,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 B=C.values().first();this.tracks.push($H({ids:C.keys().first(),effect:Effect.Morph,options:{style:B}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(E){var C=E.get("ids"),B=E.get("effect"),A=E.get("options");var D=[$(C)||$$(C)].flatten();return D.map(function(F){return new B(F,Object.extend({sync:true},A))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var A,B=$H();if(Prototype.Browser.WebKit){A=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='
';A=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(C){if(A[C]){B.set(C,A[C])}});if(Prototype.Browser.IE&&this.include("opacity")){B.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return B};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(A){var B=document.defaultView.getComputedStyle($(A),null);return Element.CSS_PROPERTIES.inject({},function(D,C){D[C]=B[C];return D})}}else{Element.getStyles=function(A){A=$(A);var C=A.currentStyle,B;B=Element.CSS_PROPERTIES.inject({},function(E,D){E[D]=C[D];return E});if(!B.opacity){B.opacity=A.getOpacity()}return B}}Effect.Methods={morph:function(B,A){B=$(B);new Effect.Morph(B,Object.extend({style:A},arguments[2]||{}));return B},visualEffect:function(B,D,A){B=$(B);var C=D.dasherize().camelize(),E=C.charAt(0).toUpperCase()+C.substring(1);new Effect[E](B,A);return B},highlight:function(A,B){A=$(A);new Effect.Highlight(A,B);return A}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(A){Effect.Methods[A]=function(B,C){B=$(B);Effect[A.charAt(0).toUpperCase()+A.substring(1)](B,C);return B}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(A){Effect.Methods[A]=Element[A]});Element.addMethods(Effect.Methods);if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(B){this.drops=this.drops.reject(function(A){return A.element==$(B)})},add:function(F){F=$(F);var D=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(D.containment){D._containers=[];var E=D.containment;if(Object.isArray(E)){E.each(function(A){D._containers.push($(A))})}else{D._containers.push($(E))}}if(D.accept){D.accept=[D.accept].flatten()}Element.makePositioned(F);D.element=F;this.drops.push(D)},findDeepestChild:function(B){deepest=B[0];for(i=1;i0){H=Droppables.findDeepestChild(F)}if(this.last_active&&this.last_active!=H){this.deactivate(this.last_active)}if(H){Position.within(H.element,E[0],E[1]);if(H.onHover){H.onHover(G,H.element,Position.overlap(H.overlap,H.element))}if(H!=this.last_active){Droppables.activate(H)}}},fire:function(D,C){if(!this.last_active){return }Position.prepare();if(this.isAffected([Event.pointerX(D),Event.pointerY(D)],C,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(C,this.last_active.element,D);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(B){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(B)},unregister:function(B){this.drags=this.drags.reject(function(A){return A==B});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(B){if(B.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=B}.bind(this),B.options.delay)}else{window.focus();this.activeDraggable=B}},deactivate:function(){this.activeDraggable=null},updateDrag:function(C){if(!this.activeDraggable){return }var D=[Event.pointerX(C),Event.pointerY(C)];if(this._lastPointer&&(this._lastPointer.inspect()==D.inspect())){return }this._lastPointer=D;this.activeDraggable.updateDrag(C,D)},endDrag:function(B){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return }this._lastPointer=null;this.activeDraggable.endDrag(B);this.activeDraggable=null},keyPress:function(B){if(this.activeDraggable){this.activeDraggable.keyPress(B)}},addObserver:function(B){this.observers.push(B);this._cacheObserverCallbacks()},removeObserver:function(B){this.observers=this.observers.reject(function(A){return A.element==B});this._cacheObserverCallbacks()},notify:function(F,D,E){if(this[F+"Count"]>0){this.observers.each(function(A){if(A[F]){A[F](F,D,E)}})}if(D.options[F]){D.options[F](D,E)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(B){Draggables[B+"Count"]=Draggables.observers.select(function(A){return A[B]}).length})}};var Draggable=Class.create({initialize:function(F){var E={handle:false,reverteffect:function(B,C,H){var A=Math.sqrt(Math.abs(C^2)+Math.abs(H^2))*0.02;new Effect.Move(B,{x:-H,y:-C,duration:A,queue:{scope:"_draggable",position:"end"}})},endeffect:function(A){var B=Object.isNumber(A._opacity)?A._opacity:1;new Effect.Opacity(A,{duration:0.2,from:0.7,to:B,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[A]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(E,{starteffect:function(A){A._opacity=Element.getOpacity(A);Draggable._dragging[A]=true;new Effect.Opacity(A,{duration:0.2,from:A._opacity,to:0.7})}})}var D=Object.extend(E,arguments[1]||{});this.element=$(F);if(D.handle&&Object.isString(D.handle)){this.handle=this.element.down("."+D.handle,0)}if(!this.handle){this.handle=$(D.handle)}if(!this.handle){this.handle=this.element}if(D.scroll&&!D.scroll.scrollTo&&!D.scroll.outerHTML){D.scroll=$(D.scroll);this._isScrollChild=Element.childOf(this.element,D.scroll)}Element.makePositioned(this.element);this.options=D;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(E){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return }if(Event.isLeftClick(E)){var G=Event.element(E);if((tag_name=G.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var H=[Event.pointerX(E),Event.pointerY(E)];var F=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(A){return(H[A]-F[A])});Draggables.activate(this);Event.stop(E)}},startDrag:function(D){this.dragging=true;if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this.element._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var C=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=C.left;this.originalScrollTop=C.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,D);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(L,I){this.dragging=false;if(this.options.quiet){Position.prepare();var J=[Event.pointerX(L),Event.pointerY(L)];Droppables.show(J,this.element)}if(this.options.ghosting){if(!this.element._originallyAbsolute){Position.relativize(this.element)}if(!Prototype.Browser.IE){delete this.element._originallyAbsolute}Element.remove(this._clone);this._clone=null}var H=false;if(I){H=Droppables.fire(L,this.element);if(!H){H=false}}if(H&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,L);var G=this.options.revert;if(G&&Object.isFunction(G)){G=G(this.element)}var K=this.currentDelta();if(G&&this.options.reverteffect){if(H==0||G!="failure"){this.options.reverteffect(this.element,K[1]-this.delta[1],K[0]-this.delta[0])}}else{this.delta=K}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(B){if(B.keyCode!=Event.KEY_ESC){return }this.finishDrag(B,false);Event.stop(B)},endDrag:function(B){if(!this.dragging){return }this.stopScrolling();this.finishDrag(B,true);Event.stop(B)},draw:function(G){var H=Position.cumulativeOffset(this.element);if(this.options.ghosting){var K=Position.realOffset(this.element);H[0]+=K[0]-Position.deltaX;H[1]+=K[1]-Position.deltaY}var I=this.currentDelta();H[0]-=I[0];H[1]-=I[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){H[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;H[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var J=[0,1].map(function(A){return(G[A]-H[A]-this.offset[A])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){J=this.options.snap(J[0],J[1],this)}else{if(Object.isArray(this.options.snap)){J=J.map(function(B,A){return(B/this.options.snap[A]).round()*this.options.snap[A]}.bind(this))}else{J=J.map(function(A){return(A/this.options.snap).round()*this.options.snap}.bind(this))}}}var L=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){L.left=J[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){L.top=J[1]+"px"}if(L.visibility=="hidden"){L.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(B){if(!(B[0]||B[1])){return }this.scrollSpeed=[B[0]*this.options.scrollSpeed,B[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(D,C){this.element=$(D);this.observer=C;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(B){while(B.tagName.toUpperCase()!="BODY"){if(B.id&&Sortable.sortables[B.id]){return B}B=B.parentNode}},options:function(B){B=Sortable._findRootElement($(B));if(!B){return }return Sortable.sortables[B.id]},destroy:function(C){var D=Sortable.options(C);if(D){Draggables.removeObserver(D.element);D.droppables.each(function(A){Droppables.remove(A)});D.draggables.invoke("destroy");delete Sortable.sortables[D.element.id]}},create:function(I){I=$(I);var J=Object.extend({element:I,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:I,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction,onStart:Prototype.emptyFunction,onEnd:Prototype.emptyFunction},arguments[1]||{});this.destroy(I);var F={revert:true,quiet:J.quiet,scroll:J.scroll,scrollSpeed:J.scrollSpeed,scrollSensitivity:J.scrollSensitivity,delay:J.delay,ghosting:J.ghosting,constraint:J.constraint,handle:J.handle,onStart:J.onStart,onEnd:J.onEnd};if(J.starteffect){F.starteffect=J.starteffect}if(J.reverteffect){F.reverteffect=J.reverteffect}else{if(J.ghosting){F.reverteffect=function(A){A.style.top=0;A.style.left=0}}}if(J.endeffect){F.endeffect=J.endeffect}if(J.zindex){F.zindex=J.zindex}var H={overlap:J.overlap,containment:J.containment,tree:J.tree,hoverclass:J.hoverclass,onHover:Sortable.onHover};var G={onHover:Sortable.onEmptyHover,overlap:J.overlap,containment:J.containment,hoverclass:J.hoverclass};Element.cleanWhitespace(I);J.draggables=[];J.droppables=[];if(J.dropOnEmpty||J.tree){Droppables.add(I,G);J.droppables.push(I)}(J.elements||this.findElements(I,J)||[]).each(function(A,C){var B=J.handles?$(J.handles[C]):(J.handle?$(A).select("."+J.handle)[0]:A);J.draggables.push(new Draggable(A,Object.extend(F,{handle:B})));Droppables.add(A,H);if(J.tree){A.treeNode=I}J.droppables.push(A)});if(J.tree){(Sortable.findTreeElements(I,J)||[]).each(function(A){Droppables.add(A,G);A.treeNode=I;J.droppables.push(A)})}this.sortables[I.id]=J;Draggables.addObserver(new SortableObserver(I,J.onUpdate))},findElements:function(D,C){return Element.findChildren(D,C.only,C.tree?true:false,C.tag)},findTreeElements:function(D,C){return Element.findChildren(D,C.only,C.tree?true:false,C.treeTag)},onHover:function(G,H,F){if(Element.isParent(H,G)){return }if(F>0.33&&F<0.66&&Sortable.options(H).tree){return }else{if(F>0.5){Sortable.mark(H,"before");if(H.previousSibling!=G){var J=G.parentNode;G.style.visibility="hidden";H.parentNode.insertBefore(G,H);if(H.parentNode!=J){Sortable.options(J).onChange(G)}Sortable.options(H.parentNode).onChange(G)}}else{Sortable.mark(H,"after");var I=H.nextSibling||null;if(I!=G){var J=G.parentNode;G.style.visibility="hidden";H.parentNode.insertBefore(G,I);if(H.parentNode!=J){Sortable.options(J).onChange(G)}Sortable.options(H.parentNode).onChange(G)}}}},onEmptyHover:function(R,P,O){var N=R.parentNode;var M=Sortable.options(P);if(!Element.isParent(P,R)){var Q;var K=Sortable.findElements(P,{tag:M.tag,only:M.only});var L=null;if(K){var J=Element.offsetSize(P,M.overlap)*(1-O);for(Q=0;Q=0){J-=Element.offsetSize(K[Q],M.overlap)}else{if(J-(Element.offsetSize(K[Q],M.overlap)/2)>=0){L=Q+10?G.flatten():[])};Element.offsetSize=function(C,D){return C["offset"+((D=="vertical"||D=="height")?"Height":"Width")]};if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(A,B,C){A=$(A);this.element=A;this.update=$(B);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(C)}else{this.options=C||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(E,D){if(!D.style.position||D.style.position=="absolute"){D.style.position="absolute";Position.clone(E,D,{setHeight:false,offsetTop:E.offsetHeight})}Effect.Appear(D,{duration:0.15})};this.options.onHide=this.options.onHide||function(E,D){new Effect.Fade(D,{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,'');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(A){var B=Event.findElement(A,"LI");if(this.index!=B.autocompleteIndex){this.index=B.autocompleteIndex;this.render()}Event.stop(A)},onClick:function(A){var B=Event.findElement(A,"LI");this.index=B.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;A0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index0){C=Element.collectTextNodes(F[0],this.options.select)}}else{C=Element.collectTextNodesIgnoreClass(E,"informal")}var B=this.getTokenBounds();if(B[0]!=-1){var D=this.element.value.substr(0,B[0]);var A=this.element.value.substr(B[0]).match(/^\s+/);if(A){D+=A[0]}this.element.value=D+C+this.element.value.substr(B[1])}else{this.element.value=C}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,E)}},updateChoices:function(B){if(!this.changed&&this.hasFocus){this.update.innerHTML=B;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 C=0;C=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 H=this.element.value;if(H.strip().empty()){return[-1,0]}var A=arguments.callee.getFirstDifferencePos(H,this.oldElementValue);var C=(A==this.oldElementValue.length?1:0);var G=-1,F=H.length;var B;for(var E=0,D=this.options.tokens.length;EG){G=B}B=H.indexOf(this.options.tokens[E],A+C);if(-1!=B&&B"+C.substr(0,E.length)+""+C.substr(E.length)+"");break}else{if(E.length>=F.options.partialChars&&F.options.partialSearch&&B!=-1){if(F.options.fullSearch||/\s/.test(C.substr(B-1,1))){G.push("
  • "+C.substr(0,B)+""+C.substr(B,E.length)+""+C.substr(B+E.length)+"
  • ");break}}}B=F.options.ignoreCase?C.toLowerCase().indexOf(E.toLowerCase(),B+1):C.indexOf(E,B+1)}}if(G.length){H=H.concat(G.slice(0,F.options.choices-H.length))}return"
      "+H.join("")+"
    "}},A||{})}});Field.scrollFreeActivate=function(A){setTimeout(function(){Field.activate(A)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(B,A,C){this.url=A;this.element=B=$(B);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(C);Object.extend(this.options,C||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=""}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}if(!this.options.externalControl){this.options.externalControlOnly=false}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(A){if(!this._editing||A.ctrlKey||A.altKey||A.shiftKey){return }if(Event.KEY_ESC==A.keyCode){this.handleFormCancellation(A)}else{if(Event.KEY_RETURN==A.keyCode){this.handleFormSubmission(A)}}},createControl:function(D,G,F){var B=this.options[D+"Control"];var C=this.options[D+"Text"];if("button"==B){var E=document.createElement("input");E.type="submit";E.value=C;E.className="editor_"+D+"_button";if("cancel"==D){E.onclick=this._boundCancelHandler}this._form.appendChild(E);this._controls[D]=E}else{if("link"==B){var A=document.createElement("a");A.href="#";A.appendChild(document.createTextNode(C));A.onclick="cancel"==D?this._boundCancelHandler:this._boundSubmitHandler;A.className="editor_"+D+"_link";if(F){A.className+=" "+F}this._form.appendChild(A);this._controls[D]=A}}},createEditField:function(){var B=(this.options.loadTextURL?this.options.loadingText:this.getText());var A;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){A=document.createElement("input");A.type="text";var C=this.options.size||this.options.cols||0;if(0=this.options.rows?this.options.autoRows:this.options.rows);A.cols=this.options.cols||40}A.name=this.options.paramName;A.value=B;A.className="editor_field";if(this.options.submitOnBlur){A.onblur=this._boundSubmitHandler}this._controls.editor=A;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var A=this;function B(E,C){var D=A.options["text"+E+"Controls"];if(!D||C===false){return }A._form.appendChild(document.createTextNode(D))}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)}B("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);B("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");B("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},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(C){var A=this._form;var B=$F(this._controls.editor);this.prepareSubmission();var D=this.options.callback(A,B)||"";if(Object.isString(D)){D=D.toQueryParams()}D.editorId=this.element.id;if(this.options.htmlResponse){var E=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(E,{parameters:D,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,E)}else{var E=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(E,{parameters:D,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,E)}if(C){Event.stop(C)}},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(B){this._form.removeClassName(this.options.loadingClassName);var C=B.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(B){A=this[B.value].bind(this);this._listeners[B.key]=A;if(!this.options.externalControlOnly){this.element.observe(B.key,A)}if(this.options.externalControl){this.options.externalControl.observe(B.key,A)}}.bind(this))},removeForm:function(){if(!this._form){return }this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(A,B){if("function"==typeof this.options[A]){this.options[A](this,B)}},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,B,A,C){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(B,A,C)},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(A){this._controls.editor.disabled=true;var B=this._controls.editor.firstChild;if(!B){B=document.createElement("option");B.value="";this._controls.editor.appendChild(B);B.selected=true}B.update((A||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(B){this._text=B.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,A)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(D){return 2===D.length?D:[D,D].flatten()});var A=("value" in this.options)?this.options.value:this._text;var C=this._collection.any(function(D){return D[0]==A}.bind(this));this._controls.editor.update("");var B;this._collection.each(function(D,E){B=document.createElement("option");B.value=D[0];B.selected=C?D[0]==A:0==E;B.appendChild(document.createTextNode(D[1]));this._controls.editor.appendChild(B)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(B){if(!B){return }function A(D,C){if(D in B||C===undefined){return }B[D]=C}A("cancelControl",(B.cancelLink?"link":(B.cancelButton?"button":B.cancelLink==B.cancelButton==false?false:undefined)));A("okControl",(B.okLink?"link":(B.okButton?"button":B.okLink==B.okButton==false?false:undefined)));A("highlightColor",B.highlightcolor);A("highlightEndColor",B.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(A){return Form.serialize(A)},onComplete:function(A,B){new Effect.Highlight(B,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(A){A.element.style.backgroundColor=A.options.highlightColor;if(A._effect){A._effect.cancel()}},onFailure:function(A,B){alert("Error communication with the server: "+A.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(A){A._effect=new Effect.Highlight(A.element,{startcolor:A.options.highlightColor,endcolor:A.options.highlightEndColor,restorecolor:A._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(A,C,B){this.delay=C||0.5;this.element=$(A);this.callback=B;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(A){if(this.lastValue==$F(this.element)){return }if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});if(!Control){var Control={}}Control.Slider=Class.create();Control.Slider.prototype={initialize:function(C,D,A){var B=this;if(C instanceof Array){this.handles=C.collect(function(E){return $(E)})}else{this.handles=[$(C)]}this.track=$(D);this.options=A||{};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(E){return $(E)}):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(E,F){F=B.handles.length-1-F;B.setValue(parseFloat((B.options.sliderValue instanceof Array?B.options.sliderValue[F]:B.options.sliderValue)||B.range.start),F);Element.makePositioned(E);Event.observe(E,"mousedown",B.eventMouseDown)});Event.observe(this.track,"mousedown",this.eventMouseDown);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var A=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(B){Event.stopObserving(B,"mousedown",A.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(C){if(this.allowedValues){if(C>=this.allowedValues.max()){return(this.allowedValues.max())}if(C<=this.allowedValues.min()){return(this.allowedValues.min())}var B=Math.abs(this.allowedValues[0]-C);var A=this.allowedValues[0];this.allowedValues.each(function(E){var D=Math.abs(E-C);if(D<=B){A=E;B=D}});return A}if(C>this.range.end){return this.range.end}if(C0)&&(Athis.values[B+1])){A=this.values[B+1]}}A=this.getNearestValue(A);this.values[B]=A;this.value=this.values[0];this.handles[B].style[this.isVertical()?"top":"left"]=this.translateToPx(A);this.drawSpans();if(!this.dragging||!this.event){this.updateFinished()}},setValueBy:function(A,B){this.setValue(this.values[B||this.activeHandleIdx||0]+A,B||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(A){var B=this.values.sortBy(Prototype.K);A=A||0;return $R(B[A],B[A+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.alignY)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var A=this;if(this.spans){$R(0,this.spans.length-1).each(function(B){A.setSpan(A.spans[B],A.getRange(B))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(A,B){if(this.isVertical()){A.style.top=this.translateToPx(B.start);A.style.height=this.translateToPx(B.end-B.start+this.range.start)}else{A.style.left=this.translateToPx(B.start);A.style.width=this.translateToPx(B.end-B.start+this.range.start)}},updateStyles:function(){this.handles.each(function(A){Element.removeClassName(A,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(B){if(Event.isLeftClick(B)){if(!this.disabled){this.active=true;var C=Event.element(B);var D=[Event.pointerX(B),Event.pointerY(B)];var E=C;if(E==this.track){var A=Position.cumulativeOffset(this.track);this.event=B;this.setValue(this.translateToValue((this.isVertical()?D[1]-A[1]:D[0]-A[0])-(this.handleLength/2)));var A=Position.cumulativeOffset(this.activeHandle);this.offsetX=(D[0]-A[0]);this.offsetY=(D[1]-A[1])}else{while((this.handles.indexOf(C)==-1)&&C.parentNode){C=C.parentNode}if(this.handles.indexOf(C)!=-1){this.activeHandle=C;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var A=Position.cumulativeOffset(this.activeHandle);this.offsetX=(D[0]-A[0]);this.offsetY=(D[1]-A[1])}}}Event.stop(B)}},update:function(A){if(this.active){if(!this.dragging){this.dragging=true}this.draw(A);if(navigator.appVersion.indexOf("AppleWebKit")>0){window.scrollBy(0,0)}Event.stop(A)}},draw:function(A){var B=[Event.pointerX(A),Event.pointerY(A)];var C=Position.cumulativeOffset(this.track);B[0]-=this.offsetX+C[0];B[1]-=this.offsetY+C[1];this.event=A;this.setValue(this.translateToValue(this.isVertical()?B[1]:B[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(B,A){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}};var Resizables={resizers:[],observers:[],register:function(B){if(this.resizers.length===0){this.eventMouseUp=this.endResize.bindAsEventListener(this);this.eventMouseMove=this.updateResize.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.resizers.push(B)},unregister:function(B){this.resizers=this.resizers.reject(function(A){return A==B});if(this.resizers.length===0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(B){if(B.options.delay){this._timeout=setTimeout(function(){Resizables._timeout=null;window.focus();Resizables.activeResizable=B}.bind(this),B.options.delay)}else{window.focus();this.activeResizable=B}},deactivate:function(){this.activeResizable=null},updateResize:function(C){if(!this.activeResizable){return }var D=[Event.pointerX(C),Event.pointerY(C)];if(this._lastPointer&&(this._lastPointer.inspect()==D.inspect())){return }this._lastPointer=D;this.activeResizable.updateResize(C,D)},endResize:function(B){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeResizable){return }this._lastPointer=null;this.activeResizable.endResize(B);this.activeResizable=null},keyPress:function(B){if(this.activeResizable){this.activeResizable.keyPress(B)}},addObserver:function(B){this.observers.push(B);this._cacheObserverCallbacks()},removeObserver:function(B){this.observers=this.observers.reject(function(A){return A.element==B});this._cacheObserverCallbacks()},notify:function(D,F,E){if(this[D+"Count"]>0){this.observers.each(function(A){if(A[D]){A[D](D,F,E)}})}if(F.options[D]){F.options[D](F,E)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onResize"].each(function(B){Resizables[B+"Count"]=Resizables.observers.select(function(A){return A[B]}).length})}};var Resizable=Class.create();Resizable._resizing={};Resizable.prototype={initialize:function(F){var E={handle:false,endeffect:function(B){var C=typeof B._opacity=="number"?B._opacity:1;var A=new Effect.Opacity(B,{duration:0.2,from:0.7,to:C,queue:{scope:"_resizable",position:"end"},afterFinish:function(){Resizable._resizing[B]=false}})},zindex:1000,revert:false,snap:false,delay:0};if(!arguments[1]||typeof arguments[1].endeffect=="undefined"){Object.extend(E,{starteffect:function(A){A._opacity=Element.getOpacity(A);Resizable._resizing[A]=true;var B=new Effect.Opacity(A,{duration:0.2,from:A._opacity,to:0.7})}})}var D=Object.extend(E,arguments[1]||{});this.element=$(F);if(D.handle&&(typeof D.handle=="string")){this.handle=this.element.down("."+D.handle,0)}if(!this.handle){this.handle=$(D.handle)}if(!this.handle){this.handle=this.element}Element.makePositioned(this.element);this.delta=this.currentDelta();this.options=D;this.resizing=false;this.eventMouseDown=this.initResize.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Resizables.register(this)},reverteffect:function(J,H,M){var I=this._edim[0]-H;var N=this._edim[1]-M;var K=new Effect.ReSize(J,{direction:"vert",amount:N});var L=new Effect.ReSize(J,{direction:"horizontal",amount:I})},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Resizables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0",10),parseInt(Element.getStyle(this.element,"top")||"0",10)])},initResize:function(H){if(typeof Resizable._resizing[this.element]!="undefined"&&Resizable._resizing[this.element]){return }if(Event.isLeftClick(H)){var L=Event.element(H);if((tag_name=L.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var M=[Event.pointerX(H),Event.pointerY(H)];this._initialX=M[0];this._initialY=M[1];var N=Element.getDimensions(this.element);this._edim=[N.width,N.height];this._min=[1,1];this._max=[0,0];var I=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(A){return(M[A]-I[A])});if(this.options.bind===true){this._parentDim=Element.getDimensions(this.element.parentNode);var J=Position.cumulativeOffset(this.element.parentNode);var K=Position.cumulativeOffset(this.element);this.elementOffset=[K[0]-J[0],K[1]-J[1]]}if(this.options.min){if(this.options.min instanceof Array){this._min=this._min.map(function(B,A){return(this.options.min[A]>0?this.options.min[A]:1)}.bind(this))}else{this._min=this._min.map(function(B,A){return(this.options.min>0?this.options.min:1)}.bind(this))}}if(this.options.max){if(this.options.max instanceof Array){this._max=this._max.map(function(B,A){return(this.options.max[A]>=this._min[A])?this.options.max[A]:0}.bind(this))}else{this._max=this._max.map(function(B,A){return(this.options.max>=this._min[A])?this.options.max:0}.bind(this))}}Resizables.activate(this);Event.stop(H)}},startResize:function(D){this.resizing=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0,10);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element.parentNode.insertBefore(this._clone,this.element);var C=this._clone.style;Position.absolutize(this._clone);if(navigator.appName.indexOf("Microsoft")!=-1&&parseInt(Element.getStyle(this.element,"margin-top"),10)>0){this.element.style.top=C.marginTop}C.margin="0px"}Resizables.notify("onStart",this,D);if(this.options.starteffect){this.options.starteffect(this.element)}},updateResize:function(C,D){if(!this.resizing){this.startResize(C)}Resizables.notify("onResize",this,C);this.draw(D);if(this.options.change){this.options.change(this)}Event.stop(C)},finishResize:function(H,F){this.resizing=false;if(this.options.ghosting){if(navigator.appName.indexOf("Microsoft")!=-1&&parseInt(Element.getStyle(this.element,"margin-top"),10)>0){this.element.style.top=this._clone.style.marginTop}Element.remove(this._clone);this._clone=null}Resizables.notify("onEnd",this,H);var E=this.options.revert;if(E&&typeof E=="function"){E=E(this.element)}if(E&&this.reverteffect){var G=Element.getDimensions(this.element);this.reverteffect(this.element,G.width,G.height)}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Resizables.deactivate(this)},keyPress:function(B){if(B.keyCode!=Event.KEY_ESC){return }this.finishResize(B,false);Event.stop(B)},endResize:function(B){if(!this.resizing){return }this.finishResize(B,true);Event.stop(B)},draw:function(H){var I=Position.cumulativeOffset(this.element);var J=this.currentDelta();I[0]-=J[0];I[1]-=J[1];var K=[0,1].map(function(A){return(H[A]-I[A]-this.offset[A])}.bind(this));var M=K[0]+this._edim[0]-J[0];var L=K[1]+this._edim[1]-J[1];K[0]=(M>this._min[0])?M:this._min[0];K[1]=(L>this._min[1])?L:this._min[1];if(this.options.snap){if(typeof this.options.snap=="function"){K=this.options.snap(K[0],K[1],this)}else{if(this.options.snap instanceof Array){K=K.map(function(C,B){var A=Math.round(C/this.options.snap[B])*this.options.snap[B];return(this.options.snap[B]>0)?((A>this._min[B])?A:this._min[B]):this._edim[B]}.bind(this))}else{K=K.map(function(C,B){var A=Math.round(C/this.options.snap)*this.options.snap-J[B];return(this.options.snap>0)?((A>this._min[B])?A:this._min[B]):this._edim[B]}.bind(this))}}}if(this.options.bind){if(this._parentDim.width<=K[0]+this.elementOffset[0]){K[0]=this._parentDim.width-this.elementOffset[0]-2}if(this._parentDim.height<=K[1]+this.elementOffset[1]){K[1]=this._parentDim.height-this.elementOffset[1]-2}}if(this.options.min){K[0]=K[0]>this._min[0]?K[0]:this._min[0];K[1]=K[1]>this._min[1]?K[1]:this._min[1]}if(this.options.max){K[0]=K[0]0?this._max[0]:K[0]);K[1]=K[1]0?this._max[1]:K[1])}var N=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){N.width=K[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){N.height=K[1]+"px"}if(N.visibility=="hidden"){N.visibility=""}}};Effect.ReSize=Class.create();Object.extend(Object.extend(Effect.ReSize.prototype,Effect.Base.prototype),{initialize:function(D){this.element=D;if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({amount:100,direction:"vert",toSize:null},arguments[1]||{});if(C.direction=="vert"){this.originalSize=C.originalSize||parseInt(this.element.style.height,10)}else{this.originalSize=C.originalSize||parseInt(this.element.style.width,10)}if(C.toSize!==null){C.amount=C.toSize-this.originalSize}this.start(C)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return }},update:function(B){if(this.options.direction=="vert"){this.element.setStyle({height:this.originalSize+(this.options.amount*B)+"px"})}else{this.element.setStyle({width:this.originalSize+(this.options.amount*B)+"px"})}},finish:function(){if(this.options.direction=="vert"){this.element.setStyle({height:this.originalSize+this.options.amount+"px"})}else{this.element.setStyle({width:this.originalSize+this.options.amount+"px"})}}}); /*** CustomControls.js - 6.0 kb ***/ // JScript File // CONSOLE PROTECTION if(typeof(console) == 'undefined') console = {log: function(obj){}}; // DATE.FORMAT.JS var dateFormat = function () { var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function (value, length) { value = String(value); length = parseInt(length) || 2; while (value.length < length) value = "0" + value; return value; }; // Regexes and supporting functions are cached through closure return function (date, mask) { // Treat the first argument as a mask if it doesn't contain any numbers if ( arguments.length == 1 && (typeof date == "string" || date instanceof String) && !/\d/.test(date) ) { mask = date; date = undefined; } date = date ? new Date(date) : new Date(); if (isNaN(date)) throw "invalid date"; var dF = dateFormat; mask = String(dF.masks[mask] || mask || dF.masks["default"]); var d = date.getDate(), D = date.getDay(), m = date.getMonth(), y = date.getFullYear(), H = date.getHours(), M = date.getMinutes(), s = date.getSeconds(), L = date.getMilliseconds(), o = date.getTimezoneOffset(), flags = { d: d, dd: pad(d), ddd: dF.i18n.dayNames[D], dddd: dF.i18n.dayNames[D + 7], m: m + 1, mm: pad(m + 1), mmm: dF.i18n.monthNames[m], mmmm: dF.i18n.monthNames[m + 12], yy: String(y).slice(2), yyyy: y, h: H % 12 || 12, hh: pad(H % 12 || 12), H: H, HH: pad(H), M: M, MM: pad(M), s: s, ss: pad(s), l: pad(L, 3), L: pad(L > 99 ? Math.round(L / 10) : L), t: H < 12 ? "a" : "p", tt: H < 12 ? "am" : "pm", T: H < 12 ? "A" : "P", TT: H < 12 ? "AM" : "PM", Z: (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4) }; return mask.replace(token, function ($0) { return ($0 in flags) ? flags[$0] : $0.slice(1, $0.length - 1); }); }; }(); // Some common format strings dateFormat.masks = { "default": "ddd mmm d yyyy HH:MM:ss", shortDate: "m/d/yy", mediumDate: "mmm d, yyyy", longDate: "mmmm d, yyyy", fullDate: "dddd, mmmm d, yyyy", shortTime: "h:MM TT", mediumTime: "h:MM:ss TT", longTime: "h:MM:ss TT Z", isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoFullDateTime: "yyyy-mm-dd'T'HH:MM:ss.lo" }; // Internationalization strings dateFormat.i18n = { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] }; // For convenience... Date.prototype.format = function (mask) { return dateFormat(this, mask); } // String Builder var StringBuilder = Class.create({ initialize: function() { this.array = new Array(); }, Append: function(str) { this.array.push(str); }, AppendStrings: function(arr) { this.array.push(arr.join("")); }, AppendFormat: function(str, obj) { this.array.push(str.interpolate(obj)); }, AppendLine: function() { this.array.push("\n"); }, Length: function() { return this.array.join("").length; }, ToString: function() { return this.array.join(""); } }); var SSMath = function() { var usa = function() { this.UPrice = function(risk, towin) { return (towin >= risk) ? (towin/risk) * 100 : (risk/towin) * -100; } this.URisk = function(price, towin) { return (price > 0) ? (towin/price) * 100 : (-price * towin) / 100; } this.UToWin = function(price, risk) { return (price > 0) ? (price * risk) / 100 : (risk/-price) * 100; } } this.USAOdds = new usa(); var dec = function() { this.UPrice = function(risk, towin) { return (towin/risk) + 1; } this.URisk = function(price, towin) { return towin / (price - 1); } this.UToWin = function(price, risk) { return (price * risk) - risk; } } this.Decimal = new dec(); this.ToCurrency = function(num) {num = num.toString().replace(/\$|\,/g,'');if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num)));num = Math.floor(num*100+0.50000000001);cents = num%100;num = Math.floor(num/100).toString();if(cents<10) cents = "0" + cents;for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + num + '.' + cents);} } var ModuleBox = { Toggle: function(obj, id){ var content = $(id); new Effect.toggle(content, 'blind', {duration:.3, afterFinish: function(){ var visible = content.getStyle('display').toLowerCase() == 'block'; obj.className = visible ? "moduleBox_arrowDown" : "moduleBox_arrowRight"; }}); } } var Forms = { CreateEnterActions: function(){ Event.observe(window, 'load', function(){ $(document.body).select('input[type="text"]','input[type="password"]').each(function(textbox){ if (textbox.getAttribute('buttonRel') != null){ var buttonId = textbox.getAttribute('buttonRel'); Event.observe(textbox, 'keydown', function(event){ if(event.which || event.keyCode){ if ((event.which == 13) || (event.keyCode == 13)) { $(buttonId).click(); return false; } } else return true; }.bind(this)); } }); }); } } Forms.CreateEnterActions(); /*** date-en.js - 25.0 kb ***/ /** * Version: 1.0 Alpha-1 * Build Date: 13-Nov-2007 * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved. * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/ */ Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}}; Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;idate)?1:(this=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;} var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);} if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);} if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);} if(x.hour||x.hours){this.addHours(x.hour||x.hours);} if(x.month||x.months){this.addMonths(x.month||x.months);} if(x.year||x.years){this.addYears(x.year||x.years);} if(x.day||x.days){this.addDays(x.day||x.days);} return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(valuemax){throw new RangeError(value+" is not a valid value for "+name+".");} return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;} if(!x.second&&x.second!==0){x.second=-1;} if(!x.minute&&x.minute!==0){x.minute=-1;} if(!x.hour&&x.hour!==0){x.hour=-1;} if(!x.day&&x.day!==0){x.day=-1;} if(!x.month&&x.month!==0){x.month=-1;} if(!x.year&&x.year!==0){x.year=-1;} if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());} if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());} if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());} if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());} if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());} if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());} if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());} if(x.timezone){this.setTimezone(x.timezone);} if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);} return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;} var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}} return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();}; Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;} return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;} if(!last&&q[1].length===0){last=true;} if(!last){var qx=[];for(var j=0;j0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}} if(rx[1].length1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];} if(args){for(var i=0,px=args.shift();i2)?n:(n+(((n+2000)Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");} var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});} return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;} for(var i=0;i= 0 || this.className.indexOf('next') >= 0) }; if (g.vars.onDateSelect) g.vars.onDateSelect(ret); }); } } } return weeks; } this.GetWeek = function(_int){ var gw = this; var days = Array(); gw.dated = m.id+1 + '/{0}/' + m.year; if (_int == 0) return m.FirstWeek('this'); if (_int == m.WeekCount) return m.LastWeek('this'); var start = 7 - m.StartDay + 1; var s = "" for(i=0;i<7;i++){ var val = (7 * (_int - 1) + start + i) var tdate = new Date(gw.dated.replace('{0}', val)); var fd = dateFormat(tdate, "mm/dd/yyyy"); var d = Builder.node('td', {id:"cal_"+fd.replace(/\//g,""),className:g.calendarClass + '_thisMonth',value:fd,month:'this'}); if(m.MatchDate(tdate, g.startDate)) $(d).addClassName(g.calendarClass + '_today'); d.appendChild(new Element('span').update(val)); days.push(d); } return days; } this.MatchDate = function (d1, d2){ var d01, d02; d01 = "#{0}/#{1}/#{2}".interpolate({0:d1.getMonth()+1, 1:d1.getDate(), 2:d1.getFullYear()}); d02 = "#{0}/#{1}/#{2}".interpolate({0:d2.getMonth()+1, 1:d2.getDate(), 2:d2.getFullYear()}); if (d01 == d02) return true; return false; } this.LastWeek = function(c){ var lw = this; var days = Array(); lw.dated = m.id+1 + '/{0}/' + m.year; var day = (m.StartDay + m.Days) % 7 - 1; day = day == -1 ? 6 : day; var s = ""; for (i=m.Days-day;i<=m.Days;i++){ var tdate = new Date(lw.dated.replace("{0}", i)); var fd = dateFormat(tdate, "mm/dd/yyyy"); var d = Builder.node('td', {id:"cal_"+fd.replace(/\//g,""),className:g.calendarClass + '_' + c + 'Month',value:fd,month:c}); d.appendChild(new Element('span').update(i)); if(m.MatchDate(tdate, g.startDate)) $(d).addClassName(g.calendarClass + '_today'); days.push(d); if(i==m.Days) m.lastCell = d; } return days; } this.FirstWeek = function(c){ var fw = this; var days = Array(); fw.dated = m.id+1 + '/{0}/' + m.year; var day = 7 - m.StartDay; var s = ""; for (i=1;i<=day;i++){ var tdate = new Date(fw.dated.replace('{0}', i)); var fd = dateFormat(tdate, "mm/dd/yyyy"); var d = Builder.node('td', {id:"cal_"+fd.replace(/\//g,""),className:g.calendarClass + '_' + c + 'Month',value:fd,month:c}); d.appendChild(new Element('span').update(i)); if(m.MatchDate(tdate, g.startDate)) $(d).addClassName(g.calendarClass + '_today'); days.push(d); if(i==1) m.firstCell = d; } return days; } this.Previous = function(){ var pid = m.id - 1 < 0 ? 11 : m.id - 1; var pyear = pid == 11 ? m.year - 1 : m.year; return new g.Month(pid, pyear); } this.Next = function(){ var pid = m.id + 1 > 11 ? 0 : m.id + 1; var pyear = pid == 0 ? m.year + 1 : m.year; return new g.Month(pid, pyear); } } this.WeekDays = g.vars.WeekDays ? g.vars.WeekDays : new Array('S','M','T','W','T','F','S'); this.MonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); this.MonthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December'); if (g.vars.autostart || g.vars.autostart == null) g.init(); } // POPUP CALENDER CLASS var PopupCalendar = function(vars){ var g = this; this.vars = vars; this.textBox = $(g.vars.textId); this.trigger = $(g.vars.triggerId); this.holder = $(g.vars.holderId); this.calendar = null; this.to = 0; this.DisableDate = new Date().setDate(new Date().getDate() - 1); this.Show = function(){ var pos = g.textBox.cumulativeOffset(); g.holder.setStyle({ position: 'absolute', left:pos.left + 'px', top: pos.top + g.textBox.getHeight() + 'px' }); clearTimeout(g.to); if (!g.holder.visible()) if (Prototype.Browser.IE) g.holder.setStyle({display:'block'}); else new Effect.toggle(g.holder, 'blind', {duration:.3}); } this.Hide = function(){ g.to = setTimeout(function(){ if (g.holder.visible()) new Effect.toggle(g.holder, 'blind', {duration:.2}); }, 200); } this.init = function(){ Event.observe(g.textBox, "focus", function(){ g.Show();}); Event.observe(g.textBox, "blur", function(){g.Hide();}); Event.observe(g.holder, "mouseover", function(){ clearTimeout(g.to); }); Event.observe(g.holder, "click", function(){ clearTimeout(g.to); }); Event.observe(g.trigger, "click", function(){ if (g.holder.visible()) g.Hide(); else g.Show(); }); Event.observe(window, "load", function(){ document.body.appendChild(g.holder); }); if (!g.vars['disablePreviousDates']) { g.DisableDate = false; } g.CreateCalendar(); g.PaintCalendar(); } this.CreateCalendar = function(){ g.calendar = null; g.holder.update(''); g.calendar = new Calendar({ holderId: g.holder.id, startDate: new Date(g.vars.startDate), calendarClass: 'popup_calendar', showPrevious: true, showNext: true, nextText: '►', prevText: '◄', onDateSelect:function(date){ g.updateText(date); g.holder.setStyle({display:'none'}); //g.textBox.focus(); }, onCreate:function(){ if (g.calendar) g.PaintCalendar(); var button = new Element('span', {'class': 'popup_today'}).update('Today'); Event.observe(button, "click", function(){ g.textBox.setValue(dateFormat(new Date(), "mm/dd/yyyy")); }); var todayHolder = new Element('div', {'class': 'popup_todayHolder'}) todayHolder.appendChild(button); button = new Element('span', {'class': 'popup_today', style:'padding:2px 17px 2px 18px;margin-left:1px;'}).update('Close'); Event.observe(button, 'click', function(){ g.textBox.blur(); g.Hide(); }); todayHolder.appendChild(button); g.holder.appendChild(todayHolder); }, onNext:function(){ g.textBox.focus(); }, onPrev:function(){ g.textBox.focus(); } }); } this.PaintCalendar = function(){ if (g.DisableDate == null) return; $(g.calendar.cells).each(function(cell){ var d = new Date(cell.getAttribute('value')); if (d <= g.DisableDate) cell.addClassName('popup_cellDisabled'); else cell.removeClassName('popup_cellDisabled'); }); } this.updateText = function(date){ if (g.DisableDate) if (date.date <= g.DisableDate) return; g.textBox.setValue(dateFormat(date.date, "mm/dd/yyyy")); if (g.vars.endDateId != ''){ eval('#{0}.DisableDate = new Date(#{1});#{0}.PaintCalendar();'.interpolate({0:g.vars.endDateId, 1:date.date.getTime()})); } } this.init(); } /*** Comment.js - 3.0 kb ***/ var Comment = { SendingAjax: false, EditValue: '', AddComment: function(obj) { // Check if we're already sending ajax if(this.SendingAjax) return; // Get all the input values x = SBRForum.FormValues(obj); // Make the ajax call this.SendingAjax = true; new Ajax.Request('/ajax/?a=Comment_AddComment', { method: 'post', parameters: { input: x.serialize }, onSuccess: function(t){ Comment.ClearInputs(obj); Comment.AddCommentToList(t.responseText.evalJSON(false).message); }, onComplete: function(t){ Comment.SendingAjax = false; } }); }, ShowEditComment: function(obj,id) { obj = $(obj).ancestors()[1].select('.textAdmin')[0]; this.EditValue = obj.innerHTML; obj.update(''); var input = new Element('textarea', {'class': 'editBox'}); Event.observe(input, 'onclick', function(e) { Event.stop(e); }); Event.observe(input, 'blur', function(){ Comment.HideEditComment(input, id); }); input.value = this.EditValue; obj.parentNode.appendChild(input); input.focus(); }, HideEditComment: function(obj, id) { var input = $(obj); obj = $(obj).parentNode; this.SendingAjax = true; new Ajax.Request('/ajax/?a=Comment_EditComment', { method: 'post', parameters: { 'id': id, 'text': input.value }, onSuccess: function(t) { Comment.EditValue = input.value; obj.removeChild(input); $(obj).select('.textAdmin')[0].update(Comment.EditValue); }, onComplete: function(t) { Comment.SendingAjax = false; Comment.EditValue = ''; } }); }, DeleteComment: function(obj,id) { obj = $(obj).ancestors()[2]; this.SendingAjax = true; new Ajax.Request('/ajax/?a=Comment_DeleteComment', { method: 'post', parameters: { 'id': id }, onSuccess: function(t) { $(obj).hide(); }, onComplete: function(t) { Comment.SendingAjax = false; } }); }, ClearInputs: function(obj) { $(obj).select('#comment')[0].value = ''; $(obj).select('#username')[0].value = ''; $(obj).select('#avatar')[0].value = ''; }, AddCommentToList: function(message) { console.log(message); var cpy = $('newComment').cloneNode(true); $(cpy).select('.avatar img')[0].src = message.avatar; $(cpy).select('strong')[0].update(message.username) $(cpy).select('.commentDate')[0].update(message.date); $(cpy).select('.text')[0].update(message.text); $(cpy).show(); if($('comments').firstDescendant() != null) $('comments').insertBefore(cpy, $('comments').firstDescendant()); else $('comments').appendChild(cpy); } } /*** DropDown.js - 9.0 kb ***/ var DropDown = Class.create({ initialize: function(options) { // Variables this.Options = options; this.showing = false; this.Timeout = 0; // Display Options this.Effect = options.effects; this.AlignLeft = options.align == null || options.align == 'left' ? true : false; this.Padding = options.padding == null ? {top: 0, left:0, right:0} : options.padding; this.Shadow = options.shadow == null ? null : options.shadow; // Close Options this.CloseOnClick = options.closeOnClick != null && options.closeOnClick; this.CloseOnMouseout = options.closeOnMouseout != null && options.closeOnMouseout; this.ShowOnMouseover = options.showOnMouseover != null && options.showOnMouseover; // Get Elements this.Trigger = $(options.trigger); this.BaseElement = options.baseElement == 'parent' ? this.Trigger.parentNode : $(options.baseElement); this.DisplayElement = $(options.displayElement); // Event Listeners this.hideListener = this.Hide.bindAsEventListener(this); this.showFinishListener = this.ShowFinish.bindAsEventListener(this); this.hideFinishListener = this.HideFinish.bindAsEventListener(this); this.HideDropDown = function(){ clearTimeout(this.Timeout); this.DisplayElement.setStyle({display:'none'}); if (this.Shadow && this.Shadow.obj){ this.Shadow.obj.setStyle({display:'none'}); } }.bind(this); // Go this.MakeTrigger(); }, // Creates trigger function and assigns Events MakeTrigger: function(){ // Return if there's no trigger to make if (this.Trigger == null) return; Event.observe(this.Trigger, 'click', this.TriggerClick.bind(this)); if (this.ShowOnMouseover){ Event.observe(this.Trigger, 'mouseover', this.Show.bind(this)); this.CloseOnMouseout = true; } var g = this; // If close on mouse out option is selected, assign events if (this.CloseOnMouseout){ Event.observe(this.DisplayElement, 'mouseout', function(){g.Timeout = setTimeout(g.Hide.bind(g), 300);}); Event.observe(this.BaseElement, 'mouseout', function(){g.Timeout = setTimeout(g.Hide.bind(g), 300);}); Event.observe(this.DisplayElement, 'mouseover', function(){clearTimeout(g.Timeout);}); Event.observe(this.BaseElement, 'mouseover', function(){clearTimeout(g.Timeout);}); if (this.ShowOnMouseover){ Event.observe(this.Trigger, 'mouseout', function(){g.Timeout = setTimeout(g.Hide.bind(g), 300);}); Event.observe(this.Trigger, 'mouseover', function(){clearTimeout(g.Timeout);}); } } // If close on click is selected, assign events if (!this.CloseOnClick) Event.observe(this.DisplayElement, 'click', this.Show.bind(this)); // Assign Default Events Event.observe(this.BaseElement, 'click', function(){this.showing = true;}); Event.observe(window, 'load', this.MoveDisplayElement.bind(this)); }, // Handles Clicking the Trigger element TriggerClick: function(){ if (this.DisplayElement.getStyle('display') == 'block') this.Hide(); else this.Show(); }, // Moves display element to the body tag so positioning is correct MoveDisplayElement: function(){ $(document.body).appendChild(this.DisplayElement); if (this.Shadow != null){ var shadow = new Element('div').update(' '); shadow.setStyle({ position: 'absolute', opacity: this.Shadow.opacity, background: '#000000', display: 'none' }); this.Shadow.obj = shadow; $(document.body).appendChild(shadow); } }, // Shows display element Show: function(){ // Assign hide for clicking on the window Event.observe(document.body, 'click', this.hideListener); // Run Functions this.ShowBegin(); // Get Baseelement postition var pos = this.BaseElement.cumulativeOffset(); // Get Effects var hasEffect = this.Effect != null && this.Effect.show != 'none' && this.Effect.show != null && this.DisplayElement.getStyle('display') == 'none'; // Find if we need to align the popup box to the right of the base element var anchorRight = pos.left + this.DisplayElement.getWidth() > document.viewport.getWidth(); // Assign Styles this.DisplayElement.setStyle({ position: 'absolute', top: pos.top + this.BaseElement.getHeight() + this.Padding.top + 'px', display: 'none', zIndex: 1000 }); // Assign correct left/right values if (this.AlignLeft) { this.DisplayElement.setStyle({ left: anchorRight ? pos.left + this.BaseElement.getWidth() - this.DisplayElement.getWidth() + this.Padding.left + 'px' : pos.left + this.Padding.left + 'px' }); } else { this.DisplayElement.setStyle({ right: anchorRight ? document.viewport.getWidth() - (pos.left + this.BaseElement.getWidth()) + this.Padding.right + 'px' : document.viewport.getWidth() - (pos.left + this.DisplayElement.getWidth()) + this.Padding.right + 'px' }); } this.showing = true; if (hasEffect) Effect.toggle(this.DisplayElement, this.Effect.show, {duration: this.Effect.duration, afterFinish: this.showFinishListener}); else { this.DisplayElement.setStyle({display: 'block'}); this.ShowFinish(); } }, ResizeShadow: function(){ this.ShowShadow(); }, // Displays Shadow ShowShadow: function(){ var pos = this.DisplayElement.cumulativeOffset(); if (pos.top == 0 && pos.left == 0) return; this.Shadow.obj.setStyle({ top: pos.top + this.Shadow.offset + 'px', left: pos.left + this.Shadow.offset + 'px', width: this.DisplayElement.getWidth() + 'px', height: this.DisplayElement.getHeight() + 'px', display: 'block' }); }, // Fires before show starts ShowBegin: function(){ if(this.Options.onShowBegin) this.Options.onShowBegin(this); }, // Fires after show is complete ShowFinish: function(){ //this.showing = false; if (this.Shadow != null && this.Shadow.obj) this.ShowShadow(); if(this.Options.onShowFinish) this.Options.onShowFinish(this); }, // Hides display element Close: function(){ this.Hide(); }, Hide: function(){ // If showing do nothing if (this.showing) {this.showing = false; return;} if(this.Shadow != null && this.Shadow.obj != null) this.Shadow.obj.setStyle({display:'none'}); // Find effect var hasEffect = this.Effect != null && this.Effect.hide != 'none' && this.Effect.hide != null && this.DisplayElement.getStyle('display') == 'block'; if (hasEffect) Effect.toggle(this.DisplayElement, this.Effect.hide, {duration:this.Effect.duration, afterFinish: this.hideFinishListener}); else { this.DisplayElement.setStyle({ display: !hasEffect ? 'none' : 'block' }); this.HideFinish(); } // Clear window click event Event.stopObserving(document.body, 'click', this.hideListener); }, HideFinish: function(){ if(this.Options.onHideFinish) this.Options.onHideFinish(this); } }); var UserDropDown = Class.create(DropDown, { initialize: function($super, userId){ $super({ trigger: 'userDropDown_Trigger_' + userId, baseElement: 'parent', displayElement: 'userDropDown_' + userId, closeOnClick: false, align: 'right', padding: {top: 1, left: 0, right: 0}, shadow: {opacity: .2, offset: 2}, effects: { show: 'blind', hide: 'none', duration: .2 }, onShowBegin: function(t){ t.Trigger.addClassName('userDropDown_Over'); }, onShowFinish: function(t){ }, onHideFinish: function(t){ t.Trigger.removeClassName('userDropDown_Over'); } }); } }); /*** Menu.js - 1.0 kb ***/ var Menu = Class.create({ initialize: function(options){ this.Options = options; this.Holder = $(options.holder); this.DropDowns = new Array(); this.BindLinks(this); }, BindLinks: function(g){ var i = 0; this.Holder.select('ul')[0].select('a').each(function(a){ if (a.select('span').length == 0) return; var sb = new StringBuilder(); sb.Append('menu_'); sb.Append(a.getAttribute('rel')); var dd = new DropDown({ trigger: a.select('span')[0], baseElement: 'parent', displayElement: sb.ToString(), closeOnClick: false, align: 'right', shadow: {opacity: .2, offset: 4}, effects: g.Options.effects, closeOnMouseout: true, padding: g.Options.padding, showOnMouseover: g.Options.showOnMouseover, onShowBegin: function(){ $(this.DropDowns).each(function(d){ if (dd.Id != d.Id) { d.HideDropDown(); d.BaseElement.removeClassName('menuBarSelected'); } }); dd.BaseElement.addClassName('menuBarSelected'); }.bind(this), onHideFinish: function(){ dd.BaseElement.removeClassName('menuBarSelected'); } }); dd.Id = 'dd_' + i; i++; this.DropDowns.push(dd); }.bind(this)); } }); /*** MessageBox.js - 6.0 kb ***/ var MessageBoard = function(vars) { var g = this; g.boxId = vars.boxId; g.typeId = vars.typeId; g.type = vars.type; g.page = vars.page; g.pageSize = vars.pageSize; g.locked = false; g.width = vars.width; this.initalize = function() { g.textBox = $('messageTextBox'+g.boxId); g.messageBox = $('messageBox'+g.boxId); g.hiddenHolder = $('hiddenBoxHolder'); g.hiddenTextBox = $('messageTextBoxHidden'); g.hiddenSubmit = $('submitReply'); } this.changePage = function(newPage) { if(!g.locked) { g.locked = true; new Ajax.Request('/ajax/?a=Message_NewPage',{ method: 'post', parameters: { 'page': newPage, 'type': g.type, 'typeId':g.typeId, 'width':g.width }, onSuccess: function(t) { g.page++; $('messageHolder'+g.boxId).update(t.responseText); }, onComplete: function(t) { g.locked = false; } }); } } this.addMessage = function(parent) { if(!g.locked) { g.locked = true; $(parent).innerHTML = 'Sending ...'; if(g.textBox.value == '') { g.locked = false; return true; } new Ajax.Request('/ajax/?a=Message_Submit',{ method: 'post', parameters: { 'text': g.textBox.value, 'reply': 0, 'type': g.type, 'typeId':g.typeId }, onSuccess: function(t) { var msg = t.responseText.evalJSON(false).messages.message[0]; g.printMessage(g.messageBox,msg,'new'); g.textBox.value = ''; }, onComplete: function() { g.locked = false; $(parent).innerHTML = "Send"; } }); } } this.replyMessage = function(replyId) { var parent = $('message'+replyId); parent.appendChild(g.hiddenHolder); g.hiddenSubmit.innerHTML = 'Reply'; g.hiddenHolder.show(); g.hiddenTextBox.value = ''; g.hiddenSubmit.onclick = function() { if(!g.locked) { g.locked = true; if( g.hiddenTextBox.value == '') { g.locked = false; return false; } new Ajax.Request('/ajax/?a=Message_Submit',{ method: 'post', parameters: { 'text': g.hiddenTextBox.value, 'reply': replyId, 'type': g.type, 'typeId':g.typeId }, onSuccess: function(t) { var msg = t.responseText.evalJSON(false).messages.message[0]; g.printMessage(parent,msg,'reply'); g.hiddenTextBox.value = ''; }, onComplete: function() { g.locked = false; g.hiddenHolder.hide(); } }); } return false; } } this.printMessage = function(p, msg, type) { var temp = $('messageTemplate').cloneNode(true); temp.select('.mUsername')[0].innerHTML = msg.username; temp.select('.mTime')[0].innerHTML = msg.elapsedTime; temp.select('.mMessage')[0].innerHTML = msg.text; temp.select('.mReply')[0].onclick = function() { g.replyMessage(msg.id); }; temp.select('.mRemove')[0].onclick = function() { g.removeMessage(msg.id); }; temp.id = 'message' + msg.id; if(type == 'reply') p.appendChild(temp); else p.insertBefore(temp, p.firstChild); temp.toggle('slow'); } this.removeMessage = function(id) { if(!g.locked) { g.locked = true; new Ajax.Request('/ajax/?a=Message_Remove',{ method: 'post', parameters: { 'id': id, 'type': g.type, 'typeId': g.typeId }, onSuccess: function(t) { var msg = $('message'+id).hide(); }, onComplete: function() { g.locked = false; g.hiddenHolder.hide(); } }); } } this.editMessage = function(id) { var parent = $('message'+id); var message = $('messageText'+id); g.hiddenTextBox.value = message.select('span')[0].innerHTML; g.hiddenSubmit.update('Edit'); message.appendChild(g.hiddenHolder); g.hiddenHolder.show(); g.hiddenSubmit.onclick = function() { if(!g.locked) { g.locked = true; g.hiddenSubmit.update('Sending ...'); new Ajax.Request('/ajax/?a=Message_Edit', { method: 'post', parameters: { 'id': id, 'type': g.type, 'typeId': g.typeId, 'text': g.hiddenTextBox.value }, onSuccess: function(t) { message.select('span')[0].innerHTML = t.responseText; }, onComplete: function() { g.hiddenSubmit.update('Edit'); g.locked = false; g.hiddenHolder.hide(); } }); } return false; }; } } /*** Module.js - 10.0 kb ***/ var Module = { SendingAjax: false, //************************************************ // Sortable - Creates Sortable for Module Order //************************************************ Sortable: function(columnId){ Sortable.create('column_' + columnId, { tag: 'div', only:'module', handle: 'moduleControls', overlap: 'horizontal', constraint: false, onUpdate: function(){ this.UpdateModuleOrder(columnId); }.bind(this) }); }, //************************************************ // UpdateModuleOrder - Updates the module order //************************************************ UpdateModuleOrder: function(columnId) { // Approve Ajax Calling if (this.SendingAjax) return; this.SendingAjax = true; var modules = new Array(); $('column_' + columnId).select('div.module').each(function(div){ modules.push(div.getAttribute('moduleId')); }); new Ajax.Request('/ajax/?a=Modules_UpdateOrder', { method: 'post', parameters: {column: columnId, pageId: _PAGEID, leagueId: _LEAGUEID, ids: modules.join(',')}, onComplete: function(t){ this.SendingAjax = false; }.bind(this) }); }, //************************************************ // Delete - Deletes module from page //************************************************ Delete: function(obj, id){ if (!confirm('Are you sure you want to delete this module?')) return; if (this.SendingAjax) return; this.SendingAjax = false; new Ajax.Request('/ajax/?a=Modules_Delete', { method: 'post', parameters: {pageId: _PAGEID, uniqueId: id}, onSuccess: function(t) { var div = $$('div[moduleid="#{0}"]'.interpolate({0: id}))[0] new Effect.BlindUp(div, {duration: .3, afterFinish: function(){ div.remove(); }.bind(this)}); }, onComplete: function(t) { this.Sending = false; }.bind(this) }); }, //************************************************ // ModulesConfigured - Stores innerHTML data for Cancel Function //************************************************ ModulesConfigured: {}, //************************************************ // ModuleList - List of avaialble modules //************************************************ ModuleList: null, //************************************************ // GetModuleList - Gets list of avaialble modules //************************************************ GetModuleList: function(options){ if (this.SendingAjax) return; this.SendingAjax = true; new Ajax.Request('/ajax/?a=Modules_GetModuleList', { method: 'post', parameters: null, onComplete: function(t){ this.SendingAjax = false; if (options.onComplete) options.onComplete(); }.bind(this), onSuccess: function(t) { this.ModuleList = t.responseJSON.root; }.bind(this) }); }, //************************************************ // BindModuleList - Populates dropdown with available modules //************************************************ BindModuleList: function(obj, column, dd){ obj.update(''); $(this.ModuleList).each(function(module){ var a = new Element('a', {href: 'javascript:void(0);'}); Event.observe(a, 'click', function(){ if (this.SendingAjax) return; this.SendingAjax = true; new Ajax.Request('/ajax/?a=Modules_AddModule', { method: 'post', parameters: {moduleId: module.id, pageId: _PAGEID, column: column}, onComplete: function(t){ this.SendingAjax = false; this.UpdateModuleOrder(column); }.bind(this), onSuccess: function(t){ var html = t.responseJSON.html; var holder = new Element('div').update(html).firstDescendant(); var columnObj = $('column_' + column); columnObj.firstDescendant().insert({after: holder}); var i = 1; columnObj.select('div.module').each(function(div){ div.id = 'module#{0}_#{1}'.interpolate({0: column, 1: i}); i++; }); Sortable.destroy('column_' + column); this.Sortable(column); }.bind(this) }); }.bind(this)) a.update(module.name); obj.appendChild(a); }.bind(this)); dd.Shadow.obj.setStyle({ height: dd.DisplayElement.getHeight() + 'px' }); }, ShowOptions: function(obj, column, dd){ obj = $(obj); if (this.ModuleList == null) this.ModuleList = this.GetModuleList({ onComplete: function(){ this.BindModuleList(obj, column, dd); }.bind(this) }); else this.BindModuleList(obj, column, dd); }, //************************************************ // HideWarning - Hides module warning //************************************************ HideWarning: function(id){ if ($('moduleWarning' + id)) new Effect.BlindUp($('moduleWarning' + id), {duration: .2}); }, //************************************************ // ShowWarning - Shows module warning //************************************************ ShowWarning: function(module){ }, //************************************************ // ShowConfigure - Displays configuration information //************************************************ ShowConfigure: function(obj, moduleId, id) { this.ModulesConfigured['module' + id] = $('moduleData' + id).innerHTML; // Approve Ajax Calling if (this.SendingAjax) return; this.SendingAjax = true; new Ajax.Request('/ajax/?a=Modules_GetConfigure', { method: 'post', parameters: {moduleId: moduleId, uniqueId: id, leagueId: _LEAGUEID, pageId: _PAGEID}, onSuccess: function(t){ var module = t.responseJSON.module; Module.HideWarning(module.uniqueId); var submit = new Element('div', {'class': 'moduleSubmit alignCenter' }); var saveButton = new Element('input', {id: 'moduleSaveButton' + module.uniqueId, type: 'button', value: 'Save Settings', 'class': 'moduleConfigureButton'}); Event.observe(saveButton, 'click', function(e){ this.ModuleSave(saveButton, module.moduleId, module.uniqueId); }.bindAsEventListener(this)); submit.appendChild(saveButton); var cancelButton = new Element('input', {id: 'moduleCancelButton' + module.uniqueId, type: 'button', value: 'Cancel', 'class': 'moduleConfigureButton'}); Event.observe(cancelButton, 'click', function(e){ this.ModuleCancel(cancelButton, module.moduleId, module.uniqueId); }.bindAsEventListener(this)); submit.appendChild(cancelButton); $('moduleData' + module.uniqueId).addClassName('moduleConfigureDiv'); this.SetModule(module, false, submit); }.bind(this), onComplete: function(t){ this.SendingAjax = false; }.bind(this) }); }, //************************************************ // ModuleSave - Saves Module //************************************************ ModuleSave: function(obj, moduleId, id){ if(this.SendingAjax) return; this.SendingAjax = false; obj.disabled = true; obj.value = 'Saving ...'; var m = $('moduleData' + id); var vars = SBRForum.FormValues(m); var ret = { vars: vars.serialize, moduleId: moduleId, uniqueId: id, pageId: _PAGEID } new Ajax.Request('/ajax/?a=Modules_SaveModule', { method: 'post', parameters: ret, onSuccess: function(t){ var module = t.responseJSON.module; if (module.status == '400') this.ShowWarning(module); else { this.HideWarning(id); this.SetModule(module, true, null); var moduleHolder = $('moduleData' + id); moduleHolder.removeClassName('moduleConfigureDiv'); } }.bind(this), onComplete: function(t){ this.SendingAjax = false; obj.disabled = false; obj.value = "Save Settings"; }.bind(this) }); }, //************************************************ // ModuleCancel - Cancels module configuration //************************************************ ModuleCancel: function(obj, moduleId, id) { var m = $('moduleData' + id); m.parentNode.select('div.moduleControls')[0].setStyle({display: ''}); m.update(this.ModulesConfigured['module' + id]); m.removeClassName('moduleConfigureDiv'); }, //************************************************ // SetModule - Sets module innerHTML //************************************************ SetModule: function(module, showConfig, button) { if (module.status != '304'){ var m = $('moduleData' + module.uniqueId); m.parentNode.select('div.moduleControls')[0].setStyle({display: 'none'}); m.update(module.innerHtml); if (showConfig) m.parentNode.select('div.moduleControls')[0].setStyle({display: ''}); if (button) m.appendChild(button); m.innerHTML.evalScripts(); } } } /*** SBRForum.js - 4.0 kb ***/ var SBRForum = { SendingAjax: false, FormValues: function(obj){ var vars = {}; obj.select('input:not([type="checkbox"])').each(function(i){ if (i.name || i.id){ if (i.getAttribute('type') == 'radio' && i.checked) vars[i.name ? i.name : i.id] = i.value; else if (i.getAttribute('type') != 'radio') vars[i.name ? i.name : i.id] = escape(i.value); } }); obj.select('select').each(function(s){ if (s.name || s.id){ vars[s.name ? s.name : s.id] = escape(s.options[s.selectedIndex].value); } }); obj.select('textarea').each(function(t){ if (t.name || t.id){ vars[t.name ? t.name : t.id] = escape(t.value); } }); obj.select('input[type="checkbox"]').each(function(c){ if (c.name || c.id){ vars[c.name ? c.name : c.id] = c.checked; } }); var s = ""; for(k in vars){ s += k.replace(/.+\$.+\$/,'') + '=' + vars[k] + "&"; } return { vars: vars, serialize: s }; }, ToggleHeadline: function(boxId, idx){ var p = $('headlines-content'); p.update($(boxId).innerHTML); var tabs = $('headline-tabs').select('a'); for(var i = 0; i < tabs.length; i++){ var tab = tabs[i]; if (idx == i) $(tab).addClassName('headline-tabs-selected'); else $(tab).removeClassName('headline-tabs-selected'); } var more = $('more-button'); var league = $('league'); more.href = league.innerHTML == 'ALL' ? '/' + boxId + '/all.aspx' : '/' + boxId + '/' + league.innerHTML + '/all.aspx'; more.update('More ' + (league.innerHTML == 'ALL' ? '' : league.innerHTML + ' ') + boxId); }, FixPageForm: function(){ Event.observe(window, 'load', function(){ if ($('aspnetForm')) $('aspnetForm').action = window.location; }); }, Quiz: { SelectAnswer: function(obj){ $(obj.name + '_holderDiv').select('img').each(function(img){ img.src = _HERE + '/images/spacer.gif'; img.parentNode.className = ''; }); var img = $(obj.id + '_imgLeft'); img.src = _HERE + '/images/quizSelect-Left.gif'; img.parentNode.className = 'quizSelected'; console.log(img.parentNode); } }, SearchOptions: { Location: 0 }, SetSearchLocation: function(obj, loc) { $('searchTextBox').setStyle({ backgroundPosition: 'right -' + (loc == -1 ? '10000' : (161 + 15 * loc)) + 'px' }); SBRForum.SearchOptions.Location = loc; }, Search: function(){ var search = escape($('searchTextBox').value.replace(/ /ig, '-').toLowerCase()); window.location = "/Sports+Betting/#{0}.aspx?loc=#{1}".interpolate({0: search, 1: SBRForum.SearchOptions.Location}); }, CreateEnterActions: function(){ Event.observe(window, 'load', function(){ $(document.body).select('input[type="text"]','input[type="password"]').each(function(textbox){ if (textbox.getAttribute('buttonRel') != null){ var buttonId = textbox.getAttribute('buttonRel'); Event.observe(textbox, 'keydown', function(event){ if(event.which || event.keyCode){ if ((event.which == 13) || (event.keyCode == 13)) { $(buttonId).click(); Event.stop(event); } } else Event.stop(event); }.bind(this)); } }); }); }, TextboxPretext: function(){ Event.observe(window, 'load', function(){ $(document.body).select('input[type="text"]').each(function(textbox){ if(textbox.getAttribute('preText') != null){ var preText = textbox.getAttribute('preText'); textbox.value = preText; Event.observe(textbox, 'focus', function(event){ if(textbox.value == preText){ textbox.value = ''; } }); Event.observe(textbox, 'blur', function(event){ if(textbox.value == ''){ textbox.value = preText; } }); } }); }); } } SBRForum.FixPageForm(); SBRForum.CreateEnterActions(); SBRForum.TextboxPretext(); /*** Scoreboard.js - 4.0 kb ***/ var Scoreboard = { SendingAjax: false, MakeCalendar: function(objId, startLeague, startDate, startLeagueId){ Event.observe(window, 'load', function(){ this.calendar = new Calendar({ holderId: objId, startDate: startDate, calendarClass: 'scoreboardCal', showPrevious: true, showNext: true, nextText: '►', prevText: '◄', onDateSelect:function(date){ if(startLeagueId == 1) { window.location.href = '/Betting-Odds/#{0}/'.interpolate({ 0: dateFormat(date.date, "yyyymmdd") }); } else { window.location.href = '/Scores/#{0}+Odds/#{1}.aspx'.interpolate({ 0: startLeague.replace(' ', '+'), 1: dateFormat(date.date, "yyyymmdd") }); } }, onCreate:function(){ }, onNext:function(){ }, onPrev:function(){ } }); }.bind(this)); }, ToggleDay: function (obj, holderId){ var pNode = $(obj.parentNode); pNode.select('a').each(function(a){ a.removeClassName('sbfp_selected'); }); $(obj).addClassName('sbfp_selected'); $('sbfb_holder').select('div.sbfb_day').each(function(div){ div.setStyle({display:'none'}); }); $(holderId).setStyle({display:'block'}); }, DeleteMonthScoresCache: function(obj, date){ if (this.SendingAjax) return; this.SendingAjax = true; var message = $(obj).select('span')[0]; message.update('Deleting Cache ...'); this.DeleteCache('month', 0, date, 0, message); }, DeleteScoresCache: function(obj, leagueId, date){ if (this.SendingAjax) return; this.SendingAjax = true; var message = $(obj).select('span')[0]; message.update('Updating Cache ... '); this.DeleteCache('scores', leagueId, date, 0, message); }, DeleteLinesCache: function(obj, leagueId, eventId, type){ if (this.SendingAjax) return; this.SendingAjax = true; var message = $(obj).select('span')[0]; console.log(message); message.update('Updating Cache ... '); this.DeleteCache('lines', leagueId, type, eventId, message); }, DeleteCache: function(type, leagueId, param, eventId, messageHolder){ new Ajax.Request('/ajax/?a=Scoreboard_DeleteCache', { method: 'post', parameters: {type: type, league: leagueId, param: param, eventId: eventId}, onSuccess: function(t){ var data = t.responseJSON; if (data.status == 200){ $(data.id).update(data.html); if (type == "month") messageHolder.update('Cache Deleted.'); else messageHolder.update('Cache Updated.'); } else { messageHolder.update('Error Ocurred.'); } setTimeout(function(){ messageHolder.update(''); }, 2000); }.bind(this), onError: function(t){ messageHolder.update('Error Ocurred.'); }, onComplete: function(t){ this.SendingAjax = false; }.bind(this) }); }, Cache: {}, GetFrontPageSB: function(leagueName){ if (this.SendingAjax) return; this.SendingAjax = true; if (this.Cache[leagueName]){ var timestamp = new Date(); if(timestamp.setSeconds(this.Cache[leagueName].timestamp.getSeconds() + 30) > new Date()){ $('fp_scoreboard_data').update(this.Cache[leagueName].innerHTML); this.SendingAjax = false; return; } } new Ajax.Request('/ajax/?a=Scoreboard_ChangeLeague', { method: 'post', parameters: {league: leagueName, location: 'frontpage'}, onSuccess: function(t){ this.Cache[leagueName] = { timestamp: new Date(), innerHTML: t.responseText } $('fp_scoreboard_data').update(t.responseText); }.bind(this), onComplete: function(t){ this.SendingAjax = false; }.bind(this) }); } }