/****** FILE: jsparty/loader.js *****/

if(typeof _LOADERS=='undefined')_LOADERS=Array();function callAllLoaders(){var i,loaderFunc;for(i=0;i<_LOADERS.length;i++){loaderFunc=_LOADERS[i];if(loaderFunc!=callAllLoaders)loaderFunc();}}
function appendLoader(loaderFunc){if(window.onload&&window.onload!=callAllLoaders)
_LOADERS[_LOADERS.length]=window.onload;window.onload=callAllLoaders;_LOADERS[_LOADERS.length]=loaderFunc;}
function setUpHandlers(tagName,className,handlerFunction){var allElements=document.getElementsByTagName(tagName);for(var i=0;i<allElements.length;i++){if(allElements[i].className){tester=' '+allElements[i].className+' ';if(tester.indexOf(' '+className+' ')!=-1){handlerFunction(allElements[i]);}}}}
function getAllElements(){var allElements=document.getElementsByTagName('*');if(allElements.length==0)return document.all;else return allElements;}
function addClass(el,cls,forceBefore){if(!el.className)el.className="";if(forceBefore!=null&&el.className.match(new RegExp('(^| )'+forceBefore))){el.className=el.className.replace(new RegExp("( |^)"+forceBefore),'$1'+cls+' '+forceBefore);}else if(!el.className.match(new RegExp('(^| )'+cls+'($| )'))){el.className+=' '+cls;el.className=el.className.replace(/(^ +)|( +$)/g,'');}}
function removeClass(el,cls){var old=el.className;var newCls=' '+el.className+' ';newCls=newCls.replace(new RegExp(' ('+cls+' +)+','g'),' ');el.className=newCls.replace(/(^ +)|( +$)/g,'');}
function removeClasses(el,cls){removeClass(el,cls);var items=el.getElementsByTagName('*');var i;for(i=0;i<items.length;i++)if(items[i].className)removeClass(items[i],cls);}
function addEventHandler(obj,evt,handler){if(obj[evt])obj['old_'+evt]=obj[evt];obj[evt]=handler;}
;
/****** FILE: jsparty/hover.js *****/

function hover_over(){Element.addClassName(this,'over');}
function hover_out(){Element.removeClassName(this,'over');}
hover_behaviour={onmouseover:hover_over,onmouseout:hover_out}
;
/****** FILE: jsparty/layout_helpers.js *****/

function fitToParent(el,tweakVal){if(typeof el=="string"){var elName=el;el=document.getElementById(el);if(!el)return;}
var height=getFittingHeight(el,tweakVal)+'px';el.style.height=height;}
function getFittingHeight(el,tweakVal,ignoreElements){if(typeof el=="string")el=document.getElementById(el);if(el.parentNode&&el.parentNode!=document.body){if(getDimension(el.parentNode,'overflow',true)!='auto')el.parentNode.style.overflow='hidden';}
var otherHeight=0;var notAComment;if(el.parentNode){for(var i=0;i<el.parentNode.childNodes.length;i++){var sibling=el.parentNode.childNodes[i];if(sibling.tagName&&el!=sibling){if(sibling.outerHTML==null)notAComment=true;else if(sibling.outerHTML.indexOf("<!--")!=0)notAComment=true;else notAComment=false;if(sibling.className&&sibling.className.indexOf('fitToParent_ignore')!=-1)notAComment=false;if(getDimension(sibling,'position',true)=='absolute')notAComment=false;else if(getDimension(sibling,'display',true)=='none')notAComment=false;else{var floatVal=getDimension(sibling,'float',true);if(floatVal=='left'||floatVal=='right')notAComment=false;}
if(ignoreElements){for(var j=0;j<ignoreElements.length;j++){if(ignoreElements[j]==sibling){notAComment=false;break;}}}
if(sibling.offsetHeight&&notAComment&&(sibling.tagName.toLowerCase()!='script')){otherHeight+=parseInt(sibling.offsetHeight);}
if(sibling.id=='top'){otherHeight+=27;}}}}
if(getDimension(el,'position',true)=='relative')otherHeight+=getDimension(el,'top');if(!tweakVal)tweakVal=0;tweakVal+=getDimension(el,'marginTop');tweakVal+=getDimension(el,'marginBottom');tweakVal+=getDimension(el,'paddingTop');tweakVal+=getDimension(el,'paddingBottom');tweakVal+=getDimension(el,'borderBottomWidth');tweakVal+=getDimension(el,'borderTopWidth');tweakVal+=getDimension(el.parentNode,'paddingTop');tweakVal+=getDimension(el.parentNode,'paddingBottom');if(el.parentNode&&el.parentNode.tagName!="BODY"){tweakVal+=getDimension(el.parentNode,'borderTopWidth');tweakVal+=getDimension(el.parentNode,'borderBottomWidth');}
if(el.parentNode&&el.parentNode.offsetHeight-otherHeight-tweakVal<0){return 0;}else{if(el.parentNode){return(el.parentNode.offsetHeight-otherHeight-tweakVal);}}}
function getSiblingList(el){var i,silbing,result=[];for(i=0;i<el.parentNode.childNodes.length;i++){sibling=el.parentNode.childNodes[i];if(sibling.tagName)result.push(sibling.tagName
+(sibling.id?('#'+sibling.id):'')
+(sibling.className?('.'+sibling.className):''));}
return result.join(", ");}
function getDimension(el,dim,notAInteger){if(!notAInteger)notAInteger=false;if(dim=='float'){dim=(typeof el.style.cssFloat=='string')?'cssFloat':'styleFloat';}
var checkForNoneValue={'borderBottomWidth':'borderBottomStyle','borderTopWidth':'borderTopStyle','borderLeftWidth':'borderLeftStyle','borderRightWidth':'borderRightStyle'};if(checkForNoneValue[dim]){if(getDimension(el,checkForNoneValue[dim],true)=='none')return 0;}
if(el&&el.style&&el.style[dim]){return notAInteger?el.style[dim]:parseInt(el.style[dim]);}else if(el&&el.currentStyle){if(el.currentStyle[dim]!='auto'){return notAInteger?el.currentStyle[dim]:parseInt(el.currentStyle[dim]);}}else if(document.defaultView&&document.defaultView.getComputedStyle){var val;try{var s=document.defaultView.getComputedStyle(el,null);val=s[dim];}catch(er){}
if(val){if(notAInteger){return val;}else{var newVal=parseInt(val);if(isNaN(newVal)){return 0;}else{return newVal;}}}}
return notAInteger?null:0;}
;
/****** FILE: jsparty/scriptaculous/effects.js *****/

String.prototype.parseColor=function(){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.collectTextNodesIgnoreClass=function(element,ignoreclass){var children=$(element).childNodes;var text="";var classtest=new RegExp("^([^ ]+ )*"+ignoreclass+"( [^ ]+)*$","i");for(var i=0;i<children.length;i++){if(children[i].nodeType==3){text+=children[i].nodeValue;}else{if((!children[i].className.match(classtest))&&children[i].hasChildNodes())
text+=Element.collectTextNodesIgnoreClass(children[i],ignoreclass);}}
return text;}
Element.setContentZoom=function(element,percent){element=$(element);element.style.fontSize=(percent/100)+"em";if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);}
Element.getOpacity=function(element){var opacity;if(opacity=Element.getStyle(element,"opacity"))
return parseFloat(opacity);if(opacity=(Element.getStyle(element,"filter")||'').match(/alpha\(opacity=(.*)\)/))
if(opacity[1])return parseFloat(opacity[1])/100;return 1.0;}
Element.setOpacity=function(element,value){element=$(element);var els=element.style;if(value==1){els.opacity='0.999999';if(/MSIE/.test(navigator.userAgent))
els.filter=Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'');}else{if(value<0.00001)value=0;els.opacity=value;if(/MSIE/.test(navigator.userAgent))
els.filter=Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')+"alpha(opacity="+value*100+")";}}
Element.getInlineOpacity=function(element){element=$(element);var op;op=element.style.opacity;if(typeof op!="undefined"&&op!="")return op;return"";}
Element.setInlineOpacity=function(element,value){element=$(element);var els=element.style;els.opacity=value;}
Element.childrenWithClassName=function(element,className){return $A($(element).getElementsByTagName('*')).select(function(c){return Element.hasClassName(c,className)});}
var Effect={tagifyText:function(element){var tagifyStyle="position:relative";if(/MSIE/.test(navigator.userAgent))tagifyStyle+=";zoom:1";element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(Builder.node('span',{style:tagifyStyle},character==" "?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||(typeof element=='function'))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var speed=options.speed;var delay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:delay+index*speed}));});}};var Effect2=Effect;Effect.Transitions={}
Effect.Transitions.linear=function(pos){return pos;}
Effect.Transitions.sinoidal=function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;}
Effect.Transitions.reverse=function(pos){return 1-pos;}
Effect.Transitions.flicker=function(pos){return((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;}
Effect.Transitions.wobble=function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;}
Effect.Transitions.pulse=function(pos){return(Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10)));}
Effect.Transitions.none=function(pos){return 0;}
Effect.Transitions.full=function(pos){return 1;}
Effect.Queue={effects:[],_each:function(iterator){this.effects._each(iterator);},interval:null,add:function(effect){var timestamp=new Date().getTime();switch(effect.options.queue){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),40);},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();this.effects.invoke('loop',timePos);}}
Object.extend(Effect.Queue,Enumerable);Effect.Base=function(){};Effect.Base.prototype={position:null,setOptions:function(options){this.options=Object.extend({transition:Effect.Transitions.sinoidal,duration:1.0,fps:25.0,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},options||{});},start:function(options){this.setOptions(options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.event('beforeStart');if(!this.options.sync)Effect.Queue.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.finishOn-this.startOn);var frame=Math.round(pos*this.options.fps*this.options.duration);if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},render:function(pos){if(this.state=='idle'){this.state='running';this.event('beforeSetup');if(this.setup)this.setup();this.event('afterSetup');}
if(this.options.transition)pos=this.options.transition(pos);pos*=(this.options.to-this.options.from);pos+=this.options.from;this.position=pos;this.event('beforeUpdate');if(this.update)this.update(pos);this.event('afterUpdate');},cancel:function(){if(!this.options.sync)Effect.Queue.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);}}
Effect.Parallel=Class.create();Object.extend(Object.extend(Effect.Parallel.prototype,Effect.Base.prototype),{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.Opacity=Class.create();Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);if(/MSIE/.test(navigator.userAgent)&&(!this.element.hasLayout))
this.element.style.zoom=1;var options=Object.extend({from:Element.getOpacity(this.element)||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){Element.setOpacity(this.element,position);}});Effect.MoveBy=Class.create();Object.extend(Object.extend(Effect.MoveBy.prototype,Effect.Base.prototype),{initialize:function(element,toTop,toLeft){this.element=$(element);this.toTop=toTop;this.toLeft=toLeft;this.start(arguments[3]);},setup:function(){Element.makePositioned(this.element);this.originalTop=parseFloat(Element.getStyle(this.element,'top')||'0');this.originalLeft=parseFloat(Element.getStyle(this.element,'left')||'0');},update:function(position){var topd=this.toTop*position+this.originalTop;var leftd=this.toLeft*position+this.originalLeft;this.setPosition(topd,leftd);},setPosition:function(topd,leftd){this.element.style.top=topd+"px";this.element.style.left=leftd+"px";}});Effect.Scale=Class.create();Object.extend(Object.extend(Effect.Scale.prototype,Effect.Base.prototype),{initialize:function(element,percent){this.element=$(element)
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(){var effect=this;this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=Element.getStyle(this.element,'position');effect.originalStyle={};['top','left','width','height','fontSize'].each(function(k){effect.originalStyle[k]=effect.element.style[k];});this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=Element.getStyle(this.element,'font-size')||"100%";['em','px','%'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){effect.fontSize=parseFloat(fontSize);effect.fontSizeType=fontSizeType;}});this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.clientHeight,this.element.clientWidth];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.style.fontSize=this.fontSize*currentScale+this.fontSizeType;this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish){var effect=this;['top','left','width','height','fontSize'].each(function(k){effect.element.style[k]=effect.originalStyle[k];});}},setDimensions:function(height,width){var els=this.element.style;if(this.options.scaleX)els.width=width+'px';if(this.options.scaleY)els.height=height+'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)els.top=this.originalTop-topd+"px";if(this.options.scaleX)els.left=this.originalLeft-leftd+"px";}else{if(this.options.scaleY)els.top=-topd+"px";if(this.options.scaleX)els.left=-leftd+"px";}}}});Effect.Highlight=Class.create();Object.extend(Object.extend(Effect.Highlight.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);var options=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(options);},setup:function(){if(this.element.style.display=='none'){this.cancel();return;}
this.oldBgImage=this.element.style.backgroundImage;this.element.style.backgroundImage="none";if(!this.options.endcolor)
this.options.endcolor=Element.getStyle(this.element,'background-color').parseColor('#ffffff');if(typeof this.options.restorecolor=="undefined")
this.options.restorecolor=this.element.style.backgroundColor;this.colors_base=[parseInt(this.options.startcolor.slice(1,3),16),parseInt(this.options.startcolor.slice(3,5),16),parseInt(this.options.startcolor.slice(5),16)];this.colors_delta=[parseInt(this.options.endcolor.slice(1,3),16)-this.colors_base[0],parseInt(this.options.endcolor.slice(3,5),16)-this.colors_base[1],parseInt(this.options.endcolor.slice(5),16)-this.colors_base[2]];},update:function(position){var effect=this;var colors=$R(0,2).map(function(i){return Math.round(effect.colors_base[i]+(effect.colors_delta[i]*position))});this.element.style.backgroundColor="#"+
colors[0].toColorPart()+colors[1].toColorPart()+colors[2].toColorPart();},finish:function(){this.element.style.backgroundColor=this.options.restorecolor;this.element.style.backgroundImage=this.oldBgImage;}});Effect.ScrollTo=Class.create();Object.extend(Object.extend(Effect.ScrollTo.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);this.start(arguments[1]||{});},setup:function(){Position.prepare();var offsets=Position.cumulativeOffset(this.element);var max=window.innerHeight?window.height-window.innerHeight:document.body.scrollHeight-
(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);this.scrollStart=Position.deltaY;this.delta=(offsets[1]>max?max:offsets[1])-this.scrollStart;},update:function(position){Position.prepare();window.scrollTo(Position.deltaX,this.scrollStart+(position*this.delta));}});Effect.Fade=function(element){var oldOpacity=Element.getInlineOpacity(element);var options=Object.extend({from:Element.getOpacity(element)||1.0,to:0.0,afterFinishInternal:function(effect)
{if(effect.options.to==0){Element.hide(effect.element);Element.setInlineOpacity(effect.element,oldOpacity);}}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Appear=function(element){var options=Object.extend({from:(Element.getStyle(element,"display")=="none"?0.0:Element.getOpacity(element)||0.0),to:1.0,beforeSetup:function(effect)
{Element.setOpacity(effect.element,effect.options.from);Element.show(effect.element);}},arguments[1]||{});return new Effect.Opacity(element,options);}
Effect.Puff=function(element){element=$(element);var oldOpacity=Element.getInlineOpacity(element);var oldPosition=element.style.position;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)
{effect.effects[0].element.style.position='absolute';},afterFinishInternal:function(effect)
{Element.hide(effect.effects[0].element);effect.effects[0].element.style.position=oldPosition;Element.setInlineOpacity(effect.effects[0].element,oldOpacity);}},arguments[1]||{}));}
Effect.BlindUp=function(element){element=$(element);Element.makeClipping(element);return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect)
{Element.hide(effect.element);Element.undoClipping(effect.element);}},arguments[1]||{}));}
Effect.BlindDown=function(element){element=$(element);var oldHeight=element.style.height;var elementDimensions=Element.getDimensions(element);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){Element.makeClipping(effect.element);effect.element.style.height="0px";Element.show(effect.element);},afterFinishInternal:function(effect){Element.undoClipping(effect.element);effect.element.style.height=oldHeight;}},arguments[1]||{}));}
Effect.SwitchOff=function(element){element=$(element);var oldOpacity=Element.getInlineOpacity(element);return new Effect.Appear(element,{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){Element.makePositioned(effect.element);Element.makeClipping(effect.element);},afterFinishInternal:function(effect){Element.hide(effect.element);Element.undoClipping(effect.element);Element.undoPositioned(effect.element);Element.setInlineOpacity(effect.element,oldOpacity);}})}});}
Effect.DropOut=function(element){element=$(element);var oldTop=element.style.top;var oldLeft=element.style.left;var oldOpacity=Element.getInlineOpacity(element);return new Effect.Parallel([new Effect.MoveBy(element,100,0,{sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){Element.makePositioned(effect.effects[0].element);},afterFinishInternal:function(effect){Element.hide(effect.effects[0].element);Element.undoPositioned(effect.effects[0].element);effect.effects[0].element.style.left=oldLeft;effect.effects[0].element.style.top=oldTop;Element.setInlineOpacity(effect.effects[0].element,oldOpacity);}},arguments[1]||{}));}
Effect.Shake=function(element){element=$(element);var oldTop=element.style.top;var oldLeft=element.style.left;return new Effect.MoveBy(element,0,20,{duration:0.05,afterFinishInternal:function(effect){new Effect.MoveBy(effect.element,0,-40,{duration:0.1,afterFinishInternal:function(effect){new Effect.MoveBy(effect.element,0,40,{duration:0.1,afterFinishInternal:function(effect){new Effect.MoveBy(effect.element,0,-40,{duration:0.1,afterFinishInternal:function(effect){new Effect.MoveBy(effect.element,0,40,{duration:0.1,afterFinishInternal:function(effect){new Effect.MoveBy(effect.element,0,-20,{duration:0.05,afterFinishInternal:function(effect){Element.undoPositioned(effect.element);effect.element.style.left=oldLeft;effect.element.style.top=oldTop;}})}})}})}})}})}});}
Effect.SlideDown=function(element){element=$(element);Element.cleanWhitespace(element);var oldInnerBottom=element.firstChild.style.bottom;var elementDimensions=Element.getDimensions(element);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){Element.makePositioned(effect.element.firstChild);if(window.opera)effect.element.firstChild.style.top="";Element.makeClipping(effect.element);element.style.height='0';Element.show(element);},afterUpdateInternal:function(effect){effect.element.firstChild.style.bottom=(effect.dims[0]-effect.element.clientHeight)+'px';},afterFinishInternal:function(effect){Element.undoClipping(effect.element);Element.undoPositioned(effect.element.firstChild);effect.element.firstChild.style.bottom=oldInnerBottom;}},arguments[1]||{}));}
Effect.SlideUp=function(element){element=$(element);Element.cleanWhitespace(element);var oldInnerBottom=element.firstChild.style.bottom;return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(effect){Element.makePositioned(effect.element.firstChild);if(window.opera)effect.element.firstChild.style.top="";Element.makeClipping(effect.element);Element.show(element);},afterUpdateInternal:function(effect){effect.element.firstChild.style.bottom=(effect.dims[0]-effect.element.clientHeight)+'px';},afterFinishInternal:function(effect){Element.hide(effect.element);Element.undoClipping(effect.element);Element.undoPositioned(effect.element.firstChild);effect.element.firstChild.style.bottom=oldInnerBottom;}},arguments[1]||{}));}
Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){Element.makeClipping(effect.element);},afterFinishInternal:function(effect){Element.hide(effect.element);Element.undoClipping(effect.element);}});}
Effect.Grow=function(element){element=$(element);var options=arguments[1]||{};var elementDimensions=Element.getDimensions(element);var originalWidth=elementDimensions.width;var originalHeight=elementDimensions.height;var oldTop=element.style.top;var oldLeft=element.style.left;var oldHeight=element.style.height;var oldWidth=element.style.width;var oldOpacity=Element.getInlineOpacity(element);var direction=options.direction||'center';var moveTransition=options.moveTransition||Effect.Transitions.sinoidal;var scaleTransition=options.scaleTransition||Effect.Transitions.sinoidal;var opacityTransition=options.opacityTransition||Effect.Transitions.full;var initialMoveX,initialMoveY;var moveX,moveY;switch(direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=originalWidth;initialMoveY=moveY=0;moveX=-originalWidth;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=originalHeight;moveY=-originalHeight;break;case'bottom-right':initialMoveX=originalWidth;initialMoveY=originalHeight;moveX=-originalWidth;moveY=-originalHeight;break;case'center':initialMoveX=originalWidth/2;initialMoveY=originalHeight/2;moveX=-originalWidth/2;moveY=-originalHeight/2;break;}
return new Effect.MoveBy(element,initialMoveY,initialMoveX,{duration:0.01,beforeSetup:function(effect){Element.hide(effect.element);Element.makeClipping(effect.element);Element.makePositioned(effect.element);},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:opacityTransition}),new Effect.MoveBy(effect.element,moveY,moveX,{sync:true,transition:moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:originalHeight,originalWidth:originalWidth},sync:true,scaleFrom:window.opera?1:0,transition:scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.style.height=0;Element.show(effect.effects[0].element);},afterFinishInternal:function(effect){var el=effect.effects[0].element;var els=el.style;Element.undoClipping(el);Element.undoPositioned(el);els.top=oldTop;els.left=oldLeft;els.height=oldHeight;els.width=originalWidth+'px';Element.setInlineOpacity(el,oldOpacity);}},options))}});}
Effect.Shrink=function(element){element=$(element);var options=arguments[1]||{};var originalWidth=element.clientWidth;var originalHeight=element.clientHeight;var oldTop=element.style.top;var oldLeft=element.style.left;var oldHeight=element.style.height;var oldWidth=element.style.width;var oldOpacity=Element.getInlineOpacity(element);var direction=options.direction||'center';var moveTransition=options.moveTransition||Effect.Transitions.sinoidal;var scaleTransition=options.scaleTransition||Effect.Transitions.sinoidal;var opacityTransition=options.opacityTransition||Effect.Transitions.none;var moveX,moveY;switch(direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=originalWidth;moveY=0;break;case'bottom-left':moveX=0;moveY=originalHeight;break;case'bottom-right':moveX=originalWidth;moveY=originalHeight;break;case'center':moveX=originalWidth/2;moveY=originalHeight/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:scaleTransition,restoreAfterFinish:true}),new Effect.MoveBy(element,moveY,moveX,{sync:true,transition:moveTransition})],Object.extend({beforeStartInternal:function(effect){Element.makePositioned(effect.effects[0].element);Element.makeClipping(effect.effects[0].element);},afterFinishInternal:function(effect){var el=effect.effects[0].element;var els=el.style;Element.hide(el);Element.undoClipping(el);Element.undoPositioned(el);els.top=oldTop;els.left=oldLeft;els.height=oldHeight;els.width=oldWidth;Element.setInlineOpacity(el,oldOpacity);}},options));}
Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=Element.getInlineOpacity(element);var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:3.0,from:0,afterFinishInternal:function(effect){Element.setInlineOpacity(effect.element,oldOpacity);}},options),{transition:reverser}));}
Effect.Fold=function(element){element=$(element);var originalTop=element.style.top;var originalLeft=element.style.left;var originalWidth=element.style.width;var originalHeight=element.style.height;Element.makeClipping(element);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){Element.hide(effect.element);Element.undoClipping(effect.element);effect.element.style.top=originalTop;effect.element.style.left=originalLeft;effect.element.style.width=originalWidth;effect.element.style.height=originalHeight;}});}},arguments[1]||{}));}
;
/****** FILE: jsparty/scriptaculous/dragdrop.js *****/

