String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};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(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});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 dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
effect.options[eventName](effect);}
return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(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(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},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(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});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(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},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(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.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(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},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(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).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 style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);;if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);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(options);else
this.options=options||{};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(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{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(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.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(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"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(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;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 i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}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(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"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 bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});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(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};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);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){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(e)Event.stop(e);},enterHover:function(e){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(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
if(e)Event.stop(e);},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(e){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 options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
$(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
this.element.observe(pair.key,listener);if(this.options.externalControl)
this.options.externalControl.observe(pair.key,listener);}.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(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;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(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
tempOption.update((text||'').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 options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.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(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._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(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){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(handle,track,options){var slider=this;if(Object.isArray(handle)){this.handles=handle.collect(function(e){return $(e)});}else{this.handles=[$(handle)];}
this.track=$(track);this.options=options||{};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(s){return $(s)}):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(h,i){i=slider.handles.length-1-i;slider.setValue(parseFloat((Object.isArray(slider.options.sliderValue)?slider.options.sliderValue[i]:slider.options.sliderValue)||slider.range.start),i);h.makePositioned().observe("mousedown",slider.eventMouseDown);});this.track.observe("mousedown",this.eventMouseDown);document.observe("mouseup",this.eventMouseUp);document.observe("mousemove",this.eventMouseMove);this.initialized=true;},dispose:function(){var slider=this;Event.stopObserving(this.track,"mousedown",this.eventMouseDown);Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);this.handles.each(function(h){Event.stopObserving(h,"mousedown",slider.eventMouseDown);});},setDisabled:function(){this.disabled=true;},setEnabled:function(){this.disabled=false;},getNearestValue:function(value){if(this.allowedValues){if(value>=this.allowedValues.max())return(this.allowedValues.max());if(value<=this.allowedValues.min())return(this.allowedValues.min());var offset=Math.abs(this.allowedValues[0]-value);var newValue=this.allowedValues[0];this.allowedValues.each(function(v){var currentOffset=Math.abs(v-value);if(currentOffset<=offset){newValue=v;offset=currentOffset;}});return newValue;}
if(value>this.range.end)return this.range.end;if(value<this.range.start)return this.range.start;return value;},setValue:function(sliderValue,handleIdx){if(!this.active){this.activeHandleIdx=handleIdx||0;this.activeHandle=this.handles[this.activeHandleIdx];this.updateStyles();}
handleIdx=handleIdx||this.activeHandleIdx||0;if(this.initialized&&this.restricted){if((handleIdx>0)&&(sliderValue<this.values[handleIdx-1]))
sliderValue=this.values[handleIdx-1];if((handleIdx<(this.handles.length-1))&&(sliderValue>this.values[handleIdx+1]))
sliderValue=this.values[handleIdx+1];}
sliderValue=this.getNearestValue(sliderValue);this.values[handleIdx]=sliderValue;this.value=this.values[0];this.handles[handleIdx].style[this.isVertical()?'top':'left']=this.translateToPx(sliderValue);this.drawSpans();if(!this.dragging||!this.event)this.updateFinished();},setValueBy:function(delta,handleIdx){this.setValue(this.values[handleIdx||this.activeHandleIdx||0]+delta,handleIdx||this.activeHandleIdx||0);},translateToPx:function(value){return Math.round(((this.trackLength-this.handleLength)/(this.range.end-this.range.start))*(value-this.range.start))+"px";},translateToValue:function(offset){return((offset/(this.trackLength-this.handleLength)*(this.range.end-this.range.start))+this.range.start);},getRange:function(range){var v=this.values.sortBy(Prototype.K);range=range||0;return $R(v[range],v[range+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 slider=this;if(this.spans)
$R(0,this.spans.length-1).each(function(r){slider.setSpan(slider.spans[r],slider.getRange(r))});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(span,range){if(this.isVertical()){span.style.top=this.translateToPx(range.start);span.style.height=this.translateToPx(range.end-range.start+this.range.start);}else{span.style.left=this.translateToPx(range.start);span.style.width=this.translateToPx(range.end-range.start+this.range.start);}},updateStyles:function(){this.handles.each(function(h){Element.removeClassName(h,'selected')});Element.addClassName(this.activeHandle,'selected');},startDrag:function(event){if(Event.isLeftClick(event)){if(!this.disabled){this.active=true;var handle=Event.element(event);var pointer=[Event.pointerX(event),Event.pointerY(event)];var track=handle;if(track==this.track){var offsets=Position.cumulativeOffset(this.track);this.event=event;this.setValue(this.translateToValue((this.isVertical()?pointer[1]-offsets[1]:pointer[0]-offsets[0])-(this.handleLength/2)));var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}else{while((this.handles.indexOf(handle)==-1)&&handle.parentNode)
handle=handle.parentNode;if(this.handles.indexOf(handle)!=-1){this.activeHandle=handle;this.activeHandleIdx=this.handles.indexOf(this.activeHandle);this.updateStyles();var offsets=Position.cumulativeOffset(this.activeHandle);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);}}}
Event.stop(event);}},update:function(event){if(this.active){if(!this.dragging)this.dragging=true;this.draw(event);if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);}},draw:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.track);pointer[0]-=this.offsetX+offsets[0];pointer[1]-=this.offsetY+offsets[1];this.event=event;this.setValue(this.translateToValue(this.isVertical()?pointer[1]:pointer[0]));if(this.initialized&&this.options.onSlide)
this.options.onSlide(this.values.length>1?this.values:this.value,this);},endDrag:function(event){if(this.active&&this.dragging){this.finishDrag(event,true);Event.stop(event);}
this.active=false;this.dragging=false;},finishDrag:function(event,success){this.active=false;this.dragging=false;this.updateFinished();},updateFinished:function(){if(this.initialized&&this.options.onChange)
this.options.onChange(this.values.length>1?this.values:this.value,this);this.event=null;}});;var Menu=Class.create();Menu.prototype={initialize:function(element,other_content){this.element=$(element);this.content=this.element.up('.tab').down('.sub-menu');this.other_content=other_content;$(document.body).insert(this.content.remove());var lthis=this;this.element.observe('mouseover',function(){this.up('ul').select('li').each(function(el){el.removeClassName('selected');});lthis.other_content.each(function(el){el.hide();});var position=Position.cumulativeOffset(lthis.element);lthis.content.style.left=(position[0])+'px';lthis.content.style.top=(position[1]+lthis.element.getHeight())+'px';lthis.content.show();this.up('li').addClassName('selected');});var func=function(event){var x=Event.pointerX(event);var y=Event.pointerY(event);if(!Position.within(lthis.content,x,y)&&!Position.within(lthis.element,x,y)){lthis.content.hide();lthis.element.up('li').removeClassName('selected');}};this.element.observe('mouseout',func);this.content.observe('mouseout',func);}};function add_menus(event,context){if(typeof(context)=="undefined")context=$(document.body);else context=$(context);context.select('ul.menu').each(function(el){var other_content=el.select('ul.sub-menu');context.select('a.m').each(function(el){if(el.hasClassName('md'))return;new Menu(el,other_content);el.addClassName('md');});});}
addDOMLoadEvent(add_menus);Ajax.Responders.register({onComplete:function(ajax){add_menus(ajax);}});;var zc={zooms:[],au:function(element,id,delay,beta){var z=this.zooms.find(function(t){return t.element==$(element);});if(z)return;element.onmouseover=null;if(typeof(delay)=='undefined')
delay=.1;z=new ZoomZoom(element,function(dest){return pzr(dest,id,element,beta);},'ajax/zoom_info.php?entity_type=user&entity_id='+id,{delay:delay,effect:(beta?null:'grow'),dismiss:(beta?'wrapper':'target'),use_overlay:!beta,location:'center'});this.zooms.push(z);},ae:function(event,element,id,delay){var z=this.zooms.find(function(t){return t.element==$(element);});if(z)return;element.onmouseover=null;if(typeof(delay)=='undefined')
delay=.3;z=new ZoomZoom(element,function(dest){return ezr(dest,id);},'ajax/zoom_info.php?entity_type=event&entity_id='+id,{delay:delay,location:'side',effect:null,dismiss:'target'});this.zooms.push(z);z.show(event);},av:function(event,element,id,delay){var z=this.zooms.find(function(t){return t.element==$(element);});if(z)return;element.onmouseover=null;if(typeof(delay)=='undefined')
delay=.3;z=new ZoomZoom(element,function(dest){return vzr(dest,id);},'ajax/zoom_info.php?entity_type=venue&entity_id='+id,{delay:delay,location:'side',effect:null,dismiss:'target'});this.zooms.push(z);z.show(event);},hide_all_but_me:function(zoom){for(var i=0;i<this.zooms.length;i++){if(this.zooms[i]!=zoom)this.zooms[i].hide();}},find_element:function(element){return this.zooms.find(function(t){return t.element==$(element);});}};function getZC(){return zc;}
var ZoomZoom=Class.create();ZoomZoom.prototype={initialize:function(element,contentFunction,trackURL){this.zIndex=200;this.element=$(element);this.contentFunction=contentFunction;this.trackURL=trackURL;this.zoom_timeout=null;this.options=Object.extend({className:'zoom',location:'center',offset:{x:0,y:0},dismiss:'target',effect:'grow',use_overlay:true},arguments[3]||{});this.target=this.element;if(this.element.tagName=='A'){var descendants=this.element.immediateDescendants(element);if(descendants.length==1&&descendants[0].tagName=='IMG'){this.target=descendants[0];}}
this.buildWrapper();this.activate();},buildWrapper:function(){this.wrapper=document.createElement('div');Element.setStyle(this.wrapper,{position:'absolute',zIndex:this.zIndex+1,display:'none'});if(this.element.tagName=='A'){this.overlay=$(document.createElement('A'));this.overlay.href=this.element.href;this.overlay.obsInherit(this.element,'click');Element.setStyle(this.overlay,{position:'absolute',display:'none',border:0,margin:0,padding:0,background:'black',filter:'alpha(opacity=0)',opacity:0,zIndex:this.zIndex+2});}
if(Prototype.Browser.IE){this.underlay=document.createElement('iframe');this.underlay.src='javascript:;';Element.setStyle(this.underlay,{position:'absolute',display:'none',border:0,margin:0,opacity:0.01,padding:0,background:'none',zIndex:this.zIndex});}},activate:function(){this.eventShow=this.show.bindAsEventListener(this);if(this.options.location=='center'){this.target.observe('mousemove',this.eventShow);}else{this.target.observe('mouseover',this.eventShow);this.eventHide=this.hide.bindAsEventListener(this);this.target.observe('mouseout',this.eventHide);this.eventPosition=this.position.bindAsEventListener(this);this.target.observe('mousemove',this.eventPosition);}},deactivate:function(){if(this.options.location=='center'){this.target.stopObserving('mousemove',this.eventShow);}else{this.target.stopObserving('mouseover',this.eventShow);this.target.stopObserving('mouseout',this.eventHide);this.target.stopObserving('mousemove',this.eventMouseMove);}},handleMouseMove:function(event){var targetPosition=Position.cumulativeOffset((this.options.dismiss=='wrapper')?this.wrapper:this.target);var targetDimension=(this.options.dismiss=='wrapper')?this.wrapper.getDimensions():this.target.getDimensions();var x=Event.pointerX(event);var y=Event.pointerY(event);var extra_space=12;if(!(x>targetPosition[0]-extra_space&&x<targetPosition[0]+targetDimension.width+extra_space&&y>targetPosition[1]-extra_space&&y<targetPosition[1]+targetDimension.height+extra_space)){this.hide();}},build:function(){if(this.tooltip){if(this.tooltip.was_canceled){this.zoom_timeout=this.contentFunction(this.tooltip);this.tooltip.was_canceled=false;}
return;}
if(Prototype.Browser.IE)document.body.appendChild(this.underlay);if(this.options.use_overlay&&this.overlay)document.body.appendChild(this.overlay);this.tooltip=this.wrapper.appendChild(document.createElement('div'));this.tooltip.className=this.options.className;this.tooltip.style.position='relative';this.tooltip.was_canceled=false;this.tooltip.obj=this;this.zoom_timeout=this.contentFunction(this.tooltip);document.body.appendChild(this.wrapper);var w=this.wrapper.getDimensions();this.wrapper.setStyle({width:w.width+'px',height:w.height+'px'});if(Prototype.Browser.IE)this.underlay.setStyle({width:w.width+'px',height:w.height+'px'});if(this.overlay)this.overlay.setStyle({width:w.width+'px',height:w.height+'px'});Element.hide(this.tooltip);},show:function(event){if(!this.tooltip||this.tooltip.getAttribute('loaded')=='false')this.build();zc.hide_all_but_me(this);this.position(event);if(Prototype.Browser.IE)this.underlay.show();if(this.overlay)this.overlay.style.display='block';this.wrapper.show();if(this.options.location=='center'){this.eventHandleMouseMove=this.handleMouseMove.bindAsEventListener(this);Event.observe(document.body,'mousemove',this.eventHandleMouseMove);}
var showing=this;if((!Prototype.Browser.IE||ie6)&&this.options.effect=='blinddown'){this.effect=new Effect.BlindDown(this.tooltip,{duration:0.3,fps:60.0,delay:(typeof(this.options.delay)!='undefined'?this.options.delay:0),afterFinish:(this.trackURL!=null?function(){track(showing.trackURL);showing.trackURL=null;}:null)});}else if(this.options.effect=='grow'){this.effect=new Effect.Grow(this.tooltip,{duration:0.3,fps:60.0,delay:(typeof(this.options.delay)!='undefined'?this.options.delay:0),afterFinish:(this.trackURL!=null?function(){track(showing.trackURL);showing.trackURL=null}:null)});}else{this.tooltip.show();if(this.trackURL){track(this.trackURL);this.trackURL=null;}}
function track(url){_qpixelsent=null;try{quantserve();}catch(ex){}};},hide:function(){if(this.effect)this.effect.cancel();if(this.zoom_timeout){clearTimeout(this.zoom_timeout);if(this.tooltip)this.tooltip.was_canceled=true;}
this.effect=null;this.wrapper.hide();if(Prototype.Browser.IE)this.underlay.hide();if(this.overlay)this.overlay.hide();if(this.tooltip&&this.tooltip.visible()){if(this.options.location=='center'){Event.stopObserving(document.body,'mousemove',this.eventHandleMouseMove);}
this.tooltip.hide();}},position:function(event){var targetPosition=Position.cumulativeOffset(this.target);var targetDimension=this.target.getDimensions();var tipd=this.wrapper.getDimensions();var pos=null;var scroll=this.getScrollOffsets();var viewport=this.viewportSize();if(this.options.location=='center'){pos={'left':targetPosition[0]+(targetDimension.width/2)-(tipd.width/2),'top':targetPosition[1]+(targetDimension.height/2)-(tipd.height/2)};}else{var x=Event.pointerX(event);var y=Event.pointerY(event);pos={'left':x+50,'top':y-(tipd.height/2)};}
pos.left+=this.options.offset.x;pos.top+=this.options.offset.y;var scroll=this.getScrollOffsets();var viewport=this.viewportSize();if((pos.left+tipd.width-scroll.left)>viewport.width){if(this.options.location=='center'){pos.left=pos.left-((pos.left+tipd.width-scroll.left)-viewport.width)-1;}else{pos.left=pos.left=x-50-tipd.width;Element.removeClassName(this.tooltip,'left');if(!Element.hasClassName(this.tooltip,'right'))Element.addClassName(this.tooltip,'right');}}else{if(this.options.location!='center'){Element.removeClassName(this.tooltip,'right');if(!Element.hasClassName(this.tooltip,'left'))Element.addClassName(this.tooltip,'left');}}
if(pos.left<0)pos.left=1;if(pos.top<0)pos.top=1;this.wrapper.setStyle({left:pos.left+'px',top:pos.top+'px'});if(Prototype.Browser.IE)this.underlay.setStyle({left:pos.left+'px',top:pos.top+'px'});if(this.overlay)this.overlay.setStyle({left:pos.left+'px',top:pos.top+'px'});},viewportWidth:function(){if(Prototype.Browser.Opera)return document.body.clientWidth;return document.documentElement.clientWidth;},viewportHeight:function(){if(Prototype.Browser.Opera)return document.body.clientHeight;if(Prototype.Browser.WebKit)return this.innerHeight;return document.documentElement.clientHeight;},viewportSize:function(){return{'height':this.viewportHeight(),'width':this.viewportWidth()};},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft;},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop;},getScrollOffsets:function(){return{'left':this.getScrollLeft(),'top':this.getScrollTop()}}};function ezr(dest,id){Element.update(dest,"<div class='event loading'></div><div class='pointer'></div>");dest.setAttribute('loaded',false);timeout=setTimeout(function(){new Ajax.Request(HOME+'ajax/zoom_info.php',{method:'get',parameters:{entity_type:'event',entity_id:id},onSuccess:function(t){render_event_callback(dest,t.responseJSON.content);dest.setAttribute('loaded',true);}})},200);return timeout;}
function vzr(dest,id){Element.update(dest,"<div class='venue loading'></div><div class='pointer pointer-venue'></div>");dest.setAttribute('loaded',false);timeout=setTimeout(function(){new Ajax.Request(HOME+'ajax/zoom_info.php',{method:'get',parameters:{entity_type:'venue',entity_id:id},onSuccess:function(t){render_venue_callback(dest,t.responseJSON.content);dest.setAttribute('loaded',true);}})},200);return timeout;}
function render_event_callback(dest,data){var content="<div class='event'><div class='top'><div class='photo'><img src='"+data['photo_url']+"'/>"+(data['num_interested']>0?"<div class='num-people'>"+data['num_interested']+"</div>":'')+"</div><div class='title'>"+truncate(data['name'],45)+"</div><div class='when-where'>"+data['date']+' '+data['time']+(data['venue']!=''?" at "+truncate(data['venue'],40):'')+"</div></div><div class='description'>"+data['description']+"</div>"+get_friends_interested_string(data)+"</div><div class='pointer'></div>";if(data['num_friends_interested']==0)Element.addClassName(dest,'no-friends');Element.update(dest,content);}
function get_friends_interested_string(data){if(data['num_friends_interested']>0){$string="";if(data['friends_interested'].length==1){$string=render_user(data['friends_interested'][0]);}else if(data['friends_interested'].length==2){$string=render_user(data['friends_interested'][0])+" and "+render_user(data['friends_interested'][1]);}
return"<div class='friends-interested'><span>"+data['num_friends_interested']+"</span> Friend"+(data['num_friends_interested']>1?'s':'')+" including "+$string+"</div>";}
return'';}
function render_user(user){return"<span>"+user['first_name']+"</span>";}
function pzr(dest,id,element,beta){Element.update(dest,"<div class='user"+(beta?"-beta":" user-loading ")+" loading'></div>");dest.setAttribute('loaded',false);if(beta){element.user_id=id;get_user_info(element.user_id,function(data){render_user_callback(dest,data,element,true);});return null;}else{timeout=setTimeout(function(){new Ajax.Request(HOME+'ajax/zoom_info.php',{method:'get',parameters:{entity_type:'user',entity_id:id},onSuccess:function(t){render_user_callback(dest,t.responseJSON.content,element,false);dest.setAttribute('loaded',true);}})},200);return timeout;}}
function show_user_details(element,user_id){if(element.details){element.details.toggle();return;}
var width=300;var zoom=$(element).up('.zoom');var mouseover=zoom.up('div');div=E('div');div.className='user-beta-details';div.style.position='absolute';div.style.height=(parseInt(mouseover.style.height)-9)+'px';div.style.width=width+'px';div.style.overflow='hidden';var position=Position.cumulativeOffset(mouseover);var dimension=mouseover.getDimensions();div.style.zIndex=element.style.zIndex;var scroll=zoom.obj.getScrollOffsets();var viewport=zoom.obj.viewportSize();if((position[0]+dimension.width+width-scroll.left)>viewport.width)div.style.left='-310px';else div.style.left=dimension.width+'px';div.style.top=0;element.details=div;mouseover.appendChild(div);element.details.innerHTML='<div class="loading"></div>';new Ajax.Request(HOME+'ajax/user_details.php',{method:'get',parameters:{user_id:user_id},onSuccess:function(t){var json=t.responseJSON;element.details.innerHTML=json.content;element.details.addClassName('valid-data');}});}
function render_user_callback(dest,data,element,beta){if(beta){var content="<div class='user-beta'><div class='title-background'>"+element.title+"</div><div class='title'><div class='info'>"+"</div>"+element.title+"</div><a class='profile' href='#'><img src='"+data['thumbnail_150']+"'/></a><div class='actions'>"+(data['num_photos']>1?"<span class='num-photos'><img src='"+STATIC_SERVER_URL+"/images/photos.png'> "+data['num_photos']+"</span>":'')+(!data['relationship']?"<a class='add' href='#' title='add'><img src='"+STATIC_SERVER_URL+"/images/add.png'></a>":"")+" <a class='message' title='message' href='#' onclick='return false;'><img src='"+STATIC_SERVER_URL+"/images/send_message.png'></a> <span "+(data['bookmarked']?"style='display:none;'":'')+" class='add-button entity-userint-"+data['int_id']+"'><a class='bookmark button' title='add to cool list' href='#'><img src='"+STATIC_SERVER_URL+"/images/add_to_hotlist_on.png'></a></span><span "+(!data['bookmarked']?"style='display:none;'":'')+" class='remove-button entity-userint-"+data['int_id']+"'><a class='bookmark button' title='remove from cool list' href='#'><img src='"+STATIC_SERVER_URL+"/images/add_to_hotlist_off.png'></a></span></div></div>";Element.update(dest,content);HLG.add_ent.add(null,dest);if(element.tagName=='A'){var link=dest.select('a.profile')[0];if(link){link.href=element.href;link.obsInherit(element,'click');}}
link=dest.down('a.add');if(link){link.onclick=function(){zc.hide_all_but_me(null);addFriend(element.user_id,LOGGED_IN_USER_INFO['name'],data['name'],false);return false;return false;}}
link=dest.down('a.message');if(link){link.onclick=function(){zc.hide_all_but_me(null);newPostMessage(undefined,undefined,element.user_id,{'thumbnail':data['thumbnail_42'],'name':data['name']});return false;}}
return;}else{common_string=get_user_common_string(data);var content="<div class='user"+(common_string!=''?' common-stuff':'')+"'><div class='title-background'>"+truncate(data['first_name'],8)+"</div><div class='title'><div class='info'>"+((data['num_photos']>1||data['num_photos']=="99+")?" <span class='num-photos'>"+parseInt(data['num_photos'])+"</span>":'')+"</div>"+truncate(data['first_name'],8)+"</div><img class='profile' src='"+data['photo_url']+"'/>"+(common_string!=''?"<div class='common'>"+common_string+"</div>":"")+"</div>";Element.update(dest,content);}}
function get_user_common_string(data){if(data['similarity']){if(data['similarity']=='high'){text='very similar';}else if(data['similarity']=='medium'){text='similar';}else if(data['similarity']=='low'){text='kind of similar';}
return"<img class='similarity similarity-"+data['similarity']+"' src='"+STATIC_SERVER_URL+"/images/clear.gif'/> You have <b class='similarity similarity-"+data['similarity']+"'>"+text+"</b> "+"tastes.";}else if(data['common_event']){if(data['common_event']['expired']){return"You both liked "+data['common_event']['name'];}else{return"You both like "+data['common_event']['name'];}}else if(data['common_friend']){if(data['common_friend']['num_friends']>1){return data['common_friend']['num_friends']+" friends in common, including "+data['common_friend']['first_name'];}else{return"You both have "+data['common_friend']['first_name']+" as a friend";}}
return'';}
function render_venue_callback(dest,data){var content="<div class='venue'><div class='top'><div class='photo'><img src='"+data['photo_url']+"'/>"+(data['num_interested']>0?"<div class='num-people'>"+data['num_interested']+"</div>":'')+"</div><div class='title'>"+truncate(data['name'],45)+"</div><div class='when-where'>"+data['address']+'<br/>'+data['city']+", "+data['state']+" "+data['zip']+"</div></div>"+get_friends_interested_string(data)+"</div><div class='pointer pointer-venue'></div>";if(data['num_friends_interested']==0)Element.addClassName(dest,'no-friends');Element.update(dest,content);}
function get_user_info(user_id,callback){result=users_info[user_id];if(!result){new Ajax.Request(HOME+'ajax/entity_info.php',{method:'get',parameters:{entity_type:'user',entity_id:user_id},onSuccess:function(t){value=t.responseJSON.content[user_id];if(value){users_info[user_id]=value;callback(value);}}})}else{callback(result);}}
function add_zoom(event,context){var event_regex=/event-(\d+)/;var venue_regex=/venue-(\d+)/;var user_regex=/user_id=(([A-Za-z0-9_ ]|(%20))+)?/;if(typeof(context)=="undefined")context=$(document.body);else context=$(context);context.select('a.z').each(function(el){if(el.hasClassName('zd'))
return;if(el.href.indexOf('event-')!=-1){var id=event_regex.exec(el.href)[1];el.observe('mouseover',function(event){getZC().ae(event,this,id);});}
else if(el.href.indexOf('venue-')!=-1){var id=venue_regex.exec(el.href)[1];el.observe('mouseover',function(event){getZC().av(event,this,id);});}
else if(el.href.indexOf('profile.php')!=-1){var id=user_regex.exec(el.href)[1];if(id){el.observe('mouseover',function(event){getZC().au(this,id,undefined,IS_BETA);});}}
el.addClassName('zd');});}
addDOMLoadEvent(add_zoom);Ajax.Responders.register({onComplete:function(ajax){add_zoom(ajax);}});;function extend(subclass,superclass){function Dummy(){}
Dummy.prototype=superclass.prototype;subclass.prototype=new Dummy();subclass.prototype.constructor=subclass;subclass.superclass=superclass;subclass.superproto=superclass.prototype;}
function AutoComplete(field_name,callback,header,id){var ac=this;this.mouseMoved=false;this.callback=callback;var match=field_name.match(new RegExp('^(.*)\\[([0-9]+)?\\]$'));this.mode=(match==null)?'single':'multi';this.limit=(this.mode=='multi'&&match[2])?match[2]:null;this.field_name=(match==null)?field_name:match[1]+'[]';this.selectorSearchIndex=0;this.seenIndex=-1;this.selectedResult=null;this.search_enabled=true;this.div=(id!=undefined)?$(id):E('DIV');this.div.className="auto-complete "+"auto-complete-"+this.mode;if(header){this.label=E('DIV');this.label.className='label';this.label.innerHTML=header;this.div.appendChild(this.label);}
this.inputDiv=E('DIV');this.inputDiv.className='input buggybox clearfix';this.inputDiv.onclick=function(){ac.enableSearch();};this.input=E('TEXTAREA');this.input.name='__dummy__';this.input.rows=1;this.input.wrap='off';this.input.setAttribute('autocomplete','off');this.input.className="mceNoEditor search";this.input.style.width='1px';if(isMac)this.input.onkeypress=function(event){return ac.onkeydown(event);};else this.input.onkeydown=function(event){return ac.onkeydown(event);};this.input.onkeyup=function(event){return ac.onkeyup(event);};this.input.onblur=function(event){return ac.onblur(event);};this.input.onfocus=function(){ac.enableSearch();}
this.inputDiv.appendChild(this.input);this.messageDiv=E('DIV');this.messageDiv.className="message-div";this.messageDiv.style.display='none';this.inputDiv.appendChild(this.messageDiv);this.div.appendChild(this.inputDiv);this.result_area=E('DIV');this.result_area.className='result-area';this.result_area.style.display='none';this.div.appendChild(this.result_area);this.onselect=null;this.onremove=null;}
AutoComplete.prototype.getElement=function(){return this.div;}
AutoComplete.prototype.getCurrentSelection=function(){var current=[];if(this.input.form){for(var i=0;i<this.input.form.elements.length;i++){if(this.input.form.elements[i].name==this.field_name){current[current.length]=this.input.form.elements[i];}}}
return current;}
AutoComplete.prototype.enableSearch=function(){var current=this.getCurrentSelection();len=current.length;limit_hit=(this.mode=='single'&&len>=1)||(this.mode=='multi'&&this.limit!=null&&len>=this.limit);if(!limit_hit){this.input.value='';this.input.style.display='';this.input.style.width='';this.result_area.innerHTML="";this.result_area.style.display="none";this.input.focus();this.search_enabled=true;this.seenIndex=this.selectorSearchIndex++;if(this.label)this.label.style.display='';this.eventHandleMouseMove=this.handleMouseMove.bindAsEventListener(this);this.mouseMoved=false;Event.observe(document.body,'mousemove',this.eventHandleMouseMove);this.messageDiv.style.display='none';}else{this.disableSearch();this.input.style.display='none';if(this.label)this.label.style.display='none';if(this.mode!='single'){this.messageDiv.innerHTML="(Limit reached)";this.messageDiv.style.display='';}}}
AutoComplete.prototype.handleMouseMove=function(event){if(this.input.value!='')this.mouseMoved=true;}
AutoComplete.prototype.disableSearch=function(){this.input.value='';this.input.style.width='1px';this.selectedResult=null;this.search_enabled=false;Event.stopObserving(document.body,'mousemove',this.eventHandleMouseMove);}
AutoComplete.prototype.onblur=function(event){if(this.selectedResult){if(!this.selectedResult.moused_over)this.selectedResult.onclick();}
else{this.disableSearch();this.result_area.style.display='none';}}
AutoComplete.prototype.onkeydown=function(event){event=window.event?window.event:event;keynum=event.keyCode;if(keynum==27){this.disableSearch();this.result_area.style.display='none';this.enableSearch();event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}else if(keynum==8){if(this.input.value==''){if(this.input.previousSibling&&this.input.previousSibling.allow_remove){this.input.parentNode.removeChild(this.input.previousSibling);}
event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}}else if(keynum==9){is_empty=this.input.value=='';if(this.selectedResult)this.selectedResult.onclick();if(!is_empty){event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}}else if(keynum==13){if(this.selectedResult)this.selectedResult.onclick();event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}else if(keynum==40){if(this.selectedResult&&this.selectedResult.nextSibling){Element.removeClassName(this.selectedResult,'selected');this.selectedResult=this.selectedResult.nextSibling;Element.addClassName(this.selectedResult,'selected');}
event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}else if(keynum==38){if(this.selectedResult&&this.selectedResult.previousSibling){Element.removeClassName(this.selectedResult,'selected');this.selectedResult=this.selectedResult.previousSibling;Element.addClassName(this.selectedResult,'selected');}
event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}else{return this.extrakeydown(event);}}
AutoComplete.prototype.extrakeydown=function(event){return true;}
AutoComplete.prototype.extrakeyup=function(event){return true;}
AutoComplete.prototype.timer=false;AutoComplete.prototype.onkeyup=function(event){if(window.event){keynum=window.event.keyCode;}else if(event.which){keynum=event.keyCode;}
if(this.extrakeyup(event)){if(keynum!=8&&keynum<=40)return false;if(this.timer!==false){clearTimeout(this.timer);}
var ac=this;var my_func=function(){var searchIndex=ac.selectorSearchIndex++;ac.selectedResult=null;new Ajax.Request(ac.callback+encodeURIComponent(ac.input.value),{onSuccess:function(results){ac.showResults(searchIndex,results.responseJSON.content);}});ac.timer=false;}
this.timer=setTimeout(my_func,250);}else return false;}
AutoComplete.prototype.hide=function(){this.div.style.display='none';}
AutoComplete.prototype.show=function(){this.div.style.display='';}
AutoComplete.prototype.is_visible=function(){return this.div.style.display!='none';}
AutoComplete.prototype.match=function(a,b){return a==b;}
AutoComplete.prototype.select=function(id,content,allow_remove,bulk){if(this.timer!==false)return false;allow_remove=(allow_remove==undefined)?true:allow_remove;this.disableSearch();this.result_area.innerHTML='';this.result_area.style.display='none';var current=this.getCurrentSelection();len=current.length;limit_hit=(this.mode=='single'&&len>=1)||(this.mode=='multi'&&this.limit!=null&&len>=this.limit);if(limit_hit)return false;found=false;for(var i=0;i<current.length;i++){if(this.match(current[i].value,id)){found=true;break;}}
if(!found){var div=E('DIV');div.className="chosen";div.innerHTML=content;div.allow_remove=allow_remove;if(allow_remove){var link=E('A');link.className='remove';link.title='remove';link.href='#';link.innerHTML="<img src='"+STATIC_SERVER_URL_LEGACY+"/images/x_close.gif'/>";var ac=this;link.onclick=function(){ac.remove(id);return false;};div.insertBefore(link,div.firstChild);}
div.appendChild(createFormInput('hidden',this.field_name,id));this.input.parentNode.insertBefore(div,this.input);if(this.onselect)this.onselect(id,content,allow_remove,bulk);}
return true;}
AutoComplete.prototype.remove=function(id,bulk){var current=this.getCurrentSelection();for(var i=0;i<current.length;i++){if(this.match(current[i].value,id)){$(current[i]).up('.chosen').remove();this.enableSearch();if(this.onremove)this.onremove(id,bulk);break;}}}
AutoComplete.prototype.showResults=function(index,results){if(this.search_enabled&&index>this.seenIndex){this.seenIndex=index;this.result_area.innerHTML='';if(typeof(results)=='object'){var fs=this;var rows=new Array();for(var i=0;i<results.length;i++){var div=E('DIV');div.className='result';div.chosen_id=results[i]['id'];div.chosen_display=this.renderOneChosen(results[i]);if(results[i]['disabled']){div.onclick=function(){};div.className+=' disabled';}else{div.onclick=function(){fs.select(this.chosen_id,this.chosen_display);fs.enableSearch();return false;};}
div.innerHTML=this.renderOne(results[i]);if(results[i]['disabled']){}else{div.onmouseover=function(){if(fs.mouseMoved){if(fs.selectedResult)Element.removeClassName(fs.selectedResult,'selected');fs.selectedResult=this;Element.addClassName(fs.selectedResult,'selected');this.moused_over=true;}}
div.onmouseout=function(){if(fs.mouseMoved){this.moused_over=false;}}
if(i==0){this.selectedResult=div;Element.addClassName(this.selectedResult,'selected');}}
this.result_area.appendChild(div);}}else{var div=E('DIV');div.innerHTML=results;this.result_area.appendChild(div);}
this.result_area.style.width=(this.inputDiv.offsetWidth-8)+'px';this.result_area.style.display='';}}
AutoComplete.prototype.renderOne=function(values){return values?values['display']:'';}
AutoComplete.prototype.renderOneChosen=function(values){return values?values['chosen_display']:'';}
function FriendSelector(include_emails,include_header,int_ids){var qs='';if(include_emails){qs='include_emails=1&';}
if(int_ids){qs+='int_ids=1&';}
qs+='search=';if(include_header||include_header==undefined){var header=(include_emails)?"<b>To</b>: (type friends' names or emails)":"<b>To:</b> (type friend's names)";}else{var header=undefined;}
FriendSelector.superclass.call(this,'send_to_friends[]','ajax_friend_search.php?'+qs,header);}
extend(FriendSelector,AutoComplete);FriendSelector.prototype.renderOne=function(values){return"<img src='"+values['photo']+"'/> "+(values['type']=='email'?values['email']:values['name']);}
FriendSelector.prototype.renderOneChosen=function(values){return"<img src='"+values['photo']+"'/> "+(values['type']=='email'?values['email']:values['name']);}
function InboxRecipientFriendSelector(){var header="To: (Start typing a friend's name)";InboxRecipientFriendSelector.superclass.call(this,'recipient_id','ajax_friend_search.php?search=',header);}
extend(InboxRecipientFriendSelector,AutoComplete);InboxRecipientFriendSelector.prototype.renderOne=function(values){return"<img src='"+values['photo']+"'/> "+values['name'];}
InboxRecipientFriendSelector.prototype.renderOneChosen=function(values){return"<img src='"+values['thumbnail']+"'/> You are sending a message to "+values['name'];}
function EventFriendSelector(invite_id,event_id,include_emails,limit){if(typeof(limit)=='undefined')
limit='';var header=(include_emails)?"To: (Start typing a friends' names or email addresses)":"To: (Start typing a friend's names)";if(invite_id)url='ajax_friend_search.php?invite_id='+invite_id;else if(event_id)url='ajax_friend_search.php?event_id='+event_id;else url='ajax_friend_search.php?';args={};if(include_emails)args['include_emails']='1';args['search']='';FriendSelector.superclass.call(this,'send_to_friends['+limit+']',url+'&'+Object.toQueryString(args),header);var l_this=this;setInterval(function(){l_this.checkforpaste();},250);}
extend(EventFriendSelector,AutoComplete);EventFriendSelector.prototype.renderOne=function(values){return"<img src='"+values['photo']+"'/> "+(values['type']=='email'?values['email']:values['name'])+(values['disabled']?" <span>(has already been invited)</span>":'');}
EventFriendSelector.prototype.renderOneChosen=function(values){return"<img src='"+values['photo']+"'/> "+(values['type']=='email'?values['email']:values['name']);}
EventFriendSelector.prototype.checkforpaste=function(event){if(!this.search_enabled)return true;var length=this.input.value.length;if((this.last_input_length==undefined&&length>1)||(length-this.last_input_length>1)){var emails=parseEmails(this.input.value);for(var i=0;i<emails.length;i++){var email=emails[i];var id="e//"+email;if(this.select(id,this.renderOneChosen({'id':id,'type':'email','photo':DEFAULT_USER_PHOTO_SQ_20,'email':email}))){this.enableSearch();}}
this.last_input_length=(emails.length==0)?length:0;return emails.length==0;}
this.last_input_length=length;return true;}
function TagSelector(field_name,max_tags,entity_type,aspect){url='ajax/tag_search.php?entity_type='+entity_type+'&aspect='+aspect+'&search=';TagSelector.superclass.call(this,field_name+'['+max_tags+']',url,'');var l_this=this;setInterval(function(){l_this.checkforpaste();},250);}
extend(TagSelector,AutoComplete);TagSelector.prototype.match=function(a,b){return a.evalJSON()[0].toLowerCase()==b.evalJSON()[0].toLowerCase();}
TagSelector.prototype.extrakeydown=function(event){keynum=(event.which)?event.which:event.keyCode;if((isMac&&keynum==44)||keynum==188){is_empty=this.input.value=='';if(this.selectedResult)this.selectedResult.onclick();if(!is_empty){event.cancelBubble=true;if(event.preventDefault)event.preventDefault();if(event.stopPropagation)event.stopPropagation();return false;}}}
TagSelector.prototype.checkforpaste=function(event){if(!this.search_enabled)return true;var length=this.input.value.length;if((this.last_input_length==undefined&&length>1)||(length-this.last_input_length>1)){var tags=this.input.value.split(',');if(tags.length>1){for(var i=0;i<tags.length;i++){var tag=tags[i].trim();if(tag!=''){if(this.select([tag,LOGGED_IN_USER_ID].toJSON(),tag)){this.enableSearch();}}}}
this.last_input_length=(tags.length==0)?length:0;return tags.length==0;}
this.last_input_length=length;return true;}
function VenueSelector(id){VenueSelector.superclass.call(this,'venue_id','ajax/venue_search.php?q=',undefined,id);}
extend(VenueSelector,AutoComplete);VenueSelector.prototype.renderOne=function(values){return values['name']+' ('+values['city']+', '+values['state']+')';}
VenueSelector.prototype.renderOneChosen=function(values){return values['name'].truncate(25)+' ('+values['city']+', '+values['state']+')';};openPopups=new Array();function Popup(width,title,className,height,modal,title_id,allow_scroll,close_link_function){this.identifier=title;if(openPopups[this.identifier]){return openPopups[this.identifier];}
openPopups[title]=this;this.allow_scroll=(ie6||isMacFireFox)||allow_scroll;if(modal==null||modal==undefined)modal=false;this.modal=modal;var element=document.createElement("DIV");element.id=createUID("popup");if(width)element.style.width=width+"px";if(height)element.style.height=height+"px";if(className==null||className==undefined)className=IS_BETA?"wPopup-beta png":"wPopup";element.className=className;if(title){var div=document.createElement('DIV');div.className="header";var inner=E('DIV');inner.className="popup-left";div.appendChild(inner);var link=document.createElement('A');link.className='close-link';link.href='#null';var popup=this;if(close_link_function){link.onclick=function(){close_link_function();popup.close();return false;}}else{link.onclick=function(){popup.close();return false;}}
if(ie)link.innerHTML="Close <img src='"+STATIC_SERVER_URL+"/images/close-x2.gif'/>";else link.innerHTML="Close <img src='"+STATIC_SERVER_URL+"/images/close-x2.png'/>";inner.appendChild(link);var title_el=document.createElement('SPAN');if(title_id){title_el.setAttribute('id',title_id);}
title_el.innerHTML=title;inner.appendChild(title_el);inner.onmousedown=function(event){if(ie){if(window.event.srcElement)dragStart(event,element.id);}else{if(event.target)dragStart(event,element.id);}};element.appendChild(div);}
if(this.modal){var popup=this;window.onresize=function(){center(element.id);};}
var div=document.createElement('DIV');div.className="content popup-content clearfix";var inner=E('DIV');inner.className='inner';div.appendChild(inner);this.contentDiv=inner;element.appendChild(div);if(IS_BETA){div=E('DIV');div.className='footer';inner=E('DIV');inner.className='popup-left';div.appendChild(inner);element.appendChild(div);}
this.element=element;this.content=null;}
Popup.prototype.setContent=function(el){var links=el.getElementsByTagName('a');var popup=this;for(i=0;i<links.length;i++){if(links[i].className.match(/(^| )close( |$)/)){var existing_onclick=links[i].onclick;links[i].onclick=function(){popup.close();if(existing_onclick){existing_onclick();}
return false;}}}
if(this.content!=null){this.contentDiv.removeChild(this.content);}
this.content=el;this.contentDiv.appendChild(el);}
Popup.prototype.show=function(){this.element.style.visibility="hidden";this.element.style.position=this.allow_scroll?"absolute":"fixed";document.body.appendChild(this.element);center(this.element.id);activecontentHider(this.element,this.modal);this.element.style.zIndex=findNextZIndex(this.element);if(this.element.modal){this.element.modal.style.zIndex=this.element.style.zIndex-1;this.element.modal.style.visibility="visible";clientSize=getScreenSize();this.element.modal.style.left="0px";this.element.modal.style.top="0px";if(ie6){this.element.modal.style.height=(document.body.scrollHeight>clientSize[1]?document.body.scrollHeight:clientSize[1])+'px';this.element.modal.style.width=(document.body.scrollWidth>clientSize[0]?document.body.scrollWidth:clientSize[0])+'px';}else{this.element.modal.style.height=clientSize[1]+'px';this.element.modal.style.width=clientSize[0]+'px';}}
if(this.element.ifrm){this.element.ifrm.style.zIndex=this.element.style.zIndex-2;this.element.ifrm.style.visibility="visible";this.element.ifrm.style.left=(this.element.modal&&ie6)?this.element.modal.style.left:this.element.style.left;this.element.ifrm.style.top=(this.element.modal&&ie6)?this.element.modal.style.top:this.element.style.top;this.element.ifrm.style.height=(this.element.modal&&ie6)?this.element.modal.style.height:this.element.offsetHeight;this.element.ifrm.style.width=(this.element.modal&&ie6)?this.element.modal.style.width:this.element.offsetWidth;}
this.element.style.visibility="visible";this.element.style.display="block";if(ie){var element=this.element;window.onscroll=function(){if(this.offset==undefined)this.offset=1;var x=parseInt(element.style.left,10);var y=parseInt(element.style.top,10);if(this.offset==1)this.offset=-1;else this.offset=1;move(element,x+this.offset,y);}}}
Popup.prototype.close=function(){if(this.element.ifrm)this.element.ifrm.style.visibility='hidden';if(this.element.modal)this.element.modal.style.visibility='hidden';this.element.style.display='none';document.body.removeChild(this.element);openPopups[this.identifier]=null;}
Popup.prototype.getId=function(){return this.element.id;}
function getFormField(form,field){for(var i=0;i<form.elements.length;i++){element=form.elements[i];if(element.name==field){if(element.type=="checkbox"||element.type=="radio"){if(element.checked){return element;}}else{return element;}}}
return null;}
function getFormParameters(form,button){var parameters="";for(i=0;i<form.elements.length;i++){element=form.elements[i];if(element.name&&!element.disabled){if(element.type!="submit"||element==button){if(element.type=="select-multiple"){anySelected=false;for(j=0;j<element.options.length;j++){if(element.options[j].selected){parameters+="&"+element.name+"="+encodeURIComponent(element.options[j].value);anySelected=true;}}
if(!anySelected){parameters+="&"+element.name+"=";}}
else{if(element.type=="checkbox"||element.type=="radio"){if(element.checked){parameters+="&"+element.name+"=";parameters+=encodeURIComponent(element.value);}}
else{parameters+="&"+element.name+"=";parameters+=encodeURIComponent(element.value);}}}}}
return parameters.substring(1);}
registration_shown=false;function showRegistration(title,form_values,required,className){if(registration_shown){return;}
urchinTracker('/analytics/signup_popup');registration_shown=true;var popup=new Popup(500,null,"cleanPopup "+className,null,true);var div=$(document.createElement('DIV'));var html_content=$('register_popup').innerHTML;id_replace='_shown';div.innerHTML=replaceAll(html_content,'__id__',id_replace);popup.setContent(div);popup.show();HLG.contentChanged();if((form_values!=undefined&&form_values!=null)||(title!=undefined&&title!=null)){var link=$('join-now'+id_replace);params=$H(link.href.toQueryParams());if(title!=undefined&&title!=null){params.set('title',title);}
if((form_values!=undefined&&form_values!=null)){for(var i=0;i<form_values.length;i++){params.set(form_values[i][0],form_values[i][1]);}}
link.href='build_profile.php?'+params.toQueryString();var form=div.select('#l_form'+id_replace)[0];if(form_values!=undefined&&form_values!=null){for(var i=0;i<form_values.length;i++){form.appendChild(createFormInput('hidden',form_values[i][0],form_values[i][1]));}}}
$('close'+id_replace).onclick=function(){if(required){document.location.href=HOME?HOME:'/';}else{popup.close();registration_shown=false;}
return false;};}
function newPostMessage(mb_id,message_id,recipient_id,recipient_content,subject){var title="Send a Message";var popup=new Popup(412,title);var message=null;is_reply=mb_id!=undefined;var div=document.createElement("DIV");div.className="commentForm";var form=document.createElement("FORM");form.onsubmit=function(){return false;};form.method="POST";form.id=createUID("post_message");var friendSelector=new InboxRecipientFriendSelector();form.appendChild(friendSelector.getElement());div.appendChild(form);if(is_reply){var message;new Ajax.Request('ajax_load_message.php',{method:'get',asynchronous:false,parameters:{board:'UserPrivateMessageBoard',board_id:mb_id,message_id:message_id,admin_mode:0},onSuccess:function(t){message=t.responseJSON.content;}});var subjectline=document.createElement("DIV");v=message['subject'];if(v.indexOf('RE:')==-1){v="RE: "+v;}
form.appendChild(document.createElement("BR"));subjectline.innerHTML="<h3 class='portlet-header'>"+v+"</h3>";form.appendChild(subjectline);var d=document.createElement("DIV");d.style.overflow="auto";d.style.height="100px";d.style.border="1px solid gray";d.style.width="100%";d.innerHTML=message['body'];form.appendChild(d);form.appendChild(document.createElement("BR"));form.appendChild(createFormInput('hidden','reply_to',message_id));form.appendChild(createFormInput('hidden','subject',v));}
if(!is_reply){var label=document.createElement("LABEL");label.innerHTML="Subject";form.appendChild(label);form.appendChild(document.createElement("BR"));var subject=createFormInput('text','subject',subject?subject:'');subject.style.width="100%";subject.className="input";form.appendChild(subject);form.appendChild(document.createElement("BR"));}
var messagelabel=document.createElement("LABEL");messagelabel.innerHTML="Message";form.appendChild(messagelabel);var textarea=document.createElement("TEXTAREA");textarea.name="message_body";textarea.style.width="100%";textarea.rows=10;textarea.className="input";form.appendChild(textarea);form.appendChild(createFormInput('hidden','_submit_check','post_message'));form.appendChild(createFormInput('hidden','board','UserPrivateMessageBoard'));div.appendChild(form);var buttons=document.createElement('DIV');buttons.className='action_buttons';var link=createButton('auto-send');link.onclick=function(){var current=new Array();for(var i=0;i<form.elements.length;i++){if(form.elements[i].name=='recipient_id'){current[current.length]=form.elements[i];}}
var recipient_id=getFormField(form,'recipient_id');var subject=getFormField(form,'subject');var message_body=getFormField(form,'message_body');if(!recipient_id&&!recipient_id.value){feedback.innerHTML="Please enter in a recipient.";return true;}else if((!subject||!subject.value)&&(!message_body||!message_body.value)){feedback.innerHTML="Please enter either a subject or message.";return true;}else{form.submit();return false;}};var feedback=document.createElement('LABEL');feedback.className='problem_feedback';buttons.appendChild(feedback);buttons.appendChild(link);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();if(recipient_id){var content=friendSelector.renderOneChosen(recipient_content);friendSelector.select(recipient_id,content,false);friendSelector.enableSearch();}
if(is_reply){textarea.focus();}else if(recipient_id){subject.focus();}else{friendSelector.input.focus();}}
function html_popup(html_content,width,title,close_fn){var popup=new Popup(width,title);var div=document.createElement("DIV");div.innerHTML=html_content;if(!close_fn)close_fn=function(){}
popup.old_close=popup.old_close?popup.old_close:popup.close;popup.close=function(){popup.old_close();close_fn();}
div.closePopup=function(){popup.close();return false;}
popup.setContent(div);popup.show();return popup;}
function ajax_popup(url,width,title,close_fn,meta_data){var processing=HLG.showProcessing('center','center');new Ajax.Request(url,{method:'post',parameters:meta_data,onSuccess:function(t){processing.remove();xml=t.responseXML;nodes=xml.getElementsByTagName('content')[0].childNodes;for(i=0;i<nodes.length;i++){if(nodes[i].nodeType==4){html_popup(nodes[i].nodeValue,width,title,close_fn);break;}}}});}
function closeNodePopup(node){if(node.closePopup!=undefined){node.closePopup();}else if(node.parentNode!=undefined){closeNodePopup(node.parentNode);}else{return;}}
function sendToFriends(logged_in,url,invite_id_filter,event_id_filter,name,email,subject,limit,can_blast,metadata){if(typeof(can_blast)=='undefined')
can_blast=false;if(typeof(limit)=='undefined')
limit=450;var track_string='/popup/send_to_friends/';if(invite_id_filter){track_string+='invite';}else if(event_id_filter){track_string+='event';}else{track_string+='';}
HLG.track(track_string);message_popup('send_to_friends',logged_in,'Send to Friends - Let others know!',url,invite_id_filter,event_id_filter,name,email,subject,limit,can_blast,metadata,420);}
function sendToFriends2(logged_in,subject,limit,can_blast,metadata){sendToFriends(logged_in,undefined,metadata['entity_type']=='invite'?metadata['entity_id']:null,metadata['entity_type']=='event'?metadata['entity_id']:null,undefined,undefined,subject,limit,can_blast,metadata);}
function message_popup(submit_check,logged_in,title,url,invite_id_filter,event_id_filter,name,email,default_subject,limit,can_blast,metadata,width){if(typeof(can_blast)=='undefined')
can_blast=false;if(typeof(limit)=='undefined')
limit=450;if(width=='undefined')width=400
var popup=new Popup(width,title,undefined,undefined,undefined,undefined,true);var div=E("DIV");div.id='invite_friends_popup';var form=E("FORM");form.method="POST";form.id=createUID("send_to_friends");if(metadata)form.appendChild(createFormInput('hidden','metadata',$H(metadata).toJSON()));var friends;if(logged_in){extra_url_stuff=(invite_id_filter?"?invite_id_filter="+invite_id_filter:"")+(event_id_filter?"?event_id_filter="+event_id_filter:"");new Ajax.Request("ajax/friend_list.php"+extra_url_stuff,{asynchronous:false,onSuccess:function(transport){friends=transport.responseJSON.content;}});}else{friends=new Array();}
var send_btn=createButton('auto-send');var friendList=E('DIV');var friendSelector=new EventFriendSelector(invite_id_filter,event_id_filter,true,limit);send_btn.onclick=function(){atleastonechecked=false;if(can_blast){choices=document.getElementById("address_list_choices");for(i=0;i<choices.childNodes.length;i++){cbid=choices.childNodes[i].id.slice(3);thischeckbox=document.getElementById(cbid);if(thischeckbox.checked){atleastonechecked=true;}}}
var current=new Array();for(var i=0;i<form.elements.length;i++){if(form.elements[i].name=='send_to_friends[]'){current[current.length]=form.elements[i];}}
if(!logged_in){tovalidate=send_from_email_input.value;if(!tovalidate.match(/^\w+$/)&&!tovalidate.match(/[\w\.\+\-=]+@[\w\.\-]+\.[\w\-]+/))
{feedback.innerHTML="Please enter in a valid return email address.";return true;}}
if((current.length==0||(current.length==1&&current[0].length==0))&&textaddresses.value==""&&!atleastonechecked){if(!logged_in){feedback.innerHTML="You did not enter any email addresses to send to.";}else{feedback.innerHTML="You did not add friends or enter an email address to send to.";}
return true;}else{feedback.innerHTML="";var span=document.createElement('SPAN');span.innerHTML='<b>processing...</b>&nbsp;&nbsp;';this.parentNode.replaceChild(span,this);form.submit();return false;}}
var aboveAddressListChoice=E('DIV');var emailbox=E('DIV');var tableDiv=document.createElement("DIV");var hiddenplaxoinput=createFormInput('hidden','plaxo_data_hidden');hiddenplaxoinput.id='plaxo_data_hidden';var toggleLinks=E('DIV');toggleLinks.style.textAlign='right';var plaxofunction1=function(){registerPlaxoCallback(function(){var emails=parseEmails($('plaxo_data_hidden').value);for(var i=0;i<emails.length;i++){var email=emails[i];var id="e//"+email;var display=friendSelector.renderOneChosen({'id':id,'type':'email','photo':STATIC_USER_SERVER_URL+'/images/avatars/sq20_gender_neutral.jpeg','email':email});friendSelector.select(id,display);}});showPlaxoABChooser('plaxo_data_hidden',document.location.pathname.substr(0,document.location.pathname.lastIndexOf('/')+1)+'plaxo_cb.html');return false;};var textarea_id=createUID('send_to');var plaxofunction2=function(){registerPlaxoCallback(null);showPlaxoABChooser(textarea_id,document.location.pathname.substr(0,document.location.pathname.lastIndexOf('/')+1)+'plaxo_cb.html');return false;};var importLink=E('A');importLink.href="#";importLink.innerHTML="Import from Addressbook";toggleLinks.appendChild(importLink);if(friends&&friends.length>0){importLink.onclick=plaxofunction1;toggleLinks.appendChild(T(' | '));var friendListDiv=E('DIV');addFriendsSelector(friendListDiv,friends,send_btn);var link1=E('A');link1.innerHTML="Select Friends from List";link1.href="#";link1.onclick=function(){this.style.display='none';link2.style.display='';friendList.removeChild(friendSelector.getElement());friendList.appendChild(friendListDiv);emailbox.removeChild(hiddenplaxoinput);emailbox.appendChild(tableDiv);importLink.onclick=plaxofunction2;center(popup.element.id);return false;}
toggleLinks.appendChild(link1);var link2=E('A');link2.href="#";link2.style.display='none';link2.innerHTML="Type in Friends";link2.onclick=function(){this.style.display='none';link1.style.display='';friendList.removeChild(friendListDiv);friendList.appendChild(friendSelector.getElement());emailbox.removeChild(tableDiv);emailbox.appendChild(hiddenplaxoinput);importLink.onclick=plaxofunction1;center(popup.element.id);return false;}
toggleLinks.appendChild(link2);aboveAddressListChoice.appendChild(toggleLinks);aboveAddressListChoice.appendChild(E('BR'));friendList.appendChild(friendSelector.getElement());aboveAddressListChoice.appendChild(friendList);}else{importLink.onclick=plaxofunction2;aboveAddressListChoice.appendChild(toggleLinks);}
if(!logged_in){var label=document.createElement("LABEL");label.innerHTML="<strong>Your name</strong>";aboveAddressListChoice.appendChild(label);aboveAddressListChoice.appendChild(document.createElement("BR"));var input=createFormInput('text','send_from_name');input.style.width="100%";if(name){input.value=name;}
aboveAddressListChoice.appendChild(input);aboveAddressListChoice.appendChild(document.createElement("BR"));var label=document.createElement("LABEL");label.innerHTML="<strong>Your email</strong>";aboveAddressListChoice.appendChild(label);aboveAddressListChoice.appendChild(document.createElement("BR"));var send_from_email_input=createFormInput('text','send_from_email');send_from_email_input.style.width="100%";if(email){send_from_email_input.value=email;}
aboveAddressListChoice.appendChild(send_from_email_input);aboveAddressListChoice.appendChild(document.createElement("BR"));aboveAddressListChoice.appendChild(document.createElement("BR"));}
var tableHTML='<BR/><table width="100%" border="0" cellpadding="0" cellspacing="0"><td valign="bottom">';if(friends&&friends.length>0){tableHTML+='<strong>Or enter emails separated by spaces or commas</strong>';}else{tableHTML+='<strong>Enter emails separated by spaces or commas</strong>';}
tableHTML+='</td></tr></table>';tableDiv.innerHTML=tableHTML;var textarea=document.createElement("TEXTAREA");var textaddresses=textarea;textarea.name="send_to";textarea.id=textarea_id;textarea.style.width="100%";textarea.rows=3;textarea.className="input";tableDiv.appendChild(textarea);if(!logged_in||!friends||friends.length==0)emailbox.appendChild(tableDiv);else emailbox.appendChild(hiddenplaxoinput);aboveAddressListChoice.appendChild(emailbox);if(can_blast){var email_list_div=document.createElement('DIV');email_list_div.id='email_list';var lists_div=document.createElement('DIV');lists_div.id='lists';lists_div.innerHTML='        <div id="loading"></div>'+'        <div id="got">'+'          <p>Send to My Lists:</p>'+'          <ul id="address_list_choices"></ul>'+'          <div style="clear: both;"/>'+'        </div>'+'        <div id="none"></div>';email_list_div.appendChild(lists_div);var add_list_words_div=document.createElement('DIV');add_list_words_div.id='add_list_words';add_list_words_div.innerHTML='<div id="link"><span><a href="#">Upload a List</a></span></div>'+'<div id="title"><span id="upload-target">Upload a List</span></div>'+'<div id="processing"><span>Processing...</span></div>';add_list_words_div.style.textAlign='right';email_list_div.appendChild(add_list_words_div);aboveAddressListChoice.appendChild(email_list_div);new AddressListSelection(div,add_list_words_div,lists_div,aboveAddressListChoice,logged_in);}
form.appendChild(aboveAddressListChoice);form.appendChild(E("BR"));if(default_subject||event_id_filter||invite_id_filter){var span_title=$('real_event_title');var div_email_subject=E('DIV');div_email_subject.style.marginBottom='10px';var subject_label=E("LABEL");subject_label.innerHTML="<strong>Subject: </strong>";div_email_subject.appendChild(subject_label);var edit_text_span=E('SPAN');var subject=E("INPUT");var subject_span=E('SPAN');if(span_title||default_subject){edit_text_span.style.display='none';var edit_span=E('SPAN');subject_span.innerHTML=default_subject?default_subject:span_title.innerHTML;edit_span.appendChild(subject_span);var edit_span_link=E('SPAN');edit_span_link.style.fontSize="10px";edit_span_link.appendChild(T(' ('));var edit_link=E('A');edit_link.href='#';edit_link.onclick=function(){Element.hide(edit_span);Element.show(edit_text_span);subject.focus();return false;};edit_link.innerHTML='edit';edit_span_link.appendChild(edit_link);edit_span_link.appendChild(T(') '));edit_span.appendChild(edit_span_link);div_email_subject.appendChild(edit_span);}
edit_text_span.appendChild(E('BR'));subject.name="message_subject";subject.style.width="100%";subject.className="input"
subject.type='text';if(span_title||default_subject){subject.value=default_subject?default_subject:span_title.innerHTML.unescapeHTML();subject.onblur=function(){Element.show(edit_span);Element.hide(edit_text_span);subject_span.innerHTML=subject.value;}}
edit_text_span.appendChild(subject);div_email_subject.appendChild(edit_text_span);form.appendChild(div_email_subject);}
var label=document.createElement("LABEL");label.innerHTML="<strong>Message</strong>";form.appendChild(label);var textarea=document.createElement("TEXTAREA");textarea.name="message_body";textarea.style.width="100%";textarea.rows=4;textarea.className="input";form.appendChild(textarea);form.appendChild(createFormInput('hidden','_submit_check',submit_check));form.appendChild(createFormInput('hidden','url',url));div.appendChild(form);var feedback=document.createElement('LABEL');feedback.className='problem_feedback';var buttons=document.createElement('DIV');buttons.className='action_buttons';buttons.appendChild(feedback);buttons.appendChild(send_btn);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();if(friendSelector)friendSelector.input.focus();}
function addFriendsSelector(friendsContainer,friends,send_btn){var leftFriendsContainer=document.createElement("DIV");leftFriendsContainer.className="friendChooser left";{var table=E('TABLE');table.cellSpacing="0";table.cellPadding="0";table.className='popuptabs';var tbody=E('TBODY');var row=E('TR');var cell=E('TD');cell.id='friends_tab_0';cell.className='selected';var link=E('A');link.href='#';link.innerHTML='My Friends';link.onclick=function(){toggle_tab('friends',0);return false;};cell.appendChild(link);row.appendChild(cell);var cell=E('TD');cell.className='spacer';cell.innerHTML='&nbsp;';row.appendChild(cell);var cell=E('TD');cell.id='friends_tab_1';var link=E('A');link.href='#';link.innerHTML='My Contacts';link.onclick=function(){toggle_tab('friends',1);return false;};cell.appendChild(link);row.appendChild(cell);tbody.appendChild(row);table.appendChild(tbody);leftFriendsContainer.appendChild(table);var optionsSelect=document.createElement("SELECT");optionsSelect.id='friends_content_0';optionsSelect.multiple=true;optionsSelect.style.borderTop='0px';var friends_list={};for(i=0;i<friends.length;i++){if(friends[i][2]=='friend'){var option=new Option();option.value=friends[i][0];option.text=friends[i][1];option.title=friends[i][1];friends_list[friends[i][0]]=true;add_option(optionsSelect,option);}}
leftFriendsContainer.appendChild(optionsSelect);var optionsSelectContacts=document.createElement("SELECT");optionsSelectContacts.id='friends_content_1';optionsSelectContacts.multiple=true;optionsSelectContacts.style.display='none';optionsSelectContacts.style.borderTop='0px';for(i=0;i<friends.length;i++){if(friends[i][2]=='contact'){var option=new Option();option.value=friends[i][0];option.text=friends[i][1];option.title=friends[i][1];add_option(optionsSelectContacts,option);}}
leftFriendsContainer.appendChild(optionsSelectContacts);}
var midFriendsContainer=document.createElement("DIV");midFriendsContainer.className="friendButtons";{var addButton=document.createElement("INPUT");addButton.type="button";addButton.value="Add "+String.fromCharCode(187);addButton.disabled=true;midFriendsContainer.appendChild(addButton);midFriendsContainer.appendChild(document.createElement("BR"));midFriendsContainer.appendChild(document.createElement("BR"));var removeButton=document.createElement("INPUT");removeButton.type="button";removeButton.value=String.fromCharCode(171)+" Remove";removeButton.disabled=true;midFriendsContainer.appendChild(removeButton);}
var rightFriendsContainer=document.createElement("DIV");rightFriendsContainer.className="friendChooser right";{var label=document.createElement("LABEL");label.innerHTML="<strong>Selected</strong>";rightFriendsContainer.appendChild(label);rightFriendsContainer.appendChild(document.createElement("BR"));var select=document.createElement("SELECT");select.name="send_to_friends[]";select.multiple=true;rightFriendsContainer.appendChild(select);}
optionsSelect.onchange=function(){addButton.disabled=this.selectedIndex==-1;}
optionsSelectContacts.onchange=function(){addButton.disabled=this.selectedIndex==-1;}
select.onchange=function(){removeButton.disabled=this.selectedIndex==-1;}
var moveOptions=function(button,a,b){for(var i=0;i<a.options.length;i++){var option=a.options[i]
if(option.selected){var optObj=new Option();optObj.text=option.text;optObj.value=option.value;optObj.title=option.title;add_option(b,optObj);a.remove(i);i--;}}
sortSelect(b);button.disabled=true;return false;}
var moveOptionsBack=function(button,source,friends,contacts){for(var i=0;i<source.options.length;i++){var option=source.options[i]
if(option.selected){var optObj=new Option();optObj.text=option.text;optObj.value=option.value;optObj.title=option.title;if(friends_list[option.value]){add_option(friends,optObj);}else{add_option(contacts,optObj);}
source.remove(i);i--;}}
sortSelect(friends);sortSelect(contacts);button.disabled=true;return false;}
addButton.onclick=function(){return moveOptions(this,optionsSelect.style.display=='none'?optionsSelectContacts:optionsSelect,select);}
removeButton.onclick=function(){return moveOptionsBack(this,select,optionsSelect,optionsSelectContacts);}
friendsContainer.appendChild(leftFriendsContainer);friendsContainer.appendChild(midFriendsContainer);friendsContainer.appendChild(rightFriendsContainer);var clearDiv=document.createElement("DIV");clearDiv.style.clear="both";friendsContainer.appendChild(clearDiv);send_btn.old_onclick=send_btn.onclick;send_btn.onclick=function(){for(var i=0;i<select.options.length;i++){select.options[i].selected=true;}
return send_btn.old_onclick();};}
function createEditorsPick(event_id,event_title,logged_in_user_id,logged_in_user_first_name,poster_id,poster_first_name){var popup=new Popup(410,"Make this event an Editors' Pick");var div=document.createElement("DIV");var form=document.createElement("FORM");form.method="POST";form.id=createUID("post_editors_pick");var label=document.createElement("LABEL");label.innerHTML="Title";form.appendChild(label);form.appendChild(document.createElement("BR"));var title=createFormInput('text','title');title.style.width="373px";title.className="input";title.value=event_title;form.appendChild(title);form.appendChild(document.createElement("BR"));form.appendChild(document.createElement("BR"));var label=document.createElement("LABEL");label.innerHTML="Picker:&nbsp;&nbsp;";form.appendChild(label);var select=document.createElement("SELECT");select.name="picker_id";var optObj=document.createElement('option');optObj.text=logged_in_user_first_name;optObj.value=logged_in_user_id;add_option(select,optObj);var optObj=document.createElement('option');optObj.text=poster_first_name;optObj.value=poster_id;add_option(select,optObj);form.appendChild(select);form.appendChild(document.createElement("BR"));form.appendChild(document.createElement("BR"));var textarea=document.createElement("TEXTAREA");textarea.name="editors_take";textarea.style.width="373px";textarea.rows=10;textarea.className="input";form.appendChild(textarea);form.appendChild(createFormInput('hidden','_submit_check','create_editors_pick'));form.appendChild(createFormInput('hidden','event_id',event_id));div.appendChild(form);var buttons=document.createElement('DIV');buttons.className='action_buttons';var link=createButton('auto-save');link.onclick=function(){form.submit();return false;};buttons.appendChild(link);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();if(title.value=="")title.focus();else textarea.focus();}
function postEventPopup(meta_data){var processing=HLG.showProcessing('center','center');new Ajax.Request('ajax_add_an_event.php',{method:'post',parameters:meta_data,onSuccess:function(t){processing.remove();html_popup(t.responseJSON.content.content,t.responseJSON.content.ticketing_approved?650:490,'Event Posting Options');}});}
function deleteUpdate(update_id){var answer=confirm("Are you sure you want to delete this update?");if(answer){var form=document.createElement('FORM');form.method='POST';form.appendChild(createFormInput('hidden','_submit_check','delete_update'));form.appendChild(createFormInput('hidden','update_id',update_id));document.body.appendChild(form);form.submit();}}
function editUserAlbum(form_name,album_name,album_desc,album_date){var popup=new Popup(290,"Edit Album");var div=document.createElement("DIV");var form=document.createElement("FORM");form.method="POST";form.id=createUID(form_name);form.name=form_name
form.appendChild(createFormInput('hidden','_submit_check',form_name));var name_label=document.createElement('STRONG');name_label.innerHTML='Name:';form.appendChild(name_label);form.appendChild(document.createElement("BR"));var name_field=createFormInput('text','name',album_name);name_field.id='name';name_field.style.width='250px';form.appendChild(name_field);form.appendChild(document.createElement("BR"));var desc_label=document.createElement('STRONG');desc_label.innerHTML='Description';form.appendChild(desc_label);var desc_opt=document.createElement('SPAN');desc_opt.innerHTML=' (optional):';form.appendChild(desc_opt);form.appendChild(document.createElement("BR"));var textarea=document.createElement("TEXTAREA");textarea.name="description";textarea.id="description";textarea.style.width="250px";textarea.rows=4;textarea.value=album_desc;form.appendChild(textarea);form.appendChild(document.createElement("BR"));var date_label=document.createElement('STRONG');date_label.innerHTML='Date';form.appendChild(date_label);var date_opt=document.createElement('SPAN');date_opt.innerHTML=' (optional):';form.appendChild(date_opt);form.appendChild(document.createElement("BR"));var date_field=createFormInput('text','date',album_date);date_field.id='date';date_field.size='10';form.appendChild(date_field);form.appendChild(document.createElement("BR"));form.appendChild(document.createElement("BR"));div.appendChild(form);var buttons=document.createElement('DIV');buttons.className='action_buttons';var save_btn=createButton('btn_save');save_btn.onclick=function(){var span=document.createElement('SPAN');span.innerHTML='<b>processing...</b>&nbsp;&nbsp;';this.parentNode.replaceChild(span,this);form.submit();return false;}
buttons.appendChild(save_btn);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();Calendar.setup({inputField:'date',ifFormat:'%Y-%m-%d',showsTime:false,eventName:'focus',firstDay:1,weekNumbers:false,showYears:true,zIndex:findNextZIndex(date_field)});}
var p_callback=null;function registerPlaxoCallback(func){p_callback=func;}
function getPlaxoCallback(){return p_callback;}
function onABCommComplete(){var func=getPlaxoCallback();if(func){func();registerPlaxoCallback(null);}}
function showSimilarPeopleExplanation(){var popup=new Popup(500,null,"cleanPopup similar-people-explanation-popup",null,true);var div=$(document.createElement('DIV'));id_replace='_shown';div.innerHTML=replaceAll($('similar-people-explanation').innerHTML,'__id__',id_replace);popup.setContent(div);popup.show();el=$(popup.element.id);el.style.top='140px';el.style.left=(parseInt(el.style.left.substring(0,el.style.left.length-2))+140)+'px';$('similar-people-explanation-close'+id_replace).onclick=function(){popup.close();return false;};}
function unsubscribeEmails(form_name,user_id){var popup=new Popup(415,"Unsubscribe emails from your invites");var div=document.createElement("DIV");var form=document.createElement("FORM");form.method="POST";form.id=createUID(form_name);form.name=form_name
form.appendChild(createFormInput('hidden','_submit_check',form_name));form.appendChild(createFormInput('hidden','user_id',user_id));var desc=document.createElement('P');desc.innerHTML='Need to unsubscribe people from your invites? Just enter their email below,'
+' separated by commas or spaces, and these users will be blocked from receiving'
+' your invites.';form.appendChild(desc);var label=document.createElement('SPAN');label.innerHTML='Enter emails separated by commas or spaces:';form.appendChild(label);var textarea=document.createElement("TEXTAREA");textarea.name="emails";textarea.id="emails";textarea.style.width="400px";textarea.rows=4;form.appendChild(textarea);form.appendChild(document.createElement("BR"));div.appendChild(form);var buttons=document.createElement('DIV');buttons.className='action_buttons';var save_btn=createButton('auto-unsubscribe');save_btn.onclick=function(){if(!confirm('Are you sure you want to unsubscribe these users?\n'
+' They will no longer receive any invites from you.')){popup.close();return false;}
var span=document.createElement('SPAN');span.innerHTML='<b>processing...</b>&nbsp;&nbsp;';this.parentNode.replaceChild(span,this);form.submit();return false;}
buttons.appendChild(save_btn);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();}
function promoteEventPopup(event_id){ajax_popup('ajax/promote_event.php?event_id='+event_id,285,'Promote Your Event');}
function promoteEventWizard(event_id){}
var IPopup=Popup.wrap(function(constructor,width,content_class,title){var content=$(document.body).down('.ipopup.'+content_class);constructor(width,title,(IS_BETA?"wPopup-beta png ":"wPopup ")+content_class);if(!content)
return;var div=E('div');div.innerHTML=content.innerHTML;this.setContent(div);});IPopup.prototype=Popup.prototype;IPopup.prototype.show=IPopup.prototype.show.wrap(function(proceed){proceed();HLG.contentChanged();});function reportAbusePopup(entity_type,entity_id){new Ajax.Request('ajax_report_abuse.php',{method:'get',parameters:{entity_type:entity_type,entity_id:entity_id},onSuccess:function(t){html_popup(t.responseJSON.content.content,350,entity_type=='entity_media'?'Reporting this photo':'Reporting Abuse');}});}
function showTwentyOneRequired(){var popup=new Popup(500,null,'cleanPopup twenty-one-required',null,true);var div=$(document.createElement('DIV'));var html_content=$('twenty_one_required_popup').innerHTML;id_replace='_shown';div.innerHTML=replaceAll(html_content,'__id__',id_replace);popup.setContent(div);popup.show();HLG.contentChanged();$('close'+id_replace).onclick=function(){document.location.href=HOME?HOME:'/';return false;};}
HLG.TermsPrivacyPopup={show:function(name){var p=new IPopup(400,'terms-privacy-popup','Welcome Back '+name+'!');p.show();$(p.contentDiv).down('a.button').onclick=function(){p.close();new Ajax.Request('ajax/terms_privacy_confirmed.php');return false;}}};addressListSelections=new Array();function AddressListSelection(master,addListWords,lists,aboveFormDiv,logged_in){if(logged_in==undefined){logged_in=true;}
this.uniqueID=createUID('address_list_selection');addressListSelections[this.uniqueID]=this;this.addListWords=addListWords;this.lists=lists;this.aboveFormDiv=aboveFormDiv;var me=this;Element.hide(childWithID(this.addListWords,'processing'));Element.hide(childWithID(this.addListWords,'title'));Element.hide(childWithID(this.lists,'none'));Element.hide(childWithID(this.lists,'got'));if(!logged_in){Element.hide(childWithID(this.addListWords,'link'));return;}
Element.show(childWithID(this.lists,'loading'));this.form_span=addressListUploadForm(this.uniqueID);master.insertBefore(this.form_span,master.firstChild);this.form=this.form_span.actual_form;childWithID(this.addListWords,'link').onclick=function(){me.showAddAListForm();return false;}
this.form.add_list_btn.onclick=function(){me.form.submit();me.hideAddAListForm(true);return false;}
this.form.cancel_btn.onclick=function(){me.hideAddAListForm(false);return false;}}
AddressListSelection.prototype.showAddAListForm=function(){Element.hide(childWithID(this.addListWords,'link'));Element.show(childWithID(this.addListWords,'title'));this.form.form_div.style.top=parseInt(this.aboveFormDiv.offsetHeight)+'px';var upload_target=$('upload-target');if(upload_target){this.form.form_div.style.right='-'+(upload_target.getWidth()-24)+'px';}
Element.show(this.form.form_div);}
AddressListSelection.prototype.hideAddAListForm=function(processing){if(processing){Element.show(childWithID(this.addListWords,'processing'));Element.hide(childWithID(this.addListWords,'link'));}else{Element.show(childWithID(this.addListWords,'link'));Element.hide(childWithID(this.addListWords,'processing'));}
Element.hide(childWithID(this.addListWords,'title'));;Element.hide(this.form.form_div);this.form.reset();}
AddressListSelection.prototype.showAddressLists=function(){var al_ul=childWithID(childWithID(this.lists,'got'),'address_list_choices');if(!al_ul){al_ul=document.createElement('UL');al_ul.id='address_list_choices';childWithID(this.lists,'got').appendChild(al_ul);}
var address_lists=loadJSON('ajax_address_list_list.php');if(address_lists.length>0){for(i=0;i<address_lists.length;i++){var list=address_lists[i];this.addList(list);}
Element.show(childWithID(this.lists,'got'));Element.hide(childWithID(this.lists,'none'));}else{Element.show(childWithID(this.lists,'none'));Element.hide(childWithID(this.lists,'got'));}
Element.hide(childWithID(this.lists,'loading'));this.hideAddAListForm(false);}
AddressListSelection.prototype.addList=function(list){var al_ul=childWithID(childWithID(this.lists,'got'),'address_list_choices');var thisName='address_lists['+list['id']+']';if(!childWithID(al_ul,thisName)){var li=document.createElement('LI');li.id='li_'+thisName;li.className="listOption";var checkbox=document.createElement('INPUT');checkbox.type='checkbox';checkbox.name=thisName;checkbox.id=thisName;li.appendChild(checkbox);var span=document.createElement('SPAN');span.innerHTML=' '+list['name']+' - ';li.appendChild(span);var em=document.createElement('EM');em.innerHTML=' '+list['size']+' emails';li.appendChild(em);var remove_btn=document.createElement('A');remove_btn.className='remove';remove_btn.href='#';remove_btn.addressListSelection=this;remove_btn.onclick=function(){if(confirm('Are you sure you want to delete this list?  You\'ll have to upload the whole file again to restore it.')){this.addressListSelection.removeList(list);}
return false;}
remove_btn.innerHTML=' <img src="images/x_mark.gif"/>';li.appendChild(remove_btn);al_ul.appendChild(li);}}
AddressListSelection.prototype.removeList=function(list){var al_ul=childWithID(childWithID(this.lists,'got'),'address_list_choices');loadJSON('ajax_delete_address_list.php?address_list_id='+list['id']);al_ul.removeChild(childWithID(al_ul,'li_address_lists['+list['id']+']'));}
function addressListUploadForm(owner_id){var form_span=document.createElement('SPAN');var return_obj=form_span;var formID=createUID('address_list_upload_form');form_span.innerHTML='<form name="address_list_upload_form" id="'+formID+'" method="post" action="ajax_process_address_list_csv_upload.php" enctype="multipart/form-data"></form>';var form=childWithID(form_span,formID);return_obj.actual_form=form;form.innerHTML='<input type="hidden" name="_submit_check" value="address_list_csv_upload"/>';var form_div=document.createElement('DIV');form_div.id='add_a_list_form';form_div.style.display='none';form_div.style.position='relative';var inner_div=document.createElement('DIV');inner_div.id='inner_div';inner_div.style.position='absolute';inner_div.style.top=inner_div.style.left='0px';inner_div.innerHTML='        <p id="instructions">Upload a CSV (Comma Separated Values) or plain text file to create your list. Have your list in an Excel file? Save it as a CSV file first.</p>'+'        <p>'+'          <div class="inputLabel">Name:</div>'+'          <input name="list_name" class="textInput"/>'+'          <div style="clear:both;"/>'+'        </p>'+'        <p>'+'          <div class="inputLabel">File:</div>'+'          <input type="file" name="csv_file"/>'+'          <div style="clear:both;"/>'+'        </p>';var btn_p=document.createElement('P');btn_p.id='btns';btn_p.style.textAlign='center';btn_p.appendChild(form.add_list_btn=createButton('auto-upload'));btn_p.appendChild(document.createTextNode(' '));var cancel=E('A');cancel.innerHTML="Cancel";cancel.href="#";btn_p.appendChild(form.cancel_btn=cancel);inner_div.appendChild(btn_p);form_div.appendChild(inner_div);form.form_div=form_div;form.appendChild(form_div);var iframe_span=document.createElement('SPAN');form.target=createUID('csv_upload_target');iframe_span.innerHTML='<iframe style="position: absolute;" frameborder="0" width="0" height="0" id="'+form.target+'" name="'+form.target+'" onload="addressListSelections[\''+owner_id+'\'].showAddressLists();" src="ajax_process_address_list_csv_upload.php"/>';form.appendChild(iframe_span);return return_obj;}
function childWithID(obj,id){var nodes=obj.childNodes;for(var i=0;i<nodes.length;i++){var node=nodes[i];if(node.id==id){return node;}else{var subNode=childWithID(node,id);if(subNode)return subNode;}}
return null;}
function parentWithID(obj,id){if(obj.parentNode){if(obj.parentNode.id==id){return obj.parentNode;}else{return parentWithID(obj.parentNode,id);}}else{return null;}}
function sortFuncAsc(record1,record2){var value1=record1.optText.toLowerCase();var value2=record2.optText.toLowerCase();if(value1>value2)return(1);if(value1<value2)return(-1);return(0);}
function sortFuncDesc(record1,record2){return sortFuncAsc(record2,record1);}
function sortSelect(selectToSort,ascendingOrder){if(arguments.length==1)ascendingOrder=true;var myOptions=[];for(var loop=0;loop<selectToSort.options.length;loop++){myOptions[loop]={optText:selectToSort.options[loop].text,optValue:selectToSort.options[loop].value};}
if(ascendingOrder){myOptions.sort(sortFuncAsc);}else{myOptions.sort(sortFuncDesc);}
selectToSort.options.length=0;for(var loop=0;loop<myOptions.length;loop++){var optObj=new Option();optObj.text=myOptions[loop].optText;optObj.value=myOptions[loop].optValue;add_option(selectToSort,optObj);}};function previewBadge(format,badge_type,id){if(badge_type=='multi_event'||badge_type=='profile'||badge_type=='tag'){var track_type=(badge_type=='multi_event')?'event':badge_type;HLG.track('/popup/multi_event_widget/'+track_type);}else{HLG.track('/popup/single_widget/'+badge_type);}
var popup=new Popup(520,"Preview");var div=E('DIV');open_links=true;if(format.startsWith('combined[img/swf]')){open_links=!format.endsWith('[myspace]');format='combined[img/swf]';}
url='ajax/badge_preview.php?format='+format;url+='&id='+id+'&type='+badge_type;url+='&open_links='+(open_links?'true':'false');var data=loadXML(url);div.innerHTML=data.responseText;popup.setContent(div);popup.show();if(format!='combined[img/swf]'){var form=$('badge_preview_config');if(format=='fb'){window.open('http://www.facebook.com/share.php?u='+encodeURIComponent(addArgument(form.action,'fb','share')));popup.close();return;}
updateBadgePreview(form);}
isSwfVisible=true;widgetImageDiv=document.getElementById("badge_preview");previewAreaDiv=document.getElementById("widget_preview_area");widgetSwfDiv=document.getElementById("widget_swf");imageDiv=document.getElementById("preview_image");if(format=='combined[img/swf]'){removeAllChildren(widgetImageDiv);removeAllChildren(previewAreaDiv);}
if(previewAreaDiv){previewAreaDiv.appendChild(widgetSwfDiv);}}
function setNarrowPlayer(){var wide=$('wideSwf');if(wide)
wide.hide();var narrow=$('narrow');if(narrow)
narrow.show();swfCode=document.getElementById("swf_badge_code");swfCode.value=swfCode.value.gsub("300","200");swfCode.value=swfCode.value.gsub("WIDE","NARROW");}
function setWidePlayer(){document.getElementById("wideSwf").style.display="block";document.getElementById("narrow").style.display="none";swfCode=document.getElementById("swf_badge_code");swfCode.value=swfCode.value.gsub("200","300");swfCode.value=swfCode.value.gsub("NARROW","WIDE");}
var codeTextSwfDiv=null;var codeTextDiv=null;var optionDiv=null;var sizeDiv=null;var optionsContDiv=null;var widgetSwfDiv=null;var widgetImageDiv=null;var imageDiv=null;var previewAreaDiv=null;var isSwfVisible=true;function showMenus(typeOfEvent){optionsContDiv=document.getElementById("options_container");optionDiv=document.getElementById("option_border");sizeDiv=document.getElementById("option_size");codeTextSwfDiv=document.getElementById("code_text_swf");codeTextDiv=document.getElementById("code_text");widgetSwfDiv=(widgetSwfDiv==null)?document.getElementById("widget_swf"):widgetSwfDiv;imageDiv=(imageDiv==null)?document.getElementById("preview_image"):imageDiv;widgetImageDiv=(widgetImageDiv==null)?document.getElementById("badge_preview"):widgetImageDiv;previewAreaDiv=document.getElementById("widget_preview_area");if(typeOfEvent=="eventsThisUser"){isSwfVisible=true;optionDiv.style.display="none";sizeDiv.style.display="none";optionDiv.style.display="none";sizeDiv.style.display="none";codeTextDiv.style.display="none";codeTextSwfDiv.style.display="block";removeAllChildren(previewAreaDiv);removeAllChildren(widgetImageDiv);previewAreaDiv.appendChild(widgetSwfDiv);document.getElementById("swf_option_size").style.display="block";setWidePlayer();}
else{isSwfVisible=false;sizeDiv.style.display="block";optionDiv.style.display="block";sizeDiv.style.display="block";optionDiv.style.display="block";codeTextDiv.style.display="block";codeTextSwfDiv.style.display="none";removeAllChildren(previewAreaDiv);removeAllChildren(widgetImageDiv);widgetImageDiv.appendChild(imageDiv);document.getElementById("swf_option_size").style.display="none";setNarrowPlayer();}}
function removeAllChildren(targetNode){if(targetNode&&targetNode.childNodes){allChildren=targetNode.childNodes;for(index=0;index<allChildren.length;index++){targetNode.removeChild(allChildren[index]);}}}
function copyCodeToClipBoard(){var targetObject=null;if(isSwfVisible){targetObject=document.getElementById("swf_badge_code");}else{targetObject=document.getElementById("badge_code");}
copyToClipboard(targetObject);}
function getPreviewBadgeCode(form,input){format=getFormField(form,'format').value;events_type=getFormField(form,'events_type');url_to_use=(events_type&&events_type.value=='upcoming')?$('multi_event_upcoming_url').value:form.action;if(format=='img'){index=url_to_use.lastIndexOf('/');url=url_to_use.substring(0,index)+'/badges'+url_to_use.substring(index)+'/'+getFormParameters(form);url=resolveRelativeUrl(url);img_url=replaceAll(replaceAll(replaceAll(url,'&','/'),'?','/'),'=','-')+'/badge.jpg';img_url=img_url.replace('type-badge/','');input.value='<a href="'+resolveRelativeUrl(url_to_use)+'#profile_events_portlet"><img src="'+img_url+'"/></a>';}else{url=resolveRelativeUrl(addArguments(url_to_use,getFormParameters(form)));input.value='<script type="text/javascript" src="'+url.replace('format=html','format=js')+'"></script>';}}
function updateBadgeSwfPreview(form){var formparams=getFormParameters(form);var format="img";var events_type=getFormField(form,'events_type');var url_to_use=(events_type&&events_type.value=='upcoming')?$('multi_event_upcoming_url').value:form.action;var url=resolveRelativeUrl(addArguments(url_to_use,formparams));$('preview_image').src=url;getPreviewBadgeCode(form,$('badge_code'));}
function updateBadgePreview(form,badge_code_input_id){if(badge_code_input_id==null)
badge_code_input_id='badge_code';var format=getFormField(form,'format').value;var formparams=getFormParameters(form);var badge_type=$('badge_type').value;if(badge_type=='tag'){formparams=formparams.replace('type=badge','type=badge_html');}else{formparams=formparams.replace('format=html','format=img');}
var events_type=getFormField(form,'events_type');var url_to_use=(events_type&&events_type.value=='upcoming')?$('multi_event_upcoming_url').value:form.action;var url=resolveRelativeUrl(addArguments(url_to_use,formparams));if(badge_type=='tag'){$('preview_iframe').src=addArgument(url,'hide_border',1);}else{$('preview_image').src=url;}
getPreviewBadgeCode(form,$(badge_code_input_id));}
function resolveRelativeUrl(url){if(url.indexOf('http')==0)return url;baseUrl=document.location.href;index=baseUrl.lastIndexOf('/');baseUrl=baseUrl.substring(0,index+1);return baseUrl+url;};function updateListing(form,args,destination_callback){HLG.ads.toggle('AD_RIGHT');var dest=destination_callback(form);Object.keys(args).each(function(key){form.getInputs(null,key)[0].setValue(args[key]);});if(dest.viewportOffset()[1]<0){var pos=dest.up('.main-content').cumulativeOffset();window.scrollTo(0,pos[1]);}
var s=form.serialize();dooh.add(s);var track=form.action;if(track.indexOf('ajax/')!=-1){track=track.substr(track.indexOf('ajax/')+5);HLG.track('/ajax/browse/'+track+'?'+s);}};function acceptFriendRequest(friend_id,friend_text,promoter){if(promoter=='false')promoter=false;var friend_type=(promoter!==false)?'Fan':'Friend';var popup=new Popup(400,'Confirm '+friend_type+' Request');if(typeof promoter=='undefined')
promoter=false;content=E('DIV');popup.setContent(content);content.className='accept_friend_request';question=E('DIV');content.appendChild(question);question.className='question';if(promoter!==false){question.innerHTML='By becoming a fan of <b>'+promoter+'</b> <i>(Event Organizer)</i> you\'ll be able to receive notifications about their upcoming events.';}else{question.innerHTML="Do you want to <b>get emails</b> from this person?";}
form=E('FORM');content.appendChild(form);form.method='POST';form.appendChild(createFormInput('hidden','_submit_check','manage_friend'));form.appendChild(createFormInput('hidden','friend_id',friend_id));accept_field=createFormInput('hidden','accept','');form.appendChild(accept_field);accept_field.id='accept_field';if(promoter==false){friend_div=E('DIV');content.appendChild(friend_div);friend_div.className='friend';friend_div.setStyle({position:'relative'});friend_link=createButton('auto-yes_add_as_a_friend');friend_link.onclick=function(){accept_field.value='friend';form.submit();return false;};friend_div.appendChild(friend_link);friend_content=E("P");friend_div.appendChild(friend_content);friend_content.innerHTML="<b>Email me</b> if they invite or message me."}
contact_div=E('DIV');content.appendChild(contact_div);contact_div.className='contact';if(promoter!==false){contact_link=createButton('png-ok');}else{contact_link=createButton('auto-no_add_as_a_contact');}
contact_link.onclick=function(){accept_field.value='contact';form.submit();return false;};contact_div.appendChild(contact_link);if(promoter==false){contact_content=E("P");contact_div.appendChild(contact_content);contact_content.innerHTML="<b>Do not email me,</b> I can check on the site."}else{cancel_link=E('A');cancel_link.update('Cancel').setStyle({'marginLeft':'5px'});cancel_link.onclick=function(){popup.close();}
contact_div.appendChild(cancel_link);}
div=E('DIV');content.appendChild(div);div.className='clear';popup.show();}
function addFriend(friend_id,sender_first_name,receiver_first_name,show_warning){var popup=new Popup(350,"Add a Friend");var div=document.createElement("DIV");div.className="commentForm";div.appendChild(E('BR'));var details=E('DIV');details.innerHTML="You are about to send a friend request to "+receiver_first_name;div.appendChild(details);div.appendChild(E('BR'));var label=E('DIV');label.innerHTML="Personal message (optional, but encouraged!):";div.appendChild(label);var form=document.createElement("FORM");form.method="POST";form.onsubmit=function(){var message=getFormField(form,'message_body').value;return true;}
var textarea=document.createElement("TEXTAREA");textarea.name="message_body";textarea.style.width="100%";textarea.rows=7;textarea.className="input";form.appendChild(textarea);form.appendChild(createFormInput('hidden','_submit_check','manage_friend'));form.appendChild(createFormInput('hidden','friend_id',friend_id));form.appendChild(createFormInput('hidden','add','true'));if(show_warning){var warning=E('DIV');warning.style.color='red';warning.style.fontStyle='italic';warning.innerHTML='Warning: If you send a lot of friend requests to people that '+'are not interested, you will be restricted.';div.appendChild(warning);}
div.appendChild(form);var buttons=document.createElement('DIV');buttons.className='action_buttons';var link=createButton('auto-send');link.onclick=function(){if(form.onsubmit())form.submit();return false;};buttons.appendChild(link);buttons.appendChild(createCancelButton(popup));div.appendChild(buttons);popup.setContent(div);popup.show();}
function manageFriends(action,friend_id){if(action!='remove'||confirm("Are you sure you want to remove this user as a friend?")){var form=document.createElement('FORM');form.method='POST';form.appendChild(createFormInput('hidden','_submit_check','manage_friend'));form.appendChild(createFormInput('hidden','friend_id',friend_id));form.appendChild(createFormInput('hidden',action,'true'));document.body.appendChild(form);form.submit();}};var dooh={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,create:function(options){var UA=navigator.userAgent.toLowerCase();var platform=navigator.platform.toLowerCase();var vendor=navigator.vendor||"";if(vendor==="KDE"){dooh.isKonqueror=true;dooh.isSupported=false;}else if(typeof window.opera!=="undefined"){dooh.isOpera=true;dooh.isSupported=true;}else if(typeof document.all!=="undefined"){dooh.isIE=true;dooh.isSupported=true;}else if(vendor.indexOf("Apple Computer, Inc.")>-1){dooh.isSafari=true;dooh.isSupported=(platform.indexOf("mac")>-1);}else if(UA.indexOf("gecko")!=-1){dooh.isGecko=true;dooh.isSupported=true;}
dooh.setupHistory(options);if(dooh.isSafari){dooh.createSafari();}else if(dooh.isOpera){dooh.createOpera();}
dooh.currentLocation=dooh.getCurrentLocation();if(dooh.isIE){dooh.createIE(dooh.currentLocation);}
var unloadHandler=function(){dooh.firstLoad=null;dooh.fire('unload',{hash:dooh.currentLocation});};dooh.addEventListener(window,'unload',unloadHandler);dooh.addEventListener(window,'load',dooh.initialize);if(dooh.isIE){dooh.ignoreLocationChange=true;}
else{if(!dooh.hasKey(dooh.PAGELOADEDSTRING)){dooh.firstLoad=true;dooh.put(dooh.PAGELOADEDSTRING,true);}else{}}
dooh.listeners={};setInterval(dooh.checkLocation,100);},initialize:function(){if(!dooh.isIE)
return;if(!dooh.hasKey(dooh.PAGELOADEDSTRING)){dooh.firstLoad=true;dooh.put(dooh.PAGELOADEDSTRING,true);}
else{dooh.firstLoad=false;}},hash:function(str){var ret=0;for(var i=0;i<str.length;i++){ret+=str.charCodeAt(i);ret%=1318699;}
return''+ret;},observe:function(action,listener){if(!dooh.listeners[action])
dooh.listeners[action]=[];listener.__dooh_hash=dooh.hash(listener.toString());if(!dooh.hasKey(listener.__dooh_hash))
dooh.put(listener.__dooh_hash,{});dooh.listeners[action].push(listener);if(action=='load'){dooh.fire('load',{hash:dooh.currentLocation});}},addEventListener:function(o,e,l){if(o.addEventListener){o.addEventListener(e,l,false);}else if(o.attachEvent){o.attachEvent('on'+e,function(){l(window.event);});}},add:function(newLocation){if(dooh.isSafari){newLocation=dooh.removeHash(newLocation);if(dooh.currentLocation!=newLocation)
dooh.fire('unload',{hash:dooh.currentLocation,newHash:newLocation});dooh.currentLocation=newLocation;window.location.hash=newLocation;dooh.putSafariState(newLocation);dooh.fire('load',{hash:newLocation});}else{var addImpl=function(){dooh.currentWaitTime=Math.max(0,dooh.currentWaitTime-dooh.waitTime);newLocation=dooh.removeHash(newLocation);if(dooh.debugMode&&document.getElementById(newLocation)){var e="Exception: History locations can not have the same value as _any_ IDs that might be in the document,"
+" due to a bug in IE; please ask the developer to choose a history location that does not match any HTML"
+" IDs in this document. The following ID is already taken and cannot be a location: "+newLocation;throw new Error(e);}
if(dooh.currentLocation!=newLocation)
dooh.fire('unload',{hash:dooh.currentLocation,newHash:newLocation});window.location.hash=newLocation;if(dooh.isIE){dooh.ignoreLocationChange=true;dooh.iframe.src="blank.html?"+newLocation;}
else{dooh.currentLocation=newLocation;dooh.fire('load',{hash:newLocation});}};window.setTimeout(addImpl,dooh.currentWaitTime);dooh.currentWaitTime=dooh.currentWaitTime+dooh.waitTime;}},isFirstLoad:function(){return dooh.firstLoad;},getVersion:function(){return"0.1";},getCurrentLocation:function(){var r=(dooh.isSafari?dooh.getSafariState():dooh.getCurrentHash());return r;},getCurrentHash:function(){var r=window.location.href;var i=r.indexOf("#");return(i>=0?r.substr(i+1):"");},PAGELOADEDSTRING:"DOOH_PAGE_LOADED",waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,firstLoad:null,createIE:function(initialHash){dooh.waitTime=400;var styles=(dooh.debugMode?'width: 800px;height:80px;border:1px solid black;':dooh.hideStyles);var iframeID="doohHistoryFrame";var iframeHTML='<iframe frameborder="0" id="'+iframeID+'" style="'+styles+'" src="blank.html?'+initialHash+'"></iframe>';document.write(iframeHTML);dooh.iframe=document.getElementById(iframeID);},createOpera:function(){dooh.waitTime=400;var imgHTML='<img src="javascript:location.href=\'javascript:dooh.checkLocation();\';" style="'+dooh.hideStyles+'" />';document.write(imgHTML);},createSafari:function(){var formID="doohSafariForm";var stackID="doohSafariStack";var lengthID="doohSafariLength";var formStyles=dooh.debugMode?dooh.showStyles:dooh.hideStyles;var inputStyles=(dooh.debugMode?'width:800px;height:20px;border:1px solid black;margin:0;padding:0;':dooh.hideStyles);var safariHTML='<form id="'+formID+'" style="'+formStyles+'">'
+'<input type="text" style="'+inputStyles+'" id="'+stackID+'" value="[]"/>'
+'<input type="text" style="'+inputStyles+'" id="'+lengthID+'" value=""/>'
+'</form>';document.write(safariHTML);dooh.safariStack=document.getElementById(stackID);dooh.safariLength=document.getElementById(lengthID);if(!dooh.hasKey(dooh.PAGELOADEDSTRING)){dooh.safariHistoryStartPoint=history.length;dooh.safariLength.value=dooh.safariHistoryStartPoint;}else{dooh.safariHistoryStartPoint=dooh.safariLength.value;}},getSafariStack:function(){var r=dooh.safariStack.value;return dooh.fromJSON(r);},getSafariState:function(){var stack=dooh.getSafariStack();var state=stack[history.length-dooh.safariHistoryStartPoint-1];return state;},putSafariState:function(newLocation){var stack=dooh.getSafariStack();stack[history.length-dooh.safariHistoryStartPoint]=newLocation;dooh.safariStack.value=dooh.toJSON(stack);},fire:function(action,event){if(!dooh.listeners[action])
return;event.action=action;for(var i=0;i<dooh.listeners[action].length;i++){var history=dooh.get(dooh.listeners[action][i].__dooh_hash);event.history=history[event.hash];history[event.hash]=dooh.listeners[action][i](event);dooh.put(dooh.listeners[action][i].__dooh_hash,history);}},checkLocation:function(){if(dooh.ignoreLocationChange)
return;var hash=dooh.getCurrentLocation();if(hash==dooh.currentLocation){return;}
if(dooh.isIE){if(dooh.getIframeHash()!=hash){dooh.ignoreLocationChange=true;dooh.iframe.src="blank.html?"+hash;return;}}
dooh.currentLocation=hash;dooh.fire('load',{hash:hash});},getIframeHash:function(){var doc=dooh.iframe.contentWindow.document;var hash=String(doc.location.search);if(hash.length==1&&hash.charAt(0)=="?"){hash="";}
else if(hash.length>=2&&hash.charAt(0)=="?"){hash=hash.substring(1);}
return hash;},removeHash:function(hashValue){var r;if(hashValue===null||hashValue===undefined){r=null;}
else if(hashValue===""){r="";}
else if(hashValue.length==1&&hashValue.charAt(0)=="#"){r="";}
else if(hashValue.length>1&&hashValue.charAt(0)=="#"){r=hashValue.substring(1);}
else{r=hashValue;}
return r;},iframeLoaded:function(newLocation){var hash=String(newLocation.search);if(hash.length==1&&hash.charAt(0)=="?"){hash="";}
else if(hash.length>=2&&hash.charAt(0)=="?"){hash=hash.substring(1);}
window.location.hash=hash;dooh.currentLocation=hash;dooh.fire('load',{hash:hash});dooh.ignoreLocationChange=false;},setupHistory:function(options){if(typeof options!=="undefined"){if(options.debugMode){dooh.debugMode=options.debugMode;}
if(options.toJSON){dooh.toJSON=options.toJSON;}
if(options.fromJSON){dooh.fromJSON=options.fromJSON;}}
var formID="rshStorageForm";var textareaID="rshStorageField";var formStyles=dooh.debugMode?dooh.showStyles:dooh.hideStyles;var textareaStyles=(dooh.debugMode?'width: 800px;height:80px;border:1px solid black;':dooh.hideStyles);var textareaHTML='<form id="'+formID+'" style="'+formStyles+'">'
+'<textarea id="'+textareaID+'" style="'+textareaStyles+'" class="'+options.textareaClass+'"></textarea>'
+'</form>';document.write(textareaHTML);dooh.storageField=document.getElementById(textareaID);if(typeof window.opera!=="undefined"){dooh.storageField.focus();}},put:function(key,value){dooh.assertValidKey(key);if(dooh.hasKey(key)){dooh.remove(key);}
dooh.storageHash[key]=value;dooh.saveHashTable();},get:function(key){dooh.assertValidKey(key);dooh.loadHashTable();var value=dooh.storageHash[key];if(value===undefined){value=null;}
return value;},remove:function(key){dooh.assertValidKey(key);dooh.loadHashTable();delete dooh.storageHash[key];dooh.saveHashTable();},reset:function(){dooh.storageField.value="";dooh.storageHash={};},hasKey:function(key){dooh.assertValidKey(key);dooh.loadHashTable();return(typeof dooh.storageHash[key]!=="undefined");},isValidKey:function(key){return(typeof key==="string");},showStyles:'border:0;margin:0;padding:0;',hideStyles:'left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;',debugMode:false,storageHash:{},hashLoaded:false,storageField:null,assertValidKey:function(key){var isValid=dooh.isValidKey(key);if(!isValid&&dooh.debugMode){throw new Error("Please provide a valid key for dooh. Invalid key = "+key+".");}},loadHashTable:function(){if(!dooh.hashLoaded){var serializedHashTable=dooh.storageField.value;if(serializedHashTable!==""&&serializedHashTable!==null){dooh.storageHash=dooh.fromJSON(serializedHashTable);dooh.hashLoaded=true;}}},saveHashTable:function(){dooh.loadHashTable();var serializedHashTable=dooh.toJSON(dooh.storageHash);dooh.storageField.value=serializedHashTable;},toJSON:function(o){return o.toJSONString();},fromJSON:function(s){return s.parseJSON();}};dooh.create({toJSON:function(o){return Object.toJSON(o);},fromJSON:function(s){return s.evalJSON();},textareaClass:'mceNoEditor'});