var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(A){A=A.toUpperCase();var F=this.NODEMAP[A]||"div";var D=document.createElement(F);try{D.innerHTML="<"+A+"></"+A+">"}catch(E){}var C=D.firstChild||null;if(C&&(C.tagName.toUpperCase()!=A)){C=C.getElementsByTagName(A)[0]}if(!C){C=document.createElement(A)}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{D.innerHTML="<"+A+" "+B+"></"+A+">"}catch(E){}C=D.firstChild||null;if(!C){C=document.createElement(A);for(attr in arguments[1]){C[attr=="class"?"className":attr]=arguments[1][attr]}}if(C.tagName.toUpperCase()!=A){C=D.getElementsByTagName(A)[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(A){var B=[];for(attribute in A){B.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+A[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"')}return B.join(" ")},_children:function(A,B){if(B.tagName){A.appendChild(B);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(B){var A=this.node("div");$(A).update(B.strip());return A.down()},dump:function(B){if(typeof B!="object"&&typeof B!="function"){B=window}var A=("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+/);A.each(function(C){B[C]=function(){return Builder.node.apply(Builder,[C].concat($A(arguments)))}})}};String.prototype.parseColor=function(){var A="#";if(this.slice(0,4)=="rgb("){var C=this.slice(4,this.length-1).split(",");var B=0;do{A+=parseInt(C[B]).toColorPart()}while(++B<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var B=1;B<4;B++){A+=(this.charAt(B)+this.charAt(B)).toLowerCase()}}if(this.length==7){A=this.toLowerCase()}}}return(A.length==7?A:(arguments[0]||this))};Element.collectTextNodes=function(A){return $A($(A).childNodes).collect(function(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(A){try{A=$(A);var C=document.createTextNode(" ");A.appendChild(C);A.removeChild(C)}catch(B){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(A){return(-Math.cos(A*Math.PI)/2)+0.5},reverse:function(A){return 1-A},flicker:function(A){var A=((-Math.cos(A*Math.PI)/4)+0.75)+Math.random()/4;return A>1?1:A},wobble:function(A){return(-Math.cos(A*Math.PI*(9*A))/2)+0.5},pulse:function(B,A){return(-Math.cos((B*((A||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(A){return 1-(Math.cos(A*4.5*Math.PI)*Math.exp(-A*6))},none:function(A){return 0},full:function(A){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(A){var B="position:relative";if(Prototype.Browser.IE){B+=";zoom:1"}A=$(A);$A(A.childNodes).each(function(C){if(C.nodeType==3){C.nodeValue.toArray().each(function(D){A.insertBefore(new Element("span",{style:B}).update(D==" "?String.fromCharCode(160):D),C)});Element.remove(C)}})},multiple:function(C,B){var A;if(((typeof C=="object")||Object.isFunction(C))&&(C.length)){A=C}else{A=$(C).childNodes}var D=Object.extend({speed:0.1,delay:0},arguments[2]||{});var E=D.delay;$A(A).each(function(G,F){new B(G,Object.extend(D,{delay:F*D.speed+E}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(B,A,C){B=$(B);A=(A||"appear").toLowerCase();return Effect[Effect.PAIRS[A][B.visible()?1:0]](B,Object.extend({queue:{position:"end",scope:(B.id||"global"),limit:1}},C||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(A){this.effects._each(A)},add:function(B){var C=new Date().getTime();var A=Object.isString(B.options.queue)?B.options.queue:B.options.queue.position;switch(A){case"front":this.effects.findAll(function(D){return D.state=="idle"}).each(function(D){D.startOn+=B.finishOn;D.finishOn+=B.finishOn});break;case"with-last":C=this.effects.pluck("startOn").max()||C;break;case"end":C=this.effects.pluck("finishOn").max()||C;break}B.startOn+=C;B.finishOn+=C;if(!B.options.queue.limit||(this.effects.length<B.options.queue.limit)){this.effects.push(B)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(A){this.effects=this.effects.reject(function(B){return B==A});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var C=new Date().getTime();for(var B=0,A=this.effects.length;B<A;B++){this.effects[B]&&this.effects[B].loop(C)}}});Effect.Queues={instances:$H(),get:function(A){if(!Object.isString(A)){return A}return this.instances.get(A)||this.instances.set(A,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(A){if(A&&A.transition===false){A.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),A||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function B(D,C){if(D.options[C+"Internal"]){D.options[C+"Internal"](D)}if(D.options[C]){D.options[C](D)}}return function(C){if(this.state==="idle"){this.state="running";B(this,"beforeSetup");if(this.setup){this.setup()}B(this,"afterSetup")}if(this.state==="running"){C=(this.options.transition(C)*this.fromToDelta)+this.options.from;this.position=C;B(this,"beforeUpdate");if(this.update){this.update(C)}B(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(A){if(A>=this.startOn){if(A>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return }var C=(A-this.startOn)/this.totalTime,B=(C*this.totalFrames).round();if(B>this.currentFrame){this.render(C);this.currentFrame=B}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(A){if(this.options[A+"Internal"]){this.options[A+"Internal"](this)}if(this.options[A]){this.options[A](this)}},inspect:function(){var A=$H();for(property in this){if(!Object.isFunction(this[property])){A.set(property,this[property])}}return"#<Effect:"+A.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(A){this.effects=A||[];this.start(arguments[1])},update:function(A){this.effects.invoke("render",A)},finish:function(A){this.effects.each(function(B){B.render(1);B.cancel();B.event("beforeFinish");if(B.finish){B.finish(A)}B.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(C,F,E){C=Object.isString(C)?$(C):C;var A=$A(arguments),D=A.last(),B=A.length==5?A[3]:null;this.method=Object.isFunction(D)?D.bind(C):Object.isFunction(C[D])?C[D].bind(C):function(G){C[D]=G};this.start(Object.extend({from:F,to:E},B||{}))},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(B,C,A){return new Effect.Move(B,Object.extend({x:A,y:C},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(B,A){this.element=$(B);if(!this.element){throw (Effect._elementDoesNotExistError)}var C=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:A},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(A){var B=(this.options.scaleFrom/100)+(this.factor*A);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*B+this.fontSizeType})}this.setDimensions(this.dims[0]*B,this.dims[1]*B)},finish:function(A){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(D,C){var E={};if(this.options.scaleX){E.width=C.round()+"px"}if(this.options.scaleY){E.height=D.round()+"px"}if(this.options.scaleFromCenter){var B=(D-this.dims[0])/2;var A=(C-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){E.top=this.originalTop-B+"px"}if(this.options.scaleX){E.left=this.originalLeft-A+"px"}}else{if(this.options.scaleY){E.top=-B+"px"}if(this.options.scaleX){E.left=-A+"px"}}}this.element.setStyle(E)}});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(B,C,D){return B+((this._base[D]+(this._delta[D]*A)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(A){var B=arguments[1]||{},D=document.viewport.getScrollOffsets(),C=$(A).cumulativeOffset();if(B.offset){C[1]+=B.offset}return new Effect.Tween(null,D.top,C[1],B,function(E){scrollTo(D.left,E.round())})};Effect.Fade=function(B){B=$(B);var A=B.getInlineOpacity();var C=Object.extend({from:B.getOpacity()||1,to:0,afterFinishInternal:function(D){if(D.options.to!=0){return }D.element.hide().setStyle({opacity:A})}},arguments[1]||{});return new Effect.Opacity(B,C)};Effect.Appear=function(A){A=$(A);var B=Object.extend({from:(A.getStyle("display")=="none"?0:A.getOpacity()||0),to:1,afterFinishInternal:function(C){C.element.forceRerendering()},beforeSetup:function(C){C.element.setOpacity(C.options.from).show()}},arguments[1]||{});return new Effect.Opacity(A,B)};Effect.Puff=function(B){B=$(B);var A={opacity:B.getInlineOpacity(),position:B.getStyle("position"),top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};return new Effect.Parallel([new Effect.Scale(B,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(B,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(C){Position.absolutize(C.effects[0].element)},afterFinishInternal:function(C){C.effects[0].element.hide().setStyle(A)}},arguments[1]||{}))};Effect.BlindUp=function(A){A=$(A);A.makeClipping();return new Effect.Scale(A,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(B){B.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(B){B=$(B);var A=B.getDimensions();return new Effect.Scale(B,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:A.height,originalWidth:A.width},restoreAfterFinish:true,afterSetup:function(C){C.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(C){C.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(B){B=$(B);var A=B.getInlineOpacity();return new Effect.Appear(B,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(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:A})}})}},arguments[1]||{}))};Effect.DropOut=function(B){B=$(B);var A={top:B.getStyle("top"),left:B.getStyle("left"),opacity:B.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(B,{x:0,y:100,sync:true}),new Effect.Opacity(B,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(C){C.effects[0].element.makePositioned()},afterFinishInternal:function(C){C.effects[0].element.hide().undoPositioned().setStyle(A)}},arguments[1]||{}))};Effect.Shake=function(B){B=$(B);var D=Object.extend({distance:20,duration:0.5},arguments[1]||{});var E=parseFloat(D.distance);var C=parseFloat(D.duration)/10;var A={top:B.getStyle("top"),left:B.getStyle("left")};return new Effect.Move(B,{x:E,y:0,duration:C,afterFinishInternal:function(F){new Effect.Move(F.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(G){new Effect.Move(G.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(H){new Effect.Move(H.element,{x:-E*2,y:0,duration:C*2,afterFinishInternal:function(I){new Effect.Move(I.element,{x:E*2,y:0,duration:C*2,afterFinishInternal:function(J){new Effect.Move(J.element,{x:-E,y:0,duration:C,afterFinishInternal:function(K){K.element.undoPositioned().setStyle(A)}})}})}})}})}})}})};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(B){B=$(B);var C=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var A={top:B.style.top,left:B.style.left,height:B.style.height,width:B.style.width,opacity:B.getInlineOpacity()};var H=B.getDimensions();var F,G;var E,D;switch(C.direction){case"top-left":F=G=E=D=0;break;case"top-right":F=H.width;G=D=0;E=-H.width;break;case"bottom-left":F=E=0;G=H.height;D=-H.height;break;case"bottom-right":F=H.width;G=H.height;E=-H.width;D=-H.height;break;case"center":F=H.width/2;G=H.height/2;E=-H.width/2;D=-H.height/2;break}return new Effect.Move(B,{x:F,y:G,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:C.opacityTransition}),new Effect.Move(I.element,{x:E,y:D,sync:true,transition:C.moveTransition}),new Effect.Scale(I.element,100,{scaleMode:{originalHeight:H.height,originalWidth:H.width},sync:true,scaleFrom:window.opera?1:0,transition:C.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(A)}},C))}})};Effect.Shrink=function(B){B=$(B);var C=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var A={top:B.style.top,left:B.style.left,height:B.style.height,width:B.style.width,opacity:B.getInlineOpacity()};var F=B.getDimensions();var E,D;switch(C.direction){case"top-left":E=D=0;break;case"top-right":E=F.width;D=0;break;case"bottom-left":E=0;D=F.height;break;case"bottom-right":E=F.width;D=F.height;break;case"center":E=F.width/2;D=F.height/2;break}return new Effect.Parallel([new Effect.Opacity(B,{sync:true,to:0,from:1,transition:C.opacityTransition}),new Effect.Scale(B,window.opera?1:0,{sync:true,transition:C.scaleTransition,restoreAfterFinish:true}),new Effect.Move(B,{x:E,y:D,sync:true,transition:C.moveTransition})],Object.extend({beforeStartInternal:function(G){G.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(G){G.effects[0].element.hide().undoClipping().undoPositioned().setStyle(A)}},C))};Effect.Pulsate=function(C){C=$(C);var D=arguments[1]||{},B=C.getInlineOpacity(),E=D.transition||Effect.Transitions.linear,A=function(F){return 1-E((-Math.cos((F*(D.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(C,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(F){F.element.setStyle({opacity:B})}},D),{transition:A}))};Effect.Fold=function(B){B=$(B);var A={top:B.style.top,left:B.style.left,width:B.style.width,height:B.style.height};B.makeClipping();return new Effect.Scale(B,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(C){new Effect.Scale(B,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(D){D.element.hide().undoClipping().setStyle(A)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(A){this.element=$(A);if(!this.element){throw (Effect._elementDoesNotExistError)}var 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 B=this.element.getStyles();this.style=this.style.reject(function(D){return D.value==B[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(G){var B=G[0],F=G[1],E=null;if(F.parseColor("#zzzzzz")!="#zzzzzz"){F=F.parseColor();E="color"}else{if(B=="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 C=this.element.getStyle(B);return{style:B.camelize(),originalValue:E=="color"?A(C):parseFloat(C||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(A){var D={},B,C=this.transforms.length;while(C--){D[(B=this.transforms[C]).style]=B.unit=="color"?"#"+(Math.round(B.originalValue[0]+(B.targetValue[0]-B.originalValue[0])*A)).toColorPart()+(Math.round(B.originalValue[1]+(B.targetValue[1]-B.originalValue[1])*A)).toColorPart()+(Math.round(B.originalValue[2]+(B.targetValue[2]-B.originalValue[2])*A)).toColorPart():(B.originalValue+(B.targetValue-B.originalValue)*A).toFixed(3)+(B.unit===null?"":B.unit)}this.element.setStyle(D,true)}});Effect.Transform=Class.create({initialize:function(A){this.tracks=[];this.options=arguments[1]||{};this.addTracks(A)},addTracks:function(A){A.each(function(B){B=$H(B);var C=B.values().first();this.tracks.push($H({ids:B.keys().first(),effect:Effect.Morph,options:{style:C}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(B){var E=B.get("ids"),C=B.get("effect"),D=B.get("options");var A=[$(E)||$$(E)].flatten();return A.map(function(F){return new C(F,Object.extend({sync:true},D))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var B,A=$H();if(Prototype.Browser.WebKit){B=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';B=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(C){if(B[C]){A.set(C,B[C])}});if(Prototype.Browser.IE&&this.include("opacity")){A.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return A};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(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(B){B=$(B);var C=B.currentStyle,A;A=Element.CSS_PROPERTIES.inject({},function(E,D){E[D]=C[D];return E});if(!A.opacity){A.opacity=B.getOpacity()}return A}}Effect.Methods={morph:function(A,B){A=$(A);new Effect.Morph(A,Object.extend({style:B},arguments[2]||{}));return A},visualEffect:function(C,B,D){C=$(C);var E=B.dasherize().camelize(),A=E.charAt(0).toUpperCase()+E.substring(1);new Effect[A](C,D);return C},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(A){this.drops=this.drops.reject(function(B){return B.element==$(A)})},add:function(A){A=$(A);var B=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(B.containment){B._containers=[];var C=B.containment;if(Object.isArray(C)){C.each(function(D){B._containers.push($(D))})}else{B._containers.push($(C))}}if(B.accept){B.accept=[B.accept].flatten()}Element.makePositioned(A);B.element=A;this.drops.push(B)},findDeepestChild:function(A){deepest=A[0];for(i=1;i<A.length;++i){if(Element.isParent(A[i].element,deepest.element)){deepest=A[i]}}return deepest},isContained:function(B,A){var C;if(A.tree){C=B.treeNode}else{C=B.parentNode}return A._containers.detect(function(D){return C==D})},isAffected:function(A,C,B){return((B.element!=C)&&((!B._containers)||this.isContained(C,B))&&((!B.accept)||(Element.classNames(C).detect(function(D){return B.accept.include(D)})))&&Position.within(B.element,A[0],A[1]))},deactivate:function(A){if(A.hoverclass){Element.removeClassName(A.element,A.hoverclass)}this.last_active=null},activate:function(A){if(A.hoverclass){Element.addClassName(A.element,A.hoverclass)}this.last_active=A},show:function(A,C){if(!this.drops.length){return }var B,D=[];this.drops.each(function(E){if(Droppables.isAffected(A,C,E)){D.push(E)}});if(D.length>0){B=Droppables.findDeepestChild(D)}if(this.last_active&&this.last_active!=B){this.deactivate(this.last_active)}if(B){Position.within(B.element,A[0],A[1]);if(B.onHover){B.onHover(C,B.element,Position.overlap(B.overlap,B.element))}if(B!=this.last_active){Droppables.activate(B)}}},fire:function(B,A){if(!this.last_active){return }Position.prepare();if(this.isAffected([Event.pointerX(B),Event.pointerY(B)],A,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(A,this.last_active.element,B);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(A){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(A)},unregister:function(A){this.drags=this.drags.reject(function(B){return B==A});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(A){if(A.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=A}.bind(this),A.options.delay)}else{window.focus();this.activeDraggable=A}},deactivate:function(){this.activeDraggable=null},updateDrag:function(A){if(!this.activeDraggable){return }var B=[Event.pointerX(A),Event.pointerY(A)];if(this._lastPointer&&(this._lastPointer.inspect()==B.inspect())){return }this._lastPointer=B;this.activeDraggable.updateDrag(A,B)},endDrag:function(A){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return }this._lastPointer=null;this.activeDraggable.endDrag(A);this.activeDraggable=null},keyPress:function(A){if(this.activeDraggable){this.activeDraggable.keyPress(A)}},addObserver:function(A){this.observers.push(A);this._cacheObserverCallbacks()},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B.element==A});this._cacheObserverCallbacks()},notify:function(A,C,B){if(this[A+"Count"]>0){this.observers.each(function(D){if(D[A]){D[A](A,C,B)}})}if(C.options[A]){C.options[A](C,B)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(A){Draggables[A+"Count"]=Draggables.observers.select(function(B){return B[A]}).length})}};var Draggable=Class.create({initialize:function(A){var C={handle:false,reverteffect:function(D,G,F){var E=Math.sqrt(Math.abs(G^2)+Math.abs(F^2))*0.02;new Effect.Move(D,{x:-F,y:-G,duration:E,queue:{scope:"_draggable",position:"end"}})},endeffect:function(E){var D=Object.isNumber(E._opacity)?E._opacity:1;new Effect.Opacity(E,{duration:0.2,from:0.7,to:D,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[E]=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(C,{starteffect:function(D){D._opacity=Element.getOpacity(D);Draggable._dragging[D]=true;new Effect.Opacity(D,{duration:0.2,from:D._opacity,to:0.7})}})}var B=Object.extend(C,arguments[1]||{});this.element=$(A);if(B.handle&&Object.isString(B.handle)){this.handle=this.element.down("."+B.handle,0)}if(!this.handle){this.handle=$(B.handle)}if(!this.handle){this.handle=this.element}if(B.scroll&&!B.scroll.scrollTo&&!B.scroll.outerHTML){B.scroll=$(B.scroll);this._isScrollChild=Element.childOf(this.element,B.scroll)}Element.makePositioned(this.element);this.options=B;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(A){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return }if(Event.isLeftClick(A)){var C=Event.element(A);if((tag_name=C.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return }var B=[Event.pointerX(A),Event.pointerY(A)];var D=this.element.cumulativeOffset();this.offset=[0,1].map(function(E){return(B[E]-D[E])});Draggables.activate(this);Event.stop(A)}},startDrag:function(B){this.dragging=true;if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var A=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=A.left;this.originalScrollTop=A.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,B);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(B,E){this.dragging=false;if(this.options.quiet){Position.prepare();var D=[Event.pointerX(B),Event.pointerY(B)];Droppables.show(D,this.element)}if(this.options.ghosting){if(!this._originallyAbsolute){Position.relativize(this.element)}delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}var F=false;if(E){F=Droppables.fire(B,this.element);if(!F){F=false}}if(F&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,B);var A=this.options.revert;if(A&&Object.isFunction(A)){A=A(this.element)}var C=this.currentDelta();if(A&&this.options.reverteffect){if(F==0||A!="failure"){this.options.reverteffect(this.element,C[1]-this.delta[1],C[0]-this.delta[0])}}else{this.delta=C}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(A){if(A.keyCode!=Event.KEY_ESC){return }this.finishDrag(A,false);Event.stop(A)},endDrag:function(A){if(!this.dragging){return }this.stopScrolling();this.finishDrag(A,true);Event.stop(A)},draw:function(A){var F=this.element.cumulativeOffset();if(this.options.ghosting){var C=Position.realOffset(this.element);F[0]+=C[0]-Position.deltaX;F[1]+=C[1]-Position.deltaY}var E=this.currentDelta();F[0]-=E[0];F[1]-=E[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){F[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;F[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var D=[0,1].map(function(G){return(A[G]-F[G]-this.offset[G])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){D=this.options.snap(D[0],D[1],this)}else{if(Object.isArray(this.options.snap)){D=D.map(function(G,H){return(G/this.options.snap[H]).round()*this.options.snap[H]}.bind(this))}else{D=D.map(function(G){return(G/this.options.snap).round()*this.options.snap}.bind(this))}}}var B=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){B.left=D[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){B.top=D[1]+"px"}if(B.visibility=="hidden"){B.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(A){if(!(A[0]||A[1])){return }this.scrollSpeed=[A[0]*this.options.scrollSpeed,A[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(B,A){this.element=$(B);this.observer=A;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(A){while(A.tagName.toUpperCase()!="BODY"){if(A.id&&Sortable.sortables[A.id]){return A}A=A.parentNode}},options:function(A){A=Sortable._findRootElement($(A));if(!A){return }return Sortable.sortables[A.id]},destroy:function(A){A=$(A);var B=Sortable.sortables[A.id];if(B){Draggables.removeObserver(B.element);B.droppables.each(function(C){Droppables.remove(C)});B.draggables.invoke("destroy");delete Sortable.sortables[B.element.id]}},create:function(A){A=$(A);var B=Object.extend({element:A,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:A,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(A);var C={revert:true,quiet:B.quiet,scroll:B.scroll,scrollSpeed:B.scrollSpeed,scrollSensitivity:B.scrollSensitivity,delay:B.delay,ghosting:B.ghosting,constraint:B.constraint,handle:B.handle};if(B.starteffect){C.starteffect=B.starteffect}if(B.reverteffect){C.reverteffect=B.reverteffect}else{if(B.ghosting){C.reverteffect=function(F){F.style.top=0;F.style.left=0}}}if(B.endeffect){C.endeffect=B.endeffect}if(B.zindex){C.zindex=B.zindex}var E={overlap:B.overlap,containment:B.containment,tree:B.tree,hoverclass:B.hoverclass,onHover:Sortable.onHover};var D={onHover:Sortable.onEmptyHover,overlap:B.overlap,containment:B.containment,hoverclass:B.hoverclass};Element.cleanWhitespace(A);B.draggables=[];B.droppables=[];if(B.dropOnEmpty||B.tree){Droppables.add(A,D);B.droppables.push(A)}(B.elements||this.findElements(A,B)||[]).each(function(H,G){var F=B.handles?$(B.handles[G]):(B.handle?$(H).select("."+B.handle)[0]:H);B.draggables.push(new Draggable(H,Object.extend(C,{handle:F})));Droppables.add(H,E);if(B.tree){H.treeNode=A}B.droppables.push(H)});if(B.tree){(Sortable.findTreeElements(A,B)||[]).each(function(F){Droppables.add(F,D);F.treeNode=A;B.droppables.push(F)})}this.sortables[A.identify()]=B;Draggables.addObserver(new SortableObserver(A,B.onUpdate))},findElements:function(A,B){return Element.findChildren(A,B.only,B.tree?true:false,B.tag)},findTreeElements:function(A,B){return Element.findChildren(A,B.only,B.tree?true:false,B.treeTag)},onHover:function(D,C,E){if(Element.isParent(C,D)){return }if(E>0.33&&E<0.66&&Sortable.options(C).tree){return }else{if(E>0.5){Sortable.mark(C,"before");if(C.previousSibling!=D){var B=D.parentNode;D.style.visibility="hidden";C.parentNode.insertBefore(D,C);if(C.parentNode!=B){Sortable.options(B).onChange(D)}Sortable.options(C.parentNode).onChange(D)}}else{Sortable.mark(C,"after");var A=C.nextSibling||null;if(A!=D){var B=D.parentNode;D.style.visibility="hidden";C.parentNode.insertBefore(D,A);if(C.parentNode!=B){Sortable.options(B).onChange(D)}Sortable.options(C.parentNode).onChange(D)}}}},onEmptyHover:function(D,G,H){var I=D.parentNode;var A=Sortable.options(G);if(!Element.isParent(G,D)){var F;var B=Sortable.findElements(G,{tag:A.tag,only:A.only});var C=null;if(B){var E=Element.offsetSize(G,A.overlap)*(1-H);for(F=0;F<B.length;F+=1){if(E-Element.offsetSize(B[F],A.overlap)>=0){E-=Element.offsetSize(B[F],A.overlap)}else{if(E-(Element.offsetSize(B[F],A.overlap)/2)>=0){C=F+1<B.length?B[F+1]:null;break}else{C=B[F];break}}}}G.insertBefore(D,C);Sortable.options(I).onChange(D);A.onChange(D)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(C,A){var D=Sortable.options(C.parentNode);if(D&&!D.ghosting){return }if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var B=C.cumulativeOffset();Sortable._marker.setStyle({left:B[0]+"px",top:B[1]+"px"});if(A=="after"){if(D.overlap=="horizontal"){Sortable._marker.setStyle({left:(B[0]+C.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(B[1]+C.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(C,F,A){var E=Sortable.findElements(C,F)||[];for(var D=0;D<E.length;++D){var B=E[D].id.match(F.format);if(!B){continue}var G={id:encodeURIComponent(B?B[1]:null),element:C,parent:A,children:[],position:A.children.length,container:$(E[D]).down(F.treeTag)};if(G.container){this._tree(G.container,F,G)}A.children.push(G)}return A},tree:function(C){C=$(C);var B=this.options(C);var D=Object.extend({tag:B.tag,treeTag:B.treeTag,only:B.only,name:C.id,format:B.format},arguments[1]||{});var A={id:null,parent:null,children:[],container:C,position:0};return Sortable._tree(C,D,A)},_constructIndex:function(B){var A="";do{if(B.id){A="["+B.position+"]"+A}}while((B=B.parent)!=null);return A},sequence:function(A){A=$(A);var B=Object.extend(this.options(A),arguments[1]||{});return $(this.findElements(A,B)||[]).map(function(C){return C.id.match(B.format)?C.id.match(B.format)[1]:""})},setSequence:function(B,A){B=$(B);var C=Object.extend(this.options(B),arguments[2]||{});var D={};this.findElements(B,C).each(function(E){if(E.id.match(C.format)){D[E.id.match(C.format)[1]]=[E,E.parentNode]}E.parentNode.removeChild(E)});A.each(function(E){var F=D[E];if(F){F[1].appendChild(F[0]);delete D[E]}})},serialize:function(B){B=$(B);var C=Object.extend(Sortable.options(B),arguments[1]||{});var A=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:B.id);if(C.tree){return Sortable.tree(B,arguments[1]).children.map(function(D){return[A+Sortable._constructIndex(D)+"[id]="+encodeURIComponent(D.id)].concat(D.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(B,arguments[1]).map(function(D){return A+"[]="+encodeURIComponent(D)}).join("&")}}};Element.isParent=function(B,A){if(!B.parentNode||B==A){return false}if(B.parentNode==A){return true}return Element.isParent(B.parentNode,A)};Element.findChildren=function(E,D,C,B){if(!E.hasChildNodes()){return null}B=B.toUpperCase();if(D){D=[D].flatten()}var A=[];$A(E.childNodes).each(function(G){if(G.tagName&&G.tagName.toUpperCase()==B&&(!D||(Element.classNames(G).detect(function(H){return D.include(H)})))){A.push(G)}if(C){var F=Element.findChildren(G,D,C,B);if(F){A.push(F)}}});return(A.length>0?A.flatten():[])};Element.offsetSize=function(A,B){return A["offset"+((B=="vertical"||B=="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,C,B){A=$(A);this.element=A;this.update=$(C);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions){this.setOptions(B)}else{this.options=B||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(D,E){if(!E.style.position||E.style.position=="absolute"){E.style.position="absolute";Position.clone(D,E,{setHeight:false,offsetTop:D.offsetHeight})}Effect.Appear(E,{duration:0.15})};this.options.onHide=this.options.onHide||function(D,E){new Effect.Fade(E,{duration:0.15})};if(typeof (this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(A){if(this.active){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(A);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(A);return ;case Event.KEY_LEFT:case Event.KEY_RIGHT:return ;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(A);return ;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(A);return }}else{if(A.keyCode==Event.KEY_TAB||A.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&A.keyCode==0)){return }}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(B){var A=Event.findElement(B,"LI");if(this.index!=A.autocompleteIndex){this.index=A.autocompleteIndex;this.render()}Event.stop(B)},onClick:function(B){var A=Event.findElement(B,"LI");this.index=A.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(A){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var A=0;A<this.entryCount;A++){this.index==A?Element.addClassName(this.getEntry(A),"selected"):Element.removeClassName(this.getEntry(A),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(A){return this.update.firstChild.childNodes[A]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(F){if(this.options.updateElement){this.options.updateElement(F);return }var D="";if(this.options.select){var B=$(F).select("."+this.options.select)||[];if(B.length>0){D=Element.collectTextNodes(B[0],this.options.select)}}else{D=Element.collectTextNodesIgnoreClass(F,"informal")}var A=this.getTokenBounds();if(A[0]!=-1){var E=this.element.value.substr(0,A[0]);var C=this.element.value.substr(A[0]).match(/^\s+/);if(C){E+=C[0]}this.element.value=E+D+this.element.value.substr(A[1])}else{this.element.value=D}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,F)}},updateChoices:function(C){if(!this.changed&&this.hasFocus){this.update.innerHTML=C;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var A=0;A<this.entryCount;A++){var B=this.getEntry(A);B.autocompleteIndex=A;this.addObservers(B)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(A){Event.observe(A,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(A,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var A=this.getTokenBounds();return this.element.value.substring(A[0],A[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var E=this.element.value;if(E.strip().empty()){return[-1,0]}var F=arguments.callee.getFirstDifferencePos(E,this.oldElementValue);var H=(F==this.oldElementValue.length?1:0);var D=-1,C=E.length;var G;for(var B=0,A=this.options.tokens.length;B<A;++B){G=E.lastIndexOf(this.options.tokens[B],F+H-1);if(G>D){D=G}G=E.indexOf(this.options.tokens[B],F+H);if(-1!=G&&G<C){C=G}}return(this.tokenBounds=[D+1,C])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(C,A){var D=Math.min(C.length,A.length);for(var B=0;B<D;++B){if(C[B]!=A[B]){return B}}return D};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(B,D,A,C){this.baseInitialize(B,D,C);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=A},getUpdatedChoices:function(){this.startIndicator();var A=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,A):A;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(A){this.updateChoices(A.responseText)}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(A,C,D,B){this.baseInitialize(A,C,B);this.options.array=D},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(A){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(B){var C=[];var E=[];var H=B.getToken();var G=0;for(var D=0;D<B.options.array.length&&C.length<B.options.choices;D++){var F=B.options.array[D];var I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase()):F.indexOf(H);while(I!=-1){if(I==0&&F.length!=H.length){C.push("<li><strong>"+F.substr(0,H.length)+"</strong>"+F.substr(H.length)+"</li>");break}else{if(H.length>=B.options.partialChars&&B.options.partialSearch&&I!=-1){if(B.options.fullSearch||/\s/.test(F.substr(I-1,1))){E.push("<li>"+F.substr(0,I)+"<strong>"+F.substr(I,H.length)+"</strong>"+F.substr(I+H.length)+"</li>");break}}}I=B.options.ignoreCase?F.toLowerCase().indexOf(H.toLowerCase(),I+1):F.indexOf(H,I+1)}}if(E.length){C=C.concat(E.slice(0,B.options.choices-C.length))}return"<ul>"+C.join("")+"</ul>"}},A||{})}});Field.scrollFreeActivate=function(A){setTimeout(function(){Field.activate(A)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(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(G,C,B){var E=this.options[G+"Control"];var F=this.options[G+"Text"];if("button"==E){var A=document.createElement("input");A.type="submit";A.value=F;A.className="editor_"+G+"_button";if("cancel"==G){A.onclick=this._boundCancelHandler}this._form.appendChild(A);this._controls[G]=A}else{if("link"==E){var D=document.createElement("a");D.href="#";D.appendChild(document.createTextNode(F));D.onclick="cancel"==G?this._boundCancelHandler:this._boundSubmitHandler;D.className="editor_"+G+"_link";if(B){D.className+=" "+B}this._form.appendChild(D);this._controls[G]=D}}},createEditField:function(){var C=(this.options.loadTextURL?this.options.loadingText:this.getText());var B;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){B=document.createElement("input");B.type="text";var A=this.options.size||this.options.cols||0;if(0<A){B.size=A}}else{B=document.createElement("textarea");B.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);B.cols=this.options.cols||40}B.name=this.options.paramName;B.value=C;B.className="editor_field";if(this.options.submitOnBlur){B.onblur=this._boundSubmitHandler}this._controls.editor=B;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var B=this;function A(E,C){var D=B.options["text"+E+"Controls"];if(!D||C===false){return }B._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)}A("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);A("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");A("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML}this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(A){if(this._saving||this._editing){return }this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(A){Event.stop(A)}},enterHover:function(A){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return }this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(A){this.triggerCallback("onFailure",A);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(A){this.wrapUp();if(A){Event.stop(A)}},handleFormSubmission:function(D){var B=this._form;var C=$F(this._controls.editor);this.prepareSubmission();var E=this.options.callback(B,C)||"";if(Object.isString(E)){E=E.toQueryParams()}E.editorId=this.element.id;if(this.options.htmlResponse){var A=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(A,{parameters:E,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,A)}else{var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:E,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,A)}if(D){Event.stop(D)}},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(C){this._form.removeClassName(this.options.loadingClassName);var B=C.responseText;if(this.options.stripLoadedTextTags){B=B.stripTags()}this._controls.editor.value=B;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,A)},postProcessEditField:function(){var A=this.options.fieldPostCreation;if(A){$(this._controls.editor)["focus"==A?"focus":"activate"]()}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(A){Object.extend(this.options,A)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var A;$H(Ajax.InPlaceEditor.Listeners).each(function(B){A=this[B.value].bind(this);this._listeners[B.key]=A;if(!this.options.externalControlOnly){this.element.observe(B.key,A)}if(this.options.externalControl){this.options.externalControl.observe(B.key,A)}}.bind(this))},removeForm:function(){if(!this._form){return }this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(B,A){if("function"==typeof this.options[B]){this.options[B](this,A)}},unregisterListeners:function(){$H(this._listeners).each(function(A){if(!this.options.externalControlOnly){this.element.stopObserving(A.key,A.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(A.key,A.value)}}.bind(this))},wrapUp:function(A){this.leaveEditMode();this._boundComplete(A,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,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(B){this._controls.editor.disabled=true;var A=this._controls.editor.firstChild;if(!A){A=document.createElement("option");A.value="";this._controls.editor.appendChild(A);A.selected=true}A.update((B||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var A=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(A,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(B){this._text=B.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,A)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(D){return 2===D.length?D:[D,D].flatten()});var B=("value" in this.options)?this.options.value:this._text;var C=this._collection.any(function(D){return D[0]==B}.bind(this));this._controls.editor.update("");var A;this._collection.each(function(E,D){A=document.createElement("option");A.value=E[0];A.selected=C?E[0]==B:0==D;A.appendChild(document.createTextNode(E[1]));this._controls.editor.appendChild(A)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(A){if(!A){return }function B(C,D){if(C in A||D===undefined){return }A[C]=D}B("cancelControl",(A.cancelLink?"link":(A.cancelButton?"button":A.cancelLink==A.cancelButton==false?false:undefined)));B("okControl",(A.okLink?"link":(A.okButton?"button":A.okLink==A.okButton==false?false:undefined)));B("highlightColor",A.highlightcolor);B("highlightEndColor",A.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(A){return Form.serialize(A)},onComplete:function(B,A){new Effect.Highlight(A,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(A){A.element.style.backgroundColor=A.options.highlightColor;if(A._effect){A._effect.cancel()}},onFailure:function(B,A){alert("Error communication with the server: "+B.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(A){A._effect=new Effect.Highlight(A.element,{startcolor:A.options.highlightColor,endcolor:A.options.highlightEndColor,restorecolor:A._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(B,A,C){this.delay=A||0.5;this.element=$(B);this.callback=C;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({initialize:function(A,C,D){var B=this;if(Object.isArray(A)){this.handles=A.collect(function(E){return $(E)})}else{this.handles=[$(A)]}this.track=$(C);this.options=D||{};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(F,E){E=B.handles.length-1-E;B.setValue(parseFloat((Object.isArray(B.options.sliderValue)?B.options.sliderValue[E]:B.options.sliderValue)||B.range.start),E);F.makePositioned().observe("mousedown",B.eventMouseDown)});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true},dispose:function(){var A=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(B){Event.stopObserving(B,"mousedown",A.eventMouseDown)})},setDisabled:function(){this.disabled=true},setEnabled:function(){this.disabled=false},getNearestValue:function(A){if(this.allowedValues){if(A>=this.allowedValues.max()){return(this.allowedValues.max())}if(A<=this.allowedValues.min()){return(this.allowedValues.min())}var C=Math.abs(this.allowedValues[0]-A);var B=this.allowedValues[0];this.allowedValues.each(function(D){var E=Math.abs(D-A);if(E<=C){B=D;C=E}});return B}if(A>this.range.end){return this.range.end}if(A<this.range.start){return this.range.start}return A},setValue:function(B,A){if(!this.active){this.activeHandleIdx=A||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles()}A=A||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((A>0)&&(B<this.values[A-1])){B=this.values[A-1]}if((A<(this.handles.length-1))&&(B>this.values[A+1])){B=this.values[A+1]}}B=this.getNearestValue(B);this.values[A]=B;this.value=this.values[0];this.handles[A].style[this.isVertical()?"top":"left"]=this.translateToPx(B);this.drawSpans();if(!this.dragging||!this.event){this.updateFinished()}},setValueBy:function(B,A){this.setValue(this.values[A||this.activeHandleIdx||0]+B,A||this.activeHandleIdx||0)},translateToPx:function(A){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(A-this.range.start))+"px"},translateToValue:function(A){return((A/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start)},getRange:function(B){var A=this.values.sortBy(Prototype.K);B=B||0;return $R(A[B],A[B+1])},minimumOffset:function(){return(this.isVertical()?this.alignY:this.alignX)},maximumOffset:function(){return(this.isVertical()?(this.track.offsetHeight!=0?this.track.offsetHeight:this.track.style.height.replace(/px$/,""))-this.alignY:(this.track.offsetWidth!=0?this.track.offsetWidth:this.track.style.width.replace(/px$/,""))-this.alignX)},isVertical:function(){return(this.axis=="vertical")},drawSpans:function(){var A=this;if(this.spans){$R(0,this.spans.length-1).each(function(B){A.setSpan(A.spans[B],A.getRange(B))})}if(this.options.startSpan){this.setSpan(this.options.startSpan,$R(0,this.values.length>1?this.getRange(0).min():this.value))}if(this.options.endSpan){this.setSpan(this.options.endSpan,$R(this.values.length>1?this.getRange(this.spans.length-1).max():this.value,this.maximum))}},setSpan:function(B,A){if(this.isVertical()){B.style.top=this.translateToPx(A.start);B.style.height=this.translateToPx(A.end-A.start+this.range.start)}else{B.style.left=this.translateToPx(A.start);B.style.width=this.translateToPx(A.end-A.start+this.range.start)}},updateStyles:function(){this.handles.each(function(A){Element.removeClassName(A,"selected")});Element.addClassName(this.activeHandle,"selected")},startDrag:function(D){if(Event.isLeftClick(D)){if(!this.disabled){this.active=true;var A=Event.element(D);var E=[Event.pointerX(D),Event.pointerY(D)];var C=A;if(C==this.track){var B=this.track.cumulativeOffset();this.event=D;this.setValue(this.translateToValue((this.isVertical()?E[1]-B[1]:E[0]-B[0])-(this.handleLength/2)));var B=this.activeHandle.cumulativeOffset();this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}else{while((this.handles.indexOf(A)==-1)&&A.parentNode){A=A.parentNode}if(this.handles.indexOf(A)!=-1){this.activeHandle=A;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var B=this.activeHandle.cumulativeOffset();this.offsetX=(E[0]-B[0]);this.offsetY=(E[1]-B[1])}}}Event.stop(D)}},update:function(A){if(this.active){if(!this.dragging){this.dragging=true}this.draw(A);if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(A)}},draw:function(B){var C=[Event.pointerX(B),Event.pointerY(B)];var A=this.track.cumulativeOffset();C[0]-=this.offsetX+A[0];C[1]-=this.offsetY+A[1];this.event=B;this.setValue(this.translateToValue(this.isVertical()?C[1]:C[0]));if(this.initialized&&this.options.onSlide){this.options.onSlide(this.values.length>1?this.values:this.value,this)}},endDrag:function(A){if(this.active&&this.dragging){this.finishDrag(A,true);Event.stop(A)}this.active=false;this.dragging=false},finishDrag:function(A,B){this.active=false;this.dragging=false;this.updateFinished()},updateFinished:function(){if(this.initialized&&this.options.onChange){this.options.onChange(this.values.length>1?this.values:this.value,this)}this.event=null}});Sound={tracks:{},_enabled:true,template:new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),enable:function(){Sound._enabled=true},disable:function(){Sound._enabled=false},play:function(A){if(!Sound._enabled){return }var B=Object.extend({track:"global",url:A,replace:false},arguments[1]||{});if(B.replace&&this.tracks[B.track]){$R(0,this.tracks[B.track].id).each(function(D){var C=$("sound_"+B.track+"_"+D);C.Stop&&C.Stop();C.remove()});this.tracks[B.track]=null}if(!this.tracks[B.track]){this.tracks[B.track]={id:0}}else{this.tracks[B.track].id++}B.id=this.tracks[B.track].id;$$("body")[0].insert(Prototype.Browser.IE?new Element("bgsound",{id:"sound_"+B.track+"_"+B.id,src:B.url,loop:1,autostart:true}):Sound.template.evaluate(B))}};if(Prototype.Browser.Gecko&&navigator.userAgent.indexOf("Win")>0){if(navigator.plugins&&$A(navigator.plugins).detect(function(A){return A.name.indexOf("QuickTime")!=-1})){Sound.template=new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')}else{if(navigator.plugins&&$A(navigator.plugins).detect(function(A){return A.name.indexOf("Windows Media")!=-1})){Sound.template=new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>')}else{if(navigator.plugins&&$A(navigator.plugins).detect(function(A){return A.name.indexOf("RealPlayer")!=-1})){Sound.template=new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>')}else{Sound.play=function(){}}}}}var Scriptaculous={Version:"1.8.3",require:function(B){try{document.write('<script type="text/javascript" src="'+B+'"><\/script>')}catch(C){var A=document.createElement("script");A.type="text/javascript";A.src=B;document.getElementsByTagName("head")[0].appendChild(A)}},REQUIRED_PROTOTYPE:"1.6.0.3",load:function(){function A(B){var C=B.replace(/_.*|\./g,"");C=parseInt(C+"0".times(4-C.length));return B.indexOf("_")>-1?C-1:C}if((typeof Prototype=="undefined")||(typeof Element=="undefined")||(typeof Element.Methods=="undefined")||(A(Prototype.Version)<A(Scriptaculous.REQUIRED_PROTOTYPE))){throw ("script.aculo.us requires the Prototype JavaScript framework >= "+Scriptaculous.REQUIRED_PROTOTYPE)}}};Scriptaculous.load();Element.addMethods({attr:function(A,B,C){if(C!==undefined){A.writeAttribute(B,C)}else{if(typeof B=="object"){for(attr in B){if(attr){A.writeAttribute(attr,B[attr])}}}else{return A.readAttribute(B)}}return A},html:function(A,B){if(B!==undefined){A.innerHTML=B}else{return A.innerHTML}return A},_setValueB:function(A,B){if(B===undefined){return A}if(B.constructor=="Number"){B+=""}if(A.nodeType!=1){return }if(/radio|checkbox/.test(A.type)===true){$$('input[type="'+A.type+'"][name="'+A.name+'"]').each(function(C){if(B.constructor==Array){C.checked=(B.indexOf(C.value)>=0)?true:false}else{C.checked=(B==C.value)?true:false}})}else{if(/select/.test(A.type)){if(B.constructor!==Array){B=[B]}A.find("option").each(function(C){C.selected=(B.indexOf(C.value)>=0)?true:false})}else{A.value=B}}return A},val:function(B,C,A){if(C!==undefined){if((A===undefined)||(A===false)){return B._setValueB(C)}else{return B.setValue(C)}}else{return B.getValue()}},find:function(){var B=$A(arguments),A=$(B.shift());return Selector.findChildElements(A,B)}});Ajax.Request.Cache={};Object.extend(Ajax.Request.prototype,{isSameOrigin:function(){var A=this.url.match(/^\s*https?:\/\/[^\/]*/);return !A||(A[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:window.location.host,port:location.port?":"+location.port:""}))},request:function(A){this.url=A;if(this.options.cache===true){this.cache_key=this.url+"_"+Object.toQueryString(this.options.parameters)}this.method=this.options.method;var E=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){E._method=this.method;this.method="post"}this.parameters=E;if(E=Object.toQueryString(E)){if(this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+E}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){E+="&_="}}}try{var B=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(B)}Ajax.Responders.dispatch("onCreate",this,B);if(this.options.cache===true){var C=Ajax.Request.Cache[this.cache_key];if(C!==undefined){if((this.options.ttl!==undefined)&&((new Date().getTime()-C.t)>this.options.ttl)){delete Ajax.Request.Cache[this.cache_key]}else{if(C.json||C.payload.isJSON()){this.options.evalJSON="force"}this.transport={};this.transport.getResponseHeader=function(F){return((F==="X-JSON")&&(C.json||C.payload.isJSON()))?C.json||C.payload:null};this.transport.status=200;this.transport.readyState=4;this.transport.responseText=C.payload;this.respondToReadyState(4);return }}}this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method==="post"?(this.options.postBody||E):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(D){this.dispatchException(D)}},onStateChange:function(){var A=this.transport.readyState;if(A>1&&!((A===4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}if(A===4){window.notify("onAjaxDone",this.url)}if((A===4)&&(this.options.cache===true)){Ajax.Request.Cache[this.cache_key]={t:new Date().getTime(),payload:this.transport.responseText};if(this.getHeader("X-JSON")){Ajax.Request.Cache[this.cache_key].json=this.getHeader("X-JSON")}}}});Object.extend(ComCore.Configuration,{set:function(A,B,C){if(B&&(B.length>0)){ComCore.configValues[A][B]=C}else{ComCore.configValues[A]=C}ComCore.configValues[A]=C;return true},_eoo:true});Object.extend(PeriodicalExecuter.prototype,{restart:function(){if(this.timer===null){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)}},_eoo:true});Object.extend(ComCore.Debug,{errorCount:function(){var A=0;if($("debugErrorCountServerSide")){A=parseInt($("debugErrorCountServerSide").value,10)||0}return A}(),info:function(A){ComCore.Debug.log(A,"info")},warning:function(A){ComCore.Debug.log(A,"warning")},error:function(A,B){ComCore.Debug.errorCount++;if(ComCore.Configuration.get("debug")){if($("debugErrorCount")){$("debugErrorCount").update(ComCore.Debug.errorCount);$("debugErrorCountMessage").show()}}ComCore.Debug.log(A,"error")},_eoo:true});Object.extend(ComCore.Queuer,{getFunctions:function(){return ComCore.Queuer.functions},clear:function(){ComCore.Queuer.functions=[]},execute:function(){ComCore.Queuer.getFunctions().each(function(B){var C=B.name;if(B.onwindowload&&(ComCore.isWindowLoaded!==true)){Event.observe(window,"load",C,false)}else{try{C()}catch(A){debug(A);debug(C)}}});ComCore.Queuer.disable();ComCore.Queuer.clear()},_eoo:true});ComCore.forward=function(B,A){debug("ComCore.forward("+B+")");B=B.replaceAll("cfajax=1","");var C=((A!==undefined)&&(ComCore.Configuration.get("debug")===true))?5000:0;setTimeout(function(){window.location=B},C)};Object.extend(ComCore,{AjaxResponse:{loginIsRequired:function(B,A){debug("ComCore.AjaxResponse.loginIsRequired()");if(A&&(A.error==="NOT_LOGGED_IN")&&A.login_url){debug("You're not logged in, matey. I'll forward you to "+A.login_url);ComCore.forward(A.login_url);window.location=A.login_url;throw"You need to be logged in to do this"}}},_eoo:true});Object.extend(ComCore.Page,{assignDefaults:function(C){try{if(typeof (C)==="string"){if(!ComCore.Page.defaults.contextUrl){ComCore.Page.defaults.contextUrl=ComCore.Page.getContextURL()}var B="";for(B in ComCore.Page.defaults){if(typeof B==="string"){C=C.replace("{"+B+"}",ComCore.Page.defaults[B])}}}}catch(A){debug(A)}return C},buildImagePath:function(B){var A=ComCore.Page.str_pad(B,9,0,"STR_PAD_LEFT");return ComCore.Configuration.get("photoStaticURL")+"/p/tt/"+A.substr(0,3)+"/"+A.substr(3,3)+"/"+B+".jpg"},getImagePathId:function(B){var A=B.split("/");return parseInt(A[A.length-1].replace(".jpg",""),10)},str_pad:function(B,G,F,C){var E="",D;var A=function(I,H){return Array(H+1).join(I)};B+="";if(C!=="STR_PAD_LEFT"&&C!=="STR_PAD_RIGHT"&&C!=="STR_PAD_BOTH"){C="STR_PAD_RIGHT"}if((D=G-B.length)>0){if(C==="STR_PAD_LEFT"){B=A(F,D)+B}else{if(C==="STR_PAD_RIGHT"){B=B+A(F,D)}else{if(C==="STR_PAD_BOTH"){E=A(F,Math.ceil(D/2));B=E+B+E;B=B.substr(0,G)}}}}return B},buildAjaxURL:function(D,A,B){var C="";if(B===true){C=""}else{C=ComCore.Page.getContextURL()}C+="/ajax";if(D){C+="/"+D}if(A){C+="/action="+A}return C},_eoo:true});Object.extend(ComCore,{UserAgent:{ie:function(){return this._ie},firefox:function(){return this._firefox},opera:function(){return this._opera},safari:function(){return this._safari},windows:function(){return this._windows},osx:function(){return this._osx},init:function(){var A=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel|Minefield).(\d+\.\d+))|(?:Opera.(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))/.exec(navigator.userAgent);var B=/(Mac OS X;)|(Windows;)/.exec(navigator.userAgent);if(A){ComCore.UserAgent._ie=A[1]?parseFloat(A[1]):NaN;ComCore.UserAgent._firefox=A[2]?parseFloat(A[2]):NaN;ComCore.UserAgent._opera=A[3]?parseFloat(A[3]):NaN;ComCore.UserAgent._safari=A[4]?parseFloat(A[4]):NaN}else{ComCore.UserAgent._ie=ComCore.UserAgent._firefox=ComCore.UserAgent._opera=ComCore.UserAgent._safari=NaN}if(B){ComCore.UserAgent._osx=!!B[1];ComCore.UserAgent._windows=!!B[2]}else{ComCore.UserAgent._osx=ComCore.UserAgent._windows=false}}},_eoo:true});ComCore.UserAgent.init();Prototype.Browser.Chrome=(navigator.userAgent.toLowerCase().indexOf("chrome")>-1);Prototype.Browser.IE6=Prototype.Browser.IE&&(parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5),10)===6);Object.extend(ComCore,{Event:{observedElements:[],observeOnce:function(C,B,A,E,D){if(!ComCore.Event.observedElements[D]){debug("Start observing "+D);Event.observe(C,B,A,E);ComCore.Event.observedElements[D]=true}else{debug("Already observing "+D)}}},_eoo:true});Element.addMethods({getClassData:function(A,C,B){B=Object.extend({glue:"_",isArray:false,toInt:false},B);A=$(A);C=C+B.glue;var D=null;if(B.isArray===true){D=[]}A.classNames().each(function(E){if(E.substr(0,C.length)===C){var F=decodeURIComponent(E.replace(C,""));if(B.toInt){F=parseInt(F,10)}if(B.isArray){D.push(F)}else{D=F}}});return D},setClassData:function(A,C,E,B){B=Object.extend({glue:"_"},B);A=$(A);var D=A.getClassData(C,{glue:B.glue});if(D){D=encodeURIComponent(D);A.removeClassName(C+B.glue+D)}E=encodeURIComponent(E);A.addClassName(C+B.glue+E);return A},_eoo:true});Object.extend(String.prototype,{trim:function(){var A=this.toString();A=A.replace(/^\s+/,"");A=A.replace(/\s+$/,"");return A},wordWrap:function(B,A,H){var E,D,C,F,G=this.split(" ");if(B>0){for(E=-1,C=G.length;++E<C;){for(F=G[E],G[E]="";F.length>B;D=H?B:(D=F.substr(0,B).match(/\S*$/)).input.length-D[0].length||D.input.length+(D=F.substr(B).match(/^\S*/)).input.length+D[0].length,G[E]+=F.substr(0,D)+((F=F.substr(D)).length?A:"")){}G[E]+=F}}return G.join("\n")},pad:function(A,C,B){C=C||" ";if(A<=this.length){return this}var D="";C=C.times(Math.ceil(A/C.length)+1);if(B){D=this+C;D=D.substr(0,A)}else{D=C+this;D=D.substr(D.length-A,A)}return D},replaceAll:function(C,A){var B=this;if(!B||(B===undefined)||(B==="")){return""}return B.replace(new RegExp(C,"g"),A)},ucFirst:function(){return this.substr(0,1).toUpperCase()+this.substr(1,this.length)},_eoo:true});function addslashes(A){return A.replace(/\'/g,"\\'").replace(/\"/g,'\\"').replace(/\\/g,"\\\\")}function stripslashes(A){return A.replace(/\\'/g,"'").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}ComCore.Quotes={toggle:function(B){var A=B.up(".quote").down(".quoteContents");if(A.visible()){A.hide();B.removeClassName("toggled");B.update("+")}else{A.show();B.addClassName("toggled");B.update("-")}},_eoo:true};ComCore.GlobalScope={counter:1,prefix:"comcoreGlobal",maxTries:10,register:function(C,A){var B=0;if(A){if(window[A]){throw"Couldn't register object with name "+A+" in ComCore.GlobalScope.register()"}}else{do{B=B+1;this.counter=this.counter+1;A=this.prefix+this.counter;if(B>this.maxTries){throw"Couldn't register object in ComCore.GlobalScope.register()"}}while(window[A])}window[A]=C;return A},_eoo:true};var comcorePreviewImage=function(A,B){ComCore.Dialog.initialize();if(B){ComCore.Dialog.options.width=B}ComCore.Dialog.setContent('<center><img src="'+A+'"></center>',true)};var comcorePopupIframe=function(B,D,E,G,F,A){B=B.replace("javascript","x");D=(D<(screen.width-100))?D:(screen.width-100);E=(E<(screen.height-100))?E:(screen.height-100);var C={};if((F)&&(typeof (F)==="function")){C.closeCallBacks=[F]}if(A){C.placeHolderClass=A}if(G===null){G="no"}else{if(G==="yes"){G="yes"}else{if(G==="auto"){G="auto"}else{G="no"}}}ComCore.Dialog.initialize(C);ComCore.Dialog.options.width=D;ComCore.Dialog.setContent('<iframe src="'+B+'" scrolling="'+G+'" frameborder="0" style="width: '+D+"px; height: "+E+'px; margin: auto; margin-bottom: 20px;"></iframe>',true)};var comcoreOverlayerStart=function(F,C,E,A){if(document.getElementById("overlayerWrapperIframe")){return false}var B=document.createElement("iframe");var D=document.viewport.getDimensions();windowWidth=D.width;windowHeight=D.height;spaceRight=spaceLeft=(windowWidth/2)-(C/2);spaceTop=((windowHeight/2)-(E/2));B.id="overlayerWrapperIframe";B.src=ComCore.Configuration.get("rootURL")+"/sales/view=showmovie&width="+C+"&height="+E+"&windowheight="+windowHeight+"&windowwidth="+windowWidth+"&movieurl="+F;B.setAttribute("frameborder","0");B.setAttribute("scrolling","no");B.cssText="top: 0px; left: 0px; z-index: 100000; position: absolute; width: 100%; height: 100%; background-color: "+(A===undefined)?"#000":A;document.body.appendChild(B)};var comcoreOverlayerClose=function(A){overlayerWrapperIframe=document.getElementById("overlayerWrapperIframe");if(overlayerWrapperIframe){if(A===true){window.location=ComCore.Configuration.get("rootURL")+"/"+(ComCore.pageLoaded?ComCore.Login.getNickname():document.getElementById("userNickname").innerHTML)}else{document.body.removeChild(overlayerWrapperIframe)}}};var comcoreSetProfileBackground=function(B,C,H,E){var D=["backgroundImage","backgroundColor","backgroundImage","backgroundImage"];if(ComCore.Page.pageSection.substring(0,7)!=="profile"){return false}var G=document.getElementById("content");for(var F=0,A=arguments.length;F<A;F++){G.style[D[F]]=(F>0)?arguments[F]:"url('"+arguments[F]+"')"}};var comcoreGetPageIdentifier=function(){return ComCore.Page.pageIdentifier};var comcoreGetProfileBackground=function(A){if(ComCore.Page.pageSection.substring(0,7)!=="profile"){return false}return document.getElementById("content").style[A]};ComCore.Queuer.add(function(A){Ajax.Responders.register({onComplete:function(C,B,D){if(B.status===403){ComCore.CSRF.onInvalidToken(C,B)}if(B.getHeader("X-CSRF-TOKEN")){ComCore.CSRF.setToken(B.getHeader("X-CSRF-ACTION"),B.getHeader("X-CSRF-TOKEN"))}}})});ComCore.Queuer.add(function(A){$(document.body).removeClassName("noJS").addClassName("yesJS")});document.write=Prototype.emptyFunction;ComCore.FontRenderer=Class.create();ComCore.FontRenderer.prototype={initialize:function(C,H,G,B,F){if(F===undefined){F=false}var D="http://static.fontself.com/swf/FSNetlogPlayer.swf";if((B!==undefined)&&(F===true)){D="http://test.fontself.com.s3.amazonaws.com/6817/swf/FSPlayer.swf";C=B+","+C}var E="fkey="+C+"&amp;size=20&amp;divId=fontswf_"+G+"&amp;text="+escape(H)+"&amp;fontStorageURLOverride=http://test.fontself.com.s3.amazonaws.com";var A=new FlashObject(D,"fontswf_"+G+"","100%",$("originalText_"+G).getHeight(),"9.0.28.0","transparent");A.useExpressInstall(ComCore.Configuration.get("staticURL")+"//s/f/expressinstall.swf");A.addParam("play","true");A.addParam("loop","false");A.addParam("quality","best");if(F===true){A.addParam("base","http://test.fontself.com.s3.amazonaws.com/6817/swf/")}A.addParam("wmode","transparent");A.addParam("menu","false");A.addParam("allowFullScreen","false");A.addParam("allowScriptAccess","always");A.addParam("FlashVars",E);A.write("originalText_"+G)}};function setFlashHeight(A){$(A.id).setStyle({height:Math.round(A.h)+"px"})}if(!ComCore.Profile){ComCore.Profile=[]}Object.extend(ComCore.Profile,{getUserID:function(){return ComCore.Profile._u},getUrl:function(){if(!ComCore.Profile.getNickname()){return undefined}var A="/"+ComCore.Profile.getNickname();if(ComCore.Profile.getNamespace()){A="/"+ComCore.Profile.getNamespace()+A}return A},getNamespace:function(){return ComCore.Profile._ns},getNickname:function(){return ComCore.Profile._n},_eoo:true});ComCore.Credits={sessions:[],requestCreditsRequester:{},requestCreditsOptions:{},requestCreditsTest:function(){ComCore.Credits.requestCredits(4,{type:"APP",ID:137},{reason:"Pieter wil een bloemetje voor zijn vriendin",onAccept:function(A){debug("onAccept callback");debug(A)},onDeny:function(A){debug("onDeny callback");debug(A)},onFailure:function(A){debug("onFailure callback");debug(A)}})},requestCredits:function(A,E,C){debug("ComCore.Credits.requestCredits("+A+", ...)");ComCore.Credits.requestCreditsRequester=Object.extend({type:null,ID:0},E);debug(ComCore.Credits.requestCreditsRequester);ComCore.Credits.requestCreditsOptions=Object.extend({onAccept:function(G){debug("default onAccept callback");debug(G)},onDeny:function(G){debug("default onDeny callback");debug(G)},onFailure:function(G){debug("default onFailure callback");debug(G)},reason:"",custom:{}},C);debug("TEST");debug(ComCore.Credits.requestCreditsOptions);A=parseInt(A,10);ComCore.Credits.requestCreditsRequester.ID=parseInt(ComCore.Credits.requestCreditsRequester.ID,10);if(!A||A<=0){ComCore.Credits.onRequestCreditsFailure({error:"INVALID_AMOUNT",amount:A});return false}if((ComCore.Credits.requestCreditsRequester.type!="APP"&&ComCore.Credits.requestCreditsRequester.type!="PREMIUM")||(ComCore.Credits.requestCreditsRequester.ID<=0)){ComCore.Credits.onRequestCreditsFailure({error:"INVALID_REQUESTER",requester:ComCore.Credits.requestCreditsRequester});return false}var B={action:"requestCredits",requestedAmount:A};if(ComCore.Credits.requestCreditsOptions.reason){B.requestReason=ComCore.Credits.requestCreditsOptions.reason}if(ComCore.Credits.requestCreditsOptions.custom){B.requestCustom=encodeURIComponent(Object.toJSON(ComCore.Credits.requestCreditsOptions.custom))}if(ComCore.Credits.requestCreditsRequester.type){B.requesterType=ComCore.Credits.requestCreditsRequester.type}if(ComCore.Credits.requestCreditsRequester.ID){B.requesterID=ComCore.Credits.requestCreditsRequester.ID}debug(B);var F=ComCore.Page.getContextURL()+"/settings/credits/view=request";if(ComCore.Credits.requestCreditsRequester.type=="APP"){F="/profile/settings/credits/view=request"}var D=function(G){debug("exitCallBack");debug(G);if(G&&(G.requestResult===true)&&(G.requester.type===ComCore.Credits.requestCreditsRequester.type)&&(G.requester.ID===ComCore.Credits.requestCreditsRequester.ID)&&(G.requestedAmount===A)&&(G.token)){ComCore.Credits.onRequestCreditsAccept(G)}else{if(G&&(G.requestResult==="REQUEST_DENIED")&&(G.requester.type===ComCore.Credits.requestCreditsRequester.type)&&(G.requester.ID===ComCore.Credits.requestCreditsRequester.ID)&&(G.requestedAmount===A)&&(G.token)){ComCore.Credits.onRequestCreditsDeny(G)}else{if(G){ComCore.Credits.onRequestCreditsFailure({error:"REQUEST_FAILED",details:G})}else{ComCore.Credits.onRequestCreditsFailure({error:"REQUEST_CANCELLED"})}}}};if(E.type=="APP"&&E.ID=="326"){ComCore.Dialog.initialize({noHidingIframes:true})}else{ComCore.Dialog.initialize()}ComCore.Dialog.options.width=645;ComCore.Dialog.registerExitCallBack(D);ComCore.Dialog.registerCloseCallBack(D);ComCore.Dialog.postContent(F,B)},_executeRequestCallBack:function(A,C){debug(C);try{if(ComCore.Credits.requestCreditsOptions[A]){ComCore.Credits.requestCreditsOptions[A](C)}}catch(B){debug(B)}},onRequestCreditsAccept:function(A){debug("ComCore.Credits.onRequestCreditsAccept()");ComCore.Credits._executeRequestCallBack("onAccept",A)},onRequestCreditsDeny:function(A){debug("ComCore.Credits.onRequestCreditsDeny()");ComCore.Credits._executeRequestCallBack("onDeny",A)},onRequestCreditsFailure:function(A){debug("ComCore.Credits.onRequestCreditsFailure()");ComCore.Credits._executeRequestCallBack("onFailure",A)},_eoo:true};ComCore.Payment={sessions:[],requestPaymentRequester:{},requestPaymentOptions:{},requestPayment:function(A,E,C){console.log("ComCore.Payment.requestPayment("+A+", ...)");ComCore.Payment.requestPaymentRequester=Object.extend({type:null,ID:0},E);console.log(ComCore.Payment.requestPaymentRequester);ComCore.Payment.requestPaymentOptions=Object.extend({onAccept:function(G){console.log("default onAccept callback");console.log(G)},onDeny:function(G){console.log("default onDeny callback");console.log(G)},onFailure:function(G){console.log("default onFailure callback");console.log(G)},reason:"",custom:{}},C);console.log(ComCore.Payment.requestPaymentOptions);A=parseInt(A,10);ComCore.Payment.requestPaymentRequester.ID=parseInt(ComCore.Payment.requestPaymentRequester.ID,10);if(!A){ComCore.Payment.onRequestPaymentFailure({error:"INVALID_ITEMID",itemid:A});return false}if((ComCore.Payment.requestPaymentRequester.type!="APP"&&ComCore.Payment.requestPaymentRequester.type!="PREMIUM")||(ComCore.Payment.requestPaymentRequester.ID<=0)){ComCore.Payment.onRequestPaymentFailure({error:"INVALID_REQUESTER",requester:ComCore.Payment.requestPaymentRequester});return false}var B={action:"requestPayment",requesterItemID:A};if(ComCore.Payment.requestPaymentOptions.reason){B.requestReason=ComCore.Payment.requestPaymentOptions.reason}if(ComCore.Payment.requestPaymentOptions.custom){B.requestCustom=encodeURIComponent(Object.toJSON(ComCore.Payment.requestPaymentOptions.custom))}if(ComCore.Payment.requestPaymentRequester.type){B.requesterType=ComCore.Payment.requestPaymentRequester.type}if(ComCore.Payment.requestPaymentRequester.ID){B.requesterID=ComCore.Payment.requestPaymentRequester.ID}var F=ComCore.Page.getContextURL()+"/settings/credits/view=paymentrequest";if(ComCore.Payment.requestPaymentRequester.type=="APP"){F="/profile/settings/credits/view=paymentrequest"}var D=function(G){console.log("exitCallBack");console.log(G);if(G&&(G.requestResult===true)&&(G.requester.type===ComCore.Payment.requestPaymentRequester.type)&&(G.requester.ID===ComCore.Payment.requestPaymentRequester.ID)&&(G.requesterItemID===A)&&(G.token)){ComCore.Payment.onRequestPaymentAccept(G)}else{if(G&&(G.requestResult==="REQUEST_DENIED")&&(G.requester.type===ComCore.Payment.requestPaymentRequester.type)&&(G.requester.ID===ComCore.Payment.requestPaymentRequester.ID)&&(G.requesterItemID===A)&&(G.token)){ComCore.Payment.onRequestPaymentDeny(G)}else{if(G){ComCore.Payment.onRequestPaymentFailure({error:"REQUEST_FAILED",details:G})}else{ComCore.Payment.onRequestPaymentFailure({error:"REQUEST_CANCELLED"})}}}};if(E.type=="APP"&&E.ID=="326"){ComCore.Dialog.initialize({noHidingIframes:true})}else{ComCore.Dialog.initialize()}ComCore.Dialog.options.width=645;ComCore.Dialog.registerExitCallBack(D);ComCore.Dialog.registerCloseCallBack(D);console.log(B);ComCore.Dialog.postContent(F,B)},_executeRequestCallBack:function(A,C){console.log(C);try{if(ComCore.Payment.requestPaymentOptions[A]){ComCore.Payment.requestPaymentOptions[A](C)}}catch(B){console.log(B)}},onRequestPaymentAccept:function(A){console.log("ComCore.Payment.onRequestPaymentAccept()");ComCore.Payment._executeRequestCallBack("onAccept",A)},onRequestPaymentDeny:function(A){console.log("ComCore.Payment.onRequestPaymentDeny()");ComCore.Payment._executeRequestCallBack("onDeny",A)},onRequestPaymentFailure:function(A){console.log("ComCore.Payment.onRequestPaymentFailure()");ComCore.Payment._executeRequestCallBack("onFailure",A)},_eoo:true};Object.extend(ComCore,{CookieManager:{getCookie:function(B){var E=B+"=";var D=document.cookie.split(";");for(var C=0;C<D.length;C++){var A=D[C];while(A.charAt(0)===" "){A=A.substring(1,A.length)}if(A.indexOf(E)===0){return A.substring(E.length,A.length)}}return""},setCookie:function(A,B){ComCore.CookieManager.setCookieWithDate(A,B,30)},setCookieWithDate:function(B,D,E){var A;var C;if(D!==""){A=new Date();A.setDate(A.getDate()+E);C=A.toGMTString()}else{E=-1;A=new Date();A.setTime(A.getTime()+(E*24*60*60*1000));C=A.toGMTString()}document.cookie=B+"="+D+"; expires="+C+"; path=/"},deleteCookie:function(A){if(ComCore.CookieManager.getCookie(A)!==""){document.cookie=A+"=; expires="+1+"; path=/"}}}});ComCore.TemplateExtensions=Class.create();ComCore.TemplateExtensions.prototype={initialize:function(){},formattext:function(D,B,A){var C=D;C=this.ellips(C,A);return C},wordwrap:function(B,A){return B.wordWrap(A,"- ",true)},ellips:function(B,A){if(A<B.length){return B.substring(0,A)+"&hellip;"}else{return B}},imagepath:function(A){if(A===""){A=0}photoidstr=""+A;photoidstr=photoidstr.pad(9,"0",0);return photoidstr.substring(0,3)+"/"+photoidstr.substring(3,6)+"/"+A},dateformat:function(B,E){if(E==="webChatSystemMessage"){var A=""+B.getHours();var C=""+B.getMinutes();var D=""+B.getSeconds();B=A.pad(2,"0",0)+":"+C.pad(2,"0",0)+":"+D.pad(2,"0",0);return B}else{if(E==="webChat"){return B.substring(11)}else{return B}}}};Object.extend(ComCore,{Language:{data:{},isLoaded:false,load:function(){if(ComCore.Language.isLoaded){return true}debug("I will load the language variables now");ComCore.Language.isLoaded=true},get:function(B,C,A){var D="";if(A){if(!ComCore.Language.data[B]){ComCore.Debug.error("Unknown language variable: ComCore.Language.data["+B+"]");D=""}else{if(!ComCore.Language.data[B][C]){ComCore.Debug.error("Unknown language variable: ComCore.Language.data["+B+"]["+C+"]");D=""}else{if(!ComCore.Language.data[B][C][A]){ComCore.Debug.error("Unknown language variable: ComCore.Language.data["+B+"]["+C+"]["+A+"]");D=""}else{D=ComCore.Language.data[B][C][A]}}}}else{if(C){if(!ComCore.Language.data[B]){ComCore.Debug.error("Unknown language variable: ComCore.Language.data["+B+"]");D=""}else{if(!ComCore.Language.data[B][C]){ComCore.Debug.error("Unknown language variable: ComCore.Language.data["+B+"]["+C+"]");D=""}else{D=ComCore.Language.data[B][C]}}}else{if(!ComCore.Language.data[B]){ComCore.Debug.warning("Unknown language variable: language["+B+"]");D=""}else{D=ComCore.Language.data[B]}}}D=ComCore.Page.assignDefaults(D);return D}}});ComCore.TextArea=Class.create();ComCore.TextArea.prototype={onChangeTimeoutLength:500,element:false,onChangeTimeout:false,initialize:function(A){this.element=$(A);$(this.element).observe("keyup",this.doOnChange.bindAsEventListener(this));$(this.element).observe("paste",this.doOnChange.bindAsEventListener(this));$(this.element).observe("input",this.doOnChange.bindAsEventListener(this));if(!!document.selection){$(this.element).observe("mouseup",this.saveRange.bindAsEventListener(this));$(this.element).observe("keyup",this.saveRange.bindAsEventListener(this))}},doOnChange:function(A){if(this.onChangeTimeout){window.clearTimeout(this.onChangeTimeout)}this.onChangeTimeout=window.setTimeout(function(){if(this.notify){this.notify("change",this.getValue())}}.bind(this),this.onChangeTimeoutLength)},saveRange:function(){this.range=document.selection.createRange()},getValue:function(){return this.element.value},getSelection:function(){if(!!document.selection){return document.selection.createRange().text}else{if(!!this.element.setSelectionRange){return this.element.value.substring(this.element.selectionStart,this.element.selectionEnd)}else{return false}}},replaceSelection:function(D){var B=this.element.scrollTop;if(!!document.selection){this.element.focus();var A=(this.range)?this.range:document.selection.createRange();A.text=D;A.select()}else{if(!!this.element.setSelectionRange){var C=this.element.selectionStart;this.element.value=this.element.value.substring(0,C)+D+this.element.value.substring(this.element.selectionEnd);this.element.setSelectionRange(C+D.length,C+D.length)}}this.doOnChange();this.element.focus();this.element.scrollTop=B},wrapSelection:function(A,B){this.replaceSelection(A+this.getSelection()+B)},insertBeforeSelection:function(A){this.replaceSelection(A+this.getSelection())},insertAfterSelection:function(A){this.replaceSelection(this.getSelection()+A)},injectEachSelectedLine:function(B,A,C){this.replaceSelection((A||"")+$A(this.getSelection().split("\n")).inject([],B).join("\n")+(C||""))},insertBeforeEachSelectedLine:function(C,A,B){this.injectEachSelectedLine(function(E,D){E.push(C+D);return E},A,B)}};Object.extend(ComCore,{FileLoader:{loadingFiles:[],loadedFiles:[],callBacks:{},include_once:function(A){if(ComCore.FileLoader.loadedFiles[A]){ComCore.FileLoader.fileLoaded(A);return false}else{return ComCore.FileLoader.include(A)}},registerCallBack:function(A,B){if(!ComCore.FileLoader.callBacks[A]){ComCore.FileLoader.callBacks[A]=[]}ComCore.FileLoader.callBacks[A].push(B);if(ComCore.FileLoader.loadedFiles[A]){this.executeCallBacks(A)}},executeCallBacks:function(A){if(ComCore.FileLoader.callBacks[A] instanceof Array){ComCore.FileLoader.callBacks[A].each(function(C){try{C()}catch(B){}})}},fileLoaded:function(A){this.executeCallBacks(A);ComCore.FileLoader.loadedFiles[A]=true;ComCore.FileLoader.callBacks[A]=false},include:function(D,A){try{var G=ComCore.Configuration.get("staticURL")+D;var C=document.getElementsByTagName("head").item(0);var F=document.createElement("script");F.setAttribute("language","javascript");F.setAttribute("type","text/javascript");F.setAttribute("src",G);var E=C.appendChild(F);ComCore.FileLoader.loadingFiles[D]=true;return true}catch(B){debug("include "+D+" failed");debug(B)}}}});ComCore.LoadingIndicator={options:{minLoadingTime:2000,updateMessageTime:10000},elementWrapper:false,elementWrapperName:"comCoreLoadingIndicatorWrapper",elementName:"comCoreLoadingIndicator",cancelShow:false,queued:false,_isShown:false,_show:function(){ComCore.LoadingIndicator._updateMessage(ComCore.Language.get("loading"));ComCore.LoadingIndicator.elementWrapper.show();ComCore.LoadingIndicator._isShown=true;if(ComCore.ActionStateMessage){ComCore.ActionStateMessage.hide()}if(ComCore.Language.get("stillLoading")){setTimeout(function(){if(ComCore.LoadingIndicator._isShown===true){ComCore.LoadingIndicator._updateMessage(ComCore.Language.get("stillLoading"))}},ComCore.LoadingIndicator.options.updateMessageTime)}},_updateMessage:function(A){if(!ComCore.LoadingIndicator.span){ComCore.LoadingIndicator.span=ComCore.LoadingIndicator.elementWrapper.down("div.text")}ComCore.LoadingIndicator.span.update(A)},_hide:function(){ComCore.LoadingIndicator.elementWrapper.hide();ComCore.LoadingIndicator._isShown=false},show:function(A){debug("ComCore.LoadingIndicator.show()");if(!ComCore.LoadingIndicator.elementWrapper){ComCore.LoadingIndicator.createElement()}if(A===true||(ComCore.LoadingIndicator.options.minLoadingTime<=0)){if((ComCore.LoadingIndicator.options.minLoadingTime>0)&&ComCore.LoadingIndicator.cancelShow){debug("ComCore.LoadingIndicator.show() cancelled")}else{ComCore.LoadingIndicator._show()}}else{if(!ComCore.LoadingIndicator.queued){setTimeout(function(){ComCore.LoadingIndicator.show(true);ComCore.LoadingIndicator.queued=false},ComCore.LoadingIndicator.options.minLoadingTime);ComCore.LoadingIndicator.queued=true}}ComCore.LoadingIndicator.cancelShow=false},hide:function(){debug("ComCore.LoadingIndicator.hide()");if(!ComCore.LoadingIndicator.elementWrapper){ComCore.LoadingIndicator.createElement()}ComCore.LoadingIndicator.cancelShow=true;ComCore.LoadingIndicator._hide()},createElement:function(){debug("ComCore.LoadingIndicator.createElement()");ComCore.LoadingIndicator.elementWrapper=$(ComCore.LoadingIndicator.elementWrapperName)},_eoo:true};if(typeof (ComCore)==="undefined"){ComCore={}}ComCore._History=Class.create();(function(){ComCore._History.useIframe=(Prototype.Browser.IE)?parseFloat(navigator.appVersion.split("MSIE ")[1])<8:false})();ComCore._History.prototype={iframeElement:null,initialize:function(){this.hashCollection=[];if(ComCore._History.useIframe===true){var A=window.location.host.split(".");this.domainName=A[A.length-2]+"."+A[A.length-1];this._createIframe()}this.historyObserver=new ComCore.HistoryObserver(this);this.historyObserver.observe("onHistoryChanged",this.onHistoryChanged.bind(this))},onHistoryChanged:function(A){if(Prototype.Browser.IE){this.setHashOnIframe()}debug("history changed");this.notify("onChange",this.historyObserver.getHash())},set:function(A){debug("ComCore.History.set");this.hashCollection.push(A);this.historyObserver.sleep();window.location.hash=A;this.historyObserver.syncHash();this.historyObserver.wakeup();if(Prototype.Browser.IE){this.setHashOnIframe()}},_createIframe:function(){if(this.iframeElement===null){var A;if(ComCore.Configuration.get("chatBar","enabled")&&this.domainName){A="javascript:document.write('<head><script>document.domain = \""+this.domainName+"\";<\/script></head><body></body>');document.close();"}else{A="javascript:document.write('<head></head><body></body>');document.close();"}document.body.onload=(function(){this.iframeElement=new Element("iframe",{name:"historyframe",id:"historyframe",width:"0",height:"0",src:A,style:{display:"none"}});document.body.appendChild(this.iframeElement);var B=$("historyframe");window.setTimeout((function(){this.setHashOnIframe()}).bind(this),1000);B.onload=(function(){this.setHashOnIframe()}).bind(this)}).bind(this)}},iframeToParent:function(B){var A=false;this.hashCollection.push(B);this.historyObserver.sleep();if(B!==window.location.hash.substring(1)){A=true}window.location.hash=B;this.historyObserver.syncHash();this.historyObserver.wakeup();if(A===true){this.notify("onChange",B)}},setHashOnIframe:function(){if(this.iframeElement===null){return false}var D=window.location.hash.substring(1)||"";try{if(D.length>0){var B;if(ComCore.Configuration.get("chatBar","enabled")&&this.domainName){B='<html><head><script type="text/javascript">document.domain="'+this.domainName+'"; parent.ComCore.History.iframeToParent("'+D+'");<\/script></head><body></body></html>'}else{B='<html><head><script type="text/javascript">parent.ComCore.History.iframeToParent("'+D+'");<\/script></head><body></body></html>'}var C=this.iframeElement.contentWindow.document;C.open("javascript:'<html></html>'");C.write(B);C.close()}}catch(A){debug("Error setting hash on iframe: "+A)}},_eoo:true};ComCore.Events.extend(ComCore._History);var historyObserverSleep=false;var historyObserverHash=window.location.hash.substring(1);function historyObserverCheck(){if(historyObserverSleep===false&&historyObserverHash!==window.location.hash.substring(1)){historyObserverHash=window.location.hash.substring(1);ComCore.History.historyObserver.notify("onHistoryChanged",this.hash)}}ComCore.HistoryObserver=Class.create();ComCore.HistoryObserver.prototype={isSleeping:false,delay:0.2,timer:null,started:false,initialize:function(A){debug("HistoryObserver is now observing");this.historyController=A;this.hash=this.getHash();if(window.onhashchange){window.onhashchange=(function(){this.notify("onHistoryChanged",this.getHash())}).bind(this)}else{window.setInterval("historyObserverCheck()",this.delay)}},sleep:function(){historyObserverSleep=true},wakeup:function(){historyObserverSleep=false},syncHash:function(){historyObserverHash=window.location.hash.substring(1)},getHash:function(){return window.location.hash.substring(1)},stop:function(){if(this.started===false){return }this.timer.stop();this.started=false},_eoo:true};ComCore.Events.extend(ComCore.HistoryObserver);ComCore.History=new ComCore._History();ComCore.NetworkErrorIndicator={options:{minLoadingTime:600,updateMessageTime:10000},cancelShow:false,queued:false,_isShown:false,timeoutID:false,_show:function(A){ComCore.ActionStateMessage.show("loading",ComCore.Language.get("networkSlow"),{sticky:true});ComCore.NetworkErrorIndicator._isShown=true;if(ComCore.Language.get("networkError")){ComCore.NetworkErrorIndicator.timeoutID=setTimeout(function(){if(ComCore.NetworkErrorIndicator._isShown===true){ComCore.ActionStateMessage.show("error",ComCore.Language.get("networkError"),{sticky:true});if(A){try{A()}catch(B){debug(B)}}}},ComCore.NetworkErrorIndicator.options.updateMessageTime)}},_hide:function(){ComCore.ActionStateMessage.hide();ComCore.NetworkErrorIndicator._isShown=false},show:function(A,B){debug("ComCore.NetworkErrorIndicator.show()");ComCore.NetworkErrorIndicator.cancelShow=false;if(A===true||(ComCore.NetworkErrorIndicator.options.minLoadingTime<=0)){if((ComCore.NetworkErrorIndicator.options.minLoadingTime>0)&&ComCore.NetworkErrorIndicator.cancelShow){debug("ComCore.NetworkErrorIndicator.show() cancelled")}else{ComCore.NetworkErrorIndicator._show(B)}}else{if(!ComCore.NetworkErrorIndicator.queued){setTimeout(function(){ComCore.NetworkErrorIndicator.show(true,B);ComCore.NetworkErrorIndicator.queued=false},ComCore.NetworkErrorIndicator.options.minLoadingTime);ComCore.NetworkErrorIndicator.queued=true}}ComCore.NetworkErrorIndicator.cancelShow=false},hide:function(){debug("ComCore.NetworkErrorIndicator.hide()");ComCore.NetworkErrorIndicator.clearTimeout();ComCore.NetworkErrorIndicator.cancelShow=true;ComCore.NetworkErrorIndicator._hide()},clearTimeout:function(){if(ComCore.NetworkErrorIndicator.timeoutID){debug("clearing networkerrorindicator timeout");window.clearTimeout(ComCore.NetworkErrorIndicator.timeoutID)}},_eoo:true};ComCore.AjaxLinksProxy=Class.create();ComCore.AjaxLinksProxy.prototype={hash:"",openRequests:[],initialize:function(A){this.config=Object.extend({ajaxLinkClass:"ajaxLink",loadingClass:"loading",selectedClass:"selected",showTimeoutIndicator:true,killOpenRequests:true,timeout:5000,failureTimeout:10000,proxyParamName:"jproxy"},A);this.contentWrapper=$(this.config.contentWrapper);this.bootloader=ComCore.BootLoader},registerLoadingStartCallback:function(A){this.loadingStart=A},registerLoadingEndCallback:function(A){this.loadingEnd=A},flagLoadingStart:function(){if(Object.isFunction(this.loadingStart)){this.loadingStart()}},flagLoadingEnd:function(A){if(Object.isFunction(this.loadingEnd)){this.loadingEnd(A)}},executeProxy:function(D,A,H,G,F){A=this.getAndSetURL(A,G,F);this.flagLoadingStart();H.addClassName("loading");if(D){this.setLoadingClass(D)}try{var C=this;var B=new Ajax.Request(A,{method:"get",onCreate:function(J){window.notify("onAjaxPageLoadCreating",J);if(C.config.killOpenRequests){for(var I=0;I<C.openRequests.length;I++){C.abortRequest(C.openRequests[I])}C.openRequests=[J]}},onLoading:function(I){window.notify("onAjaxPageLoadLoading",I);if(C.config.showTimeoutIndicator){I.timeoutID=window.setTimeout(function(){if(C.ajaxInProgress(I.transport)){C.showTimeoutMessage(I)}},C.config.timeout)}},onSuccess:function(J){window.notify("onAjaxPageLoadSucces",J);if(J.status>0){ComCore.NetworkErrorIndicator.hide();if(D){C.clearLoadingClasses(D)}var I=J.responseJSON;if(!I){try{I=J.responseText.evalJSON()}catch(L){window.notify("onAjaxPageLoadFailure",J);C.showFailureMessage(ComCore.Language.get("ajaxResponseError"),J)}}else{if(I){if(D){C.clearSelectedClasses(D);C.clearLoadingClasses(D)}if(I.payload){if(C.bootloader.load(I,C.config,H)){window.notify("onAjaxPageLoad",I)}C.syncNavigation(I.bootload.module,I.bootload.submodule);if(D){C.setSelectedClass(D)}if(C.hash!==""){var K=$(C.hash);if(K){K.scrollTo()}}}else{window.location=A}}}}},onFailure:function(I){window.notify("onAjaxPageLoadFailure",I);C.showFailureMessage("Ajax request failed",I);if(D){this.clearLoadingClasses(D)}},onComplete:function(I){window.notify("onAjaxPageLoadComplete",I);C.openRequests=C.openRequests.without(I);if(C.config.showTimeoutIndicator){window.clearTimeout(I.timeoutID)}C.flagLoadingEnd(I)}})}catch(E){window.location=A}},syncNavigation:function(B,C){if(B){var E=$("pageManageBar");if(E){var A=E.down("li.module_"+B);var F=A.down("ul");if(F){E.select("ul").invoke("removeClassName","selected");E.select("li").invoke("removeClassName","selected");E.select("ul").invoke("hide");F.show();var D;if(F){D=F.down("li.submodule_"+C);if(D){D.addClassName("selected")}}else{A.addClassName("selected")}}else{A.addClassName("selected")}}}},getAndSetURL:function(B,F,E){var D;var C=B.indexOf("#");this.hash="";if(parseInt(C,10)>-1){D=B.substring(C+1,B.length);this.hash=D;B=B.substring(0,C)}var A="";if(!B.endsWith("/")&&!B.include("=")){B=B+"/"}else{A="&";B=B}if(B.substring(0,1)!=="/"){B="/"+B}if(!F){F=1}B=B+A+this.config.proxyParamName+"="+F;if(!E){ComCore.History.set(B)}return B},showFailureMessage:function(B,A){ComCore.ActionStateMessage.show("error",B)},showTimeoutMessage:function(B){var A=this;if(B.transport&&B.transport.readyState===0){ComCore.NetworkErrorIndicator.hide()}else{ComCore.LoadingIndicator.hide();ComCore.NetworkErrorIndicator.options.updateMessageTime=this.config.failureTimeout;ComCore.NetworkErrorIndicator.show(true,function(){A.abortRequest(B)})}},abortRequest:function(A){this.aborted=A;A.transport.abort()},ajaxInProgress:function(A){switch(A.readyState){case 1:case 2:case 3:return true;default:return false}},clearTimeout:function(A){window.clearTimeout(A.timeoutID)},setSelectedClass:function(B){B.addClassName(this.config.selectedClass);var A=B.up();if(A){A.addClassName(this.config.selectedClass)}},clearSelectedClasses:function(A){this.clearClasses(A,this.config.selectedClass)},setLoadingClass:function(B){this.clearLoadingClasses(B);B.addClassName(this.config.loadingClass);var A=B.up();if(A){A.addClassName(this.config.loadingClass)}},clearLoadingClasses:function(A){this.clearClasses(A,this.config.loadingClass)},clearClasses:function(C,B){var E=C.up("ul#pageManageBar")||C.up("ul#skinUserBarMenu")||C.up("ul.skinTabs")||C.up("ul.tabList")||C.up("ul.navTabs")||C.up("ul#secondaryNav");if(E){var A=E.select("."+B);var D=this;A.each(function(H){var G=(H.tagName==="A")?H:H.down("a");if(G&&G.hasClassName(D.config.ajaxLinkClass)){G.removeClassName(B);var F=G.up();if(F){F.removeClassName(B)}}})}},_eoo:true};ComCore.Events.extend(window);ComCore.AjaxLinksObserver=Class.create();ComCore.AjaxLinksObserver.prototype={wrapperName:"ajaxWrapper",levelName:"level",ajaxLinksProxy:null,wrapper:null,wrapperLevel:0,initialize:function(A){if(!this.enabled()){return false}this.config=Object.extend({ajaxLinksClass:"ajaxLink"},A);this.ajaxLinksProxy=new ComCore.AjaxLinksProxy(A);this.ajaxLinksProxy.registerLoadingStartCallback(this.onLoadingStartedHandler.bind(this));this.ajaxLinksProxy.registerLoadingEndCallback(this.onLoadingEndedHandler.bind(this));this.observeLinks();this.observeKeyPresses();window.observe("onAjaxPageLoadFailure",this.stopLoadingIndication);ComCore.History.observe("onChange",this.onHistoryChanged.bind(this))},enabled:function(){var A=ComCore.Configuration.get("clicktale");var B=ComCore.CookieManager.getCookie("debugNoAjaxLinks");return(B!=="NO")&&!A},onHistoryChanged:function(C){if(C.trim()!==""){var B=C.split("/");var E=B.last().toQueryParams();debug(E);if(E.timestamp){delete E.timestamp}if(E.jproxy){var F=E.jproxy;var D=Object.toQueryString(E);delete E.jproxy;B[B.length-1]=D;var A=B.join("/");this.setLevelAndWrapper(F,null,A);this.ajaxLinksProxy.executeProxy(null,A,this.wrapper,F,true)}}else{window.location+=""}},stopLoadingIndication:function(){ComCore.LoadingIndicator.hide();$$("body .ajaxWrapper").invoke("removeClassName","loading")},observeLinks:function(){var A=this;ComCore.Queuer.add(function(){$(document).observe("click",A.onAjaxLinkClicked.bind(A))})},observeKeyPresses:function(){var A=this;ComCore.Queuer.add(function(){$(document).observe("keydown",A.onDocumentKeyDown.bind(A));$(document).observe("keyup",A.onDocumentKeyUp.bind(A))})},resetKeyPresses:function(){this.metaKeyPressed=false;this.ctrlKeyPressed=false;this.altKeyPressed=false;this.shiftKeyPressed=false},onDocumentKeyDown:function(A){if(A.metaKey){debug("metaKey pressed");this.metaKeyPressed=true}else{if(A.ctrlKey){debug("ctrlKey pressed");this.ctrlKeyPressed=true}else{if(A.altKey){debug("altKey pressed");this.altKeyPressed=true}else{if(A.shiftKey){debug("shiftKey pressed");this.shiftKeyPressed=true}}}}},onDocumentKeyUp:function(A){this.resetKeyPresses()},onAjaxLinkClicked:function(D){if(!Prototype.Browser.IE&&!Event.isLeftClick(D)||this.metaKeyPressed||this.shiftKeyPressed){return false}var C=D.findElement("a."+this.config.ajaxLinksClass);if(C){this.stopLoadingIndication();var A=C.getAttribute("href");if(A.match(/http:\/\//i)!==null){var E=A.split("/");delete E[0];delete E[1];delete E[2];A="/"+$A(E).compact().join("/")}var G=C.getClassData("level");if(G==="up"){G=C.up("."+this.wrapperName).getClassData("level");debug("wrapper up: "+G)}else{if(G==="down"){var B=C.up("."+this.wrapperName).select("."+this.wrapperName).first();if(B){G=B.getClassData("level")}else{C.up("."+this.wrapperName).getClassName("level")}debug("wrapper down: "+G)}}if(A){debug(G+" "+C+" "+A);var F=this.setLevelAndWrapper(G,C,A);this.ajaxLinksProxy.executeProxy(C,A,this.wrapper,this.level);D.stop()}}},setLevelAndWrapper:function(C,B,A){if(C){debug("requested wrapper level "+C);wrapper=$(this.wrapperName+C);if(!wrapper){C=2;wrapper=$(this.wrapperName+C);if(!wrapper){C=1;wrapper=$(this.wrapperName+C);if(!wrapper){window.location=A}}}}else{if(B){wrapper=B.up("."+this.wrapperName)||(window.location=A);C=parseInt(wrapper.getClassData(this.levelName),10)}else{window.location=A}}this.wrapper=wrapper;this.level=C;debug("level "+this.level);debug(this.wrapper);return wrapper},onLoadingStartedHandler:function(A){debug("loading started...");ComCore.LoadingIndicator.show()},onLoadingEndedHandler:function(A){debug("loading ended...");this.stopLoadingIndication()},_eoo:true};if(typeof ajaxLinksObserver==="undefined"){ajaxLinksObserver=new ComCore.AjaxLinksObserver()}ComCore.RegisteredEditors=[];ComCore.RegisteredEditorsObjects=[];ComCore.Editor=Class.create({initialize:function(D){if(D===null){return }ComCore.RegisteredEditors.push(D.id);ComCore.RegisteredEditorsObjects.push(this);this.editor=$(D);this.nonVerbalEditor=this.editor.next();if(!(this.nonVerbalEditor instanceof Element)||!this.nonVerbalEditor.hasClassName("nonVerbalEditor")){this.nonVerbalEditor=null}this.mode=this.editor.readAttribute("mode");this.textarea=this.editor.getElementsByTagName("textarea",D)[0];this.textareaObject=new ComCore.TextArea(this.textarea);this.charsLeft=this.editor.select(".charsUsed").first();this.maxChars=this.editor.getClassData("maxChars");this.smiliesBox=this.editor.select(".smiliesBox").first();this.premiumSmiliesBox=this.editor.select(".premiumSmiliesBox").first();this.previewLink=$(this.editor.select(".previewLink").first());this.previewArea=$(this.editor.select(".previewArea").first());this.tabsList=$(this.editor.next(".editorTabList"));this.fontButton=$(this.editor.select(".embedFontButton").first());var G=this;if(this.nonVerbalEditor instanceof Element){this.nonVerbalInput=this.nonVerbalEditor.down("input");var A=this.nonVerbalEditor.next();if(A instanceof Element&&A.tagName==="A"&&A.hasClassName("useFullEditor")){Event.observe(A,"click",this.showVerbalEditor.bindAsEventListener(this))}A=this.nonVerbalEditor.down("ul");if(A instanceof Element){A.getElementsBySelector("li").each(function(H){$(H).observe("mouseover",G.nonVerbalMouseOver.bindAsEventListener(G));$(H).observe("mouseout",G.nonVerbalMouseOut.bindAsEventListener(G));$(H).observe("click",G.nonVerbalClick.bindAsEventListener(G))})}}this.editor.up("form").observe("submit",this.onSubmit.bindAsEventListener(this));this.str="";if(this.maxChars&&(parseInt(this.maxChars,10)>0)){this.maxLength=parseInt(this.maxChars,10);if(this.charsLeft){this.charsLeft.update(parseInt(this.textarea.value.length,10))}}if(this.smiliesBox){Event.observe(document,"click",function(H){G.smiliesBox.hide()});this.editor.down(".more").observe("click",this.onMoreClicked.bindAsEventListener(this));var C=this.editor.down(".moresuper");if(C){C.observe("click",this.onMoreClicked.bindAsEventListener(this))}var E=this.editor.down(".moregrey");if(E){E.observe("click",this.onMoreClicked.bindAsEventListener(this))}var B=this.editor.select(".smileyList");if(B){B.each(function(H){H.observe("click",this.onSmileyClicked.bindAsEventListener(this))},this)}this.moreSmileysLink=this.editor.down(".moreSmileysLink");this.smileyListContinued=this.editor.down(".smileyListContinued");if(this.smileyListContinued){Event.observe(this.smileyListContinued,"click",this.onSmileyClicked.bindAsEventListener(this),false)}if(this.moreSmileysLink){Event.observe(this.moreSmileysLink,"click",this.onMoreSmileysLinkClicked.bindAsEventListener(this),false)}this.premiumSmileyListContinued=this.editor.down(".premiumSmileyListContinued");if(this.premiumSmileyListContinued){Event.observe(this.premiumSmileyListContinued,"click",this.onSmileyClicked.bindAsEventListener(this),false)}}if(this.premiumSmiliesBox){Event.observe(document,"click",function(H){G.premiumSmiliesBox.hide()})}if(this.fontButton){Event.observe(this.fontButton,"click",this.onFontsButtonClicked.bindAsEventListener(this),false);this.fontsSelectList=this.editor.down("ul.fontList");var F=this.fontsSelectList.down("li.selected a");if(F){this.selectedFont=F.getClassData("fontID")}this.fontsSelectList.observe("click",this.onFontSelected.bindAsEventListener(this))}if(this.previewLink){Event.observe(this.previewLink,"click",this.onPreviewLinkClicked.bindAsEventListener(this),false);Event.observe(this.previewArea,"click",this.onClickPreview.bindAsEventListener(this),false);Event.observe(this.previewArea,"dblclick",this.onDoubleClickPreview.bindAsEventListener(this),false)}Event.observe(this.textarea,"keypress",this.invisibleMaxLength.bindAsEventListener(this),false);if(this.maxLength>0){Event.observe(this.textarea,"keyup",this.checkMaxLength.bindAsEventListener(this),false);Event.observe(this.textarea,"blur",this.checkMaxLength.bindAsEventListener(this),false)}if(this.charsLeft){Event.observe(this.textarea,"keyup",this.updateCounter.bindAsEventListener(this),false);Event.observe(this.textarea,"blur",this.updateCounter.bindAsEventListener(this),false)}this.initToolbar();this.initTabs();if(this.textarea.hasClassName("autogrow")&&!Prototype.Browser.IE){this.initAutogrow()}},generateSmilies:function(F,E,D){if(!E){E="basic"}if(!D.ul){D.ul=$("smilies")}var A;var B=$("smileyListJSON").innerHTML.evalJSON();var C=D.ul;if(typeof (B[E])==="string"){B[E]=B[E].evalJSON()}$H(B[E]).each(function(G){if(typeof (G[1])==="string"){A=this._createSmiley(G,D);C.insert(A)}},this);if(F){F()}},htmlspecialchars_decode:function(A){return A.replace(/&gt;/g,">").replace(/&lt;/g,"<")},_createSmiley:function(C,F){var A=new Element("li");var E=this.htmlspecialchars_decode(C.key);if(F&&F.className){A.addClassName(F.className)}var B=new Element("a",{title:E,href:"#"});var D=new Element("img",{alt:E,src:ComCore.Configuration.get("staticURL")+"/s/i/smilies/"+C.value});B.insert(D);A.insert(B);return A},nonVerbalMouseOver:function(A){A.findElement("li").addClassName("hover")},nonVerbalMouseOut:function(A){A.findElement("li").removeClassName("hover")},nonVerbalClick:function(A){var B;if(A instanceof Event){B=A.findElement("li");this.textarea.value=B.down("input").value}this.nonVerbalEditor.select("li.selected").invoke("removeClassName","selected");if(A instanceof Event){B.addClassName("selected")}},clearTabs:function(){if(this.tabsList){var A=this.tabsList.down("li.nonVerbalSelected");if(A instanceof Element){A.className="nonVerbal"}A=this.tabsList.down("li.verbalSelected");if(A instanceof Element){A.className="verbal"}}},initTabs:function(){if(!(this.nonVerbalEditor instanceof Element&&this.tabsList instanceof Element)){return }var A=this;this.tabsList.observe("click",this.showTab.bindAsEventListener(this))},showVerbalEditor:function(A){Event.stop(A);$(A.element()).remove();this.nonVerbalEditor.blindUp();this.editor.blindDown()},showTab:function(B){var A=B.findElement("li");A=A.tagName==="LI"?A:A.up("LI");if(A.className.substring(A.className.length-8)==="Selected"){Event.stop(B);return }if(A.className==="nonVerbal"&&this.textarea.value!==""){ComCore.Language.load();if(!confirm(ComCore.Language.get("confirmChangeToNonVerbal"))){return }}this.clearTabs();switch(A.className){case"verbal":this.nonVerbalEditor.hide();this.editor.show();break;case"nonVerbal":this.editor.hide();this.nonVerbalEditor.show();break;default:debug("unknown name: "+A.className)}this.textarea.value="";this.nonVerbalClick(null);A.className+="Selected";Event.stop(B)},initToolbar:function(){try{this.boldButton=this.editor.select(".boldButton").first();this.italicButton=this.editor.select(".italicButton").first();this.underlineButton=this.editor.select(".underlineButton").first()}catch(A){}if(this.mode==="full"){this.leftAlignButton=this.editor.select(".leftAlignButton").first();this.centerAlignButton=this.editor.select(".centerAlignButton").first();this.rightAlignButton=this.editor.select(".rightAlignButton").first();this.embedPhotoButton=this.editor.select(".embedPhotoButton").first();this.embedVideoButton=this.editor.select(".embedVideoButton").first();this.nicknameButton=this.editor.select(".nicknameButton").first();this.urlButton=this.editor.select(".urlButton").first();this.quoteButton=this.editor.select(".quoteButton").first()}if(this.boldButton){Event.observe(this.boldButton,"click",function(B){this.showEditor();this.toggleMode("b");Event.stop(B)}.bindAsEventListener(this),false);this.boldButton.show()}if(this.italicButton){Event.observe(this.italicButton,"click",function(B){this.showEditor();this.toggleMode("i");Event.stop(B)}.bindAsEventListener(this),false);this.italicButton.show()}if(this.underlineButton){Event.observe(this.underlineButton,"click",function(B){this.showEditor();this.toggleMode("u");Event.stop(B)}.bindAsEventListener(this),false);this.underlineButton.show()}if(this.leftAlignButton){Event.observe(this.leftAlignButton,"click",function(B){this.showEditor();this.alignSelection("left");Event.stop(B)}.bindAsEventListener(this),false);this.leftAlignButton.show()}if(this.centerAlignButton){Event.observe(this.centerAlignButton,"click",function(B){this.showEditor();this.alignSelection("center");Event.stop(B)}.bindAsEventListener(this),false);this.centerAlignButton.show()}if(this.rightAlignButton){Event.observe(this.rightAlignButton,"click",function(B){this.showEditor();this.alignSelection("right");Event.stop(B)}.bindAsEventListener(this),false);this.rightAlignButton.show()}if(this.embedPhotoButton){Event.observe(this.embedPhotoButton,"click",function(D){this.showEditor();var B="";if($("sourceType")){B="&source="+$F("sourceType")}var C=this;ComCore.Dialog.initialize();ComCore.Dialog.options.width=545;ComCore.Dialog.registerExitCallBack(function(E){if(E){C.addPhoto(E)}});ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL("editor","addPhotoOverview")+B);Event.stop(D)}.bindAsEventListener(this),false);this.embedPhotoButton.show()}if(this.embedVideoButton){Event.observe(this.embedVideoButton,"click",function(C){this.showEditor();var B=this;ComCore.Dialog.initialize();ComCore.Dialog.options.width=525;ComCore.Dialog.registerExitCallBack(function(D){if(D){B.addVideo(D)}});ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL("editor","addVideoOverview"));Event.stop(C)}.bindAsEventListener(this),false);this.embedVideoButton.show()}if(this.nicknameButton){Event.observe(this.nicknameButton,"click",function(C){this.showEditor();if(this.textareaObject.getSelection()){this.textareaObject.wrapSelection("[nickname]","[/nickname]")}else{var B=this;ComCore.Dialog.initialize();ComCore.Dialog.registerExitCallBack(function(D){if(D){B.addNickname(D.value)}});ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL("editor","addNickname"))}Event.stop(C)}.bindAsEventListener(this),false);this.nicknameButton.show()}if(this.urlButton){Event.observe(this.urlButton,"click",function(D){this.showEditor();var B=this.textareaObject.getSelection();var C=this;ComCore.Dialog.initialize();ComCore.Dialog.registerExitCallBack(function(E){if(E){C.addUrl(E.url,E.description)}});ComCore.Dialog.postContent(ComCore.Page.buildAjaxURL("editor","addUrl"),"description="+encodeURIComponent(B));Event.stop(D)}.bindAsEventListener(this),false);this.nicknameButton.show()}if(this.quoteButton){Event.observe(this.quoteButton,"click",function(C){this.showEditor();if(this.textareaObject.getSelection()){this.toggleMode("quote")}else{var B=this;ComCore.Dialog.initialize();ComCore.Dialog.registerExitCallBack(function(D){if(D){B.addQuote(D.value)}});ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL("editor","addQuote"))}Event.stop(C)}.bindAsEventListener(this),false);this.quoteButton.show()}},toggleMode:function(E){var B=this.textareaObject.getSelection();var D=false;var C=false;var A=false;if((B.indexOf("["+E+"]")===0)&&(B.indexOf("[/"+E+"]")===(B.length-("[/"+E+"]").length))){C=B.indexOf("["+E+"]");A=B.indexOf("[/"+E+"]");D=true}if(D!==false){B=B.substring(("["+E+"]").length,A);this.textareaObject.replaceSelection(B)}else{this.textareaObject.wrapSelection("["+E+"]","[/"+E+"]")}},alignSelection:function(B){var C=["left","center","right"];if(C.indexOf(B)<0){return false}var D=this.textareaObject.getSelection();var F=false;var E=false;var A=false;C.each(function(G){if((D.indexOf("["+G+"]")===0)&&(D.indexOf("[/"+G+"]")===(D.length-("[/"+G+"]").length))){E=D.indexOf("["+G+"]");A=D.indexOf("[/"+G+"]");F=G}});if(F!==false){D=D.substring(("["+F+"]").length,A);this.textareaObject.replaceSelection("["+B+"]"+D+"[/"+B+"]")}else{this.textareaObject.wrapSelection("["+B+"]","[/"+B+"]")}},addUrl:function(B,A){if(B&&A){var C="[url="+B+"]"+A+"[/url] ";this.textareaObject.replaceSelection(C)}else{if(B){this.textareaObject.replaceSelection(B+" ")}}},addNickname:function(A){if(A){var B="[nickname]"+A+"[/nickname] ";this.textareaObject.replaceSelection(B)}},addQuote:function(A){if(A){this.textareaObject.replaceSelection(A)}},addPhoto:function(A){if(A){this.textareaObject.replaceSelection(A)}},addVideo:function(A){if(A){this.textareaObject.replaceSelection(A)}},onDoubleClickPreview:function(A){this.showEditor();Event.stop(A)},onClickPreview:function(A){if(this.selectedFont){this.showEditor()}Event.stop(A)},showPreview:function(F){var D=this;var G=this.editor.readAttribute("mode");var C=this.textarea.value;if(this.selectedFont){var B=this.selectedFont;if(this.personalFontKey){B=this.personalFontKey+","+B}C=C+"[font="+B+"]"}var A="message="+encodeURIComponent(C);if(G){A+="&mode="+G}var E=new Ajax.Request(ComCore.Page.buildAjaxURL(null,"previewEditor"),{parameters:A,method:"post",onSuccess:function(J,I){try{if(!I.success){throw"Could not fetch preview"}$(D.previewArea).update(J.responseText);D.previewLink.addClassName("toggled");D.previewLink.update(ComCore.Language.get("continueEditing"));D.previewArea.setStyle({height:D.textarea.getHeight()+"px",overflow:"auto"});D.textarea.hide();D.previewArea.show()}catch(H){ComCore.Debug.log(H)}}})},showEditor:function(A){this.previewLink.removeClassName("toggled");this.previewLink.update(ComCore.Language.get("preview"));this.previewArea.hide();this.textarea.show()},onFontsButtonClicked:function(A){this[this.fontButton.hasClassName("toggled")===false?"showSelectFonts":"hideSelectFonts"]();Event.stop(A)},onFontSelected:function(B){this.fontsSelectList.select("li").invoke("removeClassName","selected");var A=B.findElement("li a");if(A){this.selectedFont=A.getClassData("fontID")}if(!this.selectedFont){ComCore.Language.load();this.fontButton.update(ComCore.Language.get("font"));this.selectedFont=null;$("defaultFontSelect").hide()}else{this.fontButton.update(A.select("img").first().title);A.up().addClassName("selected");$("defaultFontSelect").show()}this.hideSelectFonts();if(typeof (ComCore.Fontselfv2Editor)!=="undefined"){this.fetchPersonalFonts()}else{this.showPreview()}Event.stop(B)},fetchPersonalFonts:function(){var B=this;var C={message:this.textarea.value};var A=new Ajax.Request(ComCore.Page.buildAjaxURL("fonts","getPersonalFontKey",true)+"&userid=38847654",{method:"POST",parameters:C,onSuccess:function(E){var D=E.responseJSON;if(D.success===true){B.personalFontKey=D.key}B.showPreview()}})},setSelectedFont:function(A){this.selectedFont=A},showSelectFonts:function(){this.fontsSelectList.show();this.fontButton.addClassName("toggled")},hideSelectFonts:function(){this.fontsSelectList.hide();this.fontButton.removeClassName("toggled")},onPreviewLinkClicked:function(A){this[this.previewArea.visible()===false?"showPreview":"showEditor"]();Event.stop(A)},onMoreClicked:function(G){var A=Event.element(G).next();var D=(A===this.premiumSmiliesBox)?"premium":"basic";var C=A.down("ul");if(C.select("li").size()===0){this.generateSmilies(function(){A.toggle()},D,{ul:C})}else{A.toggle()}if(A===this.smiliesBox){if(this.premiumSmiliesBox){this.premiumSmiliesBox.hide()}}else{this.smiliesBox.hide();if(this.premiumSmileyListContinued){if(this.premiumSmileyListContinued.id==="morepremiumoff"){var E=this;var B="type=MOREPREMIUM";var F=new Ajax.Request(ComCore.Page.buildAjaxURL(null,"getSmiliesView"),{parameters:B,method:"post",onSuccess:function(I){try{E.premiumSmileyListContinued.innerHTML=I.responseText;E.premiumSmileyListContinued.id="morepremium"}catch(H){ComCore.Debug.log(H)}}})}}}Event.stop(G)},onMoreSmileysLinkClicked:function(B){var A=this.smileyListContinued;if($$("#moresmilies li").size()===0){this.generateSmilies((function(){this.generateSmilies(function(){A.show()},"kjt",{className:"smiliesBig"})}).bind(this),"more",{})}else{A.show()}this.moreSmileysLink.hide();Event.stop(B)},onSmileyClicked:function(B){if(Event.element(B).tagName!=="IMG"){return }this.showEditor();if(document.getElementById("notpremium")!==null&&this.premiumSmiliesBox.visible()){this.showPremiumTeaser();this.premiumSmiliesBox.hide();Event.stop(B);return }var A=" "+Event.element(B).alt;this.textareaObject.replaceSelection(A);this.smiliesBox.hide();if(this.premiumSmiliesBox){this.premiumSmiliesBox.hide()}if(this.maxLength>0){this.checkMaxLength();if(this.charsLeft){this.updateCounter()}}Event.stop(B)},updateCounter:function(B){if(this.charsLeft&&(this.maxLength>0)){var A=parseInt(this.textarea.value.length,10);if(A>this.maxLength){A=this.maxLength}this.charsLeft.update(A)}},checkMaxLength:function(B){if(this.maxLength>0){var A=parseInt(this.textarea.value.length,10);if(A>this.maxLength){this.str=this.textarea.value.substring(0,this.maxLength);this.textarea.value=this.str}else{this.str=this.textarea.value}}},invisibleMaxLength:function(B){var E=B.keyCode;var D=[8,9,13,16,17,18,19,20,27,33,34,35,36,37,38,39,40,45,46];var C=false;D.each(function(F){if(F===E){C=true;throw $break}});if(!C){var A=parseInt(this.textarea.value.length,10);if(A>=this.maxLength){Event.stop(B)}}},initAutogrow:function(){this.autogrow={};this.autogrow.dummy=null;this.autogrow.interval=null;this.autogrow.max_height=parseInt(this.textarea.getStyle("max-height"),10);this.autogrow.orig_height=parseInt(this.textarea.getHeight(),10);this.textarea.setStyle({overflow:"hidden",display:"block"});Event.observe(this.textarea,"focus",this.startExpand.bindAsEventListener(this));Event.observe(this.textarea,"blur",this.stopExpand.bindAsEventListener(this));this.checkExpand()},startExpand:function(){var A=this;this.autogrow.interval=window.setInterval(function(){A.checkExpand()},400)},stopExpand:function(){clearInterval(this.autogrow.interval)},checkExpand:function(){try{if(this.autogrow.dummy===null){$(document.body).insert({bottom:'<div id="'+this.textarea.id+'_autogrow"></div>'});this.autogrow.dummy=$(this.textarea.id+"_autogrow");this.autogrow.dummy.setStyle({fontSize:this.textarea.getStyle("font-size"),fontFamily:this.textarea.getStyle("font-family"),width:this.textarea.getStyle("width"),padding:this.textarea.getStyle("padding"),margin:this.textarea.getStyle("margin"),lineHeight:"normal",overflowX:"hidden",position:"absolute",top:0,left:"-9999px"})}var B=this.textarea.value.replace(/(<|>)/g,"");if(Prototype.Browser.IE){B=B.replace(/\n/g,"<BR>new")}else{B=B.replace(/\n/g,"<br>new")}if(this.autogrow.dummy.innerHTML!==B){if(this.autogrow.orig_height===0){this.autogrow.orig_height=this.textarea.getHeight()}this.autogrow.dummy.update(B);if(this.autogrow.max_height>0&&(this.autogrow.dummy.getHeight()>this.autogrow.max_height)){this.textarea.setStyle({overflowY:"auto"})}else{this.textarea.setStyle({overflowY:"hidden"});if((this.autogrow.dummy.getHeight()>this.autogrow.orig_height)&&(this.textarea.getHeight()<this.autogrow.dummy.getHeight()||(this.autogrow.dummy.getHeight()<this.textarea.getHeight()))){this.textarea.setStyle({height:(this.autogrow.dummy.getHeight()+10)+"px"})}else{if(this.autogrow.dummy.getHeight()<=this.autogrow.orig_height){this.textarea.setStyle({height:(this.autogrow.orig_height)+"px"})}}}}}catch(A){debug(A)}},onSubmit:function(D){try{this.showEditor()}catch(F){debug(F)}if(this.premiumSmiliesBox instanceof Element&&document.getElementById("notpremium")!==null){var E=/\[[#@]([0-9a-z_])+\]/;var C=this.textarea.value;if(C.search(E)!==-1){if($("premiumSmiliesNotAllowed").visible()){$("premiumSmiliesNotAllowed").highlight()}else{$("premiumSmiliesNotAllowed").show();Event.observe($("activatePremiumLink"),"click",this.showPremiumTeaser.bindAsEventListener(this))}D.stop()}else{$("premiumSmiliesNotAllowed").hide()}}if(this.selectedFont){var A=this.selectedFont;var B=new Element("textarea",{name:"message"}).setStyle({visibility:"hidden",height:"1px",width:"1px"});this.textarea.name="oldMessage";this.textarea.up().insert(B,{position:"after"});if(this.personalFontKey){A=this.personalFontKey+","+A}B.value=this.textarea.value+"[font="+A+"]"}},showPremiumTeaser:function(A){this.saveEditorValue();this.premiumSmiliesBox.hide();ComCore.Dialog.initialize();ComCore.Dialog.options.width=630;ComCore.Dialog.getContent("/profile/settings/account/view=super&type=FUN")},saveEditorValue:function(){var A="message="+encodeURIComponent(this.textarea.value);var B=new Ajax.Request(ComCore.Page.buildAjaxURL(null,"saveEditorValue"),{parameters:A,method:"post",onSuccess:function(D,C){debug("saved: "+A)}})}});ComCore.CheckboxManager=Class.create();ComCore.CheckboxManager.prototype={initialize:function(D,E){this.form=$(D);this.buttons={};this.useConfirm=false;this.code="";this.rowType="";this.checkAllButton=false;this.onCheckedCountChangedHandlers=[];this.form.onsubmit=this.onSubmit.bindAsEventListener(this);this.table=this.form.getElementsByTagName("table")[0];var A=[];if(this.isArray(E)!==true){this.checkboxName=E;A=Form.getInputs(this.form,"checkbox",this.checkboxName)}else{A=E}this.checkboxes=[];var C=this;A.each(function(F){if(!F.hasClassName("ignoreCheckboxManager")){C.checkboxes.push(F)}});for(var B=0;B<this.checkboxes.length;B++){this.checkboxes[B].onclick=this.onCheckboxClicked.bindAsEventListener(this)}if($("checkAll")){$("checkAll").onclick=this.onCheckAllClicked.bindAsEventListener(this);this.checkAllButton=$("checkAll")}this.onCheckedCountChanged()},registerVirtualRows:function(A){this.rowType=A},registerButton:function(A,C,B,D){if($(A)){$(A).onclick=this.onButtonClicked.bindAsEventListener(this);this.buttons[A]={useConfirm:C,code:B,dontDisable:D};this.onCheckedCountChanged()}},registerCheckAllCheckBox:function(A){if($(A)){$(A).onclick=this.onCheckAllClicked.bindAsEventListener(this);this.onCheckedCountChanged();this.checkAllButton=$(A)}},registerOnCheckedCountChangedHandler:function(A){this.onCheckedCountChangedHandlers.push(A)},onButtonClicked:function(C){var B=Event.element(C).id;if(this.buttons[B]){var A=this.buttons[B];this.useConfirm=A.useConfirm;this.code=A.code}},onSubmit:function(B){if(this.useConfirm){this.useConfirm=false;var A=this.code;this.code="";if($(A+"ConfirmText")){return confirm($(A+"ConfirmText").value)}return true}},onRowClicked:function(A){var B=Event.element(A);this.selectRow(B,true)},onCheckboxClicked:function(A){var B=null;if(this.table){B=Event.findElement(A,"tr");this.selectRow(B,Event.element(A).checked)}else{B=Event.findElement(A,this.rowType);this.selectRow(B,Event.element(A).checked)}this.onCheckedCountChanged()},onCheckAllClicked:function(C){var B=Event.element(C).checked;for(var A=0;A<this.checkboxes.length;A++){this.checkboxes[A].checked=B;if(this.table){this.selectRow(Element.up(this.checkboxes[A],"tr"),B)}else{this.selectRow(Element.up(this.checkboxes[A],this.rowType),B)}}this.onCheckedCountChanged()},onCheckedCountChanged:function(){try{var C=this.checkedCount();for(var A in this.buttons){if($(A)){if(!this.buttons[A].dontDisable){$(A).disabled=(C===0)}}}if(this.checkAllButton){this.checkAllButton.checked=(C===this.checkboxes.length)}this.onCheckedCountChangedHandlers.each(function(E){try{E()}catch(D){debug("Couldn't execute onCheckedCountChangedHandler");debug(D)}})}catch(B){debug(B)}},checkedCount:function(){var B=0;for(var A=0;A<this.checkboxes.length;A++){if(this.checkboxes[A].checked){B++}}return B},selectRow:function(C,B){try{if($(C)){if(!B){$(C).removeClassName("selected")}else{$(C).addClassName("selected")}}}catch(A){}},isArray:function(A){if(!A.each){return false}else{return true}}};ComCore.Validator=new Class.create({options:{},debug:function(A){},initialize:function(B,A){this.options=Object.extend({errorClass:"error",validClass:"valid",classElement:null,directInit:true},A);this.form=$(B);this.requirements=[];this.requirementfields={};this.testCallBacks=[];this.formElementBlurCallBacks=[];this.formElementBlurPreventDefault={};this.errors={};this.errorTemplate=new Template('<span class="error" id="#{id}">#{message}</span>');this.errorTemplates={};this.errorMessages={};this.errorMessages.isRequired=ComCore.Language.get("validator","isRequired");this.errorMessages.invalidNickname=ComCore.Language.get("validator","invalidNickname");this.errorMessages.invalidEmail=ComCore.Language.get("validator","invalidEmail");this.errorMessages.invalidLength=ComCore.Language.get("validator","invalidLength");this.errorMessages.invalidEnum=ComCore.Language.get("validator","invalidEnum");this.detailedErrorMessages={};if(this.options.directInit&&this.form){this.initForm()}},initForm:function(){var A=this;$(this.form).getElements().each(function(B){var C=B.name;if(!A.options.directInit&&!A.requirementfields[C]){return }if((B.type==="radio")){B.observe("click",A.onFormElementClicked.bind(A))}else{if(B.type==="select-one"){B.observe("change",A.onFormElementChanged.bind(A))}else{B.observe("blur",A.onFormElementBlurred.bind(A));B.observe("keyup",A.onFormElementKeyUp.bind(A))}}});this.test()},checkInitialValues:function(){var B="";for(var D in this.requirementfields){if(this.requirementfields[D]===true){B=this.getValue(D);if(B===""||B===undefined||B===null){continue}if($(this.form[D])&&$(this.form[D]).attr&&($(this.form[D]).attr("placeholder")===B)){continue}this.test(D);if(this.hasError(D)){var C=this.getErrors(D);var A=C[0];this.displayError(D,A)}else{this.hideError(D);this.displayValid(D)}}}},setErrorTemplate:function(A,B){if(B){this.errorTemplates[B]=A}else{this.errorTemplate=A}},setErrorMessage:function(A,B,C){if(C){if(!this.detailedErrorMessages[C]){this.detailedErrorMessages[C]={}}this.detailedErrorMessages[C][A]=B}else{this.errorMessages[A]=B}},registerTestCallBack:function(B,C){var A={field:C,fn:B};this.testCallBacks.push(A)},registerFormElementBlurCallBack:function(C,D,B){var A={field:D,fn:C};this.formElementBlurCallBacks.push(A);if(B){this.formElementBlurPreventDefault.field=true}},disableOnError:function(A,B){this.registerTestCallBack(function(C){if(C.hasErrors()){$(A).disable()}else{$(A).enable()}},B)},displayValid:function(B){if(this.options.classElement){var A=(this.form[B].length)?$(this.form[B][0]):$(this.form[B]);var C=A.up(this.options.classElement);if(C){C.addClassName(this.options.validClass);C.removeClassName(this.options.errorClass);C.select("span.error").each(function(D){if(!D.hasClassName("nonJS")){D.hide()}})}}},displayError:function(F,C){var B=this.errorMessages[C.name];if(this.detailedErrorMessages[F]){if(this.detailedErrorMessages[F][C.name]){B=this.detailedErrorMessages[F][C.name]}}var A=null;if(B){if((C.name=="invalidLength")||(C.name=="invalidMinMax")){$w("min max").each(function(H){B=B.replace("%"+H+"%",C.options[H])})}var E=this.errorTemplate;if(this.errorTemplates&&this.errorTemplates[C.name]){E=this.errorTemplates[C.name]}var D=E.evaluate({id:"validatorError"+F,message:B});if(C&&C.name&&$("validatorError"+F+C.name+"Wrapper")){$("validatorError"+F+C.name+"Wrapper").update(D);$("validatorError"+F+C.name+"Wrapper").show()}else{if($("validatorError"+F+"Wrapper")){$("validatorError"+F+"Wrapper").update(D);$("validatorError"+F+"Wrapper").show()}else{if(!$("validatorError"+F)){A=(this.form[F].length)?$(this.form[F][0]):$(this.form[F]);A.insert({after:D})}else{$("validatorError"+F).replace(D);$("validatorError"+F).show()}}}}if(this.options.classElement){A=(this.form[F].length)?$(this.form[F][0]):$(this.form[F]);var G=A.up(this.options.classElement);if(G){G.addClassName(this.options.errorClass);G.removeClassName(this.options.validClass)}}},hideError:function(B){this.form.select("div.validatorError"+B+"Wrapper").each(function(D){D.hide()},this);if($("validatorError"+B+"Wrapper")){$("validatorError"+B+"Wrapper").hide()}if($("validatorError"+B)){$("validatorError"+B).hide()}if(this.options.classElement){var A=(this.form[B].length)?$(this.form[B][0]):$(this.form[B]);var C=A.up(this.options.classElement);if(C){C.removeClassName(this.options.errorClass)}}},test:function(B){this.checkRequirements(B);var A=this;this.testCallBacks.each(function(C){if(!C.field||(B&&(B==C.field))){C.fn(A)}})},hasErrors:function(){var B=0;for(var A in this.errors){if(typeof (A)==="string"){B=B+this.errors[A].size()}}return(B>0)},hasError:function(C,B){if(!this.errors[C]){return false}if(B){var A=false;this.errors[C].each(function(D){if(D.name===B){A=true}});return A}else{return(this.errors[C].size()>0)}},getErrors:function(A){if(A){if(!this.errors[A]){return false}return this.errors[A]}else{return this.errors}},getErrorCount:function(){var B=0;for(var A in this.errors){if(typeof (A)==="string"){B++}}return B},setError:function(D,C,B){if(!this.errors[D]){this.errors[D]=[]}var A={name:C};if(B){A.options=B}if(!this.hasError(D,C)){this.errors[D].push(A)}},removeError:function(D,B,A){if(this.errors[D]){var C=[];this.errors[D].each(function(E){if(E.name!=B){C.push(E)}});this.errors[D]=C}},getValue:function(C){try{if(this.form[C].length&&(this.form[C][0].type=="radio")){for(var B=0;B<this.form[C].length;B++){if(this.form[C][B].checked){return this.form[C][B].value}}return null}else{return $F(this.form[C])}}catch(A){}},isRequired:function(A){if(!A||!A.length){return false}return true},isNickname:function(A){return(/^[a-zA-Z0-9_]+$/).test(A)},isEmail:function(A){if(!A){return true}return(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/).test(A)},isURL:function(C,A){if(!A.protocolList){A.protocolList="http|https"}var B=new RegExp("("+A.protocolList+")://(w+:{0,1}w*@)?(S+)(:[0-9]+)?(/|/([w#!:.?+=&%@!-/]))?");return B.test(C)},isLength:function(B,A){if((A.min>0)&&(!B||!B.length)){return false}return((B.length<=A.max)&&(B.length>=A.min))},isEnum:function(C,A){if(!typeof (A.values)==="object"){return false}if(A.allowEmpty&&(C===""||C===null||C===undefined)){return true}var B=(A.values.indexOf(C)>-1);return B},isMinMax:function(B,A){B=parseInt(B,10);return((B>=A.min)&&(B<=A.max))},isKnownWebmail:function(E,C){if(!this.isEmail(E)){return true}if(!this.isRequired(E)){return true}var B=E.lastIndexOf("@");var A=E.substring(B+1,E.length);var D=false;if(C.domains&&C.domains.length){D=(C.domains.indexOf(A)>=0)}return D},setRequired:function(A){this.addRequirement(A,"isRequired","isRequired")},setNickname:function(A){this.addRequirement(A,"isNickname","invalidNickname")},setEmail:function(A){this.addRequirement(A,"isEmail","invalidEmail")},setURL:function(B,A){this.addRequirement(B,"isURL","invalidURL",{protocolList:A})},setLength:function(C,B,A){this.addRequirement(C,"isLength","invalidLength",{min:B,max:A})},setEnum:function(C,A,B){this.addRequirement(C,"isEnum","invalidEnum",{values:A,allowEmpty:B})},setMinMax:function(C,B,A){this.addRequirement(C,"isMinMax","invalidMinMax",{min:B,max:A})},setKnownWebmail:function(B,A){this.addRequirement(B,"isKnownWebmail","invalidKnownWebmail",{domains:A})},setDate:function(A,C,B){this.dateGroup=[A,C,B];$(this.form[A]).observe("change",this.onDateChanged.bind(this));$(this.form[C]).observe("change",this.onDateChanged.bind(this));$(this.form[B]).observe("change",this.onDateChanged.bind(this))},onDateChanged:function(D){var C=true;var B=true;var A=this;this.dateGroup.each(function(F){var E=$(A.form[F]);if((E!==D.element())&&!E.hasClassName("changed")){B=false}else{if((A.getValue(F)==="-1")){C=false}}});D.element().addClassName("changed");if(B){if(C){this.displayValid(this.dateGroup[0])}else{this.displayError(this.dateGroup[0],"invalidDate")}}},checkRequirements:function(B){var A=this;this.requirements.each(function(D){if(!B||(D.field===B)){var C=A.checkRequirement(D);if(!C){if(D.options){A.setError(D.field,D.error,D.options)}else{A.setError(D.field,D.error)}}else{if(D.options){A.removeError(D.field,D.error,D.options)}else{A.removeError(D.field,D.error)}}}})},checkRequirement:function(C){var B=this.getValue(C.field);var A=true;if(C.options){A=this[C.test](B,C.options)}else{A=this[C.test](B)}return A},addRequirement:function(C,E,A,B){this.requirementfields[C]=true;var D={field:C,test:E,error:A};if(B){D.options=B}if(!this.hasRequirement(C,E)){this.requirements.push(D)}},hasRequirement:function(B,C){var A=false;this.requirements.each(function(D){if((D.field===B)&&(D.test===C)){A=true}});return A},onFormElementBlurred:function(D){var C=this;var B=D.element();var F=B.name;if(!this.requirementfields[F]){return }if(!this.formElementBlurPreventDefault.field){this.test(F);if(this.hasError(F)){var E=this.getErrors(F);var A=E[0];this.displayError(F,A)}else{this.hideError(F);this.displayValid(F)}}this.formElementBlurCallBacks.each(function(G){if(!F&&!G.field){G.fn(C)}else{if(F&&(F==G.field)){G.fn(C)}}})},_onFormElementChange:function(F,E){try{var D=this;var C=F.element();var H=C.name;if(!this.requirementfields[H]){return }this.test(H);if(!this.hasError(H)){this.hideError(H);this.displayValid(H)}else{if(E===true){var G=this.getErrors(H);var A=G[0];this.displayError(H,A)}}}catch(B){}},onFormElementKeyUp:function(A){this._onFormElementChange(A)},onFormElementClicked:function(A){this._onFormElementChange(A)},onFormElementChanged:function(A){this._onFormElementChange(A,true)},_eoo:true});ComCore.InputPlaceHolder=Class.create();ComCore.InputPlaceHolder.prototype={fieldChanged:false,initialize:function(D,A){var C=this;this.field=$(D);this.options=Object.extend({},A);this.placeholder=this.field.attr("placeholder");this.onClickCallBacks=[];this.onBlurCallBacks=[];this.fieldChanged=false;this.isPasswordField=(this.field.attr("type")=="password");if(this.isPasswordField){this.inputTypeSwitchingSupported=this._switchInputType("text");if(!this.inputTypeSwitchingSupported){this.placeholder="";this.field.value="";this.fieldChanged=true}}if(this.placeholder){if(this.field.value===""){this.resetPlaceHolder()}else{if(this.field.value!==this.field.readAttribute("placeholder")){this.fieldChanged=true}}this.field.observe("click",this.onClick.bind(this));this.field.observe("focus",this.onClick.bind(this));this.field.observe("blur",this.onBlur.bind(this));this.field.observe("change",this.onClick.bind(this))}var B=this.field.up("form");if(B){var C=this;B.observe("submit",function(E){if(!C.fieldChanged){C.field.value=""}})}},isEmpty:function(){return((this.field.value===this.placeholder)||(this.field.value===""))},getPlaceHolderText:function(){return this.placeholder},updatePlaceHolderText:function(A){if(this.isPasswordField&&!this.inputTypeSwitchingSupported){return false}if(this.field.value===this.placeholder){this.field.value=A}this.placeholder=A;return true},_switchInputType:function(B){try{this.field.attr("type",B);return true}catch(A){debug("could not switch type of input field");debug(A)}return false},registerOnClickCallBack:function(A){this.onClickCallBacks.push(A)},onClick:function(A){this.fieldChanged=true;if(this.field.value===this.placeholder){this.field.value="";if(this.isPasswordField){this._switchInputType("password")}}this.field.removeClassName("placeholder");this.onClickCallBacks.each(function(C){try{C(A)}catch(B){debug("Could not execute click-callback");debug(B)}})},registerOnBlurCallBack:function(A){this.onBlurCallBacks.push(A)},onBlur:function(A){if(this.field.value===""){this.resetPlaceHolder()}this.onBlurCallBacks.each(function(C){try{C(A)}catch(B){debug("Could not execute blur-callback");debug(B)}})},resetPlaceHolder:function(){var A=this;this.field.addClassName("placeholder");setTimeout(function(){A._resetPlaceHolder()},100)},_resetPlaceHolder:function(){this.field.value=this.placeholder;if(this.isPasswordField){this._switchInputType("text");this.field.addClassName("placeholder")}},registerSubmitButton:function(A){$(A).observe("click",this.onSubmit.bind(this))},registerSubmitForm:function(A){$(A).observe("submit",this.onSubmit.bind(this))},onSubmit:function(A){if(this.field.value==this.placeholder){this.field.value=""}}};ComCore.EasterEggs={init:function(){this.initKonamiCode()},showDragon:function(){var C=40;try{var D=(document.viewport.getHeight()-463)/2;if(parseInt(D,10)>10){C=D}}catch(B){}var A='<div style="position: absolute; top: 0; left: 0; z-index: 2000; width: 100%; text-align: center;"><img src="'+ComCore.Configuration.get("staticURL")+'/s/i/misc/actions/dragon.gif" style="margin:'+C+'px auto;" onclick="$(this).up().remove();" /></div>';$(document.body).insert({bottom:A})},initKonamiCode:function(){var B=[];var A=[38,38,40,40,37,39,37,39,66,65];$(document).observe("keydown",function(C){B.push(C.keyCode);if(B.length>A.length){B=B.slice((B.length-A.length))}if(B.toString().indexOf(A.toString())>=0){B=[];ComCore.EasterEggs.showDragon()}})},_eoo:true};(function(){ComCore.EasterEggs.init()})();ComCore.UserTip=Class.create({initialize:function(){var B=this;if($("usertips")&&$("usertips_close")){$("usertips_close").observe("click",this.close.bind(this));$$("#usertips .usertips_forward").each(function(C){C.observe("click",this.forward.bind(this))},this)}if($("usertipdialog")){debug("Opening FriendFinder splash dialog");debug(!ComCore.Dialog.dialogPlaceHolder||!ComCore.Dialog.dialogPlaceHolder.visible());if(!ComCore.Dialog.dialogPlaceHolder||!ComCore.Dialog.dialogPlaceHolder.visible()){debug("Opening FriendFinder splash dialog, for real");var A=$("usertipdialog").getClassData("usertiptype");ComCore.Dialog.initialize({width:700});ComCore.Dialog.registerCloseCallBack(function(){debug("FriendFinder Tool Dialog");B.close(A)});ComCore.Dialog.getContent("/friends/find/view=tool&usertip="+A+"&professor=1")}}},_onCloseLinkClicked:function(C){var B=C.element();var A=B.readAttribute("rel");this.close(A);C.stop()},_onForwardClicked:function(C){var B=C.element();var A=B.readAttribute("rel");var D=encodeURIComponent(B.attr("href"));this.forward(A,D);C.stop()},close:function(B){ComCore.LoadingIndicator.show();var A=ComCore.Page.buildAjaxURL(null,"closeUserTip")+"&type="+B+"&hip="+Math.floor(Math.random()*1000000);var C=new Ajax.Request(A,{method:"get",onSuccess:this.closeCallback.bind(this)})},closeCallback:function(B,A){ComCore.LoadingIndicator.hide();if($("usertips")){Element.remove("usertips")}},forward:function(B,D){ComCore.LoadingIndicator.show();var A=ComCore.Page.buildAjaxURL(null,"forwardUserTip")+"&type="+B+"&hip="+Math.floor(Math.random()*1000000);if(D){D+="&forwardurl="+D}var C=new Ajax.Request(A,{method:"get",onSuccess:this.forwardCallback.bind(this)})},forwardCallback:function(B,A){if(A.success){window.location=A.url}},_eoo:true});if(typeof deconcept=="undefined"){var deconcept={}}if(typeof deconcept.util=="undefined"){deconcept.util={}}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil={}}deconcept.SWFObject=function(D,C,K,F,H,J,L,E,A,G){if(!document.getElementById){return }this.DETECT_KEY=G?G:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];if(D){this.setAttribute("swf",D)}if(C){this.setAttribute("id",C)}if(K){this.setAttribute("width",K)}if(F){this.setAttribute("height",F)}if(H){this.setAttribute("version",new deconcept.PlayerVersion(H.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(J){this.addParam("bgcolor",J)}var B=L?L:"high";this.addParam("quality",B);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var I=(E)?E:window.location;this.setAttribute("xiRedirectUrl",I);this.setAttribute("redirectUrl","");if(A){this.setAttribute("redirectUrl",A)}};deconcept.SWFObject.prototype={useExpressInstall:function(A){this.xiSWFPath=!A?"expressinstall.swf":A;this.setAttribute("useExpressInstall",true)},setAttribute:function(A,B){this.attributes[A]=B},getAttribute:function(A){return this.attributes[A]||""},addParam:function(A,B){this.params[A]=B},getParams:function(){return this.params},addVariable:function(A,B){this.variables[A]=B},getVariable:function(A){return this.variables[A]||""},getVariables:function(){return this.variables},getVariablePairs:function(){var A=[];var B;var C=this.getVariables();for(B in C){A[A.length]=B+"="+C[B]}return A},getSWFHTML:function(){var C="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}C='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+(this.getAttribute("style")||"")+'"';C+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var D=this.getParams();for(var A in D){C+=[A]+'="'+D[A]+'" '}var B=this.getVariablePairs().join("&");if(B.length>0){C+='flashvars="'+B+'"'}C+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}C='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+(this.getAttribute("style")||"")+'">';C+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var D=this.getParams();for(var A in D){C+='<param name="'+A+'" value="'+D[A]+'" />'}var B=this.getVariablePairs().join("&");if(B.length>0){C+='<param name="flashvars" value="'+B+'" />'}C+="</object>"}return C},write:function(A){if(this.getAttribute("useExpressInstall")){var B=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(B)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var C=(typeof A=="string")?document.getElementById(A):A;C.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var D=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var A=navigator.plugins["Shockwave Flash"];if(A&&A.description){D=new deconcept.PlayerVersion(A.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var C=1;var B=3;while(C){try{B++;C=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+B);D=new deconcept.PlayerVersion([B,0,0])}catch(E){C=null}}}else{try{var C=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(E){try{var C=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");D=new deconcept.PlayerVersion([6,0,21]);C.AllowScriptAccess="always"}catch(E){if(D.major==6){return D}}try{C=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(E){}}if(C!=null){D=new deconcept.PlayerVersion(C.GetVariable("$version").split(" ")[1].split(","))}}}return D};deconcept.PlayerVersion=function(A){this.major=A[0]!=null?parseInt(A[0]):0;this.minor=A[1]!=null?parseInt(A[1]):0;this.rev=A[2]!=null?parseInt(A[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(A){if(this.major<A.major){return false}if(this.major>A.major){return true}if(this.minor<A.minor){return false}if(this.minor>A.minor){return true}if(this.rev<A.rev){return false}return true};deconcept.util={getRequestParameter:function(D){var C=document.location.search||document.location.hash;if(D==null){return C}if(C){var B=C.substring(1).split("&");for(var A=0;A<B.length;A++){if(B[A].substring(0,B[A].indexOf("="))==D){return B[A].substring((B[A].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var B=document.getElementsByTagName("OBJECT");for(var C=B.length-1;C>=0;C--){B[C].style.display="none";for(var A in B[C]){if(typeof B[C][A]=="function"){B[C][A]=function(){}}}}};if(!document.getElementById&&document.all){document.getElementById=function(A){return document.all[A]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;ComCore.bubbleManager=null;ComCore.BubbleManager=Class.create();ComCore.BubbleManager.prototype={initialize:function(){this.doCheckCounter=0;this.doCheckForNewCountersDelay=20000;this.showBubbleTime=30000;this.maxBubbles=4;this.effectIntervalMilliseconds=2000;this.effectIntervalSeconds=2;this.version=0.5;this.bubbleCounter=0;var A=$("chatList");this.bubble=$("bubble");if(A&&A.visible()){this.bubble.setStyle({width:"160px"})}this.showBubbles=true;try{this.showBubbleGuestbook=showBubbleGuestbook;this.showBubbleBlog=showBubbleBlog;this.showBubblePhoto=showBubblePhoto;this.showBubbleBirthday=showBubbleBirthday;this.showBubbleFriendship=showBubbleFriendship;this.showBubblePm=showBubblePm;this.showBubbleClan=showBubbleClan;this.showBubbleVideo=showBubbleVideo;this.showBubbleQuote=showBubbleQuote;this.showBubbleEvent=showBubbleEvent;this.showBubblePartner=showBubblePartner;this.showBubbleLink=showBubbleLink;this.showBubbleFriendsOnline=showBubbleFriendsOnline;this.showBubbleNewVisitor=showBubbleNewVisitor;this.showBubblePhotoFriend=showBubblePhotoFriend}catch(B){}try{this.doCheckForNewCounters=ComCore.configValues&&ComCore.configValues.bubblesPoller&&ComCore.configValues.bubblesPoller.enabled&&(this.showBubbleGuestbook||this.showBubbleBlog||this.showBubblePhoto||this.showBubbleBirthday||this.showBubbleFriendship||this.showBubblePm||this.showBubbleClan||this.showBubbleVideo||this.showBubbleQuote||this.showBubbleEvent||this.showBubbleFriendsOnline||this.showBubbleNewVisitor||this.showBubbleLink)}catch(B){}if(this.doCheckForNewCounters===true){window.setTimeout((function(){this.checkForNewCounters()}).bind(this),this.doCheckForNewCountersDelay)}},checkForNewCounters:function(){if(this.doCheckForNewCounters){var A=ComCore.Page.buildAjaxURL("bubbles","getCounters",true)+"&hip="+Math.floor(Math.random()*1000000)+"&version="+this.version;var B=this;var C=new Ajax.Request(A,{method:"get",onSuccess:function(E,D){B.onCheckedForNewCounters(E,D)},onFailure:this.onCheckedForNewCountersFailure.bindAsEventListener(B)})}},onCheckedForNewCounters:function(B,A){try{if(!A||!A.ni){A=B.responseText.evalJSON(true)}if(A.s&&(A.ni===ComCore.Login.getNickname())){if(!A.m){A.m=0}if(!A.n){A.n=0}if(!A.f){A.f=0}if(!A.c){A.c=0}this.updateCounters(A.m,A.n,A.f,A.c);if(A.b){this.renderBubbles(A.b)}}else{debug("Not updating counters. You're now logged in as "+ComCore.Login.getNickname())}this.doCheckCounter++;if(this.doCheckCounter>3){this.doCheckForNewCountersDelay=60000;debug("Updated doCheckForNewCountersDelay to "+this.doCheckForNewCountersDelay+"ms")}if(this.doCheckCounter>10){this.doCheckForNewCountersDelay=300000;debug("Updated doCheckForNewCountersDelay to "+this.doCheckForNewCountersDelay+"ms")}if(this.doCheckCounter>15){this.doCheckForNewCountersDelay=600000;debug("Updated doCheckForNewCountersDelay to "+this.doCheckForNewCountersDelay+"ms")}if(this.doCheckCounter>20){this.doCheckForNewCounters=false;debug("disabling counter checks")}window.setTimeout((function(){this.checkForNewCounters()}).bind(this),this.doCheckForNewCountersDelay)}catch(C){ComCore.Debug.error("Error in onCheckedForNewCounters");ComCore.Debug.error(C)}},onCheckedForNewCountersFailure:function(A){window.setTimeout((function(){this.checkForNewCounters()}).bind(this),this.doCheckForNewCountersDelay)},updateCounters:function(G,I,A,E){var D=$("messageCount");if(D&&(parseInt(D.innerHTML,10)!==parseInt(G,10))){if(parseInt(G,10)<=0){D.hide()}else{D.innerHTML=G;D.show();if(typeof (Effect)!=="undefined"){var J=new Effect.Highlight(D,{startcolor:"#ffffff",endcolor:"#cc0000",duration:this.effectIntervalSeconds})}}}var B=$("notificationCount");if(B&&(parseInt(B.innerHTML,10)!==parseInt(I,10))){if(parseInt(I,10)<=0){B.hide()}else{B.innerHTML=I;B.show();if(typeof (Effect)!=="undefined"){var F=new Effect.Highlight(B,{startcolor:"#ffffff",endcolor:"#cc0000",duration:this.effectIntervalSeconds})}}}var H=$("friendCount");if(H&&(parseInt(H.innerHTML,10)!==parseInt(A,10))){if(parseInt(A,10)<=0){H.hide()}else{H.innerHTML=A;H.show();if(typeof (Effect)!=="undefined"){var C=new Effect.Highlight(H,{startcolor:"#ffffff",endcolor:"#cc0000",duration:this.effectIntervalSeconds})}}}},renderBubbles:function(D){var B={NEWFRIENDSTARTED:{f:this.showBubbleFriendship},FRIENDSTOPPED:{f:this.showBubbleFriendship},NEWFRIENDACCEPTED:{f:this.showBubbleFriendship},NEWFRIENDREGISTERED:{f:this.showBubbleFriendship},NEWEMAILCONTACTREGISTERED:{f:this.showBubbleFriendship},NEWFRIENDFROMINVITATION:{f:this.showBubbleFriendship},NEWFRIENDDENIED:{f:this.showBubbleFriendship},FRIENDRESTARTED:{f:this.showBubbleFriendship},LOVESTATERELATIONWITHYOU:{f:this.showBubbleFriendship},NEWGUESTBOOK:{f:this.showBubbleGuestbook},NEWQUEUEDGUESTBOOK:{f:this.showBubbleGuestbook},NEWCOMMENTONBLOG:{f:this.showBubbleBlog},NEWQUEUEDCOMMENTONBLOG:{f:this.showBubbleBlog},NEWCOMMENTONPHOTO:{f:this.showBubblePhoto},NEWQUEUEDCOMMENTONPHOTO:{f:this.showBubblePhoto},PHOTONOTEUSERMARKED:{f:this.showBubblePhoto},PHOTOCONFIRMED:{f:this.showBubblePhoto},NEWCOMMENTONVIDEO:{f:this.showBubbleVideo},NEWQUEUEDCOMMENTONVIDEO:{f:this.showBubbleVideo},VIDEOACTIVATED:{f:this.showBubbleVideo,picture:0},VIDEOERROR:{f:this.showBubbleVideo,picture:0},VIDEODUPLICATE:{f:this.showBubbleVideo,picture:0},VIDEODENIED:{f:this.showBubbleVideo,picture:0},NEWGUESTBOOKCOMMENTQUOTE:{f:this.showBubbleQuote},NEWBLOGCOMMENTQUOTE:{f:this.showBubbleQuote},NEWPHOTOCOMMENTQUOTE:{f:this.showBubbleQuote},NEWVIDEOCOMMENTQUOTE:{f:this.showBubbleQuote},EVENTACTIVATED:{f:this.showBubbleEvent,picture:0},EVENTDENIED:{f:this.showBubbleEvent,picture:0},EVENTATTENDINGTOMORROW:{f:this.showBubbleEvent,picture:0},BIRTHDAYTOMORROW:{f:this.showBubbleBirthday},BIRTHDAYTODAY:{f:this.showBubbleBirthday},PARTNERDELETED:{f:this.showBubblePartner,picture:0},APPLICATION:{f:this.showBubblePartner,picture:0},NEWPRIVATEMESSAGE:{f:this.showBubblePm},SHOUTMENTION:{f:this.showBubblePm},WHITELISTADD:{f:this.showBubblePm},NEWHELPDESKTICKET:{f:this.showBubblePm},ONLINEFRIEND:{f:this.showBubbleFriendsOnline},NEWVISITOR:{f:this.showBubbleNewVisitor},NEWCOMMENTONLINK:{f:this.showBubbleLink},NEWQUEUEDCOMMENTONLINK:{f:this.showBubbleLink},NEWLINKCOMMENTQUOTE:{f:this.showBubbleLink},CREDITSBOUGHT:{f:this.showBubblePm},PREMIUMEXPIRES7:{f:this.showBubblePm},PREMIUMEXPIRES3:{f:this.showBubblePm},PREMIUMEXPIRES1:{f:this.showBubblePm},PREMIUMSTOPPED:{f:this.showBubblePm},NOTIFICATION_BUBBLE_FRIEND_PHOTO_VIDEO_UPLOAD:{f:this.showBubbleLink}};for(var E=0,H=D.length;E<H;E++){var A=D[E];var I=A.type;var F=A.nickname;var C=A.pictureURL?'<img class="avatar" src="'+A.pictureURL+'" alt="'+F+'" />':"";var G=A.body;var K=A.id;var J="/logs/notifications/notificationID="+K;if((B[I]!==undefined)&&(B[I].f===true)){this.showBubble(J,(B[I].picture===undefined)?C:0,G,this.showBubbleTime)}else{ComCore.Debug.error("Unknown type or user doesn't want this (type: "+I+")")}}},showBubble:function(I,C,D,H,G){this.bubbleCounter++;var A=this.bubbleCounter;var F=$("bubble");if(F===null){return }if(ComCore.Configuration.get("bubblesPoller","enabled")===false){var E=($$("#chatConversationWindows .window").findAll(function(K){return K.visible()}).length>0);var B=E?150:180;html='<div class="clearfix" id="bubble'+A+'" style="display:none; width: '+B+'px">'}else{html='<div class="clearfix" id="bubble'+A+'" style="display:none;">'}html+='<div class="closeBubble" id="closeBubble'+A+'"><img class="icon iconCloseAlt" src="'+ComCore.Configuration.get("staticURL")+'//s/i/common/blank.gif" alt="" /></div>';if(C!=="0"){html+=C}html+='<p class="smiley">'+D+"</p></div>";$(F).insert({top:html});this.newBubble=$("bubble"+A);this.newBubble.observe("click",(function(K){if(G){debug("executing onClickFunction()");G(K);Element.remove("bubble"+A)}else{this.bubbleAction(I,A)}}).bind(this));this.closeBubble=$("closeBubble"+A);this.closeBubble.observe("click",function(K){Element.remove("bubble"+A);Event.stop(K)});this.newBubble.observe("mouseover",function(){$("closeBubble"+A).show()});this.newBubble.observe("mouseout",function(){$("closeBubble"+A).hide()});$(this.closeBubble).hide();if(this.bubbleCounter>this.maxBubbles){var J=(this.bubbleCounter-this.maxBubbles);Element.remove("bubble"+J)}if(typeof (Effect)!=="undefined"){Effect.Appear(this.newBubble,{duration:this.effectIntervalSeconds})}else{this.newBubble.show()}if(H!==0){window.setTimeout("ComCore.bubbleManager.hideBubble('bubble"+A+"')",H)}},bubbleAction:function(B,A){Element.remove("bubble"+A);var C="#utm_source=bubbles#utm_medium=bubbles#utm_campaign=bubbles";B=B+C;window.location=B},hideBubble:function(A){if($(A)){if(typeof (Effect)!=="undefined"){Effect.Fade(A,{duration:this.effectIntervalSeconds})}else{$(A).hide()}}},removeBubble:function(B){var A=$(B);if(A){A.remove()}}};ComCore.bubbleManager=new ComCore.BubbleManager();ComCore.DropDownList=Class.create({options:{},_toggleButton:null,dropDownList:null,dropDownListListing:null,dropDownControlResize:null,elementID:null,_isOpened:false,_isInitialized:false,initialize:function(B,A){debug("ComCore.DropDownList.initialize();");this.options=Object.extend({minHeight:50,maxHeight:2000,loadingMessage:ComCore.Language.get("loading"),emptyMessage:"",emptyAddLink:"",emptyAddLinkMessage:"",elementID:null,loadListURL:"",canResize:false},A);this._toggleButton=$(B);this._toggleButton.observe("click",this._toggleList.bindAsEventListener(this))},_toggleList:function(A){debug("ComCore.DropDownList._toggleList()");if(!this._isOpened){if(!this._isInitialized){this._initList(A)}this.dropDownList.show();this._isOpened=true}else{this.dropDownList.hide();this._isOpened=false}},_initList:function(F){debug("ComCore.DropDownList._initList()");var E=this;this.elementID="dropDownList"+Math.random()*1000;if(this.options.elementID){this.elementID=this.options.elementID}var D='<div class="dropDownList" id="'+this.elementID+'">\n';D+='	<div class="dropDownListHolder" style="display: none;">\n';D+='		<div class="dropDownListListing">\n';D+="           <ul></ul>";D+='			<div class="dropDownListLoading" style="margin: 5px;">'+this.options.loadingMessage+"</div>";D+='		    <div class="dropDownListEmpty" style="display: none; margin: 5px;">';D+=this.options.emptyMessage;D+='               <a id="dropDownListEmptyAddLink" href="'+this.options.emptyAddLink+'">'+this.options.emptyAddLinkMessage+"</a>.";D+="           </div>\n";D+="		</div>\n";D+='		<span class="dropDownListResize"></span>\n';D+="	</div>\n";D+="</div>\n";$("headerWrapper").insert({before:D});var G=$(this.elementID);this.dropDownList=G.down("div.dropDownListHolder");this.dropDownListListing=G.down("div.dropDownListListing");this.dropDownListControlResize=G.down("span.dropDownListResize");this.dropDownListLoadingMessage=G.down("div.dropDownListLoading");this.dropDownListEmptyMessage=G.down("div.dropDownListEmpty");var C=$("header").cumulativeOffset();var B=this._toggleButton.cumulativeOffset();var A=B[0]-C[0]-13;this.dropDownList.setStyle({marginLeft:A+"px"});document.observe("click",this._checkHideList.bind(this));if(this.options.canResize){debug("Init resize handlers");this.dropDownListControlResize.observe("mousedown",this._startResize.bind(this));document.observe("mouseup",this._stopResize.bind(this));document.observe("mousemove",this._doResize.bind(this))}this.loadSettingsFromCookie();this.loadList();this._isInitialized=true},_checkHideList:function(B){debug("ComCore.DropDownList._checkHideList()");var A=B.element();if(A.descendantOf(this.elementID)||(A===$(this.elementID))||(A.descendantOf(this._toggleButton))||(A===this._toggleButton)){debug("clicking the dropdownlist itself");return }this.dropDownList.hide();this._isOpened=false;ComCore.LoadingIndicator.hide()},loadList:function(D){debug("ComCore.DropDownList.loadList()");ComCore.LoadingIndicator.show();var A=this.options.loadListURL;var B=this;var C=new Ajax.Request(A,{method:"get",onComplete:this._onListLoadSuccess.bind(this),onFailure:this._onListLoadFailure.bind(this)})},_onListLoadFailure:function(A){ComCore.LoadingIndicator.hide()},_onListLoadSuccess:function(B,A){debug("ComCore.DropDownList._onListLoadSuccess()");this.dropDownListLoadingMessage.hide();if(A&&(A.length>0)){A.each(function(C){this.addItem(C.url,C.name)},this);this.dropDownListEmptyMessage.hide()}else{if(A.length===0){this.dropDownListEmptyMessage.show()}}ComCore.LoadingIndicator.hide()},addItem:function(B,A){debug("ComCore.DropDownList.addItem("+B+","+A+")");html='<li><a href="'+B+'">'+A+"</a></li>\n";this.dropDownListListing.down("ul").insert(html)},_startResize:function(A){this.resizing=true},_doResize:function(C){if(!this.resizing){return }var A=$(this.dropDownList).cumulativeOffset();var B=Event.pointerY(C)-A[1]-17;if(B>this.options.maxHeight){B=this.options.maxHeight}if(B<this.options.minHeight){B=this.options.minHeight}this.dropDownListListing.setStyle({height:B+"px"});this.height=B;this.saveSettingsInCookie()},_stopResize:function(A){this.resizing=false},saveSettingsInCookie:function(){ComCore.CookieManager.setCookieWithDate(this.elementID,this.height,1)},loadSettingsFromCookie:function(){var A=ComCore.CookieManager.getCookie(this.elementID);if(A!==""){if(this.options.canResize){this.height=parseInt(A,10);this.dropDownListListing.setStyle({height:this.height+"px"})}}},_eoo:true});ComCore.Ratings=Class.create();ComCore.Ratings.prototype={actionStates:["rateSuccess","rateFailure","rateFailureSpam"],initialize:function(A){var B=this;this.containerID=A;this.container=$(this.containerID);this.links=this.container.select("div ul li a");if(this.links.length>0){this.links.each(function(C){Event.observe(C,"click",B.onRatingLinkClicked.bind(B),false)})}else{this.idleLinks=this.container.select("a");if(this.idleLinks){this.idleLinks.each(function(C){Event.observe(C,"click",function(D){Event.stop(D)},false)})}}},onRatingLinkClicked:function(E){ComCore.LoadingIndicator.show();var D=this;var C=Event.element(E);var A=C.readAttribute("href")+"&ajax=1";var B=new Ajax.Request(A,{method:"post",onSuccess:function(G,F){D.actionStates.each(function(H){if($("actionState"+H)){$("actionState"+H).hide()}});if(F.actionState!=="rateSuccess"){if($("actionState"+F.actionState)){$("actionState"+F.actionState).show()}}$(D.container).replace(G.responseText);D.container=$(this.containerID);ComCore.LoadingIndicator.hide();D.notify("onRatingLinkClicked")},onFailure:function(F){ComCore.LoadingIndicator.hide()}});Event.stop(E)}};ComCore.Events.extend(ComCore.Ratings);ComCore.UnSavedInputHandler=Class.create();ComCore.UnSavedInputHandler.prototype={initialize:function(A){this.options=Object.extend({maxWarningCount:0},A);this.warningMessage="";this.ignoreWarning=false;this.changed=false;this.onChangeCallbacks=[];this.changedButtons=[];this.warningCount=0;var B=this;window.onbeforeunload=function(){if(B.changed&&!B.ignoreWarning&&((B.options.maxWarningCount===0)||(B.warningCount<B.options.maxWarningCount))){B.warningCount++;return B.warningMessage}}},isChanged:function(){return this.changed},setChanged:function(A){this.changed=A},setWarningMessage:function(A){this.warningMessage=A},onInputFieldChanged:function(E,D){var A=null;if(E){A=Event.element(E)}else{if(D){A=$(D)}}var C=$F(A);var F=A.readAttribute("placeholder");if(C!=F){this.changed=true}var B=this;this.changedButtons.each(function(G){if(B.changed){$(G).enable()}else{$(G).disable()}});this.onChangeCallbacks.each(function(G){G()})},resetPlaceHolder:function(A){A=$(A);A.setAttribute("placeholder",A.value)},registerInputField:function(B,A){B=$(B);this.resetPlaceHolder(B);if(A){Event.observe(B,A,this.onInputFieldChanged.bind(this))}else{Event.observe(B,"change",this.onInputFieldChanged.bind(this))}},onIgnoreWarningAction:function(A){this.ignoreWarning=true},registerIgnoreWarningAction:function(B,A){Event.observe($(B),A,this.onIgnoreWarningAction.bind(this))},registerIgnoreWarningActionOnCssSelector:function(B,A){$$(B).invoke("observe",A,this.onIgnoreWarningAction.bind(this))},registerChangedButton:function(A){this.changedButtons.push(A)},registerOnChangeCallback:function(A){this.onChangeCallbacks.push(A)}};ComCore.AjaxProxy=Class.create({element:null,proxySuccessCallBacks:[],proxyFailureCallBacks:[],initialize:function(B,A){debug("ComCore.AjaxProxy.initialize()");this.elementid=B;this.element=$(B);this.proxySuccessCallBacks=[];this.proxyFailureCallBacks=[];this.options=Object.extend({proxyIgnoreClasses:["ignore-proxy"],getProxyIgnoreClass:"ignore-proxy-get",postProxyIgnoreClass:"ignore-proxy-post",forceProxyClass:"force-proxy",extraParam:""},A||{});this.observe()},registerProxySuccessCallBack:function(A){this.proxySuccessCallBacks.push(A)},registerProxyFailureCallBack:function(A){this.proxyFailureCallBacks.push(A)},observe:function(){debug("ComCore.AjaxProxy.observe()");debug(this);var E=this;var C=null;var B=null;var A=null;if(this.options.getProxyIgnoreClass){A=this.element.select("."+this.options.getProxyIgnoreClass)}if(!A||(A.length===0)){debug("!ignoreProxyGet");C=this.element.select("a");C.each(function(G){var F=true;G=$(G);if(G.attr("target")==="_blank"){F=false}if(G.attr("href")==="#"){debug('not observing this link, because href="#"');debug(G);F=false}if(F){E.options.proxyIgnoreClasses.each(function(H){if(G.hasClassName(H)){F=false}})}if(F){Event.observe(G,"click",function(H){E.onLinkClicked(H)})}})}else{if(this.options.forceProxyClass){C=this.element.select("a."+this.options.forceProxyClass);C.each(function(F){$(F).observe("click",function(G){E.onLinkClicked(G)})})}}var D=null;if(this.options.postProxyIgnoreClass){D=this.element.select("."+this.options.postProxyIgnoreClass)}if(!D||(D.length===0)){debug("!ignoreProxyPost");B=this.element.select("form");B.each(function(G){var F=true;G=$(G);E.options.proxyIgnoreClasses.each(function(H){if(G.hasClassName(H)){F=false}});if(F){G.observe("submit",function(H){E.onFormSubmitted(H)});G.select('input[type="submit"]').each(function(H){H.observe("click",function(I){E.onButtonClicked(I)})})}})}else{if(this.options.forceProxyClass){B=this.element.select("form."+this.options.forceProxyClass);B.each(function(F){$(F).observe("submit",function(G){E.onFormSubmitted(G)})})}}},onLinkClicked:function(D){debug("ComCore.AjaxProxy.onLinkClicked()");try{var C=Event.findElement(D,"a");if(C&&(C!=document)){var A=C.readAttribute("href");if(C.up(".no-proxy")&&A=="#"){debug("No proxy execution, executing javascript instead.");return true}if(A){this.get(A)}}}catch(B){debug(B)}Event.stop(D)},onButtonClicked:function(D){debug("ComCore.AjaxProxy.onButtonClicked()");var B=D.findElement('input[type="submit"]');var C=D.findElement("form");if(C&&B){var E=C.down('input[name="action"]');if(E&&E.getValue()==="__button"){var A=B.name.replace("__bta","");A=A.substring(0,1).toLowerCase()+A.substring(1);E.setValue(A)}}},onFormSubmitted:function(D){debug("ComCore.AjaxProxy.onFormSubmitted("+D+")");try{var C=Event.findElement(D,"form");if(C){var E=C.serialize();var A=C.attr("action");if(A){this.post(A,E)}Event.stop(D)}}catch(B){debug(B);Event.stop(D)}},onFormSubmittedAlternative:function(C){debug("ComCore.AjaxProxy.onFormSubmittedAlternative("+C+")");try{var D=C.serialize();var A=C.readAttribute("action");if(A){this.post(A,D)}}catch(B){debug(B)}},get:function(A){var B=this;ComCore.LoadingIndicator.show();if(this.options.extraParam){A+=((A.indexOf("?")>0||A.indexOf("=")>0)?"&":(A.indexOf("&")>0?"&":"?"))+this.options.extraParam+"=1"}var C=new Ajax.Request(A,{method:"get",onSuccess:B.onGetSuccess.bind(B),onFailure:B.onGetFailure.bind(B)})},onGetSuccess:function(B,A){this.onProxySuccess(B,A,"get")},onGetFailure:function(A){this.onProxyFailure(A,"get")},post:function(A,D){var B=this;ComCore.LoadingIndicator.show();if(A.indexOf("#")!==-1){A=A.substring(0,A.indexOf("#"));debug("Stripped #hash from url: "+A)}if(this.options.extraParam){if(typeof D==="string"){D+="&"+this.options.extraParam+"=1"}else{if(!D){D={}}D[this.options.extraParam]="1"}}var C=new Ajax.Request(A,{method:"post",parameters:D,onSuccess:B.onPostSuccess.bind(B),onFailure:B.onPostFailure.bind(B)})},onPostSuccess:function(B,A){this.onProxySuccess(B,A,"post")},onPostFailure:function(A){this.onProxyFailure(A,"post")},onProxySuccess:function(C,A,B){debug("ComCore.AjaxProxy.onProxySuccess()");ComCore.AjaxResponse.loginIsRequired(C,A);this.proxySuccessCallBacks.each(function(E){try{E(C,A)}catch(D){debug("Could not execute proxy-success-callback ("+B+")");debug(D)}})},onProxyFailure:function(B,A){this.proxyFailureCallBacks.each(function(D){try{D(B)}catch(C){debug("Could not execute proxy-failure-callback ("+A+")");debug(C)}})},_eoo:true});ComCore.Dialog={options:{},initialLoad:true,ajaxProxy:null,initialize:function(B){debug("ComCore.Dialog.initialize()");ComCore.Dialog.initialLoad=true;ComCore.Dialog.options={dialogID:"dialog",dialogPlaceHolderID:"dialogPlaceHolder",closeDialogLinkID:"closeDialogLink",width:500,position:{vertical:"middle",horizontal:"middle"},transitions:false,"max-height":"auto","min-max-height":100,"min-margin-top":10,"min-margin-left":10,closeCallBacks:[],proxyIgnoreClass:"ignore-proxy",getProxyIgnoreClass:"ignore-proxy-get",postProxyIgnoreClass:"ignore-proxy-post",resultLinkClass:"dialog-result",exitCallBacks:[],setContentSuccessCallBacks:[],proxyFailureCallBacks:[],closeOnProxyFailure:true,initialContent:"",unSkippable:false,removeOnClose:true,removeOnExit:true,placeHolderClass:false,closeOnEsc:true,closeOnPlaceHolderClicked:true,noHidingIframes:false,formSubmitCallBacks:[],resizeOnViewportChange:true};ComCore.Dialog.setOptions(B);ComCore.Dialog.dialogPlaceHolder=$(ComCore.Dialog.options.dialogPlaceHolderID);if(!ComCore.Dialog.dialogPlaceHolder){ComCore.Dialog.createPlaceHolder()}if(ComCore.Dialog.options.placeHolderClass){ComCore.Dialog.dialogPlaceHolder.addClassName(ComCore.Dialog.options.placeHolderClass)}else{$w(ComCore.Dialog.dialogPlaceHolder.className).each(function(C){ComCore.Dialog.dialogPlaceHolder.removeClassName(C)})}ComCore.Dialog.dialog=$(ComCore.Dialog.options.dialogID);if(!ComCore.Dialog.dialog){ComCore.Dialog.createDialog()}if(this.ajaxProxy===null){var A={proxyIgnoreClasses:[this.options.proxyIgnoreClass,this.options.resultLinkClass],getProxyIgnoreClass:this.options.getProxyIgnoreClass,postProxyIgnoreClass:this.options.postProxyIgnoreClass,extraParam:"__dialog"};this.ajaxProxy=new ComCore.AjaxProxy(ComCore.Dialog.options.dialogID,A);this.ajaxProxy.registerProxySuccessCallBack(this.onProxyContentSuccess);this.ajaxProxy.registerProxyFailureCallBack(this.onProxyContentFailure)}ComCore.Dialog.initKeyStrokes();ComCore.Dialog.hideEmbeds=(Prototype.Browser.IE||Prototype.Browser.Opera||Prototype.Browser.Chrome);ComCore.Dialog.hideSelects=Prototype.Browser.IE6;if(ComCore.Dialog.hideEmbeds){this.pageEmbeds=$$("embed");this.pageObjects=$$("object");if(!ComCore.Dialog.options.noHidingIframes){this.pageIFrames=$$("iframe")}this.pageSelects=$$("select")}if(ComCore.Dialog.options.resizeOnViewportChange){Event.observe(window,"resize",(function(){debug("resizing dialog...");this.resize();this.position()}).bind(this))}},setOptions:function(A){Object.extend(ComCore.Dialog.options,A||{})},getContent:function(A){this.ajaxProxy.get(A)},postContent:function(A,B){this.ajaxProxy.post(A,B)},onFormSubmitCallback:function(A){ComCore.Dialog.options.formSubmitCallBacks.each(function(B){B(A)})},onProxyContentSuccess:function(C,A){if(A&&A.Dialog&&A.Dialog.forward){ComCore.Dialog.hide();ComCore.LoadingIndicator.show();ComCore.forward(A.Dialog.forward)}else{if(A&&A.Dialog&&A.Dialog.close){ComCore.Dialog.close()}else{if(A&&A.Dialog&&A.Dialog.exit){if(A.Dialog.exit.returnObj){ComCore.Dialog.exit(A.Dialog.exit.returnObj)}else{ComCore.Dialog.exit()}}else{var B="";if(ComCore.Dialog.options.unSkippable===false){B+=ComCore.Dialog.getCloseDialogLinkHTML()}B+=C.responseText;ComCore.Dialog.setContent(B)}}}},onProxyContentFailure:function(A){if(ComCore.Dialog.options.closeOnProxyFailure){ComCore.Dialog.exit(null)}ComCore.Dialog.options.proxyFailureCallBacks.each(function(C){try{C(A,"get")}catch(B){debug("Could not execute proxy-failure-callback");debug(B)}})},setContent:function(B,C){try{if(C===true){B=ComCore.Dialog.getCloseDialogLinkHTML()+B}ComCore.Dialog.dialog.update(B);ComCore.Dialog.dialog.select("img").each(function(D){D.onload=function(){ComCore.Dialog.queueReposition()}});if(ComCore.Dialog.options.formSubmitCallBacks.length){ComCore.Dialog.dialog.select("form").each(function(D){$(D).observe("submit",ComCore.Dialog.onFormSubmitCallback)})}if(ComCore.Dialog.options.unSkippable===false){ComCore.Dialog.closeLink=$("closeDialogLink");if(ComCore.Dialog.closeLink){Event.observe(ComCore.Dialog.closeLink,"click",ComCore.Dialog.onClose,false)}}this.ajaxProxy.observe();ComCore.Dialog.show();ComCore.LoadingIndicator.hide();ComCore.Dialog.options.setContentSuccessCallBacks.each(function(E){try{E()}catch(D){debug("Could not execute success-callback");debug(D)}})}catch(A){debug(A);ComCore.LoadingIndicator.hide()}},queueReposition:function(){if(!ComCore.Dialog.dialog){return }if(this._repositionQueued){return }this._repositionQueued=true;window.setTimeout(function(){ComCore.Dialog.resize();ComCore.Dialog.position();ComCore.Dialog._repositionQueued=false},300)},show:function(){if(window.doNotShowDialog){ComCore.LoadingIndicator.hide();return }try{if(ComCore.Dialog.hideEmbeds){this.pageObjects.each(function(B){B.setStyle({visibility:"hidden"})});this.pageEmbeds.each(function(B){B.setStyle({visibility:"hidden"})});this.pageIFrames.each(function(B){B.setStyle({visibility:"hidden"})});if(ComCore.Dialog.hideSelects){this.pageSelects.each(function(B){B.setStyle({visibility:"hidden"})})}}}catch(A){debug(A)}ComCore.Dialog.dialogPlaceHolder.show();ComCore.Dialog.resize();ComCore.Dialog.position();ComCore.Dialog.dialog.setStyle({visibility:"visible"});if($("tooltip")){$("tooltip").hide()}if(ComCore.Dialog.dialogPlaceHolder.getStyle("position")==="absolute"){$("headerWrapper").scrollTo()}},hide:function(){ComCore.Dialog.dialog.setStyle({visibility:"hidden"});try{if(ComCore.Dialog.hideEmbeds){this.pageObjects.each(function(B){B.setStyle({visibility:"visible"})});this.pageEmbeds.each(function(B){B.setStyle({visibility:"visible"})});this.pageIFrames.each(function(B){B.setStyle({visibility:"visible"})});if(ComCore.Dialog.hideSelects){this.pageSelects.each(function(B){B.setStyle({visibility:"visible"})})}}}catch(A){}ComCore.Dialog.dialogPlaceHolder.hide();ComCore.LoadingIndicator.hide()},hideCloseLink:function(){var A=$(ComCore.Dialog.options.closeDialogLinkID);if(A){A.hide()}},remove:function(){ComCore.Dialog.dialog.update("")},close:function(){if(ComCore.Dialog.options.unSkippable===false){ComCore.Dialog.hide();if(ComCore.Dialog.options.removeOnClose){ComCore.Dialog.remove()}ComCore.Dialog.options.closeCallBacks.each(function(B){try{B()}catch(A){debug("Could not execute close-callback");debug(A);ComCore.LoadingIndicator.hide()}})}},exit:function(A){ComCore.Dialog.hide();if(ComCore.Dialog.options.removeOnExit){ComCore.Dialog.remove()}ComCore.Dialog.options.exitCallBacks.each(function(C){try{C(A)}catch(B){debug("Could not execute exit-callback");debug(B)}})},position:function(){var E;if(ComCore.Dialog.options.position.vertical==="middle"){var B=ComCore.Dialog.dialog.getDimensions().height;var A=document.viewport.getHeight();E=Math.floor((A-B)/2);E=(E<ComCore.Dialog.options["min-margin-top"])?ComCore.Dialog.options["min-margin-top"]:E}else{E=ComCore.Dialog.options.position.vertical}var C;if(ComCore.Dialog.options.position.horizontal==="middle"){var F=ComCore.Dialog.dialog.getDimensions().width;var D=document.viewport.getWidth();C=Math.floor((D-F)/2);C=(C<ComCore.Dialog.options["min-margin-left"])?ComCore.Dialog.options["min-margin-left"]:C}else{C=ComCore.Dialog.options.position.horizontal}ComCore.Dialog.dialog.setStyle({marginTop:E+"px",marginLeft:C+"px",marginRight:C+"px"})},resize:function(){var A=ComCore.Dialog.options.width;ComCore.Dialog.dialog.setStyle({width:A+"px"});ComCore.Dialog.dialog.setStyle({height:"auto"});var B=ComCore.Dialog.getMaxHeight();var C=(ComCore.Dialog.dialog.getDimensions().height>B)?B+"px":"auto";ComCore.Dialog.dialog.setStyle({height:C})},getMaxHeight:function(){var A=ComCore.Dialog.options["max-height"];if(ComCore.Dialog.options["max-height"]==="auto"){A=document.viewport.getHeight();A-=(2*ComCore.Dialog.options["min-margin-top"]);A-=55;if((ComCore.Configuration.get("chatBar","enabled")===true)&&$("hud")){A-=$("hud").getHeight()+40}}if(A<ComCore.Dialog.options["min-max-height"]){A=ComCore.Dialog.options["min-max-height"]}return A},registerExitCallBack:function(A){ComCore.Dialog.options.exitCallBacks.push(A)},replaceExitCallBacks:function(A){ComCore.Dialog.options.exitCallBacks=[A]},registerCloseCallBack:function(A){ComCore.Dialog.options.closeCallBacks.push(A)},replaceCloseCallBacks:function(A){ComCore.Dialog.options.closeCallBacks=[A]},registerSetContentSuccessCallback:function(A){ComCore.Dialog.options.setContentSuccessCallBacks.push(A)},registerProxySuccessCallback:function(A){ComCore.Dialog.ajaxProxy.registerProxySuccessCallBack(A)},registerProxyFailureCallback:function(A){ComCore.Dialog.ajaxProxy.registerProxyFailureCallback(A)},createPlaceHolder:function(){$(document.body).insert({bottom:ComCore.Dialog.getPlaceHolderHTML()});ComCore.Dialog.dialogPlaceHolder=$(ComCore.Dialog.options.dialogPlaceHolderID);Event.observe(ComCore.Dialog.dialogPlaceHolder,"click",function(A){if(Event.element(A)===ComCore.Dialog.dialogPlaceHolder){if(ComCore.Dialog.options.closeOnPlaceHolderClicked){ComCore.Dialog.close()}}},false)},createDialog:function(){ComCore.Dialog.dialogPlaceHolder.update(ComCore.Dialog.getDialogHTML());ComCore.Dialog.dialog=$(ComCore.Dialog.options.dialogID)},getPlaceHolderHTML:function(){var A=new Template('<div id="#{ID}" style="display: none;"></div>');var C={ID:ComCore.Dialog.options.dialogPlaceHolderID};var B=A.evaluate(C);return B},getDialogHTML:function(){var A=new Template('<div id="#{ID}" style="visibility: hidden;">#{content}</div>');var C={ID:ComCore.Dialog.options.dialogID,content:ComCore.Dialog.options.initialContent};var B=A.evaluate(C);return B},getCloseDialogLinkHTML:function(){var A=new Template('<a href="#" id="#{id}" class="#{class} swapUnderlineIcons right"><span>#{text}</span> <img src="'+ComCore.Configuration.get("staticURL")+'/s/i/common/blank.gif" class="icon iconDelete" alt="" /></a>');var B={id:ComCore.Dialog.options.closeDialogLinkID,"class":ComCore.Dialog.options.proxyIgnoreClass,text:ComCore.Language.get("close")};return A.evaluate(B)},setUnSkippable:function(A){if(A&&A!==false){ComCore.Dialog.options.unSkippable=true}else{ComCore.Dialog.options.unSkippable=false}ComCore.Dialog.closeLink=$("closeDialogLink");if(ComCore.Dialog.closeLink){if(A){ComCore.Dialog.closeLink.hide()}else{ComCore.Dialog.closeLink.show()}}},onClose:function(A){ComCore.Dialog.close();Event.stop(A)},initKeyStrokes:function(){Event.observe(document,"keyup",function(B){var A=B.which||B.keyCode;if(A===Event.KEY_ESC){if(ComCore.Dialog.options.closeOnEsc){ComCore.Dialog.close()}}})}};ComCore.Pager=Class.create({initialize:function(A){debug("Pager.initialize()");this.currentPage=1;this.itemCount=0;this.offset=15;this.showPageCallback=null;this.pagerWrapper=$("pagerWrapper");if(A){this.offset=A.offset?A.offset:this.offset;this.showPageCallback=A.showPageCallback?A.showPageCallback:this.itemsPerPage;this.pagerWrapper=A.pagerWrapper?A.pagerWrapper:this.pagerWrapper}this.pagerWrapper.observe("click",this.onPagerWrapperClicked.bind(this))},setItemCount:function(A){debug("Pager.setItemCount("+A+")");this.itemCount=parseInt(A,10)},getStart:function(){return(parseInt(this.currentPage,10)-1)*parseInt(this.offset,10)},getOffset:function(){return parseInt(this.offset,10)},getNrOfPages:function(){return Math.ceil(this.itemCount/this.offset)},getCurrentPage:function(){return this.currentPage},onPagerWrapperClicked:function(A){debug("Pager.onPagerWrapperClicked()");if(A.findElement("a.pageLink")){this.onPagerClicked(A)}},onPagerClicked:function(C){var B=C.findElement("a.pageLink");var A=parseInt(B.getClassData("page"),10);this.showPage(A);C.stop()},showPage:function(A){debug("Pager.showPage("+A+")");this.currentPage=parseInt(A,10);if(Object.isFunction(this.showPageCallback)){this.showPageCallback(this.currentPage)}else{$$(".thumb").invoke("hide");$$(".thumb_page_"+A).invoke("show")}},draw:function(){debug("Pager.draw()");var F=$(this.pagerWrapper);var G=this.getNrOfPages();var B=new Element("p",{"class":"paging clearfix"});if(G>1){var C=1;var H=G;var I="";if(G>this.getAroundLimit()){C=this.getCurrentPage()-this.getAroundPages();if(C<=1){C=1}else{B.insert(" ... ")}var A=0;if(this.getCurrentPage()===2){A=1}else{if(this.getCurrentPage()===1){A=2}}H=this.getCurrentPage()+this.getAroundPages()+A;if(H>G){H=G}else{I=" ... "}}debug("writing pager (right: "+H+", left:"+C+")");var E=null;for(var D=C;D<=H;D++){if(D===this.currentPage){E=new Element("strong").update(D)}else{E=new Element("a",{href:"#","class":"pageLink page_"+D}).update(D)}B.insert(E);B.insert(" ")}B.insert(I)}F.update(B)},getAroundPages:function(){return 2},getAroundLimit:function(){return 2},_eoo:true});ComCore.PagedList=Class.create({element:null,pager:null,items:[],_itemElements:[],options:{},_selectedItems:{},_selectedItemsArray:[],_selectedItemsCount:0,_firstItemSelected:false,initialize:function(C,B,D){debug("PagedList.initialize()");debug(B);this.element=$(C);this.items=B;this.options=Object.extend({offset:21,ulClass:"list",itemsPerRow:2,selectItemCallBack:null,onMinSelect:null,minSelect:0,maxSelect:0,onMaxSelect:null,rotateSelection:false,selectedClass:"selected",deSelectedClass:false,keepSelection:true,stopEvent:true},D);this._itemElements=[];this._selectedItems={};this._selectedItemsArray=[];this._selectedItemsCount=0;this._firstItemSelected=false;this.ul=new Element("ul",{"class":this.options.ulClass}).update("");this.element.insert({top:this.ul});var A=this.element.down("div.pagerWrapper");if(!A){A=new Element("div",{"class":"pagerWrapper clearfix"});this.element.insert({bottom:A})}var F=this;var E={offset:this.options.offset,pagerWrapper:A,showPageCallback:F.showPageCallback.bind(F)};this.pager=new ComCore.Pager(E);debug(B);debug("pager.setItemCount()");debug(B.length);this.pager.setItemCount(B.length);this.drawItems();this.showPageCallback(1);this.element.observe("click",this.onListClicked.bind(this))},onListClicked:function(D){var A=D.findElement("li");if(A){var B=parseInt(A.getClassData("index"),10);var C=this.items[B];this.onItemClicked(D,B,C)}},onItemClicked:function(D,B,C){debug("PagedList.onItemClicked()");var A=D.findElement("li");if(this.options.keepSelection){if(A.hasClassName(this.options.selectedClass)){this.deSelectItem(B)}else{this.selectItem(B)}}if(this.options.stopEvent&&D){D.stop()}},selectItem:function(B){debug("PagedList.selectItem()");if(this.options.maxSelect>0){if(this._selectedItemsCount>=this.options.maxSelect){debug("PagedList.onItemClicked maxSelect reached");if(Object.isFunction(this.options.onMaxSelect)){this.options.onMaxSelect(B);return }if(this.options.rotateSelection===true){var A=this._selectedItemsArray.shift();this.deSelectItem(A,false)}}}try{this._itemElements[B].addClassName(this.options.selectedClass);if(this.options.deSelectedClass){this._itemElements[B].removeClassName(this.options.deSelectedClass)}this._selectedItems[B]=true;this._selectedItemsArray.push(B);this._selectedItemsCount=this._selectedItemsCount+1}catch(C){debug(C)}if(this._firstItemSelected===false){debug("deselect class added to all others");if(this.options.deSelectedClass){this.items.each(function(F,E){if(E!==B){this._itemElements[E].addClassName(this.options.deSelectedClass)}},this)}this._firstItemSelected=true}try{if(Object.isFunction(this.options.selectItemCallBack)){this.options.selectItemCallBack(this.items[B])}}catch(D){debug(D)}},deSelectItem:function(A,C){if((this.options.minSelect>0)&&(C!==false)){if(this._selectedItemsCount<=this.options.minSelect){debug("PagedList.onItemClicked minSelect reached");if(Object.isFunction(this.options.onMinSelect)){this.options.onMinSelect(A)}return }}debug("PagedList.deSelectItem()");try{this._itemElements[A].removeClassName(this.options.selectedClass);if(this.options.deSelectedClass){this._itemElements[A].addClassName(this.options.deSelectedClass)}delete (this._selectedItems[A]);this._selectedItemsCount=this._selectedItemsCount-1}catch(B){debug(B)}},getSelectedItems:function(){return this._selectedItems},drawItems:function(){this.element.hide();var A=this;this.items.each(function(E,D){var C=A.drawItem(E,D);var B=new Element("li",{"class":"index_"+D+(((D%A.options.itemsPerRow)===0)?" clearBoth":"")}).update(C);A.ul.insert({bottom:B});B.hide();A._itemElements.push(B)});this.element.show()},showPageCallback:function(C){debug("PagedList.showItems("+C+")");var D=this.pager.getStart();var B=this.pager.getOffset();this._itemElements.invoke("hide");var A=this._itemElements.slice(D,D+B);A.invoke("show");this.pager.draw()},drawItem:function(B,A){debug("implement me");return""},_eoo:true});ComCore.PeopleList=Class.create(ComCore.PagedList,{initialize:function($super,B,A,C){C=Object.extend({offset:6,ulClass:"profileList",itemsPerRow:3},C);$super(B,A,C)},drawItem:function(C,B){var A={userID:C.u,nickname:C.n,thumbnailURL:C.avatar,displayName:C.d,gender:C.g};if(C.ut){A.userType=C.ut}return new ComCore.Avatar(A).getResult()},onItemClicked:function($super,D,B,C){$super(D,B,C);var A=D.findElement("div.avatar");if(A){A.toggleClassName("selected")}},_eoo:true});ComCore.ActionStateMessage=Class.create({wrapperElement:null,contentElement:null,options:null,counter:0,initialize:function(A){this.options=Object.extend({closeClass:"closeActionStateMessage"},A)},show:function(E,F,C){C=Object.extend({time:3,sticky:false,width:500},C);var D='<img src="'+ComCore.Configuration.get("staticURL")+'/s/i/common/blank.gif" class="icon iconClose '+this.options.closeClass+'" alt="" />';this._setContent(D+F);if(ComCore.LoadingIndicator){ComCore.LoadingIndicator.hide()}debug("actionstatemessage options:");debug(C);if(C.onShowFunction){C.onShowFunction(this.wrapperElement,C)}var A=E.charAt(0).toUpperCase()+E.substr(1).toLowerCase();this.divElement.setClassData("actionStateMessage",A,{glue:""});this.divElement.setStyle({width:C.width+"px"});this.contentElement.setStyle({width:(C.width-100)+"px"});this.wrapperElement.show();this.counter=this.counter+1;var B=this.counter;if(!C.sticky){this.setHideTimeout(C,B)}this.wrapperElement.observe("mouseenter",function(){clearTimeout(this.timer)}.bind(this));this.wrapperElement.observe("mouseleave",function(){if(!C.sticky){this.setHideTimeout(C,B)}}.bind(this));this.wrapperElement.observe("mouseover",function(){clearTimeout(this.timer);if(this.effect){this.effect.cancel()}this.wrapperElement.show();this.wrapperElement.setStyle({opacity:1})}.bind(this))},setHideTimeout:function(B,A){if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout((function(){this.hide({effect:true,counter:A})}).bind(this),(B.time*1000))},onClick:function(A){if(A.findElement("img."+this.options.closeClass)){this.hide();A.stop()}},hide:function(A){A=Object.extend({effect:false,effectDuration:2,counter:undefined},A);if(A.counter!==undefined){if(A.counter!==this.counter){return false}}if(A.effect){this.effect=new Effect.Fade(this.wrapperElement,{duration:A.effectDuration,afterFinish:(function(){}).bind(this)})}else{if(this.wrapperElement){this.wrapperElement.hide()}}},hideStatusMessages:function(){$$(".statusMessage").invoke("remove")},_setContent:function(A){if(!this.wrapperElement){this._createElement()}this.contentElement.update(A)},_createElement:function(){if(!this.wrapperElement){this.divElement=new Element("div",{"class":"clearfix actionStateMessage"});this.contentElement=new Element("div",{"class":"text"});this.iconElement=new Element("div",{"class":"actionStateIcon"});this.divElement.insert(this.iconElement);this.divElement.insert(this.contentElement);this.wrapperElement=$("actionStateWrapper");this.wrapperElement.update(this.divElement);this.contentElement=$(this.wrapperElement).down("div.text");this.wrapperElement.observe("click",this.onClick.bind(this))}},_eoo:true});ComCore.ActionStateMessage=new ComCore.ActionStateMessage();ComCore.TabManager=Class.create({debug:function(A){},initialize:function(B,A){this.debug("TabManager.initialize()");var C=this;this.tabContainer=$(B);this.tabCallbackFunction=A;this.tabList=$(B).down("ul.tabList");this.links=$A(this.tabList.getElementsByTagName("a"));this.menu=[];this.links.each(function(D){D=$(D);if(!D.hasClassName("ignore-tab")){C.menu.push(D)}});this.menu=$A(this.menu);this.show(this.getInitialTab());this.menu.each(function(D){this.setupTab(D)}.bind(C))},setupTab:function(A){this.debug("TabManager.setupTab()");$(A).observe("click",this.activate.bindAsEventListener(this));$(A).up().removeClassName("default-selected");$(A).removeClassName("default-selected");$(this.tabID(A)).removeClassName("default-active-tab")},activate:function(B){this.debug("TabManager.activate()");var A=B.findElement("a");B.stop();this.show(A);this.menu.without(A).each(this.hide.bind(this));if(this.tabCallbackFunction){this.tabCallbackFunction(A)}},hide:function(A){this.debug("TabManager.hide()");$(A).up().removeClassName("selected");$(A).removeClassName("selected");$(this.tabID(A)).removeClassName("active-tab")},show:function(A){this.debug("TabManager.show()");$(A).up().addClassName("selected");$(A).addClassName("selected");$(this.tabID(A)).addClassName("active-tab")},tabID:function(A){this.debug("TabManager.tabID()");return A.href.match(/#(\w.+)/)[1]},showTabByID:function(B){var A=this._findLinkForID(B);if(A){this.show(A);this.menu.without(A).each(this.hide.bind(this));if(this.tabCallbackFunction){this.tabCallbackFunction(A)}}},_findLinkForID:function(A){el=this.menu.find(function(B){return(B.href.match(/#(\w.+)/)[1]==A)});return el},getInitialTab:function(){this.debug("TabManager.getInitialTab()");var A=null;if(document.location.href.match(/#(\w.+)/)){var B=RegExp.$1;A=this.menu.find(function(C){return C.href.match(/#(\w.+)/)[1]==B});return A||this.menu.first()}else{A=this.menu.find(function(C){return $(C).up().hasClassName("default-selected")});return A||this.menu.first()}},_eoo:true});ComCore.FileLoader.fileLoaded("/s/j/classes/class.tabmanager.js");var ExclusiveAction=function(A){this.attempt=function(D){for(var B=D;B!==null;B=ExclusiveAction.next(B.id)){if(B.enter||(B.number&&(B.number<this.number||(B.number==this.number&&B.id<this.id)))){var C=this;return setTimeout(function(){C.attempt(B)},200)}}this.criticalSection();this.number=0;ExclusiveAction.waitList[this.id]=null};this.id=++ExclusiveAction.commandID;this.criticalSection=A;ExclusiveAction.waitList[this.id]=this;this.enter=true;this.number=(new Date()).getTime();this.enter=false;this.attempt(ExclusiveAction.next())};ExclusiveAction.waitList={};ExclusiveAction.commandID=0;ExclusiveAction.next=function(A){for(i in ExclusiveAction.waitList){if(!A){return ExclusiveAction.waitList[i]}if(A==i){A=null}}return null};ComCore.DateManager=Class.create();ComCore.DateManager.prototype={initialize:function(A,C,B){this.day=$(A);this.month=$(C);this.year=$(B);this.month.observe("change",this.onDateChanged.bindAsEventListener(this));this.year.observe("change",this.onDateChanged.bindAsEventListener(this))},getDaysInMonth:function(C,B){var A=31;if(C==4||C==6||C==9||C==11){A=30}if(C==2){if(B>0&&(B/4)!=Math.floor(B/4)){A=28}else{A=29}}return A},onDateChanged:function(G){var C=Form.Element.getValue(this.day);var F=Form.Element.getValue(this.month);var D=Form.Element.getValue(this.year);var H=this.getDaysInMonth(F,D);var E=this.day.options.length;if(this.day.options[0].value==-1){E--}if(E>H){for(i=0;i<(E-H);i++){this.day.options[this.day.options.length-1]=null}}if(H>E){for(i=0;i<(H-E);i++){var B=document.createElement("option");B.value=E+i+1;B.text=E+i+1;if(document.all){this.day.add(B)}else{this.day.add(B,null)}}}if(this.day.options[this.day.selectedIndex].value!=-1){var A=this.getDaysInMonth(F,D);this.day.selectedIndex=(C>A?A-1:this.day.selectedIndex)}},_eoo:true};var CountryChooser=Class.create();var CountryChooserAjax=Class.create();var CountryOnlyChooserAjax=Class.create();CountryChooserAjax.prototype={initialize:function(A,C,B){if($(A)){this.countrySelect=$(A);Event.observe(this.countrySelect,"change",this.onCountryChanged.bindAsEventListener(this),false)}if($(C)){this.regionSelect=$(C);Event.observe(this.regionSelect,"change",this.onRegionChanged.bindAsEventListener(this),false)}if(B){this.callback=B}if($("allRegionsOption")){this.allRegionsOption=$("allRegionsOption")}this.reset=false},onRegionChanged:function(A){if(this.callback){this.callback.call(this,this.countrySelect.value,this.regionSelect.value)}},onCountryChanged:function(E){var C=this.countrySelect.getValue();if(C==-1){this.onRegionsLoaded();return }var B=ComCore.Page.buildAjaxURL(null,"getRegionsByCountry")+"&country="+C;var A=this.onRegionsLoaded.bindAsEventListener(this);var D=new Ajax.Request(B,{method:"get",onSuccess:A})},onRegionsLoaded:function(D){if(!D||D.responseText===""){$(this.regionSelect).hide();if(this.callback){this.callback.call(this,this.countrySelect.value,false)}}else{$(this.regionSelect).show();var E=D.responseText.evalJSON();var A="";while(this.regionSelect.firstChild){this.regionSelect.removeChild(this.regionSelect.firstChild)}var C=null;if(this.countrySelect.value!="--"&&this.allRegionsOption){option=document.createElement("option");option.value="-1";option.text=this.allRegionsOption.value;if(document.all){this.regionSelect.add(option)}else{this.regionSelect.add(option,null)}}debug(E);for(var B=0;B<E.length;B++){option=document.createElement("option");debug(option);option.value=E[B].regioncode;option.text=E[B].name;if(document.all){this.regionSelect.add(option)}else{this.regionSelect.add(option,null)}}if(this.callback){this.callback.call(this,this.countrySelect.value,this.regionSelect.value)}if(this.reset!==false){this.regionSelect.value=$("resetRegion").value;this.reset=false}}}};CountryOnlyChooserAjax.prototype={initialize:function(A,B){if($(A)){this.countrySelect=$(A);Event.observe(this.countrySelect,"change",this.onCountryChanged.bindAsEventListener(this),false)}if($(B)){this.regionSelect=$(B)}},onCountryChanged:function(E){var C=Form.Element.getValue(this.countrySelect);$(this.regionSelect).hide();if(C==-1){return }if(C=="--"){var B=ComCore.Page.buildAjaxURL(null,"getRegionsByCountry")+"&country="+C;var A=this.onRegionsLoaded.bindAsEventListener(this);var D=new Ajax.Request(B,{method:"get",onSuccess:A})}},onRegionsLoaded:function(D){$(this.regionSelect).show();var E=D.responseText.evalJSON();var B="";while(this.regionSelect.firstChild){this.regionSelect.removeChild(this.regionSelect.firstChild)}for(var C=0;C<E.length;C++){var A=document.createElement("option");A.value=E[C].regioncode;A.text=E[C].name;if(document.all){this.regionSelect.add(A)}else{this.regionSelect.add(A,null)}}}};CountryChooser.prototype={initialize:function(A,B){this.countrySelect=$(A);this.lastCountryCode=Form.Element.getValue(this.countrySelect);this.regionPrefix=!B?"locations_":B;this.countrySelect.onchange=this.onCountryChange.bindAsEventListener(this)},onCountryChange:function(A){if($(this.regionPrefix+this.lastCountryCode)){$(this.regionPrefix+this.lastCountryCode).hide()}this.lastCountryCode=Form.Element.getValue(this.countrySelect);if($(this.regionPrefix+this.lastCountryCode)){$(this.regionPrefix+this.lastCountryCode).show()}}};ComCore.AccordionMenu=Class.create();ComCore.AccordionMenu.prototype={ul:null,menuItem:[],subMenus:[],options:{},initialize:function(B,A){var C=this;this.options=Object.extend({useEffects:false,effectDuration:0.4,subMenuSelector:"ul"},A);this.ul=$(B);this.menuItems=$(B).select("a.menuItem");this.subMenus=$(B).select(this.options.subMenuSelector);this.menuItems.each(function(D){D.observe("click",C.onMenuItemClicked.bind(C))})},onMenuItemClicked:function(C){var A=C.element();var B=C.findElement("li").down(this.options.subMenuSelector);if(this.showSubMenu(B,A)){C.stop()}},showSubMenu:function(D,B){if(!D){return false}var C=D.visible();this.hideAll();if(!C){if(B){B.addClassName("selected")}if(this.options.useEffects){var A=Effect.BlindDown(D,{duration:this.options.effectDuration})}else{D.show()}}return true},hideAll:function(){var A=this;this.menuItems.each(function(B){B.removeClassName("selected")});this.subMenus.each(function(C){if(C.visible()){if(A.options.useEffects){var B=Effect.BlindUp(C,{duration:A.options.effectDuration})}else{C.hide()}}})},_eoo:true};ComCore.SearchHelper=Class.create();ComCore.SearchHelper.prototype={options:{},initialize:function(A,D,B){this.options=Object.extend({entries:null,selectItemCallBack:null},B);if(A&&typeof (A)!=="undefined"&&D&&typeof (D)!=="undefined"){var C="(?:(?:^| +)[\"'.\\-]+ *)|(?: *['\".\\-]+(?: +|$)|[@_]| +)";var E="((?:(?:^| +)[\"'.\\-]+ *)|(?: *['\".\\-]+(?: +|$)|[@_]| +))";this._keypressNotWorking=(ComCore.UserAgent.ie()<8)||(ComCore.UserAgent.safari()>500&&ComCore.UserAgent.safari()<523||ComCore.UserAgent.safari()>=525);this.searchbox=A;this.searchresults=D;this.searchresults.insert({before:"<br />"});this._maxMatches=5;this._cache={};this._loadingEntries=false;this._entriesLoaded=false;this._entries=false;this._currentValue="";this._currentMatches=[];this._currentRenderedResults=false;this._currentSelection=false;this._splitRegex=new RegExp(C,"g");this._captureRegex=new RegExp(E,"g");this.searchbox.observe("focus",this._onfocus.bind(this));this.searchbox.observe("keydown",this._onkeydown.bind(this));this.form=this.searchbox.up("form");if(this.form){this.form.observe("submit",this._onsubmit.bind(this))}}if(this.options&&(this.options.entries!==null)&&(this.options.entries!==undefined)){this._entries=this.options.entries;this._loadingEntries=false;this._entriesLoaded=true}if(this.options&&this.options.preLoad){if(this.searchbox.getValue().length>0){this._onfocus();window.setTimeout(this.lookupValue.bind(this),10)}}$(document).observe("click",(function(F){this.hide()}).bind(this))},_onkeydown:function(A){debug("SearchHelper._onkeypress()");if(this.options.entries===null){this._onfocus()}A=A||window.event;if(A){switch(A.keyCode){case Event.KEY_TAB:this.hide();break;case Event.KEY_DOWN:this._selectNext();break;case Event.KEY_UP:this._selectPrevious();break;case Event.KEY_RETURN:break;default:window.setTimeout(this.lookupValue.bind(this),10);break}}},_onsubmit:function(A){debug("SearchHelper._onsubmit()");if(this._currentSelection!==false){A.stop();this._selectCurrent(A);return false}},_onblur:function(A){window.setTimeout(this._blur.bind(this),100)},_onfocus:function(A){debug("please implement")},_onloaded:function(B,A){this._loadingEntries=false;this._entriesLoaded=true;if(!A.success){return false}this._entries=B.responseText.evalJSON()},_onmouseover:function(B){var A=B.findElement("li");A.addClassName("active");this._currentSelection=parseInt(A.id.replace(/autocomplete/i,""),10)},_onmouseout:function(B){var A=B.findElement("li");A.removeClassName("active");this._currentSelection=false},_blur:function(){if(!ComCore.Configuration.get("debug")){this.searchresults.update("");this.searchresults.hide()}},hide:function(){this.searchresults.hide()},visible:function(){this.searchresults.visible()},getActiveSelectedElement:function(){var A=this._currentMatches[this._currentSelection];var B=this._entries[A];return B},_selectCurrent:function(C){if(Object.isFunction(this.options.selectItemCallBack)){var A=this._currentMatches[this._currentSelection];var B=this._entries[A];this.options.selectItemCallBack(C,null,A,B,this);this._currentSelection=false}else{window.location=this.getEntryURL(this._entries[this._currentMatches[this._currentSelection]])}},_selectPrevious:function(){debug("_selectPrevious");if(this._currentSelection<=0){this._currentSelection=this._currentMatches.length}this._currentSelection--;this._selectIndex()},_selectNext:function(){debug("_selectNext");if(this._currentMatches.length>0){if(this._currentSelection===false){this._currentSelection=0}else{if(this._currentSelection+1>=this._currentMatches.length){this._currentSelection=0}else{this._currentSelection++}}this._selectIndex()}},_selectIndex:function(){debug("_selectIndex");var A;this._currentRenderedResults.childElements().each(function(C,B){A=C.up("li")||C;debug(A);A[(this._currentSelection===B)?"addClassName":"removeClassName"]("active")},this)},cacheSet:function(A,B){this._cache[A]=B},cacheGet:function(A){if(this._cache[A]){return this._cache[A]}return false},renderResults:function(){this.searchresults.update("");if(this._currentMatches.length>0){var D=new Element("ul");var E=null;var I=null;var F=null;D.addClassName("clearfix");for(var C=0,G=this._currentMatches.length;C<G;C++){var H=new Element("li");var A=this.getEntryHTML(this._entries[this._currentMatches[C]]);H.addClassName("nickname");H.addClassName("clearfix");H.id="autocomplete"+C;H.update(A);D.appendChild(H);H.observe("mouseover",this._onmouseover.bind(this));H.observe("mouseout",this._onmouseout.bind(this));if(this.options.selectItemCallBack){var B=this;E=this._currentMatches[C];I=this._entries[E];H.observe("click",this.handleClick.bindAsEventListener(this,H,E,I,B))}}this._currentRenderedResults=D;this.searchresults.appendChild(D);this.searchresults.show()}else{this.searchresults.hide()}},handleClick:function(E,B,C,D){debug(arguments);var A=E.findElement("li");this.options.selectItemCallBack(E,A,C,D,this)},lookupValue:function(){if(this._entriesLoaded){debug("move previous results back to cache");if((this.htmlCachingEnabled===true)&&(this._currentMatches.length>0)){this.moveOldResultsBackToHTMLCache()}this._currentValue=this.searchbox.getValue();if(this._currentValue.length>0){this._currentSelection=false;var B=this.cacheGet(this._currentValue);var H=[];if(B!==false){H=B}else{var I=this._currentValue.trim().toLowerCase().split(this._splitRegex);for(var E=0,G=this._entries.length;E<G;E++){var K=this.getSearchString(this._entries[E]).split(this._splitRegex);var C=0;for(var F=0,J=I.length;F<J;F++){if(I[F].length>0){for(var D=0,A=K.length;D<A;D++){if(K[D].length>=I[F].length&&K[D].toLowerCase().substring(0,I[F].length)===I[F]){C++;break}}}}if(C>=I.length){H.push(E);if(H.length>=this._maxMatches){break}}}this.cacheSet(this._currentValue,H)}this._currentMatches=H}else{this._currentMatches=[]}}this.renderResults()},highlight:function(G){var F=[];var H=this._currentValue.split(this._splitRegex);G=G.split(this._captureRegex);for(var D=0,A=G.length;D<A;D++){var E=false;for(var B=0,C=H.length;B<C;B++){if(H[B]&&G[D].toLowerCase().lastIndexOf(H[B],0)!==-1){F.push('<span class="highlight">',G[D].substring(0,H[B].length),"</span>",G[D].substring(H[B].length,G[D].length));E=true;break}}if(!E){F.push(G[D])}}return F.join("")},loadEntries:function(A){if(this._loadingEntries===false&&this._entriesLoaded===false){this._loadingEntries=true;var B=new Ajax.Request(A,{method:"post",cache:true,onComplete:this._onloaded.bind(this),parameters:this.options.includeSelf?"includeSelf=1":""})}},getEntryHTML:function(A){debug("implement me")},getEntryURL:function(B){var A="/"+B.n;if(B.ns){A="/"+B.ns}A=ComCore.Configuration.get("rootURL")+A;return A},_eoo:true};ComCore.SearchHelperPeople=Class.create(ComCore.SearchHelper,{options:{},initialize:function($super,A,D,B){B=B||{};B.preLoad|=true;this.htmlCachingEnabled=true;this.addCacheContainer=($("searchPeopleContainer")===null);if(B.selectItemCallBack===undefined){B.selectItemCallBack=function(H,G,E,F,I){if(F&&F.n&&A&&D){A.setValue(F.n);D.hide()}}}if(this.addCacheContainer){this.cacheContainer=new Element("div",{id:"searchPeopleContainer",style:"display: none"});var C=this;document.observe("dom:loaded",function(){document.body.appendChild(C.cacheContainer)})}else{this.cacheContainer=$("searchPeopleContainer")}$super(A,D,B)},hideAutoCompleterResults:function(){this.searchresults.hide()},_onfocus:function(A){if(this.options.entries===null){this.loadEntries(ComCore.Page.buildAjaxURL("contactlist","getSearchContactList",(ComCore.Login.getUserID()===ComCore.Login.getTopUserID())))}},moveOldResultsBackToHTMLCache:function(){$$("#searchSuggestions li div.searchHTMLCache").each(function(A){this.cacheContainer.insert(A)},this)},getEntryHTML:function(D){var A=new ComCore.TemplateExtensions();if(this.htmlCachingEnabled===true){var C=this.cacheContainer.down("div."+D.u);if(C){C.select(".highlightResult").each(function(F){F.update(this.highlight(A.ellips(D.n,25)))},this);return C}}var B='<div class="avatar '+(D.g.toLowerCase())+' small">';B+='<span class="imageWrap person">';B+='<img src="';if(D.avatar){B+=D.avatar}else{if(D.p.length===0){B+=ComCore.Configuration.get("staticURL")+"//s/i/misc/thumb/thumb_"+(D.g.toLowerCase())+".jpg"}else{B+=D.p}}B+='" alt="">';B+="</span>";B+="</div>";B+='<strong class="highlightResult" style="font-size:11px">'+this.highlight(A.ellips(D.n,25))+"</strong>";B+='<br><em style="font-size:11px" class="highlightResult">'+this.highlight(A.ellips(D.d,25))+"</em>";if(this.htmlCachingEnabled===true){var E=new Element("div",{"class":D.u+" searchHTMLCache"});E.insert(B);this.cacheContainer.insert(E)}return B},getSearchString:function(A){return A.n+" "+A.f+" "+A.l},_eoo:true});ComCore.SearchHelperPeopleShouts=Class.create(ComCore.SearchHelperPeople,{options:{},initialize:function($super,A,B){this.prefixChar="@";$super(A,B,{selectItemCallBack:this.onFriendSelected.bind(this),includeSelf:true})},lookupValue:function(){if(this._entriesLoaded){debug("move previous results back to cache");if((this.htmlCachingEnabled===true)&&(this._currentMatches.length>0)){this.moveOldResultsBackToHTMLCache()}this._currentValue=this.searchbox.getValue();var N=this._currentValue.strip();var K=N;var F=N.split(" ");if(F.size()>0){K=F.pop().strip()}if(K.length>1&&K[0]===this.prefixChar){this._currentValue=K.substring(1);this._currentSelection=false;var B=this.cacheGet(this._currentValue);var I=[];if(B!==false){I=B}else{var J=this._currentValue.trim().toLowerCase().split(this._splitRegex);for(var E=0,H=this._entries.length;E<H;E++){var M=this.getSearchString(this._entries[E]).split(this._splitRegex);var C=0;for(var G=0,L=J.length;G<L;G++){if(J[G].length>0){for(var D=0,A=M.length;D<A;D++){if(M[D].length>=J[G].length&&M[D].toLowerCase().substring(0,J[G].length)===J[G]){C++;break}}}}if(C>=J.length){I.push(E);if(I.length>=this._maxMatches){break}}}this.cacheSet(this._currentValue,I)}this._currentMatches=I}else{this._currentMatches=[]}}this.renderResults()},_onkeydown:function(A){debug("SearchHelper._onkeypress()");if(this.options.entries===null){this._onfocus()}A=A||window.event;if(A){switch(A.keyCode){case Event.KEY_TAB:case Event.KEY_DOWN:this._selectNext();break;case Event.KEY_UP:this._selectPrevious();break;case Event.KEY_RETURN:if(this._currentSelection!==false){A.stop();this._selectCurrent(A);return false}break;default:setTimeout(this.lookupValue.bind(this),10);break}}},onFriendSelected:function(E,D,A,C){debug("SearchHelperPeopleShouts.onFriendSelected()");var B=C.n;var H=this.searchbox.getValue();var G=H.split(" ");var F=this.prefixChar+B;if(G.size()>1){G.pop();F=G.join(" ")+" "+F}this.searchresults.hide();this.searchbox.setValue(F);this.searchbox.focus()},_eoo:true});if(!ComCore.Controls){ComCore.Controls={}}ComCore.Controls.AddTo=Class.create();ComCore.Controls.AddTo.prototype={id:null,toggleLink:null,initialize:function(B){debug("new ComCore.Controls.AddTo("+B+")");var A=this;this.id=$(B);if(this.id===null){debug("Invalid id specified to class.controls.addto.js");return }this.toggleLink=this.id.down("a.toggleLink");this.embedOptions=this.id.down("div.embedOptions");this.embedHTMLLink=this.embedOptions.down("a.embedHTML");this.embedHTMLForm=this.embedOptions.down("form.embedHTML");this.pageTypeLinks=this.embedOptions.select("a.pageType");this.toggleLink.observe("click",(function(D){debug("ComCore.Controls.AddTo toggle()");ComCore.Dialog.initialize();ComCore.Dialog.options.width=300;ComCore.Dialog.setContent('<div class="embedOptions">'+this.embedOptions.innerHTML+"</div>",true);var C=ComCore.Dialog.dialogPlaceHolder.down("div.embedOptions");this.embedHTMLLink=C.down("a.embedHTML");this.embedHTMLForm=C.down("form.embedHTML");this.embedHTMLForm=C.down("form.embedHTML");this.pageTypeLinks=C.select("a.pageType");this.id=ComCore.Dialog.dialogPlaceHolder;this.initObservers();ComCore.Dialog.show();D.stop()}).bind(this))},initObservers:function(){var C=this;if(this.embedHTMLLink&&this.embedHTMLForm&&this.embedHTMLForm.embedHTML){this.embedHTMLLink.observe("click",function(G){ComCore.Dialog.initialize();var F="";if(C.embedHTMLForm.embedTitle){F+="<h2>"+C.embedHTMLForm.embedTitle.value+"</h2>"}if(C.embedHTMLForm.embedDescription){F+="<p>"+C.embedHTMLForm.embedDescription.value+"</p>"}F+='<fieldset><div><textarea style="width: 100%; height: 150px;">'+C.embedHTMLForm.embedHTML.value+"</textarea></div></fieldset>";debug(F);ComCore.Dialog.setContent(F,true);C.embedOptions.hide();G.stop()})}if(this.pageTypeLinks){var B=this.id.down("form.pageTypesLinkPostFix");if(B){var A=B.pageTypesLinkPostFix.value;this.pageTypeLinks.each(function(F){F.observe("click",function(J){try{debug("Launching pick profile dialog");ComCore.LoadingIndicator.show();var I=J.element();var K=I.getClassData("userType");ComCore.Dialog.initialize({width:550});ComCore.Dialog.position();ComCore.Dialog.resize();var G=ComCore.Page.buildAjaxURL(null,"getProfiles",true)+"&type=owned&userType="+K+"&link="+encodeURIComponent(A);ComCore.Dialog.getContent(G);C.embedOptions.hide()}catch(H){debug(H)}J.stop()})})}var E=this.id.down("form.addToPageTypes");if(E){var D=E.addToPageTypes.value;debug("addToPageType:"+D);debug(this.pageTypeLinks);this.pageTypeLinks.each(function(F){F.observe("click",function(J){try{debug("Launching addToPage dialog");ComCore.LoadingIndicator.show();var I=J.element();var K=I.getClassData("userType");ComCore.Dialog.initialize();ComCore.Dialog.options.width=405;var G=ComCore.Page.buildAjaxURL(null,"getProfiles",true)+"&type=owned&userType="+K+"&addToPageTypes="+encodeURIComponent(D);ComCore.Dialog.getContent(G);C.embedOptions.hide()}catch(H){debug(H)}J.stop()})})}}},_eoo:true};if(!ComCore.Controls){ComCore.Controls={}}ComCore.Controls.Comments=Class.create();ComCore.Controls.Comments.prototype={config:null,wrapper:null,deleteCommentFormTemplate:null,type:null,itemID:null,commentView:null,commentVertical:null,ownerUserID:null,commentLanguageFilter:null,itemDistro:null,inPage:null,commentItems:null,commentElement:null,commentInfo:null,initialize:function(E,B){debug("Controls.Comments.initialize");var C=this;this.wrapper=$(E);this.config=Object.extend({doPaging:true,doPosting:true,doQuoting:true,doDeleteDialog:true,pagingClassTop:"pagingTop",pagingClassBottom:"pagingBottom",pagingClassCommentSort:"commentSort",switchCommentFilterLanguageClass:"commentLanguageFilter",scrollToCommentsClass:"scrollToComments",effectDuration:0.4},B);var D=this.wrapper.down("div.commentsListWrapper");if(!D){return }this.type=D.getClassData("type");this.itemID=D.getClassData("itemID");this.commentView=D.getClassData("commentView");this.commentVertical=D.getClassData("commentVertical");this.ownerUserID=D.getClassData("ownerUserID");this.commentLanguageFilter=D.getClassData("commentLanguageFilter");this.itemDistro=D.getClassData("itemDistro");if(this.config.doDeleteDialog){var A=this.wrapper.down("div.deleteCommentFormTemplate");if(A){this.deleteCommentFormTemplate=A.remove().innerHTML}}this.inPage=ComCore.Login.getUserType()!=="USER";this.pageID=ComCore.Login.getUserID();this.setupCommentControls();this.initListeners()},setItemID:function(A){this.itemID=A},postLanguageFilterChange:function(A,C){debug("Controls.Comments.postLanguageFilterChange");try{Event.element(A).setClassData("page","1")}catch(B){debug(B)}this.onChangePageClicked(A,"")},initListeners:function(){debug("Controls.Comments.initListeners");var A=this;if(!this.wrapper.hasClassName("observing_click")){this.wrapper.observe("click",A.onWrapperClicked.bind(A));this.wrapper.addClassName("observing_click")}if(this.config.doPosting){this.observeCommentForms()}document.observe("click",this.onDocumentClicked.bind(this))},onDocumentClicked:function(A){if(!A.findElement("a.optionsControlToggle")){this.hideOpenOptions()}},onWrapperClicked:function(A){if(A.findElement("."+this.config.pagingClassTop+" a")&&this.config.doPaging){this.onChangePageClicked(A,"top")}else{if(A.findElement("."+this.config.pagingClassBottom+" a")&&this.config.doPaging){this.onChangePageClicked(A,"bottom")}else{if(A.findElement("."+this.config.pagingClassCommentSort)&&this.config.doPaging){this.onChangePageClicked(A,"sort")}else{if(A.findElement("li.quote a")&&this.config.doQuoting){this.onQuoteLinkClicked(A)}else{if(A.findElement("li.delete a")&&this.config.doDeleteDialog){this.onDeleteLinkClicked(A)}else{if(A.findElement("a.optionsControlToggle")){this.onOptionsToggleClicked(A)}else{if(A.findElement("a.commentMakeAdministratorAction")){this.onMakeAdministratorActionClicked(A)}else{if(A.findElement("a.commentMakeModeratorAction")){this.onMakeModeratorActionClicked(A)}else{if(A.findElement("a.commentUndoAdministratorAction")){this.onUndoAdministratorActionClicked(A)}else{if(A.findElement("a.commentUndoModeratorAction")){this.onUndoModeratorActionClicked(A)}else{if(A.findElement("."+this.config.switchCommentFilterLanguageClass)&&this.config.doPaging){this.onChangePageClicked(A,"switchCommentFilterLanguage")}else{if(A.findElement(".toggleCommentLanguageFilter")){this.onToggleCommentFilter(A)}else{if(A.findElement("a.languageFilter")){if(ComCore.Controls.LanguageFilter.changeLanguageFilterEvent(A,"COMMENTS",this.postLanguageFilterChange,this)){A.stop()}}else{debug("I don't know this click.")}}}}}}}}}}}}}if(!A.findElement(".toggleCommentLanguageFilter")){this.hideCommentFilter(A)}},onToggleCommentFilter:function(A){this.wrapper.down(".commentFilterLanguages ul").toggleClassName("toggled");A.stop()},hideCommentFilter:function(B){var A=this.wrapper.down(".commentFilterLanguages ul");if(A){A.removeClassName("toggled")}},onChangePageClicked:function(K,U){debug("Controls.Comments.onPageClicked");try{ComCore.LoadingIndicator.show();var F=this;var H=K.element();var Q=K.findElement("div.commentsPage");var N=Q.getClassData("type");var M=null;var A=null;if(N==="comments"){M=this.wrapper.down("div.commentsListWrapper");A=this.wrapper.down("div.queuedCommentsListWrapper")}else{if(N==="queuedComments"){M=this.wrapper.down("div.queuedCommentsListWrapper");A=this.wrapper.down("div.commentsListWrapper")}else{return }}if(H.hasClassName("commentSort")){var L=$(M).getClassData("order");L=(L==="ASC")?"DESC":"ASC";$(M).setClassData("order",L)}else{if(U==="switchCommentFilterLanguage"){var D=K.findElement("."+this.config.switchCommentFilterLanguageClass);this.commentLanguageFilter=D.getClassData("commentlang");debug("switching language");debug(D)}}var J={type:this.type,itemID:this.itemID,commentView:this.commentView,commentVertical:this.commentVertical,order:M.getClassData("order"),ownerUserID:this.ownerUserID,commentlang:this.commentLanguageFilter,itemDistro:this.itemDistro};var S=M.getClassData("pagerUrlName");if(!S){S="page"}var R=parseInt(M.getClassData("page"),10);R=(R)?R:1;J[S]=(H.getClassData("page"))?parseInt(H.getClassData("page"),10):R;if(A){var B=A.getClassData("pagerUrlName");if(!B){B="page"}var P=parseInt(A.getClassData("page"),10);J[B]=(P)?P:1}if(U==="bottom"){var G=this.wrapper.down("."+this.config.scrollToCommentsClass);if(G){G.scrollTo()}}var E=ComCore.Page.buildAjaxURL("comments","getComments");debug(E);debug(J);var T=new Effect.Opacity(M,{duration:0.2,from:1,to:0.3});var C=this.wrapper.select(".pagerLoading");if(C){C.each(function(V){V.addClassName("pagerLoading2")})}var I=new Ajax.Request(E,{method:"post",parameters:J,onSuccess:F.changePageCallBack.bind(F)});K.stop()}catch(O){debug(O)}return false},changePageCallBack:function(B,A){debug("Controls.Comments.changePageCallBack");this.wrapper.update(B.responseText);this.setupCommentControls();ComCore.LoadingIndicator.hide();this.initListeners()},onQuoteLinkClicked:function(F){ComCore.LoadingIndicator.show();var E=this;var B=F.element();var D=B.getClassData("commentID");var A=ComCore.Page.buildAjaxURL("comments","quote");var C={type:this.type,itemID:this.itemID,itemDistro:this.itemDistro,commentView:this.commentView,commentVertical:this.commentVertical,ownerUserID:this.ownerUserID,id:D};debug(A);debug(C);var G=new Ajax.Request(A,{method:"post",parameters:C,onSuccess:E.onQuoteLinkClickedCallBack.bind(E)});F.stop()},onQuoteLinkClickedCallBack:function(D){debug("Controls.Comment.onQuoteLinkClickedCallBack()");try{var C=D.responseText.evalJSON();if(!C.success){throw"Error in ajax call onQuoteLinkClicked"}var A=this.wrapper.down("form.commentform");A.message.value=C.result.commentform.message;A.quote_nickname.value=C.result.commentform.quote_nickname;this.wrapper.down("div.commentFormWrapper").scrollTo();A.message.focus();ComCore.LoadingIndicator.hide()}catch(B){debug("Error in onQuoteLinkClickedCallBack");debug(B)}},observeCommentForms:function(){debug("Controls.Comments.observeCommentForms");var B=this;var A=this.wrapper.select("form.commentform");A.each(function(C){if(!C.hasClassName("observing")){C.observe("submit",B.onCommentFormSubmit.bindAsEventListener(B,C.select("div.editor").first().id));C.addClassName("observing")}})},onCommentFormSubmit:function(G,C){debug("Controls.Comments.onCommentFormSubmit");if(G.stopped){return }ComCore.LoadingIndicator.show();var F=this;var E=G.findElement("form");var A=ComCore.Page.buildAjaxURL("comments");var B=E.serialize(true);B.action="addComment";E.disable();var D=new Ajax.Request(A,{method:"post",parameters:B,onSuccess:function(I,H){F.onCommentFormSubmitCallBack(E,I,H,B)},onFailure:function(){ComCore.LoadingIndicator.hide();E.enable()}});G.stop()},onCommentFormSubmitCallBack:function(A,F,J,B){debug("Controls.Comments.onCommentFormSubmitCallBack");try{var C=this;if(!J.success){throw"Error in Ajax callback"}ComCore.Message.hideAll();ComCore.ActionStateMessage.hide();ComCore.ActionStateMessage.hideStatusMessages();if(A.commentView&&(A.commentView.value==="ITEM_ONE")&&J.actionState&&(J.actionState==="addCommentSuccess")){A.down("textarea").value="";this.wrapper.select("div.mollomCaptcha").each(function(L){L.remove()});this.updateCommentCounter(1);var D=this.wrapper.down("div.commentsListWrapper");D.insert({top:F.responseText});var K=D.down("p.empty");if(K){K.remove()}A.enable();this.notify("onCommentFormSubmitCallBack");var E=$("adLeaderboard");var H=$("adLeaderboardPartner");if(E&&H&&H.value==="yahoo"){E.update('<iframe src="'+ComCore.Configuration.get("rootURL")+"/yahoophotobanner&ms="+escape(ComCore.Page.pageSection)+"&v="+$("adLeaderboardView").value+'" scrolling="no" frameborder="0" style="width: 728px; height: 110px; margin:0;" marginheight="0" marginheight="0"></iframe><script type="text/javascript">adhese.initSlotTrack("93");<\/script>');$("comments").scrollTo()}else{D.scrollTo()}}else{A.enable();var G=A.up("div.commentFormWrapper");G.replace(F.responseText)}this.observeCommentForms()}catch(I){debug(I)}A.enable();ComCore.LoadingIndicator.hide()},onDeleteLinkClicked:function(K){debug("Controls.Comments.onDeleteLinkClicked()");var F=this;var D=this.deleteCommentFormTemplate;if(D){K.stop();var B=K.element();var A=B.up("li.comment");var Q=A.getClassData("comment");var J=parseInt(A.getClassData("userid"),10);var H=A.hasClassName("friend");try{var E=A.down("p a.displayName").innerHTML}catch(L){debug(L)}ComCore.Dialog.initialize({width:600});ComCore.Dialog.setContent(D,true);var C=ComCore.Dialog.dialog.down("form.deleteCommentForm");C.commentID.value=Q;C.select("span.displayName").each(function(S){S.update(E+" ")});var I=$(C.abuse);var P=$(C.spam);var R=$(C.stopFriendship);var O=$(C.blacklist);if(I||P||R||O){var G=function(U){var T=C.down("div.abuseReportWrapper");if(T){if(I&&I.checked){T.show()}else{T.hide()}ComCore.Dialog.position()}var S=C.down("p.spamWarning");if(S){if((I&&I.checked)||(P&&P.checked)){S.show()}else{S.hide()}}if(O.checked){R.checked=true}};if(I){I.observe("click",G)}if(P){P.observe("click",G)}if(R){R.observe("click",G)}if(O){O.observe("click",G)}}if(J===ComCore.Login.getTopUserID()){var N=C.down("ul.deleteOptions");if(N){N.hide()}}var M=C.down("li.stopFriendshipOption");if(H){M.show()}else{M.hide()}C.commentID.value=Q;C.observe("submit",F.onDeleteCommentFormSubmit.bind(F));ComCore.Dialog.dialog.select("a.cancelLink").each(function(S){S.observe("click",function(T){ComCore.LoadingIndicator.hide();ComCore.Dialog.hide();T.stop()})});ComCore.Dialog.show()}},onDeleteCommentFormSubmit:function(G){debug("Controls.Comments.onDeleteCommentFormSubmit()");try{var F=G.element();var E=this;var A=F.down("span.emptyAbuseReport");if(A){if((F.abuse.checked)&&(F.message.value.length<=0)){A.show();G.stop();return }else{A.hide()}}ComCore.LoadingIndicator.show();var D=F.serialize(true);D.type=this.type;D.itemID=this.itemID;D.itemDistro=this.itemDistro;D.commentView=this.commentView;D.commentVertical=this.commentVertical;D.ownerUserID=this.ownerUserID;debug(D);var B=ComCore.Page.buildAjaxURL("comments","deleteComment");var H=new Ajax.Request(B,{method:"post",parameters:D,onSuccess:E.onDeleteCommentFormCallBack.bind(E)});G.stop()}catch(C){debug(C)}},onDeleteCommentFormCallBack:function(D,B){debug("Controls.Comments.onDeleteCommentFormCallBack()");try{var C=this;ComCore.Dialog.hide();if(!B.success){throw"Error in onDeleteCommentFormSubmit ajax call"}this.wrapper.select("div.actionState").each(function(F){F.remove()});if((B.actionState==="deleteCommentSuccess")&&B.commentID){this.wrapper.select("li.comment_"+B.commentID).each(function(G){var F=Effect.BlindUp(G,{duration:C.config.effectDuration})});this.updateCommentCounter(-1)}var E=this.wrapper.down("div.commentsListWrapper");E.insert({top:D.responseText});ComCore.LoadingIndicator.hide()}catch(A){debug(A)}},updateCommentCounter:function(C){var A=null;if(this.commentVertical==="YES"){A=this.wrapper.down("h2 span.counter")}else{A=this.wrapper.down("h2 span.skinCounter")}if(A){A.update(parseInt(A.innerHTML,10)+C)}else{var B=this.wrapper.down("h2");if(B){if(this.commentVertical==="YES"){B.insert({bottom:'<span class="counter">'+C+"</span>"})}else{B.insert({bottom:'<span class="skinCounter big">'+C+"</span>"})}}}},onOptionsToggleClicked:function(B){debug("onOptionsToggleClicked");var A=B.findElement(".optionsControlWrapper");if(!A.hasClassName("optionsControlToggled")){this.hideOpenOptions();A.addClassName("optionsControlToggled");this.openOptions=A}else{this.hideOpenOptions()}B.stop()},hideOpenOptions:function(){if(this.openOptions){this.openOptions.removeClassName("optionsControlToggled")}this.openOptions=null},setupComment:function(D){D=$(D);var C=this.getCommentDetails(D);if(this.inPage&&D.hasClassName("withControls")&&C.userID!==ComCore.Login.getTopUserID()){var B=this.getControlsHTML(C);var A=D.down("ul");A.insert({after:B})}},getControlsHTML:function(D){var C="";C+='<ul id="optionsControl">';C+='<li class="optionsControlWrapper">';C+='<a href="#{contextURL}/friends" class="optionsControlToggle" title="'+ComCore.Language.get("activityLogs","edit")+'">#</a>';C+='<ul class="optionsControl">';if(!D.isAdmin){if(!D.isModerator){C+='<li><a href="#{contextURL}/friends/action=addToSet&amp;friendshipid=#{userID}&amp;setid=-1&amp;'+ComCore.CSRF.getParam("makeAdministrator",true)+'" class="commentMakeAdministratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","makeAdministrator")+'">'+ComCore.Language.get("pages","makeAdministrator")+"</a></li>";C+='<li><a href="#{contextURL}/friends/action=addToSet&amp;friendshipid=#{userID}&amp;setid=-2&amp;'+ComCore.CSRF.getParam("makeModerator",true)+'" class="commentMakeModeratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","makeModerator")+'">'+ComCore.Language.get("pages","makeModerator")+"</a></li>"}else{C+='<li><a href="#{contextURL}/friends/action=addToSet&amp;friendshipid=#{userID}&amp;setid=-1&amp;'+ComCore.CSRF.getParam("makeAdministrator",true)+'" class="commentMakeAdministratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","makeAdministratorFromModerator")+'">'+ComCore.Language.get("pages","makeAdministratorFromModerator")+"</a></li>";C+='<li><a href="#{contextURL}/friends/action=removeFromSet&amp;friendshipid=#{userID}&amp;setid=-2&amp;'+ComCore.CSRF.getParam("undoModerator",true)+'" class="commentUndoModeratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","undoModerator")+'">'+ComCore.Language.get("pages","undoModerator")+"</a></li>"}}else{C+='<li><a href="#{contextURL}/friends/action=removeFromSet&amp;friendshipid=#{userID}&amp;setid=-1&amp;'+ComCore.CSRF.getParam("undoAdministrator",true)+'" class="commentUndoAdministratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","undoAdministrator")+'">'+ComCore.Language.get("pages","undoAdministrator")+"</a></li>";C+='<li><a href="#{contextURL}/friends/action=addToSet&amp;friendshipid=#{userID}&amp;setid-2&amp;'+ComCore.CSRF.getParam("makeModerator",true)+'" class="commentMakeModeratorAction" rel="'+D.userID+'" title="'+ComCore.Language.get("pages","makeModeratorFromAdministrator")+'">'+ComCore.Language.get("pages","makeModeratorFromAdministrator")+"</a></li>"}C+="</ul>";C+="</li>";C+="</ul>";var A=new Template(C);var B={contextURL:ComCore.Page.getContextURL(),userID:D.userID};return A.evaluate(B)},getCommentDetails:function(B){var A={commentID:parseInt(B.getClassData("comment"),10),userID:parseInt(B.getClassData("userid"),10),isAdmin:B.hasClassName("admin"),isModerator:B.hasClassName("moderator")};return A},onMakeAdministratorActionClicked:function(C){debug("onMakeAdministratorActionClicked");if(confirm(ComCore.Language.get("pages","confirmMakeAdministrator"))){ComCore.LoadingIndicator.show();comment=$(Event.element(C)).up(".comment");commentInfo=this.getCommentDetails(comment);var A=ComCore.Page.buildAjaxURL("friends","addFriendToSet")+"&setid=-1&friendshipid="+commentInfo.userID+"&"+ComCore.CSRF.getParam("makeAdministrator",true);var B=new Ajax.Request(A,{method:"get",onComplete:this.onMakeAdministratorActionClickedCallback.bind(this)})}C.stop()},onMakeAdministratorActionClickedCallback:function(B,A){debug("onMakeAdministratorActionClickedCallback");try{if(!A||!A.success){throw new Error("Error in onMakeAdministratorActionClickedCallback")}this.showAdminBadges(true);this.refreshControls()}catch(C){ComCore.Debug.error(C.message);ComCore.Debug.error(C)}ComCore.LoadingIndicator.hide()},onMakeModeratorActionClicked:function(C){debug("onMakeModeratorActionClicked");ComCore.LoadingIndicator.show();comment=$(Event.element(C)).up(".comment");commentInfo=this.getCommentDetails(comment);var A=ComCore.Page.buildAjaxURL("friends","addFriendToSet")+"&setid=-2&friendshipid="+commentInfo.userID+"&"+ComCore.CSRF.getParam("makeModerator",true);var B=new Ajax.Request(A,{method:"get",onComplete:this.onMakeModeratorActionClickedCallback.bind(this)});C.stop()},onMakeModeratorActionClickedCallback:function(B,A){debug("onMakeModeratorActionClickedCallback");try{if(!A||!A.success){throw new Error("Error in onMakeModeratorActionClickedCallback")}this.showModeratorBadges(true);this.refreshControls()}catch(C){ComCore.Debug.error(C.message);ComCore.Debug.error(C)}ComCore.LoadingIndicator.hide()},onUndoAdministratorActionClicked:function(C){debug("onUndoAdministratorActionClicked");ComCore.LoadingIndicator.show();comment=$(Event.element(C)).up(".comment");commentInfo=this.getCommentDetails(comment);var A=ComCore.Page.buildAjaxURL("friends","removeFriendFromSet")+"&setid=-1&friendshipid="+commentInfo.userID+"&"+ComCore.CSRF.getParam("makeAdministrator",true);var B=new Ajax.Request(A,{method:"get",onComplete:this.onUndoAdministratorActionClickedCallback.bind(this)});C.stop()},onUndoAdministratorActionClickedCallback:function(B,A){debug("onUndoAdministratorActionClickedCallback");try{if(!A||!A.success){throw new Error("Error in onUndoAdministratorActionClickedCallback")}this.showAdminBadges(false);this.refreshControls()}catch(C){ComCore.Debug.error(C.message);ComCore.Debug.error(C)}ComCore.LoadingIndicator.hide()},onUndoModeratorActionClicked:function(C){debug("onUndoModeratorActionClicked");ComCore.LoadingIndicator.show();comment=$(Event.element(C)).up(".comment");commentInfo=this.getCommentDetails(comment);var A=ComCore.Page.buildAjaxURL("friends","removeFriendFromSet")+"&setid=-2&friendshipid="+commentInfo.userID+"&"+ComCore.CSRF.getParam("makeModerator",true);var B=new Ajax.Request(A,{method:"get",onComplete:this.onUndoModeratorActionClickedCallback.bind(this)});C.stop()},onUndoModeratorActionClickedCallback:function(B,A){debug("onUndoModeratorActionClickedCallback");try{if(!A||!A.success){throw new Error("Error in onUndoModeratorActionClickedCallback")}this.showModeratorBadges(false);this.refreshControls()}catch(C){ComCore.Debug.error(C.message);ComCore.Debug.error(C)}ComCore.LoadingIndicator.hide()},showAdminBadge:function(C,B){debug("showAdminBadges");var A=C.down(".ownership.admin");var D=C.down(".ownership.moderator");if(B===true){debug("Showing...");C.removeClassName("moderator");C.addClassName("admin");D.hide();A.appear({duration:1})}else{if(B===false){debug("Hiding...");C.removeClassName("admin");A.hide()}}},showAdminBadges:function(B){var A=this.getUserComments(comment.userID);var C=this;A.each(function(D){C.showAdminBadge(D,B)})},showModeratorBadge:function(C,B){debug("showModeratorBadge");var A=C.down(".ownership.admin");var D=C.down(".ownership.moderator");if(B===true){debug("Showing...");C.removeClassName("admin");C.addClassName("moderator");A.hide();D.appear({duration:1})}else{if(B===false){debug("Hiding...");C.removeClassName("moderator");D.hide()}}},showModeratorBadges:function(B){var A=this.getUserComments(comment.userID);var C=this;A.each(function(D){C.showModeratorBadge(D,B)})},refreshControl:function(D){debug("refreshControl");var B=this.getCommentDetails(D);var C=this.getControlsHTML(B);var A=D.down("ul#optionsControl");A.replace(C)},refreshControls:function(C){debug("refreshBadgesAndControls");var A=this.getUserComments(comment.userID);var B=this;A.each(function(D){B.refreshControl(D)})},getUserComments:function(A){return this.wrapper.select("li.userid_"+commentInfo.userID)},setupCommentControls:function(){var A=this;this.commentItems=this.wrapper.select(".comments .comment");this.commentItems.each(function(B){A.setupComment(B)})},_eoo:true};ComCore.Events.extend(ComCore.Controls.Comments);if(!ComCore.Controls){ComCore.Controls={}}if(!(ComCore.Controls.LanguageFilter instanceof Object)){ComCore.Controls.LanguageFilter=Class.create({initialize:function(C,A){debug("ComCore.Controls.LanguageFilter.initialize()");debug(C);this.div=$(C);this.menu=this.div.down("ul.languageFilterChoices");this.type=this.div.getClassData("languageFilterType");var B=this;if(A){debug("autohide");this.div.up().observe("mouseout",function(D){if(B.div.visible()){debug("blindUp");B.div.hide()}});this.div.up().observe("mouseover",function(D){if(!B.div.visible()){debug("blindDown");B.div.show()}});this.div.blindUp()}if(this.menu instanceof Element){this.div.observe("click",function(E){B.menu.toggle();try{}catch(D){debug(D)}});document.observe("click",function(D){if(!D.element().descendantOf(B.div)){B.menu.hide()}})}if(this.type==="SHOUTS"){this.toReplace=this.div.up("div.shoutsComponent");this.div.select("a.languageFilter").each(function(D){$(D).observe("click",function(G){var F=B.toReplace.down("form.shoutsComponentForm");var I="";if(F instanceof Element){if(F.includelocation instanceof Element&&F.includelocation.value=="personalhomepage"){var E=B.toReplace.up(".PersonalHomePageShoutsHTMLComponent");if(!(E instanceof Element)){debug("wickedyweird, we found no PersonalHomePageShoutsHTMLComponent");return }E=E.identify();if(!E){debug("could not get component ID!");debug(E);debug(B.toReplace.up(".PersonalHomePageShoutsHTMLComponent"));return }E=E.substring(10);if(ComCore.Controls.LanguageFilter.changeLanguageFilterEvent(G,"SHOUTS",function(){phh.refreshWidget(E)})){G.stop()}return }if(F.noJSLanguageFiltering instanceof Element&&F.noJSLanguageFiltering.value=="1"){return }ComCore.LoadingIndicator.show();if(F.action instanceof Element){F.action.value="setLanguageFilter"}I=F.serialize();I+="&type="+B.type+"&languages="+D.getClassData("filterlang")+"&url="+encodeURIComponent(document.location);debug("Sending with params: "+I);var H=new Ajax.Request(ComCore.Page.buildAjaxURL(null,"setLanguageFilter"),{method:"post",parameters:I,onSuccess:B.changeFilterCallBack.bind(B)});G.stop()}})})}else{if(this.type=="FRIENDSLOG"){this.toReplace=this.div.up(".PersonalHomePageFriendsLogComponent");if(this.toReplace instanceof Element){this.div.select("a.languageFilter").each(function(D){$(D).observe("click",function(F){ComCore.LoadingIndicator.show();var E=B.toReplace.identify();if(!E){debug("could not get component ID!");debug(E);debug(B.toReplace);return }E=E.substring(10);if(ComCore.Controls.LanguageFilter.changeLanguageFilterEvent(F,"FRIENDSLOG",function(){phh.refreshWidget(E)})){F.stop()}return })})}}}},changeFilterCallBack:function(A){debug(A);ComCore.LoadingIndicator.hide();if(!A.headerJSON||!A.headerJSON.success){debug("no json.success"+json.reason);return }this.toReplace.update(A.responseText)}});ComCore.Controls.LanguageFilter.changeLanguageFilterEvent=function(E,C,D,A){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){if(RegExp.$1<=6){return false}}ComCore.LoadingIndicator.show();if(!(D instanceof Function)){debug("no valid bindfunction given");ComCore.LoadingIndicator.hide();return false}if(A===null){A=this}var B=Event.element(E);var G="type="+C+"&languages="+B.getClassData("filterlang");debug("Sending with params: "+G);var F=new Ajax.Request(ComCore.Page.buildAjaxURL(null,"setLanguageFilter"),{method:"post",parameters:G,onSuccess:D.bind(A,E),onComplete:function(H){ComCore.LoadingIndicator.hide()}});return true}}ComCore.AvatarManager=Class.create();ComCore.AvatarManager.prototype={urlPostFix:"",initialize:function(D,C,B,F){if(B){this.urlPostFix=B}if(F){this.callback=F}var E=$(D);if(E){Event.observe(E,"click",this.newProfilePicture.bind(this),false)}var A=$(C);if(A){Event.observe(A,"click",this.editProfilePicture.bind(this),false)}},newProfilePicture:function(B){debug("Launching profile picture dialog");var A=this;ComCore.Dialog.initialize();ComCore.Dialog.options.width=545;ComCore.Dialog.registerExitCallBack(function(C){if(C){A.updateProfilePicture(C,A.callback)}});ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL("editor","addPhotoOverview")+"&skipOptions=1&source=avatar"+this.urlPostFix);B.stop()},editProfilePicture:function(A){debug("Launching profile picture dialog");this.newProfilePicture(A)},updateProfilePicture:function(B,E){var C=this;if(B.photoID){var A="photoid="+B.photoID;var D=new Ajax.Request(ComCore.Page.buildAjaxURL("editor","setProfilePicture"),{parameters:A,method:"post",onCreate:function(){ComCore.Dialog.hide();ComCore.LoadingIndicator.show()},onSuccess:function(G,F){if(!F.success){C.showFailMessage()}else{if(E){E(B)}ComCore.Dialog.hide()}},onComplete:ComCore.LoadingIndicator.hide,onFailure:C.showFailMessage})}else{ComCore.Debug.log("No photoid given, not setting profile picture")}},showFailMessage:function(){var A=new Ajax.Request(ComCore.Page.buildAjaxURL("editor","showSetProfileFailure"),{onSuccess:function(B){ComCore.Dialog.setContent(B.responseText,true)}})},_eoo:true};ComCore.Avatar=Class.create({resultElement:null,options:{},initialize:function(C,H,I,G){this.options=Object.extend({onClick:null,onMouseOver:null,onMouseOut:null,addDeleteLink:false},G);if(!C.gender){C.gender="male"}else{C.gender=C.gender.toLowerCase()}if(!C.nickname){C.nickname=""}if(!C.displayName){C.displayname=""}if(!H){H="#"}if(!I){I="normal"}var A=new Element("div",{"class":"avatar "+C.gender+((I!=="normal")?" "+I:"")+" userID_"+C.userID});if(C.age){var B=new Element("span",{"class":"age"}).update(C.age)}if(I!=="small"){var F=new Element("a",{"class":"nick person "+((C.userType)?C.userType.toLowerCase():""),href:H,title:C.displayName}).update(C.nickname)}var E=new Element("a",{"class":"imageWrap person "+((C.userType)?C.userType.toLowerCase():""),href:H,title:C.displayName});var D=new Element("img",{src:C.thumbnailURL});if(this.options.addDeleteLink){var J=new Element("span",{"class":"deleteLink",style:"display: none;"})}E.appendChild(D);if(this.options.addDeleteLink){E.appendChild(J)}A.appendChild(E);if(I!=="small"){A.appendChild(F)}if(B){A.appendChild(B)}if(Object.isFunction(this.options.onClick)){A.observe("click",this.options.onClick)}if(Object.isFunction(this.options.onMouseOver)){A.observe("mouseover",this.options.onMouseOver)}if(Object.isFunction(this.options.onMouseOut)){A.observe("mouseout",this.options.onMouseOut)}this.resultElement=A},getResult:function(){return this.resultElement},_eoo:true});ComCore.RegisterDialog=Class.create();ComCore.RegisterDialog.prototype={initialize:function(A){debug("RegisterDialog.initialize()");debug(A);if(ComCore.LoginDialog){ComCore.LoginDialog.active=false}this.options=Object.extend({annoying:false,show:true,timeleft:0,id:undefined,i:undefined,r:undefined,token:undefined,openLink:$("invitationProfileLink"),checkOnLeave:true,reOpenDelay:120,params:null},A);this.closed=!(this.options.show);if(this.options.show){this.open()}else{if((this.options.timeleft>0)&&this.options.annoying){this.queueOpen(this.options.timeleft)}}$(document).observe("click",this.onDocumentClick.bind(this))},queueOpen:function(A){var B=this;setTimeout(function(){if(!ComCore.Dialog||!ComCore.Dialog.dialog||!ComCore.Dialog.dialog.visible()){B.open({reminder:true})}},(A*1000))},open:function(B){this.closed=false;ComCore.Dialog.initialize({width:400,placeHolderClass:"registerDialog",removeOnClose:false,closeOnEsc:false,closeOnPlaceHolderClicked:false});var C=this;ComCore.Dialog.registerCloseCallBack(function(){C.onClose()});ComCore.Dialog.registerExitCallBack(function(){C.onExit()});var A="/register/";if(this.options.id){A+="id="+encodeURIComponent(this.options.id)}if(this.options.i){A+="&i="+encodeURIComponent(this.options.i)}if(this.options.r){A+="&r="+encodeURIComponent(this.options.r)}if(this.options.token){A+="&gameToken="+this.options.token}if(B&&(B.reminder===true)){A+="&reminder=1"}if(B&&(B.leaving===true)){A+="&leaving=1";if(B.leavingLink){A+="&leavingLink="+encodeURIComponent(B.leavingLink)}}if(this.options.params===null){ComCore.Dialog.getContent(A)}else{ComCore.Dialog.postContent(A,this.options.params)}},clearInvitation:function(){var B=new Ajax.Request("/register/action=clearInvitation");var A=$("invitationProfile");if(A){A.hide()}this.options.annoying=false;ComCore.Dialog.close()},onDocumentClick:function(A){if(A.stopped){return }if(A.findElement("a.clearInvitationLink")){this.onClearInvitationClicked(A)}else{if(A.findElement("a")===this.options.openLink){this.onOpenLinkClicked(A)}else{if(A.findElement("a")&&this.options.annoying&&this.closed){this.checkReOpenRegisterDialog(A)}}}},checkReOpenRegisterDialog:function(B){debug("checkReOpenRegisterDialog()");if(this.options.annoying&&this.options.checkOnLeave){var A=B.findElement("a").attr("href");if(A.indexOf(ComCore.Profile.getUrl())===-1){if(!B.findElement("a.logout")){this.open({leaving:true,leavingLink:A});B.stop()}}}},onOpenLinkClicked:function(A){this.open();A.stop()},onClearInvitationClicked:function(A){this.clearInvitation();A.stop()},onExit:function(){debug("Exit");if(ComCore.homepageSuggestionBox){ComCore.homepageSuggestionBox.reload()}},onClose:function(){this.closed=true;this.onExit();if(this.options.annoying&&this.options.reOpenDelay>0){this.queueOpen(this.options.reOpenDelay)}},_eoo:true};ComCore.LoginDialog=Class.create({initialize:function(C){debug("LoginDialog.initialize()");debug(C);this.params=Object.extend({why:undefined,token:undefined,target:window.location},C);var A=ComCore.Page.getContextURL()+"/login/";if(this.params.why){A+="&why="+this.params.why}A+="&target="+encodeURIComponent(this.params.target);if(this.params.token){A+="&gameToken="+this.params.token}var B=this;ComCore.Dialog.initialize({placeHolderClass:"loginDialog"});ComCore.Dialog.registerSetContentSuccessCallback(function(){B.contentSuccess()});ComCore.Dialog.getContent(A)},contentSuccess:function(){var A=this;$$("#dialog .registerLink").each(function(B){$(B).observe("click",A.showRegistrationDialog.bind(A))})},showRegistrationDialog:function(){var B={annoying:false};if(this.params.token){B.token=this.params.token}var A=new ComCore.RegisterDialog(B)}});ComCore.LoginDialog.active=true;ComCore.BrowserHistory=Class.create({initialize:function(A){this.options=Object.extend({writeStyle:true,linkCssClass:"testerLink"},A||{});if(this.options.writeStyle){document.write('<style type="text/css">a.'+this.options.linkCssClass+"{height:0px;} a."+this.options.linkCssClass+":visited{display:block;height:1px !important;}</style>")}this.dummy=null},_startHistoryChecks:function(){if(this.dummy){return }this.dummy=new Element("div",{id:"visitTestDiv"});$(this.dummy).setStyle({visibility:"hidden",height:"1px",lineHeight:"1px"});document.body.appendChild(this.dummy)},_stopHistoryChecks:function(){if(!this.dummy){return }$(this.dummy).remove();this.dummy=null},_isLinkVisited:function(B){var C=false;if(B.indexOf("://")===-1){B="http://"+B}var A=new Element("a",{href:B,"class":this.options.linkCssClass});this.dummy.appendChild(A);if(parseInt(A.getHeight(),10)!==0){C=true}A.remove();return C},visited:function(A){this._startHistoryChecks();var B=false;if((typeof A)==="string"){if(this._isLinkVisited(A)){B=true}}else{B=[];links.each(function(C){if(this._isLinkVisited(C)){B.push(C)}},this)}this._stopHistoryChecks();return B},_eoo:true});ComCore.BrowserHistory=new ComCore.BrowserHistory();ComCore.Queuer.add(function(){var B=$("headerNicknameText");if(B){var K=new ComCore.InputPlaceHolder(B)}if(B&&B.value){var J=$("loginPasswordText");if(J){$("loginPasswordText").focus();var H=$("headerPasswordText");if(H){var I=new ComCore.InputPlaceHolder(H)}}else{$("headerPasswordText").focus()}}var C=$("shortcutsShout");if(C){C.observe("click",function(M){ComCore.Dialog.initialize();var N=M.element().rel||"";ComCore.Dialog.getContent(ComCore.Page.buildAjaxURL(null,"showShoutsDialog&reply="+N));M.stop()})}var A=$("searchValueNickname");if(A&&ComCore.Login.isLoggedIn()){var G=function(P,O,M,N,R){if(N&&N.n){var Q=R.getEntryURL(N);window.location=Q}};var F=new ComCore.SearchHelperPeople(A,$("searchSuggestions"),{selectItemCallBack:G});var E=new ComCore.InputPlaceHolder(A)}var L=$(document.getElementsByTagName("head")[0]);var D=$("styleSwitcher");if(D){D.observe("click",function(Q){var N=$("dayStyleSheet");var M=false;if(N){N.remove()}else{var R=ComCore.Configuration.get("staticURL")+"/s/c/netlog.light.css";var O=Element.extend(document.createElement("link"));O.setAttribute("rel","stylesheet");O.setAttribute("type","text/css");O.setAttribute("media","screen");O.setAttribute("id","dayStyleSheet");O.setAttribute("href",R);debug("adding stylesheet "+R);L.appendChild(O);M=true}if(ComCore.Login.isLoggedIn()){var P=new Ajax.Request("/action=toggleDayStyle",{method:"get",onSuccess:function(T){var S=T.responseText.evalJSON()}})}else{ComCore.CookieManager.setCookie("useDayStyle",M)}Q.stop()})}$(document).observe("click",function(c){try{var b;var T=c.findElement("a");if(T){if(T.hasClassName("requireLogin")&&(ComCore.LoginDialog.active===true)){if(!ComCore.Login.isLoggedIn()){var Y={};var Z=T.getClassData("why");if(Z){Y.why=Z}Y.target=T.attr("href");debug(Y);debug(T.attr("href"));b=new ComCore.LoginDialog(Y);c.stop()}}else{if(T.hasClassName("registerButton")){if(!ComCore.Login.isLoggedIn()){var U=new ComCore.RegisterDialog();c.stop()}}else{if(T.hasClassName("spotlightPush")){if(ComCore.Login.isLoggedIn()){ComCore.Dialog.initialize();ComCore.Dialog.options.width=645;ComCore.Dialog.getContent(c.findElement("a.spotlightPush").attr("href"));c.stop()}}else{if(T.hasClassName("friendFinderTool")){var e=c.findElement("a.friendFinderTool").attr("href");if((e.indexOf("view=tool")!==-1)&&(e.indexOf("professor=1")!==-1)){ComCore.Dialog.initialize({width:700});ComCore.Dialog.getContent(e);c.stop()}}else{if(T.hasClassName("shareButton")){ComCore.Dialog.initialize({width:400});ComCore.Dialog.getContent(c.findElement("a.shareButton").attr("href"));c.stop()}else{if(T.hasClassName("addFriendLink")){var W=c.findElement("a.addFriendLink").readAttribute("rel");if(W){ComCore.Dialog.initialize();ComCore.Dialog.options.width=750;ComCore.Dialog.postContent(ComCore.Page.buildAjaxURL("friends","addFriend"),"userid="+W);c.stop()}}else{if(T.hasClassName("addFanLink")){var Q=c.findElement("a.addFanLink");var P=Q.readAttribute("rel");var j=P.split("_");var W=j[0];var S=j[1];var h=new ComCore.Fans("becomeFan","isFan");h.becomeFan(W,S);var V=$("skinCounterFans");if(V){var O=V.innerHTML;O++;V.innerHTML=O}c.stop()}else{if(T.hasClassName("addWhiteListLink")){var Q=c.findElement("a.addWhiteListLink");var P=Q.readAttribute("rel");var M=P.split("_");var W=M[0];var d=M[1];var S=M[2];var R=new ComCore.Whitelist();R.addToWhitelist(W,d,S);var X=Q.up("li");if(X){X.hide()}c.stop()}else{if(T.hasClassName("jsActionLink")){var N=c.findElement("a.jsActionLink");var g=N.getClassData("action");if(g==="show"){var a=N.getClassData("showEl");if($(a)){$(a).show();c.stop();N.hide()}}}}}}}}}}}}if(c.findElement("input.requireLogin")&&(ComCore.LoginDialog.active===true)){if(!ComCore.Login.isLoggedIn()){b=new ComCore.LoginDialog();c.stop()}}}catch(f){debug(f)}})});ComCore.Queuer.add(function(){ComCore.isWindowLoaded=true},true);window.alert=(function(A){return function(B){if(ComCore.Configuration.get("debug")===false){new Image().src="/ajax/action=logAlert&url="+escape(window.location.href)+"&txt="+escape(B)}A(B)}})(window.alert);ComCore.Scroller={busy:false,interval:undefined,didScroll:false,savedOptions:{},currently:{element:undefined,mouseDown:false,arrowElement:undefined,counter:0},options:{scrollingSpeed:10,scrollingMouseDownSpeed:25,scrollInterval:100,scrollSelector:".scroller",scrollIncreaseSpeedRatio:2,scrollFirstSpeedRatio:2,scrollIncreaseAfter:5,scrollOnMouseOver:false,smoothAutoScrollDuration:0.2},defaultAddOptions:{hideIfUnnecessary:true,detectUnnecessary:true,maxHeight:false,maxHeightInterval:0,minTop:false,onScrollCallback:undefined,scrollOneClickInterval:150},getDirection:function(A){if(A===undefined){return undefined}if(A.hasClassName("up")){return"up"}if(A.hasClassName("down")){return"down"}return undefined},add:function(C,B,A){C=$(C);B=$(B);if(C===undefined||B===undefined){return false}A=Object.extend(Object.clone(ComCore.Scroller.defaultAddOptions),A);ComCore.Scroller.savedOptions[C.identify()]=A;ComCore.Scroller.savedOptions[C.identify()].contentElement=C;if(!A.maxHeight){A.maxHeight=C.up().getHeight()}if(A.minTop===false){A.minTop=parseInt(C.offsetTop,10);if(isNaN(A.minTop)){A.minTop=0}}A.maxHeight-=A.maxHeightInterval;if(A.detectUnnecessary){if(C.getHeight()<=A.maxHeight){if(A.hideIfUnnecessary){B.remove()}return false}}if(A.onScrollCallback!==undefined){ComCore.Scroller.savedOptions[C.identify()].onScrollCallback=A.onScrollCallback}ComCore.Scroller.savedOptions[C.identify()].maxHeight=A.maxHeight;ComCore.Scroller.savedOptions[C.identify()].minTop=A.minTop;B.select(ComCore.Scroller.options.scrollSelector).each(function(D){if(ComCore.Scroller.getDirection(D)===undefined){return }D.setClassData("target",C.identify());D.observe("mouseover",ComCore.Scroller.scrollerMouseOver);D.observe("mouseout",ComCore.Scroller.scrollerMouseOut);D.observe("mousedown",ComCore.Scroller.scrollerMouseDown);D.observe("mouseup",ComCore.Scroller.scrollerMouseUp);D.observe("click",ComCore.Scroller.scrollerClick)});C.style.position="absolute";C.style.display="block";ComCore.Scroller.start();return true},start:function(){if(ComCore.Scroller.interval===undefined){ComCore.Scroller.interval=setInterval(ComCore.Scroller.scroll,ComCore.Scroller.options.scrollInterval)}},scrollerMouseDown:function(A){if(ComCore.Scroller.busy){return }ComCore.Scroller.currently.mouseDown=true},scrollerMouseUp:function(A){ComCore.Scroller.currently.mouseDown=false;ComCore.Scroller.currently.counter=0},scrollerMouseOut:function(A){ComCore.Scroller.stopScrolling()},scrollerClick:function(A){if(ComCore.Scroller.currently.counter>1){debug(ComCore.Scroller.currently.counter+" > 0");return }if(ComCore.Scroller.didScroll){ComCore.Scroller.didScroll=false;return }ComCore.Scroller.busy=true;ComCore.Scroller.clicked();ComCore.Scroller.busy=false},scrollerMouseOver:function(B){var A=B.findElement(ComCore.Scroller.options.scrollSelector);if(A===undefined){return }ComCore.Scroller.currently.counter=0;ComCore.Scroller.currently.arrowElement=A;ComCore.Scroller.currently.element=$(A.getClassData("target"))},stopScrolling:function(){ComCore.Scroller.currently.mouseDown=false;ComCore.Scroller.currently.element=undefined;ComCore.Scroller.currently.arrowElement=undefined;ComCore.Scroller.currently.counter=0},scrollToY:function(C,D,B){B=Object.extend({smooth:false},B);var A=ComCore.Scroller.savedOptions[C.identify()];if(A===undefined){return }if(A.contentElement===undefined){return }if(D<A.maxHeight-C.offsetHeight){D=A.maxHeight-C.offsetHeight}if(D>A.minTop){D=A.minTop}if(B.smooth){new Effect.Move(C,{y:D,duration:ComCore.Scroller.options.smoothAutoScrollDuration,mode:"absolute",afterFinish:function(){if(A.onScrollCallback!==undefined){A.onScrollCallback()}}})}else{C.style.top=D+"px";if(A.onScrollCallback!==undefined){A.onScrollCallback()}}},clicked:function(){if(ComCore.Scroller.currently.element===undefined||ComCore.Scroller.currently.arrowElement===undefined){return }var E=ComCore.Scroller.getDirection(ComCore.Scroller.currently.arrowElement);var D=ComCore.Scroller.currently.element;var C=D.offsetTop;var A=ComCore.Scroller.savedOptions[D.identify()];var B=A.scrollOneClickInterval;if(!B){return }switch(E){case"down":ComCore.Scroller.scrollToY(D,C-B,{smooth:true});break;case"up":ComCore.Scroller.scrollToY(D,C+B,{smooth:true});break;default:}ComCore.Scroller.currently.counter=0},scroll:function(){if(ComCore.Scroller.busy){return }if(ComCore.Scroller.currently.element===undefined||ComCore.Scroller.currently.arrowElement===undefined){return }if(!ComCore.Scroller.options.scrollOnMouseOver&&!ComCore.Scroller.currently.mouseDown){return }var B;var F=ComCore.Scroller.getDirection(ComCore.Scroller.currently.arrowElement);if(F===undefined){return }var E=ComCore.Scroller.currently.element;var D=E.offsetTop;var C=ComCore.Scroller.currently.mouseDown?ComCore.Scroller.options.scrollingMouseDownSpeed:ComCore.Scroller.options.scrollingSpeed;if(ComCore.Scroller.options.scrollIncreaseAfter&&ComCore.Scroller.currently.counter>ComCore.Scroller.options.scrollIncreaseAfter){C*=ComCore.Scroller.options.scrollIncreaseSpeedRatio}if(ComCore.Scroller.options.scrollFirstSpeedRatio&&ComCore.Scroller.currently.counter==0){}C=parseInt(C);var A=ComCore.Scroller.savedOptions[E.identify()];if(A===undefined){return }if(ComCore.Scroller.currently.counter<1){ComCore.Scroller.currently.counter=ComCore.Scroller.currently.counter+1;return }switch(F){case"down":B=D-C;if(B<A.maxHeight-E.offsetHeight){ComCore.Scroller.currently.mouseDown=false;B=A.maxHeight-E.offsetHeight}E.style.top=B+"px";break;case"up":B=D+C;if(B>A.minTop){ComCore.Scroller.currently.mouseDown=false;B=A.minTop}E.style.top=B+"px";break;default:return }ComCore.Scroller.currently.counter=ComCore.Scroller.currently.counter+1;ComCore.Scroller.didScroll=true;if(A.onScrollCallback!==undefined){A.onScrollCallback()}},_eeo:true};if(!ComCore.Controls){ComCore.Controls={}}ComCore.Controls.Ratings=Class.create({initialize:function(A,B){this.control=$(A);this.controlID=A;this.type=this.control.getClassData("type");this.itemID=this.control.getClassData("itemID");this.ownerUserID=parseInt(this.control.getClassData("ownerUserID"),10);this.isLoading(false);this.options={rateSuccessMessageID:"rateSuccess",rateErrorMessageID:"rateError",rateDuplicateMessageID:"rateDuplicate",onRatingSuccessContext:null,onRatingSuccess:null};Object.extend(this.options,B||{});this.control.observe("click",this._onControlClicked.bindAsEventListener(this))},isLoading:function(A){if(undefined===A){return this.loading}this.loading=(A===true?true:false);this.control[this.loading?"addClassName":"removeClassName"]("loading")},_onControlClicked:function(A){A.stop();if(A.element().tagName.toLowerCase()==="a"){if(!this.isLoading()){this.rate(parseInt(A.element().innerHTML,10))}}},rate:function(A){this.isLoading(true);ComCore.LoadingIndicator.show();var C=this;var B=new Ajax.Request("/ajax/ratings",{method:"post",parameters:{action:"rate",type:this.type,itemID:this.itemID,rating:A,uniqueID:this.controlID,ownerUserID:this.ownerUserID,options:Object.toJSON(this.options)},onSuccess:function(E,D){ComCore.AjaxResponse.loginIsRequired(E,D);C._onRated.bind(C,D)()}})},showMessage:function(B){var A=B+"MessageID";if(this.options[A]&&$(this.options[A])){$(this.options[A]).show()}},_onRated:function(B){ComCore.Message.hideAll();if(B.success){var A=this.options.onRatingSuccessContext||this;this.showMessage("rateSuccess");this.control.replace(B.html);this.notify("onRate",B.userID,this.itemID,B.rating);if(this.options.onRatingSuccess&&typeof this.options.onRatingSuccess.method=="function"){this.isLoading(false);this.options.onRatingSuccess.method.bind(A,this.options.onRatingSuccess.uniqueID)()}}else{this.showMessage(B.reason==="DUPLICATE"?"rateDuplicate":"rateError");if(B.reason==="DUPLICATE"){this.control.replace(B.html)}}ComCore.LoadingIndicator.hide();this.isLoading(false)},_eoo:true});ComCore.Events.extend(ComCore.Controls.Ratings);