var IndicoGlobalVars={}
var Util={parseId:function(id){var m=id.match(/^(?:([^\.]+)\.)?s(\d+)$/);if(m){return concat(["Session"],m.slice(1));}
m=id.match(/^(?:([^\.]+)\.)s(\d+)(?:\.|l)(\d+)$/);if(m){return concat(["SessionSlot"],m.slice(1));}
m=id.match(/^(?:([^\.]+)\.)(\d+)$/);if(m){return concat(["Contribution"],m.slice(1));}
return concat(["Conference"],[id]);},truncate:function(title,length){length=length||25;if(title.length>length){return title.substring(0,length-3)+"...";}else{return title;}},formatDateTime:function(obj,format,sourceFormat){format=format||"%d/%m/%Y %H:%M";var m1=null,m2=null;if(obj===null){return null;}
else if(obj.constructor==Date){m1=[null,obj.getFullYear(),obj.getMonth()+1,obj.getDate()];m2=[null,zeropad(obj.getHours()),obj.getMinutes(),obj.getSeconds()];}else if(typeof(obj)=='object'){m1=obj.date.match(/(\d+)[\-\/](\d+)[\-\/](\d+)/);m2=obj.time.match(/(\d+):(\d+)(?:\:(\d+))?/);}else if(sourceFormat){var results=Util.__parseDateTime(obj,sourceFormat);m1=[null,results['%Y'],results['%m'],results['%d']];m2=[null,any(results['%H'],''),any(results['%M'],''),any(results['%S'],'')];}else{throw'unknown source object';}
if(!m1||!m2){return null;}
return format.replace('%Y',zeropad(m1[1])).replace('%m',zeropad(m1[2])).replace('%d',zeropad(m1[3])).replace('%H',zeropad(m2[1])).replace('%M',zeropad(m2[2])).replace('%S',zeropad(m2[3]));},__parseDateTime:function(string,format){format=format||"%Y/%m/%d %H:%M";if(!string){return null;}
var tokenOrder=[];var reFormat=format.replace(/%\w/g,function(val){tokenOrder.push(val);return val=='%Y'?'(\\d{0,4})':'(\\d{0,2})';}).replace(' ','\\s+');var m=string.match('^'+reFormat+'$');if(!m){return null;}
var results={'%Y':0,'%m':1,'%d':1,'%H':0,'%M':0,'%S':0};for(var i=1;i<m.length;++i){results[tokenOrder[i-1]]=m[i];}
return results;},parseJSDateTime:function(string,format){var results=Util.__parseDateTime(string,format);if(!results){return null;}
var date=new Date(results['%Y'],results['%m']-1,results['%d']);setTime(date,[results['%H'],results['%M'],results['%S']]);return date;},parseDateTime:function(string,format){var results=Util.__parseDateTime(string,format);if(!results){return null;}
return{date:zeropad(results['%Y'])+'/'+zeropad(results['%m'])+'/'+zeropad(results['%d']),time:zeropad(results['%H'])+':'+zeropad(results['%M'])+':'+zeropad(results['%S'])};},dateTimeIndicoToJS:function(obj){m1=obj.date.match(/(\d+)[\-\/](\d+)[\-\/](\d+)/);m2=obj.time.match(/(\d+):(\d+):(\d+)/);var date=new Date(m1[1],m1[2],m1[3]);setTime(date,[m2[1],m2[2],m2[3]]);return date;},dateTimeJSToIndico:function(obj){return{date:obj.getFullYear()+'/'+zeropad(obj.getMonth()+1)+'/'+zeropad(obj.getDate()),time:zeropad(obj.getHours())+':'+zeropad(obj.getMinutes())+':'+zeropad(obj.getSeconds())};}};Util.Validation={isIPAddress:function(address){return exists(address.match(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/));},isEmailAddress:function(address){return exists(address.toLowerCase().match(/^[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?$/));},isEmailList:function(emails){return exists(emails.toLowerCase().match(/^(?:[ ,;]*)(?:[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?)(?:[ ,;]+(?:[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+(?:\.[a-z0-9!#$%&\'*+\/=?\^_`{|}~\-]+)*@(?:[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?))*(?:[ ,;]*)$/));},isURL:function(address){return exists(address.match(/^(([^:\/?#]+):)((\/\/)?([^\/?#]+))([^?#]*)(\?([^#]*))?(#(.*))?$/));},isHtml:function(text){if(/<.*>[\s\S]*<\/.*>|<br\s*\/>/.exec(text)){return true;}else{return false;}}};Protection={ParentRestrictionMessages:{'1':$T("(currently <strong>restricted</strong> to some users, but can change)"),'-1':$T("(currently <strong>open</strong> to everyone, but can change)")},resolveProtection:function(resourceProtection,parentProtection){if(resourceProtection===0){return parentProtection;}else{return resourceProtection;}}};var IndicoSortCriteria={StartTime:function(c1,c2){return SortCriteria.Integer(c1.startDate.time.replaceAll(':',''),c2.startDate.time.replaceAll(':',''));}};var IndicoDateTimeFormats={International:'%d/%m/%Y %H:%M',ISO8601:'%Y/%m/%d %H:%M',Ordinal:'%Y%m%d'};IndicoDateTimeFormats.Default=IndicoDateTimeFormats.International;IndicoDateTimeFormats.Server=IndicoDateTimeFormats.ISO8601;IndicoDateTimeFormats.DefaultHourless=IndicoDateTimeFormats.Default.split(' ')[0];IndicoDateTimeFormats.ServerHourless=IndicoDateTimeFormats.Server.split(' ')[0];include(ScriptRoot+"ckeditor/ckeditor.js");var indicoSource=null;var indicoRequest=null;var imageSrc=null;function imageFunctionGenerator(url){return function(imageId){if(Indico.SystemIcons[imageId]){return url+'/'+Indico.SystemIcons[imageId];}else{return url+'/'+imageId;}};}
if(location.protocol=="https:"){indicoSource=curry(jsonRpcValue,Indico.Urls.SecureJsonRpcService);indicoRequest=curry(jsonRpc,Indico.Urls.SecureJsonRpcService);imageSrc=imageFunctionGenerator(Indico.Urls.SecureImagesBase);}else{indicoSource=curry(jsonRpcValue,Indico.Urls.JsonRpcService);indicoRequest=curry(jsonRpc,Indico.Urls.JsonRpcService);imageSrc=imageFunctionGenerator(Indico.Urls.ImagesBase);}
function getPx(pixVal){var m=pixVal.match(/(\d+)px/);return parseInt(m[1],10);}
function pixels(val){return val+'px';}
function zeropad(number){return((''+number).length==1)?'0'+number:number;}
var IndicoUI={__globalLayerLevel:0,__globalLayerLevels:[true],assignLayerLevel:function(element){if(!exists(element))
return;for(var i=this.__globalLayerLevel;i>=0;i--){if(this.__globalLayerLevels[i]){this.__globalLayerLevel=i;break;}}
var level=++this.__globalLayerLevel;this.__globalLayerLevels[level]=true;element.setStyle('zIndex',this.__globalLayerLevel);},unAssignLayerLevel:function(element){if(!exists(element))
return;var level=element.dom.style.zIndex;if(level==''){return;}
this.__globalLayerLevels[parseInt(level)]=false;},__loadCount:0,__unloadCount:0,loadTimeFuncs:{},unloadTimeFuncs:{},executeOnLoad:function(func){IndicoUI.loadTimeFuncs[IndicoUI.__loadCount]=(func);IndicoUI.__loadCount++;},executeOnUnload:function(func){IndicoUI.unloadTimeFuncs[IndicoUI.__unloadCount]=(func);IndicoUI.__unloadCount++;}};window.onload=function(){for(var f in IndicoUI.loadTimeFuncs){IndicoUI.loadTimeFuncs[f]();}
$E(document.body).observeClick(function(e){each(IndicoUtil.onclickFunctions,function(func){if(exists(func)){func(e);}});var idxs=[];var count=0;each(IndicoUtil.onclickFunctions,function(func){if(func===null){idxs.push(count);}
count++;});idxs.reverse();each(idxs,function(idx){IndicoUtil.onclickFunctions.removeAt(idx);});});};window.onunload=function(){for(var f in IndicoUI.unloadTimeFuncs){IndicoUI.unloadTimeFuncs[f]();}};var intToStr=function(id){if(IndicoUtil.isInteger(id)){return id+'';}else{return null;}};IndicoUI.Aux={globalChangeHandler:null,RichTextEditor:{completeHandler:null,getEditor:function(width,height){return function(target,source){var accessor=getAccessorDeep(source);var field=new RichTextWidget(width,height,'','rich');var fieldDiv=field.draw();field.set(accessor.get());$B(target,fieldDiv);return{activate:function(){},save:function(){accessor.set(field.get());},stop:function(){field.destroy();}};};}},updateDateWith:function(element,value){var m=value.match(/^([0123]?\d)\/([01]?\d)\/(\d{1,4})\s+([0-2]?\d):([0-5]?\d)$/);var date=new Date(m[3],m[2]-1,m[1],m[4],m[5]);if(value===""){element.update("<em>None</em>");}
else{element.update(date.toLocaleString());}},dateEditor:function(target,value,onExit){var edit=IndicoUI.Widgets.Generic.dateField(this.useTime);var exit=function(evt){edit.stopObserving('blur',exit);onExit(edit.value);};edit.value=value;target.update(edit);edit.select();edit.observe('blur',exit);},defaultEditMenu:function(context){return Widget.text($B(new Chooser({view:[Widget.link(command(context.edit,"(edit)"))],edit:[Widget.button(command(context.save,"Save")),Widget.button(command(context.view,"Cancel"))]}),context));}};IndicoUI.Buttons={addButton:function(faded){var caption=faded?'Add (blocked)':'Add';return Html.img({alt:caption,title:caption,src:faded?imageSrc("add_faded"):imageSrc("add"),style:{'marginLeft':'5px','verticalAlign':'middle'}});},removeButton:function(faded,fadedCaption){var caption=faded?(exists(fadedCaption)?fadedCaption:'Remove (blocked)'):'Remove';return Html.img({alt:caption,title:caption,src:faded?imageSrc("remove_faded"):imageSrc("remove"),style:{'marginLeft':'5px','verticalAlign':'middle'}});},editButton:function(faded,fadedCaption){var caption=faded?(exists(fadedCaption)?fadedCaption:'Edit (blocked)'):'Edit';return Html.img({alt:caption,title:caption,src:faded?imageSrc("edit_faded"):imageSrc("edit"),style:{'marginLeft':'5px','verticalAlign':'middle'}});},starButton:function(faded){return Html.img({src:faded?imageSrc("starGrey"):imageSrc("star"),style:{'marginLeft':'5px','verticalAlign':'middle'}});},playButton:function(faded,small){var caption=faded?'Start (blocked)':'Start';var imageName="play";if(faded){imageName+="_faded";}
if(small){imageName+="_small";}
return Html.img({alt:caption,title:caption,src:imageSrc(imageName),style:{'marginLeft':'3px','marginRight':'3px','verticalAlign':'middle'}});},stopButton:function(faded,small){var caption=faded?'Stop (blocked)':'Stop';var imageName="stop";if(faded){imageName+="_faded";}
if(small){imageName+="_small";}
return Html.img({alt:caption,title:caption,src:imageSrc(imageName),style:{'marginLeft':'3px','marginRight':'3px','verticalAlign':'middle'}});},arrowExpandIcon:function(target,state){return IndicoUI.Buttons.expandIcon(target,state,Html.img({alt:'Collapse',src:imageSrc("itemExploded")}),Html.img({alt:'Expand',src:imageSrc("currentMenuItem")}));},expandIcon:function(target,state,expandedIcon,collapsedIcon,inline){var img;var eSrc=expandedIcon.dom.src;var cSrc=collapsedIcon.dom.src;var eAlt=expandedIcon.dom.alt;var cAlt=collapsedIcon.dom.alt;if(!exists(state)){state=false;}
if(state){img=expandedIcon;target.dom.style.display=inline?'inline':'block';}else{img=collapsedIcon;target.dom.style.display='none';}
var elem=Widget.link(command(function(){if(!elem.state){IndicoUI.Effect.appear(target,inline?'inline':'block');img.dom.src=eSrc;img.dom.alt=eAlt;}else{IndicoUI.Effect.disappear(target);img.dom.src=cSrc;img.dom.alt=cAlt;}
elem.state=!elem.state;return false;},img));elem.state=state;return elem;},customImgSwitchButton:function(state,icon1,icon2,associatedObject,function1,function2){var img;var src1=icon1.dom.src;var src2=icon2.dom.src;var alt1=icon1.dom.alt;var alt2=icon2.dom.alt;if(!exists(state)){state=false;}
if(!exists(function2)){function2=function1;}
if(state){img=icon1;}else{img=icon2;}
var elem=Widget.link(command(function(){if(elem.state){if(elem.associatedObject===null){function1();}else{function1(elem.associatedObject);}
img.dom.src=src2;img.dom.alt=alt2;}else{if(elem.associatedObject===null){function2();}else{function2(elem.associatedObject);}
img.dom.src=src1;img.dom.alt=alt1;}
elem.state=!elem.state;return false;},img));elem.state=state;elem.associatedObject=associatedObject;return elem;},customTextSwitchButton:function(state,text1,text2,associatedObject,function1,function2){if(!exists(state)){state=false;}
if(!exists(function2)){function2=function1;}
var button=Html.input('button',{});if(state){button.set(text1);}else{button.set(text2);}
var elem=Widget.link(command(function(){if(elem.state){if(elem.associatedObject===null){function1();}else{function1(elem.associatedObject);}
button.set(text2);}else{if(elem.associatedObject===null){function2();}else{function2(elem.associatedObject);}
button.set(text1);}
elem.state=!elem.state;return false;},button));elem.state=state;elem.associatedObject=associatedObject;return elem;},tabExpandButton:function(val){var showTabs=function(){tabs=document.getElementById('tabList').childNodes;for(i in tabs){tab=tabs[i];if(tab.tagName=='LI'){if(contains(tab.className,'hiddenTab')){tab.style.display='inline';}}}}
var hideTabs=function(){tabs=document.getElementById('tabList').childNodes;for(i in tabs){tab=tabs[i];if(tab.tagName=='LI'&&contains(tab.className,'hiddenTab')){tab.style.display='none';}}}
var option=new Chooser({showLink:command(function(){IndicoUI.Widgets.Options.setAdvancedOptions(true,function(){showTabs();option.set('hideLink');});},'Show Advanced Options'),hideLink:command(function(){IndicoUI.Widgets.Options.setAdvancedOptions(false,function(){hideTabs();option.set('showLink');});},'Hide Advanced Options')});if(!val){showTabs();option.set('hideLink');}
else{option.set('showLink');}
return Widget.link(option);}};IndicoUI.Effect={disable:function(element){element.each(function(elem){if(exists(element.dom.disabled)){element.dom.disabled=true;}
element.dom.style.color='gray';IndicoUI.Effect.disable(elem);});},enableDisableTextField:function(element,enableDisable){element.dom.disabled=!enableDisable;if(Browser.IE){if(enableDisable){element.dom.style.backgroundColor='';}else{element.dom.style.backgroundColor='#ece7e2';}}},frame:function(element){element.setStyle('overflow','auto');element.setStyle('border','1px solid red');},appear:function(element,newStyle){if(!exists(newStyle)){newStyle='';}
element.dom.style.display=newStyle;},disappear:function(element){element.dom.style.display='none';},toggleAppearance:function(element,newStyle){if(element.dom.style.display=='none'){IndicoUI.Effect.appear(element,newStyle);}else{IndicoUI.Effect.disappear(element,newStyle);}},mouseOver:function(element){element.onmouseover=function(){this.style.background="#FFF6DF";};element.onmouseout=function(){this.style.background="transparent";};},highLight:function(elementId,color,time){$E(elementId).dom.style.color=color;if(time){setTimeout("IndicoUI.Effect.removeHighLight('"+elementId+"')",time);}},removeHighLight:function(elementId){element=$E(elementId);if(exists(element)){element.dom.style.color='';}},highLightBackground:function(elementId,color,time){if(!exists(color)){color="#FFFF88"}
if(!exists(time)){time=3000;}
$E(elementId).dom.style.backgroundColor=color;if(time){setTimeout("IndicoUI.Effect.removeHighlightBackground('"+elementId+"')",time);}},removeHighlightBackground:function(elementId){element=$E(elementId);if(exists(element)){element.dom.style.backgroundColor='';}},fade:function(element,TimeToFade){if(!exists(TimeToFade))
TimeToFade=500.0
if(typeof element=="string")
element=$E(element);var element=element.dom;if(element==null)
return;if(element.FadeState==null){if(element.style.opacity==null||element.style.opacity==''||element.style.opacity=='1'){element.FadeState=2;}
else{element.FadeState=-2;}}
if(element.FadeState==1||element.FadeState==-1){element.FadeState=element.FadeState==1?-1:1;element.FadeTimeLeft=TimeToFade-element.FadeTimeLeft;}
else{element.FadeState=element.FadeState==2?-1:1;element.FadeTimeLeft=TimeToFade;setTimeout(function(){animateFade(new Date().getTime(),element);},33);}
animateFade=function(lastTick,element){var curTick=new Date().getTime();var elapsedTicks=curTick-lastTick;if(element.FadeTimeLeft<=elapsedTicks){element.style.opacity=element.FadeState==1?'1':'0';element.style.filter='alpha(opacity = '+(element.FadeState==1?'100':'0')+')';if(element.FadeState==1){element.style.filter=null;}
element.FadeState=element.FadeState==1?2:-2;return;}
element.FadeTimeLeft-=elapsedTicks;var newOpVal=element.FadeTimeLeft/TimeToFade;if(element.FadeState==1)
newOpVal=1-newOpVal;element.style.opacity=newOpVal;element.style.filter='alpha(opacity = '+(newOpVal*100)+')';setTimeout(function(){animateFade(curTick,element)},33);};},Draggable:function(elem,handle,downHandler,upHandler){var stopObsMouseDown=handle.observeEvent('mousedown',function(event){var getScrollX=function(){if(exists(window.scrollX)){return window.scrollX;}else{return document.documentElement.scrollLeft;}};var getScrollY=function(){if(exists(window.scrollY)){return window.scrollY;}else{return document.documentElement.scrollTop;}};var stopObsMouseMove=$E(document).observeEvent('mousemove',function(event){var diffX=event.clientX+getScrollX()-startX;var diffY=event.clientY+getScrollY()-startY;elem.dom.style.top=diffY+"px";elem.dom.style.left=diffX+"px";event.preventDefault();});var stopObsMouseUp=$E(document).observeEvent('mouseup',function(event){stopObsMouseMove();stopObsMouseUp();if(exists(upHandler)){upHandler();}
event.preventDefault();});var startX=event.clientX+getScrollX()-getPx(elem.dom.style.left);var startY=event.clientY+getScrollY()-getPx(elem.dom.style.top);if(exists(downHandler)){downHandler();}
event.preventDefault();});return elem;},prepareForSlide:function(elemId,initiallyHidden){var elem=$E(elemId);var height=elem.dom.offsetHeight;if(initiallyHidden){elem.dom.style.height='0';elem.dom.style.opacity="0";}
return height;},slide:function(elemId,elemHeight,showHook,hideHook){var elem=$E(elemId);elem.dom.style.overflow='hidden';var elemDivHeight=elemHeight;if(parseInt(elem.dom.style.height)=='0'){elem.dom.style.visibility='visible';var heightCounter=1;IndicoUI.Effect.fade(elemId,(Math.floor(Math.log(elemDivHeight)/Math.log(1.3))*20)+200);var incHeight=function(){heightCounter*=1.3;if(heightCounter<elemDivHeight){elem.dom.style.height=Math.floor(heightCounter)+'px';setTimeout(function(){incHeight();},20);}else{elem.dom.style.height="auto";if(exists(showHook))showHook();}};setTimeout(function(){incHeight();},20);}else{var heightCounter=elemDivHeight;IndicoUI.Effect.fade(elemId,(Math.floor(Math.log(elemDivHeight)/Math.log(1.3))*20));var decHeight=function(){heightCounter/=1.3;if(heightCounter>5){elem.dom.style.height=Math.floor(heightCounter)+'px';setTimeout(function(){decHeight();},20);}else{elem.dom.style.height='0px';elem.dom.style.visibility='hidden';if(exists(hideHook))hideHook();}};setTimeout(function(){decHeight();},20);}}};function mouseOverSwitch(observable,overAction,outAction){observable.observeEvent('mouseover',function(event){overAction(event);});observable.observeEvent('mouseout',function(event){outAction(event);});}
function showWithMouse(observable,target){var stored=target.dom.style.display;target.dom.style.display='none';mouseOverSwitch(observable,function(){target.dom.style.display=stored;},function(){target.dom.style.display='none';});}
function highlightWithMouse(observable,target){if(target.__highlightSet){return observable;}
mouseOverSwitch(observable,function(){target.__tmpColor=target.dom.style.backgroundColor;if(target.__tmpColor===''){return;}
var bgColor=target.dom.style.backgroundColor;var s=bgColor.match(/rgb\((\d+), (\d+), (\d+)\)/);if(!s){s=bgColor.match(/#(..)(..)(..)/);if(!s){return;}
s[1]=parseInt('0x'+s[1],16);s[2]=parseInt('0x'+s[2],16);s[3]=parseInt('0x'+s[3],16);}
s[1]=Math.floor(s[1]*1.05);s[2]=Math.floor(s[2]*1.05);s[3]=Math.floor(s[3]*1.05);target.setStyle('backgroundColor','rgb('+s[1]+','+s[2]+','+s[3]+')');},function(){target.setStyle('backgroundColor',target.__tmpColor);});target.__highlightSet=true;return observable;}
type('Printable',[],{print:function(element,title){var body=$E(document.body);var bodyCSSClasses=body.dom.className;var elementCSSClasses=element.dom.className;element.dom.className=elementCSSClasses+" print";body.dom.className=bodyCSSClasses+=" noprint";window.print();}});var addedWebkitJqueryFixDiv=false;type("IWidget",[],{draw:function(content){return content;},postDraw:function(){},_drawHeader:function(){return'';},disable:function(){},enable:function(){},show:function(){},hide:function(){}});type("ListWidget",["WatchObject","IWidget"],{getId:function(){return this.id;},clearList:function(){var self=this;self.message=null;self.clear();self.domList.clear();},setMessage:function(message){this.clearList();this.message=message;this.domList.append(Html.li('listMessage',message));},draw:function(){var self=this;var returnedDom=$B(self.domList,self,function(pair){var listItem=Html.li({id:self.id+'_'+pair.key},self._drawItem(pair));if(exists(self.mouseoverObserver)){listItem.observeEvent('mouseover',function(event){self.mouseoverObserver(true,pair,listItem,event);});listItem.observeEvent('mouseout',function(event){self.mouseoverObserver(false,pair,listItem,event);});}
return listItem;});if(exists(this.message)){this.domList.append(Html.li('listMessage',this.message));}
return this.IWidget.prototype.draw.call(this,returnedDom);},_drawItem:function(pair){return'';}},function(listCssClass,mouseoverObserver){this.WatchObject();this.id=Html.generateId();this.domList=Html.ul({id:this.id,className:listCssClass});this.listCssClass=listCssClass;this.mouseoverObserver=mouseoverObserver;});type("SelectableListWidget",["ListWidget"],{getSelectedList:function(){return this.selectedList;},clearSelection:function(){var self=this;each(self.domList,function(listItem){if(listItem.dom.className.search(self.selectedCssClass)>=0){listItem.dom.className=listItem.dom.className.replace(self.selectedCssClass,self.unselectedCssClass);}});this.selectedList.clear();},clearList:function(){this.clearSelection();this.ListWidget.prototype.clearList.call(this);},setMessage:function(message){this.clearSelection();this.ListWidget.prototype.setMessage.call(this,message);},draw:function(){var self=this;var returnedDom=$B(self.domList,self,function(pair){var listItem=Html.li({id:self.id+'_'+pair.key},self._drawItem(pair));if(pair.get().get("unselectable")===true){listItem.dom.className+=' unselectable';}else{listItem.observeClick(function(event){if(exists(self.selectedList.get(pair.key))){self.selectedList.set(pair.key,null);listItem.dom.className=self.unselectedCssClass;}else{if(self.onlyOne){self.clearSelection();}
self.selectedList.set(pair.key,pair.get());listItem.dom.className=self.selectedCssClass;}
if(exists(self.selectedObserver)){self.selectedObserver(self.selectedList);}});}
if(exists(self.mouseoverObserver)){listItem.observeEvent('mouseover',function(event){self.mouseoverObserver(true,pair,listItem,event);});listItem.observeEvent('mouseout',function(event){self.mouseoverObserver(false,pair,listItem,event);});}
return listItem;});if(exists(this.message)){this.domList.append(Html.li('listMessage',this.message));}
return this.IWidget.prototype.draw.call(this,returnedDom);},_drawItem:function(pair){return'';}},function(selectedObserver,onlyOne,listCssClass,selectedCssClass,unselectedCssClass,mouseoverObserver){this.selectedList=$O();this.selectedObserver=selectedObserver;this.onlyOne=any(onlyOne,false);if(exists(selectedCssClass)){this.selectedCssClass=selectedCssClass;}else{this.selectedCssClass="selectedListItem";}
if(exists(unselectedCssClass)){this.unselectedCssClass=unselectedCssClass;}else{this.unselectedCssClass="unselectedListItem";}
this.ListWidget(listCssClass,mouseoverObserver);});type("TabWidget",["IWidget"],{_titleTemplate:function(text){return text;},enableTab:function(index){this.tabs[index].dom.style.display='inline';},disableTab:function(index){this.tabs[index].dom.style.display='none';},enable:function(){this.disableOverlay.dom.style.display='none';},disable:function(){this.disableOverlay.dom.style.display='block';},_drawContent:function(){var self=this;try{each(this.optionDict,function(value,key){if(key==self.selected.get()){value.dom.style.display='block';}else{value.dom.style.display='none';}});}catch(e){if(e=="stopDrawing"){}}},draw:function(dataRetrievalFunc){var self=this;this.tabList=$B(Html.ul("tabList"),this.options,function(value){var liItem=Html.li(value==self.selected.get()?"tabSelected":"tabUnselected",Html.span({},self._titleTemplate(value)));liItem.observeClick(function(){self.selected.set(value);});liItem.observeEvent('mouseover',function(){liItem.setStyle('backgroundPosition','0 0px');});liItem.observeEvent('mouseout',function(){liItem.setStyle('backgroundPosition','0 -30px');});self.selected.observe(function(selValue){liItem.dom.className=value==selValue?"tabSelected":"tabUnselected";});self.tabs.push(liItem);return liItem;});var arrow,bg;arrow=Html.div({className:'tabScrollArrow',style:{backgroundPosition:'0 -30px'}});bg=Html.div({className:'tabScrollArrowBg'},arrow);this.scrollArrows.right=[bg,arrow];arrow=Html.div({className:'tabScrollArrow',style:{backgroundPosition:'0 -15px'}});bg=Html.div({className:'tabScrollArrowBg'},arrow);this.scrollArrows.left=[bg,arrow];this.scrollArrows.left[0].observeClick(function(event){self.scrollLeft();});this.scrollArrows.right[0].observeClick(function(event){self.scrollRight();});this.scrollArrows.left[0].observeEvent('mouseover',function(){if(!self.scrollArrowStates.left){return;}
self.scrollArrows.left[0].dom.style.backgroundPosition='0 -75px';});this.scrollArrows.left[0].observeEvent('mouseout',function(){if(!self.scrollArrowStates.left){return;}
self.scrollArrows.left[0].dom.style.backgroundPosition='0 -60px';});this.scrollArrows.right[0].observeEvent('mouseover',function(){if(!self.scrollArrowStates.right){return;}
self.scrollArrows.right[0].dom.style.backgroundPosition='0 -75px';});this.scrollArrows.right[0].observeEvent('mouseout',function(){if(!self.scrollArrowStates.right){return;}
self.scrollArrows.right[0].dom.style.backgroundPosition='0 -60px';});var extraButtons="";if(this.extraButtons.length){extraButtons=Html.div('tabExtraButtons');}
each(this.extraButtons,function(btn,index){var extraCSSClass='';if(index===0){extraCSSClass="buttonContainerLeft";}else if(index==self.extraButtons.length-1){extraCSSClass="buttonContainerRight";}
var btnContainer=Html.div('buttonContainer '+extraCSSClass,btn.btn);extraButtons.append(btnContainer);btnContainer.observeClick(function(){btn.onclick(btnContainer);});});if(dataRetrievalFunc){dataRetrievalFunc.call(this);}else{each(this.optionDict,function(value,key){self.canvas.append(value);});}
this._drawContent();var wrapperStyle=this.width?{width:this.width}:{};this.container=this.IWidget.prototype.draw.call(this,Html.div({style:wrapperStyle},Html.div({className:"tabListContainer",style:{position:'relative'}},this.scrollArrows.left[0],this.scrollArrows.right[0],this.tabList,Html.div('tabGradient',extraButtons)),Html.div({style:{marginTop:pixels(10),width:self.width?self.width:'auto',minHeight:self.height?pixels(self.height):'auto'}},this.canvas),this.disableOverlay));return this.container;},postDraw:function(){var self=this;if(this.tabs.length===0||!this.checkTabOverflow()){return;}
this.tabList.dom.style.paddingLeft="35px";this.tabList.dom.style.paddingRight="35px";for(var i=this.tabs.length-1;i>0;i--){if(self.checkTabOverflow()){this.tabs[i].dom.style.display='none';}else{self.rightTabIndex=i;break;}}
this.scrollArrows.right[0].dom.style.left=pixels(this.container.dom.clientWidth-17);this.setScrollArrowState('right',true);this.setScrollArrowState('left',false);},heightToTallestTab:function(){var currentSelectedTab=this.getSelectedTab();var maxHeight=0;for(var i=this.tabs.length-1;i>=0;i--){this.setSelectedTab(this.options.item(i));maxHeight=Math.max(maxHeight,this.container.dom.offsetHeight);}
this.container.setStyle('height',maxHeight);this.setSelectedTab(currentSelectedTab);},checkTabOverflow:function(tab){return(this.tabList.dom.offsetHeight>(Browser.IE?33:30));},scrollRight:function(){if(!this.scrollArrowStates.right){return;}
var rightTab=this.tabs[this.rightTabIndex];var nextRightTab=this.tabs[this.rightTabIndex+1];this.rightTabIndex++;rightTab.dom.style.marginRight='';nextRightTab.dom.style.display='inline';for(var i=this.leftTabIndex;i<this.tabs.length-1&&this.checkTabOverflow();i++){this.tabs[i].dom.style.display='none';this.tabs[i].dom.style.marginLeft='';this.leftTabIndex++;}
for(i=this.rightTabIndex+1;i<this.tabs.length;i++){this.tabs[i].dom.style.display='inline';this.tabs[i-1].dom.style.marginRight='';if(this.checkTabOverflow()){this.tabs[i].dom.style.display='none';this.tabs[i].dom.style.marginRight='';break;}else{this.rightTabIndex++;}}
this.setScrollArrowState('left',true);if(this.rightTabIndex==this.tabs.length-1){this.setScrollArrowState('right',false);}},scrollLeft:function(){if(!this.scrollArrowStates.left){return;}
var leftTab=this.tabs[this.leftTabIndex];var prevLeftTab=this.tabs[this.leftTabIndex-1];this.leftTabIndex--;leftTab.dom.style.marginLeft='';prevLeftTab.dom.style.display='inline';for(var i=this.rightTabIndex;i>=0&&this.checkTabOverflow();i--){this.tabs[i].dom.style.display='none';this.tabs[i].dom.style.marginRight='';this.rightTabIndex--;}
for(i=this.leftTabIndex-1;i>=0;i--){this.tabs[i].dom.style.display='inline';this.tabs[i+1].dom.style.marginLeft='';if(this.checkTabOverflow()){this.tabs[i].dom.style.display='none';this.tabs[i].dom.style.marginLeft='';break;}
else{this.leftTabIndex--;}}
this.setScrollArrowState('right',true);if(this.leftTabIndex<1){this.setScrollArrowState('left',false);}},setScrollArrowState:function(direction,active){var bg=this.scrollArrows[direction][0];var arrow=this.scrollArrows[direction][1];this.scrollArrowStates[direction]=active;if(active){arrow.dom.style.backgroundPosition='0 -'+pixels(direction=='right'?0:15);arrow.dom.style.borderColor='#999999';bg.dom.style.backgroundPosition='0 -60px';bg.dom.style.cursor='pointer';}else{arrow.dom.style.backgroundPosition='0 -'+pixels(direction=='right'?30:45);arrow.dom.style.borderColor='#D5D5D5';bg.dom.style.backgroundPosition='0 -90px';bg.dom.style.cursor='';}
bg.dom.style.display='block';},getSelectedTab:function(){return this.selected.get();},setSelectedTab:function(newSelectedTab){this.selected.set(newSelectedTab);},initializeDisableOverlay:function(){this.disableOverlay=Html.div({style:{display:'none',background:'white',opacity:'0.7',height:'50px',width:'100%',position:'absolute',top:'0',left:'0',filter:'alpha(opacity=70)'}});}},function(options,width,height,initialSelection,extraButtons,canvas){var self=this;this.width=exists(width)?((typeof(width)=='string'&&width.indexOf('%')>=0)?width:pixels(width)):width;this.height=height;this.tabs=[];this.leftTabIndex=0;this.rightTabIndex=0;this.scrollArrows={};this.scrollArrowStates={};this.extraButtons=any(extraButtons,[]);this.canvas=canvas||Html.div('canvas');if(!exists(initialSelection)){initialSelection=options[0][0];}
this.options=new WatchList();$L(options).each(function(pair){var value=pair[1];var key=pair[0];self.options.append(key);});this.optionDict={};each(options,function(item){self.optionDict[item[0]]=item[1];});this.selected=new WatchValue();this.selected.observe(function(value){self._drawContent();});this.selected.set(initialSelection);this.initializeDisableOverlay();});type("LookupTabWidget",["TabWidget"],{_drawContent:function(){var self=this;try{this.canvas.set(this.optionDict[self.selected.get()]());}catch(e){if(e=="stopDrawing"){}}},draw:function(){return this.TabWidget.prototype.draw.call(this,function(){this.canvas.set(Html.div({}));});}},function(options,width,height,initialSelection,extraButtons,canvas){this.TabWidget(options,width,height,initialSelection,extraButtons,canvas);});type("RemoteWidget",[],{_error:function(error){IndicoUI.Dialogs.Util.error(error);},run:function(content){var self=this;var canvas=Html.div({});self.source.state.observe(function(value){if(value==SourceState.Loaded){canvas.set(self.drawContent(content));}else if(value==SourceState.Loading||value==SourceState.Committing){self.runIndicator(canvas);}else if(value==SourceState.Error){self._error(self.source.error.get());}});return canvas;},draw:function(content){var canvas=this.run(content);this.runIndicator(canvas);return canvas;},runIndicator:function(canvas){if(!this.noIndicator){canvas.set(progressIndicator(false,true));}}},function(method,args,noIndicator){this.noIndicator=noIndicator;this.source=indicoSource(method,args);});type("RemoteListWidget",["ListWidget","RemoteWidget"],{draw:function(){return this.RemoteWidget.prototype.draw.call(this);},getList:function(){return this.source;},_addElement:function(element){this.add(element);},drawContent:function(){var self=this;this.clear();each($L(this.getList()),function(elem){self._addElement(elem);});return this.ListWidget.prototype.draw.call(this);}},function(listCssClass,method,args,noIndicator){this.ListWidget(listCssClass);this.RemoteWidget(method,args,noIndicator);});type("PreloadedWidget",["IWidget"],{draw:function(){var canvas=Html.span({},'loading...');var count=0;var self=this;var checkNow=function(){if(count==self.waitingList.length){canvas.set(self.drawContent());}};each(this.waitingList,function(remoteWidget){remoteWidget.ready.observe(function(value){if(value){count++;checkNow();}});});return canvas;}},function(waitingList){this.waitingList=waitingList;});progressIndicator=function(small,center){var htmlTag=small?Html.span:Html.div;return htmlTag(center?{style:{textAlign:'center'}}:{},Html.img({src:imageSrc(small?"loading":"ui_loading"),alt:"Loading..."}));};type("ServiceWidget",["IWidget"],{_error:function(error){IndicoUI.Dialogs.Util.error(error);},request:function(extraArgs){var self=this;var args=extend(clone(this.args),extraArgs);var killProgress=IndicoUI.Dialogs.Util.progress();jsonRpc(Indico.Urls.JsonRpcService,this.method,args,function(response,error){if(exists(error)){killProgress();self._error(error);}else{self._success(response);killProgress();}});}},function(endPoint,method,args){this.endPoint=endPoint;this.method=method;this.args=args;this.IWidget();});type("PopupWidget",[],{draw:function(content,x,y,styles){var self=this;this.x=x;this.y=y;if(!exists(this.canvas)){this.canvas=Html.div();}
styles=any(styles,{position:this.canvas.dom.style.position=='fixed'?'fixed':'absolute',left:pixels(x),top:pixels(y)});each(styles,function(value,key){self.canvas.setStyle(key,value);});this.canvas.setContent(content);IndicoUI.assignLayerLevel(this.canvas);if(!addedWebkitJqueryFixDiv&&navigator.userAgent.indexOf('WebKit')!=-1){$E(document.body).append(Html.div());}
addedWebkitJqueryFixDiv=true;return this.canvas;},open:function(x,y){$E(document.body).append(this.draw(x,y));this.isopen=true;this.postDraw();},isOpen:function(){return this.isopen;},postDraw:function(){if(Browser.IE){this.canvas.dom.style.display='';}},openRelative:function(x,y){var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var dsocleft=document.all?iebody.scrollLeft:pageXOffset;var dsoctop=document.all?iebody.scrollTop:pageYOffset;this.open(x+dsocleft,y+dsoctop);},getCanvas:function(){return this.canvas;},setFixedPosition:function(fixed){fixed=any(fixed,true);this.canvas.dom.style.position=fixed?'fixed':'absolute';},close:function(e){var self=this;IndicoUI.unAssignLayerLevel(this.canvas);if(Browser.IE){this.canvas.dom.style.display='none';setTimeout(function(){$E(document.body).remove(self.canvas);},500);}else{$E(document.body).remove(self.canvas);}
this.isopen=false;}},function(styleData){this.canvas=Html.div({style:styleData}||{});});type("HistoryListener",[],{_addToHistory:function(hash){if(this.historyBroker){this.historyBroker.setUserAction(hash);}},registerHistoryBroker:function(broker){this.historyBroker=broker;},notifyHistoryChange:function(hash){this._retrieveHistoryState(hash);}},function(){});type("ErrorAware",[],{_setElementErrorState:function(element,text){return IndicoUtil.markInvalidField(element,text)[1];},setError:function(text){if(!text){if(this._stopErrorList){each(this._stopErrorList,function(elem){elem();});this._inError=false;this._stopErrorList=[];}}else{this._setErrorState(text);this._inError=true;}
return this._stopErrorList;},inError:function(){return this._inError;},askForErrorCheck:function(){var errorState=this._checkErrorState();if(errorState){if(!this._inError){this.setError(errorState);}
return errorState;}else{this.setError(null);return null;}},plugParameterManager:function(parameterManager){this.parameterManager=parameterManager;var self=this;parameterManager.add(self,null,null,function(){return self.askForErrorCheck();});}},function(){});type("InlineWidget",["IWidget"],{_error:function(error){IndicoUI.Dialogs.Util.error(error);}});type("InlineRemoteWidget",["InlineWidget"],{_handleError:function(error){this._error(error);},_handleLoading:function(error){return Html.span({},'loading...');},_handleLoaded:function(){},_handleBackToEditMode:function(){},draw:function(){var self=this;var content=this._handleContent();var wcanvas=Html.div({},this.loadOnStartup?this._handleLoading():content);this.source.state.observe(function(state){if(state==SourceState.Error){self._handleError(self.source.error.get());wcanvas.set(content);self.setMode('edit');self._handleBackToEditMode();}else if(state==SourceState.Loaded){self._handleLoaded(self.source.get());wcanvas.set(content);self.setMode('display');}else{wcanvas.set(self._handleLoading());}});return wcanvas;}},function(method,attributes,loadOnStartup,callback){loadOnStartup=exists(loadOnStartup)?loadOnStartup:true;this.ready=new WatchValue();this.ready.set(false);this.loadOnStartup=loadOnStartup;this.source=indicoSource(method,attributes,null,!loadOnStartup,callback);});type("RemoteSwitchButton",["InlineWidget"],{draw:function(){var imageLoading=Html.img({src:imageSrc("loading"),alt:'Loading',title:$T('Communicating with server')});var self=this;var request=function(currentState,targetState,method){indicoRequest(method,self.args,function(response,error){if(exists(error)){self._error(error);chooser.set(currentState);}
else{chooser.set(targetState);}});};var chooser=new Chooser({'disable':command(function(event){chooser.set('progress');request('disable','enable',self.enableMethod);stopPropagation(event);return false;},this.imgEnabled),'enable':command(function(event){chooser.set('progress');request('enable','disable',self.disableMethod);stopPropagation(event);return false;},this.imgDisabled),'progress':command(function(){return false;},imageLoading)});chooser.set(this.initState?'disable':'enable');return Widget.link(chooser);}},function(initState,imgEnabled,imgDisabled,enableMethod,disableMethod,args){this.initState=initState;this.imgEnabled=imgEnabled;this.imgDisabled=imgDisabled;this.enableMethod=enableMethod;this.disableMethod=disableMethod;this.args=args;});type("RadioFieldWidget",["InlineWidget","WatchAccessor"],{draw:function(){var self=this;this.canvas=Html.div({style:{position:'relative'}},Html.table(this.cssClassRadios,$B(Html.tbody({}),this.orderedItems,function(item){var radio=self.radioDict[item.key];radio.observeClick(function(){self.select(item.key);});self.options.accessor(item.key).observe(function(value){radio.set(value);if(value){liItem.dom.className='selectedItem';}else{liItem.dom.className='';}});var itemContent=item.get();if(itemContent.IWidget){itemContent=itemContent.draw();}else{itemContent=Html.span({style:{verticalAlign:'middle'}},itemContent);}
var liItem=Html.tr(self.visibility.get(item.key)?{}:'disabledRadio',keys(self.radioDict).length>1?Html.td({},radio):'',Html.td({},itemContent));radio.dom.disabled=!self.visibility.get(item.key);if(self.options.get(item.key)){liItem.dom.className='selectedItem';}
self.visibility.accessor(item.key).observe(function(value){if(!value){liItem.dom.className='disabledRadio';radio.dom.disabled=true;}else{liItem.dom.className='enabledRadio';radio.dom.disabled=false;}
if(!value&&radio.get()){self.selectLast();}});return liItem;})));return this.canvas;},setVisibility:function(key,visible){this.visibility.set(key,visible);},show:function(){this.canvas.dom.style.display='block';},hide:function(){this.canvas.dom.style.display='none';},onSelect:function(state){},set:function(state){this.select(state);},get:function(){var selKey=null;each(this.options,function(value,key){if(value){selKey=key;}});return selKey;},enable:function(){each(this.radioDict,function(value,key){value.dom.disabled=false;});this.canvas.dom.style.opacity=1;},disable:function(){each(this.radioDict,function(value,key){value.dom.disabled=true;});this.canvas.dom.style.opacity=0.4;},observe:function(callback){this.options.observe(function(value,key){if(value){callback(key);}});},select:function(state,fromSource){var self=this;var widget=this.items[state];if(widget.IWidget){widget.enable();}
self.state.set(state);self.options.each(function(value,key){if(value){self.options.set(key,false);}
if(key!=state){var widget=self.items[key];if(widget.IWidget){widget.disable();}}});self.options.set(state,true);self.radioDict[state].set(true);self.onSelect(state,fromSource);},selectLast:function(){var visible=[];var self=this;each(this.orderedItems,function(item){if(self.visibility.get(item.key)){visible.push(item.key);}});if(visible.length>0){this.select(visible[visible.length-1]);}}},function(items,cssClassRadios){this.items={};this.radioDict={};this.options=new WatchObject();this.visibility=new WatchObject();this.cssClassRadios=exists(cssClassRadios)?cssClassRadios:'nobulletsList';var self=this;var name=Html.generateId();this.orderedItems=$L();each(items,function(item){var key=item[0];self.items[key]=item[1];self.orderedItems.append(new WatchPair(key,item[1]));self.visibility.set(key,true);self.options.set(key,false);self.radioDict[key]=Html.radio({'name':name,style:{verticalAlign:'middle'}});});this.state=new Chooser(map(items,function(value,key){return key;}));});type("SelectRemoteWidget",["InlineRemoteWidget","WatchAccessor"],{_drawItem:function(item){var option=Widget.option(item);this.options.set(item.key,option);if(this.selected.get()){if(this.selected.get()==item.key){option.accessor('selected').set(true);}}
return option;},_handleContent:function(){var self=this;this.selected.observe(function(value){var elem=self.options.get(value);if(elem){elem.accessor('selected').set(true);}});return bind.element(this.select,this.source,function(item){return self._drawItem(item);});},observe:function(func){this.select.observe(func);},refresh:function(){this.source.refresh();},disable:function(){this.select.dom.disabled=true;},enable:function(){this.select.dom.disabled=false;},get:function(){return this.select.get();},set:function(option){this.selected.set(option);},unbind:function(){bind.detach(this.select);}},function(method,args,callback){this.options=new WatchObject();this.select=Html.select({});this.selected=new WatchValue();this.InlineRemoteWidget(method,args,true,callback);this.loadOnStartup=false;});type("RealtimeTextBox",["IWidget","WatchAccessor","ErrorAware"],{_setErrorState:function(text){this._stopErrorList=this._setElementErrorState(this.input,text);},_checkErrorState:function(){return null;},draw:function(){this.enableEvent();return this.IWidget.prototype.draw.call(this,this.input);},get:function(){if(this.input.dom.disabled){return null;}else{return this.input.get();}},set:function(value){return this.input.set(value);},observe:function(observer){this.observers.push(observer);},observeEvent:function(event,observer){return this.input.observeEvent(event,observer);},observeOtherKeys:function(observer){this.otherKeyObservers.push(observer);},stopObserving:function(){this.observers=[];this.otherKeyObservers=[];},unbind:function(){bind.detach(this.input);},disable:function(){this.input.dom.disabled=true;},enable:function(){this.input.dom.disabled=false;this.enableEvent();},setStyle:function(prop,value){this.input.setStyle(prop,value);},setFocus:function(){this.input.dom.focus();},notifyChange:function(keyCode,event){var value=true;var self=this;each(this.observers,function(func){value=value&&func(self.get(),keyCode,event);});return value;},enableEvent:function(){var self=this;this.input.observeEvent('keydown',function(event){var keyCode=event.keyCode;var value=true;if((keyCode<32&&keyCode!=8)||(keyCode>=33&&keyCode<46)||(keyCode>=112&&keyCode<=123)){each(self.otherKeyObservers,function(func){value=value&&func(self.get(),keyCode,event);});return value;}
return true;});this.input.observeEvent('keyup',function(event){var keyCode=event.keyCode;if(!((keyCode<32&&keyCode!=8)||(keyCode>=33&&keyCode<46)||(keyCode>=112&&keyCode<=123))){var value=self.notifyChange(keyCode,event);Dom.Event.dispatch(self.input.dom,'change');return value;}
return true;});}},function(args){this.observers=[];this.otherKeyObservers=[];this.input=Html.input('text',args);});type("RealtimeTextArea",["RealtimeTextBox"],{},function(args){this.RealtimeTextBox(clone(args));this.input=Html.textarea(args);});type("EnterObserverTextBox",["IWidget","WatchAccessor"],{draw:function(){return this.IWidget.prototype.draw.call(this,this.input);},get:function(){return this.input.get();},set:function(value){return this.input.set(value);},observe:function(observer){this.input.observe(observer);},getInput:function(){return this.input;}},function(id,args,keyPressAction){var self=this;this.input=Html.input(id,args);this.input.observeEvent('keypress',function(event){if(event.keyCode==13){Dom.Event.dispatch(self.input.dom,'change');return keyPressAction();}
Dom.Event.dispatch(self.input.dom,'change');});});type("FlexibleSelect",["IWidget","WatchAccessor"],{_decorate:function(key,elem){return this.decorator(key,elem);},_defaultDecorator:function(key,elem){return Html.li('bottomLine',elem);},_drawOptions:function(){if(!this.optionBox){this.optionList=Html.ul('optionBoxList');var liAdd=Html.span('fakeLink',Html.span({style:{fontStyle:'italic'}},$T('Add a different one')));liAdd.href=null;liAdd.observeClick(function(){self._startNew();});this.optionBox=Html.div({style:{position:'absolute',top:pixels(20),left:0},className:'optionBox'},this.optionList,Html.div('optionBoxAdd',liAdd));var self=this;$B(this.optionList,this.list,function(elem){var li=self._decorate(elem.key,elem.get());li.observeClick(function(){self.set(elem.key);self._hideOptions();return false;});return li;});this.container.append(this.optionBox);}},_observeBlurEvents:function(leaveEditable){var self=this;this.stopObservingBlur=this.input.observeEvent('blur',function(){self._endNew(self.input.get(),leaveEditable);});this.input.observeOtherKeys(function(text,key,event){if(key==13){self._endNew(text,leaveEditable);}});},_stopObservingBlurEvents:function(){this.input.stopObserving();this.stopObservingBlur();},_startNew:function(){this._hideOptions();this.input.enable();this.input.setFocus();this.input.set('');this.value.set('');},_endNew:function(text,leaveEditable){this.value.set(text);if(!leaveEditable){this.input.disable();bind.detach(this.input);bind.detach(this.value);}
this._notify();},_hideOptions:function(){this.container.remove(this.optionBox);this.optionBox=null;},_notify:function(){var self=this;each(this.observers,function(observer){observer(self.get());});},draw:function(){var self=this;this.trigger.observeClick(function(){if(!self.disabled){self._drawOptions();}});this.container=Html.div('flexibleSelect',this.trigger,this.input.draw(),this.notificationField);return this.container;},get:function(){return this.value.get();},set:function(value){var oldVal=this.get();if(this.list.get(value)){this.input.set(this.list.get(value));}else{this.input.set(value);this.enableInput();}
this.value.set(value);if(oldVal!=this.get()){this._notify();}
return this.get();},observe:function(observer){this.observers.push(observer);},invokeObserver:function(observer){return observer(this.get());},disable:function(){this.container.dom.className='flexibleSelect disabled';this.input.disable();this.disabled=true;},enable:function(){this.container.dom.className='flexibleSelect';this.disabled=false;if(!this.inputDisabled){this.enableInput();}},disableInput:function(){this.inputDisabled=true;this.input.disable();},enableInput:function(){this.inputDisabled=false;this.input.enable();},setOptionList:function(list){this.list.clear();this.list.update(list);this.list.sort(this.sortCriteria);var self=this;if(keys(list).length===0){this.trigger.dom.style.display='none';}
if(!exists(this.list.get(this.value.get()))){this.enableInput();$B(this.input,this.value);}},setLoading:function(state){if(state){this.trigger.dom.style.display='inline';}
this.loading.set(state);},detach:function(){bind.detach(this.value);this.input.unbind();}},function(list,width,sortCriteria,decorator){width=width||150;this.decorator=decorator||this._defaultDecorator;this.sortCriteria=sortCriteria||SortCriteria.Integer;this.value=new WatchValue();this.input=new RealtimeTextBox({style:{border:'none',width:pixels(width)}});this.input.disable();this.disabled=false;this.inputDisabled=true;this.loading=new WatchValue();this.observers=[];this.notificationField=Html.div({style:{color:'#AAAAAA',position:'absolute',top:'0px',left:'5px'}});this.list=$D(list);this.list.sort(this.sortCriteria);var self=this;this.trigger=Html.div('arrowExpandIcon');$B(this.value,this.input);this.value.observe(function(value){self._notify();});this.loading.observe(function(value){self.trigger.dom.className=value?'progressIcon':'arrowExpandIcon';});$E(document.body).observeClick(function(event){if(self.optionBox&&!self.optionList.ancestorOf($E(eventTarget(event)))&&eventTarget(event)!=self.trigger.dom)
{self._hideOptions();}});this.WatchAccessor(this.get,this.set,this.observe,this.invokeObserver);});type("DisabledButton",["IWidget","WatchAccessor"],{draw:function(){return this.IWidget.prototype.draw.call(this,this.div);},observeEvent:function(observer,func){this.div.observeEvent(observer,func);},observeClick:function(func){var self=this;this.div.observeClick(function(){if(!self.button.dom.disabled){func();}});},enable:function(){this.button.dom.disabled=false;this.topTransparentDiv.dom.style.display="none";},disable:function(){this.button.dom.disabled=true;this.topTransparentDiv.dom.style.display="";},isEnabled:function(){return!this.button.dom.disabled;}},function(button){var self=this;this.button=button;this.topTransparentDiv=Html.div({style:{position:"absolute",top:pixels(0),left:pixels(0),width:Browser.IE?"":"100%",height:Browser.IE?"":"100%"}});this.div=Html.div({style:{display:"inline",position:Browser.IE?"":"relative"}},button,this.topTransparentDiv);});type("HiddenText",["IWidget"],{draw:function(){var self=this;var content=$B(Html.div({style:{display:"inline"}}),this.show,function(show){var message;var button;if(show){message=self.text;button=Html.span("fakeLink"," ("+$T("Hide")+")");button.observeClick(function(){self.show.set(false);});}else{message=self.hiddenMessage;button=Html.span("fakeLink"," ("+$T("Show")+")");button.observeClick(function(){self.show.set(true);});}
return Html.span({},message,button);});return this.IWidget.prototype.draw.call(this,content);}},function(text,hiddenMessage,initialShow){this.text=text;this.hiddenMessage=hiddenMessage;this.show=$V(initialShow);});type("ShowablePasswordField",["IWidget","ErrorAware"],{_setErrorState:function(text){if(this.show){this._stopErrorList=this._setElementErrorState(this.clearTextField,text);}else{this._stopErrorList=this._setElementErrorState(this.passwordField,text);}},getName:function(){return this.name;},set:function(newPassword){this.passwordField.dom.value=newPassword;this.clearTextField.dom.value=newPassword;this.setError(false);},get:function(newPassword){if(this.show){return this.clearTextField.dom.value;}else{return this.passwordField.dom.value;}},refresh:function(){if(this.show){this.button.set(" ("+$T("Hide")+")");this.inputDiv.set(this.clearTextField);}else{this.button.set(" ("+$T("Show")+")");this.inputDiv.set(this.passwordField);}},draw:function(){var self=this;this.inputDiv=Html.div({style:{display:'inline'}});this.passwordField=Html.input('password',{name:this.name},this.initialPassword);this.clearTextField=Html.input('text',{name:this.name},this.initialPassword);this.button=Html.span("fakeLink");this.button.observeClick(function(){if(self.show){self.passwordField.set(self.clearTextField.get());}else{self.clearTextField.set(self.passwordField.get());}
self.show=!self.show;self.refresh();self.setError(false);});this.refresh();var content=Html.div({style:{display:"inline"}},this.inputDiv,this.button);return this.IWidget.prototype.draw.call(this,content);}},function(name,initialPassword,initialShow){this.name=name;this.initialPassword=initialPassword;this.show=initialShow;this.invalidFieldTooltips=[];this.invalidFieldObserverDetachers=[];});type("TypeSelector",["IWidget","WatchAccessor","ErrorAware"],{_checkErrorState:function(){if(this.selectOn){return null;}else{return this.text._checkErrorState();}},setError:function(text){this.text.setError(text);},draw:function(){var self=this;var chooser=new Chooser(new Lookup({select:function(){self.selectOn=true;self._notifyObservers(self.select.get());return Html.div({},self.select," ",$T("or")," ",Widget.link(command(function(){chooser.set('write');self.text.setFocus();},$T("other"))));},write:function(){bind.detach(self.select);self.selectOn=false;self._notifyObservers(self.text.get());return Html.div({},self.text.draw()," ",$T("or")," ",Widget.link(command(function(){chooser.set('select');self.select.dom.focus();},$T("select from list"))));}}));chooser.set('select');return Widget.block(chooser);},isSelect:function(){var self=this;return self.selectOn;},_notifyObservers:function(value){each(this.observers,function(observer){observer(value);});},set:function(value){if(this.selectOn){this.select.set(value);}else{this.text.set(value);}
this._notifyObservers(value);},get:function(){var self=this;if(self.selectOn){return self.select.get();}
else{return self.text.get();}},observe:function(callback){var self=this;this.observers.push(callback);this.select.observe(function(value){if(self.selectOn){callback(value);}});this.text.observe(function(value){if(!self.selectOn){callback(value);}});},getSelectBox:function(){return this.select;},plugParameterManager:function(parameterManager){this.ErrorAware.prototype.plugParameterManager.call(this,parameterManager);}},function(types,selParams,textParams){selParams=selParams||{};textParams=textParams||{};this.select=bind.element(Html.select(selParams),$L(types),function(value){return Html.option({'value':value[0]},value[1]);});textParams.id=Html.generateId();this.text=new RealtimeTextBox(textParams);this.text._checkErrorState=function(){if(this.get()!==''){return null;}else{return $T('Please select a material type');}};this.selectOn=true;this.types=types;this.observers=[];});type("InlineEditWidget",["InlineRemoteWidget"],{setMode:function(mode){this.modeChooser.set(mode);},_buildFrame:function(modeChooser,switchChooser){return Html.div({},modeChooser,Html.div({style:{marginTop:'5px'}},switchChooser));},_handleError:function(error){this._error(error);},_handleContentEdit:function(){var self=this;this.saveButton=Widget.button(command(function(){if(self._verifyInput()){self._savedValue=self._getNewValue();self.source.set(self._savedValue);}},'Save'));var editButtons=Html.div({},this.saveButton,Widget.button(command(function(){self.setMode('display');},'Cancel')));return this._buildFrame(self._handleEditMode(self.value),editButtons);},_handleContentDisplay:function(){var self=this;return this._buildFrame(self._handleDisplayMode(self.value),Widget.link(command(function(){self.setMode('edit');return false;},'(edit)')));},_handleContent:function(mode){var self=this;this.modeChooser=new Chooser(new Lookup({'edit':function(){return self._handleContentEdit();},'display':function(){return self._handleContentDisplay();}}));this.modeChooser.set('display');return Widget.block(this.modeChooser);},_verifyInput:function(){return true;},_setSave:function(state){this.saveButton.dom.disabled=!state;},_handleLoading:function(){return progressIndicator(true,false);},_handleLoaded:function(result){if(exists(result.hasWarning)&&result.hasWarning===true){var popup=new WarningPopup(result.warning.title,result.warning.content);popup.open();this.value=result.result;}else{this.value=result;}}},function(method,attributes,initValue){this.value=initValue;this.InlineRemoteWidget(method,attributes,false);});type("SupportEditWidget",["InlineEditWidget"],{__buildStructure:function(captionValue,emailValue){return Html.table({},Html.tbody({},Html.tr("support",Html.td("supportEntry","Caption :"),Html.td({},captionValue)),Html.tr("support",Html.td("supportEntry","Email :"),Html.td({},emailValue))));},_handleEditMode:function(value){this.caption=Html.edit({},value.caption);this.email=Html.edit({},value.email);this.__parameterManager.add(this.caption,'text',false);this.__parameterManager.add(this.email,'emaillist',true);return this.__buildStructure(this.caption,this.email);},_handleDisplayMode:function(value){return this.__buildStructure(value.caption,value.email);},_getNewValue:function(){emaillist=this.email.get().replace(/(^[ ,;]+)|([ ,;]+$)/g,'');emaillist=emaillist.replace(/[ ,;]+/g,',');return{caption:this.caption.get(),email:emaillist};},_verifyInput:function(){if(!this.__parameterManager.check()){return false;}
return true;}},function(method,attributes,initValue){this.InlineEditWidget(method,attributes,initValue);this.__parameterManager=new IndicoUtil.parameterManager();});type("SessionRenameWidget",["InlineWidget"],{setMode:function(mode){this.modeChooser.set(mode);var contentHeight=this.parentContainer.content.dom.offsetHeight;this.parentContainer.contentWrapper.setStyle('height',pixels(contentHeight));},_buildFrame:function(modeChooser,switchChooser){return Html.div({},modeChooser,Html.div({style:{marginTop:'5px',marginLeft:'5px',display:'inline'}},switchChooser));},__buildStructure:function(sessionTitleValue){return Html.div({style:{display:'inline'}},Html.span("sessionRenameEntry",$T("This slot belongs to the session ")),Html.span("sessionRenameValue",sessionTitleValue));},draw:function(){var self=this;var content=this._handleContent();var wcanvas=Html.div({},content);return wcanvas;},_handleContent:function(mode){var self=this;this.modeChooser=new Chooser(new Lookup({'edit':function(){return self._handleContentEdit();},'display':function(){return self._handleContentDisplay();}}));this.modeChooser.set('display');return Widget.block(this.modeChooser);},_handleContentEdit:function(){var self=this;return this._buildFrame(self._handleEditMode(self.value),'');},_handleContentDisplay:function(){var self=this;return this._buildFrame(self._handleDisplayMode(self.value),Widget.link(command(function(){self.setMode('edit');return false;},$T('(rename Session)'))));},_handleEditMode:function(value){this.sessionTitle=Html.edit({},value);this.__parameterManager.add(this.sessionTitle,'text',false);$B(this.info.accessor('sessionTitle'),this.sessionTitle);return this.__buildStructure(this.sessionTitle);},_handleDisplayMode:function(value){var val=value;if(val.length>20){val=val.substr(0,17)+'...';}
return this.__buildStructure("'"+val+"'");}},function(initValue,parameterManager,parentContainer,info){this.value=initValue;this.parentContainer=parentContainer;this.__parameterManager=parameterManager;this.info=info;});type('AutocheckTextBox',['RealtimeTextBox'],{_textTyped:function(key){var self=this;var text=trim(this.get());if(text.length>1){if(text!=self.originalText){if(exists(self.functionToHide)){self.functionToHide(self.component);}
else{self.component.dom.style.display="none";}}
else{if(exists(self.functionToShow)){self.functionToShow(self.component);}
else{self.component.dom.style.display='';}}}},setOriginalText:function(text){this.originalText=text;},startWatching:function(isRepeated,originalText){var self=this;self.setOriginalText(originalText==null?self.get():originalText);if(isRepeated){if(exists(self.functionToShow)){self.functionToShow(self.component);}
else{self.component.dom.style.display='';}}
else{if(exists(self.functionToHide)){self.functionToHide(self.component);}
else{self.component.dom.style.display="none";}}
self.observe(function(key,event){self._textTyped(key);return true;});}},function(args,component,functionToShow,functionToHide){args.autocomplete='off';this.RealtimeTextBox(args);this.setOriginalText(this.get());this.component=component;this.functionToShow=functionToShow;this.functionToHide=functionToHide;});type("DateTimeSelector",["RealtimeTextBox","ErrorAware"],{get:function(direct){var value=RealtimeTextBox.prototype.get.call(this);if(value&&!direct){var dateTime=Util.parseDateTime(value,this.displayFormat);if(dateTime){return Util.formatDateTime(dateTime,IndicoDateTimeFormats.Server);}else{return undefined;}}else if(direct){return value;}else{return null;}},draw:function(){this.enableEvent();return this.IWidget.prototype.draw.call(this,this.tab);},set:function(value,direct){if(!direct){var dateTime=Util.parseDateTime(value,IndicoDateTimeFormats.Server);RealtimeTextBox.prototype.set.call(this,Util.formatDateTime(dateTime,this.displayFormat));}else{RealtimeTextBox.prototype.set.call(this,value);}},_setErrorState:function(text){var self=this;this._stopErrorList=this._setElementErrorState(this.input,text);if(text!==null){if(this.tab.dom.className.slice(-7)!="invalid"){this.tab.dom.className+=" invalid";}}
this._stopErrorList.push(function(){if(self.tab.dom.className.slice(-7)=="invalid"){self.tab.dom.className=self.tab.dom.className.substring(0,self.tab.dom.className.length-8);}});},_setElementErrorState:function(element,text){return IndicoUtil.markInvalidField(element,text,true)[1];},_checkErrorState:function(){var value=this.get();if(this.mandatory?!value:value===undefined){return $T('Date is invalid');}else{return null;}}},function(args,format,mandatory){this.displayFormat=format||IndicoDateTimeFormats.Default;this.mandatory=mandatory||false;this.RealtimeTextBox(args);this.input;this.trigger=Html.img({src:imageSrc("calendarWidget")});this.tab=Html.div("dateField",this.input,this.trigger);var self=this;this.observe(function(){self.askForErrorCheck();return true;});var onSelect=function(cal){var p=cal.params;var update=(cal.dateClicked||exists(cal.activeDiv._range));if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")
p.inputField.onchange();}
if(update&&p.displayArea)
p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")
p.onUpdate(cal);};Calendar.setup({inputField:this.input.dom,button:this.trigger.dom,displayArea:this.input,eventName:"click",ifFormat:this.displayFormat,showsTime:true,align:"",onUpdate:function(){self.notifyChange();},onSelect:onSelect});});type("StartEndDateWidget",["InlineEditWidget"],{__buildStructure:function(start,end){return Html.table({},Html.tbody({},Html.tr("startEndDate",Html.td("startEndDateEntry","Starts :"),Html.td({},start)),Html.tr("startEndDate",Html.td("startEndDateEntry","Ends :"),Html.td({},end))));},__verifyDates:function(){var valid=true;this.startDate.askForErrorCheck();this.endDate.askForErrorCheck();if(this.startDate.inError()||this.endDate.inError()){valid=false;}else{var sDateTime=Util.parseJSDateTime(this.startDate.get(),IndicoDateTimeFormats.Server);var eDateTime=Util.parseJSDateTime(this.endDate.get(),IndicoDateTimeFormats.Server);if(sDateTime>=eDateTime){valid=false;this.startDate.setError($T('Start date should be before end date'));this.endDate.setError($T('End date should be after start date'));}else{valid=true;this.startDate.setError(null);this.endDate.setError(null);}}
this._setSave(valid);},_handleEditMode:function(value){this.shiftTimes=Html.checkbox({});this.startDate=new DateTimeSelector();this.endDate=new DateTimeSelector();this.startDate.set(Util.formatDateTime(value.startDate,IndicoDateTimeFormats.Server));this.endDate.set(Util.formatDateTime(value.endDate,IndicoDateTimeFormats.Server));var self=this;this.startDate.observe(function(){self.__verifyDates();return true;});this.endDate.observe(function(){self.__verifyDates();return true;});return Html.div({},this.__buildStructure(this.startDate.draw(),this.endDate.draw()),Html.div("widgetCheckboxOption",this.shiftTimes,Html.span({},$T("Move session/contribution times in the timetable accordingly"))));},_handleDisplayMode:function(value){return this.__buildStructure(Util.formatDateTime(value.startDate),Util.formatDateTime(value.endDate));},_getNewValue:function(){return{startDate:Util.parseDateTime(this.startDate.get(),IndicoDateTimeFormats.Server),endDate:Util.parseDateTime(this.endDate.get(),IndicoDateTimeFormats.Server),shiftTimes:this.shiftTimes};},_verifyInput:function(){if(!Util.parseDateTime(this.startDate.get())){return false;}else if(!Util.parseDateTime(this.endDate.get())){return false;}
return true;}},function(method,attributes,initValue){this.InlineEditWidget(method,attributes,initValue);});type("DateTimeDurationWidget",["IWidget"],{draw:function(){this.dateTimeField=new DateTimeSelector({});$B(this.dateTimeField,this.data.accessor('dateTime'));return Html.div({},Html.label("fieldLabel",this.dateTimeLabel),this.dateTimeField.draw(),Html.span({style:{marginLeft:pixels(10)}},""),Html.label("fieldLabel",this.durationLabel),$B(IndicoUI.Widgets.Generic.durationField(),this.data.accessor('duration')));},set:function(property,value){this.data.set(property,value);},accessor:function(property){return this.data.accessor(property);}},function(defaultDateTime,defaultDur,dateTimeLabel,durationLabel){this.dateTimeLabel=dateTimeLabel||$T("Date/Time:");this.durationLabel=durationLabel||$T("Duration(min):");this.data=new WatchObject();this.data.set('dateTime',defaultDateTime);this.data.set('duration',defaultDur);});type("DateTimeSelectorWFields",["DateTimeSelector"],{_setHiddenFields:function(value){var dtValue=Util.parseJSDateTime(value,IndicoDateTimeFormats.Server)
if(!dtValue){each(this._fields,function(fname){$E(fname).set('');});return;}
$E(this._fields[0]).set(dtValue.getDate());$E(this._fields[1]).set(dtValue.getMonth()+1);$E(this._fields[2]).set(dtValue.getFullYear());if(!this._dateOnly){$E(this._fields[3]).set(dtValue.getHours());$E(this._fields[4]).set(dtValue.getMinutes());}}},function(args,format,mandatory,dateOnly,fields){this.DateTimeSelector(args,format,mandatory);this._fields=fields;this._dateOnly=dateOnly;var self=this;this.observe(function(value){self._setHiddenFields(value)});});type("ChainedPopupWidget",["PopupWidget"],{clickTriggersClose:function(target){var result=true;each(this.chainElements,function(element){element=element.ChainedPopupWidget?element.canvas:element;result=result&&!element.ancestorOf(target);});return result&&!this.canvas.ancestorOf(target);},open:function(x,y){var self=this;if(this.active){return;}else{this.active=true;}
this.PopupWidget.prototype.open.call(this,x,y);this.handler=function(event){if(self.clickTriggersClose($E(eventTarget(event)))){self.close();each(self.chainElements,function(element){if(element.ChainedPopupWidget){element.close();}});}};IndicoUtil.onclickHandlerAdd(this.handler);},postDraw:function(){this.PopupWidget.prototype.postDraw.call(this);if(this.alignRight){this.canvas.dom.style.visibility='hidden';this.canvas.dom.style.left=0;this.canvas.dom.style.left=pixels(this.x-this.canvas.dom.offsetWidth);this.canvas.dom.style.visibility='visible';}},close:function(){this.active=false;IndicoUtil.onclickHandlerRemove(this.handler);this.PopupWidget.prototype.close.call(this);}},function(chainElements,alignRight){this.PopupWidget();this.chainElements=chainElements;this.active=false;this.alignRight=any(alignRight,false);});type("PopupMenu",["ChainedPopupWidget"],{_processItem:function(pair){var self=this;var value=pair.get();var link=Html.a('fakeLink',pair.key);if(typeof value=="string"){link.setAttribute('href',value);if(self.closeOnClick){link.observeClick(function(){self.close();});}}
else{link.observeClick(pair.get().PopupWidget?function(e){if(self.selected){self.selected.dom.className=null;self.selected=null;}
link.dom.className='selected';self.selected=link;var pos=listItem.getAbsolutePosition();each(self.items,function(item,key){if(item.PopupWidget&&item.isOpen()){item.close();}});IndicoUtil.onclickHandlerRemove(self.handler);var target=pair.get();target.open(pos.x+(target.alignRight?0:link.dom.offsetWidth),pos.y-1);return false;}:function(){pair.get()(self);if(self.closeOnClick){self.close();}});}
var listItem=null;if(pair.key===this.currentItem){listItem=Html.li("current",link);}
else{listItem=Html.li({},link);}
return listItem;},close:function(){if(this.closeHandler()){this.ChainedPopupWidget.prototype.close.call(this);}},draw:function(x,y){var self=this;var content=$B(Html.ul(self.cssClass),this.items,function(pair){return self._processItem(pair);});return this.PopupWidget.prototype.draw.call(this,content,x,y);}},function(items,chainElements,cssClass,closeOnClick,alignRight,closeHandler,currentItem){this.ChainedPopupWidget(chainElements,alignRight);this.items=items;this.currentItem=currentItem;this.selected=null;this.cssClass="popupList "+any(cssClass,"");this.closeOnClick=any(closeOnClick,false);this.closeHandler=any(closeHandler,function(){return true;});});type("SectionPopupMenu",["PopupMenu"],{draw:function(x,y){var self=this;var sectionContent=Html.ul(self.cssClass);each(this.items,function(item,key){var section=null;if(key!==""){section=Html.li('section',Html.div('line',Html.div('name',key)));}
var tmp=$B(Html.ul('subPopupList'),item,self._processItem);sectionContent.append(Html.li({},section,tmp));});return this.PopupWidget.prototype.draw.call(this,sectionContent,x,y);}},function(items,chainElements,cssClass,closeOnClick,alignRight,closeHandler){this.ChainedPopupWidget(chainElements,alignRight);this.items=items;this.selected=null;this.cssClass="popupList sectionPopupList "+any(cssClass,"");this.closeOnClick=any(closeOnClick,false);this.closeHandler=any(closeHandler,function(){return true;});});type("SessionSectionPopupMenu",["SectionPopupMenu"],{_processItem:function(pair){var self=this;var value=pair.get();var color=null;var title=null;if(exists(value.title)){title=value.title;}else{title=pair.key;}
if(exists(value.color)){color=value.color;value=value.func;}
var colorSquare=null;if(color!==null){colorSquare=Html.div({style:{backgroundColor:color,color:color,cssFloat:'right',width:'15px',height:'15px'}});}
var link=Html.a({className:'fakeLink',style:{display:'inline',padding:0,paddingLeft:'4px',paddingRight:'4px'}},Util.truncate(title));var divInput=Html.div({style:{height:'20px',overflow:'auto'}},colorSquare,link);if(typeof value=="string"){link.setAttribute('href',value);if(self.closeOnClick){link.observeClick(function(){self.close();});}}
else{link.observeClick(value.PopupWidget?function(e){if(self.selected){self.selected.dom.className=null;self.selected=null;}
link.dom.className='selected';self.selected=link;var pos=listItem.getAbsolutePosition();each(self.items,function(item,key){if(item.PopupWidget&&item.isOpen()){item.close();}});IndicoUtil.onclickHandlerRemove(self.handler);var target=value;target.open(pos.x+(target.alignRight?0:link.dom.offsetWidth),pos.y-1);return false;}:function(){value(self);if(self.closeOnClick){self.close();}});}
var listItem=Html.li({},divInput);return listItem;}},function(items,chainElements,cssClass,closeOnClick,alignRight,closeHandler){this.SectionPopupMenu(items,chainElements,cssClass,closeOnClick,alignRight,closeHandler);});type("RadioPopupWidget",["ChainedPopupWidget"],{draw:function(x,y){var self=this;var optionsId=Html.generateId();this.radioButtons={};var content=$B(Html.ul({className:"popupList",style:{padding:pixels(2)}}),this.states,function(pair){var optionRadio=Html.radio({name:optionsId});self.radioButtons[pair.key]=optionRadio;optionRadio.observe(function(value){if(value){self.accessor.set(pair.key);}});return Html.li({},Html.span({style:{padding:'0px 4px 2px 0px'}},optionRadio,pair.get()));});return this.PopupWidget.prototype.draw.call(this,content,x,y);},postDraw:function(){var self=this;each(this.radioButtons,function(radio,key){if(self.accessor.get()==key){radio.set(true);}});}},function(states,accessor,chainElements){this.ChainedPopupWidget(chainElements);this.states=states;this.accessor=accessor;});type("CheckPopupWidget",["ChainedPopupWidget"],{draw:function(x,y,maxHeight,styles){var self=this;var optionsId=Html.generateId();this.checkboxes={};var content=null;if(this.options.isEmpty()&&this.noOptionsMessage){content=Html.ul({className:"popupList",style:{maxHeight:pixels(maxHeight),fontStyle:'italic',color:'#444444',padding:pixels(5)}},this.noOptionsMessage);return this.PopupWidget.prototype.draw.call(this,content,x,y,styles);}
content=$B(Html.ul({className:"popupList popupListCheckboxes",style:{maxHeight:pixels(maxHeight),overflowY:'auto',overflowX:'hidden',padding:pixels(2)}}),this.options,function(pair){var optionCheck=Html.checkbox({});optionCheck.dom.name=optionsId;optionCheck.observeClick(function(e){if(!e){e=window.event;}
e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}});self.checkboxes[pair.key]=optionCheck;$B(optionCheck,self.object.accessor(pair.key));var color=self.colors.get(pair.key);if(!color){color='transparent';}
var textColor=self.textColors.get(pair.key);if(!textColor){textColor='black';}
var span=Html.span('wrapper',pair.get());var li=Html.li({style:{backgroundColor:color,color:textColor,marginBottom:'2px'}},optionCheck,span);li.observeClick(function(){self.object.set(pair.key,!self.object.get(pair.key));});return li;});return this.PopupWidget.prototype.draw.call(this,content,x,y,styles);},postDraw:function(){var self=this;each(this.checkboxes,function(check,key){if(self.object.get(key)){check.set(true);}});}},function(options,object,colors,textColors,chainElements,noOptionsMessage){this.ChainedPopupWidget(chainElements);this.options=options;this.object=object;this.colors=colors;this.textColors=textColors;this.noOptionsMessage=any(noOptionsMessage,null);});type("ColorPicker",["WatchValue","ChainedPopupWidget"],{defaultColors:[{bgColor:'#EEE0EF',textColor:'#1D041F'},{bgColor:'#E3F2D3',textColor:'#253F08'},{bgColor:'#FEFFBF',textColor:'#1F1F02'},{bgColor:'#DFE555',textColor:'#202020'},{bgColor:'#FFEC1F',textColor:'#1F1D04'},{bgColor:'#DFEBFF',textColor:'#0F264F'},{bgColor:'#0D316F',textColor:'#EFF5FF'},{bgColor:'#1A3F14',textColor:'#F1FFEF'},{bgColor:'#5F171A',textColor:'#FFFFFF'},{bgColor:'#D9DFC3',textColor:'#272F09'},{bgColor:'#4F144E',textColor:'#FFEFFF'},{bgColor:'#6F390D',textColor:'#FFEDDF'},{bgColor:'#8ec473',textColor:'#021F03'},{bgColor:'#92b6db',textColor:'#03070F'},{bgColor:'#DFDFDF',textColor:'#151515'},{bgColor:'#ecc495',textColor:'#1F1100'},{bgColor:'#b9cbca',textColor:'#0F0202'},{bgColor:'#C2ECEF',textColor:'#0D1E1F'},{bgColor:'#d0c296',textColor:'#000000'},{bgColor:'#EFEBC2',textColor:'#202020'}],draw:function(x,y){var self=this;var colorInputChanged=function(colorType,color,previewBlock){if(!self._validateColor(color)){previewBlock.set('x');previewBlock.dom.style.backgroundColor='transparent';}else{previewBlock.set('');previewBlock.dom.style.backgroundColor=color;var colors=clone(self.get());colors[colorType]=color;self.set(colors);}};var updateColorInput=function(color,inputElement,previewBlock){if(!color){return;}
previewBlock.dom.style.backgroundColor=color;inputElement.set(color.substr(1,color.length-1));};var createColorInput=function(colorType){var input=Html.edit();var preview=Html.div('previewBlock');input.observeEvent('keyup',function(){colorInputChanged(colorType,'#'+input.get(),preview);});self.observe(function(colors){updateColorInput(colors[colorType],input,preview);});updateColorInput(self.get()[colorType],input,preview);return Html.div('inputWrapper',preview,Html.div('inputContainer clearfix',Html.div('numberSign','#'),input));};var tbody=Html.tbody({});var tr;var i=0;each(self.defaultColors,function(c){if(i++%5===0){tr=Html.tr();tbody.append(tr);}
var colorBlock=Html.div({className:'block',style:{backgroundColor:c.bgColor,color:c.textColor}},'e');colorBlock.observeClick(function(e){self.set(c);self.close();});tr.append(Html.td({},colorBlock));});var div=Html.div('colorPicker');div.observeEvent('keyup',function(e){if(e.keyCode==27){self.close();}});div.append(Html.table({},tbody));tbody=Html.tbody({});var customTable=Html.table({className:'custom',cellspacing:'0',cellpadding:'0',border:'0'},tbody);tbody.append(Html.tr({},Html.td({},'Block'),Html.td({},createColorInput('bgColor'))));tbody.append(Html.tr({},Html.td({},'Text'),Html.td({},createColorInput('textColor'))));div.append(customTable);var currentColors=this.get();var showCustom=true;for(var i in this.defaultColors){colors=this.defaultColors[i];if(colors.textColor==currentColors.textColor&&colors.bgColor==currentColors.bgColor){showCustom=false;break;}}
if(!showCustom){var customLink=Html.a({className:'fakeLink',style:{fontSize:'0.8em'}},'Custom colors');customTable.dom.style.display='none';customLink.observeClick(function(){customTable.dom.style.display='block';customLink.dom.style.display='none';});div.append(Html.div({style:{textAlign:'right',margin:'3px 5px'}},customLink));}
return this.PopupWidget.prototype.draw.call(this,div,x,y);},getLink:function(onclick,text){var self=this;text=any(text,$T('Color'));onclick=any(onclick,function(){return true;});this.link=Html.span('colorPickerLink',Html.span({},text));this._updateLink(this.get());this.observe(function(colors){self._updateLink(colors);});this.chainElements.push(this.link);this.link.observeClick(function(){if(self.active){self.close();}else if(onclick()){var pos=self.link.getAbsolutePosition();pos.y+=self.link.dom.offsetHeight;if(self.alignRight){pos.x+=self.link.dom.offsetWidth;}
self.open(pos.x+3,pos.y+2);}});return this.link;},setColors:function(textColor,bgColor){this.set({textColor:textColor,bgColor:bgColor});},getTextColor:function(){return this.get().textColor;},getBgColor:function(){return this.get().bgColor;},_validateColor:function(color){var regexp=new RegExp("^#?([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$");return regexp.test(color);},_getRandomColors:function(){var rand=Math.floor(Math.random()*this.defaultColors.length);return this.defaultColors[rand];},_updateLink:function(colors){if(!exists(this.link)){return;}
var cssClass='dropDownMenu';if(colors.bgColor){this.link.dom.style.backgroundColor=colors.bgColor;if(this._colorIsDark(colors.bgColor)){cssClass='dropDownMenuGrey';}}
var tmp=this.link.dom.childNodes[0];if(colors.textColor){tmp.style.color=colors.textColor;}
tmp.className='fakeLink '+cssClass;},_colorIsDark:function(color){if(color.length==4){var tmp="#";for(var i in color){if(i!==0){tmp+=color[i]+color[i];}}
color=tmp;}
var rgb=[parseInt(color.substr(1,2),16),parseInt(color.substr(3,2),16),parseInt(color.substr(5,2),16)];return Math.floor((rgb[0]+rgb[1]+rgb[2])/3)<128;}},function(chainElements,alignRight,bgColor,textColor){this.triggerElement=chainElements[0];this.ChainedPopupWidget(chainElements,alignRight);if(!exists(textColor)||!exists(bgColor)){var c=this._getRandomColors();textColor=c.textColor;bgColor=c.bgColor;}
this.WatchValue({'textColor':textColor,'bgColor':bgColor});});var executeOnload=false;var __globalEditorTable={};var languages={'en_US':'en','fr_FR':'fr'};var userLanguage='en_US';type("RichTextEditor",["IWidget","Accessor"],{draw:function(){var self=this;this.div=Html.div({'id':'text'+this.divId,style:{height:this.height+75,width:this.width}});setTimeout(function(){initializeEditor(self,'text'+self.divId,self.text,self.callbacks,self.width,self.height,self.toolbarSet);},50);return this.div;},get:function(){if(this.getEditor()&&this.getEditor().getData){return this.getEditor().getData();}else{return'';}},set:function(text){var self=this;if(this.getEditor()&&this.getEditor().setData){this.getEditor().setData(text);}else{this.text=text;}},observe:function(callback){this.callbacks.append(callback);},unbind:function(){this.observing=false;this.callbacks.clear();},onLoad:function(callback){this.onLoadList.append(callback);},destroy:function(){this.unbind();},getEditor:function(){return CKEDITOR.instances["text"+this.divId];}},function(width,height,toolbarSet){this.onLoadList=new WatchList();this.callbacks=new WatchList();this.width=width;this.height=height;this.toolbarSet=toolbarSet?toolbarSet:'IndicoMinimum';this.divId=Html.generateId();});type("ParsedRichTextEditor",["RichTextEditor"],{clean:function(){if(this.getEditor()&&this.getEditor().getData){return cleanText(this.getEditor().getData(),this)}else{return false;}}},function(width,height,toolbarSet,sanitizationLevel){this.RichTextEditor(width,height,toolbarSet);this.sanitizationLevel=sanitizationLevel?sanitizationLevel:2;});type("RichTextWidget",["IWidget","Accessor"],{draw:function(){this.richDiv.append(this.rich.draw());return Html.div({},this.plain.draw(),this.richDiv,Widget.link(this.switchLink));},observe:function(callback){var self=this;var observeFunc=function(value){self.plain.unbind();self.rich.unbind();if(value=='rich'){self.rich.observe(function(){callback(self.rich);});}else{self.plain.observe(function(){callback(self.plain);});}};this.selected.observe(observeFunc);observeFunc(this.selected.get());},get:function(){return this.activeAccessor.get();},set:function(value,noDetection){this.currentText=value;if(!any(noDetection,false)){if((Util.Validation.isHtml(value)?'rich':'plain')!=this.selected.get()){this.switchLink.get()(false);}}
if(value&&(this.loaded||this.selected.get()=='plain')){this.activeAccessor.set(value);}},synchronizePlain:function(){this.currentText=this.rich.get();this.plain.set(this.currentText);},synchronizeRich:function(){this.currentText=this.plain.get();this.rich.set(this.currentText);},postDraw:function(){this.rich.postDraw();},destroy:function(){this.rich.destroy();}},function(width,height,initialText,mode,toolbarSet){var textAreaParams={style:{}};textAreaParams.style.width=pixels(width);textAreaParams.style.height=pixels(height);this.plain=new RealtimeTextArea(textAreaParams);this.rich=new RichTextEditor(width,height,toolbarSet);this.richDiv=Html.div({});this.currentText=any(initialText,'');this.loaded=false;this.selected=new WatchValue();this.toPlainFunc=function(sync){self.plain.setStyle('display','block');self.richDiv.setStyle('display','none');self.switchLink.set('toRich');self.activeAccessor=self.plain;self.selected.set('plain');if(sync!==false){self.synchronizePlain();}};this.toRichFunc=function(sync){self.plain.setStyle('display','none');self.richDiv.setStyle('display','block');self.switchLink.set('toPlain');self.activeAccessor=self.rich;self.selected.set('rich');if(sync!==false){self.synchronizeRich();}};var self=this;this.switchLink=new Chooser({toPlain:command(self.toPlainFunc,$T("switch to plain text")),toRich:command(self.toRichFunc,$T("switch to rich text"))});if(exists(mode)&&mode=='rich'){self.toRichFunc();}else if(exists(mode)){self.toPlainFunc();}else if(Util.Validation.isHtml(self.currentText)){self.toRichFunc();}else{self.toPlainFunc();}
this.rich.onLoad(function(){self.loaded=true;self.set(self.currentText,true);});});type("ParsedRichTextWidget",['RichTextWidget'],{clean:function(){if(this.activeAccessor==this.rich)
return this.rich.clean();else if(this.activeAccessor==this.plain)
return cleanText(this.plain.get(),this.plain);}},function(width,height,initialText,mode,toolbarSet){this.RichTextWidget(width,height,initialText,mode,toolbarSet);this.rich=new ParsedRichTextEditor(width,height,toolbarSet);var self=this;if(exists(mode)&&mode=='rich'){self.toRichFunc();}else if(exists(mode)){self.toPlainFunc();}else if(Util.Validation.isHtml(self.currentText)){self.toRichFunc();}else{self.toPlainFunc();}
this.rich.onLoad(function(){self.loaded=true;self.set(self.currentText,true);});});type("RichTextInlineEditWidget",["InlineEditWidget"],{_handleEditMode:function(value){this.description=new RichTextWidget(600,400,'','rich','IndicoMinimal');this.description.set(value);return this.description.draw();},_handleDisplayMode:function(value){var self=this;var iframeId="descFrame"+Html.generateId();var iframe=Html.iframe({id:iframeId,name:iframeId,style:{width:pixels(600),height:pixels(100),border:"1px dotted #ECECEC"}});var loadFunc=function(){var doc;if(Browser.IE){doc=document.frames[iframeId].document;}else{doc=$E(iframeId).dom.contentDocument;}
if(value==""){value='<em>No description</em>';}
doc.body.innerHTML='<link href="css/Default.css" type="text/css" rel="stylesheet">'+(Util.Validation.isHtml(value)?value:escapeHTML(value));};if(Browser.IE){iframe.dom.onreadystatechange=loadFunc;}else{iframe.observeEvent("load",loadFunc);}
return iframe;},_handleBackToEditMode:function(){this.description.set(this._savedValue);},_getNewValue:function(){return this.description.get();}},function(method,attributes,initValue,width,height){this.width=width?width:600;this.height=height?height:100;this.InlineEditWidget(method,attributes,initValue);});type("ParsedRichTextInlineEditWidget",["RichTextInlineEditWidget"],{_handleEditMode:function(value){this.description=new ParsedRichTextWidget(600,400,'','rich','IndicoMinimal');this.description.set(value);return this.description.draw();},_handleContentEdit:function(){var self=this;this.saveButton=Widget.button(command(function(){if(self._verifyInput()&&self.description.clean()){self._savedValue=self._getNewValue();self.source.set(self._savedValue);}},'Save'));var editButtons=Html.div({},this.saveButton,Widget.button(command(function(){self.setMode('display');},'Cancel')));return this._buildFrame(self._handleEditMode(self.value),editButtons);}},function(method,attributes,initValue,width,height){this.RichTextInlineEditWidget(method,attributes,initValue,width,height)});function initializeEditor(wrapper,editorId,text,callbacks,width,height,toolbarSet){try{CKEDITOR.replace(editorId,{language:userLanguage,width:width,height:height-75,'toolbar':toolbarSet});var cki=CKEDITOR.instances[editorId];cki.setData(text);cki.on('key',function(e)
{each(callbacks,function(func){func();})});cki.on('instanceReady',function(e)
{each(wrapper.onLoadList,function(callback){callback();});});}
catch(error){setTimeout(function(){initializeEditor(wrapper,editorId,text,callbacks,width,height);},50);}}
function cleanText(text,target){try{var self=target;killProgress=IndicoUI.Dialogs.Util.progress($T('Saving...'));var parsingResult=escapeHarmfulHTML(text);if(parsingResult[1]>0){var cleaningFunction=function(confirmed){if(confirmed){self.set(parsingResult[0]);}};var security;switch(parsingResult[1]){case 1:security="HTML";break;case 2:security="HTML and scripts";break;default:security="code";break;}
killProgress();var showErrorList=Html.span("fakeLink",$T("here"));showErrorList.observeClick(function(){var ul=Html.ul({id:'',style:{listStyle:'circle',marginLeft:'-25px'}});each(parsingResult[2],function(value){ul.append(Html.li('',value));});var popupErrorList=new AlertPopup(Html.span('warningTitle',"List of forbidden elements"),ul);popupErrorList.open();});var popup=new ConfirmPopup($T("Warning!"),Html.div({style:{width:pixels(300),textAlign:'justify'}},$T("Your data contains some potentially harmful "+security+", which cannot be stored in the database. Use the automatic Indico cleaner or clean the text manually (see the list of forbidden elements that you are using "),showErrorList,")."),cleaningFunction);popup.draw=function(){var self=this;var okButton=Html.input('button',{style:{marginRight:pixels(3)}},$T('Clean automatically'));okButton.observeClick(function(){self.close();self.handler(true);});var cancelButton=Html.input('button',{style:{marginLeft:pixels(3)}},$T('Clean manually'));cancelButton.observeClick(function(){self.close();self.handler(false);});return this.ExclusivePopupWithButtons.prototype.draw.call(this,this.content,Html.div({},okButton,cancelButton));}
popup.open();return false;}
else{killProgress();return true;}}catch(error){if(killProgress)
killProgress();if(typeof error=="string"&&error.indexOf("Parse Error")!=-1){var popup=new WarningPopup($T("Warning!"),$T("Format of your data is invalid. Please check the syntax."));popup.open();return false;}
else
throw error;}}
var makePageList=function(nPages,selectedPage,around){var result=[];result.push(selectedPage);var min=selectedPage;var max=selectedPage;var remaining=around*2;var i=1;while(remaining>0&&(min>1||max<nPages)){if(selectedPage-i>0){min=selectedPage-i;result.push(min)
remaining--;}
if(selectedPage+i<=nPages){max=selectedPage+i;result.push(max);remaining--;}
i++;}
var roundTo10=function(n){var remainder=n%10;return(n-remainder);}
min=roundTo10(min-1);max=roundTo10(max+10);var firstInserted=false;var lastInserted=false;for(i=0;i<around/2;i++){if(min>0){result.push(min)}
if(max<=nPages){result.push(max)}
min-=10;max+=10;}
result.sort(numberSorter);if(result[result.length-1]!=nPages){result.push(nPages)}
if(result[0]!=1){result.push(1);result.sort(numberSorter);}
return result;}
type("PageFooter",[],{getNumberOfPages:function(){return this.nPages;},setNumberOfPages:function(nPages){nPages=parseInt(nPages);this.nPages=nPages;this.selectedPage=1;},getSelectedPage:function(){return this.selectedPage;},selectPage:function(page){page=parseInt(page);this.selectedPage=page;this.refresh()},refresh:function(){var self=this;var pages=makePageList(this.nPages,this.selectedPage,this.around);if(this.nPages>1){if(this.hidden){IndicoUI.Effect.appear(this.content);this.hidden=false;}
this.content.clear();each(pages,function(i){var page=Html.a(i==self.selectedPage?'pageSelected':'pageUnselected',i);page.observeClick(function(){self.handler(i);});self.content.append(Html.li('pageNumber'+(i==self.nPages?' lastPageNumber':''),page))});}else{this.hidden=true;IndicoUI.Effect.disappear(this.content);}},draw:function(){this.content=Html.ul('pageNumberList');this.refresh();return this.content;}},function(nPages,initialPage,around,handler){this.nPages=parseInt(nPages);if(!this.nPages){this.nPages=1}
this.selectedPage=parseInt(initialPage);if(!this.selectedPage){this.selectedPage=1}
this.around=around;if(!this.around){this.around=4}
this.handler=handler;this.hidden=false;});type("PopupDialog",["PopupWidget"],{draw:function(content,x,y){return this.PopupWidget.prototype.draw.call(this,content,x,y);},clickTriggersClosing:function(target){var nonCloseTriggeringClick=false;each(this.nonCloseTriggeringElements,function(e){if(e.ancestorOf(target)){nonCloseTriggeringClick=true;}});return(!this.canvas.ancestorOf(target)&&!this.triggerElement.ancestorOf(target)&&!nonCloseTriggeringClick);},open:function(x,y){var self=this;this.PopupWidget.prototype.open.call(this,x,y);self.clickHandler=function(event){if(self.clickTriggersClosing($E(eventTarget(event)))){self.close();}};IndicoUtil.onclickHandlerAdd(self.clickHandler);},close:function(){if(this.closeHandler()&&this.isopen){IndicoUtil.onclickHandlerRemove(this.clickHandler);this.PopupWidget.prototype.close.call(this);}},addNonCloseTriggeringElement:function(element){this.nonCloseTriggeringElements.push(element);}},function(content,triggerElement,closeHandler,nonCloseTriggeringElements){this.content=content;this.PopupWidget();this.triggerElement=triggerElement;this.closeHandler=any(closeHandler,function(){return true;});this.nonCloseTriggeringElements=any(nonCloseTriggeringElements,[]);});type("ExclusivePopup",["PopupWidget","Printable"],{open:function(){this.PopupWidget.prototype.open.call(this);},draw:function(content,customStyle){var self=this;customStyle=any(customStyle,{});this.greyBg=Html.div({className:this.printable?'noprint':'',style:{'opacity':0.5,'filter':'alpha(opacity=50)','-khtml-opacity':0.5,'-moz-opacity':0.5,'background':'#444444','position':'fixed','width':'100%','height':'100%','left':pixels(0),'top':pixels(0)}});IndicoUI.assignLayerLevel(this.greyBg);$E(document.body).append(this.greyBg);this.content=Html.div({},content);this.contentWrapper=Html.div({style:{padding:pixels(10)}},this.content);this.container=Html.div({className:'exclusivePopup'+(this.printable?' noprint':''),style:customStyle},this.contentWrapper);this.titleDiv=Html.div('title',this.title);this.titleWrapper=Html.div('titleWrapper',this.titleDiv);if(this.title&&this.title!==''){this.container.append(Html.div('exclusivePopupTopBg',Html.div({style:{width:'20px',height:'20px'}})));this.container.append(this.titleWrapper);this.contentWrapper.setStyle('paddingTop','0px');}
this.container.append(this.contentWrapper);this.closeButton=null;if(this.closeHandler!==null){this.closeButton=Html.div('exclusivePopupCloseButton');this.closeButton.observeClick(function(e){if(self.closeHandler()){self.close();}});this.titleWrapper.append(this.closeButton);}
this.printLink=null;if(this.showPrintButton){this.printLink=Html.div('printLink',Html.div('printButton fakeLink','Print'));this.titleWrapper.append(this.printLink);this.printLink.observeClick(function(){self.print();});}
return this.PopupWidget.prototype.draw.call(this,this.container,0,0);},close:function(){IndicoUI.unAssignLayerLevel(this.greyBg);$E(document.body).remove(this.greyBg);this.PopupWidget.prototype.close.call(this);},postDraw:function(){this.winDim=getWindowDimensions();this._adjustContentWrapper();this._postDrawPositionDialog();this._postDrawAdjustTitle();},_calculateContentHeight:function(){var winHeight=this.winDim.height-100;var contentHeight=this.contentWrapper.dom.offsetHeight;if(contentHeight>winHeight){if(winHeight>this.maxHeight){contentHeight=this.maxHeight;}else{contentHeight=winHeight;}}
return contentHeight;},_adjustContentWrapper:function(){var contentHeight=this._calculateContentHeight();this.contentWrapper.setStyle('height',pixels(contentHeight));this.contentWrapper.setStyle('overflowY','auto');this.contentWrapper.setStyle('overflowX','hidden');},_postDrawPositionDialog:function(){var left=Math.floor((this.winDim.width-this.container.dom.offsetWidth)/2);var top=Math.floor((this.winDim.height-this.container.dom.offsetHeight)/2);this.canvas.dom.style.left=pixels(left);this.canvas.dom.style.top=pixels(top);},_postDrawAdjustTitle:function(){var titlePaddingRight=20;if(this.closeButton){titlePaddingRight+=30;}
if(this.printLink){titlePaddingRight+=this.printLink.dom.offsetWidth;}
this.titleDiv.dom.style.paddingRight=pixels(titlePaddingRight);},print:function(){if(!exists(this.printDiv)){this.printDiv=Html.div({className:'onlyPrint',style:{position:'absolute',top:'10px',left:'10px'}});$E(document.body).append(this.printDiv);}
this.printDiv.dom.innerHTML=this.content.dom.innerHTML;this.Printable.prototype.print.call(this,this.printDiv);}},function(title,closeButtonHandler,printable,showPrintButton){this.title=any(title,null);this.closeHandler=any(closeButtonHandler,positive);this.maxHeight=600;this.printable=any(printable,true);this.showPrintButton=any(showPrintButton&&title&&printable,false);this.PopupWidget();});type("ExclusivePopupWithButtons",["ExclusivePopup"],{draw:function(mainContent,buttonContent,popupCustomStyle,mainContentStyle,buttonBarStyle){popupCustomStyle=any(popupCustomStyle,{});mainContentStyle=any(mainContentStyle,{});var mainContentDiv=Html.div({className:"popupWithButtonsMainContent",style:mainContentStyle},mainContent);var canvas=this.ExclusivePopup.prototype.draw.call(this,mainContentDiv,popupCustomStyle);buttonBarStyle=any(buttonBarStyle,{});var buttonDiv=Html.div({className:"popupButtonBar",style:buttonBarStyle},buttonContent);this.container.append(buttonDiv);return canvas;},_adjustContentWrapper:function(){this.contentWrapper.setStyle('padding',pixels(0));this.contentWrapper.setStyle('overflowY','auto');this.contentWrapper.setStyle('overflowX','hidden');this.contentWrapper.setStyle('position','relative');if(this.title&&this.title!==''){this.contentWrapper.setStyle('top',pixels(-10));}else{this.contentWrapper.setStyle('top',pixels(10));}
var contentHeight=this._calculateContentHeight();this.contentWrapper.setStyle('height',pixels(contentHeight));}},function(title,closeButtonHandler,printable,showPrintButton){this.ExclusivePopup(title,closeButtonHandler,printable,showPrintButton);});type("BalloonPopup",["PopupDialog"],{draw:function(x,y){var self=this;this.closeButton=Html.div({className:'balloonPopupCloseButton'});this.balloonContent=Html.div({className:this.balloonClass},this.hasCloseButton?this.closeButton:'',this.content);this.arrowDiv=Html.div({className:this.arrowClass,style:{width:this.arrowWidth,height:this.arrowHeight}});this.mainDiv=Html.div({},this.balloonContent,this.arrowDiv);this.mainDiv.dom.style.visibility='hidden';this.switchOrientation();var toReturn=this.PopupDialog.prototype.draw.call(this,this.mainDiv,x,y);this.arrowDiv.dom.style.left=pixels(0);if(this.hasCloseButton){this.closeButton.observeClick(function(){self.close();});}
return toReturn;},open:function(x,y){var self=this;this.x=x;this.y=y;this.PopupDialog.prototype.open.call(this,x,y);this.verifyXPos();this.verifyYPos();this.mainDiv.dom.style.visibility='visible';},switchOrientation:function(){if(this.balloonContent.dom.style.bottom===''){this.balloonContent.dom.style.bottom=pixels(this.arrowHeight-1);this.balloonContent.dom.style.top='';this.arrowDiv.dom.style.backgroundPosition='0 -6px';this.arrowDiv.dom.style.top='';this.arrowDiv.dom.style.bottom=pixels(0);}else{this.balloonContent.dom.style.top=pixels(this.arrowHeight-1);this.balloonContent.dom.style.bottom='';this.arrowDiv.dom.style.backgroundPosition='0px -25px';this.arrowDiv.dom.style.bottom='';this.arrowDiv.dom.style.top=pixels(0);}},verifyYPos:function(){var height=this.getBalloonHeight();if((this.y-height)<5){this.switchOrientation();return;}
if((this.y-height)<getScrollOffset().y){if((getWindowDimensions().height+getScrollOffset().y)>(this.y+height)){this.switchOrientation();return;}}},verifyXPos:function(){var balloonWidth=this.balloonContent.dom.offsetWidth;var leftPos=this.x-Math.floor(balloonWidth/2);if(leftPos-getScrollOffset().x<0){leftPos=getScrollOffset().x+5;var arrowLeftMargin=this.x-Math.floor(this.arrowWidth/2)-this.cornerRadius;if(arrowLeftMargin<leftPos){leftPos=arrowLeftMargin;}}
else if(leftPos+balloonWidth>getScrollOffset().x+getWindowDimensions().width-25){leftPos=getScrollOffset().x+getWindowDimensions().width-balloonWidth-25;var arrowRightMargin=this.x+Math.floor(this.arrowWidth/2)+this.cornerRadius;if(arrowRightMargin>leftPos+balloonWidth){leftPos=arrowRightMargin-balloonWidth;}}
this.canvas.dom.style.left=pixels(leftPos);this.arrowDiv.dom.style.left=pixels(this.x-leftPos-Math.floor(this.arrowWidth/2));},getBalloonHeight:function(){return this.balloonContent.dom.offsetHeight+
this.arrowDiv.dom.offsetHeight;}},function(content,triggerElement,closeHandler,nonCloseElements,balloonClass,arrowClass){this.PopupDialog(content,triggerElement,closeHandler,nonCloseElements);this.hasCloseButton=exists(closeHandler);this.balloonClass=balloonClass||'balloonPopup';this.arrowClass=arrowClass||'balloonPopupArrow';this.arrowHeight=19;this.arrowWidth=35;this.cornerRadius=6;});type("NotificationBalloonPopup",["BalloonPopup"],{},function(pointElement,content){this.pointElement=pointElement;var canvas=Html.div({style:{padding:'5px'}},content);this.BalloonPopup(canvas,pointElement,null,null,'balloonPopup yellowBalloon','balloonPopupArrow yellowArrow');});type("AlertPopup",["ExclusivePopup"],{draw:function(){var self=this;var okButton=Html.input('button',{style:{marginTop:pixels(20)}},$T('OK'));okButton.observeClick(function(){self.close();});return this.ExclusivePopup.prototype.draw.call(this,Html.div({style:{maxWidth:pixels(400),padding:pixels(10),textAlign:'center'}},Html.div({style:{textAlign:'left'}},this.content),okButton));}},function(title,content){this.content=content;this.ExclusivePopup(Html.div({style:{textAlign:'center'}},title),positive);});type("ConfirmPopup",["ExclusivePopupWithButtons"],{draw:function(){var self=this;var okButton=Html.input('button',{style:{marginRight:pixels(3)}},$T('OK'));okButton.observeClick(function(){self.close();self.handler(true);});var cancelButton=Html.input('button',{style:{marginLeft:pixels(3)}},$T('Cancel'));cancelButton.observeClick(function(){self.close();self.handler(false);});return this.ExclusivePopupWithButtons.prototype.draw.call(this,this.content,Html.div({},okButton,cancelButton));}},function(title,content,handler){var self=this;this.content=content;this.handler=handler;this.ExclusivePopupWithButtons(Html.div({style:{textAlign:'center'}},title),function(){self.handler(false);return true;});});type("ConfirmPopupWithPM",["ExclusivePopupWithButtons"],{draw:function(){var self=this;var okButton=Html.input('button',{style:{marginRight:pixels(3)}},$T('OK'));okButton.observeClick(function(){checkOK=self.parameterManager.check();if(checkOK){self.handler(true);}});var cancelButton=Html.input('button',{style:{marginLeft:pixels(3)}},$T('Cancel'));cancelButton.observeClick(function(){self.close();self.handler(false);});return this.ExclusivePopupWithButtons.prototype.draw.call(this,this.content,Html.div({},okButton,cancelButton));}},function(title,content,handler){var self=this;this.content=content;this.handler=handler;this.parameterManager=new IndicoUtil.parameterManager();this.ExclusivePopupWithButtons(Html.div({style:{textAlign:'center'}},title),function(){self.handler(false);return true;});});type("SaveConfirmPopup",["ExclusivePopupWithButtons"],{draw:function(){var self=this;var saveButton=Html.input('button',{style:{marginRight:pixels(3)}},$T('Save'));saveButton.observeClick(function(){self.close();self.handler(1);});var dontSaveButton=Html.input('button',{style:{marginLeft:pixels(3),marginRight:pixels(3)}},$T('Don\'t Save'));dontSaveButton.observeClick(function(){self.close();self.handler(2);});var cancelButton=Html.input('button',{style:{marginLeft:pixels(3)}},$T('Cancel'));cancelButton.observeClick(function(){self.close();self.handler(0);});return this.ExclusivePopupWithButtons.prototype.draw.call(this,this.content,Html.div({},saveButton,dontSaveButton,cancelButton));}},function(title,content,handler){var self=this;this.content=content;this.handler=handler;this.ExclusivePopupWithButtons(Html.div({style:{textAlign:'center'}},title),function(){self.handler(0);return true;});});type("WarningPopup",["AlertPopup"],{_formatLine:function(line){var result=Html.div({paddingBottom:pixels(2)});var linkStart=0;var linkMiddle;var linkEnd=0;while(linkStart>=0){linkStart=line.indexOf('[[',linkEnd);if(linkStart>=0){result.append(Html.span('',line.substring(linkEnd,linkStart)));linkMiddle=line.indexOf(' ',linkStart);linkEnd=line.indexOf(']]',linkStart);result.append(Html.a({href:line.substring(linkStart+2,linkMiddle)},line.substring(linkMiddle+1,linkEnd)));linkEnd+=2;}else{result.append(Html.span('',line.substring(linkEnd,line.length)));}}
return result;},_formatContent:function(content,level){var self=this;if(isString(content)){return Html.span('',self._formatLine(content));}else if(isArray(content)){var result=Html.ul(level===0?'warningLevel0':'warningLevel1');each(content,function(line){if(isString(line)){result.append(Html.li({},self._formatLine(line)));}else if(isArray(line)){result.append(self._formatContent(line,level+1));}else{result.append(Html.li({},line));}});return result;}}},function(title,lines){var self=this;var content=this._formatContent(lines,0);this.AlertPopup(Html.span('warningTitle',title),content);});type("ErrorPopup",["ExclusivePopup"],{draw:function(){var errorList=null;if(this.errors.length==1){errorList=Html.div({className:"errorList"},this.errors[0]);}else{errorList=Html.ul("errorList");each(this.errors,function(e){errorList.append(Html.li('',e));});}
return this.ExclusivePopup.prototype.draw.call(this,Widget.block([errorList,this.afterMessage]));}},function(title,errors,afterMessage){this.afterMessage=afterMessage;this.errors=errors;this.ExclusivePopup(title,function(){return true;});});type("PreLoadHandler",[],{execute:function(){var self=this;if(this.counter===0){this.process();}else{$L(this.actionList).each(function(preloadItem){var hook=new WatchValue();hook.set(false);hook.observe(function(value){if(value){bind.detach(hook);self.counter--;if(self.counter===0){self.process();}}});if(preloadItem.PreLoadAction){preloadItem.run(hook);}else{preloadItem.call(self,hook);}});}}},function(list,process){this.actionList=list;this.counter=list.length;this.process=process;});type("ServiceDialog",["ExclusivePopup"],{_error:function(error){IndicoUI.Dialogs.Util.error(error);},request:function(extraArgs){var self=this;var args=extend(clone(this.args),extraArgs);var killProgress=IndicoUI.Dialogs.Util.progress();jsonRpc(Indico.Urls.JsonRpcService,this.method,args,function(response,error){if(exists(error)){killProgress();self._error(error);}else{self._success(response);killProgress();self.close();}});}},function(endPoint,method,args,title,closeHandler){this.endPoint=endPoint;this.method=method;this.args=args;this.ExclusivePopup(title,closeHandler);});type("ServiceDialogWithButtons",["ExclusivePopupWithButtons","ServiceDialog"],{},function(endPoint,method,args,title,closeHandler){this.endPoint=endPoint;this.method=method;this.args=args;this.ExclusivePopupWithButtons(title,closeHandler);});type("ErrorReportDialog",["ServiceDialogWithButtons"],{_sendReport:function(email){var self=this;this.error.userMail=email.get();indicoRequest('system.error.report',this.error,function(result,error){if(error){alert($T("Unable to send your error report: ")+error.message);}
else{if(result){alert($T("Your report has been sent. Thank you!"));}else{alert($T("Your report could not be sent to the support address."));}
self.close();}});},draw:function(){var self=this;var email=new WatchObject();$B(email.accessor(),indicoSource('user.data.email.get',{}));var content=Html.div({style:{paddingLeft:pixels(10),paddingRight:pixels(10),paddingBottom:pixels(10)}},Html.div({style:{marginBottom:pixels(10),width:'300px',textAlign:'center'}},$T('An error has occurred while processing your request. We advise you to submit an error report, by clicking "Send report".')),Html.unescaped.div({style:{color:'red',marginBottom:pixels(10),width:'300px',maxHeight:'75px',textAlign:'center',overflow:'auto'}},this.error.message),Html.div({style:{marginBottom:pixels(10),textAlign:'center'}},Html.label({},"Your e-mail: "),$B(Html.input("text",{}),email.accessor())));var buttons=Html.div({},Widget.link(command(function(){self._sendReport(email);},Html.input('button',{},$T('Send report')))),Widget.link(command(function(){self.close();},Html.input('button',{style:{marginLeft:pixels(5)}},$T('Do not send report')))));return this.ServiceDialogWithButtons.prototype.draw.call(this,content,buttons);}},function(error){this.error=error;});type("NoReportErrorDialog",["AlertPopup"],{__getTitle:function(){var title=this.error.title;return Html.span('warningTitle',title?title:$T("Warning"));},__getContent:function(){var content=Html.div({style:{textAlign:'left'}});content.append(Html.div({},this.error.message));content.append(Html.unescaped.div("warningExplanation",this.error.explanation));if(this.error.code=='ERR-P4'){content.append(Html.div({style:{marginTop:pixels(10)}},Html.a({href:Indico.Urls.Login+'?returnURL='+document.URL},$T("Go to login page"))));}
return content;}},function(error){this.error=error;this.AlertPopup(this.__getTitle(),this.__getContent());});type("ProgressDialog",["ExclusivePopup"],{draw:function(){return this.ExclusivePopup.prototype.draw.call(this,Html.div('loadingPopup',Html.div('text',this.text)),{background:'#424242',border:'none',padding:'20px'});}},function(text){if(text===undefined){this.text=$T('Loading...');}else{this.text=text;}
this.ExclusivePopup();});IndicoUI.Dialogs={};IndicoUI.Dialogs.Util={error:function(err){var dialog=null;if(exists(err.type)&&err.type==="noReport"){dialog=new NoReportErrorDialog(err);}else{dialog=new ErrorReportDialog(err);}
dialog.open();},progress:function(text){var dialog=new ProgressDialog(text);dialog.open();return function(){dialog.close();};},alert:function(title,message){var popup=new AlertPopup(title,message);popup.open();},confirm:function(title,message,handler){var popup=new ConfirmPopup(title,message,handler);popup.open();}};extend(Html.prototype,{ancestorOf:function(child){if(!child){return false;}else if(this.dom==child.dom){return true;}else if(child.getParent()===null){return false;}else if(child.getParent()==this){return true;}else if(child.getParent().dom==document.body){return false;}else{return this.ancestorOf(child.getParent());}},getElementsByClassName:function(name){if(document.getElementsByClassName){return translate(this.dom.getElementsByClassName(name),$E);}else{if(!!document.evaluate){var expression=".//*[contains(concat(' ', @class, ' '), ' "+name+" ')]";var results=[];var query=document.evaluate(expression,this.dom,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var i=0,length=query.snapshotLength;i<length;i++){results.push(query.snapshotItem(i));}
return translate(results,$E);}else{var children=this.dom.getElementsByTagName('*');var elements=[],child;for(var j=0,length2=children.length;j<length2;j++){child=children[j];if(child.className==name){elements.push(child);}}
return translate(elements,$E);}}},replaceWith:function(element){this.getParent().dom.replaceChild(element.dom,this.dom);}});extend(WatchObject.prototype,{clone:function(){return $O(this.getAll());}});function getMousePointerCoordinates(e){e=e||window.event;var cursor={x:0,y:0};if(e.pageX||e.pageY){cursor.x=e.pageX;cursor.y=e.pageY;}
else{var de=document.documentElement;var b=document.body;cursor.x=e.clientX+
(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);cursor.y=e.clientY+
(de.scrollTop||b.scrollTop)-(de.clientTop||0);}
return cursor;}
function getWindowDimensions(){var dim={width:0,height:0};if(typeof(window.innerWidth)=='number'){dim.width=window.innerWidth;dim.height=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){dim.width=document.documentElement.clientWidth;dim.height=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){dim.width=document.body.clientWidth;dim.height=document.body.clientHeight;}
return dim;}
function getScrollOffset(){var scroll={x:0,y:0};if(typeof(window.pageYOffset)=='number'){scroll.y=window.pageYOffset;scroll.x=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scroll.y=document.body.scrollTop;scroll.x=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scroll.y=document.documentElement.scrollTop;scroll.x=document.documentElement.scrollLeft;}
return scroll;}
function eventTarget(event){return any(event.srcElement,event.target);}
function relatedTarget(event){return any(event.relatedTarget,event.toElement);}
function stopPropagation(event){if(event.stopProgagation){event.stopPropagation();}else{event.cancelBubble=true;}}
function $N(name){return translate(document.getElementsByName(name),$E);}
function flatten(array){if(!isArray(array)){return[array];}else if(array.length===0){return[];}
var elem=array.splice(0,1);return concat(flatten(elem[0]),flatten(array));}
function positive(){return true;}
function negative(){return false;}
var numberSorter=function(a,b){return a-b;};var getSelectedItems=function(select){var selectedItems=[];for(var i=0;i<select.dom.length;i++){if(select.dom.options[i].selected){selectedItems.push(select.dom[i].value);}}
return(selectedItems);};function createObject(clazz,args){function Dummy(){}
Dummy.prototype=clazz.prototype;var x=new Dummy();x.constructor=clazz;clazz.apply(x,args);return x;}
function filter(array,func)
{var len=array.length;var res=[];for(var i=0;i<len;i++)
{if(i in array)
{var val=array[i];if(func(val))
{res.push(val);}}}
return res;}
function escapeHTML(html){return html.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}
function invertableBind(target,source,invert,template){var invTemplate=template?{toSource:template.toTarget,toTarget:template.toSource}:null;return invert?$B(source,target,invTemplate):$B(target,source,template);}
var SortCriteria={Default:function(e1,e2){return e1==e2?0:(e1<e2?-1:1);},Integer:function(e1,e2){if(isNaN(parseInt(e1,10))||isNaN(parseInt(e2,10))){return SortCriteria.Default(e1,e2);}else{return parseInt(e1,10)==parseInt(e2,10)?0:(parseInt(e1,10)<parseInt(e2,10)?-1:1);}}};function partition(list,start,end,index,cmp){var pval=list.item(index);list.swap(index,end);var store=start;for(var i=start;i<end;++i){if(cmp(list.item(i),pval)<0){list.swap(i,store);store++;}}
list.swap(store,end);return store;}
function quicksort(list,start,end,cmp){if(end>start){var pnew=partition(list,start,end,start,cmp);quicksort(list,start,pnew-1,cmp);quicksort(list,pnew+1,end,cmp);}}
extend(WatchList.prototype,{swap:function(source,destination){var itemS=this.item(source);var itemD=this.item(destination);this.replaceAt(source,itemD);this.replaceAt(destination,itemS);},sort:function(compare){compare=compare||SortCriteria.Default;quicksort(this,0,this.length.get()-1,compare);}});type("WatchOrderedDict",["WatchObject"],{sort:function(compare){this.order.sort(compare);}},function(){this.order=$L();this.WatchObject();var self=this;this.each=function(iterator){var self=this;each(this.order,function(key){iterator(self.get(key),key);});};this.set=function(key,value){this.order.add(key);this.WatchObject.prototype.set.call(key,value);};var oldUpdate=this.update;var oldClear=this.clear;this.update=function(values){var self=this;each(values,function(value,key){self.order.append(key);});oldUpdate.call(this,values);};this.clear=function(){this.order.clear();return oldClear();};});function $D(source,template){return bind.toDictionary(new WatchOrderedDict(),source,template);}
String.prototype.replaceAll=Browser.Gecko?function(pattern,replace){return this.replace(pattern,replace,'g');}:function(pattern,replace){return this.replace(new RegExp(pattern,"g"),replace);};Html.unescaped=map({'div':null,'span':null},function(value,elemType){return function(){var res=Html[elemType].apply(this,arguments);res.dom.innerHTML=res.get();return res;};});type("BrowserHistoryBroker",[],{addListener:function(listener){this.listeners.push(listener);listener.registerHistoryBroker(this);},setUserAction:function(hash){window.location.hash=hash;this.currentHash='#'+hash;}},function(){this.listeners=[];this.currentHash=window.location.hash;var self=this;var checkHashChanged=function(){if(self.currentHash!=window.location.hash){each(self.listeners,function(listener){listener.notifyHistoryChange(window.location.hash);});self.currentHash=window.location.hash;}};if(document.body.onhashchange!==undefined){$E(document.body).observeEvent('hashchange',checkHashChanged);}else{setInterval(checkHashChanged,500);}});IndicoUI.Services={deleteSubContribution:function(conference,contribution,subContribution){jsonRpc(Indico.Urls.JsonRpcService,'contribution.deleteSubContribution',{'conference':conference,'contribution':contribution,'subcontribution':subContribution},function(response,error){var killProgress=IndicoUI.Dialogs.Util.progress();if(exists(error)){killProgress();IndicoUtil.errorReport(error);}
else{window.location.reload(true);}});},deleteSession:function(conference,session){jsonRpc(Indico.Urls.JsonRpcService,'schedule.event.deleteSession',{'conference':conference,'session':session},function(response,error){var killProgress=IndicoUI.Dialogs.Util.progress();if(exists(error)){killProgress();IndicoUtil.errorReport(error);}
else{window.location.reload(true);}});}};Util.postRequest=function(url,getArguments,postArguments,method,separator){method=any(method,"post");separator=any(separator,"&");var getUrl=url;if(exists(getArguments)){first=true;each(getArguments,function(value,key){if(first){getUrl+="?";first=false;}else{getUrl+=separator;}
getUrl+=key+"="+value;});}
var form=Html.form({method:method,action:encodeURI(getUrl)});each(postArguments,function(value,key){var hiddenField=Html.input("hidden",{name:key});hiddenField.dom.value=value;form.append(hiddenField);});$E(document.body).append(form);form.dom.submit();};type("DebugWindow",[],{buildDialog:function(){this.debugInfo=Html.textarea({style:{width:'100%',height:'100%',background:'red'}},'');return Html.div({style:{border:'1px dashed black',opacity:0.7,position:'fixed',width:'100%',bottom:'0px',height:'100px',left:'0px'}},this.debugInfo);},addText:function(text){this.debugInfo.set(this.debugInfo.get()+text+'\n');}},function(){$E(document.body).append(this.buildDialog());});debugWindow=null;function createDebugWindow(){debugWindow=new DebugWindow();}
function debug(text){if(debugWindow){debugWindow.addText(text);}}
type("DebugObjectBox",[],{buildDialog:function(obj){var list=$B(Html.ul({}),obj,function(item){return Html.li({},item.key+': ',$B(Html.input('text'),item));});return $B(Html.div({style:{border:'1px dashed black',opacity:0.7,position:'fixed',width:'300px',top:pixels(this.y),height:'100px',left:pixels(this.x),background:'green'}}),list);}},function(obj,x,y){this.x=x;this.y=y;$E(document.body).append(this.buildDialog(obj));});function debugObjectBox(obj,x,y){new DebugObjectBox(obj,x,y);}
