function FolderTree(cH,opts){var selectedFolder=false,aZ=false,tree=$(cH),observers={},O={};O={tpl:new Template('<a class="link"><span class="overlay"></span><img src="/Assets/Default/Images/x.gif" width="16px" height="16px" class="toggle" /><img src="/Assets/Default/Images/x.gif" width="16px" height="16px" class="icon small #{icon}" /><span class="label">#{name}</span></a>')};Object.extend(O,opts||{});var name,eventName;for(eventName in O){if(!(eventName.startsWith('on')||eventName.include('/on')))continue;name=eventName.substring(2).toLowerCase();observers[eventName]=O[eventName].bind(this);if(/^(?:click|mouseover|hover|contextmenu)$/.test(name)){tree.observe(name,observers[eventName]);}else{tree.observe('tree:'+name,observers[eventName]);}}tree.observe('click',function(event){if(event.findElement('.toggle')){showHideNode(Event.findElement(event,'li'));}else if(event.findElement('a.link')){if(event.which&&event.which>1)return;var node=Event.findElement(event,'li');cp(node);tree.fire('tree:nodeselected',{data:node.nsData,event:event});if(event.stopped){node.addClassName('tree_open').removeClassName('tree_closed');}else{showHideNode(node);}}return event.stop();});this.initTree=function(gX,fD){aZ=gX;tree.addClassName('tree_root');cp();tree.update();tree.fire('tree:populatenode');if(fD&&fD.selectNode&&this.selectNode(fD.selectNode))return;if(fD&&fD.noPopulate)return;this.eh();};this.eh=function(){if(tree.firstChild)return;cT(aZ,tree);};this.aY=function(id){var node=w(id);if(!node)return;return node.hasClassName('tree_closed');};this.isOpen=function(id){var node=w(id);if(!node)return;return node.hasClassName('tree_open');};this.showHideNode=function(id){var node=w(id);if(!node)return;showHideNode(node);};this.cp=cp;this.selectedFolderId=function(){return selectedFolder?selectedFolder.nsData.id:false;};this.aZ=function(){return aZ;};this.updateNode=function(update){var node=w(update.id);if(!node)return;P(node,update);};this.P=function(eH,node){if(O.containerOnly&& !node.container)return;var B=w(eH);if(B&&B.tagName=='LI'){var parent=B;B=parent.down('ul');}if(!B)return;P(B,node);};this.removeNode=function(id){var node=w(id);if(!node)return;if(selectedFolder&&node==selectedFolder)cp();node.remove();tree.fire('tree:removenode',{id:id});};this.refreshNode=function(id){var node=w(id);if(!node)return;var list=node.getElementsByTagName('UL')[0];if(!list)return;var fD={};if(selectedFolder&&selectedFolder.ancestors().any(function(Q){return list==Q})){fD.selectNode=selectedFolder.nsData.id;cp();}list.remove();cT(node.nsData.id,node,fD);};this.populateNode=function(dir,fD){var node=w(dir.id);if(!node)return;if(!(fD&&fD.force)&&dir.pages>1&& !(dir.container==1&&dir.page==1&& !dir.orderBy&& !dir.orderDirection&& !dir.node.last().container)){if(node.hasClassName('tree_open')){return cT(dir.id,node);}else{return;}}populateNode(node,dir);};this.selectNode=function(dir){if(this.selectedFolderId()==dir.id)return;var node=w(dir.id);if(node)return selectNode(node);cp();if(dir.path&&dir.path.reverse().any(function(elem){node=w(elem.id);if(!node)return false;cT(dir.id,node,{selectNode:dir.id,pathTo:elem.id});return true;}))return true;return false;};function w(id){if(aZ==id)return tree;return $(gn(id));};function gn(id){return cH+'-'+id;};function P(B,node){var li,ha=gn(node.id);if(B.id==ha){li=B;li.childElements().reject(function(e){return e.tagName=='UL'}).invoke('remove');$w(li.className).each(function(name){if(name=='tree_open'||name=='tree_closed')return;li.removeClassName(name);});}else{li=new Element('li',{id:ha,className:'tree_closed'});B.insert(li);}if(node.floor)li.addClassName('floor');li.nsData=node;li.showHideNode=showHideNode;li.insert({top:O.tpl.evaluate(node)});tree.fire('tree:addnode',{li:li,node:node});if(node.open&&li.hasClassName('tree_closed'))showHideNode(li);return li;};function showHideNode(node){if(!node)node=this;if(node.nsData.floor){cp(node);}else if(node.hasClassName('tree_closed')){node.addClassName('tree_open').removeClassName('tree_closed');var ul=node.getElementsByTagName('UL')[0];if(!ul)cT(node.nsData.id,node);}else{node.addClassName('tree_closed').removeClassName('tree_open');}};function cp(node){if(selectedFolder)selectedFolder.down('a').removeClassName('selected');selectedFolder=node&&node!=tree?node:false;if(!selectedFolder)return;node.down('a').addClassName('selected');};function cT(da,B,fD){var pathTo=fD&&fD.pathTo?fD.pathTo:null;var containerOnly=fD&&fD.containerOnly?fD.containerOnly:(O.containerOnly||null);new Ajax.Request('/Pages/ListDir'+(da.startsWith('/')?'':'/')+da,{onlyLatestOfClass:'folderTree-'+cH,parameters:{noPage:1,noStats:1,textContent:0,containerOnly:containerOnly,pathTo:pathTo,columns:(O.columns||null)},onSuccess:function(transport){var dir=transport.responseText.evalJSON(true);makeUrisAbsolute(dir);if(!dir.node||dir.error)return;dir.path.each(function(elem,i){if(!elem.node|| !B)return;makeUrisAbsolute(elem);var ul=populateNode(B,elem);var hm=dir.path[i+1].id;B=ul.childElements().find(function(bQ){return bQ.nsData.id==hm});});if(B)populateNode(B,dir);if(fD&&fD.selectNode&& !selectedFolder){var node=w(fD.selectNode);if(node)selectNode(node);};}});};function makeUrisAbsolute(dir){for(var i=0,len=dir.node.length;i<len;i++){var nodeUri=dir.node[i].uri;if(nodeUri&& !nodeUri.startsWith('/'))dir.node[i].uri=dir.uri?dir.uri+nodeUri:null;}};function populateNode(B,data){if(B.id==cH&&B.firstChild)return B;if(B.tagName=='LI'){var hp=B.getElementsByTagName('UL');if(hp.length>0)return hp[0];var li=B;B=new Element('ul');li.insert(B);}tree.fire('tree:data',{'data':data,'B':B});data.node.each(function(node){if(O&&O.containerOnly&& !node.container)return;P(B,node);});return B;};function selectNode(node){cp(node);var parent=node.up('.FolderTree ul');while(parent&&parent.id!=cH){var li=parent.parentNode;li.removeClassName('tree_closed').addClassName('tree_open');li.down('a').select('img').invoke('removeClassName','tree_closed').invoke('addClassName','tree_open');parent=li.up('.FolderTree ul');}var viewport=$(cH).parentNode;dw(viewport,node,{paddingLeft:80,paddingTop:40});return true;}};
function gh(){var gf;var fi;var ft;var fh;var fn=false;var uploadStatus=false;var bM=false;var cx=new Object;var appletWaiting=false;this.load=function(fD){if(!fD)fD={};fi=fD;if(fn)return fi.onSuccess(af());if(!fh)gV(fi);Action.Dialog('/Pages/Dialog/AppletHelp/EnablingJava.htm',{width:450,minHeight:200,afterEffectShow:function(){Applet.hb();}});};this.hide=function(){bM=false;$('info_upload_applet').style.height='0px';var applet=af();if(!applet)return;if(BrowserDetect.ap=='Opera'){applet.style.visibility='hidden';}else{applet.style.height='0px';}if(!U['upload'])infoHeaderButtonDown('upload',true);av();};this.show=function(){if(uploadStatus)return;bM=true;$('info_upload_applet').style.height='140px';var applet=af();if(applet){applet.style.height='140px';applet.style.visibility='visible';}if(U['upload'])infoHeaderButtonDown('upload',true);av('upload');return false;};this.fw=function(fD){uploadStatus={ew:bM};Applet.hide();$('info_header_link_upload').update(Locale[fD.download?'downloadStatus':'uploadStatus']);if($('info_header_upload').tip)$('info_header_upload').tip.update(Locale[fD.download?'downloadStatusTip':'uploadStatusTip']);$('info_upload_progress').show();if(U['upload'])infoHeaderButtonDown('upload',true);av('upload');};this.fR=function(){if(!uploadStatus)return;$('info_upload_progress').hide();$('info_header_link_upload').update(Locale.dragDropUpload);if($('info_header_upload').tip)$('info_header_upload').tip.update(Locale.uploadOpenTip);var ew=uploadStatus.ew;uploadStatus=false;if(ew){Applet.show();}else{if(!U['upload'])infoHeaderButtonDown('upload',true);}};this.fy=function(){var applet=af();if(!applet)return;try{var fy=new String(applet.getOpenedFiles()).evalJSON();return fy.map(function(fileName){return fileName.replace(/.*\\/,'').replace(/.*\//,'');});}catch(fl){}};this.hb=function(){fn=db();if(fn===true){Action.cj();fi.onSuccess(af());return clearTimeout(gf);}else if(fn===false){fi.onFailure();return clearTimeout(gf);}else if(fn==='wait'&&appletWaiting===false){fi.onFailure();appletWaiting=true;}return gf=setTimeout("Applet.hb()",100);};this.isActive=db;this.af=af;this.bK=function(){return navigator.javaEnabled();};function af(){if(!fh)return;return document.getElementById('upload_applet');};function gV(fD){if(fh===true)return false;clearTimeout(ft);bM=fD.hidden?false:true;var height=fD.hidden&&BrowserDetect.ap!='Opera'?0:140;if(BrowserDetect.OS=='cy'){h='<object id="upload_applet" ';if(BrowserDetect.ap=='Explorer'){h=h+'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ';}else{h=h+'type="application/x-java-applet;version=1.4.1" ';}if(fD.hidden&&BrowserDetect.ap=='Opera')h=h+'style="visibility: hidden;" ';h=h+'width="178" height="'+height+'">';h=h+'<param name="archive" value="'+rootURL+'Assets/Applets/UploadApplet.jar">';h=h+'<param name="code" value="com.thinfile.upload.ThinUploadPro">';h=h+'<param name="mayscript" value="1">';h=h+'<param name="name" value="'+siteName+' Online Storage">';}else{h='<applet id="upload_applet" archive="'+rootURL+'Assets/Applets/UploadApplet.jar" ';h=h+'code="com.thinfile.upload.ThinUploadPro" ';h=h+'name="'+siteName+' Online Storage" ';h=h+'hspace="0" vspace="0" MAYSCRIPT ';h=h+'width="178" height="'+height+'" align="middle">';h=h+Locale.javaRequired+'<br /><a href="'+(location.protocol=='https:'?'https:':'http:')+'//www.java.com/getjava/" target="_blank">'+Locale.getJava+'</a>';}h=h+'<param name="props_file" value="'+rootURL+'Pages/Upload?page=Properties.txt&_session_id='+getSID()+'&_brand_id='+brandId+'">';if(BrowserDetect.OS=='cy'){h=h+'</object>';}else{h=h+'</applet>';}$('info_upload_applet').show().setStyle({height:height}).innerHTML=h;fh=true;return true;};function db(){var applet=af();if(!applet)return null;try{var active=applet.isActive();if(active){var perm=applet.permDenied();return!perm;}else{return null}}catch(e){if(window.navigator.javaEnabled()){if(BrowserDetect.ap==='Opera'||BrowserDetect.ap==='Firefox')return null;return hasTimePassed('waiting',8000)?"wait":null;}return false;};return null;};function hasTimePassed(aF,needed){var di=cx[aF];if(di){var hv=new Date();var ms=hv.getTime()-di.getTime();if(ms<needed)return false;}else{cx[aF]=new Date();return false;}return true;}};
var BrowserDetect={dL:function(){this.ap=this.searchString(this.au)||"An unknown browser";this.version=this.aq(navigator.userAgent)||this.aq(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.aB)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var ah=data[i].string;var az=data[i].aM;this.ai=data[i].ac||data[i].V;if(ah){if(ah.indexOf(data[i].Y)!= -1)return data[i].V;}else if(az)return data[i].V;}},aq:function(ah){var index=ah.indexOf(this.ai);if(index== -1)return;return parseFloat(ah.substring(index+this.ai.length+1));},au:[{string:navigator.userAgent,Y:"Chrome",V:"Chrome"},{string:navigator.userAgent,Y:"OmniWeb",ac:"OmniWeb/",V:"OmniWeb"},{string:navigator.vendor,Y:"Apple",V:"Safari"},{aM:window.opera,V:"Opera"},{string:navigator.vendor,Y:"iCab",V:"iCab"},{string:navigator.vendor,Y:"KDE",V:"Konqueror"},{string:navigator.userAgent,Y:"Firefox",V:"Firefox"},{string:navigator.userAgent,Y:"Shiretoko",V:"Firefox",ac:"Shiretoko"},{string:navigator.userAgent,Y:"Namoroka",V:"Firefox",ac:"Namoroka"},{string:navigator.vendor,Y:"Camino",V:"Camino"},{string:navigator.userAgent,Y:"Netscape",V:"Netscape"},{string:navigator.userAgent,Y:"MSIE",V:"Explorer",ac:"MSIE"},{string:navigator.userAgent,Y:"Gecko",V:"Mozilla",ac:"rv"},{string:navigator.userAgent,Y:"Mozilla",V:"Netscape",ac:"Mozilla"}],aB:[{string:navigator.platform,Y:"Win",V:"cy"},{string:navigator.platform,Y:"Mac",V:"Mac"},{string:navigator.platform,Y:"Linux",V:"Linux"}]};BrowserDetect.dL(); ;
function eA(){var an=false;var dragObj=false;var ae=false;var aT=false;var ct=0;var cZ=0;var K=false;Event.observe(document,'dragstart',function(event){Event.stop(event)});Event.observe(document,'mousemove',function(event){if(ct&& !dragObj&&Selection.aA()&&cwd.container==1){dragObj=cG();}if(!dragObj&& !K)return;Selection.fG();var cq=Event.pointerX(event);var cn=Event.pointerY(event);if(dragObj){if(dragObj.onMouseMove)return dragObj.onMouseMove(event,ct,cZ);dragObj.style.left=(cq-ct)+'px';dragObj.style.top=(cn-cZ)+'px';}var bj=false;Position.prepare();if(Position.within($('OrganiseTree'),cq,cn)){if(!dragObj)return;dW();aT.any(function(node){if(Position.withinIncludingScrolloffsets(node,cq,cn)){bj=node;return true;}});}else{Listing.nodes().any(function(node){if((dragObj&& !node.data.container)||(!dragObj&&node.data.container)||Selection.bS(node.index))return;var obj=node.elements.first();if(Position.withinIncludingScrolloffsets(obj,cq,cn)){bj=obj;return true;}});}if(ae&&bj!=ae){dc(ae);}if(bj&&bj!=ae){eb(bj);}});Event.observe(document,'mouseup',function(event){ct=false;cZ=false;aT=false;if(!dragObj)return;if(dragObj.onEnd){var eU=dragObj.onEnd(event);dragObj=false;return eU;}document.body.removeChild(dragObj);if(ae){var destination=ae.nsData?ae.nsData:cwd.node[ae.nodeId-1];Action.MoveCopy(false,false,{action:an?'Copy':'Move',destination:destination.id});dc(ae);}dragObj=false;an=false;});Event.observe(document,'keydown',function(event){if(event.keyCode!=17)return;if(!dragObj||an)return;an=document.createElement('IMG');an.src='/Assets/Default/Images/Plus.gif';an.className='drag_copy';an.style.top=(cZ+10)+'px';an.style.left=(ct+10)+'px';dragObj.appendChild(an);});Event.observe(document,'keyup',function(event){if(event.keyCode!=17)return;if(!dragObj|| !an)return;dragObj.removeChild(an);an=false;});this.dL=function(event,obj){ct=Event.pointerX(event);cZ=Event.pointerY(event);if(obj)dragObj=obj;};this.eu=function(){if(dragObj){return true;}else{return false;}};this.K=function(highlight){K=highlight;if(ae)dc(ae);};function eb(obj){var nodeId=obj.nodeId;if(nodeId){if(Selection.bS(nodeId))return;Selection.aU(nodeId);}else{navTree.cp(obj);}ae=obj;return true;};function dc(obj){var nodeId=obj.nodeId;if(nodeId){if(Selection.bS(nodeId))return;Selection.ax(nodeId);}else{navTree.cp(false);}if(ae==obj)ae=false;return true;};function cG(){var ez=0,eV=0,H='';var eJ=bv($('BodyContainer'));Selection.selectedIds().each(function(id){var elem=$('node_'+id);var pos=elem.cumulativeOffset();var size=elem.getDimensions();var left=pos.left-eJ.left;var top=pos.top-eJ.top;var width=left+size.width;var height=top+size.height;if(width>eV)eV=width;if(height>ez)ez=height;var Node=cwd.node[id-1];if(cwd.listView=='Thumbs'){var bgImage;if(Node.thumb)bgImage='style="background-image:url('+Node.thumb+'); background-position:center;"';H=H+'<div class="drag_node" style="top: '+top+'px; left: '+left+'px;"> \
							<div class="drag_icon_frame"> \
								<div class="icon_element icon large '+Node.icon+'" '+bgImage+'></div> \
							</div> \
							<div class="drag_file_name">'+Node.name+'</div> \
						</div>';}else{H=H+'<div class="drag_node_details" style="top: '+top+'px; left: '+(left+20)+'px;"> \
							<div class="details_icon"> \
								<img src="/Assets/Default/Images/x.gif" class="icon small '+Node.icon+'" border="0" width="16" height="16"> \
							</div> \
							<div class="node_details_text">'+Node.name+'</div> \
						</div>';}});var aN=document.createElement('DIV');aN.className='drag_container';aN.innerHTML=H;aN.style.height=ez+'px';aN.style.width=eV+'px';document.body.appendChild(aN);return aN;};function dW(){if(aT)return;var tree=$('OrganiseTree');var eJ=bv(tree);var A=eJ.left;var du=tree.getWidth()+A;var co=eJ.top;var dS=tree.getHeight()+co;var i=0;aT=new Array;tree.descendants().each(function(element){if(element.tagName!='LI'||element.nsData.container!=1)return;var aQ=Position.positionedOffset(element);var aD=element.getHeight()+aQ[1];if(!((aQ[1]>=co&&aQ[1]<=dS)||(aD>=co&&aD<=dS)))return;var cz=element.getWidth()+aQ[0];if(!((aQ[0]>=A&&aQ[0]<=du)||(cz>=A&&cz<=du)||(aQ[0]<=A&&cz>=du)))return;aT[i]=element;i++;});aT.reverse();}};
function ej(){var targets=new Array;var l=false;var D=false;var G=false;var fL=false;var dG='';var fs=false;var fr=false;var aV=false;var hy=false;this.Play=function(){ar(this,'Play',arguments)};this.View=function(){ar(this,'View',arguments)};this.Open=function(){ar(this,'Open',arguments)};this.DownloadMulti=function(){ar(this,'DownloadMulti',arguments)};this.Delete=function(){ar(this,'Delete',arguments)};this.Rename=function(){ar(this,'Rename',arguments)};this.MoveCopy=function(){ar(this,'MoveCopy',arguments)};this.newFolder=function(){ar(this,'newFolder',arguments)};this.Recycle=function(){ar(this,'Recycle',arguments)};this.cj=cj;this.bN=bN;this.setSizes=setSizes;this.API=C;this.close=function(eO){cj(eO);};Event.observe(window,'resize',setSizes);this.sizeDialog=function(){D=false;G=false;setSizes();};Event.observe(document,'keydown',function(event){if(event.keyCode!=46&&event.keyCode!=113)return;if(l)return;if(!Selection.aA)return;var fI=Menu.actionsFor({targets:Selection.selectedIds()}).pluck('id');if(event.keyCode==46){if(event.shiftKey!==true&&fI.include('recycle'))Action.Recycle();else if(fI.include('erase'))Action.Delete();}if(event.keyCode==113&&fI.include('rename'))Action.Rename();});this.cV=function(event){var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');var actions=Menu.buildActions(Menu.actionsFor({targets:[nodeId]}),[nodeId]);var action=actions.find(function(a){return a.dflt});if(action)eval(action.code);};function ar(obj,action,bT){fC(bT);var eC='do'+action;return obj[eC](bT[2]);};function fC(bT){var id=bT[0];var name=bT[1];targets=new Array;if(id){targets[0]={id:id,name:name};}else{targets=Selection.aW();}};this.doView=function(){var params={orderBy:cwd.orderBy,orderDirection:cwd.orderDirection,page:cwd.page,fileClass:['Image','Video'],id:targets.collect(function(t){return t.id})};if(targets.length==1&&targets[0].id!=cwd.id){params.id=cwd.id;params.startId=targets[0].id;}var url='/Pages/MediaPlayer?'+Object.toQueryString(params);var height=window.screen.height-(25*window.screen.height/100);if(height>1024)height=1024;var width=height*(4/3);popupWindow('View',height,width,false,url);};this.doPlay=function(){var height=204,len=targets.length;var params={orderBy:cwd.orderBy,orderDirection:cwd.orderDirection,page:cwd.page,fileClass:'Audio',id:targets.collect(function(t){return t.id})};if(len==1&&targets[0].id!=cwd.id){params.id=cwd.id;params.startId=targets[0].id;}var url='/Pages/MediaPlayer?'+Object.toQueryString(params);if(len>1&&len<=8)height=60*targets.length+24;popupWindow('Play',height,400,false,url);};this.doOpen=function(){Applet.load({hidden:true,onSuccess:function(applet){if(applet)applet.editFile(rootURL+'O/'+targets[0].id);},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});}});return false;};this.detailsTreeInit=function(fD){if(fD.loadingMessage)fD.loadingMessage.show();var sharing=new FolderTree($(fD.elem),{tpl:new Template('<span class="s-avatar #{icon}" /></span><span class="s-name">#{name}</span><span class="s-info">#{desc}</span><span class="s-actions"></span><div class="clear"></div>'),onAddNode:function(x){var li=x.memo.li,cR={targets:[li],menu:'sharing',require:true},span=li.down('span.s-actions');if(li.nsData.thumb){var thumb=li.nsData.thumb.replace('/94/94/0/','/31/31/1/');li.down('span.s-avatar').setStyle({backgroundImage:'url('+thumb+')'});}Menu.buildActions(Menu.actionsFor(cR),cR.targets).each(function(action){span.insert(new Element('a',{className:'action'}).update(action.label).observe('click',function(event){event.stop();eval(action.code);}));});if(fD.emptyMessage)fD.emptyMessage.hide();if(fD.nonEmptyMessage)fD.nonEmptyMessage.show();$(fD.elem).show();},onData:function(data){if(fD.loadingMessage)fD.loadingMessage.hide();if(!$(fD.elem).firstChild){if(fD.nonEmptyMessage)fD.nonEmptyMessage.hide();if(fD.emptyMessage)fD.emptyMessage.show();}},onRemoveNode:function(id){if(!$(fD.elem).firstChild){if(fD.nonEmptyMessage)fD.nonEmptyMessage.hide();if(fD.emptyMessage)fD.emptyMessage.show();}if($('shared-with-title-shared')&& !$('shared-list').firstChild){$('shared-with-title-shared').hide();fD.nonEmptyMessage.hide();fD.emptyMessage.hide();$('shared-list').hide();}}});if(fD.data){sharing.initTree(fD.nsId,{noPopulate:true});sharing.populateNode(fD.data);}else{sharing.initTree(fD.nsId);}Listing.addListener(sharing);Selection.onChange(function(){Listing.removeListener(sharing);});return sharing;};this.AutocompleterInit=function(fD){if(fD.idIn)fD.input.observe('change',function(e){fD.idIn.value=''});fD.input.observe('focus',function(){fD.input.clear();});new Ajax.Autocompleter(fD.input,fD.choices,'/Pages/AutoComplete?validate=1',{paramName:'recipient',updateElement:function(selection){var children=selection.descendants();if(!children[0])return;var value=children[0].innerHTML;if(children[1])var value=value+' <'+children[1].innerHTML+'>';fD.input.setValue(value);if(selection.id&&fD.idIn)fD.idIn.value=selection.id;if(fD.afterUpdateElement)fD.afterUpdateElement();},onSuccess:fD.onSuccess});};this.quickCreateInit=function(fD){var input=fD.input;Action.AutocompleterInit({input:input,choices:fD.choices,idIn:fD.idIn,afterUpdateElement:fD.afterUpdateElement,onSuccess:fD.onSuccess});fD.form.observe('submit',function(e){var form=this;if(fD.onSubmit)fD.onSubmit(form);Action.Create(e,{form:form,loadMessage:fD.loadMessage});});};this.doDownloadMulti=function(){Applet.load({hidden:true,onSuccess:function(applet){Menu.hide();var ids=L(targets).join(',');if(applet.downloadMultipleFiles(ids)==0)Upload.start({advanced:true,download:true});},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});}});};this.DialogAction=function(fD){var Address=fD.page;if(!fD.width)fD.width=400;if(typeof(fD.target)!='undefined'){fC([fD.target]);for(var i=0,len=targets.length;i<len;i++){Address=Address+'id='+encodeURIComponent(targets[i].id)+'&';}}this.Dialog(Address,fD);};this.doDelete=function(fD){if(!fD)fD={confirm:{message:{plural:Locale['actionsMessageDeleteMultiple'],singular:Locale['actionsMessageDeleteSingle']}}};$('Delete_title').hide();if(fD.confirm){var message=typeof fD.confirm.message==='object'?targets.length>1?fD.confirm.message.plural:fD.confirm.message.singular:fD.confirm.message;var temp=new Template(message);if(fD.confirm.title)$('Delete_title').update(fD.confirm.title).show();SetMessage(temp.evaluate({items:targets.length,name:targets[0].name}),0,'message_Delete');bN('Delete',{width:370,onComplete:function(){var x=$('delete_node_text');x.select();x.focus();},onClose:function(){$("popup_Delete_form").stopObserving("submit");}});$('popup_Delete_form').observe('submit',function(event){event.stop();fD.confirm=false;fD.ak='Delete';fD.onSuccess=function(){cj(true);$('popup_Delete_form').stopObserving('submit');};Action.doDelete(fD);return false;});return false;}var loadMessage=fD&&fD.loadMessage?fD.loadMessage:Locale['actionsPopupDelete'];C({type:'Delete',ak:fD?fD.ak:'',loadMessage:loadMessage,parameters:{id:fD.id?fD.id:L(targets)},onSuccess:fD?fD.onSuccess:''});};this.doRename=function(aS){var en=$('rename_input'),eW=new Element('span').insert(targets[0].name.stripTags());if(!aS){SetMessage(Locale['actionsMessageRename'],0,'message_Rename');en.value=eW.innerHTML;bN('Rename',{width:370,onComplete:function(){en.select();en.focus();}});return;}var bb=en.value;if(!bb)return SetMessage(Locale['actionsMessageRenameNoName'],1,'message_Rename');if(targets[0].name==bb)return cj();C({type:'Update',ak:'Rename',loadMessage:Locale['actionsPopupRename'],parameters:{id:targets[0].id,name:bb},onSuccess:function(){cj()}});};this.doRecycle=function(bT){var t=new Template(Locale['actionsMessagesRecycleSingle']);this.Update(targets.pluck('id'),{parameters:{recycle:true},loadMessage:Locale['actionsPopupRecycle'],confirm:{icon:'/Assets/Default/Images/Icons/Large/RecycleBin.gif',message:{plural:{description:Locale['actionsMessagesRecycleMultiple']},singular:{description:t.evaluate({'name':targets[0].name})}}}});};this.Update=function(id,fD){if(id&&typeof id==='string'){fD.parameters.id=id.split(',');}else if(id&&typeof id==='object'){fD.parameters.id=id;}else{fD.parameters.id=Selection.aW().pluck('id');}if(typeof fD.confirm==='object'){if(fD.confirm.icon)$('Confirm_icon').src=fD.confirm.icon?fD.confirm.icon:'/Assets/Default/Images/Icons/Large/NotFound.gif';var mesg=fD.parameters.id.length>1?fD.confirm.message.plural.description:fD.confirm.message.singular.description;SetMessage(mesg,false,'message_Confirm');$('popup_Confirm_form').observe('submit',function(event){event.stop();fD.confirm=true;fD.ak='Confirm';fD.onSuccess=function(){cj(true);$('popup_Confirm_form').stopObserving('submit');};Action.Update(id,fD);});bN('Confirm',{width:fD.confirm.width?fD.confirm.width:370,onComplete:function(){var x=$('popupConfirm_text');x.select();x.focus();},onClose:function(){$("popup_Confirm_form").stopObserving("submit");}});}else{fD.type=fD.type?fD.type:'Update';C(fD);}};this.Create=function(event,fD){event.stop();if(!fD)fD={};if(!fD.form)fD.form=this;C({type:'Create',parameters:fD.form.serialize(),ak:fD?fD.ak:'',loadMessage:fD.loadMessage,onSuccess:function(response){fD.form.reset();$('BodyContainer').focus();}});};this.hx=function(fD){var temp=new Template(Locale['actionsMessageConflict']);SetMessage(temp.evaluate(fD.conflictDst),0,'message_Conflict');temp=new Template(Locale['actionsMessageConflictFile']);var hA=fD.conflictDst.icon?'<img src="/Assets/Default/Images/x.gif" style="width: 17px; height: 17px;" class="icon small '+fD.conflictDst.icon+'" /> ':'';$('ConflictDstFile').update(hA+temp.evaluate(fD.conflictDst));if(fD.conflictSrc){var fx=fD.conflictDst.icon?'<img src="/Assets/Default/Images/x.gif" style="width: 17px; height: 17px;" class="icon small '+fD.conflictSrc.icon+'" /> ':'';$('ConflictSrcFile').update(fx+temp.evaluate(fD.conflictSrc));}[$('ConflictSrcIntro'),$('ConflictSrcRow')].invoke(fD.conflictSrc?'show':'hide');var rename=$('Conflict_rename_text');fD.onRename?rename.show():rename.hide();hy=fD;bN('Conflict',{width:405,onClose:fD.onCancel});};this.conflictResponse=function(response){aV=false;cj(true);hy['on'+response]({doForAll:$('ConflictDoForAll').checked?1:0});};this.doMoveCopy=function(fD){var action=fD.action;var messageKey=fD.available?fD.available.join(''):action;var destination=fD.destination;if(!action){var aF='actionsMessage'+messageKey+(targets.length>1?'Multiple':'Single');var temp=new Template(Locale[aF]);SetMessage(temp.evaluate({items:targets.length,name:targets[0].name}),0,'message_MoveCopy');fD.available.include('Move')?$('button_MoveCopy_Move_text').show():$('button_MoveCopy_Move_text').hide();fD.available.include('Copy')?$('button_MoveCopy_Copy_text').show():$('button_MoveCopy_Copy_text').hide();CopyMoveTree.eh();bN('MoveCopy',{width:300});return;}if(!destination)return fO(Locale['actionsMessage'+messageKey+'NoFolder'],'MoveCopy');var param;if(fD.hu){param=fL;param.conflictAction=fD.hu;param.doForAll=fD.doForAll;}else{fL=false;param={source:L(targets),destination:destination};}var dK=l;if(l.id!='popup_MoveCopy'&&l.id!='popup_Conflict')dK=$('BodyContainer');Loading.show({obj:dK,label:Locale['actionsPopup'+action]});new Ajax.Request('/Pages/API?action='+action,{onlyLatestOfClass:'fileActions',parameters:param,onSuccess:function(transport){var ao=transport.responseText.evalJSON(true);if(ao.Status=='OK'){fM(destination,ao.moved);cj();}else{if(ao.Message=='RESUME_REQUIRED'){fL=ao.resumeData;if(ao.moved)fM(destination,ao.moved);Action.hx({conflictSrc:ao.conflictSrc,conflictDst:ao.conflictDst,onReplace:function(fD){Action.doMoveCopy({action:action,destination:destination,hu:"overwrite",doForAll:fD.doForAll});},onSkip:function(fD){Action.doMoveCopy({action:action,destination:destination,hu:"keep",doForAll:fD.doForAll});}});}else{fO(ao.Message,'MoveCopy')}}},onFailure:function(response){fO(d(response,{j:Locale.requestError}),'MoveCopy');},onComplete:function(){Loading.hide();}});};function fM(destination,targets){if(cwd.id==destination)refreshDir();CopyMoveTree.refreshNode(destination);navTree.refreshNode(destination);targets.each(function(node){Listing.removeNode(node);});};this.donewFolder=function(aS){if(!aS){SetMessage(Locale['actionsMessageNewFolder'],0,'message_NewFolder');bN('NewFolder',{width:370,onComplete:function(){$('newFolder_input').select();$('newFolder_input').focus();}});return;}var Folder=$('newFolder_input').value;if(!Folder)return SetMessage(Locale['actionsMessageNewFolderNoName'],1,'message_NewFolder');C({type:'Create',ak:'NewFolder',loadMessage:Locale['actionsPopupNewFolder'],parameters:{parent:targets[0].id,name:Folder},onSuccess:function(){cj()}});};this.Dialog=function(Address,cr){if(!cr)cr={};var aj=(Address.split('?'))[0]==(dG.split('?'))[0];var eZ=aj&&cr.restore;var popped=false;if(!l||l.id!='popup_Dialog'){if(!eZ)$('DialogContent').innerHTML='';aj=false;popped=true;bN('Dialog',{width:cr.width||null,height:cr.height||null,onComplete:function(){if(!$('DialogContent').innerHTML.empty())return;Loading.show({obj:$('popup_Dialog'),bx:$('DialogContent'),label:cr.loadMessage});new Tips('#DialogContent *[title]',{position:'top'});},afterEffectShow:cr.afterEffectShow||null,onClose:cr.onClose||null});}else if(!eZ){var popup=$('popup_Dialog');if(cr.width)popup.style.width=cr.width+'px';Loading.show({obj:popup,bx:$('DialogContent'),label:cr.loadMessage});if(aV)aV();aV=cr.onClose;}D=cr.minHeight?cr.minHeight:false;G=cr.maxHeight?cr.maxHeight:false;if(eZ){if(cr.onComplete)cr.onComplete();return;}var bp;if(cr.form)bp=Form.serialize(cr.form);dG=Address;new Ajax.Updater({success:'DialogContent'},Address,{onlyLatestOfClass:'dialog',evalScripts:true,parameters:bp,onComplete:function(response){if(!aj){setSizes();var images=$('DialogContent').select('img');images.invoke('observe','load',function(event){if(images.any(function(i){return!i.complete}))return;setSizes();});}Loading.hide();if(response.request.success()){if(cr.onComplete)cr.onComplete();new Tips('#DialogContent *[title]',{position:'top'});}else{fO(d(response,{j:Locale.requestError}));}if(cr.afterEffectShow&&popped!==true)cr.afterEffectShow();}});return false;};function r(message,fq,title,width){SetMessage(message,0,'message_Info');bN('Info',{'width':(width?width:'350')});$('Info_detail').innerHTML=fq||'';if(title){$('Info_title').show().innerHTML=title;}else{$('Info_title').hide();}};this.r=r;function C(Request){if(Request.loadMessage)Loading.show({obj:l.id==('popup_'+Request.ak)?l:$('BodyContainer'),label:Request.loadMessage});new Ajax.Request('/Pages/API?action='+Request.type,{onlyLatestOfClass:'fileActions',parameters:Request.parameters,onSuccess:function(transport){var ao=transport.responseText.evalJSON(true);Loading.hide();if(ao.Status=='OK'){Listing.update(ao);if(Request.onSuccess)Request.onSuccess(ao);}else{fO(ao.Message,Request.ak);}},onFailure:function(response){fO(d(response,{j:Locale.requestError}),Request.ak);Loading.hide();}});};function fO(error,fP){if(fP&&l.id==('popup_'+fP)){SetMessage(error,1,'message_'+fP);}else{r(error);}};function bN(bf,cr){cj(true);Listing.nodeTipsEnabled=false;var cc='popup_'+bf;var aN=$(cc);if(cr.width)aN.style.width=cr.width+'px';D=cr.minHeight?cr.minHeight:false;G=cr.maxHeight?cr.maxHeight:false;l=aN;setSizes();if(BrowserDetect.ap=='Firefox'){aN.style.visibility='hidden';aN.show();aN.hide();aN.style.visibility='visible';}fs=new Effect.Fade('BodyContainer',{duration:0.5,to:0.3});fr=new Effect.Appear(cc,{duration:0.5,afterFinish:function(){if(cr.onComplete)cr.onComplete();if(cr.afterEffectShow)cr.afterEffectShow();}});if(cr.onClose)aV=cr.onClose;return false;};function setSizes(){var height=0;var popup=l;if(!popup)return;var gp=popup.select("div.dBody .content");$('DialogContent').setStyle({'height':'auto'});gp.invoke('setStyle',{'height':'auto'});var aI=windowSize();var height=popup.getHeight();var minHeight=D||100;if(height<minHeight)height=minHeight;if(height>(aI.height-50))height=aI.height-50;if(G&&height>G)height=G;gp.invoke('setStyle',{'height':(height-51)+'px'});var y=((aI.height-popup.getHeight())/2);var x=((aI.width-popup.getWidth())/2);if(y<10)y=10;if(x<10)x=10;popup.style.top=y+'px';popup.style.left=x+'px';};function cj(eO){if(!l)return;if(aV){aV();aV=false;}if(fr)fr.cancel();if(fs)fs.cancel();if(eO){l.hide();$('BodyContainer').setOpacity(1.0);Listing.setSizes();l.select("div.dBody .content").invoke('setStyle',{'height':'auto'});}else{new Effect.Fade(l,{duration:0.5,afterFinish:function(el){Listing.setSizes();el.element.select("div.dBody .content").invoke('setStyle',{'height':'auto'});}});new Effect.Appear('BodyContainer',{duration:0.5})}Listing.nodeTipsEnabled=true;Loading.hide(true);D=false;G=false;l=false;if(window.focus)window.focus();};function L(aJ){var ba=new Array;for(var i=0,len=aJ.length;i<aJ.length;i++){ba[ba.length]=aJ[i].id;}return ba;}} ;
(function(){var hash=null,previous_hash=null,isIE=BrowserDetect.ap==='Explorer'?true:false;function poll(){var hash=getUriFrom(window);if(hash&&hash!==previous_hash){if(isIE){var dh=$('historyshim').contentWindow.document;dh.open();dh.write(new Date().getTime());dh.close();dh.location.hash=hash;}document.fire('hash:cl',{previous:previous_hash,current:hash});}previous_hash=hash;window.setTimeout(arguments.callee,300);};function iFrameCheck(){var iHash=$('historyshim').contentWindow.document.location.hash.substring(1);if(iHash&&iHash!==previous_hash){window.location.hash=iHash;previous_hash=iHash;document.fire('hash:cl',{previous:previous_hash,current:iHash});}window.setTimeout(arguments.callee,300);};function ea(e){var opts={};if(e.memo.previous===null)opts={cgiParams:{firstCall:true}};Action.close(true);listDirectory(e.memo.current,opts);};document.observe('hash:cl',ea);document.observe('humyo:started',function(){if(isIE)iFrameCheck();poll();});})();;
var U={upload:true};Event.observe(window,'resize',function(event){av(false,true);});Event.observe(window,'load',function(){var header=$('info_header_upload');if(!header)return;new Tip(header,{tip_content:Locale.uploadOpenTip,position:'right'});header.observe('mousedown',function(){if(U['upload']){var hc=Upload.open({advanced:'dragdrop'});if(hc)return;}infoHeaderButtonDown('upload');});});function infoHeaderButtonOver(n){var state;if(U[n]){state='down hover';}else{state='up hover';}document.getElementById("info_header_button_"+n).className='info_header_button '+state;document.getElementById("info_header_link_"+n).className='info_header_text_hover';};function infoHeaderButtonOut(n){var state;if(U[n]){state='down';}else{state='up';}document.getElementById("info_header_button_"+n).className='info_header_button '+state;document.getElementById("info_header_link_"+n).className='info_header_text';};function infoHeaderButtonDown(n,cg){var state;var fg=document.getElementById('info_pane_'+n);if(!fg)return;if(U[n]){if(cg){state='up';}else{state='down hover';}$('info_'+n).show();$('info_header_'+n).addClassName('tipHide');U[n]=false;}else{if(cg){state='down';}else{state='up hover';}if(n=='upload'&& !cg)Applet.hide();$('info_'+n).hide();$('info_header_'+n).removeClassName('tipHide');U[n]=true;}document.getElementById("info_header_button_"+n).className='info_header_button '+state;if(!cg)av(n);};function av(Opened,cv){var tree=$('OrganiseTree');if(!tree)return;var tasks=$('info_pane_tasks');var upload=$('info_pane_upload');var header=$('header');if(cv&&U['tasks']&&Opened!='tasks')infoHeaderButtonDown('tasks',true);var aD=windowSize().height-(header?header.getHeight():0)-tasks.getHeight()-upload.getHeight()-38;var aE=50;if(aD<aE&& !U['tree']&&Opened!='tree'){infoHeaderButtonDown('tree',true);aE=0;}else if(U['tree']){aE=0;}if(aD<aE&& !U['tasks']&&Opened&&Opened!='tasks'){aD+=$('info_tasks').getHeight();infoHeaderButtonDown('tasks',true);}if(aD<aE&& !U['upload']&&Opened!='upload'){aD+=($('info_upload').getHeight()+$('info_upload_applet').getHeight());infoHeaderButtonDown('upload',true);}if(aD>=50){if(cv&&U['tree']&&Opened!='tree')infoHeaderButtonDown('tree',true);$('OrganiseTree').style.height=aD+'px';}};function uploadAppletCallback(es,aw,fe,ff,bH,fileIds){if(es==0){var fD={to:{id:fe.substring(1,fe.length-1),name:bH},fileIds:fileIds};if(aw==507)fD.goTo='Splash:QuotaExceeded';if(aw==520)fD.goTo='Splash:VerifyEmailUpload';Upload.finish(fD);}else if(es==1){if(aw!=0){if(aw== -2&&BrowserDetect.ap=='Explorer'&&BrowserDetect.OS=='cy'){Action.Dialog('/Pages/HelpUploadUAC',{width:450});}else{Action.r(Locale.actionsMessageOpenFail,'Error Code: '+aw);}}}else if(es==2){refreshDir();}else if(es==3){var fD={};if(aw!=0){if(aw==402)fD.goTo='Splash:MultiDownloadUpsell';fD.error=Locale.requestError+' ('+aw+')';}if(fileIds&&fileIds[0].fileFailed.length>0)fD.fileFailed=fileIds[0].fileFailed;Upload.finish(fD);}else{alert("unrecognised callback from applet: "+es);}} ;
function dO(){var by=new Object;var listViews=new Array;var dA=new Array;var eQ=null,nodeTipsEnabled=true;Event.observe(window,'resize',setSizes);document.observe('ns:update',function(e){eval("Listing.update("+e.memo+")");});this.ad=ad;this.P=P;this.setSizes=setSizes;this.ds=ds;this.addListener=function(fQ){dA.push(fQ);};this.removeListener=function(remove){dA.each(function(fQ,index){if(fQ==remove)dA.splice(index,1);});};this.update=function(data){var list=this;if(data.updated)data.updated.each(function(update){list.updateNode(update);});if(data.added)data.added.each(function(add){list.appendNode(add);});if(data.deleted)data.deleted.each(function(erase){list.removeNode(erase);});if(data.info)data.info.each(function(info){list.addInfo(info);});if(typeof(data.content)!='undefined')cwd.content=data.content;};this.hideContent=function(){this.update({content:null});this.build('List');};this.removeNode=function(id){var node=this.nodes().detect(function(node){return node.data.id==id});if(node){node.elements.invoke('setStyle',{visibility:'hidden'});cwd.node[node.index-1]=null;cwd.items--;Selection.removeNode(node.index);eQ=null;}dv().invoke('removeNode',id);};this.appendNode=function(node){var hi=node.added_to?node.added_to:[cwd.id];hi.each(function(at){if(at==cwd.id){var content=$('Content');if(content){content.remove();cwd.content=null;$('BodyTag').insert(new Element('div',{className:'clear'}));}var index=cwd.node.length;cwd.node[index]=node;Listing.P(index+1,node);cwd.items++;Selection.update();}dv().invoke('P',at,node);});};this.updateNode=function(update){if(update.id==cwd.id){goToOrRefresh(update.uri,{invisible:true});}else{var node=this.nodes().detect(function(node){return node.data.id==update.id});if(node){cwd.node[node.index-1]=update;node.elements.invoke('remove');P(node.index,update);Selection.update();}}dv().invoke('updateNode',update);};this.clear=function(hg){if($('BodyTag'))$('BodyTag').remove();if($('node_ctrl'))$('node_ctrl').remove();if($('Content'))$('Content').remove();if($('footerbar'))$('footerbar').remove();if(!hg){$('alert').addClassName('hide').update();}else{$('alert').select('.dynamic').invoke('remove');}eQ=null;};this.nodes=function(){if(eQ)return eQ;eQ=new Array;for(var i=0,len=cwd.node.length;i<len;i++){var data=cwd.node[i];if(!data)continue;var elements=new Array;elements.push($('node_'+(i+1)));if(cwd.columns){cwd.columns.each(function(col){var element=$('node_'+(i+1)+'_'+col.param);if(element)elements.push(element);});}eQ.push({index:i+1,data:data,elements:elements});}return eQ;};this.addInfo=function(content){if(content.blank())return;var gI=$('alert');gI.removeClassName('hide').insert(content);gI.childElements().each(function(bQ){if(bQ.hasClassName('closeable')){var hs=new Element('a',{className:'info_close'});bQ.removeClassName('closeable').insert(hs);hs.observe('click',function(event){event.stop();Listing.removeInfo(bQ);});}});new Tips('#alert *[title]',{position:'top'});setSizes();};this.removeInfo=function(info){if(!info)return;info.remove();var gI=$('alert');if(gI.empty())gI.addClassName('hide');setSizes();};this.build=function(listView){if(listView&& !cwd.listViews.include(listView))return;if(!listView){var gZ=listViews[cwd.id];if(gZ&&cwd.listViews.include(gZ)){listView=gZ;}else{listView=cwd.listViews[0];}}cwd.listView=listViews[cwd.id]=listView;['List','Thumbs'].each(function(view){var button=$('tb_'+view);if(cwd.listViews.length<2){g.fb(button);return;}g.fU(button);if(cwd.listView==view){g.select(button);}else{g.gq(button);}});if(cwd.listView=='Thumbs'){$('body').removeClassName('list').addClassName('thumbs');}else{$('body').removeClassName('thumbs').addClassName('list');}if(cwd.filters&&cwd.filters.size()>1){var filters=$('view_filters').removeClassName('hide');var menu=$('view_filters_menu').update();cwd.filters.each(function(filter){var a=new Element('a',{className:filter.name,href:'#'+filter.uri}).update(filter.text).observe('click',function(event){trackEvent('File Filters',event.type,filter.name,'#'+filter.uri);});if(filter.selected)a.addClassName('selected');menu.insert(a);});$('view_filters').setStyle({'width':menu.getWidth()+'px'});var text=filters.down("div.label");var icon=filters.down("div.icon");var selected=cwd.filters.find(function(filter){return filter.selected});if(selected){filters.addClassName('click');icon.writeAttribute('class','icon '+selected.name);text.update(selected.text);}else{filters.removeClassName('click');icon.writeAttribute('class','icon nofilters');text.update(Locale['fileFiltersButton']);}}else{$('view_filters').addClassName('hide');}dL();if(!cwd.content||cwd.content.blank()){eP();$('BodyTag').insert('<div class="clear"></div>');}if(cwd.pages>1||cwd.listMore){if(!$('footerbar')){var footer=new Element('div',{id:'footerbar'});$('body').insert(footer);}var table=new Element('table',{id:'pagination',width:'100%',cellpadding:'0',cellspacing:'0',border:'0',className:'pagination'});var gJ=new Element('tbody');var tr=new Element('tr');var gK=new Element('td',{width:'30px'});if(cwd.page==1){gK.innerHTML='<a id="page-pre" href="" onClick="return false;" class="toolbut disabled"><span><img class="icon toolbar pageback" src="/Assets/Default/Images/x.gif" alt="" border="0" /></span></a>';}else{gK.innerHTML='<a id="page-pre" href=""  title="'+Locale['altPrevious']+'" onClick="goPage(cwd.page - 1);return false;" class="toolbut"><span><img class="icon toolbar pageback" src="/Assets/Default/Images/x.gif" alt="" border="0" /></span></a>';}var dx,gd;if(cwd.page!==cwd.pages){if(cwd.page===1){dx=1;}else{dx=(cwd.perPage*(cwd.page-1))+1;}gd=cwd.perPage*cwd.page;}else{dx=cwd.perPage*(cwd.pages-1)+1;gd=(cwd.perPage*(cwd.pages-1))+cwd.node.length;}var gR=new Element('td',{id:'page-content',align:'center'}).update(Locale['Displaying']+' '+dx+' '+Locale['to']+' '+gd+' '+Locale['of']+' '+cwd.items+' '+cwd.childNoun);var gs=new Element('td',{width:'30px',align:'right'});if(!cwd.listMore&&cwd.page==cwd.pages){gs.innerHTML='<a id="page-next" href="" onClick="return false;" class="toolbut disabled"><span><img class="icon toolbar pagefwd" src="/Assets/Default/Images/x.gif" alt="" border="0" /></span></a>';}else{gs.innerHTML='<a id="page-next" href="" title="'+Locale['altNext']+'" onClick="goPage(cwd.page + 1);return false;" class="toolbut"><span><img class="icon toolbar pagefwd" src="/Assets/Default/Images/x.gif" alt="" border="0" /></span></a>';}tr.insert(gK).insert(gR).insert(gs);gJ.insert(tr);table.insert(gJ);$('footerbar').insert(table);new Tips('#footerbar *[title]',{position:'bottom',destroy:true});}if(cwd.parent&&cwd.parent!=0){toolBarEnable('Up',Locale['altUp']);}else{toolBarDisable('Up');}setSizes();new Tips('#BodyContainer *[title]',{position:'top'});};function ad(event){var dy=$('details_header_scroll');if(!dy)return;var eJ=$('BodyContainer').scrollLeft;if(eJ>0){dy.style.marginLeft='-'+eJ+'px';}else{dy.style.marginLeft='0px';}};function setSizes(size){var aD=document.viewport.getHeight()-1;var infoHeight=aD;if($('header'))infoHeight=infoHeight-$('header').getHeight();$('info_left').setStyle({'height':infoHeight+'px'});$('info_right').setStyle({'height':infoHeight+'px'});['header','header_navigation','details_header','footerbar','alert'].each(function(hk){var elem=$(hk);if(elem&& !elem.empty()){var elH=elem.getHeight();aD-=elH;}});if(aD<25)aD=25;$('BodyContainer').setStyle({height:aD+'px'});var as=$('BodyTag');if(as){as.setStyle({height:'auto'});$('BodyContent').setStyle({height:'100%'});var content=$('BodyContent');if(cwd.listView!='Thumbs'&&as.getHeight()<aD)as.setStyle({height:'100%'});hozScrollCheck();}ad();};function eP(){if(cwd.listView!='Thumbs'){var nodes=[];cwd.columns.each(function(c,i){nodes[i]='';});}else{var nodes='';}for(var i=1,len=cwd.node.length;i<=len;i++){var node=cwd.node[i-1];if(cwd.listView!='Thumbs'){if(node){var eW=dY(i,node);for(var x=0;x<eW.length;x++){nodes[x]=nodes[x]+eW[x];}}}else{if(node)nodes=nodes+dY(i,node);}}if(cwd.listView!='Thumbs'){$('BodyTag').removeClassName('empty');cwd.columns.each(function(c,i){$('details_column_'+c.name).innerHTML=nodes[i];});}else{$('BodyTag').innerHTML=nodes;}$$('.node').inject(0,function(x,y){y.nodeId=y.readAttribute('nodeId');if(Selection.bS(y.nodeId))Selection.aU(y.nodeId);});};function dY(nodeId,Node){if(cwd.listView!='Thumbs'){var tr,td,node=[];cwd.columns.each(function(col,i){td='<div id="node_'+nodeId;if(i!=0)td+='_'+col.param;td+='" nodeId="'+nodeId+'" class="node node_'+nodeId+' node_details">';if(i==0){td+='<a class="icon_context"><img src="/Assets/Default/Images/x.gif" /></a>';td+='<input id="check_box_'+nodeId+'" type="checkbox" class="icon_select details_checkbox" />';td+='<div class="details_icon icon small '+Node.icon+'">';if(Node.overlays){var x=Node.overlays[0];var title=Locale['overlays'][x]['title']?Locale['overlays'][x]['title']:null;td+='<div class="overlay small '+x+'" title="'+title.interpolate({item:Node.noun})+'"></div>';}td+='</div>';}td+='<div id="file_name_'+nodeId+'" class="node_details_text"><span>'+(Node[col.param]||'')+'</span></div>';td+='</div>';node[i]=td;});}else{var overlay='';if(Node.overlays){overlay+='<div id="node_'+nodeId+'_overlay" class="icon_overlay_bottom">';Node.overlays.each(function(x){var title=Locale['overlays'][x]['title']?Locale['overlays'][x]['title']:null;overlay+='<div class="overlay '+x+'" title="'+title.interpolate({item:Node.noun})+'"></div>';});overlay+='</div>';}var thumb=Node.thumb;if(thumb&&thumb.substring(0,4)!='http'){thumb=document.location.protocol+'//'+document.location.host+Node.thumb;}var node='<div id="node_'+nodeId+'" nodeId="'+nodeId+'" class="node"><div id="icon_frame_'+nodeId+'" class="icon_frame"><div class="icon_element icon large '+Node.icon+' '+(thumb?'thumb':'')+'"'+(thumb?' style="background-image:url('+thumb+');"':'')+'><a class="icon_context"><img src="/Assets/Default/Images/x.gif" width="13" height="13" /></a><input id="check_box_'+nodeId+'" class="icon_select" type="checkbox" />'+overlay+'</div></div><div class="file_name"><span id="file_name_'+nodeId+'">'+Node.name+'</span></div></div>';}return node;};function P(nodeId,Node){if(cwd.listView!='Thumbs'){$('BodyTag').removeClassName('empty');var aN=dY(nodeId,Node);cwd.columns.each(function(col,i){var fZ='node_'+(nodeId+1)+(i==0?'':'_'+col.param);var before=$(fZ);if(before){before.insert({before:aN[i]});}else{var hl=$('details_column_'+col.name);hl.insert(aN[i]);}});}else{aN=dY(nodeId,Node);var before=$('node_'+(nodeId+1));if(before){before.insert({before:aN});}else{$('BodyTag').down('div.clear').insert({before:aN});}}$('node_'+nodeId).nodeId=nodeId;if(Selection.bS(nodeId))Selection.aU(nodeId);eQ=null;};function dL(){eQ=null;var bC=$('BodyContainer');var BodyContent=new Element('div',{id:'BodyContent'});var bE=new Element('div',{id:'BodyTag'});bC.update().removeClassName('selection');if($('details_header'))$('details_header').remove();if($('footerbar'))$('footerbar').remove();if(!cwd.error&&cwd.columns){cwd.columns.each(function(col){if(by[col.name]){col.width=by[col.name];}});}BodyContent.observe('mousedown',Selection.bl);bC.observe('scroll',ad);bE.observe('mousedown',function(event){if(event.findElement('a.icon_context'))return event.stop();if(event.element().hasClassName('icon_select')){event.stop();Selection.fF(event);}else if(event.element().nodeId||event.element().up('div.node')){Selection.cM(event);}}).observe('mouseup',function(event){if(event.element().nodeId||event.element().up('div.node')){Selection.dm(event);}}).observe('dblclick',function(event){if(event.element().hasClassName('icon_select'))event.stop();else if(event.element().nodeId||event.element().up('div.node')){Action.cV(event);}}).observe('click',function(event){if(event.findElement('a.icon_context')){Menu.show(event);if(!event.findElement('.icon_frame_selected'))Selection.cM(event);}});if(cwd.content){BodyContent.insert(new Element('div',{id:'Content'}).update(cwd.content));if(!$('info_tasks').visible())infoHeaderButtonDown('tasks');}if(cwd.listView!='Thumbs'){bE.addClassName('empty');var dC=document.createElement('DIV');dC.id='details_header';document.body.appendChild(dC);var bF=document.createElement('DIV');bF.id='details_header_scroll';dC.appendChild(bF);if(cwd.columns){var bw=0;cwd.columns.each(function(col,i){bw+=(col.width+7);var dF=new Element('div',{id:'details_column_'+col.name,className:'details_column'});dF.style.width=col.width+'px';if(i==0)dF.addClassName('first');if(i==(cwd.columns.length-1))dF.addClassName('last');bE.appendChild(dF);var aG=document.createElement('DIV');aG.id='details_header_'+col.name;aG.ay=col.name;aG.className='details_header_column';aG.style.width=col.width+'px';if(col.orderBy){aG.onmouseover=function(){this.className='details_header_column_ro'};aG.onmouseout=function(){this.className='details_header_column'};aG.onmousedown=function(){orderBy(col.orderBy);};}var cu=document.createElement('DIV');cu.className='details_header_spacer';var Img=document.createElement('IMG');Img.src='/Assets/Default/Images/Spacer.gif';cu.appendChild(Img);Event.observe(cu,'mousedown',eg);Event.observe(cu,'dblclick',dM);aG.appendChild(cu);var bb=document.createElement('DIV');bb.className='details_header_text';var Text=document.createTextNode(col.label);bb.appendChild(Text);if(cwd.orderBy==col.orderBy&&cwd.orderDirection){var Img=document.createElement('IMG');Img.src='/Assets/Default/Images/OrderBy'+cwd.orderDirection+'.gif';bb.appendChild(Img);}aG.appendChild(bb);bF.appendChild(aG);});}bE.style.width=bw+'px';}BodyContent.appendChild(bE);BodyContent.insert('<div class="clear"></div>');bC.appendChild(BodyContent);document.body.appendChild(bC);};function eg(event){Event.stop(event);document.body.style.cursor='e-resize';var obj=Event.element(event).parentNode;var column=obj.ay;obj.onMouseMove=ei;obj.onEnd=eK;obj.A=parseInt(obj.style.width);obj.dD=[$('details_column_'+column),$('BodyTag')];obj.dD.each(function(o){o.A=parseInt(o.style.width);});dT.dL(event,obj);};function ei(event,ct,cZ){var ea=Event.pointerX(event)-ct;var cz=this.A+ea;if(cz<50){ea+=(50-cz);cz=50;}by[this.ay]=cz;this.style.width=cz+'px';this.dD.each(function(o){var width=(o.A+ea);o.style.width=width+'px';});Listing.ad();};function hozScrollCheck(){if($('BodyContent').getWidth()<$('BodyTag').getWidth()){aD=$('BodyContent').getHeight()-20;$('BodyContent').setStyle({height:aD+'px'});}};function eK(event){document.body.style.cursor='';hozScrollCheck();};function dM(event){Event.stop(event);var ay=Event.element(event).parentNode.ay;var column=$('details_column_'+ay);var minWidth=50;var maxWidth=0;column.immediateDescendants().each(function(row){var cK=0;row.immediateDescendants().each(function(eN){var eG=eN.immediateDescendants();if(eG[0]){cK+=eG[0].getWidth();}else{cK+=(eN.getWidth()+6);}});if(cK>maxWidth)maxWidth=cK;});maxWidth+=10;if(maxWidth<minWidth)maxWidth=minWidth;var A=parseInt(column.style.width);if(maxWidth!=A){[$('BodyTag'),$('details_header_'+ay)].each(function(element){var eR=parseInt(element.style.width);element.style.width=(eR+(maxWidth-A))+'px';});}column.style.width=maxWidth+'px';by[ay]=maxWidth;hozScrollCheck();};this.cB=function(){[$('advert_right')].each(function(bk){if(!bk)return;bk.innerHTML='';var parent=bk.parentNode;var aD=Element.getHeight(parent);parent.immediateDescendants().each(function(bQ){if(bQ==bk)return;aD-=bQ.getHeight();});var choices=AdChoices[bk.id];var bG='';var bU=0;for(var size in choices){size=parseInt(size);if(size>bU&&size<=aD){bU=size;bG=choices[size];}}bG=bG.replace(/INSERT_RANDOM_NUMBER_HERE/g,Math.random());bk.innerHTML=bG;});};function ds(nodeId){var node=$('node_'+nodeId);if(!node)return;var viewport=$('BodyContainer');var fD={paddingTop:node.getHeight()+10};if(cwd.listView=='Thumbs')fD.paddingLeft=node.getWidth()+10;dw(viewport,node,fD);};function dv(){return dA;}}(function(){Event.observe(document,'mouseover',mouseover);function mouseover(event){if(!Listing||Listing.nodeTipsEnabled===false)return false;var node=event.findElement('.node');if(typeof node==='object'){node.observe('mousedown',mouseout);node.observe('mouseout',mouseout);node.observe('mousemove',mousemove);window.document.observe('mousewheel',hB).observe('DOMMouseScroll',hB);return timeoutID=window.setTimeout(function(){popped(node)},1000);}else{return false;}};function hB(event){$$('.nodeTip').invoke('hide');};function mousemove(event){var self=this;Event.stop(event);window.clearTimeout(timeoutID);return timeoutID=window.setTimeout(function(){popped(event,self)},1000);};function mouseout(event){try{this.tipAjax.respondToReadyState=Prototype.emptyFunction;this.tipAjax.transport.abort()}catch(e){}unobserve(this);return window.clearTimeout(timeoutID);};function unobserve(node){node.stopObserving('mousedown',mouseout);node.stopObserving('mouseout',mouseout);node.stopObserving('mousemove',mousemove);};function popped(event,node){if(typeof node!=='object')return;var tipId='node_'+(node.nodeId)+'_tip',nodeId=node.nodeId-1,options={};if(!cwd.node[nodeId])return;options={id:tipId,position:'bottom',classExtra:'nodeTip nodeDetails '+cwd.listView,showDelay:500,hideDelay:0,loadShown:true,destroy:true};unobserve(node);var selection=Selection.aW(),gC=selection.length;if(gC>1){if(node.hasClassName('node_details_selected')||node.down().hasClassName('icon_frame_selected')){var temp=new Template(Locale['YouHaveSelected']);options.tip_content='<div class="arrow"></div><h2>'+temp.evaluate({'item':gC,'childNoun':cwd.childNoun})+'</h2>';return new Tip(node,options);}}var tipContent=cwd.node[nodeId].tipContent;if(tipContent){if(tipContent!=='NOAJAX'){options.tip_content=tipContent;new Tip(node,options);}}else{node.tipAjax=new Ajax.Request('/Pages/Tooltip',{onlyLatestOfClass:'nodeTip',parameters:{node:cwd.node[nodeId].id,container:cwd.id},onSuccess:function(ajax){if(ajax.responseText){cwd.node[nodeId].tipContent=ajax.responseText;}},onComplete:function(){tipContent=cwd.node[nodeId].tipContent;if(tipContent){options.tip_content=tipContent;new Tip(node,options);}else{cwd.node[nodeId].tipContent='NOAJAX';}}});}}})(); ;
function dN(){var bx;var timer;var v;Event.observe(window,'resize',dq);this.show=function(cr){v=cr;Loading.hide();$('LoadingLabel').innerHTML=v.label||Locale['loading'];dq();if(v.eE){timer=setTimeout(show,v.eE);return;}show();};this.hide=function(ey){if(timer)clearTimeout(timer);$('Loading').hide();if(bx){if(!ey){bx.setOpacity(1);Listing.nodeTipsEnabled=true;}bx=false;}};function show(){Listing.nodeTipsEnabled=false;$('Loading').show();bx=v.bx||v.obj;bx.setOpacity(0.25);};function dq(){var aN=$('Loading');var aQ=Position.positionedOffset(v.obj);var x=v.x||aQ[0]+(v.obj.getWidth()/2)-(aN.getWidth()/2);var y=v.y||aQ[1]+(v.obj.getHeight()/2)-(aN.getHeight()/2);aN.style.left=x+'px';aN.style.top=y+'px';}};
function ef(){var ce={play:{code:"Action.Play('#{target}')",icon:'Play',mult:true,fB:['Audio'],not:['view'],dflt:true},view:{code:"Action.View('#{target}')",icon:'View',mult:true,fB:['Video','Image'],not:['play'],dflt:true},open:{code:"Action.Open('#{target}')",icon:'Open',dflt:true},download:{code:"window.location.href='#{uri}?dl=1'",icon:'Download',dflt:true},downloadMulti:{code:"Action.DownloadMulti('#{target}')",mult:true,icon:'Download',not:['download']},listDir:{code:"window.location.hash = '#{uri}'",icon:'OpenFolder',dflt:true},link:{code:"Action.DialogAction({page: '/Pages/Link?container=' + cwd.id + '&', target:'#{target}'})",icon:'Link.png',mult:true,tasks:0,context:0,tree:0,sharing:true},link_facebook:{code:"popupWindow('link_facebook', 450, 600, false, '/Pages/Link?site=facebook&container=' + cwd.id + '&id=#{targets}')",icon:"Facebook.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_twitter:{code:"popupWindow('link_twitter', 600, 800, true, '/Pages/Link?site=twitter&container=' + cwd.id + '&id=#{targets}')",icon:"Twitter.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_myspace:{code:"popupWindow('link_myspace', 450, 600, false, '/Pages/Link?site=myspace&container=' + cwd.id + '&id=#{targets}')",icon:"Myspace.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_linkedin:{code:"popupWindow('link_linkedin', 450, 600, false, '/Pages/Link?site=linkedin&container=' + cwd.id + '&id=#{targets}')",icon:"Linkedin.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},share:{code:"Action.DialogAction({ page: '/Pages/Share?', width: 475, minHeight: 330, target: '#{target}' })",icon:'Share.gif',mult:true,tasks:0,context:0,tree:0},embed:{code:"Action.DialogAction({ page: '/Pages/Embed?', target: '#{target}'})",icon:'Embed.gif',mult:true,fB:['Image','Audio','Video'],tasks:0,context:0,tree:0},erase:{code:"Action.Delete('#{target}', '#{name}')",icon:'Delete',mult:true},dropLink:{code:"Action.Delete('#{target}', '#{name}', { loadMessage: Locale['actionsPopupDropLink'], confirm: { title:Locale['actionsPopupDropLinkTitle'] , message:Locale['actionsPopupDropLinkConfirm'] } })",icon:'Delete.gif',sharing:1},recycle:{code:"Action.Recycle('#{target}', '#{name}')",icon:'Delete',mult:true},restore:{code:"Action.Update('#{target}', {parameters: {updateType:'restore'}, loadMessage:Locale['actionsPopupRestore']})",icon:'RestoreBin',mult:true},empty:{code:"Action.Update('#{target}', {parameters: {updateType: 'empty'}, loadMessage:Locale['actionsPopupEmptyBin'], confirm: {icon:'/Assets/Default/Images/Icons/Large/RecycleBin.gif', message:{singular:{description:Locale['actionsConfirmEmptyRecycle']}}}})",icon:'Empty',mult:true},rename:{code:"Action.Rename('#{target}', '#{name}')",icon:'Rename'},move:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Move'] })",icon:'Move.gif',mult:true,not:['moveCopy']},copy:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Copy'] })",icon:'Copy.gif',mult:true,not:['moveCopy']},moveCopy:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Move','Copy'] })",icon:'Move',mult:true},newFolder:{code:"Action.newFolder('#{target}')",icon:'NewFolder'},listVersions:{code:"Action.DialogAction({page:'/Pages/VersionDialog?', target: '#{target}', width: 480})",icon:'FileVersions'}};this.mouseOut=function(event){$('popup_menu').tid=setTimeout("$('popup_menu').style.visibility = 'hidden'",20);};this.contextMenu=function(event){var target=Event.element(event);if(target.tagName=='INPUT'||target.tagName=='TEXTAREA')return;return show(event);};Event.observe(document,'contextmenu',this.contextMenu);Event.observe(window,'resize',hide);Event.observe(document,'click',hide);this.hide=hide;this.show=show;this.actionsFor=actionsFor;this.buildActions=buildActions;this.cb=cb;function hide(event){if(event&&(event.type==='click'&& !Event.isLeftClick(event))&&(Object.isElement(event.originalTarget)&&event.originalTarget.up('.node')))return false;$('popup_menu').style.visibility='hidden';};function show(event){event=event||window.event;var element=Event.element(event);if(dT.eu())return true;Event.stop(event);var be=$('popup_menu');clearTimeout(be.tid);if(element.hasClassName('icon_context')){var o=element.viewportOffset();var x=o.left;var y=o.top;}else{var x=Event.pointerX(event);var y=Event.pointerY(event);}if(element.up('div.node'))element=element.up('div.node');else{var i=0;while(element&& !element.nodeId&& !element.nsData&&i<5){element=element.parentNode;i++;}}var cR={targets:[],menu:'context'};var menu;if(element&&element.nsData){cR.targets.push(element);cR.menu='tree';}else if(element&&element.nodeId){if(Selection.bS(element.readAttribute('nodeId'))){cR.targets=Selection.selectedIds();}else{cR.targets.push(element.readAttribute('nodeId'));}}var actions=buildActions(actionsFor(cR),cR.targets);cb(actions,x,y,event);};function cb(M,x,y,event){if(M.length==0)return true;var be=$('popup_menu'),PopContent=$('popup_menu_content'),bt=false,bgHost=document.location.protocol+'//'+document.location.host+'/Assets/Default/Images/Icons/Small/';PopContent.update('');M.each(function(a){var attr={},el;if(a.dflt& !bt){attr.className='selected';bt=true;}if(a.href)attr.href=a.href;el=new Element('a',attr).insert({'top':'<div class="icon tasks '+a.icon+'"></div>'}).insert(a.label);if(!a.href)el.observe("click",function(event){event.stop();return eval(a.code);});PopContent.insert(el);});if(event.type=='contextmenu'){x--;y--;}else{var o=event.element().viewportOffset();x=o.left;y=o.top;}var aI=windowSize();if((x+be.getWidth())>aI.width){x=x-((x+be.getWidth())-aI.width)-30;}if((y+be.getHeight())>aI.height){y=y-((y+be.getHeight())-aI.height)-20;}var nodeTip=Ajax.currentRequests['nodeTip'];if(nodeTip){nodeTip.transport.onreadystatechange=Prototype.emptyFunction;nodeTip.transport.abort();Ajax.activeRequestCount--;};be.style.top=y+'px';be.style.left=x+'px';be.style.visibility='visible';};function populateActions(actions){if(!actions)return[];actions.each(function(action){if(!action.id)return;if(ce[action.id])Object.extend(action,ce[action.id]);var text=Locale['menuItems'][action.id];if(!text)return;['alt','label'].each(function(aF){if(action[aF])return;action[aF]=text[aF];});});return actions;};function actionsFor(cR){var targets=cR.targets,dZ=0,M=new Array;if(targets)dZ=targets.length;if(dZ==1){var target=targets[0];var node=typeof(target)!='object'?cwd.node[targets[0]-1]:(target.nsData||target);var fo=node.actions.clone();M=populateActions(fo);}else if(dZ>1){M=populateActions(cwd.actions).reject(function(action){if(!action.mult)return true;if(action.fB&& !targets.any(function(target){if(action.fB.include(cwd.node[target-1].fClass))return true;}))return true;}).concat(populateActions(cwd.node[targets[0]-1].actions).reject(function(action){if(!action.mult)return true;if(!targets.all(function(target){if(populateActions(cwd.node[target-1].actions).any(function(cf){if(cf.id==action.id)return true;}))return true;}))return true;}));}else{M=populateActions(cwd.actions);}if(!M)return[];var cQ=new Array;M.each(function(fH){if(!cQ.find(function(action){if(action.id==fH.id)return true;})){cQ.push(fH);}});return cQ.reject(function(action){if(action.fB){var valid=action.fB.any(function(n){return cwd.node.any(function(x){return x&&n===x.fClass;});});if(!valid)return true;}if(cR.menu&&action[cR.menu]==0)return true;if((cR.require||['tasks','details'].any(function(m){return action[m]}))&&(!cR.menu|| !action[cR.menu]))return true;if(dZ&&action.not&&action.not.any(function(not){if(M.pluck('id').include(not))return true;}))return true;});};function buildActions(actions,targets){var target,name,itemDesc,fJ,uri;var bR=targets.length;if(bR==0){target=fJ=cwd.id;name=cwd.name;itemDesc=cwd.noun;uri=cwd.uri;}else if(bR==1){var node=typeof(targets[0])!='object'?cwd.node[targets[0]-1]:(targets[0].nsData||targets[0]);target=node.id;name=node.name;itemDesc=node.noun;fJ=target;uri=node.uri;}else{target=null;itemDesc=cwd.childNoun;var ids=new Array;for(var i=0;i<targets.length;i++){if(targets[i].id){ids[ids.length]=targets[i].id;}else{ids[ids.length]=cwd.node[targets[i]-1].id;}}fJ=ids.join(',');}var vars={uri:uri,target:target,targets:fJ,name:name,item:itemDesc};for(var i=0,len=actions.length;i<len;i++){var src=actions[i];var dz={code:src.code,href:src.href,icon:src.icon,dflt:src.dflt};['label','alt'].each(function(aF){if(!src[aF])return;dz[aF]=(src.code?src[aF].base:(src[aF].static||src[aF].base))||src[aF];if(bR>1){if(src[aF].plural)dz[aF]=src[aF].plural;}else if(bR==0){if(src[aF].container)dz[aF]=src[aF].container;}});['code','label','alt','href'].each(function(aF){if(dz[aF]){var temp=new Template(dz[aF]);dz[aF]=temp.evaluate(vars);}});actions[i]=dz;}return actions;}} ;
function dB(){var selected=new Array;var selection=null;var checkBox=false;var dV=false;var ab=0;var T=0;var aO=false;var bo=null;var bY=null;var onChangeCode=null;var cY=null;this.cM=function(event){event=event||window.event;Event.stop(event);var nodeId=parseInt(event.element().nodeId||event.element().up('.node').readAttribute('nodeId'));if(!Event.isLeftClick(event)&&selected[nodeId])return false;if(aO&& !cwd.node[nodeId-1].container){dT.K(false);aO(cwd.node[nodeId-1]);aO=false;return true;}if(!event.findElement('a.icon_context')){if(Event.isLeftClick(event))dT.dL(event);if(selected[nodeId]){dV=nodeId;return true;}}return dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});};this.dm=function(event){event=event||window.event;var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');if(dV!=nodeId&&Event.element(event).id!='check_box_'+checkBox)return true;dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});return true;};Event.observe(document,'keydown',function(event){switch(event.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_LEFT:case Event.KEY_RIGHT:var elem=event.element();if(elem.tagName=='INPUT'||elem.tagName=='TEXTAREA')return;Event.stop(event);var aF=event.keyCode;if(cwd.listView!='Thumbs'&&(aF==Event.KEY_LEFT||aF==Event.KEY_RIGHT))return;var last=T?T:ab;var next;if(cwd.listView=='Thumbs'){var gl=$('node_'+last);if(!gl)return;var dj=gl.positionedOffset();var nodes=aF==Event.KEY_UP||aF==Event.KEY_LEFT?Listing.nodes().reverse():Listing.nodes();var node=nodes.find(function(node){if(node.index==last)return;var pos=node.elements[0].positionedOffset();if((aF==Event.KEY_UP||aF==Event.KEY_DOWN)&&pos.left!=dj.left)return;if((aF==Event.KEY_LEFT||aF==Event.KEY_RIGHT)&&pos.top!=dj.top)return;if(aF==Event.KEY_DOWN&&pos.top<=dj.top)return;if(aF==Event.KEY_UP&&pos.top>=dj.top)return;if(aF==Event.KEY_RIGHT&&pos.left<=dj.left)return;if(aF==Event.KEY_LEFT&&pos.left>=dj.left)return;return true;});if(node)next=node.index;}else{next=aF==Event.KEY_UP?last-1:last+1;}if(!next)return;dR(next,{range:event.shiftKey,multiple:cmdKey(event)});Listing.ds(next);break;}});Event.observe($('BodyContainer'),'mousedown',lasso);$('BodyContainer').focus();this.fF=function(event){event=event||window.event;var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');if(!Event.isLeftClick(event)){if(!selected[nodeId])dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});return;}checkBox=nodeId;};this.aA=function(){for(i=0;i<selected.length;i++){if(selected[i])return true;}return false;};this.bS=function(nodeId){return selected[nodeId];};this.selectedIds=function(){return selection?selection:[];};this.gD=function(hn){var nodes=Listing.nodes();var gu=nodes.findAll(function(node){return hn.include(node.data.id)});bl();gu.each(function(node){dR(node.index,{multiple:true,delayUpdate:true})});this.update();return gu;};this.clear=function(){selection=null;ab=T=0;Selection.gD([]);};this.aW=function(){var aW=new Array;if(selection){selection.each(function(nodeId){aW.push(cwd.node[nodeId-1]);});}return aW;};this.bl=bl;this.removeNode=function(nodeId){selected[nodeId]=false;update();};this.aU=aU;this.ax=ax;this.update=update;this.fG=fG;this.executeDelayed=executeDelayed;this.selectFile=function(eY){Action.close();this.gD([]);aO=eY;dT.K(true);};this.ga=function(){if(bY)bY();bY=bo=null;};this.onChange=function(code){onChangeCode=code;};this.detailsInfoData=function(){return cY;};function cmdKey(event){return BrowserDetect.OS==='Mac'?event.metaKey:event.ctrlKey;};Element.addMethods({nodeOffset:function(element){if("getBoundingClientRect"in document.documentElement){return element.getBoundingClientRect();}else{return element.positionedOffset();}}});function lasso(event){if(event.element().identify()!=='BodyContainer')Listing.nodeTipsEnabled=false;var container=$('BodyContent');if(!container)return;var cW=container.getDimensions(),cO=container.cumulativeOffset(),cS=container.cumulativeScrollOffset(),ct=Event.pointerX(event),cZ=Event.pointerY(event);if($('BodyContainer').scrollHeight>cW.height){if(cW.width<=(ct-cO.left))return event.stop();}Event.observe(document,'mousemove',mousemove);Event.observe(document,'mouseup',mouseup);event.stop();var nodes=Listing.nodes(),position=[],size=0,length=0,lasso=$('lasso')?$('lasso'):new Element('div',{'id':'lasso','style':'display:none'});container.insert(lasso.setOpacity(0.2));lasso.setStyle({'width':'0px','height':'0px'});length=nodes.length;if(length>0&&nodes[0].elements[0]){size=nodes[0].elements[0].getDimensions();if(cwd.listView!=='Thumbs'){var n1=nodes[0].elements.last().nodeOffset();size.width=n1.left-container.nodeOffset().left+size.width;}while(length--){var n=nodes[length].elements[0];if(!position[n.nodeId]){position[n.nodeId]={};position[n.nodeId].left=n.nodeOffset().left-container.nodeOffset().left;position[n.nodeId].top=n.nodeOffset().top-container.nodeOffset().top;}}}function mousemove(event){var top=cZ,left=ct,width=Event.pointerX(event)-ct,height=Event.pointerY(event)-cZ;if(width<0){width= -width;left=Event.pointerX(event);}if(height<0){height= -height;top=Event.pointerY(event);}top=top-cO.top+cS.top;left=left-cO.left+cS.left;lasso.setStyle({'width':width+'px','height':height+'px','left':left+'px','top':top+'px'}).show();length=nodes.length;if(length>0){while(length--){var n=nodes[length].elements.first();if(n){var leftIn=left<(position[n.nodeId].left+size.width),rightIn=(left+width)>position[n.nodeId].left,topIn=top<(position[n.nodeId].top+size.height),bottomIn=(top+height)>position[n.nodeId].top;if(leftIn&&rightIn&&topIn&&bottomIn){if(selected[n.nodeId]!==true){Selection.aU(n.nodeId);selected[n.nodeId]=true;}}else{if(selected[n.nodeId]!==false){Selection.ax(n.nodeId);selected[n.nodeId]=false;}}}}}};function mouseup(event){Listing.nodeTipsEnabled=true;lasso.hide();update();Event.stopObserving(document,'mousemove',mousemove);Event.stopObserving(document,'mouseup',mouseup);}};function dR(nodeId,fD){if(!cwd.node[nodeId-1])return;if(fD.range&ab>0){if(!fD.multiple)bl();var cw=0;var dU=0;if(T>0){if(T>ab){cw=ab;dU=T;}else{cw=T;dU=ab;}for(i=cw;i<=dU;i++){if(cwd.node[i-1]){ax(i);selected[i]=false;}}}if(nodeId>ab){cw=ab;dU=nodeId;}else{cw=nodeId;dU=ab;}for(i=cw;i<=dU;i++){if(cwd.node[i-1]){aU(i);selected[i]=true;}}T=nodeId;}else if(fD.multiple||(checkBox==nodeId)){if(selected[nodeId]){ax(nodeId);selected[nodeId]=false;ab=0;}else{aU(nodeId);selected[nodeId]=true;ab=nodeId;}T=0;}else{bl();selected[nodeId]=true;ab=nodeId;T=0;aU(nodeId);}fG();if(!fD.delayUpdate)update();return true;};function update(cl){if(cwd.error){$('info_details').update();clearTasks();return;}var dP=new Array;cwd.node.each(function(node,i){if(!node)return;var nodeId=i+1;if(selected[nodeId])return dP.push(nodeId);});if(!cl)cl= !selection||dP.toString()!=selection.toString();if(cl){executeDelayed();if(onChangeCode)onChangeCode();selection=dP;Action.close(true);}er(cl);eo();};function executeDelayed(eY,eE){if(bo)clearTimeout(bo);bY=eY;bo=eY?setTimeout("Selection.ga()",eE):null;};function er(cl){var name,desc,dZ,info;var details=$("info_details");var items=selection.length;if(cl){details.update();$('info_right_text').update();}if(items>=1){var node=cwd.node[selection[0]-1];name=node[cwd.columns[0].param];desc=node.desc;info=node.details}else{info=cwd.details;}if(info&&cl){var content=typeof(info)=='object'?Jemplate.process(info.temp,info.vars):info;cY=typeof(info)=='object'?info.vars:null;if(items>1){var gp=new Element('div').update(content.stripScripts()).select('.all_nodes');if(gp.length>0){gp.each(function(node){details.insert(node)});content.evalScripts();}}else{details.insert(content.stripScripts());content.evalScripts();}}new Tips('#info_details *[title]',{position:'left'});};function eo(){var M=Menu.buildActions(Menu.actionsFor({targets:selection,menu:'tasks'}),selection);if(M.length==0){$("info_tasks").update(Locale['noTasks']);}else{$("info_tasks").update('');M.each(function(action){var attr={title:action.alt},el,a;if(action.href)attr.href=action.href;a=new Element('a',attr).insert(new Element('img',{src:'/Assets/Default/Images/x.gif','class':'icon tasks '+action.icon,width:'22',height:'17'})).insert(action.label);el=new Element('div').insert(a);if(!attr.href){a.observe('click',function(event){event.stop();return eval(action.code);});}$("info_tasks").insert(el);});}new Tips('#info_left a[title]',{position:'right'});av();};function bl(){for(i=0;i<selected.length;i++){if(selected[i]){ax(i);selected[i]=false;}}};function fG(){dV=false;checkBox=false;};function aU(nodeId){var node=$('node_'+nodeId);if(!node)return;if(cwd.listView=='Thumbs'){$("file_name_"+nodeId).className='file_name_selected';$("icon_frame_"+nodeId).className='icon_frame_selected';}else{if(cwd.columns){node.addClassName('node_details_selected');cwd.columns.each(function(col){var element=$('node_'+nodeId+'_'+col.param);if(element)element.addClassName('node_details_selected');});}}if(!dT.eu()&&checkBox!=nodeId){$("check_box_"+nodeId).checked=true;}if($$('.node_details_selected').length!==0)$('BodyContainer').addClassName('selection');};function ax(nodeId){var node=$('node_'+nodeId);if(!node)return;if(cwd.listView=='Thumbs'){$("file_name_"+nodeId).className='';$("icon_frame_"+nodeId).className='icon_frame';}else{if(cwd.columns){node.removeClassName('node_details_selected');cwd.columns.each(function(col){var element=$('node_'+nodeId+'_'+col.param);if(element)element.removeClassName('node_details_selected');});}}if(checkBox!=nodeId){$("check_box_"+nodeId).checked=false;}if($$('.node_details_selected').length===0)$('BodyContainer').removeClassName('selection');}};
 var dn=0;var g={mouseover:function(x){var e=this;if(!e.hasClassName('disabled')&& !e.hasClassName('search')){e.addClassName('hover');}},mouseout:function(x){var e=this;if(!e.hasClassName('disabled')&& !e.hasClassName('search')){e.removeClassName('hover');if(!e.hasClassName('selected')&& !e.hasClassName('mouse_over_menu')){e.removeClassName('click');}}},mousedown:function(x){var e=this;if(!e.hasClassName('disabled')&& !e.hasClassName('search')&& !e.hasClassName('mouse_over_menu')){e.addClassName('click');}},mouseup:function(x){var e=this;if(!e.hasClassName('disabled')&& !e.hasClassName('search')&& !e.hasClassName('mouse_over_menu')){e.removeClassName('click');}},fb:function(x){x.addClassName('disabled');x.removeClassName('hover');x.removeClassName('click');x.addClassName('tipHide');},fU:function(x){x.removeClassName('disabled');x.removeClassName('tipHide');},select:function(x){x.addClassName('selected');x.addClassName('click');},gq:function(x){x.removeClassName('selected');x.removeClassName('click');},gr:function(event){clearTimeout(dn);li=$('view_filters');menu=$('view_filters_menu');var offset=li.positionedOffset();menu.setStyle({visibility:'visible',left:offset.left+'px',top:Math.round(offset.top+18)+'px'});li.removeClassName('hover');if(!li.hasClassName('click')){li.addClassName('click');li.addClassName('clicked');}Event.observe(menu,'click',g.fA);Event.observe(menu,'mouseover',g.gr);Event.observe(menu,'mouseleave',g.fA);},fA:function(event){li=$('view_filters');menu=$('view_filters_menu');menu.setStyle({visibility:'hidden'});if(li.hasClassName('clicked')){li.removeClassName('click');li.removeClassName('clicked');}}};function toolBarDisable(R){return g.fb($('tb_'+R));};function toolBarEnable(R,fd){return g.fU($('tb_'+R));};Event.observe(window,'load',function(){var gY=$('toolbar').childElements();gY.each(function(button){if(!button.hasClassName('spacer')&& !button.hasClassName('skip')){Event.observe(button,'mouseenter',g.mouseover);Event.observe(button,'mouseleave',g.mouseout);Event.observe(button,'mousedown',g.mousedown);Event.observe(button,'mouseup',g.mouseup);}if(button.hasClassName('mouse_over_menu')){Event.observe(button,'click',g.gr);Event.observe(button,'mouseleave',function(){dn=setTimeout("g.fA()",100);});}}.bind(this));});;
 var Tips=Class.create({initialize:function(selector,options){$$(selector).each(function(el){new Tip(el,options);});}});var Tip=Class.create({initialize:function(el,options){this.el=$(el);this.options={showDelay:500,hideDelay:0,hideOthers:true,classTip:'tooltip',classContent:'tip',position:'top',size:{width:null,height:null},offset:{top:0,right:0,bottom:0,left:0},ignoreTipClass:'tipHide',shown:false,loadShown:false};Object.extend(this.options,options||{});this.id=this.options.id?this.options.id:this.el.identify()+'_tip';if(!$(this.id)){this.content();}else{this.el.removeAttribute('title');}this.boundMouseover=this.mouseover.bind(this);this.boundMouseout=this.mouseout.bind(this);this.boundClick=this.click.bind(this);this.observe(this.el);if(this.options.loadShown){var eW=this.options.showDelay;this.options.showDelay=0;$(el).fire('tip:show');this.options.showDelay=eW;delete eW;}if(this.options.destroy!==true)$(el).tip=this;return this},update:function(content){if(this.tip)this.tip.down('.tip').update(content);return this},content:function(){if(this.options.tip_content){if(typeof this.options.tip_content==='function'){this.tip_content=this.options.tip_content();}else{this.tip_content=this.options.tip_content;}}if(this.options.tip_id){this.tip_content=$(this.options.tip_id).show();$(this.options.tip_id).remove();}if(this.el.readAttribute('title'))this.tip_content=this.el.readAttribute('title');this.el.removeAttribute('title');},ht:function(el){this.offset=el.viewportOffset();this.offset.right=document.viewport.getWidth()-(this.offset.left+el.getWidth());this.offset.bottom=document.viewport.getHeight()-(this.offset.top+el.getHeight());this.gy={top:{top:this.offset.top-this.tip.getHeight()+'px',left:this.offset.left+(el.getWidth()/2)-(this.tip.getWidth()/2)+'px'},right:{top:this.offset.top+(el.getHeight()/2)-(this.tip.getHeight()/2)+'px',left:this.offset.left+el.getWidth()+this.options.offset.left+'px'},bottom:{top:this.offset.top+el.getHeight()+this.options.offset.top+'px',left:this.offset.left+(el.getWidth()/2)-(this.tip.getWidth()/2)+'px'},left:{top:this.offset.top+(el.getHeight()/2)-(this.tip.getHeight()/2)+'px',right:this.offset.right+el.getWidth()+'px'}};this.canFit={top:(this.offset.top+this.tip.getHeight())<0,bottom:(this.offset.bottom-this.tip.getHeight())>0}},position:function(el){if(!this.canFit[this.options.position]){switch(this.options.position){case 'top':this.options.position='bottom';break;case 'bottom':this.options.position='top';break;}}var style=this.gy[this.options.position];el.addClassName(this.options.position);el.setStyle(style);},build:function(){if($(this.id)){this.tip=$(this.id);this.target=this.el;}else{this.tip=new Element('div',{id:this.id,className:this.options.classTip}).hide();if(this.options.classExtra)this.tip.addClassName(this.options.classExtra);this.tip.update(new Element('div',{id:this.id+'_content',className:this.options.classContent}).update(this.tip_content));this.target=$(this.options.target)||this.el;if(this.options.hideOthers)this.observe(this.tip);$('body').insert(this.tip);if(this.options.size.height){this.tip.setStyle({height:this.options.size.height+'px'});}if(this.options.size.width&&this.tip.getWidth()>this.options.size.width){this.tip.setStyle({width:this.options.size.width+'px'});}}},observe:function(el){el.observe("tip:close",this.boundMouseout);el.observe('mouseenter',this.boundMouseover);el.observe('mouseleave',this.boundMouseout);el.observe('tip:show',this.boundMouseover);},unobserve:function(){this.el.stopObserving('tip:close');this.el.stopObserving('mouseenter',this.boundMouseover);this.el.stopObserving('mouseleave',this.boundMouseout);this.el.stopObserving('tip:show');},gQ:function(){$$('.'+this.options.classTip+'.shown:not(#'+this.id+')').each(function(el){el.fire('tip:close');});},mouseover:function(event){Event.stop(event);this.over(event);},mouseout:function(event){Event.stop(event);this.out(event);},click:function(event){this.el.fire('tip:close');},over:function(event){Event.observe(document,'click',this.boundClick);event.stop();window.clearTimeout(this.hd);if(this.shown!=true){if(this.el.hasClassName(this.options.ignoreTipClass))return;if(this.options.hideOthers)this.gQ();var self=this;if(!this.target)this.build();this.ht(this.target);this.position(this.tip);if(this.tip){this.he=window.setTimeout(function(){self.shown=true;self.tip.show();self.tip.addClassName('shown');},this.options.showDelay);}}},out:function(event){Event.stopObserving(document,'click',this.boundClick);event.stop();window.clearTimeout(this.he);var self=this;if(this.tip){this.hd=window.setTimeout(function(){self.shown=false;self.tip.hide();self.tip.removeClassName('shown');if(self.options.destroy)self.destroy(self);},this.options.hideDelay);}},destroy:function(el){el.unobserve();if($(el.id))el.tip.remove();}}); ;