var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if((typeof containment=='object')&&(containment.constructor==Array)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
if(options.accept)options.accept=[options.accept].flatten();options.element=element;this.drops.push(options);},isContained:function(element,drop){var parentNode=element.parentNode;return drop._containers.detect(function(c){return parentNode==c});},isAffected:function(pX,pY,element,drop){return((drop.element!=element)&&(drop.element.parentNode)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&((!drop.checkDroppableIsntContained)||!Element.contains(element,drop.element))&&Position.within(drop.element,pX,pY));},deactivate:function(drop){if(drop.hoverclass)
Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(this.last_active)this.deactivate(this.last_active);if(drop.hoverclass)
Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(event,element){if(!this.drops.length)return;var pX=Event.pointerX(event);var pY=Event.pointerY(event);Position.prepare();var i=this.drops.length-1;do{var drop=this.drops[i];if(this.isAffected(pX,pY,element,drop)){if(drop.onHover)
drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop.greedy){this.activate(drop);return;}}}while(i--);if(this.last_active)this.deactivate(this.last_active);},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected(Event.pointerX(event),Event.pointerY(event),element,this.last_active))
if(this.last_active.onDrop)
this.last_active.onDrop(element,this.last_active.element,event);},reset:function(){if(this.last_active)
this.deactivate(this.last_active);}}
var Draggables={observers:[],addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}}
var Draggable=Class.create();Draggable.prototype={initialize:function(element){var options=Object.extend({handle:false,starteffect:function(element){new Effect.Opacity(element,{duration:0.2,from:1.0,to:0.7});},reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.MoveBy(element,-top_offset,-left_offset,{duration:dur});},endeffect:function(element){new Effect.Opacity(element,{duration:0.2,from:0.7,to:1.0});},zindex:1000,revert:false,snap:false},arguments[1]||{});this.element=$(element);if(options.handle&&(typeof options.handle=='string'))
this.handle=Element.childrenWithClassName(this.element,options.handle)[0];if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;this.offsetX=0;this.offsetY=0;this.originalLeft=this.currentLeft();this.originalTop=this.currentTop();this.originalX=this.element.offsetLeft;this.originalY=this.element.offsetTop;this.options=options;this.active=false;this.dragging=false;this.eventMouseDown=this.startDrag.bindAsEventListener(this);this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.update.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);this.registerEvents();},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);this.unregisterEvents();},registerEvents:function(){Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);Event.observe(this.handle,"mousedown",this.eventMouseDown);},unregisterEvents:function(){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);},currentLeft:function(){return parseInt(this.element.style.left||'0');},currentTop:function(){return parseInt(this.element.style.top||'0')},startDrag:function(event){if(Event.isLeftClick(event)){var src=Event.element(event);if(src.tagName&&(src.tagName=='INPUT'||src.tagName=='SELECT'||src.tagName=='BUTTON'||src.tagName=='TEXTAREA'))return;Element.makePositioned(this.element);this.element.wasDragged=false;this.active=true;var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.element);this.offsetX=(pointer[0]-offsets[0]);this.offsetY=(pointer[1]-offsets[1]);Event.stop(event);}},finishDrag:function(event,success){this.active=false;this.dragging=false;this.element.wasDragged=true;if(this.options.ghosting){Position.relativize(this.element);Element.remove(this._clone);this._clone=null;}
if(success)Droppables.fire(event,this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&typeof revert=='function')revert=revert(this.element);if(revert&&this.options.reverteffect){this.options.reverteffect(this.element,this.currentTop()-this.originalTop,this.currentLeft()-this.originalLeft);}else{this.originalLeft=this.currentLeft();this.originalTop=this.currentTop();}
if(this.options.zindex)
this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
this.options.endeffect(this.element);Droppables.reset();},keyPress:function(event){if(this.active){if(event.keyCode==Event.KEY_ESC){Element.undoPositioned(this.element);this.finishDrag(event,false);Event.stop(event);}}},endDrag:function(event){Element.undoPositioned(this.element);if(this.active&&this.dragging){this.finishDrag(event,true);Event.stop(event);}
this.active=false;this.dragging=false;},draw:function(event){var pointer=[Event.pointerX(event),Event.pointerY(event)];var offsets=Position.cumulativeOffset(this.element);offsets[0]-=this.currentLeft();offsets[1]-=this.currentTop();var style=this.element.style;var pos=[(pointer[0]-offsets[0]-this.offsetX),(pointer[1]-offsets[1]-this.offsetY)];if(this.options.snap){if(typeof this.options.snap=='function'){pos=this.options.snap(pos[0],pos[1]);}else{var draggable=this;if(this.options.snap instanceof Array){pos=pos.collect(function(v,i){return Math.round(v/draggable.options.snap[i])*draggable.options.snap[i]})}else{pos=pos.collect(function(v){return Math.round(v/draggable.options.snap)*draggable.options.snap})}}}
if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=pos[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=pos[1]+"px";if(style.visibility=="hidden")style.visibility="";},update:function(event){if(this.active){if(!this.dragging){if(this.options.onStartDrag)this.options.onStartDrag(this.element);var style=this.element.style;this.dragging=true;if(Element.getStyle(this.element,'position')=='')
style.position="relative";if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);style.zIndex=this.options.zindex;}
if(this.options.ghosting){this._clone=this.element.cloneNode(true);Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);}
Droppables.show(event,this.element);Draggables.notify('onDrag',this,event);this.draw(event);if(this.options.change)this.options.change(this);if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);Event.stop(event);}}}
function rollingStatus(chr,maxLength){var txt=window.status+chr;if(txt.length>maxLength)txt=txt.substr(txt.length-maxLength);window.status=txt;}
var SortableObserver=Class.create();SortableObserver.prototype={initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
this.observer(this.element)}}
var Sortable={sortables:new Array(),options:function(element){element=$(element);return this.sortables.detect(function(s){return s.element==element});},destroy:function(element){element=$(element);this.sortables.findAll(function(s){return s.element==element}).each(function(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');});this.sortables=this.sortables.reject(function(s){return s.element==element});},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,hoverclass:null,ghosting:false,format:null,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
options_for_draggable.reverteffect=options.reverteffect;else
if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
options_for_draggable.endeffect=options.endeffect;if(options.zindex)
options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass,onHover:Sortable.onHover,greedy:!options.dropOnEmpty}
Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty){Droppables.add(element,{containment:options.containment,onHover:Sortable.onEmptyHover,greedy:false});options.droppables.push(element);}
(this.findElements(element,options)||[]).each(function(e){var handle=options.handle?Element.childrenWithClassName(e,options.handle)[0]:e;options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);options.droppables.push(e);});this.sortables.push(options);Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){if(!element.hasChildNodes())return null;var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName==options.tag.toUpperCase()&&(!options.only||(Element.hasClassName(e,options.only))))
elements.push(e);if(options.tree){var grandchildren=this.findElements(e,options);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():null);},onHover:function(element,dropon,overlap){if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon){if(element.parentNode!=dropon){var oldParentNode=element.parentNode;dropon.appendChild(element);Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon).onChange(element);}},unmark:function(){if(Sortable._marker)Element.hide(Sortable._marker);},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=$('dropmarker')||document.createElement('DIV');Element.hide(Sortable._marker);Element.addClassName(Sortable._marker,'dropmarker');Sortable._marker.style.position='absolute';document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
var offsets=Position.cumulativeOffset(dropon);Sortable._marker.style.left=offsets[0]+'px';Sortable._marker.style.top=offsets[1]+'px';if(position=='after')
if(sortable.overlap=='horizontal')
Sortable._marker.style.left=(offsets[0]+dropon.clientWidth)+'px';else
Sortable._marker.style.top=(offsets[1]+dropon.clientHeight)+'px';Element.show(Sortable._marker);},serialize:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,only:sortableOptions.only,name:element.id,format:sortableOptions.format||/^[^_]*_(.*)$/},arguments[1]||{});var ret=$(this.findElements(element,options)||[]).collect(function(item){return(encodeURIComponent(options.name)+"[]="+
encodeURIComponent(item.id.match(options.format)?item.id.match(options.format)[1]:''));}).join("&");return ret;}}
;
/****** FILE: jsparty/scriptaculous/controls.js *****/

var Autocompleter={}
Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(element,update,options){this.element=$(element);this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;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);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,"keypress",this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(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);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();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN)
return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},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;},markNext:function(){if(this.index<this.entryCount-1)this.index++
else this.index=0;},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=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var lastTokenPos=this.findLastToken();if(lastTokenPos!=-1){var newValue=this.element.value.substr(0,lastTokenPos+1);var whitespace=this.element.value.substr(lastTokenPos+1).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value;}else{this.element.value=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.firstChild);if(this.update.firstChild&&this.update.firstChild.childNodes){this.entryCount=this.update.firstChild.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;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;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices();}else{this.active=false;this.hide();}},getToken:function(){var tokenPos=this.findLastToken();if(tokenPos!=-1)
var ret=this.element.value.substr(tokenPos+1).replace(/^\s+/,'').replace(/\s+$/,'');else
var ret=this.element.value;return/\n/.test(ret)?'':ret;},findLastToken:function(){var lastTokenPos=-1;for(var i=0;i<this.options.tokens.length;i++){var thisTokenPos=this.element.value.lastIndexOf(this.options.tokens[i]);if(thisTokenPos>lastTokenPos)
lastTokenPos=thisTokenPos;}
return lastTokenPos;}}
Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{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(){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.Local.prototype=Object.extend(new 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();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(element,url,options){this.url=url;this.element=$(element);this.options=Object.extend({okText:"ok",cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightcolor});},onFailure:function(transport){alert("Error communicating with the server: "+transport.responseText.stripTags());},callback:function(form){return Form.serialize(form);},handleLineBreaks:true,loadingText:'Loading...',savingClassName:'inplaceeditor-saving',loadingClassName:'inplaceeditor-loading',formClassName:'inplaceeditor-form',highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,ajaxOptions:{}},options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null;}}
if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl);}
this.originalBackground=Element.getStyle(this.element,'background-color');if(!this.originalBackground){this.originalBackground="transparent";}
this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);Event.observe(this.element,'mouseover',this.mouseoverListener);Event.observe(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,'click',this.onclickListener);Event.observe(this.options.externalControl,'mouseover',this.mouseoverListener);Event.observe(this.options.externalControl,'mouseout',this.mouseoutListener);}},enterEditMode:function(evt){if(this.saving)return;if(this.editing)return;this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl);}
Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);Field.scrollFreeActivate(this.editField);if(evt){Event.stop(evt);}
return false;},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName)
this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var br=document.createElement("br");this.form.appendChild(br);}
okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;this.form.appendChild(okButton);cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);this.form.appendChild(cancelLink);},hasHTMLLineBreaks:function(string){if(!this.options.handleLineBreaks)return false;return string.match(/<br/i)||string.match(/<p>/i);},convertHTMLLineBreaks:function(string){return string.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"");},createEditField:function(){var text;if(this.options.loadTextURL){text=this.options.loadingText;}else{text=this.getText();}
if(this.options.rows==1&&!this.hasHTMLLineBreaks(text)){this.options.textarea=false;var textField=document.createElement("input");textField.type="text";textField.name="value";textField.value=text;textField.style.backgroundColor=this.options.highlightcolor;var size=this.options.size||this.options.cols||0;if(size!=0)textField.size=size;this.editField=textField;}else{this.options.textarea=true;var textArea=document.createElement("textarea");textArea.name="value";textArea.value=this.convertHTMLLineBreaks(text);textArea.rows=this.options.rows;textArea.cols=this.options.cols||40;this.editField=textArea;}
if(this.options.loadTextURL){this.loadExternalText();}
this.form.appendChild(this.editField);},getText:function(){return this.element.innerHTML;},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions));},onLoadedExternalText:function(transport){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=transport.responseText.stripTags();},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false;},onFailure:function(transport){this.options.onFailure(transport);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null;}
return false;},onSubmit:function(){var form=this.form;var value=this.editField.value;this.onLoading();new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(form,value),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions));if(arguments.length>1){Event.stop(arguments[0]);}
return false;},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving();},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);},removeForm:function(){if(this.form){if(this.form.parentNode)Element.remove(this.form);this.form=null;}},enterHover:function(){if(this.saving)return;this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel();}
Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground;}
Element.removeClassName(this.element,this.options.hoverClassName)
if(this.saving)return;this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground});},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl);}
this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode();},onComplete:function(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,this.element);},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;}
this.leaveEditMode();Event.stopObserving(this.element,'click',this.onclickListener);Event.stopObserving(this.element,'mouseover',this.mouseoverListener);Event.stopObserving(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,'click',this.onclickListener);Event.stopObserving(this.options.externalControl,'mouseover',this.mouseoverListener);Event.stopObserving(this.options.externalControl,'mouseout',this.mouseoutListener);}}};Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={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));}};
;
/****** FILE: jsparty/greybox/AmiJS.js *****/

AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,_unloadListeners:function(){if(AJS.listeners)
AJS.map(AJS.listeners,function(elm,type,fn){AJS.removeEventListener(elm,type,fn)});AJS.listeners=[];},getElement:function(id){if(AJS.isString(id)||AJS.isNumber(id))
return document.getElementById(id);else
return id;},getScrollTop:function(){var t;if(document.documentElement&&document.documentElement.scrollTop)
t=document.documentElement.scrollTop;else if(document.body)
t=document.body.scrollTop;return t;},isArray:function(obj){return obj instanceof Array;},removeElement:function(){var args=AJS.flattenList(arguments);AJS.map(args,function(elm){AJS.swapDOM(elm,null);});},isDict:function(o){var str_repr=String(o);return str_repr.indexOf(" Object")!=-1;},isString:function(obj){return(typeof obj=='string');},getIndex:function(elm,list,eval_fn){for(var i=0;i<list.length;i++)
if(eval_fn&&eval_fn(list[i])||elm==list[i])
return i;return-1;},createDOM:function(name,attrs){var i=0,attr;elm=document.createElement(name);if(AJS.isDict(attrs[i])){for(k in attrs[0]){attr=attrs[0][k];if(k=="style")
elm.style.cssText=attr;else if(k=="class"||k=='className')
elm.className=attr;else{elm.setAttribute(k,attr);}}
i++;}
if(attrs[0]==null)
i=1;AJS.map(attrs,function(n){if(n){if(AJS.isString(n)||AJS.isNumber(n))
n=AJS.TN(n);elm.appendChild(n);}},i);return elm;},isIe:function(){return(navigator.userAgent.toLowerCase().indexOf("msie")!=-1&&navigator.userAgent.toLowerCase().indexOf("opera")==-1);},addEventListener:function(elm,type,fn,listen_once,cancle_bubble){if(!cancle_bubble)
cancle_bubble=false;var elms=AJS.$A(elm);AJS.map(elms,function(elmz){if(listen_once)
fn=AJS._listenOnce(elmz,type,fn);if(AJS.isIn(type,['submit','load','scroll','resize'])){var old=elm['on'+type];elm['on'+type]=function(){if(old){fn(arguments);return old(arguments);}
else
return fn(arguments);};return;}
if(elmz.attachEvent){elmz.attachEvent("on"+type,fn);}
else if(elmz.addEventListener)
elmz.addEventListener(type,fn,cancle_bubble);AJS.listeners=AJS.$A(AJS.listeners);AJS.listeners.push([elmz,type,fn]);});},swapDOM:function(dest,src){dest=AJS.getElement(dest);var parent=dest.parentNode;if(src){src=AJS.getElement(src);parent.replaceChild(src,dest);}else{parent.removeChild(dest);}
return src;},getLast:function(list){if(list.length>0)
return list[list.length-1];else
return null;},map:function(list,fn,start_index,end_index){var i=0,l=list.length;if(start_index)
i=start_index;if(end_index)
l=end_index;for(i;i<l;i++)
fn.apply(null,[list[i]]);},getElementsByTagAndClassName:function(tag_name,class_name,parent){var class_elements=[];if(!AJS.isDefined(parent))
parent=document;if(!AJS.isDefined(tag_name))
tag_name='*';var els=parent.getElementsByTagName(tag_name);var els_len=els.length;var pattern=new RegExp("(^|\\s)"+class_name+"(\\s|$)");for(i=0,j=0;i<els_len;i++){if(pattern.test(els[i].className)||class_name==null){class_elements[j]=els[i];j++;}}
return class_elements;},isOpera:function(){return(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);},setLeft:function(){var args=AJS.flattenList(arguments);var l=AJS.getLast(args);AJS.map(args,function(elm){elm.style.left=AJS.getCssDim(l)},0,args.length-1);},getBody:function(){return AJS.$bytc('body')[0]},getWindowSize:function(){var win_w,win_h;if(self.innerHeight){win_w=self.innerWidth;win_h=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){win_w=document.documentElement.clientWidth;win_h=document.documentElement.clientHeight;}else if(document.body){win_w=document.body.clientWidth;win_h=document.body.clientHeight;}
return{'w':win_w,'h':win_h};},showElement:function(){var args=AJS.flattenList(arguments);AJS.map(args,function(elm){elm.style.display=''});},removeEventListener:function(elm,type,fn,cancle_bubble){if(!cancle_bubble)
cancle_bubble=false;if(elm.removeEventListener){elm.removeEventListener(type,fn,cancle_bubble);if(AJS.isOpera())
elm.removeEventListener(type,fn,!cancle_bubble);}
else if(elm.detachEvent)
elm.detachEvent("on"+type,fn);},_getRealScope:function(fn,extra_args,dont_send_event,rev_extra_args){var scope=window;extra_args=AJS.$A(extra_args);if(fn._cscope)
scope=fn._cscope;return function(){var args=[];var i=0;if(dont_send_event)
i=1;AJS.map(arguments,function(arg){args.push(arg)},i);args=args.concat(extra_args);if(rev_extra_args)
args=args.reverse();return fn.apply(scope,args);};},_createDomShortcuts:function(){var elms=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","br","textarea","form","p","select","option","iframe","script","center","dl","dt","dd","small","pre"];var createDOM=AJS.createDOM;var extends_ajs=function(elm){var c_dom="return createDOM.apply(null, ['"+elm+"', arguments]);";var c_fun_dom='function() { '+c_dom+'  }';eval("AJS."+elm.toUpperCase()+"="+c_fun_dom);}
AJS.map(elms,extends_ajs);AJS.TN=function(text){return document.createTextNode(text)};},isNumber:function(obj){return(typeof obj=='number');},bind:function(fn,scope,extra_args,dont_send_event,rev_extra_args){fn._cscope=scope;return AJS._getRealScope(fn,extra_args,dont_send_event,rev_extra_args);},setTop:function(){var args=AJS.flattenList(arguments);var t=AJS.getLast(args);AJS.map(args,function(elm){elm.style.top=AJS.getCssDim(t)},0,args.length-1);},appendChildNodes:function(elm){if(arguments.length>=2){AJS.map(arguments,function(n){if(AJS.isString(n))
n=AJS.TN(n);if(AJS.isDefined(n))
elm.appendChild(n);},1);}
return elm;},isDefined:function(o){return(o!="undefined"&&o!=null)},isIn:function(elm,list){var i=AJS.getIndex(elm,list);if(i!=-1)
return true;else
return false;},setHeight:function(){var args=AJS.flattenList(arguments);var h=AJS.getLast(args);AJS.map(args,function(elm){elm.style.height=AJS.getCssDim(h)},0,args.length-1);},hideElement:function(elm){var args=AJS.flattenList(arguments);AJS.map(args,function(elm){elm.style.display='none'});},createArray:function(v){if(AJS.isArray(v)&&!AJS.isString(v))
return v;else if(!v)
return[];else
return[v];},setWidth:function(){var args=AJS.flattenList(arguments);var w=AJS.getLast(args);AJS.map(args,function(elm){elm.style.width=AJS.getCssDim(w)},0,args.length-1);},getCssDim:function(dim){if(AJS.isString(dim))
return dim;else
return dim+"px";},_listenOnce:function(elm,type,fn){var r_fn=function(){AJS.removeEventListener(elm,type,r_fn);fn(arguments);}
return r_fn;},flattenList:function(list){var r=[];var _flatten=function(r,l){AJS.map(l,function(o){if(AJS.isArray(o))
_flatten(r,o);else
r.push(o);});}
_flatten(r,list);return r;}}
AJS.$=AJS.getElement;AJS.$$=AJS.getElements;AJS.$f=AJS.getFormElement;AJS.$b=AJS.bind;AJS.$A=AJS.createArray;AJS.DI=AJS.documentInsert;AJS.ACN=AJS.appendChildNodes;AJS.RCN=AJS.replaceChildNodes;AJS.AEV=AJS.addEventListener;AJS.REV=AJS.removeEventListener;AJS.$bytc=AJS.getElementsByTagAndClassName;AJS.addEventListener(window,'unload',AJS._unloadListeners);AJS._createDomShortcuts()
AJSDeferred=function(req){this.callbacks=[];this.errbacks=[];this.req=req;};AJSDeferred.prototype={excCallbackSeq:function(req,list){var data=req.responseText;while(list.length>0){var fn=list.pop();var new_data=fn(data,req);if(new_data)
data=new_data;}},callback:function(){this.excCallbackSeq(this.req,this.callbacks);},errback:function(){if(this.errbacks.length==0)
alert("Error encountered:\n"+this.req.responseText);this.excCallbackSeq(this.req,this.errbacks);},addErrback:function(fn){this.errbacks.unshift(fn);},addCallback:function(fn){this.callbacks.unshift(fn);},addCallbacks:function(fn1,fn2){this.addCallback(fn1);this.addErrback(fn2);},sendReq:function(data){if(AJS.isObject(data)){var post_data=[];for(k in data){post_data.push(k+"="+AJS.urlencode(data[k]));}
post_data=post_data.join("&");this.req.send(post_data);}
else if(AJS.isDefined(data))
this.req.send(data);else{this.req.send("");}}}
;
/****** FILE: jsparty/greybox/greybox.js *****/

var GB_CURRENT=null;var GB_ONLY_ONE=null;try{var theBaseHref=document.getElementsByTagName("base")[0].href;var GB_IMG_DIR=theBaseHref+"jsparty/greybox/";}catch(err){var GB_IMG_DIR="jsparty/greybox/";}
function GreyBox(){this.type="page";this.overlay_click_close=true;if(GB_IMG_DIR)
this.img_dir=GB_IMG_DIR;else
this.img_dir="greybox/";this.overlay_color="dark";this.center_window=false;this.g_window=null;this.g_container=null;this.iframe=null;this.overlay=null;this.timeout=null;this.defaultSize();this.showCloseImage(true);this.url="";this.caption="";this.callback_fn=[];this.reload_on_close=false;}
GreyBox.prototype.setDimension=function(width,height){this.height=height;this.width=width;}
GreyBox.prototype.setFullScreen=function(bool){this.full_screen=bool;}
GreyBox.prototype.setType=function(type){this.type=type;}
GreyBox.prototype.setCenterWindow=function(bool){this.center_window=bool;}
GreyBox.prototype.setImageDir=function(dir){this.img_dir=dir;}
GreyBox.prototype.showCloseImage=function(bool){this.show_close_img=bool;}
GreyBox.prototype.setOverlayCloseClick=function(bool){this.overlay_click_close=bool;}
GreyBox.prototype.setOverlayColor=function(color){this.overlay_color=color;}
GreyBox.prototype.setCallback=function(fn){if(fn)
this.callback_fn.push(fn);}
GreyBox.prototype.show=function(caption,url){GB_CURRENT=this;this.url=url;this.caption=caption;AJS.map(AJS.$bytc("div","GB_dummy"),function(elm){AJS.removeElement(elm)});AJS.map(AJS.$bytc("div","GB_loader"),function(elm){AJS.removeElement(elm)});if(AJS.isIe())
AJS.map(AJS.$bytc("select"),function(elm){elm.style.visibility="hidden"});AJS.map(AJS.$bytc("object"),function(elm){elm.style.visibility="hidden"});this.initOverlayIfNeeded();this.setOverlayDimension();AJS.showElement(this.overlay);this.setFullScreenOption();this.initIfNeeded();AJS.hideElement(this.g_window);AJS.ACN(this.g_container,this.iframe);if(caption=="")
caption="&nbsp;";this.div_caption.innerHTML=caption;AJS.showElement(this.g_window)
this.setVerticalPosition();this.setWidthNHeight();this.setTopNLeft();GB_CURRENT.startLoading();return false;}
GreyBox.prototype.hide=function(){AJS.hideElement(this.g_window,this.overlay);try{AJS.removeElement(this.iframe);}
catch(e){}
this.iframe=null;if(this.type=="image"){this.width=200;this.height=200;}
if(AJS.isIe())
AJS.map(AJS.$bytc("select"),function(elm){elm.style.visibility="visible"});AJS.map(AJS.$bytc("object"),function(elm){elm.style.visibility="visible"});var c_bs=GB_CURRENT.callback_fn;if(c_bs!=[]){AJS.map(c_bs,function(fn){fn();});}
GB_CURRENT=null;if(this.reload_on_close)
window.location.reload();}
GB_initOneIfNeeded=function(){if(!GB_ONLY_ONE){GB_ONLY_ONE=new GreyBox();}}
GB_show=function(caption,url,height,width,callback_fn){GB_initOneIfNeeded();GB_ONLY_ONE.defaultSize();GB_ONLY_ONE.setFullScreen(false);GB_ONLY_ONE.setType("page");GB_ONLY_ONE.setCallback(callback_fn);GB_ONLY_ONE.setDimension(width,height);GB_ONLY_ONE.show(caption,url);return false;}
GB_showFullScreen=function(caption,url,callback_fn){GB_initOneIfNeeded();GB_ONLY_ONE.defaultSize();GB_ONLY_ONE.setType("page");GB_ONLY_ONE.setCallback(callback_fn);GB_ONLY_ONE.setFullScreen(true);GB_ONLY_ONE.show(caption,url);return false;}
GB_showImage=function(caption,url){GB_initOneIfNeeded();GB_ONLY_ONE.defaultSize();GB_ONLY_ONE.setFullScreen(false);GB_ONLY_ONE.setType("image");GB_ONLY_ONE.show(caption,url);return false;}
GB_hide=function(){GB_CURRENT.hide();}
GreyBox.preloadGreyBoxImages=function(img_dir){var pics=[];if(!img_dir)
img_dir=GB_IMG_DIR;var fn=function(path){var pic=new Image();pic.src=GB_IMG_DIR+path;pics.push(pic);};AJS.map(['indicator.gif','blank.gif','close.gif','header_bg.gif','overlay_light.png','overlay_dark.png'],AJS.$b(fn,this));}
GreyBox.prototype.getOverlayImage=function(){return"overlay_"+this.overlay_color+".png";};GreyBox.prototype.initOverlayIfNeeded=function(){this.overlay=AJS.DIV({'id':'GB_overlay'});if(AJS.isIe()){this.overlay.style.backgroundColor="#000000";this.overlay.style.backgroundColor="transparent";this.overlay.style.backgroundImage="url("+this.img_dir+"blank.gif)";this.overlay.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.img_dir+this.getOverlayImage()+"',sizingMethod='scale')";}
else
this.overlay.style.backgroundImage="url("+this.img_dir+this.getOverlayImage()+")";if(this.overlay_click_close)
AJS.AEV(this.overlay,"click",GB_hide);AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);};GreyBox.prototype.initIfNeeded=function(){this.init();this.setWidthNHeight=AJS.$b(this.setWidthNHeight,this);this.setTopNLeft=AJS.$b(this.setTopNLeft,this);this.setFullScreenOption=AJS.$b(this.setFullScreenOption,this);this.setOverlayDimension=AJS.$b(this.setOverlayDimension,this);GreyBox.addOnWinResize(this.setWidthNHeight,this.setTopNLeft,this.setFullScreenOption,this.setOverlayDimension);this.g_container.style.marginBottom="-3px";var fn=function(){this.setOverlayDimension();this.setVerticalPosition();this.setTopNLeft();this.setWidthNHeight();};AJS.AEV(window,"scroll",AJS.$b(fn,this));if(!this.iframe){var new_frame;var d={'name':'GB_frame','class':'GB_frame','frameBorder':0};new_frame=AJS.IFRAME(d);this.iframe=new_frame;AJS.hideElement(this.iframe);}}
GreyBox.prototype.init=function(){this.g_window=AJS.DIV({'id':'GB_window'});var table=AJS.TABLE({'class':'GB_t_frame','frameborder':0});var tbody=AJS.TBODY();AJS.ACN(table,tbody);var td_middle_m=AJS.TD({'class':'GB_content'});this.td_middle_m=td_middle_m;AJS.ACN(tbody,AJS.TR(td_middle_m));var header=AJS.TABLE({'class':'GB_header'});this.header=header;var caption=AJS.TD({'class':'GB_caption'});this.div_caption=caption;tbody_header=AJS.TBODY();var close=AJS.TD({'class':'GB_close'});if(this.show_close_img){var img_close=AJS.IMG({'src':this.img_dir+'close.gif'});AJS.ACN(close,img_close,"Close");AJS.AEV(close,"click",GB_hide);}
AJS.ACN(tbody_header,AJS.TR(caption,close));AJS.ACN(header,tbody_header);AJS.ACN(td_middle_m,header);this.g_container=AJS.DIV({'class':'GB_container'});AJS.ACN(td_middle_m,this.g_container);AJS.ACN(this.g_window,table);AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);}
GreyBox.prototype.startLoading=function(){this.iframe.src=this.img_dir+'loader_frame.html';AJS.showElement(this.iframe);}
GreyBox.prototype.setIframeWidthNHeight=function(){try{AJS.setWidth(this.iframe,this.width);AJS.setHeight(this.iframe,this.height);}
catch(e){}}
GreyBox.prototype.setOverlayDimension=function(){var page_size=AJS.getWindowSize();if((navigator.userAgent.toLowerCase().indexOf("firefox")!=-1))
AJS.setWidth(this.overlay,"100%");else
AJS.setWidth(this.overlay,page_size.w);var max_height=Math.max(AJS.getScrollTop()+page_size.h,AJS.getScrollTop()+this.height);if(max_height<AJS.getScrollTop())
AJS.setHeight(this.overlay,max_height);else
AJS.setHeight(this.overlay,AJS.getScrollTop()+page_size.h);}
GreyBox.prototype.setWidthNHeight=function(){AJS.setWidth(this.g_window,this.width);AJS.setHeight(this.g_window,this.height);AJS.setWidth(this.g_container,this.width);AJS.setHeight(this.g_container,this.height);this.setIframeWidthNHeight();AJS.setWidth(this.td_middle_m,this.width+10);}
GreyBox.prototype.setTopNLeft=function(){var page_size=AJS.getWindowSize();AJS.setLeft(this.g_window,((page_size.w-this.width)/2)-13);var fl=((page_size.h-this.height)/2)-15+AJS.getScrollTop();AJS.setTop(this.g_window,fl);}
GreyBox.prototype.setVerticalPosition=function(){var page_size=AJS.getWindowSize();var st=AJS.getScrollTop();if(this.g_window.offsetWidth<=page_size.h||st<=this.g_window.offsetTop){AJS.setTop(this.g_window,st);}}
GreyBox.prototype.setFullScreenOption=function(){if(this.full_screen){var page_size=AJS.getWindowSize();overlay_h=page_size.h;this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);this.height=Math.round(overlay_h-(overlay_h/100)*10);}}
GreyBox.prototype.defaultSize=function(){this.width=300;this.height=300;}
GreyBox.addOnWinResize=function(funcs){funcs=AJS.$A(funcs);AJS.map(funcs,function(fn){AJS.AEV(window,"resize",fn);});}
;
/****** FILE: cms/javascript/LeftAndMain.js *****/

