/* Copyright (c) 2006-2009, Apple Inc. All rights reserved. */
/* Compressed JavaScript. Do not modify. */


/* widgets_core.js */

var requiredUIRevision='WikiServerUI-200';function prepare(inAlwaysRun){if(window.unitTestHandler&&(!inAlwaysRun))return true;if(window.opera&&gPrepareIteration++>0)return true;try{publisher().publish('awakeFromPage',d);publisher().publish('PAGE_INITIALIZE_FINISHED',d);}
catch(e){reportError(e);}}
function reportErrorInDebugMode(e,optRealErrorObj){if(gDebug)
{return reportError(e,optRealErrorObj);}
else
{return false;}}
function reportError(e,optRealErrorObj){if(window.gLastErrorObj&&(e==gLastErrorObj||optRealErrorObj==gLastErrorObj))return;gLastErrorObj=e;if(window.parent&&window.parent.AppleUnitTester){if(window.parent.AppleUnitTester.sharedTester().mIsLoadingPage&&e.getAllResponseHeaders){return false;}
else{window.parent.AppleUnitTester.sharedTester().reportError(e);}}
else if(gDebug){debugger;var errorString='unknown';try{if(e.request&&e.status&&e.request.url&&e.getAllResponseHeaders){debug_message('Request returned error:');debug_message(e.request.method.toUpperCase()+' '+e.request.url);if(e.request.options&&e.request.options.requestHeaders)$H(e.request.options.requestHeaders).each(function(hdr){debug_message(hdr.key+': '+hdr.value);});if(e.request.options&&e.request.options.postBody)debug_message(e.request.options.postBody);debug_message('--- RESPONSE: '+e.status+' ---');debug_message(e.getAllResponseHeaders());if(e.responseText)debug_message(e.responseText);errorString='Server returned an error: '+e.status+'. Check the console for detailed request/response logs.';}
else{errorString=(Object.isString(e)?e:$H(optRealErrorObj||e).inspect());}}
catch(e2){try{errorString=e.toString();}
catch(e3){}}
alert('Error: '+errorString);throw e;return false;}
throw e;}
function debug_message(inString){if(window.gDebug&&window.console){window.console.log(inString);}}
Class.createWithSharedInstance=function(inOptInstanceShortcutName,inOptInstantiateOnAwakeFromPage){var cls=null;cls=function(){var result=this.initialize.apply(this,arguments);if(result==invalidate){var timeoutCallback=function(){try{if(this&&this['_parentClass']&&this['_parentClass']['_sharedInstance']==this){var cp=this;this['_parentClass']['_sharedInstance']=null;}}
catch(e){if(window.reportError)reportError(e);else throw e;}}
setTimeout(timeoutCallback.bind(this),200);}}
cls.autocreate=inOptInstantiateOnAwakeFromPage;cls.sharedInstance=function(){if(!cls['_sharedInstance']){cls['_sharedInstance']=new cls();cls['_sharedInstance']['_parentClass']=cls;}
return cls['_sharedInstance'];}
if(inOptInstanceShortcutName)window[inOptInstanceShortcutName]=cls.sharedInstance;if(inOptInstantiateOnAwakeFromPage){publisher().subscribe(function(){if(cls.autocreate)cls.sharedInstance();},'awakeFromPage');}
return cls;}
var NotificationPublisher=Class.createWithSharedInstance('publisher');NotificationPublisher.prototype={initialize:function(){this.mSubcribers=[];},publish:function(inMessage,inObject,inUserInfo){var subscriberDidRespond=false;for(var subscriberIdx=0;subscriberIdx<this.mSubcribers.length;subscriberIdx++){var subscriber=this.mSubcribers[subscriberIdx];var m=subscriber.message||inMessage;var o=subscriber.obj||inObject;if(m==inMessage&&o==inObject){subscriber.callback(inMessage,inObject,inUserInfo);subscriberDidRespond=true;}}
if(window.parent&&window.parent.AppleUnitTester){window.parent.AppleUnitTester.sharedTester().publishMessage(inMessage);}
return subscriberDidRespond;},subscribe:function(inCallback,inMessage,inObject){this.mSubcribers.push({callback:inCallback,message:inMessage,obj:inObject});},unsubscribe:function(inCallback,inMessage,inObject){this.mSubcribers=this.mSubcribers.reject(function(subscriber){return(subscriber.callback==inCallback&&subscriber.message==inMessage&&subscriber.obj==inObject);});}}
function invalidate(){return false;}
function getMetaTagValue(inTagName){var matchingTag=$A(d.getElementsByTagName('META')).detect(function(tag){return(tag.name==inTagName);});return(matchingTag?matchingTag.content:null);}
function padNumberStr(theNumber,digits){var padder=((arguments.length>2)?arguments[2]:'0');var theString="";theString+=theNumber;for(var i=0;i<(digits-theString.length);i++){theString=padder+theString;}
return theString;}
function createDateObjFromISO8601(inISOString,inOptIsGMT){if(!inISOString)return null;var str=inISOString.match(/[Tt]/)?inISOString:inISOString+'T000000Z';var d=str.match(/(\d{4})-?(\d{2})-?(\d{2})\s*[Tt]?(\d{2}):?(\d{2}):?(\d{2})/);if(!d)return null;var dt=new Date(d[1],d[2]-1,d[3],d[4],d[5],d[6]);if(inOptIsGMT)dt.setHours(dt.getHours()-(dt.getTimezoneOffset()/60));return dt;}
function dateObjToISO8601(inDateObj,inOptMakeGMT,inIncludeZ){if(!inDateObj)return null;var includeZ=(arguments.length>2?inIncludeZ:true);var dt=new Date(inDateObj.getTime());if(inOptMakeGMT)dt.setHours(dt.getHours()-(dt.getTimezoneOffset()/(-60)));var iso_string='';iso_string+=dt.getFullYear()
+padNumberStr(dt.getMonth()+1,2)
+padNumberStr(dt.getDate(),2)
+'T'
+padNumberStr(dt.getHours(),2)
+padNumberStr(dt.getMinutes(),2)
+padNumberStr(dt.getSeconds(),2)
+(includeZ?'Z':'');return iso_string;}
function getEndDateUsingDuration(inDate,inDuration){var dt=new Date(inDate.getTime());if(inDuration.days)dt.setDate(dt.getDate()+inDuration.days);if(inDuration.hours)dt.setHours(dt.getHours()+inDuration.hours);if(inDuration.minutes)dt.setMinutes(dt.getMinutes()+inDuration.minutes);if(inDuration.seconds)dt.setMinutes(dt.getSeconds()+inDuration.seconds);return dt;}
function getDurationUsingEndDate(inStartDate,inEndDate){var time=Math.floor((inEndDate.getTime()-inStartDate.getTime())/1000);var whole=(time<0?Math.ceil:Math.floor);var duration={days:whole(time/86400)};time=time%86400;duration.hours=whole(time/3600);time=time%3600;duration.minutes=whole(time/60);duration.seconds=time%60;return duration;}
function durationFromISO8601(inISOString){if(!inISOString)return null;var dt=inISOString.match(/^P([^T]*)T?(.*)$/);if(!dt)return null;var duration=new Object();['years','months','days','hours','minutes','seconds'].each(function(key,i){var mat=dt[Math.floor(i/3)+1].match("([0-9]+)"+key.charAt(0).toUpperCase());duration[key]=mat?parseInt(mat[1]):0;});return duration;}
function durationToISO8601(inDuration){var str='P';if(inDuration.years&&inDuration.years>0)str+=inDuration.years+'Y';if(inDuration.months&&inDuration.months>0)str+=inDuration.months+'M';if(inDuration.days&&inDuration.days>0)str+=inDuration.days+'D';str+='T';if(inDuration.hours&&inDuration.hours>0)str+=inDuration.hours+'H';if(inDuration.minutes&&inDuration.minutes>0)str+=inDuration.minutes+'M';if(inDuration.seconds&&inDuration.seconds>0)str+=inDuration.seconds+'S';return str;}
function compareDateWeeks(inDate1,inDate2,inOptStartWeekday){var dates=new Array();var startWeekday=inOptStartWeekday||0;for(i=0;i<2;i++){var date=new Date(arguments[i].getTime());if(date.getDay()<startWeekday){date.setDate(date.getDate()-7);}
date.setDate(date.getDate()-(date.getDay()-startWeekday));dates.push(date);}
return(parseInt(dateObjToISO8601(dates[0],false,false))==parseInt(dateObjToISO8601(dates[1],false,false)));}
function fixSiteRelativeURLForIE(inURLString){if(!document.all||inURLString.indexOf('/')!=0)return inURLString;return window.location.protocol+'//'+window.location.host+inURLString;}
var IEFixes={isIE:(document.all&&!(/Opera/.test(navigator.userAgent))?true:false),isIE7:document.all&&/MSIE 7/.test(navigator.userAgent),isIE6:document.all&&/MSIE 6/.test(navigator.userAgent)}
if(IEFixes.isIE6){try{document.execCommand("BackgroundImageCache",false,true);}catch(err){}}
var SafariFixes={isMobileSafari:/ AppleWebKit\/.+Mobile\//.test(navigator.userAgent),isiPad:/ AppleWebKit\/.+Mobile\//.test(navigator.userAgent)&&/iPad/.test(navigator.userAgent),isWebKit:/WebKit/.test(navigator.userAgent),isTigerSafari:(/WebKit\/\d+/.test(navigator.userAgent)&&(parseInt(navigator.userAgent.match(/WebKit\/(\d+)/)[1])<420))}
var MozillaFixes={isGecko:/Gecko\/\d*/.test(navigator.userAgent),isGecko1_9:/Gecko\/\d*/.test(navigator.userAgent)&&/rv:1.9/.test(navigator.userAgent),isCamino:/Gecko\/\d*.+Camino\/\d*/.test(navigator.userAgent)}
var OperaFixes={isOpera:/Opera/.test(navigator.userAgent)}
function bindEventListeners(inParentObj,inFnNameArray){inFnNameArray.each(function(f){inParentObj[f]=inParentObj[f].bindAsEventListener(inParentObj);});}
function observeEvents(inParentObj,inElement,inFnNameArray,inOptStopObserving){var elm=$(inElement);$H(inFnNameArray).each(function(handler){if(inOptStopObserving)Event.stopObserving(elm,handler.key,inParentObj[handler.value]);else Event.observe(elm,handler.key,inParentObj[handler.value]);});}
function stopObservingEvents(inParentObj,inElement,inFnNameArray){observeEvents(inParentObj,inElement,inFnNameArray,true);}
function removeAllChildNodes(inParent){inParent=$(inParent);while(inParent.childNodes.length>0){inParent.removeChild(inParent.firstChild);}}
function replaceElementContents(inElement,inStringOrObj,inEvaluate){var elm=$(inElement);if(typeof inStringOrObj=='string'&&inEvaluate){elm.innerHTML=inStringOrObj;}
else{removeAllChildNodes(elm);if(typeof inStringOrObj=='string'){elm.appendChild(elm.ownerDocument.createTextNode(inStringOrObj));}else if(inStringOrObj){elm.appendChild(inStringOrObj);}}}
function promoteElementChildren(inParent){while(inParent.childNodes.length>0){var currentChild=inParent.firstChild;inParent.removeChild(currentChild);inParent.parentNode.insertBefore(currentChild,inParent);}
inParent.parentNode.removeChild(inParent);}
function changeNodeName(inElement,inNodeName){var elm=$(inElement);var node=elm.ownerDocument.createElement(inNodeName);$A(elm.childNodes).each(function(child){elm.removeChild(child);node.appendChild(child);});elm.parentNode.insertBefore(node,elm);Element.remove(elm);return node;}
function insertAtBeginning(inElement,inParentElement){var elm=$(inParentElement);if(!elm)return false;if(elm.childNodes.length>0)elm.insertBefore($(inElement),elm.firstChild);else elm.appendChild($(inElement));}
function insertAfter(inElement,inSibling){var elm=$(inElement);var sibling=$(inSibling);var nextSibling=sibling.nextSibling;if(nextSibling)nextSibling.parentNode.insertBefore(elm,nextSibling);else sibling.parentNode.appendChild(inElement);}
Object.extend(String,{append:function(inOrig,inNew){var delimiter=arguments.length>2?arguments[2]:' ';if(inNew){if(inOrig!='')inOrig+=delimiter;inOrig+=inNew;}
return inOrig;},appendPathComponent:function(inString,inPathComponent){return inString.replace(/\/$/,'')+'/'+inPathComponent.replace(/^\//,'');},appendPathExtension:function(inString,inPathExtension){return inString.replace(/\.[^.]+$/,'')+'.'+inPathExtension.replace(/^\./,'');},addSlash:function(inString){return inString.replace(/([^\/])$/,'$1/');},removeSlash:function(inString){return inString.replace(/\/+$/,'');},lastPathComponent:function(inString){return inString.match(/\/([^\/]+)\/*$/)[1];},format:function(inFormatStr,inDictionary){return $H(inDictionary).inject(inFormatStr,function(str,cur){var r=new RegExp('%\\('+cur.key+'\\)[sdig]','gi');return str.replace(r,cur.value);});},hexValueForColorString:function(inColorString){var rgbColorMatch=inColorString.match(/rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\s*\)/);if(!rgbColorMatch)return inColorString;var colorStr='#';for(var colorMatchIdx=1;colorMatchIdx<4;colorMatchIdx++){colorStr+=padNumberStr(parseInt(rgbColorMatch[colorMatchIdx]).toString(16),2);}
return colorStr;}});Object.extend(Element,{childrenWithNodeName:function(inParent,inNodeName){var retList=[];var children=inParent.childNodes;for(var childIdx=0;childIdx<children.length;childIdx++){if(children.item(childIdx).nodeName==inNodeName)retList.push(children.item(childIdx));}
return retList;},elementWithSimpleXPath:function(inParent,inPath){return $A(inPath.split('.')).inject(inParent,function(currentParent,pathComponent){return currentParent?Element.firstChildWithNodeName(currentParent,pathComponent):null;});},firstChildWithNodeName:function(inParent,inNodeName){var children=inParent.childNodes;for(childIdx=0;childIdx<inParent.childNodes.length;childIdx++){if(children.item(childIdx).nodeName==inNodeName)return children.item(childIdx);}
return null;},firstNodeValue:function(inElement){var elm=(inElement&&inElement.constructor==String)?$(inElement):inElement;if(elm&&elm.firstChild)return elm.firstChild.nodeValue||'';return'';}});Object.extend(Array,{sortArrayUsingKey:function(inArray,inKey){var sortCallback=function(a,b){if(!(a[inKey]))return 0;if(a[inKey]>b[inKey])return 1;else if(a[inKey]<b[inKey])return-1;return 0;}
return inArray.sort(sortCallback);},removeDuplicateRows:function(inArray,inOptPreferenceTest){var keyedArray=inArray.clone();for(var rowIdx=0;rowIdx<keyedArray.length;rowIdx++){var row=keyedArray[rowIdx];if(!row.uid)continue;if(keyedArray[row.uid]){keyedArray.splice(rowIdx--,1);if(inOptPreferenceTest&&inOptPreferenceTest(keyedArray[row.uid],row)){var earlierIndex=keyedArray.indexOf(keyedArray[row.uid]);keyedArray.splice(earlierIndex,1,row);}}
keyedArray[row.uid]=row;}
return keyedArray.clone();}});Element.addClassName=function(element,className){if(!(element=$(element)))return;if(!Element.hasClassName(element,className))
element.className+=(element.className?' ':'')+className;return element;};if(window.Builder&&IEFixes.isIE){Builder.unpatched_node=Builder.node;Builder.node=function(){return $(Builder.unpatched_node.apply(this,arguments));}}
var gPrepareIteration=0;var d=document||'';if(!window.gDebug)gDebug=false;if(window.loaded)loaded('widgets_core.js');

/* locUtils.js */

if(!window.Loc)Loc={};Loc.getBrowserLocale=function()
{return(navigator.language?navigator.language:navigator.browserLanguage||'en').split('-')[0];};Loc.getTimeRangeDisplayString=function(inStartDate,inDuration){if(inDuration.days>0&&inDuration.hours==0&&inDuration.minutes==0){var str=inStartDate.formatDate(Loc.dateFormats.mediumDate);if(inDuration.days>1){var endDate=getEndDateUsingDuration(inStartDate,inDuration);endDate.setDate(endDate.getDate()-1);str+=' - '+endDate.formatDate(Loc.dateFormats.mediumDate);}
return str;}
var time_string=Loc.getLocalizedHourKey(inStartDate.getHours(),inStartDate.getMinutes());var endDate=getEndDateUsingDuration(inStartDate,inDuration);return inStartDate.formatDate(Loc.dateFormats.mediumDate)+'; '+time_string+' - '+Loc.getLocalizedHourKey(endDate.getHours(),endDate.getMinutes());};Loc.getDurationDisplayString=function(inDuration){if(!inDuration)return'';var daysString='';var hoursString='';var minutesString='';var andString='';if(inDuration.days&&inDuration.days>0){var pluralString=Loc.durationFormats[inDuration.days>1?'days':'day'];daysString=String.format(Loc.durationFormats.daysFormat,{days:inDuration.days,pluralString:pluralString});}
var hours=0;if(inDuration.hours>0||inDuration.minutes>0){if(inDuration.hours>0){var pluralString=Loc.durationFormats[inDuration.hours>1?'hours':'hour'];hoursString=String.format(Loc.durationFormats.hoursFormat,{hours:inDuration.hours,pluralString:pluralString});}
if(inDuration.minutes>0){var pluralString=Loc.durationFormats[inDuration.minutes>1?'minutes':'minute'];minutesString=String.format(Loc.durationFormats.minutesFormat,{minutes:inDuration.minutes,pluralString:pluralString});}
if((inDuration.minutes>0)&&((inDuration.hours>0)||(inDuration.days>0))){andString=Loc.durationFormats['and'];}}
var subStrs={daysString:daysString,minutesString:minutesString,hoursString:hoursString};subStrs['and']=andString;return String.format(Loc.durationFormats.mainFormat,subStrs);};Loc.getRelativeDateString=function(d)
{if(!d)return'';var now=new Date();if((d.getDate()==now.getDate())&&(d.getMonth()==now.getMonth())&&(d.getFullYear()==now.getFullYear())){return Loc.today;}else if(d.getFullYear()==now.getFullYear()){return d.formatDate(Loc.dateFormats.shortDate);}else{return d.formatDate(Loc.dateFormats.mediumDate);}};Loc.getRelativeDatetimeString=function(d)
{if(!d)return'';var now=new Date();if((d.getDate()==now.getDate())&&(d.getMonth()==now.getMonth())&&(d.getFullYear()==now.getFullYear())){return String.format(Loc.dateFormats.todayDateAndTime,{'time':d.formatDate(Loc.dateFormats.hourAndMinutes)});}else{return d.formatDate(Loc.dateFormats.mediumDate);}};Loc.getLongDateString=function(inDateObj){return inDateObj?inDateObj.formatDate(Loc.dateFormats.mediumDateAndShortTime):'';};Loc.getExtraLongDateString=function(inDateObj){return inDateObj?inDateObj.formatDate(Loc.dateFormats.longDateAndLongTime):'';};Loc.getDateString=function(inDateObj){return inDateObj?inDateObj.formatDate(Loc.dateFormats.mediumDate):'';};Loc.getTimeString=function(inDateObj){return inDateObj?inDateObj.formatDate(Loc.dateFormats.hourAndMinutes):'';};Loc.getLocalizedHourKey=function(inHours,inOptMinutes){var dt=new Date();dt.setHours(inHours);dt.setMinutes(inOptMinutes||0);return dt.formatDate(Loc.dateFormats[(inOptMinutes&&inOptMinutes>0)?'hourAndMinutes':'hour']);};if(window.loaded)loaded('locUtils.js');

/* widgets.js */

var gAnimate=true;var gDoubleClickDelay=300;function loggedIn(sessionID){dialogManager().mOKCallback();}
var Notifier=Class.createWithSharedInstance('notifier');Notifier.prototype={initialize:function(){bindEventListeners(this,['handleMouseDown']);this.mTimeout=8000;this.mElement=Builder.node('div',{id:'system_message',style:(IEFixes.isIE6?"position:absolute;top:0;float:right;filter:alpha(opacity='70');display:none":'display:none')});d.body.appendChild(this.mElement);if(arguments.length>0)Object.extend(this,arguments[0]);var results=d.cookie.match(/notify=([^;]+)/);if(results){var callback=function(){this.mTimer=null;this.print(results[1]);}
this.mTimer=setTimeout(callback.bind(this),1000);d.cookie='notify=; path=/';}},print:function(inStr){if(typeof(Loc)!='undefined')inStr=((Loc&&Loc[inStr])?Loc[inStr]:inStr);removeAllChildNodes(this.mElement);this.mElement.appendChild(d.createTextNode(inStr));if(gAnimate){if(this.mEffect)this.mEffect.cancel();this.mEffect=new Effect.Appear(this.mElement);}
else{Element.show(this.mElement);}
if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.hide.bind(this),this.mTimeout);observeEvents(this,d,{mousedown:'handleMouseDown'});if(window.unitTestHandler)unitTestHandler.messageFromJS_(inStr);},printAtPage:function(inStr,inPage){d.cookie='notify='+inStr+'; path=/';if(inPage){if(SafariFixes.isWebKit){var a=Builder.node('a',{href:inPage,display:'none'});d.body.appendChild(a);var evt=document.createEvent('MouseEvents');evt.initEvent('click',true,true);a.dispatchEvent(evt);}
else{location.href=inPage;}}
else{location.reload(true);}},hide:function(){var inFade=(arguments.length>0?arguments[0]:gAnimate);Event.stopObserving(d,'mousedown',this.handleMouseDown);if(this.mEffect)this.mEffect.cancel();if(inFade){this.mEffect=new Effect.Fade(this.mElement);}
else{Element.hide(this.mElement);}
this.mTimer=null;},handleMouseDown:function(e){if(this.mTimer)clearTimeout(this.mTimer);this.hide(false);}}
var TooltipManager=Class.createWithSharedInstance('tooltipManager',true);TooltipManager.prototype={mShowTimeout:2000,mHideTimeout:20000,mEnabled:true,initialize:function(){bindEventListeners(this,['handleMouseDown','handleMouseOver','handleMouseOut']);},show:function(inElement,inValues){this.mElement=$(inElement);var prefix=this.mElement.id+'_';this.mPopulatedKeys=[];for(var key in inValues){if($(prefix+key)){this.mPopulatedKeys.push(prefix+key);replaceElementContents(prefix+key,(inValues[key].constructor==Function?inValues[key]():inValues[key])||'');}}
this.mElement.style.visibility='hidden';Element.show(inElement);var leftPos=Math.min(this.mPos[0],d.viewport.getWidth()-this.mElement.offsetWidth-8);var topPos=Math.min(this.mPos[1],d.viewport.getHeight()-this.mElement.offsetHeight-8);Element.hide(inElement);Element.setStyle(inElement,{left:leftPos+'px',top:topPos+'px',visibility:''});this.mEffect=new Effect.Appear(inElement,{duration:0.5});if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.hide.bind(this),this.mHideTimeout);observeEvents(this,d,{mousedown:'handleMouseDown'});},hide:function(){var afterFinish=function(){this.mPopulatedKeys.each(function(key){replaceElementContents(key,"\u00A0");});}.bind(this);var inFade=(arguments.length>0?arguments[0]:gAnimate);Event.stopObserving(d,'mousedown',this.handleMouseDown);if(this.mActiveElement)Event.stopObserving(this.mActiveElement,'mouseout',this.handleMouseOut);this.mActiveElement=null;if(this.mEffect)this.mEffect.cancel();if(inFade&&this.mElement){this.mEffect=new Effect.Fade(this.mElement,{from:0.9,afterFinish:afterFinish});}
else if(this.mElement){Element.hide(this.mElement);afterFinish();}
if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=null;},handleMouseDown:function(e){this.mActiveElement=null;if(this.mTimer)clearTimeout(this.mTimer);this.hide(false)},handleMouseOver:function(e){if(this.mEnabled){this.mPos=new Array(Event.pointerX(e)+2,Event.pointerY(e)+10);this.mActiveElement=Event.element(e);while(this.mActiveElement.parentNode&&!this.mActiveElement.tooltipElement){this.mActiveElement=$(this.mActiveElement.parentNode);}
if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.getValues.bind(this),this.mShowTimeout);observeEvents(this,this.mActiveElement,{mouseout:'handleMouseOut'});}},handleMouseOut:function(e){if(this.mTimer)clearTimeout(this.mTimer);try{this.hide(false)}
catch(e){}},observe:function(inElement){observeEvents(this,inElement,{mouseover:'handleMouseOver'});},stopObserving:function(inElement){if(this.mActiveElement==inElement){this.hide(false);if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=null;this.mActiveElement=null;}
Event.stopObserving(inElement,'mouseover',this.handleMouseOver);},getValues:function(){if(this.mActiveElement&&this.mActiveElement.tooltipValues){this.show(this.mActiveElement.tooltipElement,this.mActiveElement.tooltipValues);}
else if(this.mActiveElement&&this.mActiveElement.tooltipCallback){this.mActiveElement.tooltipCallback(this.mActiveElement);}}}
var ModalDialogManager=Class.createWithSharedInstance('dialogManager');ModalDialogManager.prototype={mSlideFromElement:null,mProgressMessageDelay:700,mProgressMessageHideDelay:850,initialize:function(){bindEventListeners(this,['handleKeyPress','handleCancelClick','handleOKClick','handleDialogMouseDown','handleDialogDrag','handleDialogEndDrag']);if($('dialog_mask')){this.mMaskWidget=$('dialog_mask');}else{this.mMaskWidget=Builder.node('div',{id:'dialog_mask',style:(IEFixes.isIE6?"position:absolute;top:0;left:0;width:100%;filter:alpha(opacity='50');display:none":'display:none')});d.body.appendChild(this.mMaskWidget);}
if(arguments.length>0)Object.extend(this,arguments[0]);},drawDialog:function(inID,inFields,inOKTitle,inOptFormAction){var tbody=Builder.node('tbody');var dialog=Builder.node('div',{id:inID,className:'dialog',style:'display:none','role':'dialog'},[Builder.node('div',{className:'dialog_contents'},[Builder.node('form',{id:inID+'_form',method:(inOptFormAction?'post':'get'),action:inOptFormAction||'#',enctype:(inOptFormAction?'multipart/form-data':'application/x-www-form-urlencoded'),target:(inOptFormAction?'image_upload_iframe':'_self')},[Builder.node('table',[Builder.node('thead',[Builder.node('tr',[Builder.node('td',{colSpan:'2'},(Loc[inID+'_header']||''))])]),tbody])])])]);for(index=0;index<inFields.length;index++){var field=inFields[index];var td=Builder.node('td');var labelText=Loc[field.label]||field.label;var label=Builder.node('label',labelText);var headerArgs=(labelText==''?{className:'dialog_empty_header'}:{});if((field.label||field.label=='')&&field.contents){tbody.appendChild(Builder.node('tr',[Builder.node('th',headerArgs,label),td]));replaceElementContents(td,field.contents,true);if(field.id)td.id=field.id;var inputs=td.getElementsByTagName('input');if(inputs.length)label.setAttribute('for',inputs.item(0).getAttribute('id'));}
else{var fieldValue=field.contents||field;Element.addClassName(td,'dialog_description');td.colSpan='2';if(field.id)td.id=field.id;tbody.appendChild(Builder.node('tr',[td]));replaceElementContents(td,Loc[fieldValue]||fieldValue,field.contents);}}
tbody.appendChild(Builder.node('tr',[Builder.node('td',{colSpan:'2',className:'form_buttons'},[Builder.node('div',{className:'submit'},[Builder.node('input',{type:'submit',className:'primaryaction',id:inID+'_ok',value:(Loc[inOKTitle]||inOKTitle),name:'ok_button'}),Builder.node('input',{type:'button',className:'secondaryaction',id:inID+'_cancel',value:Loc.cancel,name:'cancel_button'})])])]));d.body.appendChild(dialog);if(!inOptFormAction)$(inID+'_form').onsubmit=invalidate;return dialog;},focus:function(){if(this.mFocusField){if(this.mFocusField.activate)this.mFocusField.activate();}
else{var inputs=this.mActiveElement.getElementsByTagName('input');$A(inputs).detect(function(elm){if(elm.type&&elm.focus&&(elm.type.toLowerCase()=='text'||elm.type.toLowerCase()=='search')&&(!Element.hasClassName(elm,'search_field'))&&(!elm.disabled)){$(elm).activate();return true;}
return false;});}
if(window.unitTestHandler)unitTestHandler.messageFromJS_('dialog');publisher().publish('DIALOG_FOCUS',this.mActiveElement);},prepareToShow:function(inElement,inCancelCallback,inOKCallback,inOptSlideFrom,inOptShowSpinner,inOptFocusField,inOptAllowSubmission){this.hide();this.mShowSpinner=inOptShowSpinner;this.mFocusField=$(inOptFocusField);this.mAllowSubmission=inOptAllowSubmission;inOptSlideFrom=inOptSlideFrom||this.mSlideFromElement;this.mActiveParent=(inOptSlideFrom?$(inOptSlideFrom):null);if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}
this.mActiveElement=$(inElement);this.mCancelCallback=inCancelCallback;this.mOKCallback=inOKCallback;if(IEFixes.isIE6)this.mMaskWidget.style.height=(d.viewport.getHeight()+d.viewport.getScrollOffsets().top)+'px';publisher().publish('DIALOG_WILL_SHOW',this.mActiveElement);Element.show(this.mMaskWidget);},finishShowing:function(){this.mCancelElement=$(this.mActiveElement.id+'_cancel');if(this.mCancelElement){Event.observe(this.mCancelElement,'click',this.handleCancelClick);}
Event.observe(d,'keydown',this.handleKeyPress);this.mFormElement=$(this.mActiveElement.id+'_form');if(this.mFormElement){if(SafariFixes.isWebKit&&(this.mFormElement.enctype=='multipart/form-data')&&$(this.mActiveElement.id+'_ok')){$(this.mActiveElement.id+'_ok').type='button';this.mObservingInfo={elm:this.mActiveElement.id+'_ok',evt:'click'};Event.observe(this.mActiveElement.id+'_ok','click',this.handleOKClick);}
else{this.mObservingInfo={elm:this.mFormElement,evt:'submit'};Event.observe(this.mFormElement,'submit',this.handleOKClick);}}
if(this.mCancelElement)this.mCancelElement.disabled=false;if($(this.mActiveElement.id+'_ok'))$(this.mActiveElement.id+'_ok').disabled=false;Event.observe(this.mActiveElement,'mousedown',this.handleDialogMouseDown);},show:function(inElement,inCancelCallback,inOKCallback,inOptSlideFrom,inOptShowSpinner,inOptFocusField,inOptAllowSubmission){this.prepareToShow(inElement,inCancelCallback,inOKCallback,inOptSlideFrom,inOptShowSpinner,inOptFocusField,inOptAllowSubmission);if(this.mActiveParent&&(inElement!=this.mProgressElement)){window.scrollTo(0,0);this.mActiveElement.style.height='';Element.setStyle(this.mActiveParent,{position:'relative',zIndex:'504'});Element.addClassName(this.mActiveParent,'dialog_parent');this.mActiveElement.style.visibility='hidden';Element.show(this.mActiveElement);var cloneOptions={setWidth:false,setHeight:false,offsetLeft:(this.mActiveParent.offsetWidth/2)-(this.mActiveElement.offsetWidth/2),offsetTop:Element.getHeight(this.mActiveParent)};Position.clone(this.mActiveParent,this.mActiveElement,cloneOptions);}
else{this.mActiveElement.style.visibility='hidden';Element.show(this.mActiveElement);var elementBounds=offsetBoundsForDiv(this.mActiveElement.down('table')||this.mActiveElement);var leftd=((window.innerWidth||d.body.offsetWidth)/2)-(elementBounds[2]/2);var topd=((window.innerHeight||d.documentElement.offsetHeight)/3)-(elementBounds[3]/2);leftd=Math.max(leftd,0);topd=Math.max(topd,0)+d.viewport.getScrollOffsets().top;this.mActiveElement.style.left=leftd+'px';this.mActiveElement.style.top=topd+'px';}
if(MozillaFixes.isGecko)this.mActiveElement.style.position='fixed';Element.hide(this.mActiveElement);this.mActiveElement.style.visibility='visible';this.mEffect=new Effect.Appear(this.mActiveElement,{duration:0.3,afterFinish:this.focus.bind(this)});if(IEFixes.isIE){Element.setStyle(this.mMaskWidget,{width:d.body.offsetWidth+'px',height:d.documentElement.offsetHeight+'px'});}
this.finishShowing();},handleDialogMouseDown:function(inEvent){if(inEvent.findElement('thead')||inEvent.findElement('h2')){if(Element.hasClassName(inEvent.findElement('table'),'tableEditor')){return;}else if(inEvent.findElement('h2')&&!inEvent.findElement('h2').up('div.dialog').id=='tableDialog'){return;}
Event.stop(inEvent);this.mDragPos=[inEvent.pointerX(),inEvent.pointerY()];observeEvents(this,d,{mousemove:'handleDialogDrag',mouseup:'handleDialogEndDrag'});}},handleDialogDrag:function(inEvent){Event.stop(inEvent);this.mActiveElement.style.left=(parseFloat(this.mActiveElement.style.left)+(inEvent.pointerX()-this.mDragPos[0]))+'px';this.mActiveElement.style.top=(parseFloat(this.mActiveElement.style.top)+(inEvent.pointerY()-this.mDragPos[1]))+'px';this.mDragPos=[inEvent.pointerX(),inEvent.pointerY()];return false;},handleDialogEndDrag:function(inEvent){stopObservingEvents(this,d,{mousemove:'handleDialogDrag',mouseup:'handleDialogEndDrag'});},showProgressMessage:function(inMessage,inOptShowProgressBar,inOptCancelCallback){dialogManager().showingProgressMessage=true;if(!this.mProgressElement){this.mProgressElement=this.drawDialog('progress_message_dialog',[{id:'progress_spinner',contents:"<span>\u00A0</span>"},{id:'progress_message',contents:"\u00A0"}],'cancel');$('progress_message_dialog_ok').remove();}
if(inOptShowProgressBar){Element.removeClassName(this.mProgressElement,'indeterminate');this.mProgressBar=Builder.node('div',{className:'progress_bar'},[Builder.node('div',{style:'width:0'},"\u00A0")]);replaceElementContents(this.mProgressElement.down('thead td'),Loc[inMessage]||inMessage);replaceElementContents('progress_message',this.mProgressBar);}
else{replaceElementContents('progress_message',(Loc[inMessage]||inMessage));Element.addClassName(this.mProgressElement,'indeterminate');removeAllChildNodes(this.mProgressElement.down('thead td'));}
this.hide(null,true);this.mTimer=setTimeout(function(){if(this.mHideDelayTimer){clearTimeout(this.mHideDelayTimer);delete this.mHideDelayTimer;}
this.mHideDelayTimer=setTimeout(function(){delete this.mHideDelayTimer;if(this.mShouldHideLater){this.mShouldHideLater=false;this.hideProgressMessage();}}.bind(this),this.mProgressMessageHideDelay);this.show(this.mProgressElement,inOptCancelCallback,invalidate);}.bind(this),this.mProgressMessageDelay);delete dialogManager().showingProgressMessage;},hide:function(inOptElement,inPerformFakeHide){if(!this.mTargeted)targetedDialogManager().hide(inOptElement,inPerformFakeHide);if(this.mObservingInfo){Event.stopObserving(this.mObservingInfo.elm,this.mObservingInfo.evt,this.handleOKClick);delete this.mObservingInfo;}
if(SafariFixes.isWebKit&&this.mProgressElement&&(this.mActiveElement==this.mProgressElement)){$$('div.dialog').each(function(dialogDiv){if(dialogDiv.style.visibility=='hidden'){Element.hide(dialogDiv);dialogDiv.style.visibility='';}});}
if(inOptElement&&(this.mActiveElement!=inOptElement))return false;if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}
Event.stopObserving(d,'keydown',this.handleKeyPress);if(this.mCancelElement){if(this.mShowSpinner)this.mCancelElement.disabled=false;Event.stopObserving(this.mCancelElement,'click',this.handleCancelClick);delete this.mCancelElement;}
if(this.mShowSpinner){$(this.mActiveElement.id+'_ok').disabled=false;$A(this.mActiveElement.getElementsByClassName('dialog_progress_row')).invoke('removeClassName','dialog_progress_row');this.mShowSpinner=false;}
if(this.mActiveElement){Event.stopObserving(this.mActiveElement,'mousedown',this.handleDialogMouseDown);if(this.mEffect)this.mEffect.cancel();var elementForm=$(this.mActiveElement).down('form');if(SafariFixes.isWebKit&&dialogManager().showingProgressMessage&&elementForm&&elementForm.method=='post'){this.mActiveElement.style.visibility='hidden';}
else{Element.hide(this.mActiveElement);}
Element.hide(this.mMaskWidget);publisher().publish('DIALOG_HIDDEN',this.mActiveElement);delete this.mActiveElement;}
if(this.mActiveParent){Element.setStyle(this.mActiveParent,{position:'',zIndex:''});Element.removeClassName(this.mActiveParent,'dialog_parent');}},shakeDialog:function(){var element=$(this.mActiveElement);element=$(element);var oldStyle={left:element.getStyle('left')};return new Effect.Move(element,{x:10,y:0,duration:0.05,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:20,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-20,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:20,y:0,duration:0.1,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-10,y:0,duration:0.05,afterFinishInternal:function(effect){effect.element.setStyle(oldStyle);}})}})}})}})}})}});},willResize:function(){if(!this.mActiveElement)return;var contentsTable=this.mActiveElement.down('table');this.mOldStyles={top:parseInt(this.mActiveElement.style.top),left:parseInt(this.mActiveElement.style.left),width:this.mActiveElement.getWidth(),height:this.mActiveElement.getHeight()};if(contentsTable){this.mOldStyles.tableWidth=contentsTable.getWidth();this.mOldStyles.tableHeight=contentsTable.getHeight();}
this.mActiveElement.setStyle({left:'0',top:'0'});},didResize:function(){if(!this.mActiveElement)return;if(!this.mOldStyles)return;Element.setOffsetWidth(this.mActiveElement,this.mActiveElement.getWidth());Element.setOffsetHeight(this.mActiveElement,this.mActiveElement.getHeight());var changedWidth=parseInt(this.mActiveElement.style.width);var changedHeight=parseInt(this.mActiveElement.style.height);var contentsTable=this.mActiveElement.down('table');var changedTableWidth=0;var changedTableHeight=0;if(contentsTable&&this.mOldStyles.tableWidth){Element.setOffsetWidth(contentsTable,contentsTable.getWidth());Element.setOffsetHeight(contentsTable,contentsTable.getHeight());changedTableWidth=parseInt(contentsTable.style.width);changedTableHeight=parseInt(contentsTable.style.height);}
this.mActiveElement.setStyle({left:this.mOldStyles.left+'px',top:this.mOldStyles.top+'px'});if(contentsTable&&this.mOldStyles.tableWidth){Element.setOffsetWidth(contentsTable,this.mOldStyles.tableWidth);Element.setOffsetHeight(contentsTable,this.mOldStyles.tableHeight);}
Element.setOffsetWidth(this.mActiveElement,this.mOldStyles.width);Element.setOffsetHeight(this.mActiveElement,this.mOldStyles.height);var delta=changedWidth-parseInt(this.mActiveElement.style.width);var changedLeft=Math.round(this.mOldStyles.left-(delta/2));changedLeft=Math.max(Math.min(changedLeft,d.viewport.getWidth()-changedWidth-30),10);var resizedStyleString='left:'+changedLeft+'px;width:'+changedWidth+'px;height:'+changedHeight+'px';if(this.mResizeEffect)this.mResizeEffect.cancel();var effects=$A([new Effect.Morph(this.mActiveElement,{style:resizedStyleString})]);if(contentsTable){effects.push(new Effect.Morph(contentsTable,{style:'width:'+changedTableWidth+'px;height:'+changedTableHeight+'px'}));}
this.mResizeEffect=new Effect.Parallel(effects,{duration:0.20,afterFinish:function(eff){this.mActiveElement.setStyle({width:'',height:''});if(contentsTable)contentsTable.setStyle({width:'',height:''});}.bind(this)});delete this.mOldStyles;},hideProgressMessage:function(){if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}
if(this.mActiveElement==this.mProgressElement){if(this.mHideDelayTimer){this.mShouldHideLater=true;}
else{this.hide();}}},handleKeyPress:function(inEvent){if(inEvent.keyCode==Event.KEY_ESC){this.handleCancelClick(inEvent);}},handleCancelClick:function(inEvent){this.hide();if(this.mCancelCallback)this.mCancelCallback();},handleOKClick:function(inEvent){var elm=Event.element(inEvent);if(!this.mAllowSubmission)Event.stop(inEvent);if(elm&&elm.type&&elm.form&&(elm.type=='button')&&this.mAllowSubmission)elm.form.submit();if(this.mShowSpinner){if(this.mCancelElement)this.mCancelElement.disabled=true;$(this.mActiveElement.id+'_ok').disabled=true;$A(this.mActiveElement.getElementsByClassName('form_buttons')).invoke('addClassName','dialog_progress_row');}
else{this.hide();}
if(this.mOKCallback)this.mOKCallback();if(!this.mAllowSubmission)return false;}}
var TargetedDialogManager=Class.createWithSharedInstance('targetedDialogManager');Object.extend(Object.extend(TargetedDialogManager.prototype,ModalDialogManager.prototype),{mTargeted:true,show:function(inElement,inCancelCallback,inOKCallback,inSlideFrom,inOptShowSpinner,inOptFocusField,inOptAllowSubmission){this.prepareToShow(inElement,inCancelCallback,inOKCallback,inSlideFrom,inOptShowSpinner,inOptFocusField,inOptAllowSubmission);Element.addClassName(this.mActiveElement,'targeted_dialog');if(MozillaFixes.isGecko)this.mActiveElement.style.position='fixed';this.mActiveElement.style.visibility='hidden';Element.show(this.mActiveElement);Element.setStyle(this.mActiveElement,{width:'',height:''});var origSize=Element.getInvisibleSize(this.mActiveElement);if(IEFixes.isIE&&$('toolbars')&&Element.descendantOf(inSlideFrom,'toolbars'))Position.absolutize('toolbars');var editorElement=$('editable_content');if(editorElement&&editorElement.tagName.toLowerCase()=='iframe'&&editorElement.contentWindow&&editorElement.contentWindow.document.body&&Element.descendantOf(inSlideFrom,editorElement.contentWindow.document.body)){Position.clone(editorElement,this.mActiveElement,{limitWithScrollbars:true});if(IEFixes.isIE&&$('toolbars')&&Element.descendantOf(inSlideFrom,'toolbars'))Position.relativize('toolbars');var clonedSize=Element.getInvisibleSize(this.mActiveElement);Element.setStyle(this.mActiveElement,{width:Math.min(origSize[0],clonedSize[0])+'px',height:Math.min(origSize[1],clonedSize[1])+'px'});var originalTop=parseInt(this.mActiveElement.style.top);var originalLeft=parseInt(this.mActiveElement.style.left);var top=originalTop+inSlideFrom.offsetTop-window.frames['editable_content'].scrollY;var left=originalLeft+inSlideFrom.offsetLeft;if(top<originalTop){top=originalTop;}else if(top+this.mActiveElement.getHeight()>originalTop+editorElement.getHeight()){top=originalTop+editorElement.getHeight()-this.mActiveElement.getHeight();}
this.mActiveElement.style.top=top+'px';this.mActiveElement.style.left=left+'px';}else{Position.clone(inSlideFrom,this.mActiveElement,{limitWithScrollbars:true});if(IEFixes.isIE&&$('toolbars')&&Element.descendantOf(inSlideFrom,'toolbars'))Position.relativize('toolbars');var clonedSize=Element.getInvisibleSize(this.mActiveElement);Element.setStyle(this.mActiveElement,{width:Math.min(origSize[0],clonedSize[0])+'px',height:Math.min(origSize[1],clonedSize[1])+'px'});}
var diffs=[this.mActiveElement.offsetWidth-parseInt(this.mActiveElement.style.width),this.mActiveElement.offsetHeight-parseInt(this.mActiveElement.style.height)];origSize[0]-=diffs[0];origSize[1]-=diffs[1];Element.hide(this.mActiveElement);this.mActiveElement.style.visibility='';var leftOffset1='';var leftOffset2='';if(parseInt(this.mActiveElement.style.left)>(d.viewport.getWidth()/2)){this.mActiveElement.style.left=(parseInt(this.mActiveElement.style.left)-6)+'px';var leftOffset=parseInt(this.mActiveElement.style.left)+parseInt(this.mActiveElement.style.width)-origSize[0]-diffs[0]-diffs[0];leftOffset1='left:'+(leftOffset-13)+'px;';leftOffset2='left:'+leftOffset+'px;';}
else{this.mActiveElement.style.left=(parseInt(this.mActiveElement.style.left)+6)+'px';}
var topOffset1='';var topOffset2='';if(parseInt(this.mActiveElement.style.top)>(d.viewport.getHeight()/2)){this.mActiveElement.style.top=(parseInt(this.mActiveElement.style.top)-6)+'px';var topOffset=parseInt(this.mActiveElement.style.top)+parseInt(this.mActiveElement.style.height)-origSize[1]-diffs[1];topOffset1='top:'+(topOffset-13)+'px;';topOffset2='top:'+topOffset+'px;';}
else{this.mActiveElement.style.top=(parseInt(this.mActiveElement.style.top)+6)+'px';}
Element.show(this.mActiveElement);this.mEffect=new Effect.Morph(inElement,{style:leftOffset1+topOffset1+'width:'+(origSize[0]+13)+'px;height:'+(origSize[1]+13)+'px',duration:0.14,afterFinish:function(eff){new Effect.Morph(eff.element,{style:leftOffset2+topOffset2+'width:'+origSize[0]+'px;height:'+origSize[1]+'px',duration:0.08,afterFinish:function(eff){eff.element.style.width='';eff.element.style.height='';this.focus();}.bind(this)});}.bind(this)});this.finishShowing();}});var NiftyDatePicker=Class.create();NiftyDatePicker.prototype={mSelectedDate:new Date(),mShownDate:new Date(),mDateLinks:$A([]),mStartWeekday:0,mEnabled:true,initialize:function(){bindEventListeners(this,['handleParentElementClick','handleWindowClick','handleMonthSkipButtonClick','handleDateCellClick']);this.mParentDateFormat=Loc.dateFormats.mediumDate;if(arguments.length>0)Object.extend(this,arguments[0]);if(this.mElement)this.mElement=$(this.mElement);if(!this.mElement){this.mElement=Builder.node('div',{className:'niftydate_popup',style:'visibility:hidden'});d.body.appendChild(this.mElement);}
if(!this.mElement.id){this.mElement.id='niftydate_'+Math.floor(Math.random()*1000000);}
Element.addClassName(this.mElement,'niftydate');replaceElementContents(this.mElement,Builder.node('h2',[Builder.node('a',{href:'#',className:'niftydate_prev_month'},'<'),Builder.node('span',{className:'niftydate_header'},this.mShownDate.formatDate(Loc.dateFormats.longMonthAndYear)),Builder.node('a',{href:'#',className:'niftydate_next_month'},'>')]));var calendarHeaderElm=Builder.node('ul',{className:'niftydate_headers'});this.mElement.appendChild(calendarHeaderElm);for(var i=0;i<7;i++){calendarHeaderElm.appendChild(Builder.node('li',"\u00A0"));}
this.drawWeekdayHeaders();this.mHeaderBlockSpacer=new BlockSpacer(calendarHeaderElm,this.mElement);var calendarDaysElm=Builder.node('ul',{className:'niftydate_days'});for(var weekday=0;weekday<7;weekday++){calendarDaysElm.appendChild(Builder.node('li',{className:(weekday==0?'niftydate_column niftydate_first_column':'niftydate_column')}));}
this.mElement.appendChild(calendarDaysElm);this.setShownDate(this.mShownDate);this.mCellBlockSpacer=new BlockSpacer(calendarDaysElm,this.mElement);var width=calendarDaysElm.down('ul').offsetWidth;$$('#'+this.mElement.id+' ul.niftydate_days ul li').each(function(li){li.style.lineHeight=width+'px';});$$('#'+this.mElement.id+' .niftydate_prev_month_cells').invoke('hide');$$('#'+this.mElement.id+' .niftydate_next_month_cells').invoke('hide');Event.observe(this.mElement.down('a.niftydate_prev_month'),'click',this.handleMonthSkipButtonClick);Event.observe(this.mElement.down('a.niftydate_next_month'),'click',this.handleMonthSkipButtonClick);if(this.mParentElement)Event.observe(this.mParentElement,'click',this.handleParentElementClick);if(this.mParentElement)replaceElementContents(this.mParentElement,this.mSelectedDate.formatDate(this.mParentDateFormat));publisher().subscribe(this.handleOtherDatePickerShown.bind(this),'DATE_PICKER_SHOWN');},drawWeekdayHeaders:function(){var calendarHeaderElm=this.mElement.down('ul.niftydate_headers');$$('#'+this.mElement.id+' ul.niftydate_headers li').each(function(li,i){replaceElementContents(li,Loc.weekdays[(this.mStartWeekday+i)%7]);},this);},handleParentElementClick:function(inEvent){Event.stop(inEvent);this.show();return false;},handleWindowClick:function(inEvent){if(!Position.within(this.mElement,Event.pointerX(inEvent),Event.pointerY(inEvent)))this.hide();},handleOtherDatePickerShown:function(inMessage,inObject,inUserInfo){if(inObject!=this)this.hide();},show:function(){if(!this.mParentElement)return;Position.clone(this.mParentElement,this.mElement,{setWidth:false,setHeight:false});Element.show(this.mElement);Event.observe(window,'click',this.handleWindowClick);publisher().publish('DATE_PICKER_SHOWN',this);},hide:function(){if(!this.mParentElement)return;Event.stopObserving(window,'click',this.handleWindowClick);Element.hide(this.mElement);},setShownDate:function(inNewShownDate){var dt=new Date(inNewShownDate.getTime());dt.setDate(1);dt.setDate(1-(dt.getDay()-this.mStartWeekday));if(1<dt.getDate()&&dt.getDate()<8){dt.setDate(dt.getDate()-7);}
var cellHeight=$$('#'+this.mElement.id+' ul.niftydate_days li')[0].offsetWidth;if(cellHeight==0)cellHeight=$$('#'+this.mElement.id+' ul.niftydate_headers li')[0].offsetWidth;var isFirstSetup=$$('#'+this.mElement.id+' ul.niftydate_days li ul').length<=0;var direction=(inNewShownDate>this.mShownDate)?1:(-1);var columns=$$('#'+this.mElement.id+' li.niftydate_column');var oldDateLists=$$('#'+this.mElement.id+' li.niftydate_column ul');var dateLists=$R(0,6).collect(function(i){var ul=Builder.node('ul',{className:(isFirstSetup?'':'animatedheight')});if(isFirstSetup||direction==1){columns[i].appendChild(ul);}
else{insertAtBeginning(ul,columns[i]);}
return ul;});var now=new Date();var todayDateISO=parseInt(dateObjToISO8601(now));var selectedDateISO=parseInt(dateObjToISO8601(this.mSelectedDate));for(var i=0;i<(7*6);i++){var dtISO=parseInt(dateObjToISO8601(dt));var li=Builder.node('li',{style:'line-height:'+cellHeight+'px'},[Builder.node('a',{href:'#',className:'niftydate_datecell_'+dtISO},''+dt.getDate())]);Event.observe(li.down('a'),'click',this.handleDateCellClick);if(dt.getMonth()!=inNewShownDate.getMonth()){Element.addClassName(li,'niftydate_other_month')}
else if(dtISO==todayDateISO){Element.addClassName(li,(dtISO==selectedDateISO?'niftydate_today_selected_date':'niftydate_today'));}
else if(dtISO==selectedDateISO){Element.addClassName(li,'niftydate_selected_date');}
else if(compareDateWeeks(dt,this.mSelectedDate,this.mStartWeekday)){Element.addClassName(li,'niftydate_selected_week');}
dateLists[i%7].appendChild(li);dt.setDate(dt.getDate()+1);}
if(isFirstSetup){var callback=function(){var listHeight=Element.getHeight(dateLists[0]);dateLists.invoke('setStyle',{height:listHeight+'px'});this.mElement.style.height=(Element.getHeight(this.mElement)-1)+'px';dateLists.invoke('addClassName','animatedheight');if(this.mElement.style.visibility=='hidden'){Element.hide(this.mElement);this.mElement.style.visibility='';}}
setTimeout(callback.bind(this),10);}
else{var listHeight=Element.getHeight(dateLists[0]);dateLists.invoke('setStyle',{height:'0'});var callback=function(){oldDateLists.invoke('setStyle',{height:'0'});dateLists.invoke('setStyle',{height:listHeight+'px'});}
setTimeout(callback,10);}
this.mShownDate=inNewShownDate;replaceElementContents(this.mElement.down('span.niftydate_header'),this.mShownDate.formatDate(Loc.dateFormats.longMonthAndYear));this.mDateLinks=$$('#'+this.mElement.id+' ul.niftydate_days a');var cleanupCallback=function(){oldDateLists.each(function(elm){if(elm.parentNode)elm.remove();});this.mDateLinks=$$('#'+this.mElement.id+' ul.niftydate_days a');}
setTimeout(cleanupCallback.bind(this),1100);},setSelectedDate:function(inNewSelectedDate,inOptShouldNotify){var shouldNotify=(inOptShouldNotify!=undefined)?inOptShouldNotify:true;publisher().publish('SELECTED_DATE_WILL_CHANGE',this);if(!inNewSelectedDate){this.mWeekStartDate=new Date(this.mSelectedDate.getTime());this.mWeekStartDate.setDate(this.mWeekStartDate.getDate()-(this.mWeekStartDate.getDay()-this.mStartWeekday));if(parseInt(dateObjToISO8601(this.mWeekStartDate))>parseInt(dateObjToISO8601(this.mSelectedDate))){this.mWeekStartDate.setDate(this.mWeekStartDate.getDate()-7);}
if(shouldNotify)publisher().publish('SELECTED_DATE_CHANGED',this,{selectedDate:this.mSelectedDate,weekStartDate:this.mWeekStartDate,oldSelectedDate:this.mSelectedDate});return;}
if(inNewSelectedDate.getYear()!=this.mShownDate.getYear()||inNewSelectedDate.getMonth()!=this.mShownDate.getMonth()){this.mSelectedDate=inNewSelectedDate;this.setShownDate(new Date(inNewSelectedDate.getTime()));}
var now=new Date();var todayDateISO=parseInt(dateObjToISO8601(now));var selectedDateISO=parseInt(dateObjToISO8601(inNewSelectedDate));var startWeekday=this.mStartWeekday;this.mDateLinks.each(function(a){var dtISO=a.className.match(/niftydate_datecell_(\d{8})/)[1];var dt=createDateObjFromISO8601(dtISO);var li=a.up('li');li.className='';if(dt.getMonth()!=inNewSelectedDate.getMonth()){Element.addClassName(li,'niftydate_other_month')}
else if(dtISO==todayDateISO){Element.addClassName(li,(dtISO==selectedDateISO?'niftydate_today_selected_date':'niftydate_today'));}
else if(dtISO==selectedDateISO){Element.addClassName(li,'niftydate_selected_date');}
else if(compareDateWeeks(dt,inNewSelectedDate,startWeekday)){Element.addClassName(li,'niftydate_selected_week');}});var oldSelectedDate=this.mSelectedDate;this.mSelectedDate=inNewSelectedDate;this.mShownDate=inNewSelectedDate;if(this.mParentElement)replaceElementContents(this.mParentElement,inNewSelectedDate.formatDate(this.mParentDateFormat));this.mWeekStartDate=new Date(inNewSelectedDate.getTime());this.mWeekStartDate.setDate(this.mWeekStartDate.getDate()-(this.mWeekStartDate.getDay()-this.mStartWeekday));if(this.mWeekStartDate>inNewSelectedDate){this.mWeekStartDate.setDate(this.mWeekStartDate.getDate()-7);}
if(shouldNotify)publisher().publish('SELECTED_DATE_CHANGED',this,{selectedDate:new Date(this.mSelectedDate.getTime()),weekStartDate:this.mWeekStartDate,oldSelectedDate:oldSelectedDate});},setStartWeekday:function(inWeekdayInt){this.mStartWeekday=inWeekdayInt;this.drawWeekdayHeaders();this.setShownDate(new Date(this.mShownDate.getTime()));},handleMonthSkipButtonClick:function(inEvent){Event.stop(inEvent);var direction=Element.hasClassName(Event.findElement(inEvent,'a'),'niftydate_prev_month')?(-1):1;var dt=new Date(this.mShownDate.getTime());dt.setMonth(dt.getMonth()+direction);this.setShownDate(dt);return false;},handleDateCellClick:function(inEvent){Event.stop(inEvent);var elm=Event.findElement(inEvent,'a');var dtISO=elm.className.match(/niftydate_datecell_(\d{8})/)[1];var dt=createDateObjFromISO8601(dtISO);this.setSelectedDate(dt);this.hide();return false;},enableParentElement:function(){if(this.mParentElement)Event.observe(this.mParentElement,'click',this.handleParentElementClick);$(this.mParentElement).removeClassName('disabled');this.mEnabled=true;},disableParentElement:function(){if(this.mParentElement)Event.stopObserving(this.mParentElement,'click',this.handleParentElementClick);$(this.mParentElement).addClassName('disabled');this.mEnabled=false;}}
var BlockSpacer=Class.create();BlockSpacer.prototype={initialize:function(inElement,inParent,inOptVertical){this.mElement=$(inElement);this.mParent=inParent.mElement?inParent:$(inParent);this.mVertical=inOptVertical;Element.cleanWhitespace(this.mElement);this.zoomOut();},space:function(inOptTotalSize){if(!this.mElement.offsetParent||(IEFixes.isIE&&this.mElement.offsetWidth==0&&this.mElement.offsetHeight==0)){return false;}
if(this.mParent.mElement){if(!this.mParent.mSpacedBlocks){return false;}
if(this.mVertical){Element.setOffsetHeight(this.mElement,this.mParent.mElement.offsetHeight);}
else{Element.setOffsetWidth(this.mElement,this.mParent.mElement.offsetWidth);}
var nodes=$A(this.mParent.mElement.childNodes);if(nodes.length!=this.mParent.mElement.childNodes.length)return false;$A(this.mElement.childNodes).each(function(elm,i){if(nodes[i]){if(!Element.visible(nodes[i])){Element.hide(elm);}
else if(this.mVertical){Element.show(elm);Element.setOffsetHeight(elm,nodes[i].offsetHeight);}
else{Element.show(elm);Element.setOffsetWidth(elm,nodes[i].offsetWidth);}}}.bind(this));return true;}
if(!this.mSpacedBlocks){this.mSpacedBlocks=[];this.mSkippedBlocks=[];$A(this.mElement.childNodes).each(function(elm){if(elm.className&&Element.hasClassName(elm,'use_content_size')){this.mSkippedBlocks.push(elm);}
else if(elm.nodeName.toLowerCase()=='li'||elm.nodeName.toLowerCase()=='div'){this.mSpacedBlocks.push(elm);}}.bind(this));}
var pos=0;if(this.mVertical){pos=Element.getTop(this.mElement,this.mParent);}
else{pos=Element.getLeft(this.mElement,this.mParent);}
var parentSize=this.mParent[this.mVertical?'offsetHeight':'offsetWidth'];var totalSize=inOptTotalSize?inOptTotalSize:(parentSize-pos);if(!inOptTotalSize)this.mElement.style[this.mVertical?'height':'width']=(totalSize+2)+'px';this.mSkippedBlocks.each(function(elm){totalSize-=elm[this.mVertical?'offsetHeight':'offsetWidth'];}.bind(this));if(this.mZoomedItem>=0){this.mSpacedBlocks.each(function(elm,i){if(i==this.mZoomedItem){elm.style.display='';if(this.mVertical){Element.setOffsetHeight(elm,totalSize);}
else{Element.setOffsetWidth(elm,totalSize);}}
else{elm.style.display='none';}}.bind(this));return true;}
var columnSize=Math.floor(totalSize/this.mSpacedBlocks.length);var remainder=totalSize%this.mSpacedBlocks.length;var r=remainder;this.mSpacedBlocks.each(function(elm){var w=columnSize;if(r>0){w++;r--;}
if(this.mVertical){Element.setOffsetHeight(elm,w);}
else{Element.setOffsetWidth(elm,w);}}.bind(this));if((!this.mVertical)&&totalSize>100&&Math.abs(this.mSpacedBlocks[0].offsetTop-this.mSpacedBlocks.last().offsetTop)>10){this.space(--totalSize);}
return true;},zoomInOnItem:function(inItemIndex){this.mZoomedItem=inItemIndex;this.space();},zoomOut:function(){if(this.mSpacedBlocks)this.mSpacedBlocks.invoke('setStyle',{display:''});this.mZoomedItem=(-1);this.space();}}
var Button=Class.create({initialize:function(element,params)
{var params=arguments[1]||{};if(params.type)this.type=params.type;if(params.options)this.options=params.options;if(params.onExecute)this.onExecute=params.onExecute;if(!this.type)this.type='trigger';if(!this.options)this.options=[];this.element=$(element);this.element.observe('click',this.onElementClick.bind(this));if(params.value===undefined){for(var i=0,n=this.options.length;i<n;i++)
{var key=this.options[i];if(key&&this.hasClassName(key))this._value=key;}}else{this.setValue(params.value);}},onElementClick:function(e)
{e.stop();if(this.hasClassName('disabled'))return;this[this.type]();},onExecute:function()
{},getValue:function()
{return this._value;},setValue:function(value)
{this._value=value;var options=this.options;for(var i=0,n=options.length;i<n;i++)
{var option=options[i];if(option)this.setClassName(option,(option==value));}},hasClassName:function(key)
{return this.element.hasClassName(key);},setClassName:function(key,value)
{this.element[value?'addClassName':'removeClassName'](key);},trigger:function()
{this.onExecute(this);},toggle:function()
{var options=this.options;if(options.length==0)return;var idx=options.indexOf(this.getValue());if(idx==-1)idx=0;idx++;if(idx>=options.length)idx=0;this.setValue(options[idx]);this.onExecute(this);}});var InlineDeleteButton=Class.create();InlineDeleteButton.prototype={initialize:function(inParent,inCallback,optConfirm,optShowPoofs){bindEventListeners(this,['handleParentHover','handleParentOut','handleButtonClick']);this.mParent=$(inParent);this.mCallback=inCallback;this.mConfirm=(optConfirm!==undefined)?optConfirm:true;this.mShowPoofs=(optShowPoofs!==undefined)?optShowPoofs:true;observeEvents(this,this.mParent,{mouseover:'handleParentHover',mouseout:'handleParentOut'});},show:function(){if(!this.mElement){this.mElement=Builder.node('a',{href:'#',className:'inline_delete_button',style:'display:none',title:Loc.tags_remove_tag_dialog_ok},Loc.tags_remove_tag_dialog_ok);this.mElement.onclick=this.handleButtonClick;d.body.appendChild(this.mElement);observeEvents(this,this.mElement,{mouseover:'handleParentHover',mouseout:'handleParentOut'});}
Position.clone(this.mParent,this.mElement,{setWidth:false,setHeight:false,offsetLeft:(-9),offsetTop:(-10)});Element.show(this.mElement);Element.addClassName(this.mParent,'inlinedeletefocus');},hide:function(){Element.hide(this.mElement);Element.removeClassName(this.mParent,'inlinedeletefocus');},handleParentHover:function(inEvent){if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}
this.show();},handleParentOut:function(inEvent){if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}
this.mTimer=setTimeout(this.hide.bind(this),200);},handleButtonClick:function(inEvent){Event.stop(inEvent);if(this.mConfirm){if(!InlineDeleteButton.mConfirmDialog){InlineDeleteButton.mConfirmDialog=dialogManager().drawDialog('tags_remove_tag_dialog',['tags_remove_tag_dialog_description'],'tags_remove_tag_dialog_ok');}
targetedDialogManager().show(InlineDeleteButton.mConfirmDialog,null,this.handleConfirmDialogOK.bind(this),this.mParent);}else{this.handleConfirmDialogOK();}
return false;},handleConfirmDialogOK:function(){var callback=function(){this.hide(false);if(this.mCallback)this.mCallback(this.mParent);}.bind(this);if(this.mShowPoofs)
poof().showOverElement(this.mParent,callback);else
callback();},destroy:function(){Event.stopObserving(this.mParent,'mouseover',this.handleParentHover);Event.stopObserving(this.mParent,'mouseout',this.handleParentOut);if(this.mElement){Event.stopObserving(this.mElement,'mouseover',this.handleParentHover);Event.stopObserving(this.mElement,'mouseout',this.handleParentOut);}}}
var UploadProgressPlaceholder=Class.create();UploadProgressPlaceholder.prototype={mCheckInterval:1000,initialize:function(inElement,inUpdateID,inCallback){if(!UploadProgressPlaceholder.allPlaceholders)UploadProgressPlaceholder.allPlaceholders={};UploadProgressPlaceholder.allPlaceholders[inUpdateID]=this;this.mElement=$(inElement);this.mCallback=inCallback;this.mUpdateID=inUpdateID;if(arguments.length>1)Object.extend(this,arguments[1]);this.mTimer=setTimeout(this.sendUpdateRequest.bind(this),500);},sendUpdateRequest:function(){server().getUploadProgress(this.gotUpdateResponse.bind(this),this.mUpdateID);},gotUpdateResponse:function(q,r){if(!this.mTimer)return false;if(r.done){if(this.mCallback)this.mCallback(this,r);this.destroy();}
else if(SafariFixes.isWebKit&&this.mFrameFinishedLoading){if(this.mCallback)this.mCallback(this,{retry:true});}
else if(this.mFileSizeError||(r.error=='2')){if(this.mCallback)this.mCallback(this,{fileSizeError:true,maxFileSize:r.maxFileSizeInBytes||this.mMaxFileSize});}
else{if(this.mElement&&r['size']&&r.uploaded){if(Element.hasClassName(this.mElement,'progress_bar')){if(gDebug)notifier().print('File upload: '+Math.floor((r.uploaded/r['size'])*100)+'%');this.mElement.firstChild.style.width=((r.uploaded/r['size'])*this.mElement.offsetWidth)+'px';}
else{if(gDebug)notifier().print('File upload: '+Math.floor((r.uploaded/r.size)*100)+'%');var offset=Math.min(Math.floor((r.uploaded/r.size)*10),8)*this.mElement.offsetWidth;this.mElement.style.backgroundPosition=(offset*(-1))+'px 0';}}
else if(this.mElement){if(Element.hasClassName(this.mElement,'progress_bar'))this.mElement.firstChild.style.width='0';else this.mElement.style.backgroundPosition='0 0';}
this.mTimer=setTimeout(this.sendUpdateRequest.bind(this),this.mCheckInterval);}},cancel:function(){if(this.mTimer){clearTimeout(this.mTimer);this.mTimer=null;}},destroy:function(){this.cancel();delete UploadProgressPlaceholder.allPlaceholders[this.mUpdateID];}}
UploadProgressPlaceholder.handleUploadFrameLoad=function(){if(!UploadProgressPlaceholder.allPlaceholders)return true;$H(UploadProgressPlaceholder.allPlaceholders).each(function(ph){ph.value.mFrameFinishedLoading=true;});}
UploadProgressPlaceholder.handleFileSizeError=function(inMaxFileSizeString){if(!UploadProgressPlaceholder.allPlaceholders)return true;$H(UploadProgressPlaceholder.allPlaceholders).each(function(ph){ph.value.mFileSizeError=true;ph.value.mMaxFileSize=inMaxFileSizeString;});}
function addUploadFrame(){if(!$('image_upload_iframe')){d.body.appendChild(Builder.node('iframe',{name:'image_upload_iframe',id:'image_upload_iframe',src:'about:blank',style:'position:absolute;top:0;left:0;width:1px;height:1px;visibility:hidden'}));}
$('image_upload_iframe').show();}
function removeUploadFrame(){if($('image_upload_iframe'))Element.remove('image_upload_iframe');}
var BackgroundAnimator=Class.create();BackgroundAnimator.prototype={initialize:function(inElement,inFrameWidth,inTotalFrames,inFrameTimerLength){this.handleTimerFired=this.handleTimerFired.bind(this);this.mElement=$(inElement);this.mFrameWidth=inFrameWidth;this.mTotalFrames=inTotalFrames;this.mFrameTimerLength=inFrameTimerLength;this.mCurrentFrame=0;},start:function(){this.mElement.style.backgroundPosition='0 0';if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.handleTimerFired,this.mFrameTimerLength);},stop:function(){if(this.mTimer){clearTimeout(this.mTimer);delete this.mTimer;}},handleTimerFired:function(){if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.handleTimerFired,this.mFrameTimerLength);this.mCurrentFrame=(++this.mCurrentFrame%this.mTotalFrames);this.mElement.style.backgroundPosition='-'+(this.mCurrentFrame*this.mFrameWidth)+'px 0';}}
var PoofManager=Class.createWithSharedInstance('poof');PoofManager.prototype={mFrameDelay:100,mWidth:42,mHeight:52,initialize:function(){this.mElement=Builder.node('div',{id:'poof',style:'display:none'},["\u00A0"]);d.body.appendChild(this.mElement);if(arguments.length>0)Object.extend(this,arguments[0]);},showOverElement:function(inElement,inOptFinishedFunc){if(!inElement)return null;var elm=$(inElement);if(!elm)return null;Position.clone(elm,this.mElement,{setWidth:false,setHeight:false,offsetLeft:(elm.offsetWidth/2)-(this.mWidth/2),offsetTop:(elm.offsetHeight/2)-(this.mHeight/2)});this.showAtPoint(null,inOptFinishedFunc);},showAtPoint:function(inPoint,inOptFinishedFunc){if(window.unitTestHandler)unitTestHandler.messageFromJS_('poof');this.mFinishedFunc=inOptFinishedFunc;Element.setStyle(this.mElement,{backgroundPosition:'0px 0px',display:''});if(inPoint)Element.setStyle(this.mElement,{left:inPoint[0]+'px',top:inPoint[1]+'px'});this.mCurrentFrame=0;if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=setTimeout(this.handleTimerFired.bind(this),this.mFrameDelay);},handleTimerFired:function(){if(this.mCurrentFrame<4){this.mCurrentFrame++;var x=this.mCurrentFrame*this.mWidth*(-1);this.mElement.style.backgroundPosition=x+'px 0px';this.mTimer=setTimeout(this.handleTimerFired.bind(this),this.mFrameDelay);}
else{Element.hide(this.mElement);if(this.mFinishedFunc)this.mFinishedFunc();delete this.mTimer;}}}
var ImageThumbnailManager=Class.createWithSharedInstance('imageThumbnailManager',true);ImageThumbnailManager.prototype={mImageThumbnails:[],initialize:function(){this.findThumbnails();},findThumbnails:function(){var thumbnailImages=$$('img.thumbnail');for(var i=0;i<thumbnailImages.length;i++){this.mImageThumbnails.push(new ImageThumbnail(thumbnailImages[i]));}},prepareForEditing:function(){this.mImageThumbnails.each(function(thumb){thumb.destroy();});this.mImageThumbnails=[];}}
var ImageThumbnail=Class.create();ImageThumbnail.prototype={initialize:function(inImage){bindEventListeners(this,['handleShowClick']);this.mImage=$(inImage);parentElm=this.mImage.parentNode;var sizeAnchorMatch=null;this.mFullSrc=this.mImage.getAttribute('longdesc')||this.mImage.getAttribute('name')||this.mImage.getAttribute('alt')||this.mImage.getAttribute('src');if(this.mFullSrc)sizeAnchorMatch=this.mFullSrc.match(/#(\d+)x(\d+)$/);if(sizeAnchorMatch)this.mEndSize=[parseInt(sizeAnchorMatch[1]),parseInt(sizeAnchorMatch[2])];if(this.mImage.getAttribute('alt')&&this.mImage.getAttribute('alt')!=''){this.mImage.setAttribute('title',this.mImage.getAttribute('alt'));}else if(this.mImage.getAttribute('title')&&this.mImage.getAttribute('title')!=''){this.mImage.setAttribute('title','');}
var cell=Builder.node('td');var fullsizeLink=Builder.node('div',{className:'fullsize_link'});this.mTable=Builder.node('table',{className:this.mImage.className,cellspacing:'0',cellpadding:'4'},[Builder.node('tbody',[Builder.node('tr',[cell]),Builder.node('tr',[Builder.node('td',[fullsizeLink,this.mImage.getAttribute('alt')||Loc.image_thumbnail_caption])])])]);parentElm.insertBefore(this.mTable,this.mImage);Element.remove(this.mImage);Element.removeClassName(this.mImage,'thumbnail');cell.appendChild(this.mImage);Event.observe(fullsizeLink,'mousedown',this.handleShowClick);Event.observe(this.mImage,'mousedown',this.handleShowClick);},destroy:function(){this.mImage.className=this.mTable.className;Element.remove(this.mImage);this.mTable.parentNode.insertBefore(this.mImage,this.mTable);Element.remove(this.mTable);Event.stopObserving(this.mImage,'mousedown',this.handleShowClick);this.mImage.name=this.mFullSrc;},handleShowClick:function(inEvent){if(!this.mEndSize)this.mEndSize=[d.viewport.getWidth(),d.viewport.getHeight()];var w=window.open(this.mFullSrc,'applewikiimg'+server().getNextUploadID(),'status=0,toolbar=0,resizable=1,scrollbars=1,width='+this.mEndSize[0]+',height='+this.mEndSize[1]);w.moveTo(0,0);}}
var FavoriteIconsManager=Class.createWithSharedInstance('favoriteIconsManager',true);FavoriteIconsManager.prototype={initialize:function()
{this.icons=$$('.favorite-icon').map(function(element)
{return new FavoriteIcon(element);});}}
var FavoriteIcon=Class.create({initialize:function(element)
{bindEventListeners(this,['onElementClick']);this.element=$(element);if(this.element.hasClassName('active')){this.element.setAttribute('title',Loc.mark_as_not_favorite);}else{this.element.setAttribute('title',Loc.mark_as_favorite);}
this.element.tabindex='0';this.element.role='button';this.element.observe('click',this.onElementClick);this.uid=this.element.getAttribute('name');},onElementClick:function(e)
{e.stop();this.toggle();},toggle:function()
{this.isSelected()?this.deselect():this.select();},select:function()
{this.element.setAttribute('title',Loc.mark_as_not_favorite);this.element.addClassName('active');server().preferences.addUsersFavorite(invalidate,this.uid);publisher().publish('DID_STAR_PAGE',this);},deselect:function()
{this.element.setAttribute('title',Loc.mark_as_favorite);this.element.removeClassName('active');server().preferences.removeUsersFavorite(invalidate,this.uid);publisher().publish('DID_UNSTAR_PAGE',this);},isSelected:function()
{return this.element.hasClassName('active');}});var HintedTextField=Class.create();HintedTextField.prototype={initialize:function(inElement,inHintStr){bindEventListeners(this,['handleFocus','handleBlur']);this.mElement=$(inElement);this.mHintStr=inHintStr;if(!this.getFocusState())this.addHint();observeEvents(this,this.mElement,{focus:'handleFocus',blur:'handleBlur'});},addHint:function(){if(this.mElement.value==''){Element.addClassName(this.mElement,'hinted');this.mElement.value=Loc[this.mHintStr]||this.mHintStr;}},getFocusState:function(){if(window.getSelection){var sel=window.getSelection();if(!sel)return false;return(sel.anchorNode&&Element.descendantOf(this.mElement,sel.anchorNode)||(sel.rangeCount>0&&sel.getRangeAt(0).intersectsNode&&sel.getRangeAt(0).intersectsNode(this.mElement)));}
else if(d.selection&&d.selection.createRange){var rng=d.selection.createRange();if(!rng)return false;return(rng.parentElement()==this.mElement);}
return false;},getValue:function(){return(Element.hasClassName(this.mElement,'hinted')?'':this.mElement.value);},setValue:function(inValue){Element.removeClassName(this.mElement,'hinted');this.mElement.value=inValue;this.addHint();},handleFocus:function(inEvent){if(Element.hasClassName(this.mElement,'hinted')){this.mElement.value='';Element.removeClassName(this.mElement,'hinted');}},handleBlur:function(inEvent){this.addHint();}}
var SearchFieldBase=Class.create();SearchFieldBase.prototype={mClickedItemCallback:null,mStartedItemSearchCallback:null,mSearchCancelledCallback:null,mResultTable:null,mPositionResults:true,mHeaderElement:null,mMinQueryChars:1,mInterval:500,mNumberOfEntries:20,mSortKey:null,mTrapTabs:true,mShowPlaceholderStrings:false,mCaptureReturnChar:true,mSelectOnClick:true,initialize:function(inSearchField){bindEventListeners(this,['handleSafariSearch','handleKeypress','handleChanged','mousedOverUser','mousedOutUser','clickedUser']);this.mSearchField=$(inSearchField);if(arguments.length>1)Object.extend(this,arguments[1]);if(!this.mResultTable){this.mResultTable=Builder.node('table',{className:'search_field_results',style:'display:none'},[Builder.node('tbody')]);d.body.appendChild(this.mResultTable);}
this.mIsReallyTable=(this.mResultTable.nodeName.toLowerCase()=='table');observeEvents(this,this.mSearchField,{keydown:'handleKeypress',change:'handleChanged'});if(SafariFixes.isWebKit&&(this.mSearchField.type=='search'))Event.observe(this.mSearchField,'search',this.handleSafariSearch);},handleSafariSearch:function(e){if(Event.element(e).value=='')this.runQuery();},handleKeypress:function(e){switch(e.keyCode){case Event.KEY_DOWN:this.suggestSibling('nextSibling');Event.stop(e);break;case Event.KEY_UP:this.suggestSibling('previousSibling');Event.stop(e);break;case Event.KEY_TAB:case Event.KEY_RETURN:case 188:if(e.keyCode==Event.KEY_TAB&&this.mSearchField.value=='')return true;if(e.keyCode==Event.KEY_RETURN&&!this.mCaptureReturnChar)return true;this.handleChanged(e);if(e.keyCode==188||this.mTrapTabs)Event.stop(e);break;case Event.KEY_ESC:this.mSearchField.value='';this.mLastQuery=null;this.mRows=null;if(this.mSearchCancelledCallback)this.mSearchCancelledCallback();break;default:if(!this.mTimer)this.mTimer=setTimeout(this.runQuery.bind(this),this.mInterval);}},handleChanged:function(e){if(this.mSearchField.value!=''){this.selectSuggestedUID();Element.hide(this.mResultTable);}},suggestSibling:function(inKey){var elm=$(this.mResultTable.id+'_'+(this.mSuggestedUID||''));if(elm&&elm.parentNode[inKey]){this.suggestUID(elm.parentNode[inKey].firstChild.dataSource.uid);}
else if((!elm)&&inKey=="nextSibling"&&this.mRows&&this.mRows.length>0){this.suggestUID(this.mRows[0].uid);}
else if(inKey=='previousSibling'&&this.mSuggestedUID==this.mRows[0].uid){this.suggestUID(null);}},suggestUID:function(inUID){Element.removeClassName(this.mResultTable.id+'_'+this.mSuggestedUID,'suggested');this.mSuggestedUID=inUID;if(inUID)Element.addClassName(this.mResultTable.id+'_'+inUID,'suggested');},selectSuggestedUID:function(){this.mChosenUID=this.mSuggestedUID;if(this.mChosenUID){var chosenElm=$(this.mResultTable.id+'_'+this.mChosenUID);this.mChosenDataSource=chosenElm.dataSource;if(this.mPositionResults){Element.hide(this.mResultTable);this.mSearchField.value=chosenElm.firstChild.nodeValue;}
if(this.mClickedItemCallback)this.mClickedItemCallback(this.mChosenUID,this.mChosenDataSource.url);}
else if(!Element.hasClassName(this.mSearchField,'hinted')){if(this.mClickedItemCallback)this.mClickedItemCallback($F(this.mSearchField),null);}
if(this.mTimer){clearTimeout(this.mTimer);this.mTimer=null;}},mousedOverUser:function(e){if(this.mSelectOnClick)this.suggestUID(Event.findElement(e,(this.mIsReallyTable?'td':'a')).dataSource.uid);},mousedOutUser:function(e){},clickedUser:function(e){this.suggestUID(Event.findElement(e,(this.mIsReallyTable?'td':'a')).dataSource.uid);if(this.mSelectOnClick)this.selectSuggestedUID();},constructQuery:function(inSearchString){},runQuery:function(){if($F(this.mSearchField)!=this.mLastQuery){this.mSuggestedUID=null;this.mRows=new Array();this.draw();if(this.mShowPlaceholderStrings){replaceElementContents(this.mResultTable,Builder.node('li',{className:'search_placeholder busy_field'},[Builder.node('a',{href:'#',onclick:invalidate},Loc.link_popup_searching_progress)]));}
if(this.mPrefetch||($F(this.mSearchField).length>=this.mMinQueryChars)){Element.addClassName(this.mSearchField,'busy_field');if(this.mStartedItemSearchCallback)this.mStartedItemSearchCallback();this.constructQuery($F(this.mSearchField));}
else{this.mTimer=null;if(this.mSearchCancelledCallback)this.mSearchCancelledCallback();}}
else{this.mTimer=null;}
this.mLastQuery=$F(this.mSearchField);},gotSearchResult:function(inRequestObj,inResponseObj){this.mRows=inResponseObj;if(this.mSortKey)Array.sortArrayUsingKey(this.mRows,this.mSortKey);if(this.mPrefetch&&(!this.mCachedRows)){this.mCachedRows=inResponseObj;Element.removeClassName(this.mSearchField,'busy_field');}
else{this.draw();}
this.mTimer=null;this.runQuery();if(this.mSearchResultCallback)this.mSearchResultCallback(inResponseObj);},handleError:function(inFaultCode,inFaultString){this.mTimer=null;},getDisplayString:function(inRow){},updatePosition:function(){if(this.mPositionResults){var cloneOptions={setHeight:false,offsetTop:Element.getHeight(this.mSearchField)};Position.clone(this.mSearchField,this.mResultTable,cloneOptions);}},draw:function(){this.updatePosition();if(this.mPositionResults)Element.hide(this.mResultTable);if(this.mHeaderElement)Element.hide(this.mHeaderElement);removeAllChildNodes(this.mIsReallyTable?this.mResultTable.firstChild:this.mResultTable);this.mSuggestedUID=null;if(this.mShowPlaceholderStrings&&(this.mRows.length==0)){this.mResultTable.appendChild(Builder.node('li',[Builder.node('a',{href:'#',onclick:invalidate,className:'search_placeholder'},$F('no_results_str'))]));}
this.mRows.each(function(row){row.displayString=this.getDisplayString(row);if(row.displayString!=''){if(this.mPositionResults)Element.show(this.mResultTable);if(this.mHeaderElement)Element.show(this.mHeaderElement);var currentCell=Builder.node((this.mIsReallyTable?'td':'a'),{id:this.mResultTable.id+'_'+row.uid});currentCell.style.cursor='pointer';currentCell.dataSource=row;this.drawCell(currentCell);if(this.mIsReallyTable){this.mResultTable.firstChild.appendChild(Builder.node('tr',[currentCell]));}
else{currentCell.href=row.url;this.mResultTable.appendChild(Builder.node('li',[currentCell]));}
observeEvents(this,currentCell,{click:'clickedUser',mouseover:'mousedOverUser',mouseout:'mousedOutUser'});}}.bind(this));Element.removeClassName(this.mSearchField,'busy_field');},drawCell:function(inCell){replaceElementContents(inCell,inCell.dataSource.displayString);}}
var QuickSearchField=Class.create();Object.extend(Object.extend(QuickSearchField.prototype,SearchFieldBase.prototype),{mCaptureReturnChar:false,getDisplayString:function(inRow){return inRow.title;},constructQuery:function(inSearchString){if(this.mQueryStartCallback)this.mQueryingCallback();return server().search.getEntriesForQuickSearch([this.gotSearchResult.bind(this),this.handleError.bind(this)],inSearchString,uid().mBasePath);}});var TextInputObserver=Class.create({initialize:function(element,options)
{var options=Object.extend({callback:Prototype.emptyFunction,duration:0.5},arguments[1]||{});this.onTimerExecute=this.onTimerExecute.bind(this);this.onValueChange=this.onValueChange.bindAsEventListener(this);this.timer=new PeriodicalExecuter(this.onTimerExecute,options.duration);this.timer.stop();this.element=$(element);this.element.observe('keyup',this.onValueChange);this.element.observe('change',this.onValueChange);if(SafariFixes.isWebKit&&(this.element.type=='search')){this.element.observe('search',this.onValueChange);}
this.callback=options.callback;},onValueChange:function()
{this.timer.stop();this.timer.start();},onTimerExecute:function()
{this.timer.stop();this.callback(this.element.getValue());}});var SizeObserver=Class.create();Object.extend(Object.extend(SizeObserver.prototype,Abstract.TimedObserver.prototype),{getValue:function(){return this.element.offsetHeight;}});var SplitView=Class.create();SplitView.prototype={mMaintainTotalHeight:false,mMinimumHeight:80,mMaximumHeight:10000,mInverseDelta:false,initialize:function(inElement){bindEventListeners(this,['handleMouseDown','handleMouseMove','handleMouseUp']);this.mElement=$(inElement);Element.cleanWhitespace(this.mElement);var nodes=this.mElement.childNodes;if(nodes.length>2)this.mViews=new Array(nodes.item(0),nodes.item(2));this.mSplitter=nodes.item(1);if(arguments.length>1)Object.extend(this,arguments[1]);Event.observe(this.mSplitter,'mousedown',this.handleMouseDown);this.mElement.onselectstart=invalidate;},handleMouseDown:function(e){this.mInitialHeight=parseInt(this.mViews[0].style.height);if(isNaN(this.mInitialHeight))this.mInitialHeight=Element.getHeight(this.mViews[0]);this.mInitialPos=e.clientY;observeEvents(this,d,{mousemove:'handleMouseMove',mouseup:'handleMouseUp'});Event.stop(e);if(this.mStartCallback)this.mStartCallback();},handleMouseMove:function(e){var height=this.mInitialHeight;if(this.mInverseDelta){height-=e.clientY-this.mInitialPos;}
else{height-=this.mInitialPos-e.clientY;}
height=Math.max(height,this.mMinimumHeight);height=Math.min(height,this.mMaximumHeight);if(this.mMaintainTotalHeight){var delta=height-parseInt(this.mViews[0].style.height||''+this.mViews[0].offsetHeight);var otherHeight=parseInt(this.mViews[1].style.height)-delta;if(otherHeight<this.mMinimumHeight){delta=this.mMinimumHeight-otherHeight;height-=delta;otherHeight+=delta;}
this.mViews[1].style.height=otherHeight+'px';}
this.mViews[0].style.height=height+'px';if(this.mDuringCallback)this.mDuringCallback(height);},handleMouseUp:function(e){Event.stopObserving(d,'mousemove',this.handleMouseMove);Event.stopObserving(d,'mouseup',this.handleMouseUp);if(this.mEndCallback)this.mEndCallback();}}
var ViewSprings=Class.create();ViewSprings.prototype={initialize:function(inElement,inOptCallback,inOptOtherElement){this.handleWindowResize=this.handleWindowResize.bindAsEventListener(this);this.mElement=$(inElement);this.mCallback=inOptCallback;if(inOptOtherElement)this.mOtherElement=$(inOptOtherElement);this.boing();Event.observe(window,'resize',this.handleWindowResize);},boing:function(){var h=this.mOtherElement?Math.max(this.mElement.offsetHeight,this.mOtherElement.offsetHeight):this.mElement.offsetHeight;h=d.viewport.getHeight()-(d.body.offsetHeight-h);if(h<300)h=300;this.mElement.style.height=h+'px';var lies=d.body.offsetHeight-d.body.parentNode.scrollHeight;if(lies!=0)this.mElement.style.height=(h+lies)+'px';if(this.mCallback)this.mCallback();},handleWindowResize:function(inEvent){this.boing();},destroy:function(){Event.stopObserving(window,'resize',this.handleWindowResize);}}
var PopupManager=Class.createWithSharedInstance('popupManager');PopupManager.prototype={mHideDelay:350,mShowDuration:0,mHideDuration:0.2,initialize:function(){bindEventListeners(this,['handleMouseOut','handleMouseOver','handleWindowClick','handleWindowKeypress','handleKeyboardFocus']);if(arguments.length>0)Object.extend(this,arguments[0]);},show:function(inParent,inElement,inOptOffset,inFade,inOptCallback){var offsetLeft=0;var offsetTop=inOptOffset||0;if(inOptOffset&&inOptOffset.constructor==Array){offsetLeft=inOptOffset[0];offsetTop=inOptOffset[1];}
var inFade=(arguments.length>3?arguments[3]:gAnimate);this.hide(false);this.clearTimer();this.mActiveParent=$(inParent);this.mActiveElement=$(inElement);this.mCallback=inOptCallback;if(this.mActiveParent){this.mActiveElement.style.position='absolute';var cloneOptions={setWidth:false,setHeight:false,offsetLeft:offsetLeft,offsetTop:offsetTop};Position.clone(this.mActiveParent,this.mActiveElement,cloneOptions);if(IEFixes.isIE){var currentLeft=parseInt(this.mActiveElement.style.left);if(currentLeft<0){this.mActiveElement.style.left=(currentLeft-offsetLeft)+'px';}}
Element.addClassName(this.mActiveParent,'active');}
var bottomOfWindow=d.viewport.getScrollOffsets()[1]+d.viewport.getHeight();var elementTop=parseInt(this.mActiveElement.style.top);this.mActiveElement.style.top='0px';var elementHeight=Element.getInvisibleSize(this.mActiveElement)[1]+40;this.mActiveElement.style.top=Math.max(Math.min(elementTop,(bottomOfWindow-elementHeight)),30)+'px';this.mActiveElement.style.opacity='';if(IEFixes.isIE)this.mActiveElement.style.filter='';Event.observe(this.mActiveParent,'mouseout',this.handleMouseOut);Event.observe(this.mActiveElement,'mouseout',this.handleMouseOut);Event.observe(this.mActiveParent,'mouseover',this.handleMouseOver);Event.observe(this.mActiveElement,'mouseover',this.handleMouseOver);if(inFade){Element.hide(this.mActiveElement);if(this.mEffect)this.mEffect.cancel();this.mEffect=new Effect.Appear(this.mActiveElement,{duration:this.mShowDuration});}
else{Element.show(this.mActiveElement);}
Event.observe(d.body.firstChild,'mousedown',this.handleWindowClick);Event.observe(d,'keypress',this.handleWindowKeypress);},createPopupElement:function(inOptClassName,inOptID){var sClassName='popup';if(inOptClassName)sClassName+=' '+inOptClassName;var elm=Builder.node('ul',{className:sClassName,style:'display:none'});if(inOptID)elm.id=inOptID;d.body.appendChild(elm);return elm;},itemWithTitle:function(inPopup,inTitle,inOptHref,inOptCallback,inOptRel){var a=Builder.node('a',{className:'popuplink',title:'',href:inOptHref||'javascript:void(0);'},[inTitle]);if(inOptRel)a.setAttribute('rel',inOptRel);if(inOptCallback)a.onclick=inOptCallback;var elm=Builder.node('li',[a]);inPopup.appendChild(elm);return a;},divider:function(inPopup){var li=Builder.node('li',{className:'popupDivider'},'\u00A0');inPopup.appendChild(li);return li;},hide:function(){if(this.mEffect)this.mEffect.cancel();if(this.mActiveElement){var inFade=(arguments.length>0?arguments[0]:gAnimate);Event.stopObserving(this.mActiveParent,'mouseout',this.handleMouseOut);Event.stopObserving(this.mActiveElement,'mouseout',this.handleMouseOut);Event.stopObserving(this.mActiveParent,'mouseover',this.handleMouseOver);Event.stopObserving(this.mActiveElement,'mouseover',this.handleMouseOver);if(inFade){this.mEffect=new Effect.Fade(this.mActiveElement,{duration:this.mHideDuration});}
else{Element.hide(this.mActiveElement);}
if(this.mChildManager)this.mChildManager.hide(inFade);Element.removeClassName(this.mActiveParent,'active');this.mActiveParent=null;this.mActiveElement=null;Event.stopObserving(d,'mousedown',this.handleWindowClick);Event.stopObserving(d,'keypress',this.handleWindowKeypress);if(this.mCallback)this.mCallback();}
$$('.popup').each(function(popupElm){popupElm.hide();});},handleMouseOut:function(inEvent){Event.stop(inEvent);this.setTimer();},handleMouseOver:function(inEvent){Event.stop(inEvent);this.clearTimer();},setTimer:function(inDelay){this.clearTimer();this.mTimer=setTimeout(this.handleTimerFired.bind(this),inDelay||this.mHideDelay);},clearTimer:function(){if(this.mTimer)clearTimeout(this.mTimer);this.mTimer=null;},handleTimerFired:function(){this.hide();},handleWindowClick:function(e){var elm=Event.element(e);if(elm&&Element.hasClassName(elm,'popuplink'))return true;this.setTimer(100);},handleWindowKeypress:function(e)
{if(e.keyCode==Event.KEY_ESC){this.setTimer(100);}},handleKeyboardFocus:function(e){}}
var Tabset=Class.create();Tabset.prototype={initialize:function(){if(arguments.length>0)Object.extend(this,arguments[0]);this.tabs=[];this.selectedPanel=null;this.selectedTrigger=null;bindEventListeners(this,['handleClick']);},addTab:function(inID,inLabel,inTabContentNode){this.tabs.push({id:inID,label:inLabel,node:inTabContentNode})},getTabset:function(){var tabsNode=Builder.node('ul');var tabContainerNode=Builder.node('div',{className:'tabpanels'});var tabsetNode=Builder.node('div',{className:'tabgroup'},[Builder.node('div',{className:'tabs'},[tabsNode]),tabContainerNode])
for(var i=0,c=this.tabs.length;i<c;i++){var tab=this.tabs[i];var trigger=Builder.node('a',{href:('#'+tab.id)},[tab.label]);var panel=tab.node;panel.setAttribute('id',tab.id);Element.addClassName(panel,'tabpanel');tabsNode.appendChild(Builder.node('li',{},[trigger]));if(c==1)trigger.style.visibility='hidden';Event.observe(trigger,'click',this.handleClick);tabContainerNode.appendChild(panel);if(!i){this.selectTab(trigger,panel);Element.addClassName(trigger,'first');}else if(i==c-1){Element.addClassName(trigger,'last');}}
return tabsetNode;},handleClick:function(inEvent){Event.stop(inEvent);var trigger=Event.element(inEvent);var panel=$(trigger.getAttribute('href').replace('#',''));this.selectTab(trigger,panel);},selectTab:function(inTrigger,inPanel){inTrigger.blur();inPanel.focus();if(this.selectedTrigger==inTrigger)return;Element.removeClassName(this.selectedTrigger,'selected');Element.removeClassName(this.selectedPanel,'tabpanelselected');Element.addClassName(inTrigger,'selected');Element.addClassName(inPanel,'tabpanelselected');this.selectedTrigger=inTrigger;this.selectedPanel=inPanel;}};var CollapsibleList=Class.create({initialize:function(element,collapsedCount)
{this.element=$(element);this.list=this.element.down('.collapsible-list');this.button=this.element.down('.collapsible-list-toggle');if(this.button){this.button.down('a').observe('click',this.onButtonClick.bindAsEventListener(this));}
this.collapsedCount=(collapsedCount!=undefined)?collapsedCount:5;this._calculateHeights();this._resizeList();},onButtonClick:function(e)
{e.stop();this.toggle();},insertListItem:function(element)
{this.list.insert(element);this._calculateHeights();this._resizeList();},removeListItem:function(element)
{element.remove();this._calculateHeights();this._resizeList();},isCollapsed:function()
{return this.list.hasClassName('collapsed');},toggle:function()
{this.isCollapsed()?this.expand():this.collapse();},expand:function()
{if(!this.isCollapsed())return;this.list.removeClassName('collapsed');this.button.down('a').addClassName('active');this.button.down('.label').update(Loc.search_saved_less);this._resizeListWithAnimation(this.collapsedHeight,this.expandedHeight);},collapse:function()
{if(this.isCollapsed())return;this.list.addClassName('collapsed');this.button.down('a').removeClassName('active');this.button.down('.label').update(Loc.search_saved_more);this._resizeListWithAnimation(this.expandedHeight,this.collapsedHeight);},_calculateHeights:function()
{var nodes=this.list.childElements();this.expandedCount=nodes.length;this.collapsedHeight=0;this.expandedHeight=0;for(var i=0,n=this.expandedCount;i<n;i++)
{var node=nodes[i];this.expandedHeight+=node.getHeight();if(i<this.collapsedCount){this.collapsedHeight=this.expandedHeight;}}
if(this.button){(this.expandedCount>this.collapsedCount)?this.button.show():this.button.hide();}},_resizeList:function(toValue)
{if(toValue==undefined){var toValue=this.isCollapsed()?this.collapsedHeight:this.expandedHeight;}
this.list.setStyle({maxHeight:'',height:(toValue).round()+'px'});},_resizeListWithAnimation:function(fromValue,toValue)
{if(this.effect)this.effect.cancel();this.effect=new Effect.Tween(this.list,fromValue,toValue,{duration:0.5},function(value){this.setStyle({height:(value).round()+'px'});});}});var ACLChooser=Class.create({initialize:function(element)
{this.element=$(element);this.onAccessLevelChange=this.onAccessLevelChange.bindAsEventListener(this);this.onUserPermissionListChange=this.onUserPermissionListChange.bind(this);this.element.select('.acl-chooser-radio').invoke('observe','click',this.onAccessLevelChange);this.element.down('.acl-chooser-checkboxes').observe('click',this.onAccessLevelChange);this.userlist=new UserPermissionList(this.element.down('.acl-chooser-private-userlist'),{mChangeCallback:this.onUserPermissionListChange});},reset:function()
{this.element.down('.acl-chooser-checkboxes-read').checked=false;this.element.down('.acl-chooser-checkboxes-write').checked=false;this.element.down('.acl-chooser-private-userlist').select('li').invoke('remove');this.setAccessLevel(ACLChooser.ACCESS_PUBLIC);},getACLs:function()
{var acls={read:'unauthenticated',write:'unauthenticated'};if(this.getAccessLevel()==ACLChooser.ACCESS_PUBLIC){if(this.element.down('.acl-chooser-checkboxes-read').checked){acls.read="non-member";}
if(this.element.down('.acl-chooser-checkboxes-write').checked){acls.write="non-member";var specific=this.element.down('.acl-chooser-public-write-radio-specific');if(specific&&specific.checked){var userlist=this.element.down('.acl-chooser-public-write-userlist');if(userlist)acls.write=userlist.select('li a').invoke('getAttribute','title');}}}else{var userlist=this.element.down('.acl-chooser-private-userlist');acls.read=userlist.select('li a.readonly').invoke('getAttribute','title');acls.write=userlist.select('li a.readwrite').invoke('getAttribute','title');}
return acls;},getAccessLevel:function()
{var radio=this.element.select('.acl-chooser-radio').find(function(r){return r.checked;});if(radio){return radio.value;}},setAccessLevel:function(name)
{this.element.select('.acl-chooser-section').each(function(section){var radio=section.down('.acl-chooser-radio');if(radio.value==name){radio.checked=true;section.addClassName('selected');}else{radio.checked=false;section.removeClassName('selected');}});var cbEmail=this.element.down('.acl-chooser-private-notification input[type="checkbox"]');var cbGroup=this.element.down('.acl-chooser-checkboxes');var cbRead=this.element.down('.acl-chooser-checkboxes-read');var cbWrite=this.element.down('.acl-chooser-checkboxes-write');if(name==ACLChooser.ACCESS_PUBLIC){cbEmail.disable();cbGroup.removeClassName('disabled');cbRead.enable();if(cbRead.checked){cbWrite.checked=true;cbWrite.disable();}else{cbWrite.enable();}}else{cbEmail.enable();cbGroup.addClassName('disabled');cbRead.disable();cbWrite.disable();}
(cbWrite.checked)?this.element.addClassName('public-authenticated-write'):this.element.removeClassName('public-authenticated-write');var rbAnyoneWrite=this.element.down('.acl-chooser-public-write-radio-anyone');var rbSpecificWrite=this.element.down('.acl-chooser-public-write-radio-specific');if(rbAnyoneWrite&&rbSpecificWrite){(rbAnyoneWrite.checked)?this.element.addClassName('public-authenticated-write-anyone'):this.element.removeClassName('public-authenticated-write-anyone');(rbSpecificWrite.checked)?this.element.addClassName('public-authenticated-write-specific'):this.element.removeClassName('public-authenticated-write-specific');}
publisher().publish('ACL_CHOOSER_CHANGE',this);},onAccessLevelChange:function(e)
{var level=this.getAccessLevel();if(level){this.setAccessLevel(level);}},onUserPermissionListChange:function()
{publisher().publish('ACL_CHOOSER_CHANGE',this);}});ACLChooser.ACCESS_PUBLIC='public';ACLChooser.ACCESS_PRIVATE='private';Position.super__clone=Position.clone;Position.ieCompatibleClone=function(source,target){var options=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});if(!IEFixes.isIE)return Position.super__clone(source,target,options);var targetElm=$(target);if(targetElm.parentNode!=document.body)return Position.super__clone(source,target,options);var p=$(source).viewportOffset();targetElm.style.position='absolute';if(options.setLeft)targetElm.style.left=(p[0]-document.body.offsetLeft+options.offsetLeft)+'px';if(options.setTop)targetElm.style.top=(p[1]-document.body.offsetTop+options.offsetTop)+'px';if(options.setWidth)targetElm.style.width=$(source).offsetWidth+'px';if(options.setHeight)targetElm.style.height=$(source).offsetHeight+'px';}
Position.clone=function(source,target){var options=arguments[2]||{};if(!options.limitWithScrollbars)return Position.ieCompatibleClone(source,target,options);var scrolledParent=null;var elm=source;if(elm.ownerDocument&&(elm.ownerDocument!=document)&&elm.ownerDocument.defaultView){scrolledParent=elm.ownerDocument.defaultView.frameElement;}
while(!scrolledParent&&elm&&elm.parentNode&&(elm.nodeName.toLowerCase()!='body')){if(elm.scrollTop&&elm.scrollTop>0){scrolledParent=elm;}
else{elm=elm.parentNode;}};if(!scrolledParent)return Position.ieCompatibleClone(source,target,options);var parentTop=Element.getTop(scrolledParent);Position.ieCompatibleClone(source,target,options);if(parseFloat(target.style.top)<parentTop)target.style.top=parentTop+'px';}
Object.extend(Element,{getLeft:function(inElement,inOptParent){var parent=inOptParent?$(inOptParent):null;var currentNode=$(inElement);var currentLeft=0;while(currentNode){currentLeft+=currentNode.offsetLeft;currentNode=currentNode.offsetParent;if(parent&&currentNode==parent){currentNode=null;}
if(currentNode&&!IEFixes.isIE&&currentNode.nodeName.toLowerCase()=='body'){currentNode=null;}}
return currentLeft;},getTop:function(inElement,inOptParent){var parent=inOptParent?$(inOptParent):null;var currentNode=$(inElement);var currentTop=0;while(currentNode){currentTop+=currentNode.offsetTop;currentNode=currentNode.offsetParent;if(parent&&currentNode==parent){currentNode=null;}
if(currentNode&&!IEFixes.isIE&&currentNode.nodeName.toLowerCase()=='body'){currentNode=null;}}
return currentTop;},setOffsetHeight:function(element,height){element=$(element);if(height){element.style.height=height+'px';}
else{height=parseInt(element.style.height);}
var actual=Element.getHeight(element);element.style.height=(height-(actual-height))+'px';},setOffsetWidth:function(element,width){element=$(element);if(width){element.style.width=width+'px';}
else{width=parseInt(element.style.width);}
var actual=element.offsetWidth;element.style.width=(width-(actual-width))+'px';},getInvisibleSize:function(inElement){var elm=$(inElement);if(Element.visible(inElement))return[Element.getWidth(inElement),Element.getHeight(inElement)];elm.style.visibility='hidden';Element.show(elm);var width=elm.offsetWidth;var height=Element.getHeight(elm);Element.hide(elm);elm.style.visibility='';return[width,height];},getInvisibleHeight:function(inElement){return Element.getInvisibleSize(inElement)[1];},isChild:function(inChildElement,inParentElement){return Element.descendantOf(inChildElement,inParentElement);},unwrap:function(inChildElm,inSelector,inTagBuilderCallback,inOptParentElm){inChildElm=$(inChildElm);var parentElm=inOptParentElm||inChildElm.up(inSelector);if(parentElm){var ancestor=$A(parentElm.childNodes).detect(function(elm){return(elm==inChildElm||inChildElm.descendantOf(elm));});if(ancestor&&ancestor.previousSibling){var subelm=inTagBuilderCallback();while(ancestor.previousSibling){var sibling=ancestor.previousSibling;Element.remove(sibling);insertAtBeginning(sibling,subelm);}
insertAtBeginning(subelm,parentElm);}
if(ancestor&&ancestor.nextSibling){var subelm=inTagBuilderCallback();while(ancestor.nextSibling){var sibling=ancestor.nextSibling;Element.remove(sibling);subelm.appendChild(sibling);}
parentElm.appendChild(subelm);}
if(ancestor!=inChildElm){Element.unwrap(inChildElm,inSelector,inTagBuilderCallback,ancestor);}
if(!inOptParentElm){promoteElementChildren(parentElm);promoteElementChildren(inChildElm);}}},reload:function(inElement,inCallback,optUrl){var elm=$(inElement);var inCallback=inCallback||Prototype.emptyFunction;if(!elm||!elm.id){inCallback(false);return false;}
var url=optUrl||(window.location.pathname+window.location.search);var reloadFrame=Builder.node('iframe',{name:'element_reload_'+server().getNextUploadID(),style:'position:absolute;top:0;left:0;width:1px;height:1px;visibility:hidden',src:'about:blank'});d.body.appendChild(reloadFrame);var frameWindow=reloadFrame.contentWindow;var maybeLoadedCallback=function(){if(frameWindow.document&&frameWindow.document.body){var req=new Ajax.Request(url,{method:'get',onSuccess:function(inTransport){var bodyTextMatch=inTransport.responseText.replace(/[\r\n]/gm,'').match(/<body[^>]*>(.+)<\/body>/);if(bodyTextMatch){frameWindow.document.body.innerHTML=bodyTextMatch[1];var replacementElement=frameWindow.document.getElementById(elm.id);if(replacementElement){elm.update(replacementElement.innerHTML);inCallback(true);}
else{inCallback(false);}}
else{inCallback(false);}
Element.remove(reloadFrame);}});}
else{setTimeout(maybeLoadedCallback,250);}}
setTimeout(maybeLoadedCallback,750);},enableLinkIfAvailable:function(inElement,inOptCallback){var elm=$(inElement);if(!elm)return;var availability_url=elm.getAttribute('name')||elm.getAttribute('href');if(availability_url)
{var href=elm.getAttribute('href');elm.addClassName('disabled');elm.setAttribute('href','#');new Ajax.Request(availability_url,{method:(SafariFixes.isWebKit?'get':'post'),onComplete:function(transport)
{if(transport.status>=200&&transport.status<300)
{elm.removeClassName('disabled');elm.setAttribute('href',href);}
if(Object.isFunction(inOptCallback))inOptCallback(elm);}});}},forceReflow:function(inElement){var elm=$(inElement);if(elm&&elm.style){Element.hide(elm);setTimeout(function(){Element.show(elm)},1);}},formatElementDateContents:function(inElement,inOptIsGMT){var elm=$(inElement);var d=createDateObjFromISO8601(Element.firstNodeValue(elm),inOptIsGMT);if(d)replaceElementContents(elm,Loc.getLongDateString(d));}});Object.extend(Array,{syncKeyedArrayWithRows:function(inKeyedArray,inRows,inOptCopyKeys,inOptDeletePrefix){var copyKeys=inOptCopyKeys||$A([]);var syncStatus={deletedRows:Object.extend({},inKeyedArray),updatedRows:[],addedRows:[]};for(var rowIdx=0;rowIdx<inRows.length;rowIdx++){var row=inRows[rowIdx];if(!row.uid)continue;if(inKeyedArray[row.uid]){delete syncStatus.deletedRows[row.uid];syncStatus.updatedRows.push(row);for(var i=0;i<copyKeys.length;i++){row[copyKeys[i]]=inKeyedArray[row.uid][copyKeys[i]];}}
else{syncStatus.addedRows.push(row);}
inKeyedArray[row.uid]=row;}
var deletedKeys=$H(syncStatus.deletedRows).keys();syncStatus.deletedRows=$A([]);for(var i=0;i<deletedKeys.length;i++){if(!inOptDeletePrefix||deletedKeys[i].indexOf(inOptDeletePrefix)>=0){syncStatus.deletedRows.push(inKeyedArray[deletedKeys[i]]);delete inKeyedArray[deletedKeys[i]];}}
return syncStatus;}});Object.extend(Form,{getIntValue:function(inFieldElement){var val=parseInt($(inFieldElement).value);return(isNaN(val)?0:val);},setSelectValue:function(inSelectElement,inValue,inOptDefaultIdx){var defaultIdx=inOptDefaultIdx||0;var elm=$(inSelectElement);elm.options[defaultIdx].selected=true;if(!inValue)return;for(var optionIdx=0;optionIdx<elm.options.length;optionIdx++){if(elm.options[optionIdx].value==inValue){elm.options[optionIdx].selected=true;return;}}}});Object.extend(Form.Element.Serializers,{textarea:function(element){return Element.hasClassName('hinted')?'':element.value;}});Object.extend(PeriodicalExecuter.prototype,{start:function()
{if(this.timer)this.stop();this.registerCallback();}});function boundsForDiv(theDiv){return offsetBoundsForDiv(theDiv);}
function offsetBoundsForDiv(theDiv){return new Array(Element.getLeft(theDiv),Element.getTop(theDiv),theDiv.offsetWidth,theDiv.offsetHeight);}
function styleBoundsForDiv(theDiv){var s=theDiv.style;if(s.left&&s.top&&s.width&&s.height){return new Array(parseFloat(s.left),parseFloat(s.top),parseFloat(s.width),parseFloat(s.height));}
return null;}
function blur(){try{var anchors=$A(d.getElementsByTagName('a'));if(anchors.length){var firstLink=anchors.detect(function(elm){return elm.href});firstLink.focus();firstLink.blur();}}
catch(e){}}
function afterFinishShow(effect){effect.element.style.height='';Element.show(effect.element);}
function afterFinishHide(effect){effect.element.style.height='';Element.hide(effect.element);}
function afterFinishDelete(effect){effect.element.style.height='';Element.remove(effect.element);}
Object.extend(String.prototype,{trim:function(){return this.toString().replace(/^[\s\t\n\r]*|[\s\t\n\r]*$/g,'');}});if(window.loaded)loaded('widgets.js');