function gi(){var aR=0;var cs=false;var progress=false;var bA=false;var button=$('tb_upload');var advanced=false;var conflicts=false;var images=null;var download=false;var gE=$('simple_upload_target');if(gE)gE.observe('load',function(event){var error=cD(true);if(error&&cs)Upload.finish({error:error});});this.open=function(fD){download=false;if(Upload.fS()){if(fD&&fD.advanced=='dragdrop'&&bA.id=='simple_upload_progress'){Action.close();return true;}return;}if(!fD)fD={};return fD.advanced?this.gx(fD):this.gM(fD);};this.gM=function(fD){aR=0;conflicts=false;if(button.hasClassName('disabled')&& !fD.reopen)return;g.fb(button);fX({pane:'gP'});return true;};this.gx=function(fD){Applet.load({hidden:fD.advanced?true:false,onSuccess:function(applet){if(fD.advanced==='dragdrop')return Applet.show();if(applet)applet.openChooseFile();},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});Applet.hide();}});return true;};this.addFile=function(){var dJ=$("file_"+aR);if(dJ){var gO=dJ.value;if($('simple_upload_form').getInputs('file').any(function(input){return(input==dJ||input.value!=gO)?false:true;})){alert(Locale['uploadAlreadyAdded']);dJ.remove();}else{dJ.stopObserving('change').removeClassName('add_file').addClassName('list_file').hide();var fileName=gO.replace(/.*\\/,'').replace(/.*\//,'');var del=new Element('img',{src:'/Assets/Default/Images/Icons/Tiny/Delete.gif',className:'delete'});del.observe('click',Upload.gN);var li=new Element('li',{id:'display_upload_'+aR}).insert('<span>'+fileName+'</span>').insert(del);li.aR=aR;$('simple_upload_files').insert({top:li});$('simple_upload_must_choose_file').hide();}}aR++;input=new Element('input',{'id':'file_'+aR,name:'file_'+aR,type:'file',className:'add_file'}).setStyle({opacity:0}).observe('change',Upload.addFile);$('add_file').insert({bottom:input})};this.gN=function(){var img=this;var li=img.up();var dJ=$('file_'+li.aR);li.remove();dJ.remove()};this.start=function(fD){if(!fD)fD={};advanced=fD.advanced;download=fD.download;cs=fY();progress=false;images=null;var started=advanced?Upload.gj(fD):Upload.gB(fD);if(!started){cs=false;return;}g.fb(button);if(advanced!='dragdrop'){Applet.hide();fX({pane:'progress'});}else{Action.close();Upload.gm();aX();setTimeout("Upload.status()",1000);}};this.gB=function(fD){if(conflicts)return Upload.hz(fD);var form=$('simple_upload_form');var ho=form.getInputs('file');if(!ho.any(function(dJ){return dJ.value})){$('simple_upload_must_choose_file').addClassName('error').show();return;}var param={to:cwd.id};ho.each(function(dJ){if(!dJ.value)return;param[dJ.name]=dJ.value;});new Ajax.Request('/Pages/Upload?checkFiles=1',{method:'post',parameters:param,onSuccess:function(transport){var aK=transport.responseText.evalJSON();conflicts=aK.conflicts;return Upload.start(fD);},onFailure:function(response){Upload.finish({error:d(response,{j:Locale.requestError})})}});return;};this.hz=function(fD){if(fD.doForAll){conflicts.findAll(function(c){return!c.hu}).each(function(c){c.hu=fD.doForAll});}else{var hf=conflicts.find(function(c){return!c.hu});if(hf){cs=false;Action.hx({conflictDst:hf.data,onReplace:function(hy){hf.hu='overwrite';if(hy.doForAll)fD.doForAll='overwrite';Upload.start(fD);},onSkip:function(hy){hf.hu='skip';if(hy.doForAll)fD.doForAll='skip';Upload.start(fD);},onRename:function(hy){hf.hu='rename';if(hy.doForAll)fD.doForAll='rename';Upload.start(fD);},onCancel:function(){Upload.cancel();}});return false;}}conflicts.findAll(function(c){return c.hu=='skip'}).each(function(c){$("file_"+c.index).remove();});var form=$('simple_upload_form');var ho=form.getInputs('file');if(!ho.any(function(dJ){return dJ.value}))return;var action=form.action+cs+'&to='+cwd.id;conflicts.findAll(function(c){return c.hu=='overwrite'}).each(function(c){action=action+'&overwrite_'+c.index+'=1';});conflicts=false;form.action=action;form.submit();return true;};this.advancedConflicts=function(fD){conflicts=[fD];Action.hx({conflictDst:fD,onReplace:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?2:1);},onSkip:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?6:5);},onRename:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?4:3);},onCancel:function(){if(!conflicts)return;Upload.cancel();}});};this.gj=function(fD){conflicts=false;return true;};this.finish=function(fD){cs=false;bA.id=='simple_upload_progress'&& !conflicts?Action.close():Applet.fR();g.fU(button);if(fD.goTo)return listDirectory(fD.goTo);if(fD.error)Action.r(Locale[download?'downloadFailed':'uploadFailed']+':<br /><br />'+fD.error);Listing.removeInfo($('info_upload_complete'));Listing.removeInfo($('info_download_complete'));if(download){addDownloadCompleteInfo(fD);}else if(fD.to&&fD.to.id==cwd.id){refreshDir({onComplete:function(){addUploadCompleteInfo(fD);}});}else if(fD.to){addUploadCompleteInfo(fD);}};addUploadCompleteInfo=function(fD){if(!fD.fileIds|| !fD.fileIds.size())return;var Z=fD.fileIds.size();trackEvent("Uploads","Upload","",Z);var selected=fD.to&&fD.to.id==cwd.id?Selection.gD(fD.fileIds):[];if(clientProductName)Listing.removeInfo($('info_install_client'));Listing.addInfo(Jemplate.process('FileManager/Info/UploadComplete.htm',{uploadedFiles:Z,selectedFiles:selected.size(),uploadedTo:fD.to,cwd:cwd,fileName:selected&&selected[0]?selected[0].data.name:'',clientProductName:clientProductName,siteName:siteName}));};addDownloadCompleteInfo=function(fD){if(fD.fileFailed){var failed='',msg='';fD.fileFailed.each(function(x,i){failed+='<li>'+x+'</li>';});msg+='<h3>'+Locale['downloadPartialFailed'].title+'</h3>';msg+='<p>'+Locale['downloadPartialFailed'].message+'</p>';msg+='<div id="downloadPartialFailed"><ul>'+failed+'</ul></div>';return Action.r(msg,null,null,500);}if(clientProductName)Listing.removeInfo($('info_install_client'));Listing.addInfo(Jemplate.process('FileManager/Info/DownloadComplete.htm'));};this.cancel=function(){Upload.finish({});advanced?Applet.af().stopTransfers():$('simple_upload_target').src='/Pages/Upload?page=Hidden';};this.setScaling=function(scaling){if(!advanced)return;Upload.setScalingLabel(scaling);try{Applet.af().setScaling(scaling);}catch(e){};};this.gm=function(){if(cs){bA=$('info_upload_progress');Applet.fw({download:download});aX(progress);}else{g.fU(button);}};this.status=function(){if(!cs)return;if(advanced){var status;var applet;try{applet=Applet.af();var gH=new String(download?applet.getJSONDownloadStatus():applet.getJSONUploadStatus());var aK=gH.evalJSON();status=aK[0];}catch(e){};if(!download){try{if(images==null)images=applet.includesImages();if(images)status.scaling=applet.getScaling();}catch(e){};}aX(status);setTimeout("Upload.status()",1000);return;}var cP=cD();if(!cs)return;if(cP)return Upload.finish({error:cP});new Ajax.Request('/__upload_status',{method:'get',parameters:{client_up_sess:cs,rand:Math.random()},onSuccess:function(transport){var aK=transport.responseText.evalJSON();aX(aK);},onComplete:function(transport){if(!cs)return;setTimeout("Upload.status()",1000);}});};this.fS=function(){return cs?true:false;};this.fp=function(){return download;};function fX(fD){var page=download?'DownloadProgress':'SimpleStart';Action.Dialog('/Pages/Upload/'+page,{width:470,onComplete:function(){switch(fD.pane){case 'gP':var form=$('simple_upload_form');if(!form)return;Upload.addFile();form.observe('submit',Upload.start);break;case 'progress':var gP=$("simple_upload_choose");if(gP)gP.hide();bA=$('simple_upload_progress').show();aX();setTimeout("Upload.status()",1000);break;}Action.sizeDialog();},onClose:function(){if(conflicts)return;Upload.gm();},restore:fD.pane=='progress'?true:false});};function aX(fD){if(!fD)fD={done:0};var msg;if(fD.done){msg=fD.done==fD.total?Locale[download?'compingDownload':'compingUpload']:Locale['uploadProgress'];}else{msg= !advanced&&progress.total?Locale[download?'compingDownload':'compingUpload']:Locale[download?'startDownload':'startUpload'];}progress=fD;var progressBar=bA.down('.upload_progress_bar');var statusText=bA.down('.upload_progress_text');fD.displayDone=al(fD.done);if(fD.total){fD.displayTotal=al(fD.total);fD.fj=Math.round((fD.done/fD.total)*100);if(fD.fj>100)fD.fj=100;}else{fD.fj=0;}progressBar.setStyle({width:fD.fj+'%'});var speed=fD.done/(fD.nowtime-fD.starttime);if(speed)fD.displaySpeed=al(speed,{gc:'bits'});var temp=new Template(msg);var text=temp.evaluate(fD);if(fD.done!=fD.total&&fD.current&&fD.fileDone&&fD.fileTotal){fD.fileRemaining=fD.fileTotal-fD.fileDone;fD.displayCurrent=fD.current.truncate(20);temp=new Template(Locale[download?'downloadProgressFiles':'uploadProgressFiles']);statusText.update(temp.evaluate(fD)).insert(new Element('span').update(text)).addClassName('detailed');}else{statusText.removeClassName('detailed').update(text);}if(typeof(fD.scaling)!='undefined'){var eF=bA.down('.scale_images');if(!eF)return;var scaling=eF.show().down('input');scaling.checked=fD.scaling;Upload.setScalingLabel(scaling.checked);}if(bA.id=='simple_upload_progress')Action.sizeDialog();};this.setScalingLabel=function(scalingCheck){if(scalingCheck){$('scalingLabel').show();$('notScalingLabel').hide();}else{$('scalingLabel').hide();$('notScalingLabel').show();}};function cD(complete){var error;var iframe=frames['simple_upload_target'];try{if(iframe&&iframe.document){var dh=iframe.document.getElementById('uploadEndJS');if(dh){if(dh.innerHTML){var js=dh.innerHTML;dh.innerHTML='';eval(js);}}else if(complete){error=iframe.document.title;}}}catch(fl){error=Locale.connectError;};return error;};function fY(){var hw=Math.random()+"";return hw.replace(/[^\d]/,"");}} ;
function aH(number,X){X=(!X?2:X);return Math.round(number*Math.pow(10,X))/Math.pow(10,X);};function al(size,fD){var gc=fD&&fD.gc?fD.gc:'bytes';if(gc=='bits')size=size*8;if(size<500)return aH(size)+' '+Locale[gc];size=aH(size/1024);if(size<500)return size+' '+Locale['kilo'+gc];size=aH(size/1024);if(size<1024)return size+' '+Locale['mega'+gc];size=aH(size/1024);return size+' '+Locale['giga'+gc];};function windowSize(){var bs=0,bg=0;if(navigator.vendor&&navigator.vendor.indexOf('Apple')> -1&&self.innerHeight){bs=self.innerWidth;bg=self.innerHeight;}else if(!window.opera&&document.documentElement&&document.documentElement.clientHeight){bs=document.documentElement.clientWidth;bg=document.documentElement.clientHeight;}else if(document.body){bs=document.body.clientWidth;bg=document.body.clientHeight;}return{width:bs,height:bg};};function bv(elem,eL){if(typeof(elem.pageYOffset)=='number'){if(eL&&eL.left)elem.pageXOffset=eL.left;if(eL&&eL.top)elem.pageYOffset=eL.top;return{left:elem.pageXOffset,top:elem.pageYOffset};}else{if(eL&&eL.left)elem.scrollLeft=eL.left;if(eL&&eL.top)elem.scrollTop=eL.top;return{left:elem.scrollLeft,top:elem.scrollTop};}};function dw(viewport,element,fD){var eJ=bv(viewport);var bB=new Array(eJ.left,eJ.left+viewport.getWidth(),eJ.top,eJ.top+viewport.getHeight());if(fD&&fD.paddingLeft)bB[1]-=fD.paddingLeft;if(fD&&fD.paddingTop)bB[3]-=fD.paddingTop;var ck=element.positionedOffset();var fT=new Object;if(ck.left<bB[0])fT.left=eJ.left-(bB[0]-ck.left+10);else if(ck.left>bB[1])fT.left=eJ.left+(ck.left-bB[1]);if(ck.top<bB[2])fT.top=eJ.top-(bB[2]-ck.top+10);else if(ck.top>bB[3])fT.top=eJ.top+(ck.top-bB[3]);return bv(viewport,fT);};function getSID(){var sid=$('body').readAttribute('sid');if(sid)return sid;return false;};var cy=new Array;function popupWindow(bf,aD,cz,bz,Address){var Window;if(aD){aD=',height='+aD;}if(cz){cz=',width='+cz;}if(bz){bz=',scrollbars=yes';}else{bz=',scrollbars=no';}if(!Address){Address='/Pages/'+bf;}Address+=(Address.include('?')?'&':'?')+'_brand_id='+brandId;bf=bf.gsub('-','_');if(cy[bf]&& !cy[bf].closed&&cy[bf].location){Window=cy[bf];Window.location.href=Address;}else{Window=window.open(Address,bf,'resizable=yes,status=yes'+aD+cz+bz);if(!Window.opener)Window.opener=self;}if(window.focus)Window.focus();return;};function SetMessage(Message,Error,Element){Element=Element||"message";var bX=document.getElementById(Element);if(Error){bX.style.color='red';}else{bX.style.color='';}bX.innerHTML=Message;bX.style.display='block';};function fa(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}return null;};function disableSelection(){if(Prototype.Browser.IE){document.onselect=function(){return false};}else{document.onmousedown=function(x){var x=Event.element(x);if(!x.match('input')&& !x.match('textarea'))return false;};}};function d(response,message){if(!message.eM)message.eM=Locale.connectError;if(!message.j)message.j=response.statusText;var eq= !response.status||response.status>=600;return eq?message.eM:message.j+' ('+response.status+')';};if(typeof(console)==='undefined'){console={'log':function(){},'profile':function(){},'profileEnd':function(){}};} ;
var cwd={},clickUser,clickAuth,cC=0;var gA=Prototype.ScriptFragment;Prototype.ScriptFragment='<script[^>]*>(('+gA+'|[\\S\\s])*?)<\/script>';Ajax.currentRequests={};Ajax.Responders.register({onCreate:function(request){cC++;if(request.options.onlyLatestOfClass&&Ajax.currentRequests[request.options.onlyLatestOfClass]){try{var gS=Ajax.currentRequests[request.options.onlyLatestOfClass];gS.respondToReadyState=Prototype.emptyFunction;gS.transport.abort();}catch(e){}}Ajax.currentRequests[request.options.onlyLatestOfClass]=request;request.success=function(){var status=this.getStatus();if(status){return status>=200&&status<300;}else{return request.responseText;}};request.url+=(request.url.include('?')?'&':'?')+'_brand_id='+brandId;},onComplete:function(request){cC--;if(request.options.onlyLatestOfClass){Ajax.currentRequests[request.options.onlyLatestOfClass]=null;}}});Event.observe(document,'selectstart',function(event){var element=Event.element(event);if(element.tagName!='INPUT'&&element.tagName!='TEXTAREA')Event.stop(event);});Event.observe(window,'dragdrop',function(event){Event.stop(event);alert(Locale['dragDropWindow']);});window.onbeforeunload=function(){var fz=Upload?Upload.fS():false;var fy=Applet?Applet.fy():0;var gG=new Array;if(fz)gG.push(Locale[Upload.fp()?'downloadWarn':'uploadWarn']);if(fy&&fy.size()){var gk=[Locale.openFilesWarn,''];fy.each(function(fileName){gk.push('\t'+fileName);});gG.push(gk.join('\n'));};if(gG.size()<1)return;var returnValue=gG.join('\n\n');return returnValue;};var Listing,Selection,Menu,Loading,dT,Action,Upload,Applet,navTree;function startHumyo(cU,cA){clickUser=cU;clickAuth=cA;$('JSRequired').remove();if(!getUriFrom(window))window.location.hash='/home';Listing=new dO;Selection=new dB;Menu=new ef;Loading=new dN;dT=new eA;Action=new ej;Upload=new gi;Applet=new gh;if($('OrganiseTree')){navTree=new FolderTree('OrganiseTreeList',{onNodeSelected:function(x){window.location.hash=x.memo.data.uri;Event.stop(x.memo.event);},onData:function(x){if(x.memo.B.id=='OrganiseTreeList')$('info_header_link_tree').update(x.memo.data.name);CopyMoveTree.populateNode(x.memo.data);},onContextMenu:function(event){var node=Event.findElement(event,'li');navTree.cp(node);},containerOnly:true,columns:''});Listing.addListener(navTree);Listing.addListener(CopyMoveTree);}var gL=$('search_query');gL.value=Locale.searchTip;gL.observe('focus',function(event){if(gL.value==Locale.searchTip)gL.value='';});if(!((BrowserDetect.ap=='Explorer'&&BrowserDetect.version>=7)||(BrowserDetect.ap=='Firefox'&&BrowserDetect.version>=1.5)||(BrowserDetect.ap=='Safari'&&BrowserDetect.version>=3)||(BrowserDetect.ap=='Opera'&&BrowserDetect.version>=9)||(BrowserDetect.ap=='Chrome'))||(BrowserDetect.OS=='Mac'&&BrowserDetect.ap=='Firefox')){$('BrowserUnsupported').show();if(BrowserDetect.ap=='Explorer'&&BrowserDetect.version==6){$('ie6issues').show();}else if(BrowserDetect.ap=='Firefox'&&BrowserDetect.OS=='Mac'){$('firefoxmacissues').show();$$('#firefoxlogo, #ielogo').invoke('hide');};return;}document.fire('humyo:started');};function listDirectory(dir,v){if(!dir)return;if(!v)v={};if(!dir.startsWith('/'))dir='/'+dir;var hg=(cwd.uri||0)==dir;if(!hg|| !v.invisible){Listing.clear(hg);var cN=v.cN||1500;var dr=v.dr||Locale['loading'];var dI=$('body').getHeight()/2;Loading.show({obj:$('BodyContainer'),y:dI,eE:cN,label:dr});}var J=v.cgiParams||new Object;J._session_id=getSID()||'';if(clickUser)J.clickUser=clickUser;if(clickAuth)J.clickAuth=clickAuth;['orderBy','orderDirection','listView','page'].each(function(aF){if(v[aF]){J[aF]=v[aF];}else if(hg){J[aF]=cwd[aF];}});new Ajax.Request('/Pages/ListDir'+dir,{onlyLatestOfClass:'listDir',parameters:J,onFailure:function(response){Loading.hide();var msg=d(response,{j:Locale.listDirError});$('BodyContainer').innerHTML='<div><h2 style="text-align: center;">'+msg+'</h2></div>';},onSuccess:function(transport){var responseText=transport.responseText;if(!responseText)return;cwd=responseText.evalJSON(true);for(var i=0,len=cwd.node.length;i<len;i++){var nodeUri=cwd.node[i].uri;if(nodeUri&& !nodeUri.startsWith('/'))cwd.node[i].uri=cwd.uri?cwd.uri+nodeUri:null;}document.title=siteName+' - '+cwd.name.unescapeHTML();$('historyshim').contentWindow.document.title=document.title;ec(cwd);Loading.hide();if(v.gD){Selection.gD(v.gD);}else{Selection.clear();}if(v.invisible)Listing.clear(hg);Listing.build(J.listView);if(!hg){Listing.cB();if(cwd.info)Listing.addInfo(cwd.info);}if(navTree){var gU=eT(cwd);if(gU==navTree.aZ()){navTree.populateNode(cwd);navTree.selectNode(cwd);}else{navTree.initTree(gU,{populateNode:cwd,selectNode:cwd});}}if(v.onComplete)v.onComplete();}});};function getUriFrom(win){var hash=win.location.hash.substring(1);if(BrowserDetect.ap==='Firefox'){var path=hash.split('/');var encoded=path.collect(function(p){return encodeURIComponent(p)});return encoded.join('/');}return hash;};function eT(data){if(!data.filters)return data.treeRoot;var selected=cwd.filters.find(function(f){return f.selected});return selected?selected.tree:data.treeRoot;};function goPage(page){if(page<1)return;if(!cwd.listMore&&page>cwd.pages)page=1;listDirectory(cwd.uri,{page:page});};function refreshDir(fD){if(!fD)fD={};var current=getUriFrom(window);if(fD.fK&&decodeURIComponent(fD.fK)!=decodeURIComponent(current))return;if(!fD.gD)fD.gD=Selection.selectedIds().map(function(i){return cwd.node[i-1].id});var eJ=bv($('BodyContainer'));if(!fD.onComplete)fD.onComplete=function(){bv($('BodyContainer'),eJ);};listDirectory(current,fD);};function goToOrRefresh(dir,fD){if(!dir.startsWith('/'))dir='/'+dir;var hash=getUriFrom(window);if(decodeURIComponent(hash)===decodeURIComponent(dir))refreshDir(fD);return window.location.hash=dir;};function upDir(){if(cwd.parent&&cwd.parent!=0)window.location.hash=cwd.parent;};function orderBy(ed){var direction;if(cwd.orderBy){direction='Asc';if(cwd.orderBy==ed&&cwd.orderDirection=='Asc'){direction='Desc';}}else{direction='Desc';if(cwd.orderBy==ed&&cwd.orderDirection=='Desc'){direction='Asc';}}listDirectory(cwd.uri,{orderBy:ed,orderDirection:direction,page:1,gD:Selection.selectedIds().map(function(i){return cwd.node[i-1].id})});};function goSearch(form){if(!cwd.searchId)return;var cgiParams=form?form.serialize(true):{};var searchId=(cgiParams.id||cwd.searchId);if(!cgiParams.q){var q=$('search_query');if(q&&q.value!=''&&q.value!=Locale.searchTip)cgiParams.q=q.value;}if(!cgiParams.q||cgiParams.q.blank())return;listDirectory(searchId,{cgiParams:cgiParams,dr:Locale.searching});};function ec(data){var HTML='';if(data.path){var start=data.filters&&eT(data)==cwd.path[0].id?1:0;for(var index=start,len=data.path.length;index<len;++index){var node=cwd.path[index];HTML=HTML+'<a href="#'+node.uri+'">'+node.name+'</a>';if(index!=len-1)HTML=HTML+' / ';}}$('address').innerHTML=HTML;};function ignoreEvent(event){event=event||window.event;var target=Event.element(event);if(target.tagName=='INPUT'||target.tagName=='TEXTAREA')return;event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;};function clearTasks(){$("info_tasks").update(Locale['noTasks']);av();};function nothingHappening(){return cC==0?true:false;};function trackEvent(fc,action,label,value){try{pageTracker._trackEvent(fc,action,label,value);}catch(e){};} ;
(function(){function showAuthPopup(){alert(Locale.sessionTimeoutWarn);};function notifyAndReload(){showAuthPopup();window.location='/login?redirect='+encodeURI(window.location);};var ajaxAuth={onCreate:function(req,response){var terminateAjax=function(){Ajax.Request.Events._each(function(it){req.options['on'+it]=function(){};});req.options.onFailure=function(){};};['403','300','301','302','303','304','305','307']._each(function(k){var old=req.options['on'+k];if(old){req.options['on'+k]=function(response){terminateAjax();notifyAndReload();return old(response);};}else{req.options['on'+k]=function(response){terminateAjax();return notifyAndReload();};}});}};Ajax.Responders.register(ajaxAuth);return;})(); ;