var _AJAX_LOADING=false;if(typeof(jQuery)!='undefined'){(function($){$(document).ready(function(){window.onresize(true);});})(jQuery);}
function DraggableSeparator(){this.onmousedown=this.onmousedown.bindAsEventListener(this);}
DraggableSeparator.prototype={onmousedown:function(event){this.leftBase=$('left').offsetWidth-Event.pointerX(event);this.separatorBase=getDimension($('separator'),'left')-Event.pointerX(event);this.rightBase=getDimension($('right'),'left')-Event.pointerX(event);document.onmousemove=this.document_mousemove.bindAsEventListener(this);document.onmouseup=this.document_mouseup.bindAsEventListener(this);document.body.onselectstart=this.body_selectstart.bindAsEventListener(this);},document_mousemove:function(event){$('left').style.width=(this.leftBase+Event.pointerX(event))+'px';fixRightWidth();},document_mouseup:function(e){document.onmousemove=null;},body_selectstart:function(event){Event.stop(event);return false;}}
function fixRightWidth(){if(!$('right'))return;var sep=getDimension($('left'),'width')+getDimension($('left'),'left');$('separator').style.left=(sep+2)+'px';$('right').style.left=(sep+6)+'px';var bodyWidth=parseInt(document.body.offsetWidth);var leftWidth=parseInt($('left').offsetWidth);var sepWidth=parseInt($('separator').offsetWidth-8);var rightWidth=bodyWidth-leftWidth-sepWidth-18;if($('contentPanel')&&$('contentPanel').style.display!="none"){rightWidth-=210;$('contentPanel').style.left=leftWidth+sepWidth+rightWidth+sepWidth+23+'px';}
if(rightWidth>=0)$('right').style.width=rightWidth+'px';}
Behaviour.register({'#separator':DraggableSeparator,'#left':{hide:function(){if(!this.hidden){this.hidden=true;this.style.width=null;Element.addClassName(this,'hidden');Element.addClassName('separator','hidden');fixRightWidth();}},show:function(){if(this.hidden){this.hidden=false;Element.removeClassName(this,'hidden');Element.removeClassName('separator','hidden');fixRightWidth();}}},'#MainMenu li':{onclick:function(event){return LeftAndMain_window_unload();window.location.href=this.getElementsByTagName('a')[0].href;Event.stop(event);}},'#Menu-help':{onclick:function(){var w=window.open(this.getElementsByTagName('a')[0].href,'help');w.focus();return false;}},'#Logo':{onclick:function(){var w=window.open(this.getElementsByTagName('a')[0].href);w.focus();return false;}},'#EditMemberProfile':{onclick:function(e){var el=Event.element(e);GB_show('Edit Profile',el.attributes.href.value,290,500);Event.stop(e);}}});window.ontabschanged=function(){var formEl=$('Form_EditForm');if(!formEl)formEl=$('Form_AddForm');if(!formEl)
return;var fs=formEl.getElementsByTagName('fieldset')[0];if(fs)fs.style.height=formEl.style.height;if(typeof _TAB_DIVS_ON_PAGE!='undefined'){for(i=0;i<_TAB_DIVS_ON_PAGE.length;i++){fitToParent(_TAB_DIVS_ON_PAGE[i],30);}}}
window.onresize=function(init){var right=$('right');if(typeof fitToParent=='function'){fitToParent('right',12);if($('ModelAdminPanel')){fitToParent('ModelAdminPanel',-60);}
if($('contentPanel')){fitToParent('contentPanel',12);}}
if($('left')&&$('separator')&&right){if(navigator.appName=="Microsoft Internet Explorer"){var paddingBottomOffset=35;}else{var paddingBottomOffset=20;}
var rightH=parseInt(right.style.height)+paddingBottomOffset;$('left').style.height=$('separator').style.height=rightH+'px';}
if(typeof fitToParent=='function'){if($('Form_EditForm'))fitToParent('Form_EditForm',4);if($('Form_AddForm'))fitToParent('Form_AddForm',4);if($('Form_EditorToolbarImageForm')&&$('Form_EditorToolbarImageForm').style.display=="block"){fitToParent('Form_EditorToolbarImageForm',5);fitToParent($('Form_EditorToolbarImageForm').getElementsByTagName('fieldset')[0]);if(navigator.appName=="Microsoft Internet Explorer"){fitToParent('Image');}else{fitToParent('Image',250);}}
if($('Form_EditorToolbarFlashForm')&&$('Form_EditorToolbarFlashForm').style.display=="block"){fitToParent('Form_EditorToolbarFlashForm',5);fitToParent($('Form_EditorToolbarFlashForm').getElementsByTagName('fieldset')[0]);if(navigator.appName=="Microsoft Internet Explorer"){fitToParent('Flash');}else{fitToParent('Flash',130);}}}
if(typeof fixHeight_left=='function')fixHeight_left();if(typeof fixRightWidth=='function')fixRightWidth();window.ontabschanged();}
appendLoader(function(){document.body.style.overflow='hidden';window.onresize(true);});function isVisible(el){if(el.tagName=="body"||el.tagName=="BODY")return(el.isVisible=true);else if(el.style.display=='none')return(el.isVisible=false);else return(el.isVisible=isVisible(el.parentNode));}
LeftAndMain_window_unload=function(){window.exiting=true;if(typeof autoSave=='function'){return autoSave(true);}}
function unlockStatusMessage(){statusMessage.locked=false;if(statusMessage.queued){statusMessage(statusMessage.queued.msg,statusMessage.queued.type,statusMessage.queued.showNetworkActivity);statusMessage.queued=null;}}
function ajaxActionsAtTop(formName,actionHolderName,tabName){var actions=document.getElementsBySelector('#'+formName+' .Actions')[0];var holder;if((holder=$(actionHolderName))&&holder!=actions){holder.parentNode.removeChild(holder);}
if(actions){actions.id=actionHolderName;actions.className='ajaxActions';$(tabName).appendChild(actions);prepareAjaxActions(actions,formName,tabName);}}
function prepareAjaxActions(actions,formName,tabName){var i,button,list=actions.getElementsByTagName('input')
for(i=0;button=list[i];i++){button.ownerForm=$(formName);button.onclick=function(e){if(!e)e=window.event;if(window[this.name+'_'+tabName]){window[this.name+'_'+tabName](e);}else{statusMessage('...');Ajax.SubmitForm(this.ownerForm,this.name,{onSuccess:Ajax.Evaluator,onFailure:ajaxErrorHandler});}
return false;}}}
function ingize(val){var ingWord,suffix;if(!val)val="process";if(val.match(/^([^ ]+) +(.*)$/)){ingWord=RegExp.$1;suffix=' '+RegExp.$2+'...';}else{ingWord=val;suffix='...';}
if(ingWord.match(/^(.*)e$/))return RegExp.$1+'ing'+suffix;else return ingWord+'ing'+suffix;}
function ajaxSubmitForm(automated,callAfter,form,action,verb){var alreadySaved=false;if($(form).elements.length<2)alreadySaved=true;if(alreadySaved){if(callAfter)callAfter();}else{statusMessage(verb+'...','',true);var success=function(response){Ajax.Evaluator(response);if(callAfter)callAfter();}
if(callAfter)success=success.bind({callAfter:callAfter});Ajax.SubmitForm(form,action,{onSuccess:success,onFailure:function(response){errorMessage('Error '+verb,response);}});}
return false;};function ajaxSubmitFieldSet(href,fieldSet,extraData){var i,field,data="ajax=1";for(i=0;field=fieldSet[i];i++){data+='&'+Form.Element.serialize(field);}
if(extraData){data+='&'+extraData;}
new Ajax.Request(href,{method:'post',postBody:data,onSuccess:function(response){Ajax.Evaluator(response);},onFailure:function(response){alert(response.responseText);}});}
function ajaxLink(href){new Ajax.Request(href+(href.indexOf("?")==-1?"?":"&")+"ajax=1",{method:'get',onSuccess:Ajax.Evaluator,onFailure:ajaxErrorHandler});}
function ajaxLoadPage(){statusMessage('loading...',2,true);new Ajax.Request(this.URL+'&ajax=1',{method:'get',onSuccess:ajaxLoadPage_success.bind(this)});}
function ajaxLoadPage_success(response){statusMessage('loaded');$(this.form).loadNewPage(response.responseText);}
Behaviour.register({'#statusMessage':{showMessage:function(message,type,waitTime,clearManually){if(this.fadeTimer){clearTimeout(this.fadeTimer);this.fadeTimer=null;}
if(this.currentEffect){this.currentEffect.cancel();this.currentEffect=null;}
this.innerHTML=message;this.className=type;Element.setOpacity(this,1);this.style.display='';this.style.visibility='';if(!clearManually){this.fade(0.5,waitTime?waitTime:5);}},clearMessage:function(waitTime){this.fade(0.5,waitTime);},fade:function(fadeTime,waitTime){if(!fadeTime)fadeTime=0.5;if(waitTime){this.fadeTimer=setTimeout((function(){this.fade(fadeTime);}).bind(this),waitTime*1000);}else{this.currentEffect=new Effect.Opacity(this,{duration:0.5,transition:Effect.Transitions.linear,from:1.0,to:0.0,afterFinish:this.afterFade.bind(this)});}},afterFade:function(){this.style.visibility='hidden';this.style.display='none';this.innerHTML='';}}});function statusMessage(msg,type,clearManually,container){var statusMessageEl=$('statusMessage');if(container!=null)statusMessageEl=container;if(statusMessageEl){if(msg){statusMessageEl.showMessage(msg,type,msg.length/20,clearManually);}else{statusMessageEl.clearMessage();}}}
function clearStatusMessage(){$('statusMessage').clearMessage();}
function errorMessage(msg,fullMessage){if(fullMessage){try{if(typeof fullMessage=='object')fullMessage=fullMessage.status+'//'+fullMessage.responseText;}catch(er){fullMessage="";}
console.error(fullMessage);}
msg=msg.replace(/\n/g,'<br>');$('statusMessage').showMessage(msg,'bad');}
function ajaxErrorHandler(response){errorMessage('Server Error',response);}
BaseForm=Class.create();BaseForm.prototype={intitialize:function(){this.visible=this.style.display=='none'?false:true;this.buttons=[];var i,input,allInputs=this.getElementsByTagName('input');for(i=0;input=allInputs[i];i++){if(input.type=='button'||input.type=='submit'){this.buttons.push(input);input.holder=this;input.onclick=function(){return this.holder.buttonClicked(this);}}}},show:function(){this.visible=true;Element.hide(show);},hide:function(){this.visible=false;Element.hide(this);},isVisible:function(){return this.visible;},buttonClicked:function(button){return true;}}
ChangeTracker=Class.create();ChangeTracker.prototype={initialize:function(){this.resetElements();},resetElements:function(debug){var elements=Form.getElements(this);var i,element;for(i=0;element=elements[i];i++){if(element.resetChanged){element.resetChanged();}else{element.originalSerialized=Form.Element.serialize(element);}}},field_changed:function(){if((this.originalSerialized+'')=='undefined')return Form.Element.serialize(this)?true:false;else return this.originalSerialized!=Form.Element.serialize(this);},isChanged:function(){var elements=Form.getElements(this);var i,element;for(i=0;element=elements[i];i++){if(element.className.substr(0,3)=='mce')continue;if(!element.isChanged)element.isChanged=this.field_changed;if(!this.changeDetection_fieldsToIgnore[element.name]&&element.isChanged()){return true;}}
return false;},changeDetection_fieldsToIgnore:{'Sort':true},serializeChangedFields:function(){var elements=Form.getElements(this);var queryComponent,queryComponents=new Array();var i,element;var forceFields={};if(arguments){for(var i=0;i<arguments.length;i++)forceFields[arguments[i]]=true;}
for(i=0;element=elements[i];i++){if(!element.name.match(/^action_(.+)$/i))
{if(!element.isChanged)element.isChanged=this.field_changed;if(forceFields[element.name]||(element.isChanged())||element.name.match(/\[.*\]/g)){queryComponent=Form.Element.serialize(element);if(queryComponent)
queryComponents.push(queryComponent);}else{if(element.name.match('/\]$/'))
queryComponents.push(element.name.substring(0,element.name.length-1)+'_unchanged'+']=1');else
queryComponents.push(element.name+'_unchanged=1');}}}
return queryComponents.join('&');},serializeAllFields:function(){return Form.serializeWithoutButtons(this);}}
ModalForm=Class.extend('BaseForm');ModalForm.prototype={blockEvent:function(element,event){element.observeMethod(event,(function(){return!this.isVisible();}).bind(this));}}
function doYouWantToRollback(handlers){var url=document.getElementsByTagName('base')[0].href+'admin/canceldraftchangesdialog';OpenModalDialog(url,handlers,'Are you sure?');}
function modalDialog(url,handlers){var baseURL=document.getElementsByTagName('base')[0].href;if(window.showModalDialog){var result=showModalDialog(baseURL+url+'&Modal=1',null,"status:no;dialogWidth:400px;dialogHeight:150px;edge:sunken");if(handlers[result])
handlers[result]();}}
ModalDialog=Class.create();ModalDialog.prototype={initialize:function(url,handlers){this.url=url;this.handlers=handlers;this.timer=setInterval(this.interval.bind(this),50);this.window=window.open(this.url,'dialog',"status=no,width=400,height=150,edge=sunken");this.window.dialogObject=this;this.window.linkedObject=this;setTimeout((function(){this.window.linkedObject=this;}).bind(this),500);},force:function(val){this.finished=true;this.clearInterval(this.time);if(this.handlers[val]){_DO_YOU_WANT_TO_SAVE_IS_OPEN=false;(this.handlers[val])();}else{throw("Couldn't find a handler called '"+this.result+"'");}},interval:function(){if(this.finished){clearInterval(this.timer);return;}
if(!this.window||this.window.closed){clearInterval(this.timer);if(this.handlers){if(this.handlers[this.result]){_DO_YOU_WANT_TO_SAVE_IS_OPEN=false;(this.handlers[this.result])();}else{throw("Couldn't find a handler called '"+this.result+"'");}}}else{this.window.focus();}}}
window.top._OPEN_DIALOG=null;OpenModalDialog=function(url,handlers,message){var dialog=new GBModalDialog(url,handlers,message);}
GBModalDialog=Class.create();GBModalDialog.prototype={initialize:function(url,handlers,message){this.url=url;this.handlers=handlers;this.caption=message;window.top._OPEN_DIALOG=this;GB_show(this.caption,this.url,110,450);},execHandler:function(handler){GB_hide();if(this.handlers[handler])
this.handlers[handler]();else
throw("Unknown handler '"+handler+"'");}}
function hideLoading(){if($('Loading'))$('Loading').style.display='none';Element.removeClassName(document.body,'stillLoading');}
function baseHref(){var baseTags=document.getElementsByTagName('base');if(baseTags)return baseTags[0].href;else return"";}
returnFalse=function(){return false;}
showResponseAsSuccessMessage=function(response){statusMessage(response.responseText,'good');}
function onSessionLost(){w=window.open('Security/login');if(w){alert("Please log in and then try again");}else{alert("Please enable pop-ups for this site");}}
var _CURRENT_CONTEXT_MENU=null;function createContextMenu(event,owner,menuItems){if(_CURRENT_CONTEXT_MENU){document.body.removeChild(_CURRENT_CONTEXT_MENU);_CURRENT_CONTEXT_MENU=null;}
var menu=document.createElement("ul");menu.className='contextMenu';menu.style.position='absolute';menu.style.left=event.clientX+'px';menu.style.top=event.clientY+'px';var menuItemName,menuItemTag,menuATag;for(menuItemName in menuItems){menuItemTag=document.createElement("li");menuATag=document.createElement("a");menuATag.href="#";menuATag.onclick=menuATag.oncontextmenu=contextmenu_onclick;menuATag.innerHTML=menuItemName;menuATag.handler=menuItems[menuItemName];menuATag.owner=owner;menuItemTag.appendChild(menuATag);menu.appendChild(menuItemTag);}
document.body.appendChild(menu);document.body.onclick=contextmenu_close;_CURRENT_CONTEXT_MENU=menu;return menu;}
function contextmenu_close(){if(_CURRENT_CONTEXT_MENU){document.body.removeChild(_CURRENT_CONTEXT_MENU);_CURRENT_CONTEXT_MENU=null;}}
function contextmenu_onclick(){this.handler(this.owner);contextmenu_close();return false;}
function showIndicator(id,container,imgSrc,insertionType,displayType){if(!id||!$(container))return false;if(!imgSrc)imgSrc="cms/images/network-save.gif";if(!displayType)displayType="inline";if(!insertionType)insertionType=Insertion.Bottom;if(!$(id)){var html='<img src="'+imgSrc+'" class="indicator '+displayType+'" id="'+id+'" style="display: none" />';new insertionType(container,html);}
Effect.Appear(id);}
function hideIndicator(id){Effect.Fade(id,{duration:0.3});}
setInterval(function(){new Ajax.Request("Security/ping");},5*60*1000);function nullConverter(url){return url;}
Behaviour.register({'textarea.htmleditor':{initialize:function(){tinyMCE.execCommand("mceAddControl",true,this.id);this.isChanged=function(){return tinyMCE.getInstanceById(this.id).isDirty();}
this.resetChanged=function(){inst=tinyMCE.getInstanceById(this.id);if(inst)inst.startContent=tinymce.trim(inst.getContent({format:'raw',no_events:1}));}}}})
;
/****** FILE: cms/javascript/LeftAndMain_left.js *****/

if(typeof SiteTreeHandlers=='undefined')SiteTreeHandlers={};SiteTreeHandlers.parentChanged_url='admin/ajaxupdateparent';SiteTreeHandlers.orderChanged_url='admin/ajaxupdatesort';SiteTreeHandlers.showRecord_url='admin/show/';SiteTreeHandlers.controller_url='admin';var _HANDLER_FORMS={addpage:'Form_AddPageOptionsForm',batchactions:'batchactionsforms',search:'search_options'};var TreeContextMenu=null;TreeAPI=Class.create();TreeAPI.prototype={setCustomURL:function(url,arguments){this.customURL=url;this.customArguments=$H(arguments);},clearCustomURL:function(){this.customURL=this.customArguments=null;},url:function(args){var args=$H(args).merge(this.customArguments);var url=this.customURL?this.customURL:SiteTreeHandlers.loadTree_url;url=url+(url.match(/\?/)?'&':'?')+args.toQueryString();return url;},reload:function(options){this.innerHTML='Loading...';var args={ajax:1,ID:0};if($('LangSelector'))args.locale=$('LangSelector').value;url=this.url(args);var self=this;new Ajax.Request(url,{onSuccess:function(response){self.innerHTML=response.responseText;self.castAsTreeNode(self.firstChild);if(options.onSuccess)options.onSuccess(response);},onFailure:function(response){errorMessage('error loading tree',response);if(options.onError)options.onError(response);}});},performOnTreeNode:function(idx,code){var treeNode=this.getTreeNodeByIdx(idx);if(!treeNode)return;if(treeNode.className.indexOf('manyparents')==-1){code(treeNode);}else{var i,item,allNodes=this.getElementsByTagName('li');for(i=0;item=allNodes[i];i++){if(treeNode.id==item.id)code(item);}}},getTreeNodeByIdx:function(idx){if(!idx)idx="0";var node=document.getElementById('record-'+idx);if(idx=="0"&&!node)node=document.getElementById('record-root');return node;},getIdxOf:function(treeNode){if(treeNode&&treeNode.id&&treeNode.id.match(/record-([0-9a-zA-Z\-]+)$/))
return RegExp.$1;},createTreeNode:function(idx,title,pageType){var i;var node=document.createElement('li');node.id='record-'+idx;node.className=pageType;var aTag=document.createElement('a');aTag.href=SiteTreeHandlers.showRecord_url+idx;aTag.title='Page type: '+pageType;aTag.innerHTML=title;node.appendChild(aTag);SiteTreeNode.create(node,this.options);return node;},setNodeIdx:function(idx,newIdx){this.performOnTreeNode(idx,function(treeNode){treeNode.id='record-'+newIdx;var aTag=treeNode.getElementsByTagName('a')[0];aTag.href=aTag.href.replace(idx,newIdx);});var treeNode=this.getTreeNodeByIdx(idx);},setNodeTitle:function(idx,title){this.performOnTreeNode(idx,function(treeNode){var aTag=treeNode.getElementsByTagName('a')[0];aTag.innerHTML=title;});},setNodeIcon:function(idx,oldClassName,newClassName){this.performOnTreeNode(idx,function(treeNode){treeNode.className=treeNode.className.replace(oldClassName,newClassName);treeNode.aSpan.className='a '+treeNode.className.replace('closed','spanClosed');var aTag=treeNode.getElementsByTagName('a')[0];aTag.title='Page type: '+newClassName;treeNode.setIconByClass();});},setNodeParentID:function(idx,parentID){var treeNode=this.getTreeNodeByIdx(idx);var parentNode=this.getTreeNodeByIdx(parentID);parentNode.appendTreeNode(treeNode);},setCurrentByIdx:function(idx){if(this.selected){var i,item;for(i=0;item=this.selected[i];i++){item.removeNodeClass('current');}}
__tree=this;__tree.selected=[];this.performOnTreeNode(idx,function(treeNode){__tree.selected.push(treeNode);treeNode.expose();treeNode.addNodeClass('current');});},changeCurrentTo:function(newNode){if(this.selected){var i,item;for(i=0;item=this.selected[i];i++){item.removeNodeClass('current');}}
newNode.addNodeClass('current');this.selected=[newNode];newNode.expose();},firstSelected:function(){if(this.selected)return this.selected[0];}};TreeNodeAPI=Class.create();TreeNodeAPI.prototype={selectTreeNode:function(){if(this.getElementsByTagName('a')[0].href){_AJAX_LOADING=true;if($('sitetree').notify('SelectionChanged',this)){autoSave(true,this.getPageFromServer.bind(this));}}},getPageFromServer:function(){$('Form_EditForm').getPageFromServer(this.id.replace('record-',''),this);_AJAX_LOADING=false;},ajaxExpansion:function(){this.addNodeClass('loading');var ul=this.treeNodeHolder(false);ul.innerHTML='loading...';ul.cuedNewNodes=[];ul.appendTreeNode=function(node){this.cuedNewNodes[this.cuedNewNodes.length]=node;}
var args={ajax:1,ID:this.getIdx()};if($('LangSelector'))args.locale=$('LangSelector').value;url=this.tree.url(args);new Ajax.Request(url,{onSuccess:this.installSubtree.bind(this),onFailure:this.showSubtreeLoadingError});},showSubtreeLoadingError:function(response){errorMessage('error loading subtree',response);},oncontextmenu:function(event){if(TreeContextMenu){if(!event)event=window.event;createContextMenu(event,this,TreeContextMenu);Event.stop(event);return false;}},duplicatePage:function(){var parentClause="";if(this.parentTreeNode&&this.parentTreeNode.getIdx){parentClause="&parentID="+this.parentTreeNode.getIdx();}
new Ajax.Request(baseHref()+'admin/duplicate/'+this.getIdx()+'?ajax=1'+parentClause,{method:'get',onSuccess:Ajax.Evaluator,onFailure:function(response){errorMessage('Error: ',response);}});},duplicatePageWithChildren:function(){new Ajax.Request(baseHref()+'admin/duplicatewithchildren/'+this.getIdx()+'?ajax=1',{method:'get',onSuccess:Ajax.Evaluator,onFailure:function(response){errorMessage('Error: ',response);}});}}
SiteSubTree=Class.extend('Tree').extend('TreeAPI');SiteSubTree.prototype={castAsTreeNode:function(li){behaveAs(li,SiteTreeNode,this.options);}}
SiteTree=Class.extend('SiteSubTree');SiteTree.prototype={initialize:function(){this.Tree.initialize();this.observeMethod('SelectionChanged',this.interruptLoading.bind(this));},destroy:function(){if(this.Tree)this.Tree.destroy();this.Tree=null;this.SiteSubTree=null;this.TreeAPI=null;this.selected=null;},interruptLoading:function(newLoadingNode){if(this.loadingNode)this.loadingNode.removeNodeClass('loading');this.loadingNode=newLoadingNode;}}
SiteTreeNode=Class.extend('TreeNode').extend('TreeNodeAPI');SiteTreeNode.prototype={initialize:function(options){this.TreeNode.initialize(options);if(this.className&&this.className.match(/ *([^ ]+)( +|$)/)){if((typeof siteTreeHints!='undefined')&&siteTreeHints[RegExp.$1]){this.hints=siteTreeHints[RegExp.$1];this.dropperOptions={accept:(this.hints.allowedChildren&&(this.className.indexOf('nochildren')==-1))?this.hints.allowedChildren:'none'};}}
if(this.className.indexOf('current')>-1){if(!this.tree.selected)this.tree.selected=[];this.tree.selected.push(this);}
if(!this.hints)this.hints={}},destroy:function(){if(this.TreeNode)this.TreeNode.destroy();this.TreeNode=null;this.TreeNodeAPI=null;},castAsTree:function(childUL){behaveAs(childUL,SiteSubTree,this.options);if(this.draggableObj)childUL.makeDraggable();},onselect:function(){this.selectTreeNode();return false;},onParentChanged:function(node,oldParent,newParent){if(newParent.id.match(/^record-new/)){alert("You must save the page before dragging children into it");return false;}
if(node==newParent||node.getIdx()==newParent.getIdx()){alert("You cannot add a page to itself");return false;}
if(node.innerHTML.toLowerCase().indexOf('<del')>-1){alert("You can't moved deleted pages");return false;}
if(Element.hasClassName(newParent,'nochildren')){alert("You can't add children to that node");return false;}
var currentlyOpenPageID=0;if($('Form_EditForm').elements.ID)currentlyOpenPageID=$('Form_EditForm').elements.ID.value;statusMessage(ss.i18n._t('CMSMAIN.SAVING'),'',true);new Ajax.Request(SiteTreeHandlers.parentChanged_url,{method:'post',postBody:'ID='+node.getIdx()+'&ParentID='+newParent.getIdx()+'&CurrentlyOpenPageID='+currentlyOpenPageID,onSuccess:Ajax.Evaluator,onFailure:function(response){errorMessage('error saving parent',response);}});return true;},onOrderChanged:function(nodeList,movedNode){statusMessage(ss.i18n._t('CMSMAIN.SAVING'),'',true);var i,parts=Array();sort=0;for(i=0;i<nodeList.length;i++){if(nodeList[i].getIdx&&nodeList[i].getIdx()){parts[parts.length]='ID[]='+nodeList[i].getIdx();if(nodeList[i].id.indexOf("record-new")==0)
if($('Form_EditForm_ID')&&('record-'+$('Form_EditForm_ID').value==nodeList[i].id))
if($('Form_EditForm_Sort'))
$('Form_EditForm_Sort').value=++sort;}}
if(movedNode.getIdx&&movedNode.getIdx()){parts[parts.length]='MovedNodeID='+movedNode.getIdx();}
var currentlyOpenPageID=0;if($('Form_EditForm').elements.ID)currentlyOpenPageID=$('Form_EditForm').elements.ID.value;if(parts){new Ajax.Request(SiteTreeHandlers.orderChanged_url,{method:'post',postBody:parts.join('&')+'&CurrentlyOpenPageID='+currentlyOpenPageID,onSuccess:Ajax.Evaluator,onFailure:function(response){errorMessage('error saving order',response);}});}
return true;}}
treeactions={toggleSelection:function(li){li=(li.tagName.toLowerCase()=='button')?li.parentNode:li;if(li.selected)this.closeSelection(li,true);else this.openSelection(li,true);fixHeight_left();return li.selected;},closeSelection:function(li,nested){li=(li.tagName.toLowerCase()=='button')?li.parentNode:li;Element.hide(_HANDLER_FORMS[li.id]);removeClass(li,'selected');li.selected=false;$(_HANDLER_FORMS[li.id]).notify('Close');if(li.onclose)li.onclose();if(typeof nested=='undefined')fixHeight_left();},openSelection:function(li,nested){li=(li.tagName.toLowerCase()=='button')?li.parentNode:li;addClass(li,'selected');Element.show(_HANDLER_FORMS[li.id]);li.selected=true;var i,set=li.parentNode.getElementsByTagName('li');for(i=0;i<set.length;i++)if(li!=set[i]&&set[i].selected){this.closeSelection(set[i],true);}
if(typeof nested=='undefined')fixHeight_left();}}
function fixHeight_left(){if($('treepanes')){fitToParent('treepanes');var st=$('treepanes');if(st.resize)st.resize();}
else fitToParent('sitetree_holder');}
SiteTree.applyTo('#sitetree');ReorganiseAction=Class.create();ReorganiseAction.applyTo('#sortitems');ReorganiseAction.prototype={initialize:function(){},onclick:function(){if($('sitetree').isDraggable==false){$('sitetree').makeDraggable();}else{$('sitetree').stopBeingDraggable();}}}
;
/****** FILE: cms/javascript/LeftAndMain_right.js *****/

