Ajax.Responders.register({onCreate:function(a){a.timeoutId=window.setTimeout(function(){switch(a.transport.readyState){case 0:case 1:case 2:case 3:a.transport.abort();if(a.options.onFailure){a.options.onFailure(a.transport,a.json)}break}},5000)},onComplete:function(a){window.clearTimeout(a.timeoutId)}});var siteComponentsElementMethods={getHiddenElementDimensions:function(d){d=$(d);var c=d.getStyle("visibility");var f=d.getStyle("display");var b=d.getStyle("position");d.setStyle({visibility:"hidden",display:"block",position:"absolute"});var a=d.getHeight();var e=d.getWidth();d.setStyle({visibility:c,display:f,position:b});return{height:a,width:e}},getDimensionFromStyle:function(c,d){var a=c.getStyle(d);if(a!==null){var b=a.match(/^([0-9]+)px$/);if(b.length===2){return parseInt(b[1],10)}else{return 0}}else{return 0}}};Element.addMethods(siteComponentsElementMethods);function getSiteComponentsConfig(b,c,a){if(typeof siteComponentsConfig!=="undefined"&&typeof siteComponentsConfig[b]!=="undefined"&&siteComponentsConfig[b][c]!=="undefined"){return siteComponentsConfig[b][c]}if(typeof a!=="undefined"){return a}return null}function recommendCommentPost(a){new Ajax.Updater({success:"commentpost-rating-"+a},"/xmlhttprequest.php?service=entity.rate",{parameters:{entity_id:a,entity_type:"EntityCommentPost",rating:"99"}});return false}function articleOpinion(b,a){new Ajax.Updater({success:"article-opinion-"+b+"-"+(a?"agree":"disagree")},"/xmlhttprequest.php?service=entity.rate",{parameters:{entity_id:b,entity_type:"Article",rating:a?99:1}});return false}var themeName;function getThemeName(){if(typeof themeName==="undefined"){var b=$$("link[rel=stylesheet]");if(b.size()>0){var a=b[0].readAttribute("href");a=a.substring(0,a.lastIndexOf("/"));themeName=a.substring(a.lastIndexOf("/")+1)}}return themeName}function regenerateAllCaptchas(){var a=Math.floor(Math.random()*100000);$$("div.captcha-image img").each(function(b){b.src=b.src+"&amp;rand="+a})};var lightbox;var Lightbox=Class.create({showHtml:function(a,b){this.prepareToShow();this.content.update(a);this.lightbox.fire("lightbox:contentUpdated");if(Object.isUndefined(b)||b===true){this.doShow()}},show:function(a){this.prepareToShow();lightbox.getAndShowContentFromUrl(a)},hide:function(){if(this.historyPolling!==null){this.historyPolling.stop()}this.lightbox.hide();this.content.hide();this.overlay.hide();this.spinner.hide();this.htmlElement.setStyle({overflow:this.htmlOverflowStyle});this.contentDimensionChangedRunner.stop();Event.stopObserving(window,"resize",this.windowResizeListenerObj);this.content.stopObserving("lightbox:contentDimensionChanged",this.windowResizeListenerObj);this.lightbox.stopObserving("lightbox:contentUpdated");this.showPersistentObjects(true);this.content.update();if(window.location.hash=="#modal"){history.go(-1)}this.container.setStyle({width:this.originalContainerWidth+"px"})},initializeLightboxAnchors:function(a){var b=[];if(Object.isUndefined(a)){b=$$("a.lightbox")}else{b=a.select("a.lightbox")}b.each(function(c){c.observe("click",function(e){e.stop();var d=Event.findElement(e,"a");if(d!=document){lightbox.activeElement=d;lightbox.show(d.getAttribute("href"))}})})},isVisible:function(){return this.lightbox.visible()},initialize:function(){this.history={};this.historyPolling=null;this.htmlElement=$$("html").first();var b=$$("body").first();if(Prototype.Browser.IE){var c=document.createElement("iframe");c.setAttribute("id","lightbox-history-frame");c.src="/history-frame.php";c.style.display="block";c.style.visibility="hidden";c.style.position="absolute";c.style.top="0";c.style.left="0";c.style.width="1px";c.style.height="1px";b.appendChild(c);this.historyFrame=c}b.insert({bottom:'<div id="lightbox"></div><div id="lightbox-spinner"></div>'});var e=$("lightbox");e.setStyle({display:"none"});e.update('<div id="lightbox-overlay"></div><div id="lightbox-container"></div>');var a=$("lightbox-container");a.update('<div id="lightbox-close-container"><a href="#" id="lightbox-close"><span>Close</span></a></div>');a.insert({bottom:'<div id="lightbox-default-focus" style="display:none;"><input type="text" name="lightbox-default-focus"/></div>'});a.insert({bottom:'<div id="lightbox-start"><div class="left"></div><div class="right"></div></div><div id="lightbox-content-left"></div><div id="lightbox-content-right"></div><div id="lightbox-outer-content"><div id="lightbox-content"></div></div><div id="lightbox-end"><div class="left"></div><div class="right"></div></div>'});this.content=$("lightbox-content");this.lightbox=$("lightbox");this.container=$("lightbox-container");this.overlay=$("lightbox-overlay");this.spinner=$("lightbox-spinner");this.defaultFocusElement=$("lightbox-default-focus").down();this.spinner.setStyle({position:"absolute",zIndex:1000,display:"none"});this.containerTop=Element.getDimensionFromStyle(this.container,"top");if(Prototype.Browser.Gecko){this.overlay.setStyle({background:"url(/images/lightbox/ff-overlay-img.png)"})}else{this.overlay.setStyle({opacity:0.5})}document.observe("keydown",this.keydownListener.bindAsEventListener(this));this.lightbox.observe("click",this.lightboxClickListener.bindAsEventListener(this));$("lightbox-close").observe("click",this.clickToCloseListener.bindAsEventListener(this));this.overlay.observe("click",this.clickToCloseListener.bindAsEventListener(this));this.lightbox.observe("lightbox:contentReady",this.contentReadyListener.bindAsEventListener(this));this.lightbox.observe("lightbox:cpWriteMediaObjectRun",this.cpWriteMediaObjectRunListener.bindAsEventListener(this));if(Prototype.Browser.IE&&(typeof document.documentMode=="undefined"||document.documentMode==7)){var d=1000;this.container.select("div").each(function(f){f.style.zIndex=d--})}},getContainerHorizontalPadding:function(){if(typeof this.containerPadding=="undefined"){var d=this.content;var c=0;var a=0;while(d!==null&&d!=this.container&&a<50){c+=Element.getDimensionFromStyle(d,"padding-left");c+=Element.getDimensionFromStyle(d,"padding-right");c+=Element.getDimensionFromStyle(d,"margin-left");c+=Element.getDimensionFromStyle(d,"margin-right");var b=d;d=d.getOffsetParent();if(d==b){alert("Error: Could not resolve offsetParent - does the stylesheet contain all required styles?");break}}this.containerPadding=c}return this.containerPadding},prepareHistory:function(){if(Prototype.Browser.IE){this.historyFrame.src="/history-frame.php?modal"}else{window.location.hash="#modal"}this.historyPolling=new PeriodicalExecuter(function(a){var d=false;if(Prototype.Browser.IE){var b=this.historyFrame.contentWindow.document.title;if(b.indexOf("?modal")<0){d=true}}else{var c=window.location.hash;if(window.location.hash!="#modal"){d=true}}if(d){a.stop();if(this.isVisible()){this.hide()}}}.bind(this),0.5)},showPersistentObjects:function(a){$$("select","embed","object").each(function(b){if(a){b.style.visibility="visible"}else{b.style.visibility="hidden"}})},prepareToShow:function(){if(!this.prepared){if(this.isVisible()){this.hide()}this.prepareHistory();this.content.hide();this.showPersistentObjects(false);this.overlay.show();this.container.hide();this.lightbox.show();this.scolloffset=document.viewport.getScrollOffsets();this.htmlOverflowStyle=this.htmlElement.getStyle("overflow");this.htmlElement.setStyle({overflow:"hidden"});this.repositionLightboxAndOverlay();this.repositionSpinner();this.spinner.show();this.prepared=true}},repositionLightboxAndOverlay:function(){var c=document.viewport.getScrollOffsets();var a=document.viewport.getDimensions();var d=this.container.getDimensions();var e=[d.height+this.containerTop,a.height].max();var b=[d.width,a.width].max();this.lightbox.setStyle({top:c.top+"px",left:c.left+"px",width:a.width+"px",height:a.height+"px"});this.overlay.setStyle({left:"0px",top:"0px",height:e+"px",width:b+"px"})},doShow:function(){if(!this.prepared){this.prepareToShow()}this.prepared=false;this.content.show();this.container.setStyle({visibility:"hidden"});this.container.show();if(Object.isUndefined(this.originalContainerWidth)||this.originalContainerWidth===null){this.originalContainerWidth=this.container.getWidth()}this.windowResizeListenerObj=this.windowResizeListener.bindAsEventListener(this);Event.observe(window,"resize",this.windowResizeListenerObj);this.content.observe("lightbox:contentDimensionChanged",this.windowResizeListenerObj);this.lastContentDimensions=this.content.getDimensions();this.contentDimensionChangedRunner=new PeriodicalExecuter(function(g){var h=this.content.getDimensions();if(h.height!=this.lastContentDimensions.height||h.width!=this.lastContentDimensions.width){this.content.fire("lightbox:contentDimensionChanged")}this.lastContentDimensions=this.content.getDimensions()}.bind(this),0.5);var b=-1;var a=false;var f=this.content.down("div");if(typeof f!="undefined"&&f.identify()!="lightbox_flash_container"&&f.getWidth()>0){this.setContentWidth(f.getWidth());a=true}else{var d=this.content.down();var c;if(d!==null&&typeof d!="undefined"){if(d.tagName=="IMG"){c=d.getWidth();if(c>0){this.setContentWidth(c);a=true}else{d.observe("load",this.resizeContentToImageSizeListener.bindAsEventListener(this))}}else{if(d.identify()=="lightbox_flash_container"&&d.down()!==null){if(d.down()!==null){var e=d.down().getDimensionFromStyle("width");if(e>0){this.setContentWidth(e);a=true}}else{}}else{a=true}}}else{a=true}}if(a){this.lightbox.fire("lightbox:contentReady")}this.lightbox.fire("lightbox:doShowFinished")},getAndShowContentFromUrl:function(f){if(f===null){alert("No URL provided");return}if(f.match(/\.(jpg|jpeg|png|gif)$/)){var g=new Image();Event.observe(g,"load",function(m){this.showHtml('<img src="'+f+'" alt=""/>')}.bindAsEventListener(this));g.src=f}else{if(f.match(/\.(swf|flv)/)){var h='<div id="lightbox_flash_container"></div>';var d;var k;var l=500;var a=300;if(typeof this.activeElement!="undefined"){var b=this.activeElement.readAttribute("name");if(b!==null&&b.match(/width\d+height\d/)){d=b.match(/width(\d+)/).last();k=b.match(/height(\d+)/).last()}}var j=f.match(/\.(swf|flv)$/).last();var c="";switch(j){case"swf":c="application/x-shockwave-flash";var e={};break;case"flv":c="video/flv";var i={floatingcontrols:"true"};break}this.lightbox.observe("lightbox:contentUpdated",function(m){if(typeof d!="undefined"&&typeof k!="undefined"){this.insertMediaObject(f,d,k,c,i)}else{var n={service:"mmarchive.fileinfo",fileUrl:f};new Ajax.Request("/xmlhttprequest.php",{parameters:n,onSuccess:function(o){var p=o.responseText.evalJSON();this.insertMediaObject(f,p.width,p.height,c,i)}.bind(this),onFailure:function(){this.insertMediaObject(f,l,a,c,i)}.bind(this)})}}.bindAsEventListener(this));this.showHtml(h,false)}else{new Ajax.Request(f,{method:"get",onSuccess:function(s){var p=s.responseText;if(p.match(/<body\b/)){var n=p.match(/<div id="placeholder-content">([\s\S]*?)<div id="placeholder-/);if(n===null){n=p.match(/<div id="placeholder-content-no-right">([\s\S]*?)<div id="placeholder-/)}if(n!==null){var m=n.first();n=m.match(/([\s\S]*)<\/div>/);p=n.first();p=p.replace(/placeholder-content(-no-right)?/,"lightbox-placeholder-content")}}this.content.update(p);var r=this.content.select("div[id=lightbox-placeholder-content]");try{if(r.length>0){var o=r.first();var q=o.select("div.tile-common");if(q.length>0){q.each(function(t){t.classNames().each(function(u){if(u=="tile-common"){return}o.addClassName(u+"-lightbox")})})}}}finally{this.lightbox.fire("lightbox:contentUpdated");this.doShow()}}.bind(this),onFailure:function(m){this.hide();alert("Could not connect to URL")}.bind(this)})}}},insertMediaObject:function(b,c,a,e,d){cpWriteMediaObject(b,"null",c,a,e,0,1,"null","lightbox_flash_container",d,true);this.lightbox.fire("lightbox:cpWriteMediaObjectRun")},repositionSpinner:function(){var b=document.viewport.getScrollOffsets();var a=document.viewport.getDimensions();this.spinner.setStyle({top:b.top+"px",left:b.left+"px",width:a.width+"px",height:a.height+"px"})},setContentWidth:function(a){this.container.setStyle({width:a+this.getContainerHorizontalPadding()+"px"})},setDefaultFocus:function(){try{this.defaultFocusElement.focus()}catch(a){}},contentReadyListener:function(a){lightbox.initializeLightboxAnchors(this.content);this.container.setStyle({visibility:"visible"});this.spinner.hide();this.repositionLightboxAndOverlay();this.setDefaultFocus()},windowResizeListener:function(a){this.repositionLightboxAndOverlay()},resizeContentToImageSizeListener:function(a){this.setContentWidth(a.element().getHiddenElementDimensions().width);this.lightbox.fire("lightbox:contentReady")},cpWriteMediaObjectRunListener:function(b){var a=$("lightbox_flash_container").down();if(a!==null){this.setContentWidth(a.getDimensionFromStyle("width"));this.lightbox.fire("lightbox:contentReady")}this.doShow()},keydownListener:function(a){if(lightbox.isVisible()){if(a.keyCode==Event.KEY_ESC){this.clickToCloseListener(a)}if([32,Event.KEY_RETURN,Event.KEY_TAB,Event.KEY_UP,Event.KEY_DOWN].indexOf(a.keyCode)>-1){if(!a.element().descendantOf(this.lightbox)){a.stop()}}}},lightboxClickListener:function(c){var b=c.element();var a=c.findElement("a");if(["INPUT","BUTTON","A"].indexOf(b.nodeName)==-1&&Object.isUndefined(a)){c.stop()}},clickToCloseListener:function(a){a.stop();this.hide()}});document.observe("dom:loaded",function(a){lightbox=new Lightbox();lightbox.initializeLightboxAnchors()});var Keywords=Class.create({initialize:function(){this.html="";this.replacements={};this.replacementsMacroCounter=0;this.regExpEscapeChars=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];this.defaultSkipTags=["a","textarea","label","legend","option","title","script","style"]},replaceKeywordsInHtml:function(c,a){if(typeof cpKeywords!="undefined"&&cpKeywords instanceof Object){this.html=c.innerHTML;var b;if(a instanceof Array){for(b=0;b<a.length;b++){this._replaceStringsWithMacrosByPattern(new RegExp("<"+this._escapeRegExpString(a[b])+".*\\/"+this._escapeRegExpString(a[b])+">","ig"))}}this._replaceStringsWithMacrosByPattern(new RegExp("<[^>]*>","g"));for(b in cpKeywords){switch(cpKeywords[b]["type"]){case"list":case"link":this._replaceStringsWithMacrosByPattern(new RegExp("\\b"+b+"\\b","ig"),true,'<a class="keyword-replacement keyword-replacement-'+cpKeywords[b]["type"]+" keyword-replacement-"+b.toLowerCase().replace(/[^A-Za-z0-9]/ig,"")+'" href="'+cpKeywords[b]["link"]+'" target="'+cpKeywords[b]["target"]+'" title="'+cpKeywords[b]["explanation"]+'">',"</a>");break;case"title":this._replaceStringsWithMacrosByPattern(new RegExp("\\b"+b+"\\b","ig"),true,'<a class="keyword-replacement keyword-replacement-'+cpKeywords[b]["type"]+" keyword-replacement-"+b.toLowerCase().replace(/[^A-Za-z0-9]/ig,"")+'" href="'+cpKeywords[b]["link"]+'" title="'+cpKeywords[b]["explanation"]+'" onclick="return false;">',"</a>");break}}for(b in this.replacements){this.html=this.html.replace(new RegExp(b,"g"),this.replacements[b])}c.innerHTML=this.html}},_replaceStringsWithMacrosByPattern:function(e,a,f,g){f=f===undefined?"":f;g=g===undefined?"":g;var d=this.html.match(e);if(d instanceof Array){for(var b=0;b<d.length;b++){var c="{::"+this.replacementsMacroCounter+++"::}";this.replacements[c]=f+d[b]+g;if(a===true){this.html=this.html.replace(new RegExp("\\b"+this._escapeRegExpString(d[b])+"\\b","ig"),c)}else{this.html=this.html.replace(new RegExp(this._escapeRegExpString(d[b]),"ig"),c)}}}},_escapeRegExpString:function(a){return a.replace(new RegExp("(\\"+this.regExpEscapeChars.join("|\\")+")","g"),"\\$1")}});document.observe("dom:loaded",function(c){var d=getSiteComponentsConfig("keywords","elements",[]);if(d.length>0){var b=new Keywords();for(var a=0;a<d.length;a++){b.replaceKeywordsInHtml($(d[a]),getSiteComponentsConfig("keywords","skiptags",[]))}if(getSiteComponentsConfig("keywords","usetooltip",true)&&typeof CtTooltip!="function"){new CtTooltip(getSiteComponentsConfig("tooltip","positionby","element"))}}});var CtTooltip=Class.create({initialize:function(b){switch(b){case"mouse":b="mouse";break;default:case"element":b="element";break}this.positionBy=b;var c=document.getElementsByTagName("body").item(0);var d=document.createElement("div");d.setAttribute("id","tooltip");d.style.display="none";d.style.position="absolute";d.style.zIndex="100";c.appendChild(d);var a=document.createElement("div");a.setAttribute("id","tooltip-top");d.appendChild(a);var f=document.createElement("div");f.setAttribute("id","tooltip-content");d.appendChild(f);var e=document.createElement("div");e.setAttribute("id","tooltip-bottom");d.appendChild(e);this.tooltip=$("tooltip");this.content=$("tooltip-content");this.topDiv=$("tooltip-top");this.bottomDiv=$("tooltip-bottom");$$("a").each(function(g){this.addTooltipToElement(g)}.bind(this));if(Prototype.Browser.IE&&navigator.appVersion.match(/MSIE 6\.0/)){this.tooltip.setStyle({position:"absolute",width:"50px",whiteSpace:"nowrap"})}},addTooltipToElement:function(b){try{var c=b.getAttribute("title");if(c!==null&&c.length>0){b.observe("mouseover",function(d){tooltip.show(b,d)});b.observe("mouseout",function(d){tooltip.hide()});if(this.positionBy=="mouse"){b.observe("mousemove",function(d){tooltip.moveTo(d.pointerX(),d.pointerY())})}}}catch(a){}},show:function(b,c){try{if(b.getAttribute("title").length>0){if(this.visible){this.hide()}this.element=b;this.tooltipText=b.getAttribute("title");b.setAttribute("title","");switch(this.positionBy){case"element":this.moveTo(b.cumulativeOffset()[0],b.cumulativeOffset()[1]);break;default:case"mouse":this.moveTo(c.pointerX(),c.pointerY());break}this.content.update(this.tooltipText);try{this.effect=Effect.Appear("tooltip",{duration:0.25,afterFinish:function(){tooltip.effect=null}})}catch(d){this.tooltip.show()}this.visible=true}}catch(a){}},hide:function(){if(this.visible){if(this.effect!==null){this.effect.cancel();this.effect=null}this.tooltip.hide();this.element.setAttribute("title",this.tooltipText);this.tooltipText=null;this.visible=false}},moveTo:function(c,h){c-=10;h+=20;var f=this.tooltip.getWidth();var b=this.tooltip.getHeight();var a=document.viewport.getScrollOffsets();var g={top:a.top,bottom:a.top+document.viewport.getHeight(),left:a.left,right:a.left+document.viewport.getWidth()};var e=false;if(c+f>g.right){c=g.right-f;e=true}var d=false;if(h+b>g.bottom){h=h-b-30;d=true}if(d){this.tooltip.addClassName("flipped-y")}else{this.tooltip.removeClassName("flipped-y")}this.tooltip.setStyle({left:c+"px",top:h+"px"})}});Event.observe(window,"load",function(){if(!getSiteComponentsConfig("tooltip","disable")){window.tooltip=new CtTooltip(getSiteComponentsConfig("tooltip","positionby"))}});var CtCookie=Class.create({set:function(d,e,b){var a;if(b){var c=new Date();c.setTime(c.getTime()+(b*24*60*60*1000));a="; expires="+c.toGMTString()}else{a=""}document.cookie=d+"="+e+a+"; path=/"},get:function(b){var a=new RegExp("^\\s?"+b+"=.*");var c=document.cookie.split(";").grep(a).collect(function(d){return d.strip()});if(c.size()>0){return c.first().substring(b.length+1)}else{return null}},clear:function(a){this.set(a,"",-1)}});var CtFontSize=Class.create({initialize:function(){this.c=new CtCookie()},getAvailableFontSizes:function(){return getSiteComponentsConfig("fontsize","sizes",["10px","15px","20px"])},toggle:function(){var a=this.getCurrentIndex();var c=this.getAvailableFontSizes();var b=null;if(a+1>=c.size()){b=c[0]}else{if(a<0){b=c[0]}else{b=c[a+1]}}this.set(b)},getCurrentIndex:function(){var b=this.getAvailableFontSizes();var a=this.c.get("fontsize");return b.indexOf(a)},set:function(a){this.c.set("fontsize",a);$(document.body).setStyle({fontSize:a})},setByIndex:function(a){var b=this.getAvailableFontSizes();if(a>=0&&a<b.size()){this.set(b[a])}},initializeFromCookie:function(){var a=this.getCurrentIndex();var b=this.getAvailableFontSizes();if(a<0){this.set(b[0])}else{this.set(b[a])}}});var SlideshowTile=Class.create({initialize:function(a){this.element=$(a);this.current=0;this.images=a.select("div.slideshow-image");this.navigation=this.element.select(".slideshow-navigation").first();if(typeof this.navigation!="undefined"){this.thumbnailContainer=this.element.select(".slideshow-thumbnails").first();this.thumbnails=this.thumbnailContainer.childElements();this.navigation.show();this.setActiveThumb(this.images[this.current])}else{this.navigation=null}this.addListeners()},addListeners:function(){this.images.each(function(a){var b=a.down("img");b.observe("click",this.nextListener.bindAsEventListener(this))}.bind(this));if(this.navigation!==null){this.element.select("a.slideshow-previous").first().observe("click",this.previousListener.bindAsEventListener(this));this.element.select("a.slideshow-next").first().observe("click",this.nextListener.bindAsEventListener(this));this.thumbnailContainer.show();this.thumbnailContainer.select("a").each(function(a){a.observe("click",this.thumbnailListener.bindAsEventListener(this))}.bind(this))}else{this.interval=this.element.select("div.slideshow-interval").first().innerHTML;new PeriodicalExecuter(this.periodicalExecutor.bind(this),this.interval)}},previous:function(){var b=this.current;var a=this.current-1;if(a<0){a=this.images.size()-1}this.fadeFromTo(b,a)},next:function(){var b=this.current;var a=this.current+1;if(a>=this.images.size()){a=0}this.fadeFromTo(b,a)},showElementId:function(a){var b=0;this.images.each(function(f){if(f.id==a){throw $break}b++});var e=this.current;var c=b;try{this.fadeFromTo(e,c)}catch(d){}},setActiveThumb:function(b){if(typeof this.thumbnails=="undefined"){return}var a=b.id.substring(b.id.lastIndexOf("-")+1);this.thumbnails.each(function(e){var d=e.down().readAttribute("href");var c=d.substring(d.lastIndexOf("#show_image_")+12);if(e.hasClassName("active")){e.removeClassName("active")}else{if(a==c){e.addClassName("active")}}}.bind(this))},fadeFromTo:function(h,g){if(h==g){return}var b=this.images[g];var f=this.images[h];var d=Effect.Queues.get("slideshow");if(d.effects.length>0){d.each(function(e){e.cancel();if(e.element==this.images[this.current]){e.element.setOpacity(1);e.element.show()}else{e.element.hide();this.current=h;this.images[h].show();this.images[h].setOpacity(1)}}.bind(this))}this.setActiveThumb(b);try{var a=Element.getHiddenElementDimensions(b);new Effect.Opacity(f,{to:0,from:1,duration:0.3,queue:{scope:"slideshow"},afterFinish:function(){this.eff=new Effect.Morph(f,{duration:0.1,style:{height:a.height+"px"},queue:{scope:"slideshow"},afterFinish:function(){this.eff=new Effect.Appear(b,{duration:0.3,queue:{scope:"slideshow"},afterUpdate:function(i){if(i.currentFrame===0){f.hide();f.setOpacity(1);f.setStyle({height:"auto"});try{var e=b.select("div.rating-container");if(e.size()>0){e.each(function(k){if(typeof k.enhancer=="object"){k.enhancer.reinitializeElements()}})}}catch(j){}}}.bind(this)})}})}.bind(this)})}catch(c){f.hide();b.show()}this.current=g},nextListener:function(a){a.stop();this.next()},previousListener:function(a){a.stop();this.previous()},thumbnailListener:function(c){c.stop();var a=c.findElement("a").readAttribute("href");var b="image-"+this.element.id+"-"+a.substring(a.lastIndexOf("#show_image")+12);this.showElementId(b)},periodicalExecutor:function(a){this.next()}});var EntityCommentUtil=Class.create({initialize:function(a){this.element=$(a);this.openedPosts={};this.initializeSubPostForms();this.initializeToggleLinks();this.initializeEditForms()},initializeEditForms:function(){this.element.select("ul.entitycommentlist li div.entitycomment-tools button.editcomment").each(function(a){a.observe("click",this.editButtonClickListener.bindAsEventListener(this))}.bind(this))},initializeToggleLinks:function(){this.element.select("a.toggler").each(function(a){a.observe("click",function(b){b.stop();this.toggleSubpost(b.findElement("a"))}.bindAsEventListener(this))}.bind(this))},toggleSubpost:function(c){var d=c.up(2);var a=d.id.match(/[0-9]+$/).first();d.toggleClassName("collapsed");if(typeof this.openedPosts[a]=="undefined"){var e={};e.post_id=a;e.service="entitycommentpost.getBody";new Ajax.Request("/xmlhttprequest.php",{parameters:e,onSuccess:function(h){var i=h.responseText;var f=$("post-body-"+a);try{f.setStyle({height:f.getHeight()+"px"});f.setOpacity(0);f.setStyle({overflow:"hidden"});f.update(i);this.openedPosts[a]=true;new Effect.Opacity(f,{to:1,from:0,duration:0.5});new Effect.Morph(f,{style:{height:f.scrollHeight+"px"},duration:0.5})}catch(g){f.setStyle({height:"auto",overflow:"auto"});f.setOpacity(1);f.update(i)}}.bind(this)})}else{var b=$("post-body-"+a);if(b.getStyle("height")=="0px"){b.setStyle({height:"auto",overflow:"auto"});b.setOpacity(1)}}},initializeSubPostForms:function(){this.element.select("button.entity-comment-answer").each(function(a){a.observe("click",this.answerButtonClickListener.bindAsEventListener(this))}.bind(this))},answerButtonClickListener:function(d){d.stop();this.parentId=d.element().id.substring(15);var c=$("subpost-entitycomment-form");lightbox.showHtml('<div class="lightbox-entitycomment-form">'+c.innerHTML+"</div>");var a=lightbox.content.select("input[name=parentpostid]").first();a.value=this.parentId;var b=lightbox.content.select("div.entitycomment-form-quoted").first();b.update($("post-body-"+this.parentId).innerHTML);this.form=lightbox.content.select("form").first();this.form.observe("submit",this.answerFormSubmitListener.bindAsEventListener(this))},editButtonClickListener:function(a){a.stop();this.postId=a.element().up(3).identify().substr(5);new Ajax.Request("/xmlhttprequest.php?service=entitycommentpost.getEditForm",{parameters:{post_id:this.postId},onSuccess:function(b){lightbox.showHtml('<div class="lightbox-entitycomment-form">'+b.responseText+"</div>");this.form=lightbox.content.select("form").first();this.form.observe("submit",this.editFormSubmitListener.bindAsEventListener(this))}.bind(this),onFailure:function(b){alert("Could not get post edit form from service, check logs")}})},answerFormSubmitListener:function(a){a.stop();new Ajax.Request(this.form.readAttribute("action"),{parameters:this.form.serialize(),onSuccess:function(b){var d=b.responseText.evalJSON();alert(d.message);if(!d.isError){var c=this.form.select("input[name=returnpage]").first().value;c=c.substring(0,c.indexOf("#"));location.href=c}}.bind(this)})},editFormSubmitListener:function(a){a.stop();new Ajax.Request(this.form.readAttribute("action"),{parameters:this.form.serialize(),onSuccess:function(c){var d=c.responseText.evalJSON();if(d.isError){alert(d.message)}else{if(!Object.isUndefined(this.postId)){$("post-"+this.postId).select("p").first().update(d.body.replace(/\n/g,"<br/>"));var e=$("post-"+this.postId).select("div.entitycomment-urls").first();var b=e.select("a").first();if(Object.isUndefined(d.url)){b.setAttribute("href","#");b.update();e.hide()}else{b.setAttribute("href",d.url);b.update(d.url);e.show()}$("post-"+this.postId).pulsate({pulses:2,duration:0.5})}lightbox.hide()}}.bind(this)})}});var DatePicker=Class.create({initialize:function(a){this.element=$(a);this.dateField=this.element.select("input").first();this.popup=this.element.select(".datepicker-popup").first();this.element.select("noscript").first().replace('<a href="#select_date" class="datepicker-select"><span>Select date</span></a>');this.openLink=this.element.select("a.datepicker-select").first();this.popup.setStyle({position:"absolute",zIndex:1000});this.initializePopupLinks();this.popup.observe("datepicker:contentChanged",this.initializePopupLinks.bindAsEventListener(this));this.openLink.observe("click",this.openLinkListener.bindAsEventListener(this));Event.observe(document,"click",this.windowClickListener.bindAsEventListener(this));this.openLinkListenerObj=this.openLinkListener.bindAsEventListener(this)},initializePopupLinks:function(){this.popup.select("a.day-link").each(function(a){a.observe("click",function(b){b.stop();this.dateField.value=b.element().hash.substr(10);new Effect.Highlight(this.dateField,{queue:{scope:this.element.id,position:"end",limit:2}});this.hide()}.bindAsEventListener(this))}.bind(this))},openLinkListener:function(b){b.stop();var c=this.openLink.positionedOffset();if(Prototype.Browser.IE&&!Prototype.BrowserFeatures.ElementExtensions){c.top-=14}if(Prototype.Browser.Gecko){c.left-=1}this.popup.setStyle({position:"absolute",left:c.left+"px",top:c.top+"px"});try{new Effect.Grow(this.popup,{direction:"top-left",duration:0.3,queue:{scope:this.element.id,position:"end",limit:1}})}catch(a){this.popup.show()}},hide:function(){this.popup.hide()},windowClickListener:function(a){if(!a.element().descendantOf(this.popup)){this.hide()}}});var CoreFader=Class.create({initialize:function(a,b){this.element=$(a);if(typeof b!="undefined"){this.duration=b}else{this.duration=0.5}},fadeTo:function(a){a=$(a);if(typeof this.effect=="object"&&this.effect.state!="finished"){this.effect.cancel()}this.effect=new Effect.Opacity(this.element,{from:1,to:0,duration:this.duration,queue:"end",limit:1,afterFinish:function(){this.element.update(a.innerHTML);this.effect=new Effect.Opacity(this.element,{from:0,to:1,duration:this.duration,queue:"end",limit:1})}.bind(this)})},fadeBetween:function(b,c){if(typeof c=="undefined"){c=10}var a=(this.duration*2)+c;b.next=function(){if(typeof this.currentIndex=="undefined"){this.currentIndex=0}if(this.currentIndex>=b.length){this.currentIndex=0}this.currentElement=this[this.currentIndex];this.currentIndex++;return this.currentElement}.bind(b);new PeriodicalExecuter(function(d){this.frequency=a;this.fadeTo(b.next())}.bind(this),c)}});var CtFormLightbox=Class.create({initialize:function(a){this.element=a;var b=this.element;b.observe("submit",function(d){d.stop();var c=d.element();c.select(".ctwebform-element-validationerror").each(function(e){e.up().removeClassName("ctform-element-container-validationerror");e.remove()});new Ajax.Request(c.readAttribute("action"),{method:c.readAttribute("method"),parameters:c.serialize(),onSuccess:function(e){alert(e.responseText.evalJSON());lightbox.hide()},onFailure:function(g){var e=g.responseText.evalJSON();for(var f in e){var h=$("ctwebform-element-"+f);if(h===null){h=$("appbase-form-view-default-"+f)}var j=h.select(".ctwebform-element-validationerror");if(j.size()===0){h.insert({bottom:'<span class="ctwebform-element-validationerror">'+e[f]+"</span>"});h.addClassName("ctform-element-container-validationerror")}new Effect.Pulsate(h,{pulses:1,duration:0.5})}}})})}});document.observe("lightbox:contentUpdated",function(a){lightbox.content.select("form.ctform").each(function(b){new CtFormLightbox(b)})});var RoundedButton=Class.create({initialize:function(a){this.button=a;this.wrapButton(a)},wrapButton:function(a){if(!a.up().hasClassName("button-wrapper")){var b=a.wrap("span",{"class":"button-wrapper"});a.insert({before:'<span class="button-left"></span>'});a.insert({after:'<span class="button-right"></span>'});b.insert({after:'<span class="button-after"></span>'});b.observe("click",this.wrapperClickListener.bindAsEventListener(this))}},wrapperClickListener:function(a){if(this.button==a.element()){return}["input","button"].each(function(b){var c=a.findElement("span.button-wrapper").down(b);if(typeof c!="undefined"){c.click();return}})}});document.observe("dom:loaded",function(a){$$("div.ctform-submit input","input.ctwebform-element-type-reset","input.ctwebform-element-type-submit","input.ctwebform-element-type-button","td.ctwebform-element-type-submit input","button.submit","input.submit").each(function(b){new RoundedButton(b)})});document.observe("lightbox:contentUpdated",function(a){lightbox.content.select("div.ctform-submit input","input.ctwebform-element-type-reset","input.ctwebform-element-type-submit","input.ctwebform-element-type-button","td.ctwebform-element-type-submit input","button.submit","input.submit").each(function(b){new RoundedButton(b)})});var SmallCalendarTile=Class.create({initialize:function(a){this.element=$(a);this.initializeLinks();Event.observe(document,"click",function(b){this.closeAllTooltips()}.bind(this));this.element.observe("smallcalendar:contentChanged",this.contentChangedListener.bindAsEventListener(this))},initializeLinks:function(){this.element.select("a.calendar_popup_link").each(function(a){a.observe("click",function(d){d.stop();var c=d.findElement("a");var e=$(c.id.substring(20));if(e.visible()){return}this.closeAllTooltips();e.setStyle({left:(c.positionedOffset()["left"]-11)+"px",top:(c.positionedOffset()["top"]+18)+"px"});try{new Effect.Grow(e,{direction:"top-left",duration:0.3,queue:{scope:this.element.id,limit:1}})}catch(b){e.show()}}.bindAsEventListener(this))}.bind(this))},contentChangedListener:function(a){this.initializeLinks();new Effect.Pulsate(a.element().select("table.calendar-header td").first().next(),{duration:0.3,pulses:1})},closeAllTooltips:function(){$$(".small-calendar-popup").each(function(a){a.hide()})}});var TabbedEntityList=Class.create({initialize:function(a){this.element=a;this.cookie=new CtCookie();this.tabs=a.select("div.tab");this.cookieKey="open_tabs_"+this.element.id;this.tabNum=0;if(this.cookie.get(this.cookieKey)===null){this.activeTab=this.tabs[0]}else{this.activeTab=$(this.cookie.get(this.cookieKey))}this.tabs.each(this.initializeTab.bind(this))},initializeTab:function(a){if(a!=this.activeTab){a.down().next().hide()}a.down().down().observe("click",this.toggleActiveTab.bindAsEventListener(this));this.tabNum++},toggleActiveTab:function(c){c.stop();var e=c.findElement("div");if(this.activeTab!=e){var d=this.activeTab.down().next();var b=e.down().next();try{new Effect.SlideUp(d,{duration:0.2});new Effect.BlindDown(b,{duration:0.2})}catch(a){d.hide();b.show()}this.activeTab=e;this.cookie.set(this.cookieKey,this.activeTab.id)}}});var SuggestionTile=Class.create({initialize:function(a){this.element=$(a);this.form=this.element.select("form").first();this.form.observe("submit",this.formSubmitListener.bindAsEventListener(this))},formSubmitListener:function(a){a.stop();new Ajax.Request(this.form.readAttribute("action"),{parameters:this.form.serialize(),onSuccess:function(b){var c=b.responseText.evalJSON();alert(c.message);if(!c.isError){lightbox.hide()}}.bind(this)})}});var SearchInputTile=Class.create({initialize:function(a){this.element=$(a);this.element.select("div.searchfield").first().insert({after:'<div class="pane_headers"></div><div class="panes"></div>'});this.paneHeaders=this.element.select("div.pane_headers").first();this.paneContents=this.element.select("div.panes").first();this.paneMap=$H();this.element.select("div.pane").each(function(b){this.addPane(b)}.bind(this));this.paneHeaders.show();this.paneContents.show();this.handleErrorsFromSearchResult()},addPane:function(c){var b=c.select("h4").first();var a=c.select("div").first();b.addClassName(c.classNames());a.addClassName(c.classNames());this.paneMap.set(b.identify(),a.identify());this.paneHeaders.insert({bottom:b});this.paneContents.insert({bottom:a});b.observe("click",function(d){this.showPane(d)}.bindAsEventListener(this));if(c.hasClassName("summarycriteria")){b.addClassName("active")}else{a.hide()}},showPane:function(a){this.hideAllPanes();var c=a.element("h4");var b=$(this.paneMap.get(c.identify()));c.addClassName("active");b.show()},hideAllPanes:function(){this.paneMap.each(function(a){$(a.key).removeClassName("active");$(a.value).hide()})},handleErrorsFromSearchResult:function(){var a=$$("div.searchresult-message");if(a.length>0){var b=$$("div.panes div.summarycriteria").first();a.each(function(c){if(c.hasClassName("error")){b.insert({bottom:c})}else{b.up().insert({bottom:c})}})}},selectAllCategoryCriteria:function(a){var b=true;a.findElement("select").childElements().each(function(c){if(b){b=false;return}c.selected=false})}});var SmallSearchInputTile=Class.create({initialize:function(a){this.focused=false;this.label=a.select("label").first();this.labelString=this.label.innerHTML;this.input=a.select("input[type=text]").first();if(this.input.value===""){this.input.value=this.labelString}this.label.remove();this.unfocusColor=this.input.getStyle("color");this.input.observe("focus",this.focusEvent.bindAsEventListener(this));this.input.observe("blur",this.blurEvent.bindAsEventListener(this));a.select("form").first().observe("submit",this.submitListener.bindAsEventListener(this))},hasInput:function(){return this.input.value!=this.labelString},focusEvent:function(a){this.focused=true;a.element().setStyle({color:"#000"});if(a.element().value==this.labelString){a.element().value=""}},blurEvent:function(a){a.element().setStyle({color:this.unfocusColor});if(a.element().value===""){a.element().value=this.labelString}},submitListener:function(a){if(!this.focused||!this.hasInput()){this.input.value=""}}});document.observe("smallsearch:rendered",function(a){new SmallSearchInputTile(a.element())});var StarRating=Class.create({initialize:function(a){this.container=a;this.numberOfStars=5;this.starBackgroundUrl="/themes/"+getThemeName()+"/images/rating/stars.png";this.starImage=new Image();Event.observe(this.starImage,"load",this.imageLoadListener.bindAsEventListener(this));this.starImage.src=this.starBackgroundUrl},initBoxPosition:function(){var b=this.container.cumulativeOffset();var a=this.container.getDimensions();this.box={left:b.left,top:b.top,right:(b.left+a.width),bottom:(b.top+this.getBackgroundHeight())}},reinitializeElements:function(){this.initStyle();this.initBoxPosition()},getBackgroundWidth:function(){return this.starImage.width},getBackgroundHeight:function(){return this.starImage.height/3},getRatingScale:function(){return this.getBackgroundWidth()/100},getInitialRatingWidth:function(){return this.initialStars*this.getStarWidth()},getStarWidth:function(){return this.getBackgroundWidth()/this.numberOfStars},getStarFromPosition:function(a){var b=a.left-this.box.left;return this.getStarFromWidth(b)},getStarFromWidth:function(a){return Math.ceil(a/this.getStarWidth())},getStarFromRating:function(a){if(a>=80){return 5}else{if(a>=60){return 4}else{if(a>=40){return 3}else{if(a>=20){return 2}else{return 1}}}}},getWidthFromStar:function(a){return a*this.getStarWidth()},initStyle:function(){this.container.setStyle({width:this.getBackgroundWidth()+"px",position:"relative",padding:0,margin:0,background:"none"});this.gray.setStyle({position:"absolute",top:"0px",left:"0px",width:this.getBackgroundWidth()+"px",height:this.getBackgroundHeight()+"px",background:"url("+this.starBackgroundUrl+") no-repeat"});this.blue.setStyle({position:"absolute",top:"0px",left:"0px",height:this.getBackgroundHeight()+"px"});this.yellow.setStyle({position:"absolute",top:"0px",left:"0px",height:this.getBackgroundHeight()+"px"})},setInitialStars:function(){this.blue.setStyle({background:"url("+this.starBackgroundUrl+") no-repeat 0 -"+this.getBackgroundHeight()+"px",width:this.getInitialRatingWidth()+"px"});this.yellow.setStyle({background:"url("+this.starBackgroundUrl+") no-repeat 0 -"+this.getBackgroundHeight()*2+"px",width:"0px"});this.label.setStyle({paddingTop:this.getBackgroundHeight()+"px"})},addListeners:function(){Event.observe(this.container,"mousemove",this.mousemoveListener.bindAsEventListener(this));Event.observe(this.container,"click",this.clickListener.bindAsEventListener(this));Event.observe(this.container,"mouseout",this.mouseoutListener.bindAsEventListener(this))},removeListeners:function(){this.container.stopObserving("mousemove");this.container.stopObserving("mouseout");this.container.stopObserving("click")},setRating:function(d){var a=d.responseText.evalJSON();var b=this.getWidthFromStar(this.getStarFromRating(a.avg));try{new Effect.Fade(this.yellow,{duration:0.1,queue:{position:"end",scope:"starrating"}});new Effect.Appear(this.blue,{duration:0.1,queue:{position:"end",scope:"starrating"}});new Effect.Morph(this.blue,{style:"width: "+b+"px",duration:1,queue:{position:"end",scope:"starrating"}});this.updateLabel(a.count)}catch(c){this.yellow.hide();this.blue.show();this.blue.setStyle({width:b+"px"})}this.removeListeners()},updateLabel:function(b){var a=this.labelText.replace(/\{0\}/,b);this.label.update(a)},handleRatingError:function(a){this.removeListeners();this.cancelEffects();try{new Effect.Fade(this.yellow,{duration:0.2,queue:{position:"end",scope:"starrating"}});new Effect.Appear(this.blue,{duration:0.2,queue:{position:"end",scope:"starrating"}})}catch(b){this.yellow.hide();this.blue.show()}},animate:function(){this.cancelEffects();this.yellow.show();this.yellow.setOpacity(1);if(this.blue.visible()){this.blue.hide()}try{this.mousemoveEffect=new Effect.Morph(this.yellow,{style:"width: "+(this.getStarWidth()*this.hoverStar)+"px",duration:0.1,queue:{position:"end",scope:"starrating"}})}catch(a){this.yellow.setStyle({width:(this.getStarWidth()*this.hoverStar)+"px"})}},pointerInsideBox:function(a){return !(a.pointerX()<=this.box.left||a.pointerY()<=this.box.top||a.pointerX()>=this.box.right||a.pointerY()>=this.box.bottom)},mousemoveListener:function(a){if(this.pointerInsideBox(a)){var c=a.pointerX()-a.element().positionedOffset()["left"];var b=this.getStarFromPosition({left:a.pointerX()});if(this.hoverStar!=b){this.hoverStar=b;if(typeof this.timeout!="undefined"){clearTimeout(this.timeout)}this.animate()}}},mouseoutListener:function(b){if(!this.pointerInsideBox(b)){try{this.cancelEffects();new Effect.Fade(this.yellow,{duration:0.3,queue:{position:"end",scope:"starrating"}});new Effect.Appear(this.blue,{duration:0.3,queue:{position:"end",scope:"starrating"}})}catch(a){this.yellow.setStyle({width:"0px"});this.blue.show()}this.hoverStar=null}},cancelEffects:function(){clearTimeout(this.timeout);try{var a=Effect.Queues.get("starrating");a.each(function(c){c.cancel()})}catch(b){}},clickListener:function(b){var a;switch(this.getStarFromPosition({left:b.pointerX()})){case 1:a=0;break;case 2:a=25;break;case 3:a=50;break;case 4:a=75;break;case 5:a=100;break;default:return}this.params.set("rating",a);new Ajax.Request(this.form.getAttribute("action"),{parameters:this.params,onSuccess:this.setRating.bindAsEventListener(this),onFailure:this.handleRatingError.bindAsEventListener(this)})},imageLoadListener:function(a){this.form=this.container.select("form").first();this.params=new Hash(this.form.serialize(true));this.initialStars=this.container.select('input[name="initial_stars"]')[0].value;this.initialRatingCount=this.container.select('input[name="rating_count"]')[0].value;this.labelText=this.container.select('input[name="rating_count_label"]')[0].value;this.gray=$(this.container.update('<div></div><div></div><div></div><div class="rating-label"></div>').firstChild);this.yellow=this.gray.next();this.blue=this.yellow.next();this.label=this.blue.next();this.updateLabel(this.initialRatingCount);this.initStyle();this.setInitialStars();this.addListeners();this.initBoxPosition()}});var RecommendRating=Class.create({initialize:function(a){this.form=$(a.down());this.text=this.form.next();this.initStyle();this.form.observe("submit",this.submitListener.bindAsEventListener(this))},initStyle:function(){this.img=new Image();Event.observe(this.img,"load",this.imageLoadListener.bindAsEventListener(this));this.img.src="/themes/"+getThemeName()+"/images/rating/recommended.png";this.gray=new Image();this.gray.src="/themes/"+getThemeName()+"/images/rating/recommended_gray.png"},updateRecommendationCount:function(b){var a=b.responseText.evalJSON();this.text.down().update(a.amount_with_rating);this.submit.setStyle({background:"url("+this.gray.src+") no-repeat"});this.removeListeners()},removeListeners:function(){this.form.stopObserving("submit");this.form.observe("submit",function(a){a.stop()})},imageLoadListener:function(a){this.submit=this.form.select("input[type=submit]")[0];this.submit.value="";this.submit.setStyle({background:"url("+this.img.src+") no-repeat",border:"0px",width:this.img.width+"px",height:this.img.height+"px"})},submitListener:function(a){a.stop();new Ajax.Request(this.form.getAttribute("action"),{parameters:this.form.serialize(),onSuccess:this.updateRecommendationCount.bindAsEventListener(this)})}});var AgreeDisagreeRating=Class.create({initialize:function(a){this.form=a.down();this.text=this.form.next();this.initStyle();this.agree.observe("click",this.submitListener.bindAsEventListener(this));this.disagree.observe("click",this.submitListener.bindAsEventListener(this))},initStyle:function(){var a=this.form.select("button");this.upIconPath="/themes/"+getThemeName()+"/images/rating/thumb_up.png";this.downIconPath="/themes/"+getThemeName()+"/images/rating/thumb_down.png";this.upIconGrayPath="/themes/"+getThemeName()+"/images/rating/thumb_up_gray.png";this.downIconGrayPath="/themes/"+getThemeName()+"/images/rating/thumb_down_gray.png";this.agree=this.transformButton(a[0],this.upIconPath);this.disagree=this.transformButton(a[1],this.downIconPath)},transformButton:function(c,a){var b=new Image();b.src=a;if(b.complete){this.setButtonBackground(c,b)}else{Event.observe(b,"load",function(d){c.update();c.setStyle({background:"url("+a+") no-repeat",border:"0",width:b.width+"px",height:b.height+"px"})})}return c},setButtonBackground:function(a,b){a.update();a.setStyle({background:"url("+b.src+") no-repeat",border:"0",width:b.width+"px",height:b.height+"px"})},updateRatingCount:function(b){var a=b.responseText.evalJSON();this.eventTrigger.next().down().update(a.amount_with_rating);this.agree.stopObserving("click");this.disagree.stopObserving("click");this.form.observe("submit",function(c){c.stop()});this.agree.setStyle({background:"url("+this.upIconGrayPath+")"});this.disagree.setStyle({background:"url("+this.downIconGrayPath+")"});new Effect.Shake(this.submit,{distance:100})},submitListener:function(a){a.stop();var b=this.form.serialize(true);b.rating=a.element().value;this.eventTrigger=a.element();new Ajax.Request(this.form.getAttribute("action"),{parameters:b,onSuccess:this.updateRatingCount.bindAsEventListener(this),onFailure:function(c){}})}});var OffensiveComment=Class.create({rewriteButtonToLink:function(b){this.element=b;var c=b.down();this.ajaxifyForm(c);var a=b.select("button").first();this.link=b.update('<a href="#offensive">'+a.firstChild.nodeValue+"</a>").down();this.link.observe("click",this.submitListener.bindAsEventListener(this))},ajaxifyForm:function(a){this.parameters=a.serialize();this.serviceUrl=a.readAttribute("action");this.tagOffensiveConfirmText=a.select("input[name=tag_offensive_confirm]")[0].value;this.taggedOffensiveText=a.select("input[name=tagged_offensive]")[0].value;this.button=a.select("button").first();this.button.observe("click",this.submitListener.bindAsEventListener(this))},submitListener:function(a){a.stop();if(confirm(this.tagOffensiveConfirmText)){new Ajax.Request(this.serviceUrl,{parameters:this.parameters,onSuccess:this.successListener.bindAsEventListener(this)})}},successListener:function(c){if(typeof this.link!="undefined"){var a=this.link.replace("<span>("+this.taggedOffensiveText+")</span>").down();try{new Effect.Highlight(a)}catch(b){}}else{this.button.disabled=true;this.button.addClassName("disabledbutton")}}});