CMSForm=Class.extend('ChangeTracker').extend('Observable');CMSForm.prototype={initialize:function(fn){this.ChangeTracker.initialize();this.formName=fn;this.prepareForm();},onsubmit:function(e){this.save();Event.stop(e);return false;},prepareForm:function(){ajaxActionsAtTop(this.id,'form_actions_'+this.formName,this.formName);},loadActionsFromString:function(actionHTML){var actionHolder=$('form_actions_'+this.formName);actionHolder.innerHTML=actionHTML;prepareAjaxActions(actionHolder,this.id,this.formName);},closeIfSetTo:function(id){if(this.elements.ID&&this.elements.ID.value==id){tinymce_removeAll();this.innerHTML="<p>"+ss.i18n._t('LeftAndMain.PAGEWASDELETED')+"</p>";}},reloadIfSetTo:function(id){if(this.elements.ID&&this.elements.ID.value==id){this.getPageFromServer(id);}},close:function(){this.innerHTML="<p>&#160;</p>";var actions;if(actions=$('form_actions_'+this.formName)){actions.parentNode.removeChild(actions);}},updateStatus:function(newStatus){if($('Form_EditForm_Status'))
$('Form_EditForm_Status').innerHTML="STATUS: "+newStatus;},loadNewPage:function(formContent,response,evalResponse){var rightHTML=formContent;rightHTML=rightHTML.replace(/(<a[^>]+href *= *")#/g,'$1'+window.location.href.replace(/#.*$/,'')+'#');rightHTML=rightHTML.replace(/(<iframe[^>]*src=")([^"]+)("[^>]*>)/g,'$1'+baseHref()+'$2$3');tinymce_removeAll();var i,allIframes=this.getElementsByTagName('iframe');if(allIframes)for(i=0;i<allIframes.length;i++){allIframes[i].contentWindow.location.href='about:blank';allIframes[i].parentNode.removeChild(allIframes[i]);}
if(response&&evalResponse){Ajax.Evaluator(response);}else{this.innerHTML=rightHTML;}
var attr;for(attr in{'action':true,'method':true,'enctype':true,'name':true}){if(this.elements['_form_'+attr]){this[attr]=this.elements['_form_'+attr].value;this.elements['_form_'+attr].parentNode.removeChild(this.elements['_form_'+attr]);}}
allIframes=this.getElementsByTagName('iframe');if(allIframes)for(i=0;i<allIframes.length;i++){try{allIframes[i].contentWindow.location.href=allIframes[i].src;}catch(er){alert('Error in LeftAndMain_right.js CMSForm.loadNewPage: '+er.message);}}
_TAB_DIVS_ON_PAGE=[];if(!evalResponse){if(this.prepareForm)this.prepareForm();Behaviour.apply(this);}
if(this.resetElements)this.resetElements();window.ontabschanged();if($('input#Form_EditForm_Title')&&$('input#Form_EditForm_Title').value.match(/^new/i)){$('input#Form_EditForm_Title').select();}},save:function(ifChanged,callAfter,action,publish){console.log(this.action);_AJAX_LOADING=true;if(typeof tinyMCE!='undefined')tinyMCE.triggerSave();if(!action)action="save";var __callAfter=callAfter;var __form=this;if(__form.notify&&__form.elements.ID!=undefined)__form.notify('BeforeSave',__form.elements.ID.value);if(this.validate&&!this.validate()){statusMessage("Validation failed.","bad");if($('Form_EditForm_action_save')&&$('Form_EditForm_action_save').stopLoading)$('Form_EditForm_action_save').stopLoading();return false;}
var success=function(response){Ajax.Evaluator(response);__form.resetElements();if(__callAfter)__callAfter();if(__form.notify&&__form.elements.ID!=undefined)__form.notify('PageSaved',__form.elements.ID.value);if($('Form_EditForm_action_save')&&$('Form_EditForm_action_save').stopLoading)$('Form_EditForm_action_save').stopLoading();_AJAX_LOADING=false;}
if(ifChanged){var data=this.serializeChangedFields('ID')+'&ajax=1&action_'+action+'=1';}else{var data=this.serializeAllFields()+'&ajax=1&action_'+action+'=1';}
if(publish)
{data+='&publish=1';}
statusMessage(ss.i18n._t('CMSMAIN.SAVING'),null,true);new Ajax.Request(this.action,{method:this.method,postBody:data,onSuccess:success,onFailure:function(response){errorMessage('Error saving content',response);if($('Form_EditForm_action_save')&&$('Form_EditForm_action_save').stopLoading)$('Form_EditForm_action_save').stopLoading();_AJAX_LOADING=false;}});},loadPage_url:'admin/getpage'}
CMSRightForm=Class.extend('CMSForm');CMSRightForm.prototype={intialize:function(){this.CMSForm.initialize('right');},loadURLFromServer:function(url){var urlParts=url.match(/ID=(\d+)/);var id=urlParts?urlParts[1]:null;if(!url.match(/^https?:\/\/.*/))
url=document.getElementsByTagName('base')[0].href+url;new Ajax.Request(url+'&ajax=1',{asynchronous:true,onSuccess:function(response){$('Form_EditForm').successfullyReceivedPage(response,id);},onFailure:function(response){alert(response.responseText);errorMessage('error loading page',response);}});},successfullyReceivedPage:function(response,pageID){var loadingNode=$('sitetree').loadingNode;if(loadingNode&&pageID&&parseInt($('sitetree').getIdxOf(loadingNode))!=pageID){return;}
document.body.style.cursor='wait';this.loadNewPage(response.responseText);var subform;if(subform=$('Form_MemberForm'))subform.close();if(subform=$('Form_SubForm'))subform.close();if(this.elements.ID){this.notify('PageLoaded',this.elements.ID.value);}
if(this.receivingID){var treeNode=loadingNode?loadingNode:$('sitetree').getTreeNodeByIdx(this.receivingID);if(treeNode){$('sitetree').setCurrentByIdx(treeNode.getIdx());treeNode.removeNodeClass('loading');}
statusMessage('');}
document.body.style.cursor='default';},didntReceivePage:function(response){errorMessage('error loading page',response);$('sitetree').getTreeNodeByIdx(this.elements.ID.value).removeNodeClass('loading');},getPageFromServer:function(id,treeNode){if(id&&(id=='root'||parseInt(id)==id||(id.substr&&id.substr(0,3)=='new'))){this.receivingID=id;if(!treeNode)treeNode=$('sitetree').getTreeNodeByIdx(id);if(treeNode){$('sitetree').loadingNode=treeNode;treeNode.addNodeClass('loading');url=treeNode.aTag.href+(treeNode.aTag.href.indexOf('?')==-1?'?':'&')+'ajax=1';}
if(SiteTreeHandlers.loadPage_url){var sep=(SiteTreeHandlers.loadPage_url.indexOf('?')==-1)?'?':'&';url=SiteTreeHandlers.loadPage_url+sep+'ID='+id;}
var lang=$('LangSelector')?$F('LangSelector'):null;if(lang){url+='&locale='+lang;}
statusMessage("loading...");this.loadURLFromServer(url);}else{throw("getPageFromServer: Bad page ID: "+id);}}}
CMSForm.applyTo('#Form_SubForm');CMSRightForm.applyTo('#Form_EditForm','right');function action_save_right(){_AJAX_LOADING=true;$('Form_EditForm_action_save').value=ss.i18n._t('CMSMAIN.SAVING');$('Form_EditForm_action_save').className='action loading';$('Form_EditForm_action_save').stopLoading=function(){if($('Form_EditForm_action_save')&&$('Form_EditForm_action_save').className.indexOf('loading')!=-1){$('Form_EditForm_action_save').value='Save';Element.removeClassName($('Form_EditForm_action_save'),'loading');}}
$('Form_EditForm').save(false);}
function autoSave(confirmation,callAfter){if(typeof tinyMCE!='undefined')tinyMCE.triggerSave();var __forms=[]
if($('Form_EditForm'))__forms.push($('Form_EditForm'));if($('Form_SubForm'))__forms.push($('Form_SubForm'));if($('Form_MemberForm'))__forms.push($('Form_MemberForm'));var __somethingHasChanged=false;var __callAfter=callAfter;__forms.each(function(form){if(form.isChanged&&form.isChanged()){__somethingHasChanged=true;}});if(__somethingHasChanged){var options={save:function(){statusMessage(ss.i18n._t('CMSMAIN.SAVING'),'',true);var i;for(i=0;i<__forms.length;i++){if(__forms[i].isChanged&&__forms[i].isChanged()){if(i==0)__forms[i].save(true,__callAfter);else __forms[i].save(true);}}},discard:function(){__forms.each(function(form){form.resetElements(false);});if(__callAfter)__callAfter();},cancel:function(){}}
if(confirmation){if(confirm(ss.i18n._t('LeftAndMain.CONFIRMUNSAVED')))
{if(__callAfter)__callAfter();}else{return false;}}else{options.save();}}else{if(__callAfter)__callAfter();}}
StageLink=Class.create();StageLink.prototype={initialize:function(getVars,urlField){this.getVars=getVars;this.urlField=urlField;var boundNewPage=this.newPage.bind(this);$('Form_EditForm').observeMethod('PageLoaded',boundNewPage);$('Form_EditForm').observeMethod('PageSaved',boundNewPage);$('Form_EditForm').observeMethod('PagePublished',boundNewPage);$('Form_EditForm').observeMethod('PageUnpublished',boundNewPage);this.newPage();},newPage:function(){var linkField=$('Form_EditForm').elements[this.urlField];var linkVal=linkField?linkField.value:null;if(linkVal){if(this.id!='viewArchivedSite')this.style.display='';this.href=linkVal+this.getVars;}else{if(this.id!='viewArchivedSite')this.style.display='none';}
if($('Form_EditForm_Locale')){this.href+="&locale="+$('Form_EditForm_Locale').value;}},onclick:function(){var w=window.open(this.href,windowName('site'));w.focus();return false;},baseURL:function(){return document.getElementsByTagName('base')[0].href;}}
StageLink.applyTo('#viewStageSite','?stage=Stage','StageURLSegment');StageLink.applyTo('#viewLiveSite','?stage=Live','LiveURLSegment');StageLink.applyTo('#viewArchivedSite','','URLSegment');window.name=windowName('cms');function windowName(suffix){var base=document.getElementsByTagName('base')[0].href.replace('~','').replace('http://','').replace(/\//g,'_').replace(/\./g,'_');return base+suffix;}
function tinymce_removeAll(){if((typeof tinymce!='undefined')&&tinymce.EditorManager){var id;for(id in tinymce.EditorManager.editors){tinymce.EditorManager.editors[id].remove();}
tinymce.EditorManager.editors={};}}
;
/****** FILE: jsparty/tree/tree.js *****/

Function.prototype.create=function(item,arg1,arg2,arg3,arg4,arg5,arg6){return behaveAs(item,this,arg1,arg2,arg3,arg4,arg5,arg6);}
Tree=Class.create();Tree.prototype={initialize:function(options){this.isDraggable=false;var i,li;this.options=options?options:{};if(!this.options.tree)this.options.tree=this;this.tree=this.options.tree;if(this==this.tree)Observable.applyTo(this);for(i=0;i<this.childNodes.length;i++){if(this.childNodes[i].tagName&&this.childNodes[i].tagName.toLowerCase()=='li'&&!(this.childNodes[i].childNodes[0]&&this.childNodes[i].childNodes[0].attributes&&this.childNodes[i].childNodes[0].attributes["class"]&&this.childNodes[i].childNodes[0].attributes["class"]=="a")){li=this.childNodes[i];this.castAsTreeNode(li);while(this.childNodes[i].tagName.toLowerCase()!="li")i++;}}
this.className=this.className.replace(/ ?unformatted ?/,' ');if(li){li.addNodeClass('last');if(this.parentNode.tagName.toLowerCase()=="li"){this.treeNode=this.parentNode;}
return true;}else{return false;}},destroy:function(){this.tree=null;this.treeNode=null;if(this.options)this.options.tree=null;this.options=null;},castAsTreeNode:function(li){behaveAs(li,TreeNode,this.options);},getIdxOf:function(el){if(!el.treeNode)el.treeNode=el;if(el.treeNode.id.match(/^selector-([^-]+)-([0-9]+)$/))return RegExp.$2;if(el.treeNode.id.match(/([^-]+)-(.+)$/))return RegExp.$1;else return el.treeNode.id;},childTreeNodes:function(){var i,item,children=[];for(i=0;item=this.childNodes[i];i++){if(item.tagName&&item.tagName.toLowerCase()=='li')children.push(item);}
return children;},hasChildren:function(){return this.childTreeNodes().length>0;},makeDraggable:function(){this.isDraggable=true;var i,item,x;var trees=this.getElementsByTagName('ul');for(x in DraggableTree.prototype)this[x]=DraggableTree.prototype[x];DraggableTree.prototype.setUpDragability.apply(this);var nodes=this.getElementsByTagName('li');for(i=0;item=nodes[i];i++){for(x in DraggableTreeNode.prototype)item[x]=DraggableTreeNode.prototype[x];}
for(i=0;item=trees[i];i++){for(x in DraggableTree.prototype)item[x]=DraggableTree.prototype[x];}
for(i=0;item=nodes[i];i++){DraggableTreeNode.prototype.setUpDragability.apply(item);}
for(i=0;item=trees[i];i++){DraggableTree.prototype.setUpDragability.apply(item);}},appendTreeNode:function(child,before){if(child.parentTreeNode){var oldParent=child.parentTreeNode;oldParent.removeTreeNode(child);}
var lastNode,i,holder=this;if(lastNode=this.lastTreeNode())lastNode.removeNodeClass('last');if(before){child.removeNodeClass('last');if(holder!=before.parentNode){throw("TreeNode.appendTreeNode: 'before' not contained within the holder");holder.appendChild(child);}else{holder.insertBefore(child,before);}}else{holder.appendChild(child);}
if(this.parentNode&&this.parentNode.fixDragHelperDivs)this.parentNode.fixDragHelperDivs();if(oldParent&&oldParent.fixDragHelperDivs)oldParent.fixDragHelperDivs();if(this.parentNode&&this.parentNode.tagName.toLowerCase()=='li'){if(this.parentNode.className.indexOf('closed')==-1)this.parentNode.addNodeClass('children');this.lastTreeNode().addNodeClass('last');}
if(this.parentNode.tagName.toLowerCase()=='li')child.parentTreeNode=this.parentNode;else child.parentTreeNode=null;if(this.isDraggable){for(x in DraggableTreeNode.prototype)child[x]=DraggableTreeNode.prototype[x];DraggableTreeNode.prototype.setUpDragability.apply(child);}},lastTreeNode:function(){var i,holder=this;for(i=holder.childNodes.length-1;i>=0;i--){if(holder.childNodes[i].tagName&&holder.childNodes[i].tagName.toLowerCase()=='li')return holder.childNodes[i];}},removeTreeNode:function(child){var holder=this;try{holder.removeChild(child);}catch(er){}
var i,hasChildren=false;for(i=0;i<holder.childNodes.length;i++){if(holder.childNodes[i].tagName&&holder.childNodes[i].tagName.toLowerCase()=="li"){hasChildren=true;break;}}
if(!hasChildren)this.removeNodeClass('children');else this.lastTreeNode().addNodeClass('last');if(child.parentTreeNode==this.parentNode){child.parentTreeNode=null;}},open:function(){},expose:function(){},addNodeClass:function(className){if(this.parentNode.tagName.toLowerCase()=='li')
this.parentNode.addNodeClass(className);},removeNodeClass:function(className){if(this.parentNode.tagName.toLowerCase()=='li')
this.parentNode.removeNodeClass(className);}}
TreeNode=Class.create();TreeNode.prototype={initialize:function(options){var spanA,spanB,spanC;var startingPoint,stoppingPoint,childUL;var j;var li=this;this.options=options?options:{};this.tree=this.options.tree;if(!this.ajaxExpansion&&this.options.ajaxExpansion)
this.ajaxExpansion=this.options.ajaxExpansion;if(this.options.getIdx)
this.getIdx=this.options.getIdx;if(this.id&&this.id.match(/([^-]+)-(.+)$/))
this.recordID=RegExp.$1;spanA=document.createElement('span');spanB=document.createElement('span');spanC=document.createElement('span');spanA.appendChild(spanB);spanB.appendChild(spanC);spanA.className='a '+li.className.replace('closed','spanClosed');spanB.className='b';spanB.onclick=TreeNode_bSpan_onclick;spanC.className='c';this.castAsSpanA(spanA);if(li.hasChildren()&&li.className.indexOf('current')>-1){li.className=li.className+' children';spanA.className=spanA.className+' children';}
stoppingPoint=li.childNodes.length;startingPoint=0;childUL=null;for(j=0;j<li.childNodes.length;j++){if(li.childNodes[j].tagName&&li.childNodes[j].tagName.toLowerCase()=='ul'){childUL=li.childNodes[j];stoppingPoint=j;break;}}
for(j=startingPoint;j<stoppingPoint;j++){spanC.appendChild(li.childNodes[startingPoint]);}
if(li.childNodes.length>startingPoint)li.insertBefore(spanA,li.childNodes[startingPoint]);else li.appendChild(spanA);if(li.parentNode&&li.parentNode.parentNode&&li.parentNode.parentNode.tagName.toLowerCase()=='li'){li.parentTreeNode=li.parentNode.parentNode;}
li.aSpan=spanA;li.bSpan=spanB;li.cSpan=spanC;li.treeNode=spanA.treeNode=spanB.treeNode=spanC.treeNode=li;var aTag=spanC.getElementsByTagName('a')[0];if(aTag){aTag.treeNode=li;li.aTag=aTag;}else{throw("Tree creation: A tree needs <a> tags inside the <li>s to work properly.");}
aTag.onclick=TreeNode_aTag_onclick.bindAsEventListener(aTag);if(childUL!=null){if(this.castAsTree(childUL)){if(this.className.indexOf('closed')==-1){this.addNodeClass('children');}}}else{this.removeNodeClass('closed');}
this.setIconByClass();},destroy:function(){this.tree=null;this.treeNode=null;this.parentTreeNode=null;if(this.options)this.options.tree=null;this.options=null;if(this.aTag){this.aTag.treeNode=null;this.aTag.onclick=null;}
if(this.aSpan){this.aSpan.treeNode=null;this.aSpan.onmouseover=null;this.aSpan.onmouseout=null;}
if(this.bSpan){this.bSpan.treeNode=null;this.bSpan.onclick=null;}
if(this.cSpan)this.cSpan.treeNode=null;this.aSpan=null;this.bSpan=null;this.cSpan=null;this.aTag=null;},castAsSpanA:function(spanA){var x;for(x in TreeNode_SpanA)spanA[x]=TreeNode_SpanA[x];},castAsTree:function(childUL){return behaveAs(childUL,Tree,this.options);},toggle:function(force){if(this.treeNode.wasDragged||this.treeNode.anchorWasClicked){this.treeNode.wasDragged=false;this.treeNode.anchorWasClicked=false;return;}
if(this.hasChildren()||this.className.match(/(^| )unexpanded($| )/)){if(this.className.match(/(^| )closed($| )/)||this.className.match(/(^| )unexpanded($| )/))this.open();else this.close();}},open:function(){if(this.className.indexOf('unexpanded')!=-1){if(this.ajaxExpansion)this.ajaxExpansion();}
if(!this.className.match(/(^| )closed($| )/))return;this.removeNodeClass('closed');},close:function(){this.addNodeClass('closed');},expose:function(){if(this.parentTreeNode){this.parentTreeNode.open();this.parentTreeNode.expose();}},setIconByClass:function(){if(typeof _TREE_ICONS=='undefined')return;var classes=this.className.split(/\s+/);var obj=this;classes.each(function(className){if(_TREE_ICONS[className]){obj.fileIcon=_TREE_ICONS[className].fileIcon;obj.openFolderIcon=_TREE_ICONS[className].openFolderIcon;obj.closedFolderIcon=_TREE_ICONS[className].closedFolderIcon;throw $break;}else if(className=="Page"){obj.fileIcon=null;obj.openFolderIcon=null;obj.closedFolderIcon=null;}});this.updateIcon();},updateIcon:function(){var icon;if(this.closedFolderIcon&&this.className.indexOf('closed')!=-1){icon=this.closedFolderIcon;}else if(this.openFolderIcon&&this.className.indexOf('children')!=-1){icon=this.openFolderIcon;}else if(this.fileIcon){icon=this.fileIcon;}
if(icon)this.aTag.style.background="url("+icon+") no-repeat";else this.aTag.style.backgroundImage="";},appendTreeNode:function(child,before){this.treeNodeHolder().appendTreeNode(child,before);},treeNodeHolder:function(performCast){if(performCast==null)performCast=true;var uls=this.getElementsByTagName('ul');if(uls.length>0)return uls[0];else{var ul=document.createElement('ul');this.appendChild(ul);if(performCast)this.castAsTree(ul);return ul;}},hasChildren:function(){var uls=this.getElementsByTagName('ul');if(uls.length>0){var i,item;for(i=0;item=uls[0].childNodes[i];i++){if(item.tagName&&item.tagName.toLowerCase()=='li')return true;}}
return false;},removeTreeNode:function(child){var holder=this.treeNodeHolder();try{holder.removeChild(child);}catch(er){}
var i,hasChildren=false;for(i=0;i<holder.childNodes.length;i++){if(holder.childNodes[i].tagName&&holder.childNodes[i].tagName.toLowerCase()=="li"){hasChildren=true;break;}}
if(!hasChildren)this.removeNodeClass('children');else this.lastTreeNode().addNodeClass('last');child.parentTreeNode=null;},lastTreeNode:function(){return this.treeNodeHolder().lastTreeNode();},firstTreeNode:function(){var i,holder=this.treeNodeHolder();for(i=0;i<holder.childNodes.length;i++){if(holder.childNodes[i].tagName&&holder.childNodes[i].tagName.toLowerCase()=='li')return holder.childNodes[i];}},addNodeClass:function(className){if(Element&&Element.addClassName){Element.addClassName(this,className);if(className=='closed')Element.removeClassName(this,'children');this.aSpan.className='a '+this.className.replace('closed','spanClosed');if(className=='children'||className=='closed')this.updateIcon();}},removeNodeClass:function(className){if(Element&&Element.removeClassName){Element.removeClassName(this,className);if(className=='closed'&&this.hasChildren())Element.addClassName(this,'children');this.aSpan.className='a '+this.className.replace('closed','spanClosed');if(className=='children'||className=='closed')this.updateIcon();}},getIdx:function(){if(this.id.match(/([^-]+)-(.+)$/))return RegExp.$2;else return this.id;},getTitle:function(){return this.aTag.innerHTML;},installSubtree:function(response){var ul=this.treeNodeHolder(false);ul.innerHTML=response.responseText;ul.appendTreeNode=null;this.castAsTree(ul);if(ul.cuedNewNodes){var i;for(i=0;i<ul.cuedNewNodes.length;i++){ul.appendTreeNode(ul.cuedNewNodes[i]);}
ul.cuedNewNodes=null;}
this.removeNodeClass('closed');this.addNodeClass('children');this.removeNodeClass('loading');this.removeNodeClass('unexpanded');}}
function treeCloseAll(){var candidates=document.getElementsByTagName('li');for(var i=0;i<candidates.length;i++){var aSpan=candidates[i].childNodes[0];if(aSpan.childNodes[0]&&aSpan.childNodes[0].className=="b"){if(!aSpan.className.match(/spanClosed/)&&candidates[i].id!='record-0'){aSpan.childNodes[0].onclick();}}}}
function treeOpenAll(){var candidates=document.getElementsByTagName('li');for(var i=0;i<candidates.length;i++){var aSpan=candidates[i].childNodes[0];if(aSpan.childNodes[0]&&aSpan.childNodes[0].className=="b"){if(aSpan.className.match(/spanClosed/)){aSpan.childNodes[0].onclick();}}}}
TreeNode_aTag_onclick=function(event){Event.stop(event);if(!this.treeNode.tree||this.treeNode.tree.notify('NodeClicked',this.treeNode)){if(this.treeNode.options.onselect){return this.treeNode.options.onselect.apply(this.treeNode,[event]);}else if(this.treeNode.onselect){return this.treeNode.onselect();}}
return false;}
TreeNode_bSpan_onclick=function(){this.treeNode.toggle();};TreeNode_SpanA={onmouseover:function(event){this.parentNode.addNodeClass('over');},onmouseout:function(event){this.parentNode.removeNodeClass('over');}}
DraggableTree=Class.extend('Tree');DraggableTree.prototype={initialize:function(options){this.Tree.initialize(options);this.setUpDragability();},setUpDragability:function(){this.isDraggable=true;this.allDragHelpers=[];if(this.parentNode.tagName.toLowerCase()=="li"){this.treeNode=this.parentNode;if(this.treeNode.hasChildren()){this.treeNode.createDragHelper();}}},stopBeingDraggable:function(){this.isDraggable=false;var i,item,nodes=this.getElementsByTagName('li');for(i=0;item=nodes[i];i++){item.destroyDraggable();}
for(i=0;item=this.allDragHelpers[i];i++){Droppables.remove(item);if(item.parentNode){item.parentNode.removeChild(item);}}
this.allDragHelpers=[];},castAsTreeNode:function(li){behaveAs(li,DraggableTreeNode,this.options);}}
DraggableTreeNode=Class.extend('TreeNode');DraggableTreeNode.prototype={initialize:function(options){this.TreeNode.initialize(options);this.setUpDragability();},setUpDragability:function(){this.draggableObj=new Draggable(this,TreeNodeDragger);Droppables.add(this.aTag,this.dropperOptions?Object.extend(this.dropperOptions,TreeNodeDropper):TreeNodeDropper);if(this.parentTreeNode&&this.parentTreeNode.createDragHelper){this.parentTreeNode.createDragHelper(this);}
if(this.hasChildren()&&this.parentNode.tagName.toLowerCase()=="li"){this.treeNode=this.parentNode;}
this.aTag._onclick_before_draggable=this.aTag.onclick;this.aTag.baseClick=this.aTag.onclick;this.aTag.onclick=this.aTagOnClick.bindAsEventListener(this.aTag);if(this.options.onParentChanged)this.onParentChanged=this.options.onParentChanged;if(this.options.onOrderChanged)this.onOrderChanged=this.options.onOrderChanged;},aTagOnClick:function(event){if(this.treeNode.wasDragged){Event.stop(event);return false;}else{this.treeNode.anchorWasClicked=true;this.treeNode.wasDragged=false;return this.baseClick(event);}},destroyDraggable:function(){Droppables.remove(this.aTag);this.aTag.onclick=this.aTag._onclick_before_draggable;if(this.draggableObj){this.draggableObj.destroy();this.draggableObj=null;}},fixDragHelperDivs:function(){var i,holder=this.treeNodeHolder();var lastDiv,expecting="div";for(i=0;i<holder.childNodes.length;i++){if(holder.childNodes[i].tagName){if(holder.childNodes[i].tagName.toLowerCase()=="div")lastDiv=holder.childNodes[i];if(expecting!=holder.childNodes[i].tagName.toLowerCase()){if(expecting=="div"){this.createDragHelper(holder.childNodes[i]);}else{holder.removeChild(holder.childNodes[i]);}
i--;}else{expecting=(expecting=="div")?"li":"div";}}}
if(expecting=="div")this.createDragHelper();},createDragHelper:function(before){var droppable=document.createElement('div');droppable.className="droppable";droppable.treeNode=this;this.dragHelper=droppable;this.tree.allDragHelpers[this.tree.allDragHelpers.length]=this.dragHelper;var holder=this.treeNodeHolder();if(before)holder.insertBefore(droppable,before);else holder.appendChild(droppable);var customOptions=holder.parentNode.dropperOptions?Object.extend(holder.parentNode.dropperOptions,TreeNodeSeparatorDropper):TreeNodeSeparatorDropper;if(!customOptions.accept!='none'){if(Droppables)Droppables.add(droppable,customOptions);}}}
TreeNodeDragger={onStartDrag:function(dragger){dragger.oldParent=dragger.parentTreeNode;},revert:true}
TreeNodeDropper={onDrop:function(dragger,dropper,event){var result=true;if(dragger.onParentChanged&&dragger.parentTreeNode!=dropper.treeNode)
result=dragger.onParentChanged(dragger,dragger.parentTreeNode,dropper.treeNode);var i=0,item=null,items=[];items[items.length]=dragger.treeNode;for(i=0;item=dropper.treeNode.treeNodeHolder().childNodes[i];i++){if(item!=dragger.treeNode)items[items.length]=item;}
if(result&&dragger.onOrderChanged)
result=dragger.onOrderChanged(items,items[0]);if(result){dropper.treeNode.appendTreeNode(dragger.treeNode,dropper.treeNode.firstTreeNode());}
dragger.wasDragged=true;},hoverclass:'dragOver',checkDroppableIsntContained:true}
TreeNodeSeparatorDropper={onDrop:function(dragger,dropper,event){var result=true;if(dragger.onParentChanged&&dragger.parentTreeNode!=dropper.treeNode)
result=dragger.onParentChanged(dragger,dragger.parentTreeNode,dropper.treeNode);var i=0,item=null,items=[];for(i=0;item=dropper.treeNode.treeNodeHolder().childNodes[i];i++){if(item==dropper)items[items.length]=dragger.treeNode;if(item!=dragger.treeNode)items[items.length]=item;}
if(result&&dragger.onOrderChanged)
result=dragger.onOrderChanged(items,dragger.treeNode);if(result){dropper.treeNode.appendTreeNode(dragger.treeNode,dropper);}
dragger.wasDragged=true;},hoverclass:'dragOver',greedy:true,checkDroppableIsntContained:true}
MultiselectTree=Class.create();MultiselectTree.prototype={initialize:function(){Element.addClassName(this,'multiselect');this.MultiselectTree_observer=this.observeMethod('NodeClicked',this.multiselect_handleSelectionChange.bind(this));this.selectedNodes={}},destroyDraggable:function(){this.stopObserving(this.MultiselectTree_observer);},multiselect_handleSelectionChange:function(selectedNode){var idx=this.getIdxOf(selectedNode);if(selectedNode.selected){selectedNode.removeNodeClass('selected');selectedNode.selected=false;delete this.selectedNodes[idx];}else{selectedNode.addNodeClass('selected');selectedNode.selected=true;this.selectedNodes[idx]=selectedNode.aTag.innerHTML;}
return false;}}
function findChildWithTag(el,tag){for(var i=0;i<el.childNodes.length;i++){if(el.childNodes[i].tagName!=null&&el.childNodes[i].tagName.toLowerCase()==tag)return el.childNodes[i];}
return null;}
;
/****** FILE: jsparty/tabstrip/tabstrip.js *****/

jQuery('ul.tabstrip').livequery(function(){initTabstrip(this);window.ontabschanged();});var _CUR_TABS=[];var _TABS_ON_PAGE=[];var _TAB_DIVS_ON_PAGE=[];function initTabstrip(tabstrip,namedAnchors){var i,anchor,container,anchorName,li;var childAnchors=tabstrip.getElementsByTagName('a');var base,curTab=null,curURL=window.location.href;var previousTab=null;var firstTab,foundATab=false;var curQuery=window.location.search;if(curURL.indexOf('#')==-1){base=curURL.length-curQuery.length;}else{base=curURL.indexOf('#')-curQuery.length;curTab=curURL.substr(curURL.indexOf('#')+1);}
if(_CUR_TABS[tabstrip.parentNode.id]&&$(_CUR_TABS[tabstrip.parentNode.id])){curTab=_CUR_TABS[tabstrip.parentNode.id];}else{for(i=0;i<childAnchors.length;i++){var child=childAnchors[i];var anchorPos=child.href.indexOf('#');if(anchorPos!=-1){anchorName=child.href.substr(anchorPos+1);if(firstTab==null)firstTab=anchorName;if(anchorName==curTab)foundATab=true;}}
if(!foundATab)curTab=firstTab;}
_CUR_TABS[tabstrip.parentNode.id]=curTab;for(i=0;i<childAnchors.length;i++){var anchorBase=childAnchors[i].href.indexOf('#');if(anchorBase!=-1){anchorName=childAnchors[i].href.substr(anchorBase+1);li=childAnchors[i].parentNode;container=document.getElementById(anchorName);if(container)tabstrip_initTab(childAnchors[i],anchorName,tabstrip,container);if(previousTab){previousTab.nextTab=li;li.previousTab=previousTab;}
previousTab=li;if(curTab&&anchorName==curTab){tabstrip.currentlyShowing=li;addClass(li,'current');if(container){container.style.display='';}}else{if(container)container.style.display='none';}}}
if($('Form_EditForm')){var divs=$('Form_EditForm').getElementsByTagName('div');}else{var divs=document.getElementsBySelector('form div');}
for(i=0;i<divs.length;i++){if((Element.hasClassName(divs[i],'tab')||Element.hasClassName(divs[i],'tabset'))){_TAB_DIVS_ON_PAGE.push(divs[i]);}}
tabstrip.openNextTab=tabstrip_openNextTab;tabstrip.openPreviousTab=tabstrip_openPreviousTab;if(Class&&Class.registerForDestruction){tabstrip.destroy=tabstrip_destroy;Class.registerForDestruction(tabstrip);}}
function tabstrip_destroy(){this.currentlyShowing=null;_CUR_TABS=null;var childAnchors=this.getElementsByTagName('a');var i,a,li;for(i=0;a=childAnchors[i];i++){a.onclick=null;li=a.parentNode;li.onclick=null;li.onmouseover=null;li.onmouseout=null;li.tabstrip=null;li.previousTab=null;li.nextTab=null;if(li.container){li.container.ownerTab=null;li.container=null;}}}
function tabstrip_initTab(a,anchorName,tabstrip,container){a.onclick=tabstrip_showTab;a.onclick=a.onclick.bindAsEventListener(a);a.openTab=tabstrip_showTab;li=a.parentNode;li.container=container;li.anchorName=anchorName;li.tabstrip=tabstrip;li.onclick=li.openTab=tabstrip_showTab;li.onmouseover=tabstrip_mouseOver;li.onmouseout=tabstrip_mouseOut;_TABS_ON_PAGE[anchorName]=li;container.ownerTab=li;}
function openTab(anchorName){if(typeof anchorName!='string')
return;var tabNames=anchorName.split('set');if(tabNames.length>1)
anchorName=tabNames.shift()+'set';while(anchorName){if(_TABS_ON_PAGE[anchorName])_TABS_ON_PAGE[anchorName].openTab(_TABS_ON_PAGE[anchorName].getElementsByTagName('a')[0]);if(tabNames.length==0)
anchorName=null;else{anchorName=anchorName+tabNames.shift()+'set';}}}
function findParentForm(el){var ownerForm=el.parentNode,tn;while((tn=ownerForm.tagName.toLowerCase())!="body"&&tn!="form"){ownerForm=ownerForm.parentNode;}
if(tn=="form")return ownerForm;else return null;}
function tabstrip_showTab(evt){if(this.tagName.toLowerCase()=="a")var el=this.parentNode;else el=this;_CUR_TABS[el.tabstrip.parentNode.id]=el.container.id;if(el.tabstrip.currentlyShowing&&el.tabstrip.currentlyShowing.container&&el.tabstrip.currentlyShowing!=el){el.tabstrip.currentlyShowing.container.style.display='none';removeClass(el.tabstrip.currentlyShowing.container,'current');removeClass(el.tabstrip.currentlyShowing,'current');}
var container=document.getElementById(el.container.id);if(container&&container.style.display=='none'){container.style.display='block';addClass(container,'current');}
addClass(el,'current');el.tabstrip.currentlyShowing=el;setHashLink(el.anchorName);if(evt!='init'){if(window.ontabschanged)window.ontabschanged();else if(window.onresize)window.onresize();}
return false;}
function setHashLink(hashLink){return;var preserveScroll=preserveScrollPosition(hashLink);if(navigator.userAgent.indexOf("Mac")>-1&&navigator.userAgent.indexOf("MSIE")>-1)
return;if(window.location.href.indexOf('#')==-1)
window.location.href+='#'+hashLink;else
window.location.href=window.location.href.replace(/#.*$/,'#'+hashLink);if(typeof preserveScroll!='undefined')
restoreScrollPosition(preserveScroll);}
function preserveScrollPosition(hashLink){var el=document.getElementById(hashLink);var preserved=[];while(el){preserved[preserved.length]=el;el.oldScroll=el.scrollTop;if(el.tagName&&el.tagName.toLowerCase()=="body")break;el=el.parentNode;}
return preserved;}
function restoreScrollPosition(preserved){var i;for(i=0;i<preserved.length;i++){preserved[i].scrollTop=preserved[i].oldScroll;delete preserved[i].oldScroll;}}
function tabstrip_mouseOver(){if(self.addClass)addClass(this,'over');}
function tabstrip_mouseOut(){if(self.removeClass)removeClass(this,'over');}
function tabstrip_openNextTab(){if(this.currentlyShowing&&this.currentlyShowing.nextTab)
this.currentlyShowing.nextTab.onclick();}
function tabstrip_openPreviousTab(){if(this.currentlyShowing&&this.currentlyShowing.previousTab)
this.currentlyShowing.previousTab.onclick();}
;
/****** FILE: cms/javascript/TinyMCEImageEnhancement.js *****/

TinyMCEImageEnhancement=Class.create();TinyMCEImageEnhancement.prototype={initialize:function(){this.filesUploaded=0;this.processInProgress=false;Event.observe(window,'load',this.onWindowLoad.bind(this));},addListeners:function(){$('Form_EditorToolbarImageForm_FolderID').value="";Event.observe($('AddFolder'),'click',this.onAddFolder.bind(this));Event.observe($('FolderOk'),'click',this.onFolderOk.bind(this));Event.observe($('FolderCancel'),'click',this.onFolderCancel.bind(this));Event.observe($('UploadFiles'),'click',this.onUpload.bind(this));},addElement:function(tag,className,parent,properties){var e=document.createElement(tag);Element.addClassName(e,className);parent.appendChild(e);Object.extend(e,properties);return e;},onUpload:function(event){Event.stop(event);if(!this.processInProgress){if(this.getParentID()!='root'){this.upload.browse();}else{statusMessage("Please choose folder","bad");}}},onAddFolder:function(event){Event.stop(event);Element.hide('AddFolder');Element.show('NewFolderName','FolderOk','FolderCancel');this.applyIE6Hack();},onFolderOk:function(event){Event.stop(event);var folderName=$('NewFolderName').value;var options={method:'post',postBody:'ParentID='+this.getParentID()+'&ajax=1&returnID=1&Name='+folderName+($('SecurityID')?'&SecurityID='+$('SecurityID').value:''),onSuccess:this.onFolderGetSuccess.bind(this),onFailure:function(transport){errorMessage('Error: Folder not added',transport);}};new Ajax.Request('admin/assets/addfolder',options);},onFolderGetSuccess:function(transport){var folderID=transport.responseText;var date=new Date();var year=date.getFullYear();var month=date.getMonth()<10?'0'+date.getMonth():date.getMonth();var day=date.getDay()<10?'0'+date.getDay():date.getDay();var hours=date.getHours()<10?'0'+date.getHours():date.getHours();var minutes=date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes();var seconds=date.getSeconds()<10==1?'0'+date.getSeconds():date.getSeconds();var currentDate=year+'-'+month+'-'+day+' '+hours+':'+minutes+':'+seconds;var folderName=$('NewFolderName').value;this.folderID=folderID;statusMessage('Creating new folder');$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').itemTree=null;$('TreeDropdownField_Form_EditorToolbarImageForm_FolderID').setValue(this.folderID);$('NewFolderName').value='';Element.show('AddFolder');Element.hide('NewFolderName','FolderOk','FolderCancel');this.removeIE6Hack();},onFolderCancel:function(event){$('NewFolderName').value='';Element.show('AddFolder');Element.hide('NewFolderName','FolderOk','FolderCancel');this.removeIE6Hack();Event.stop(event);return false;},onWindowLoad:function(){pv=getFlashPlayerVersion();if(pv.major<9||pv.major>9||(pv.major==9&&pv.minor==0&&pv.rev<64)){if($('AddFolderGroup'))$('AddFolderGroup').style.display='none';if($('PipeSeparator'))$('PipeSeparator').style.display='none';if($('UploadGroup'))$('UploadGroup').style.display='none';return;}
if($('FolderID')!=null){if($('SecurityID'))var securityid=$('SecurityID').value;else var securityid=null;this.upload=new Upload({fileTypes:'*.jpeg;*.jpg;*.jpe;*.png;*.gif;',fileTypesDescription:'Image files',fileUploadLimit:'100',securityID:securityid,beginUploadOnQueue:true,buildUI:this.addListeners.bind(this),fileQueued:this.uploadFileQueuedCallback.bind(this),fileComplete:this.uploadFileCompleteCallback.bind(this),queueComplete:this.uploadQueueCompleteCallback.bind(this)});}},uploadFileQueuedCallback:function(file,queueLength){this.processInProgress=true;this.upload.setFolderID(this.getParentID());$('UploadFiles').innerHTML="Uploading ... 1/"+this.upload.getFilesToUpload();this.upload.startUpload();},uploadFileCompleteCallback:function(file,serverData){Element.addClassName($('UploadFiles'),'link');$('UploadFiles').innerHTML='Uploading ... '+this.upload.getFilesUploaded()+"/"+this.upload.getFilesToUpload();},uploadQueueCompleteCallback:function(){this.filesUploaded=this.upload.getFilesUploaded();$('UploadFiles').innerHTML="upload";statusMessage('Uploaded '+this.upload.getFilesUploaded()+' files','good');if(this.getParentID()!='root'){$('Image').ajaxGetFiles(this.getParentID(),null,this.insertImages.bind(this));}},insertImages:function(transport){if(transport.responseText==''){$('Image').ajaxGetFiles(this.getParentID(),null,this.insertImages.bind(this));return;}
$('Image').reapplyBehaviour();this.addToTinyMCE=this.addToTinyMCE.bind(this);this.processInProgress=false;},addToTinyMCE:function(target){var formObj=$('Form_EditorToolbarImageForm');var altText=formObj.elements.AltText.value;var cssClass=formObj.elements.CSSClass.value;var baseURL=document.getElementsByTagName('base')[0].href;var relativeHref=target.href.substr(baseURL.length)
if(!tinyMCE.selectedInstance)tinyMCE.selectedInstance=Toolbar.instance().editor;if(tinyMCE.selectedInstance.contentWindow.focus)tinyMCE.selectedInstance.contentWindow.focus();var destWidth=null;var destHeight=null;try{var imgTag=target.getElementsByTagName('img')[0];destWidth=imgTag.className.match(/destwidth=([0-9.\-]+)([, ]|$)/)?RegExp.$1:null;destHeight=imgTag.className.match(/destheight=([0-9.\-]+)([, ]|$)/)?RegExp.$1:null;}catch(er){}
TinyMCE_AdvancedTheme._insertImage(relativeHref,altText,0,'','',destWidth,destHeight,'','',cssClass);},applyIE6Hack:function(){if(/msie/i.test(navigator.userAgent)){elements=[$('FolderOk'),$('FolderCancel'),$('UploadFiles')];$A(elements).each(function(element){element.style.position="relative";element.style.top="-3px";});}},removeIE6Hack:function(){if(/msie/i.test(navigator.userAgent)){elements=[$('FolderOk'),$('FolderCancel'),$('UploadFiles')];$A(elements).each(function(element){element.style.position="";});}},getParentID:function(){return $('Form_EditorToolbarImageForm_FolderID').value==''?'root':$('Form_EditorToolbarImageForm_FolderID').value;}}
tinyMCEImageEnhancement=new TinyMCEImageEnhancement();
;
/****** FILE: jsparty/SWFUpload/SWFUpload.js *****/

var SWFUpload=function(init_settings){this.initSWFUpload(init_settings);};SWFUpload.prototype.initSWFUpload=function(init_settings){try{document.execCommand('BackgroundImageCache',false,true);}catch(ex1){}
try{this.customSettings={};this.settings={};this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings(init_settings);this.loadFlash();this.displayDebugInfo();}catch(ex2){this.debug(ex2);}}
SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.prototype.initSettings=function(init_settings){this.addSetting("upload_url",init_settings.upload_url,"");this.addSetting("file_post_name",init_settings.file_post_name,"Filedata");this.addSetting("post_params",init_settings.post_params,{});this.addSetting("file_types",init_settings.file_types,"*.*");this.addSetting("file_types_description",init_settings.file_types_description,"All Files");this.addSetting("file_size_limit",init_settings.file_size_limit,"1024");this.addSetting("file_upload_limit",init_settings.file_upload_limit,"0");this.addSetting("file_queue_limit",init_settings.file_queue_limit,"0");this.addSetting("flash_url",init_settings.flash_url,"swfupload.swf");this.addSetting("flash_width",init_settings.flash_width,"1px");this.addSetting("flash_height",init_settings.flash_height,"1px");this.addSetting("flash_color",init_settings.flash_color,"#FFFFFF");this.addSetting("debug_enabled",init_settings.debug,false);this.flashReady_handler=SWFUpload.flashReady;this.swfUploadLoaded_handler=this.retrieveSetting(init_settings.swfupload_loaded_handler,SWFUpload.swfUploadLoaded);this.fileDialogStart_handler=this.retrieveSetting(init_settings.file_dialog_start_handler,SWFUpload.fileDialogStart);this.fileQueued_handler=this.retrieveSetting(init_settings.file_queued_handler,SWFUpload.fileQueued);this.fileQueueError_handler=this.retrieveSetting(init_settings.file_queue_error_handler,SWFUpload.fileQueueError);this.fileDialogComplete_handler=this.retrieveSetting(init_settings.file_dialog_complete_handler,SWFUpload.fileDialogComplete);this.uploadStart_handler=this.retrieveSetting(init_settings.upload_start_handler,SWFUpload.uploadStart);this.uploadProgress_handler=this.retrieveSetting(init_settings.upload_progress_handler,SWFUpload.uploadProgress);this.uploadError_handler=this.retrieveSetting(init_settings.upload_error_handler,SWFUpload.uploadError);this.uploadSuccess_handler=this.retrieveSetting(init_settings.upload_success_handler,SWFUpload.uploadSuccess);this.uploadComplete_handler=this.retrieveSetting(init_settings.upload_complete_handler,SWFUpload.uploadComplete);this.debug_handler=this.retrieveSetting(init_settings.debug_handler,SWFUpload.debug);this.customSettings=this.retrieveSetting(init_settings.custom_settings,{});};SWFUpload.prototype.loadFlash=function(){var html,target_element,container;if(document.getElementById(this.movieName)!==null){return false;}
try{target_element=document.getElementsByTagName("body")[0];if(typeof(target_element)==="undefined"||target_element===null){this.debug('Could not find the BODY element. SWFUpload failed to load.');return false;}}catch(ex){return false;}
container=document.createElement("div");container.style.width=this.getSetting("flash_width");container.style.height=this.getSetting("flash_height");target_element.appendChild(container);container.innerHTML=this.getFlashHTML();};SWFUpload.prototype.getFlashHTML=function(){var html="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" src="'+this.getSetting("flash_url")+'" width="'+this.getSetting("flash_width")+'" height="'+this.getSetting("flash_height")+'"';html+=' id="'+this.movieName+'" name="'+this.movieName+'" ';html+='bgcolor="'+this.getSetting("flash_color")+'" quality="high" menu="false" flashvars="';html+=this.getFlashVars();html+='" />';}else{html='<object id="'+this.movieName+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getSetting("flash_width")+'" height="'+this.getSetting("flash_height")+'">';html+='<param name="movie" value="'+this.getSetting("flash_url")+'">';html+='<param name="bgcolor" value="'+this.getSetting("flash_color")+'" />';html+='<param name="quality" value="high" />';html+='<param name="menu" value="false" />';html+='<param name="flashvars" value="'+this.getFlashVars()+'" />';html+='</object>';}
return html;};SWFUpload.prototype.getFlashVars=function(){var param_string=this.buildParamString();var html="";html+="movieName="+encodeURIComponent(this.movieName);html+="&uploadURL="+encodeURIComponent(this.getSetting("upload_url"));html+="&params="+encodeURIComponent(param_string);html+="&filePostName="+encodeURIComponent(this.getSetting("file_post_name"));html+="&fileTypes="+encodeURIComponent(this.getSetting("file_types"));html+="&fileTypesDescription="+encodeURIComponent(this.getSetting("file_types_description"));html+="&fileSizeLimit="+encodeURIComponent(this.getSetting("file_size_limit"));html+="&fileUploadLimit="+encodeURIComponent(this.getSetting("file_upload_limit"));html+="&fileQueueLimit="+encodeURIComponent(this.getSetting("file_queue_limit"));html+="&debugEnabled="+encodeURIComponent(this.getSetting("debug_enabled"));return html;};SWFUpload.prototype.getMovieElement=function(){if(typeof(this.movieElement)==="undefined"||this.movieElement===null){this.movieElement=document.getElementById(this.movieName);}
return this.movieElement;};SWFUpload.prototype.buildParamString=function(){var post_params=this.getSetting("post_params");var param_string_pairs=[];var i,value,name;if(typeof(post_params)==="object"){for(name in post_params){if(post_params.hasOwnProperty(name)){if(typeof(post_params[name])==="string"){param_string_pairs.push(encodeURIComponent(name)+"="+encodeURIComponent(post_params[name]));}}}}
return param_string_pairs.join("&");};SWFUpload.prototype.addSetting=function(name,value,default_value){if(typeof(value)==="undefined"||value===null){this.settings[name]=default_value;}else{this.settings[name]=value;}
return this.settings[name];};SWFUpload.prototype.getSetting=function(name){if(typeof(this.settings[name])==="undefined"){return"";}else{return this.settings[name];}};SWFUpload.prototype.retrieveSetting=function(value,default_value){if(typeof(value)==="undefined"||value===null){return default_value;}else{return value;}};SWFUpload.prototype.displayDebugInfo=function(){var key,debug_message="";debug_message+="----- SWFUPLOAD SETTINGS     ----\nID: "+this.moveName+"\n";debug_message+=this.outputObject(this.settings);debug_message+="----- SWFUPLOAD SETTINGS END ----\n";debug_message+="\n";this.debug(debug_message);};SWFUpload.prototype.outputObject=function(object,prefix){var output="",key;if(typeof(prefix)!=="string"){prefix="";}
if(typeof(object)!=="object"){return"";}
for(key in object){if(object.hasOwnProperty(key)){if(typeof(object[key])==="object"){output+=(prefix+key+": { \n"+this.outputObject(object[key],"\t"+prefix)+prefix+"}"+"\n");}else{output+=(prefix+key+": "+object[key]+"\n");}}}
return output;};SWFUpload.prototype.selectFile=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SelectFile)==="function"){try{movie_element.SelectFile();}
catch(ex){this.debug("Could not call SelectFile: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.selectFiles=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SelectFiles)==="function"){try{movie_element.SelectFiles();}
catch(ex){this.debug("Could not call SelectFiles: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.startUpload=function(file_id){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.StartUpload)==="function"){setTimeout(function(){try{movie_element.StartUpload(file_id);}
catch(ex){self.debug("Could not call StartUpload: "+ex);}},0);}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.cancelUpload=function(file_id){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.CancelUpload)==="function"){try{movie_element.CancelUpload(file_id);}
catch(ex){this.debug("Could not call CancelUpload: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.stopUpload=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.StopUpload)==="function"){try{movie_element.StopUpload();}
catch(ex){this.debug("Could not call StopUpload: "+ex);}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.getStats=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.GetStats)==="function"){try{return movie_element.GetStats();}
catch(ex){this.debug("Could not call GetStats");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.setStats=function(stats_object){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetStats)==="function"){try{movie_element.SetStats(stats_object);}
catch(ex){this.debug("Could not call SetStats");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.setCredentials=function(name,password){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetCredentials)==="function"){try{return movie_element.SetCredentials(name,password);}
catch(ex){this.debug("Could not call SetCredentials");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.getFile=function(file_id){var movie_element=this.getMovieElement();if(typeof(file_id)==="number"){if(movie_element!==null&&typeof(movie_element.GetFileByIndex)==="function"){try{return movie_element.GetFileByIndex(file_id);}
catch(ex){this.debug("Could not call GetFileByIndex");}}else{this.debug("Could not find Flash element");}}else{if(movie_element!==null&&typeof(movie_element.GetFile)==="function"){try{return movie_element.GetFile(file_id);}
catch(ex){this.debug("Could not call GetFile");}}else{this.debug("Could not find Flash element");}}};SWFUpload.prototype.addFileParam=function(file_id,name,value){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.AddFileParam)==="function"){try{return movie_element.AddFileParam(file_id,name,value);}
catch(ex){this.debug("Could not call AddFileParam");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.removeFileParam=function(file_id,name){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.RemoveFileParam)==="function"){try{return movie_element.RemoveFileParam(file_id,name);}
catch(ex){this.debug("Could not call AddFileParam");}}else{this.debug("Could not find Flash element");}};SWFUpload.prototype.setUploadURL=function(url){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetUploadURL)==="function"){try{this.addSetting("upload_url",url);movie_element.SetUploadURL(this.getSetting("upload_url"));}
catch(ex){this.debug("Could not call SetUploadURL");}}else{this.debug("Could not find Flash element in setUploadURL");}};SWFUpload.prototype.setPostParams=function(param_object){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetPostParams)==="function"){try{this.addSetting("post_params",param_object);movie_element.SetPostParams(this.getSetting("post_params"));}
catch(ex){this.debug("Could not call SetPostParams");}}else{this.debug("Could not find Flash element in SetPostParams");}};SWFUpload.prototype.setFileTypes=function(types,description){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileTypes)==="function"){try{this.addSetting("file_types",types);this.addSetting("file_types_description",description);movie_element.SetFileTypes(this.getSetting("file_types"),this.getSetting("file_types_description"));}
catch(ex){this.debug("Could not call SetFileTypes");}}else{this.debug("Could not find Flash element in SetFileTypes");}};SWFUpload.prototype.setFileSizeLimit=function(file_size_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileSizeLimit)==="function"){try{this.addSetting("file_size_limit",file_size_limit);movie_element.SetFileSizeLimit(this.getSetting("file_size_limit"));}
catch(ex){this.debug("Could not call SetFileSizeLimit");}}else{this.debug("Could not find Flash element in SetFileSizeLimit");}};SWFUpload.prototype.setFileUploadLimit=function(file_upload_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileUploadLimit)==="function"){try{this.addSetting("file_upload_limit",file_upload_limit);movie_element.SetFileUploadLimit(this.getSetting("file_upload_limit"));}
catch(ex){this.debug("Could not call SetFileUploadLimit");}}else{this.debug("Could not find Flash element in SetFileUploadLimit");}};SWFUpload.prototype.setFileQueueLimit=function(file_queue_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFileQueueLimit)==="function"){try{this.addSetting("file_queue_limit",file_queue_limit);movie_element.SetFileQueueLimit(this.getSetting("file_queue_limit"));}
catch(ex){this.debug("Could not call SetFileQueueLimit");}}else{this.debug("Could not find Flash element in SetFileQueueLimit");}};SWFUpload.prototype.setFilePostName=function(file_post_name){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetFilePostName)==="function"){try{this.addSetting("file_post_name",file_post_name);movie_element.SetFilePostName(this.getSetting("file_post_name"));}
catch(ex){this.debug("Could not call SetFilePostName");}}else{this.debug("Could not find Flash element in SetFilePostName");}};SWFUpload.prototype.setDebugEnabled=function(debug_enabled){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.SetDebugEnabled)==="function"){try{this.addSetting("debug_enabled",debug_enabled);movie_element.SetDebugEnabled(this.getSetting("debug_enabled"));}
catch(ex){this.debug("Could not call SetDebugEnabled");}}else{this.debug("Could not find Flash element in SetDebugEnabled");}};SWFUpload.prototype.flashReady=function(){var movie_element=this.getMovieElement();if(movie_element===null||typeof(movie_element.StartUpload)!=="function"){this.debug("ExternalInterface methods failed to initialize.");return;}
var self=this;if(typeof(self.flashReady_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.flashReady_handler();};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("flashReady_handler event not defined");}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue.shift();if(typeof(f)==="function"){f();}}
SWFUpload.prototype.fileDialogStart=function(){var self=this;if(typeof(self.fileDialogStart_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogStart_handler();};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileDialogStart event not defined");}};SWFUpload.prototype.fileQueued=function(file){var self=this;if(typeof(self.fileQueued_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueued_handler(file);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileQueued event not defined");}};SWFUpload.prototype.fileQueueError=function(file,error_code,message){var self=this;if(typeof(self.fileQueueError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueueError_handler(file,error_code,message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileQueueError event not defined");}};SWFUpload.prototype.fileDialogComplete=function(num_files_selected){var self=this;if(typeof(self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogComplete_handler(num_files_selected);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("fileDialogComplete event not defined");}};SWFUpload.prototype.uploadStart=function(file){var self=this;if(typeof(self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.returnUploadStart(self.uploadStart_handler(file));};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadStart event not defined");}};SWFUpload.prototype.returnUploadStart=function(return_value){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof(movie_element.ReturnUploadStart)==="function"){try{movie_element.ReturnUploadStart(return_value);}
catch(ex){this.debug("Could not call ReturnUploadStart");}}else{this.debug("Could not find Flash element in returnUploadStart");}};SWFUpload.prototype.uploadProgress=function(file,bytes_complete,bytes_total){var self=this;if(typeof(self.uploadProgress_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadProgress_handler(file,bytes_complete,bytes_total);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadProgress event not defined");}};SWFUpload.prototype.uploadError=function(file,error_code,message){var self=this;if(typeof(this.uploadError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadError_handler(file,error_code,message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadError event not defined");}};SWFUpload.prototype.uploadSuccess=function(file,server_data){var self=this;if(typeof(self.uploadSuccess_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadSuccess_handler(file,server_data);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadSuccess event not defined");}};SWFUpload.prototype.uploadComplete=function(file){var self=this;if(typeof(self.uploadComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadComplete_handler(file);};setTimeout(function(){self.executeNextEvent();},0);}else{this.debug("uploadComplete event not defined");}};SWFUpload.prototype.debug=function(message){var self=this;if(typeof(self.debug_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.debug_handler(message);};setTimeout(function(){self.executeNextEvent();},0);}else{this.eventQueue[this.eventQueue.length]=function(){self.debugMessage(message);};setTimeout(function(){self.executeNextEvent();},0);}};SWFUpload.flashReady=function(){try{this.debug("Flash called back and is ready.");if(typeof(this.swfUploadLoaded_handler)==="function"){this.swfUploadLoaded_handler();}}catch(ex){this.debug(ex);}};SWFUpload.swfUploadLoaded=function(){};SWFUpload.fileDialogStart=function(){};SWFUpload.fileQueued=function(file){};SWFUpload.fileQueueError=function(file,error_code,message){try{switch(error_code){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.debug("Error Code: Zero Byte File, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:this.debug("Error Code: File extension is not allowed, Message: "+message);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+error_code);}}catch(ex){this.debug(ex);}};SWFUpload.fileDialogComplete=function(num_files_selected){};SWFUpload.uploadStart=function(file){return true;};SWFUpload.uploadProgress=function(file,bytes_complete,bytes_total){this.debug("File Progress: "+file.id+", Bytes: "+bytes_complete+". Total: "+bytes_total);};SWFUpload.uploadSuccess=function(file,server_data){};SWFUpload.uploadComplete=function(file){};SWFUpload.debug=function(message){if(this.getSetting("debug_enabled")){this.debugMessage(message);}};SWFUpload.uploadError=function(file,error_code,msg){try{switch(error_code){case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:this.debug("Error Code: File ID specified for upload was not found, Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:this.debug("Error Code: HTTP Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:this.debug("Error Code: No backend file, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:this.debug("Error Code: IO Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:this.debug("Error Code: Security Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:this.debug("Error Code: Upload Initialization exception, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:this.debug("Error Code: uploadStart callback returned false, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:this.debug("Error Code: The file upload was cancelled, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:this.debug("Error Code: The file upload was stopped, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+error_code);}}catch(ex){this.debug(ex);}};SWFUpload.prototype.debugMessage=function(message){var exception_message,exception_values;if(typeof(message)==="object"&&typeof(message.name)==="string"&&typeof(message.message)==="string"){exception_message="";exception_values=[];for(var key in message){exception_values.push(key+": "+message[key]);}
exception_message=exception_values.join("\n");exception_values=exception_message.split("\n");exception_message="EXCEPTION: "+exception_values.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exception_message);}else{SWFUpload.Console.writeLine(message);}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){var console,documentForm;try{console=document.getElementById("SWFUpload_Console");if(!console){documentForm=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(documentForm);console=document.createElement("textarea");console.id="SWFUpload_Console";console.style.fontFamily="monospace";console.setAttribute("wrap","off");console.wrap="off";console.style.overflow="auto";console.style.width="700px";console.style.height="350px";console.style.margin="5px";documentForm.appendChild(console);}
console.value+=message+"\n";console.scrollTop=console.scrollHeight-console.clientHeight;}catch(ex){alert("Exception: "+ex.name+" Message: "+ex.message);}};
;
/****** FILE: cms/javascript/Upload.js *****/

Upload=Class.create();Upload.prototype={initialize:function(params){this.filesUploaded=0;this.filesToUpload=0;this.folderID='root';this.uploadInProgress=false;this.uploadMessage='';if(typeof params.fileSizeLimit!='undefined')this.setFileSizeLimit=params.fileSizeLimit;else this.fileSizeLimit='30720';if(typeof params.fileTypes!='undefined')this.fileTypes=params.fileTypes;else this.fileTypes='*.*';if(typeof params.fileTypesDescription!='undefined')this.fileTypesDescription=params.fileTypesDescription;else this.fileTypesDescription='All Files';if(typeof params.fileUploadLimit!='undefined')this.fileUploadLimit=params.fileUploadLimit;else this.fileUploadLimit='6';if(typeof params.beginUploadOnQueue!='undefined')this.beginUploadOnQueue=params.beginUploadOnQueue;else this.beginUploadOnQueue=false;if(typeof params.fileQueued!='undefined')this.fileQueued=params.fileQueued;if(typeof params.fileProgress!='undefined')this.fileProgress=params.fileProgress;else this.fileProgress=Prototype.emptyFunction;if(typeof params.fileCancelled!='undefined')this.fileCancelled=params.fileCancelled;if(typeof params.fileComplete!='undefined')this.fileComplete=params.fileComplete;if(typeof params.queueComplete!='undefined')this.queueComplete=params.queueComplete;if(typeof params.buildUI!='undefined')this.customBuildUI=params.buildUI;if(typeof params.securityID!='undefined')this.securityID=params.securityID;this.onLoad();},onLoad:function(){path=this.getBasePath();sessId=this.getSessionId();this.swfu=new SWFUpload({upload_url:path+'admin/assets/UploadForm?SecurityID='+this.securityID+'&PHPSESSID='+sessId,file_post_name:'Files',file_size_limit:this.fileSizeLimit,file_types:this.fileTypes,file_types_description:this.fileTypesDescription,file_upload_limit:this.fileUploadLimit,begin_upload_on_queue:this.beginUploadOnQueue,use_server_data_event:true,validate_files:false,file_queued_handler:this.uploadFileQueuedCallback.bind(this),upload_success_handler:this.uploadFileCompleteCallback.bind(this),upload_progress_handler:this.uploadFileProgressCallback.bind(this),error_handler:this.uploadErrorCallback.bind(this),file_validation_handler:Prototype.emptyFunction,file_cancelled_handler:Prototype.emptyFunction,flash_url:'jsparty/SWFUpload/swfupload_f9.swf',swfupload_loaded_handler:this.buildUI.bind(this),debug:false});},getBasePath:function(){var path='http://'+window.location.host+window.location.pathname;if(path.match(/^(.*\/)admin/i))return RegExp.$1;else return path;},getSessionId:function(){var start=document.cookie.indexOf('PHPSESSID')+10;var end=document.cookie.indexOf(';',start);if(end==-1)end=document.cookie.length;return document.cookie.substring(start,end);},buildUI:function(){this.customBuildUI();},uploadFileQueuedCallback:function(file,queueLength){this.filesToUpload++;this.fileQueued(file,queueLength);this.addFileParam(file);},uploadFileCompleteCallback:function(file,serverData){this.filesUploaded++;if(serverData){var toEval=serverData.substr(serverData.indexOf('<script'));toEval=toEval.replace('<script type="text/javascript">','');toEval=toEval.replace('</script>','');this.uploadMessage=toEval;}
this.fileComplete(file,serverData);if(this.swfu.getStats().files_queued>0)this.startUpload();else{this.queueComplete();this.uploadInProgress=false;this.filesUploaded=0;this.filesToUpload=0;}},uploadFileProgressCallback:function(file,bytes_complete){this.uploadInProgress=true;this.fileProgress(file,bytes_complete);},uploadErrorCallback:function(error_code,file,message){this.swfu.cancelQueue();switch(error_code){case SWFUpload.ERROR_CODE_HTTP_ERROR:alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: HTTP Error, File name: '+file.name+', Message: '+msg);break;case SWFUpload.ERROR_CODE_IO_ERROR:alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: IO Error, File name: '+file.name+', Message: '+msg);break;case SWFUpload.ERROR_CODE_SECURITY_ERROR:alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: Security Error, File name: '+file.name+', Message: '+msg);break;case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:alert('Files cannot be bigger than '+this.fileSizeLimit/1024+' MB.');break;case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:alert('Files cannot be empty');break;case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:alert('You can only have six files in queue');break;case SWFUpload.ERROR_CODE_UPLOAD_FAILED:alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');break;case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');break;default:alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');}},addFileParam:function(file){this.swfu.addFileParam(file.id,'ID',this.folderID);this.swfu.addFileParam(file.id,'action_doUpload','1');this.swfu.addFileParam(file.id,'Files',file.name);this.swfu.addFileParam(file.id,'MAX_FILE_SIZE','31457280');},browse:function(){this.swfu.selectFiles();},startUpload:function(){this.swfu.startUpload();},cancelUpload:function(fileId){this.filesToUpload--;this.swfu.cancelUpload(fileId);},setFolderID:function(id){this.folderID=id;},getFilesUploaded:function(){return this.filesUploaded;},getFilesToUpload:function(){return this.filesToUpload;},getUploadMessage:function(){return this.uploadMessage;},isUploadInProgress:function(){return this.uploadInProgress;}}
;
/****** FILE: sapphire/javascript/TreeSelectorField.js *****/

TreeDropdownField=Class.extend('Observable');TreeDropdownField.prototype={initialize:function(){this.editLink=this.getElementsByTagName('a')[0];this.humanItems=this.getElementsByTagName('span')[0];this.inputTag=this.getElementsByTagName('input')[0];this.editLink.treeDropdownField=this;this.humanItems.treeDropdownField=this;this.inputTag.treeDropdownField=this;this.editLink.onclick=this.edit_click;this.humanItems.onclick=this.edit_click;this.inputTag.setValue=this.setValue.bind(this);},destroy:function(){if(this.editLink){this.editLink.onclick=null;this.editLink.treeDropdownField=null;this.editLink=null;}
if(this.humanItems){this.humanItems.onclick=null;this.humanItems.treeDropdownField=null;this.humanItems=null;}
if(this.inputTag){this.inputTag.setValue=null;this.inputTag.treeDropdownField=null;this.inputTag=null;}},refresh:function(){this.createTreeNode();this.ajaxGetTree((function(response){this.newTreeReady(response,false);this.updateTreeLabel();}).bind(this));},helperURLBase:function(){return this.ownerForm().action+'/field/'+this.inputTag.name+'/';},ownerForm:function(){var f=this.parentNode;while(f&&f.tagName.toLowerCase()!='form')f=f.parentNode;return f;},toggleTree:function(){if(this.treeShown)this.hideTree();else this.showTree();},createTreeNode:function(keepTreeHidden){if(!this.itemTree){this.itemTree=document.createElement('div');if(keepTreeHidden){this.hideTree();}
this.itemTree.className='tree_holder';this.itemTree.innerHTML=ss.i18n._t('LOADING','Loading...');this.appendChild(this.itemTree);}},showTree:function(){this.treeShown=true;if(this.itemTree){this.itemTree.style.display='block';this.bound_testForBlur=this.testForBlur.bind(this);Event.observe(document,'click',this.bound_testForBlur);this.stretchIframeIfNeeded();}else{this.createTreeNode();this.ajaxGetTree((function(response){this.newTreeReady(response,false);this.updateTreeLabel();}).bind(this));}},stretchIframeIfNeeded:function(){if(parent&&parent.document){if(!this.iframeObj){var iframes=parent.document.getElementsByTagName('iframe')
var i,item;for(i=0;item=iframes[i];i++){if(item.contentWindow==window){this.iframeObj=item;break;}}}
if(this.iframeObj&&this.iframeObj.id=='GB_frame')return;var desiredHeight=Position.cumulativeOffset(this.itemTree)[1]+this.itemTree.offsetHeight+2;if(this.iframeObj&&desiredHeight>this.iframeObj.offsetHeight){this.iframeObj.oldHeight=this.iframeObj.offsetHeight;this.iframeObj.style.height=desiredHeight+'px';}}},unstretchIframeIfNeeded:function(){if(this.iframeObj&&this.iframeObj.oldHeight)
this.iframeObj.style.height=this.iframeObj.oldHeight+'px';},testForBlur:function(event){var clicked=Event.element(event);if(clicked!=this.itemTree&&!hasAncestor(clicked,this.itemTree)&&clicked!=this.editLink&&clicked!=this.humanItems){this.hideTree();}},hideTree:function(){this.treeShown=false;if(this.itemTree){this.itemTree.style.display='none';if(this.bound_testForBlur)Event.stopObserving(document,'click',this.bound_testForBlur);this.unstretchIframeIfNeeded();}},ajaxGetTree:function(after){var ajaxURL=this.helperURLBase()+'gettree?forceValues='+this.inputTag.value;ajaxURL+=$('SecurityID')?'&SecurityID='+$('SecurityID').value:'';if($('Form_EditForm_Locale'))ajaxURL+="&locale="+$('Form_EditForm_Locale').value;new Ajax.Request(ajaxURL,{method:'get',onSuccess:after,onFailure:function(response){errorMessage("Error getting data",response);}})},newTreeReady:function(response,keepTreeHidden){this.itemTree.innerHTML=response.responseText;this.itemTree.appendChild(document.createElement('iframe'));this.tree=Tree.create(this.itemTree.getElementsByTagName('ul')[0],{ajaxExpansion:this.ajaxExpansion,getIdx:function(){return this.id.replace(this.options.idxBase,'');},idxBase:'selector-'+this.inputTag.name+'-',dropdownField:this,onselect:this.tree_click});var selectedItems=this.inputTag.value.split(/ *, */);var i,isSelected={};for(i=0;i<selectedItems.length;i++)isSelected[selectedItems[i]]=true;if(!keepTreeHidden){this.showTree();}},ajaxExpansion:function(){this.addNodeClass('loading');var ul=this.treeNodeHolder();ul.innerHTML=ss.i18n._t('LOADING','Loading...');var ajaxURL=this.options.dropdownField.helperURLBase()+'getsubtree?&SubtreeRootID='+this.getIdx();ajaxURL+=$('SecurityID')?'&SecurityID='+$('SecurityID').value:'';if($('Form_EditForm_Locale'))ajaxURL+="&locale="+$('Form_EditForm_Locale').value;new Ajax.Request(ajaxURL,{onSuccess:this.installSubtree.bind(this),onFailure:function(response){errorMessage('error loading subtree',response);}});},setValue:function(val){if(this.inputTag.value!=val){this.inputTag.value=val;this.notify('Change',val);if($('selector-'+this.inputTag.name+'-'+this.inputTag.value)){this.updateTreeLabel();}else{this.ajaxGetTree((function(response){this.createTreeNode(true);this.newTreeReady(response,true);this.updateTreeLabel();}).bind(this));}}},updateTreeLabel:function(){var treeNode;if(treeNode=$('selector-'+this.inputTag.name+'-'+this.inputTag.value)){this.humanItems.innerHTML=treeNode.getTitle();if(treeNode.tree.selected&&treeNode.tree.selected.removeNodeClass)treeNode.tree.selected.removeNodeClass('current');treeNode.addNodeClass('current');this.tree.selected=treeNode;}else{this.humanItems.innerHTML=this.inputTag.value?this.inputTag.value:'(Choose)';}},setValueFromTree:function(treeID,title){this.humanItems.innerHTML=title;this.inputTag.value=treeID.replace('selector-'+this.inputTag.name+'-','');this.notify('Change',this.inputTag.value);this.hideTree();},edit_click:function(){this.treeDropdownField.toggleTree();return false;},tree_click:function(){this.options.dropdownField.setValueFromTree(this.id,this.getTitle());if(this.tree.selected&&this.tree.selected.removeNodeClass)this.tree.selected.removeNodeClass('current');this.addNodeClass('current');this.tree.selected=this;}}
TreeMultiselectField=Class.extend('TreeDropdownField');TreeMultiselectField.prototype={destroy:function(){if(this.TreeDropdownField)this.TreeDropdownField.destroy();this.TreeDropdownField=null;},newTreeReady:function(response){this.TreeDropdownField.newTreeReady(response);MultiselectTree.create(this.tree);var selectedItems=this.inputTag.value.split(/ *, */);var i,isSelected={};for(i=0;i<selectedItems.length;i++)isSelected[selectedItems[i]]=true;var allNodes=this.tree.getElementsByTagName('li');for(i=0;i<allNodes.length;i++){if(isSelected[allNodes[i].getIdx()]){this.tree.multiselect_handleSelectionChange(allNodes[i]);}}},hideTree:function(){this.TreeDropdownField.hideTree();var internalVal=humanVal="";for(i in this.tree.selectedNodes){internalVal+=(internalVal?',':'')+i;humanVal+=(humanVal?', ':'')+this.tree.selectedNodes[i];}
this.inputTag.value=internalVal;this.humanItems.innerHTML=humanVal;}}
TreeMultiselectField.applyTo('div.TreeDropdownField.multiple');TreeDropdownField.applyTo('div.TreeDropdownField.single');
;
/****** FILE: cms/javascript/ThumbnailStripField.js *****/

ThumbnailStripField=Class.create();ThumbnailStripField.applyTo('#Image');ThumbnailStripField.applyTo('#Flash');ThumbnailStripField.prototype={updateMethod:'getimages',initialize:function(){try{this.updateMethod=this.className.match(/updatemethod=([^ ]+)/)[1];}catch(err){}
if(this.className.match(/parent=([^ ]+)/)){var parentField=$(RegExp.$1).parentNode;if(parentField){parentField.observeMethod('Change',this.ajaxGetFiles.bind(this));}
var searchField=$$('#'+this.updateMethod+'Search input')[0];var timeout=undefined;if(searchField){Event.observe(searchField,'keypress',function(event){if(timeout!=undefined)clearTimeout(timeout);timeout=setTimeout(function(){var searchText=searchField.value;$('Flash').ajaxGetFiles(null,searchText);$('Image').ajaxGetFiles(null,searchText);},500);});}}},ajaxGetFiles:function(folderID,searchText,callback){if(!callback)callback=this.reapplyBehaviour.bind(this);var securityID=($('SecurityID')?'&SecurityID='+$('SecurityID').value:'');this.innerHTML='<h2>Loading...</h2>';var ajaxURL=this.helperURLBase()+'&methodName='+this.updateMethod+'&folderID='+folderID+'&searchText='+searchText+securityID+'&cacheKillerDate='+parseInt((new Date()).getTime())+'&cacheKillerRand='+parseInt(10000*Math.random());new Ajax.Updater(this,ajaxURL,{method:'get',onComplete:callback,onFailure:function(response){errorMessage("Error getting files",response);}});},reapplyBehaviour:function(){Behaviour.apply(this);},helperURLBase:function(){var fieldName=this.id;var ownerForm=this.ownerForm();var securityID=($('SecurityID')?'&SecurityID='+$('SecurityID').value:'');return ownerForm.action+'?action_callfieldmethod=1&fieldName='+fieldName+'&ajax=1'+securityID;},ownerForm:function(){var f=this.parentNode;while(f&&f.tagName.toLowerCase()!='form')f=f.parentNode;return f;}}
;
