var VarUtils;function PictureBarFile(b,e,d,h,i,g,j,f,c,l,a,k){this.source=b;this.uniqueId=e;
this.id=e;this.name=d;this.length=h;this.lastModified=i;this.width=g;this.height=j;
this.mimeType=f;this.url=PictureBarFile.fixUrl(c);this.rotation=l!==undefined?l:null;
this.exifDate=a!==undefined?a:"";this.transformations=new Object();this.transformations.width=g;
this.transformations.height=j;this.transformations.imageOperation=k!==undefined?k:"";
if(this.transformations.imageOperation!=""){}}PictureBarFile.jordanPort=null;PictureBarFile.fixUrl=function(a){var b;
if(!a){return a}if(!PictureBarFile.jordanPort&&a.indexOf("http://localhost:")!=0){return a.replace(/localhost/,"127.0.0.1")
}if(!PictureBarFile.jordanPort||(a.indexOf("http://localhost:")!=0&&a.indexOf("http://127.0.0.1:")!=0)){return a
}b=a.replace(/http:\/\/(localhost|127\.0\.0\.1):[0-9]+/,"http://127.0.0.1:"+PictureBarFile.jordanPort);
if(b!=a){jade.Log.debug("Corrected picture bar url "+a+" to "+b)}return b};PictureBarFile.prototype.isReady=function(){return PictureBarFile.jordanPort!==null
};PictureBarFile.prototype.getUrl=function(){this.url=PictureBarFile.fixUrl(this.url);
return this.url};PictureBarFile.prototype.getTransformedUrl=function(){var a,b=this.getUrl();
if(!this.isIPSPicture()){return b}if(this.transformations&&this.transformations.imageOperation){a=this.transformations.imageOperation
}else{a=null}return b+"/%WIDTH%x%HEIGHT%"+(a?"@"+a:"")};PictureBarFile.prototype.isIPSPicture=function(){var a=this.getUrl();
if(a.indexOf("showPicture.do")!=-1||a.indexOf("localhost:")!=-1||a.indexOf("127.0.0.1:")!=-1){return true
}return false};PictureBarFile.prototype.canEdit=function(){return this.isIPSPicture()
};PictureBarFile.getFullUrl=function(b,c,a){var b=this.getUrl();if(!this.isIPSPicture()){return b
}return b+"/"+c+"x"+a};PictureBarFile.prototype.applyTransformations=function(d){var f,b,c,e=null,a=null;
this.transformations.imageOperation=d!=null?d:"";this.rotation=0;f=this.transformations.imageOperation.split("&");
for(c=0;c<f.length;++c){b=f[c].match(/rotation=(\d+)/);if(null!=b){this.rotation=parseInt(b[1])
}b=f[c].match(/filter=crop,left=(\d+),top=(\d+),width=(\d+),height=(\d+)/);if(null!=b){e=b[3];
a=b[4]}}switch(this.rotation){case 0:case 180:this.width=e!=null?e:this.transformations.width;
this.height=a!=null?a:this.transformations.height;break;case 90:case 270:this.width=a!=null?a:this.transformations.height;
this.height=e!=null?e:this.transformations.width;break;default:break}};PictureBarFile.SOURCE_PICTURE=0;
PictureBarFile.SOURCE_LOCAL=1;PictureBarFile.SOURCE_REMOTE=2;PictureBarFile.CLIENT_COPY=3;
PictureBarFile.unserialize=function(data){var defs,pair,i,max,file;file=new PictureBarFile(PictureBarFile.SOURCE_LOCAL);
defs=data.split("|");for(i=0,max=defs.length;i<max;i++){pair=defs[i].split("=");if(pair[0]=="width"||pair[0]=="height"){eval("file."+pair[0]+"=parseInt(decodeURIComponent('"+pair[1]+"'))")
}else{eval("file."+pair[0]+"=decodeURIComponent('"+pair[1].replace(/\+/g,"%20")+"')")
}}file.uniqueId=file.id;file.rotation=0;if(data.transformations==null){file.transformations=new Object();
file.transformations.width=file.width;file.transformations.height=file.height;file.transformations.imageOperation=""
}return file};PictureBarFile.fromJSONObject=function(c){var b,a;b=new PictureBarFile();
if(c.transformations==null){c.transformations=new Object()}if(c.transformations.width==null){c.transformations.width=c.width
}if(c.transformations.height==null){c.transformations.height=c.height}if(c.transformations.imageOperation==null){c.transformations.imageOperation=""
}for(a in c){b[a]=c[a];if(a=="width"||a=="height"){b[a]=parseInt(b[a])}if(a=="name"){b[a]=decodeURIComponent(b[a].replace(/\+/g,"%20"))
}}if(b.source===undefined){b.source=PictureBarFile.SOURCE_LOCAL}b.uniqueId=b.source+":"+b.id;
return b};PictureBarFile.createFiles=function(data,pbFileMimeTypeWhiteList){var files,i,max,items,pbFile;
if(pbFileMimeTypeWhiteList!==null&&pbFileMimeTypeWhiteList!=""){pbFileMimeTypeWhiteList=pbFileMimeTypeWhiteList.split(",");
if(pbFileMimeTypeWhiteList.length==0){pbFileMimeTypeWhiteList=false}}else{pbFileMimeTypeWhiteList=false
}files=[];if(data.length>0){if((data.charAt(0)=="[")||(data.charAt(0)=="{")){items=eval("{var_="+data+"}");
for(i=0,max=items.length;i<max;i++){pbFile=PictureBarFile.fromJSONObject(items[i]);
if(!pbFileMimeTypeWhiteList||jade.ArrayUtils.inArray(pbFileMimeTypeWhiteList,pbFile.mimeType)){files.push(pbFile)
}}}else{items=data.split(",");for(i=0,max=items.length;i<max;i++){pbFile=PictureBarFile.unserialize(items[i]);
if(!pbFileMimeTypeWhiteList||jade.ArrayUtils.inArray(pbFileMimeTypeWhiteList,pbFile.mimeType)){files.push(pbFile)
}}}}return files};PictureBarFile.createFilesFromObject=function(b){var d,c,a;d=[];
for(c=0,a=b.length;c<a;c++){d.push(PictureBarFile.fromJSONObject(b[c]))}return d};
PictureBarFile.prototype.serialize=function(){return VarUtils.serialize(this)};PictureBarFile.prototype.exportData=function(){return'{ "type": "PictureBarFile", "jsonClass": "PictureBarFile", "source": "'+this.source+'", "id": "'+this.id+'", "name": "'+this.name+'", "length": '+this.length+', "lastModified": '+this.lastModified+', "width": '+this.width+', "height": '+this.height+', "mimeType": "'+this.mimeType+'", "url": "'+this.getUrl()+'", "rotation": '+this.rotation+', "exifDate": "'+this.exifDate+'", "transformations": { "width": "'+this.transformations.width+'", "height": "'+this.transformations.height+'", "imageOperation": "'+this.transformations.imageOperation+'" } }'
};PictureBarFile.prototype.getWidth=function(){return this.width};PictureBarFile.prototype.getHeight=function(){return this.height
};var HTMLUtils,ThumbnailUtils;function PictureBarModule(a,d,b){var e,c;this.name=a;
this.pictureBar=d;this.treeElement=b;e="pictureBarListModule-"+this.name;this.listElement=document.getElementById(e);
this.infoMessages=[];this.selectCount=0;this.picturesToLoad=0;if(!this.listElement){throw new Error("HTML element '"+e+"' not found")
}this.button=this.findButton();this.content=this.findContent();this.insertPoint=HTMLUtils.getElementByClassName(this.listElement,"insertPoint");
e="pbPictureTemplate-"+this.name;c=document.getElementById(e);if(!c){throw new Error("Picture template with id '"+e+"' not found")
}this.pictureTemplate=c.cloneNode(true);this.pictureTemplate.id=null;this.foldersElement=document.getElementById("pbFolders-"+this.name);
this.infoMessages=HTMLUtils.getElementsByClassName(document.getElementById("pictureBarListModule-"+this.name),"pbInfoMessage");
this.ItemManager(this.listElement);this.onChange=this.handleChange;this.onDblClick=this.handleDblClick;
this.ctrlLock=true;PictureBarModule.instance={};PictureBarModule.instance[this.name]=this
}VarUtils.inherit(PictureBarModule,ItemManager);PictureBarModule.prototype.handleChange=function(a){this.pictureBar.selectHandler(this.getSelectionCount())
};PictureBarModule.prototype.handleDblClick=function(a,b){if(this.pictureBar.sendPictureOnDblClick){this.pictureBar.onSend(this.pictureBar,[b.file])
}};PictureBarModule.prototype.createDragElement=function(b){var c,a;c=document.getElementById("pbDragElement").cloneNode(true);
a=c.getElementsByTagName("img")[0];a.src=b.src;a.width=b.width;a.height=b.height;
return c};PictureBarModule.prototype.start=function(){this.multipleSelection=this.pictureBar.multipleSelection;
this.ItemManager_start();this.synchronize();this.initEvents()};PictureBarModule.prototype.ItemManager_start=ItemManager.prototype.start;
PictureBarModule.prototype.initEvents=function(){this.button.control=this;this.button.onclick=this.handleButtonClick;
this.onDrop=this.pictureBar.onDrop;this.onDragStart=this.pictureBar.onDragStart;this.onDragStop=this.pictureBar.onDragStop;
this.onDragEnter=this.pictureBar.onDragEnter;this.onDragLeave=this.pictureBar.onDragLeave
};PictureBarModule.prototype.ready=function(){if(this.pictureBar.onModuleReady){this.pictureBar.onModuleReady(this)
}};PictureBarModule.prototype.handleButtonClick=function(a){if(this.control){return this.control.handleButtonClick(a?a:window.event)
}this.pictureBar.activateModule(this);return false};PictureBarModule.prototype.getButtonHeight=function(){return this.button.offsetHeight
};PictureBarModule.prototype.findButton=function(){var a;a=HTMLUtils.getElementsByClassName(this.treeElement,"button");
if(a.length!=1){throw new Error("Module needs 1 element with class 'button' but found "+a.length)
}return a[0]};PictureBarModule.prototype.findContent=function(){var a;a=HTMLUtils.getElementsByClassName(this.treeElement,"content");
if(a.length!=1){throw new Error("Module needs 1 element with class 'content' but found "+a.length)
}return a[0]};PictureBarModule.prototype.init=function(){jade.Log.debug("Initializing picture bar module "+this.name);
if(HTMLUtils.hasClassName(this.treeElement,"activeModule")){this.activate();return true
}else{this.deactivate();return false}};PictureBarModule.prototype.activate=function(){new jade.Ajax("noop.do?pbActiveModule="+this.name).send();
this.content.style.height=this.pictureBar.getMaxTreeContentHeight()+"px";HTMLUtils.replaceClassName(this.treeElement,"inactiveModule","activeModule");
HTMLUtils.replaceClassName(this.listElement,"inactiveModule","activeModule");this.pictureBar.selectHandler(this.selectCount);
if(this.pictureBar.thumbnailPixelSize){this.resizeThumbnails(this.pictureBar.thumbnailPixelSize,false)
}else{this.fixCanvasSize()}};PictureBarModule.prototype.deactivate=function(){this.content.style.height="1px";
HTMLUtils.replaceClassName(this.treeElement,"activeModule","inactiveModule");HTMLUtils.replaceClassName(this.listElement,"activeModule","inactiveModule")
};PictureBarModule.isValidElement=function(a){return HTMLUtils.hasClassName(a,"module")
};PictureBarModule.prototype.addFile=function(a){this.addItem(this.createFileElement(a))
};PictureBarModule.prototype.createFileElement=function(e){var f,d,b,c,h,a;h=e.width;
a=e.height;c=this.pictureBar.thumbnailSize;if(this.pictureBar.thumbnailPixelSize){b=this.pictureBar.thumbnailPixelSize
}else{b=c}f=jade.ThumbnailUtils.getThumbnailData(h,a,b.width,b.height,e.rotation);
d=this.pictureTemplate.cloneNode(true);this.disableItem(d);d.className="selectable";
d.style.width=Math.floor(f.width)+"px";d.style.height=Math.floor(f.height)+"px";d.style.marginTop=Math.floor(f.top+1)+"px";
d.style.marginBottom=Math.floor(f.bottom+1)+"px";d.style.marginLeft=Math.floor(f.left+1)+"px";
d.style.marginRight=Math.floor(f.right+1)+"px";d.title=e.name+" ("+h+"x"+a+")";d.control=this;
d.file=e;var g=PictureBar.getPictureSrc(e,c.width,c.height);d.onerror=function(){jade.Log.debug("onerror "+this.src+", aborting image...");
this.style.display="none";if(--this.control.picturesToLoad==0){this.control.pictureBar.onAllPicturesLoaded()
}};d.onabort=function(){jade.Log.debug("onabort "+this.src);this.style.display="none";
if(--this.control.picturesToLoad==0){this.control.pictureBar.onAllPicturesLoaded()
}};d.onload=function(){this.control.enableItem(this);if(--this.control.picturesToLoad==0){this.control.pictureBar.onAllPicturesLoaded()
}};d.src=g;return d};PictureBarModule.prototype.addFiles=function(c){var b,a,d;d=[];
for(b=0,a=c.length;b<a;b++){d.push(this.createFileElement(c[b]))}this.addItems(d)
};PictureBarModule.prototype.setPictures=function(b){var a;this.clearItems();this.picturesToLoad=b.length;
a=document.getElementById("pbNoPictures-"+this.name);if(a){a.style.display=b.length>0?"none":"block"
}b.sort(this.comparePicture);this.addFiles(b);this.pictureBar.selectHandler(0)};PictureBarModule.prototype.addSliceFiles=function(b){var a;
noPictures=document.getElementById("pbNoPictures-"+this.name);if(noPictures){noPictures.style.display=b.length>0?"none":"block"
}for(a=0;a<b.length;++a){this.addFiles(b[a])}};PictureBarModule.prototype.setPicturesStart=function(c,b,a){this.pictureBar.onDirectoryScanStart();
this.clearItems();this.currentListSession=new Object();this.currentListSession.id=c;
this.currentListSession.files=b;this.currentListSession.slices=a;this.currentListSession.nextSlice=0;
this.currentListSession.bufferedSlices=new Array();this.picturesToLoad=0};PictureBarModule.prototype.setPicturesSlice=function(g,f,b,e){jade.Log.debug(g+" slice = "+(f+1)+" of "+b);
var d,c,a;if((""+g)!=(""+this.currentListSession.id)){return}if(f!=this.currentListSession.nextSlice){d=new Object();
d.index=f;d.files=e;this.currentListSession.bufferedSlices.push(d);jade.Log.debug("buffered slice %d, expected slice %d",(f+1),this.currentListSession.nextSlice);
return}this.addFiles(e);this.currentListSession.nextSlice++;jade.Log.debug("added "+e.length+" files from jordan");
for(c=0;c<this.currentListSession.bufferedSlices.length;++c){if(this.currentListSession.bufferedSlices[c].id==f){this.addFiles(this.currentListSession.bufferedSlices[c].files);
this.currentListSession.nextSlice++;jade.Log.debug("added "+this.currentListSession.bufferedSlices[c].files.length+" buffered files from jordan");
this.currentListSession.bufferedSlices.splice(c,1);c=0}}this.pictureBar.selectHandler(0);
if(this.currentListSession.nextSlice==this.currentListSession.slices){a=this.getItems().length;
this.picturesToLoad+=a;if(this.picturesToLoad==0){this.pictureBar.onAllPicturesLoaded()
}this.pictureBar.onDirectoryScanEnd();if(a==0){this.displayInfoMessage("pbNoPictures-local")
}}};PictureBarModule.prototype.synchronize=function(){var d,a,c,b,e;b=this.getItems();
for(d=0,a=b.length;d<a;d++){if(pbServerFiles[this.name][d]!==undefined){e=b[d];e.file=pbServerFiles[this.name][d]
}}this.selectedFolder=null;if(this.foldersElement){c=HTMLUtils.getElementsByClassName(this.foldersElement,"pbFolderLink");
for(d=0,a=c.length;d<a;d++){c[d].control=this;c[d].onclick=this.handleFolderSelect;
if(HTMLUtils.hasClassName(c[d],"selected")){this.selectedFolder=c[d]}}}};PictureBarModule.prototype.handleFolderSelect=function(b,a){if(this.control){return this.control.handleFolderSelect(b?b:window.event,this)
}if(PictureBarModule.instance[this.name]){return false}if(this.selectedFolder){HTMLUtils.removeClassName(this.selectedFolder,"selected")
}this.clearItems();this.displayInfoMessage("pbModuleChange-myPhotos");HTMLUtils.addClassName(a,"selected");
this.selectedFolder=a;PictureBarModule.instance[this.name]=this;window.setTimeout("PictureBarModule.instance."+this.name+".handleFolderSelect2('"+a.href+"')",150);
return false};PictureBarModule.prototype.handleFolderSelect2=function(b){var f,e,d,a;
f=b.substring(b.indexOf("?")+1);e=new jade.Ajax("pbFolderContent.do?"+f);try{a=e.request()
}catch(c){this.displayInfoMessage("pbModuleChangeError-myPhotos");PictureBarModule.instance[this.name]=null;
return false}d=PictureBarFile.createFilesFromObject(VarUtils.unserialize(a));this.displayInfoMessage("");
this.setPictures(d);PictureBarModule.instance[this.name]=null};PictureBarModule.prototype.resizeThumbnails=function(j,e){var d,g,b,c,f,h;
if(e===undefined){e=false}f=this.getItems();for(d=0,g=f.length;d<g;d++){h=f[d];b=h.file;
if(b!==undefined){c=jade.ThumbnailUtils.getThumbnailData(b.width,b.height,j.width,j.height,b.rotation);
if(!e){var a=PictureBar.getPictureSrc(b,j.width,j.height);jade.Log.debug("resizeThumbnails "+a);
h.src=a}h.style.width=Math.floor(c.width)+"px";h.style.height=Math.floor(c.height)+"px";
h.style.marginTop=Math.floor(c.top+1)+"px";h.style.marginBottom=Math.floor(c.bottom+1)+"px";
h.style.marginLeft=Math.floor(c.left+1)+"px";h.style.marginRight=Math.floor(c.right+1)+"px"
}}this.fixCanvasSize()};PictureBarModule.prototype.reloadThumbnails=function(d){var c,a,b,e;
b=this.getItems();for(c=0,a=b.length;c<a;c++){e=b[c];var f=PictureBar.getPictureSrc(e.file,d.width,d.height);
jade.Log.debug("reloadThumbnails "+f);e.src=f}};PictureBarModule.prototype.comparePicture=function(f,e){var d,c,g;
d=this.pictureBar.thumbnailOrder;if(d%2){c=f.file===undefined?f:f.file;g=e.file===undefined?e:e.file
}else{c=e.file===undefined?e:e.file;g=f.file===undefined?f:f.file}switch(this.pictureBar.thumbnailOrder){case 0:case 1:return c.lastModified-g.lastModified;
case 2:case 3:if(c.name==g.name){return 0}if(c.name.toLowerCase()==g.name.toLowerCase()){return(c.name<g.name?-1:1)
}return(c.name.toLowerCase()<g.name.toLowerCase()?-1:1);case 6:case 7:if(c.exifDate<g.exifDate){return -1
}else{if(c.exifDate>g.exifDate){return 1}}return 0;case 8:case 9:if(c.length<g.length){return -1
}else{if(c.length>g.length){return 1}}return 0;default:return c.width*c.height-g.width*g.height
}};PictureBarModule.prototype.sort=function(){var c,a,b,d;b=this.getItems();b.sort(this.comparePicture);
for(c=0,a=b.length;c<a;c++){d=b[c];d.parentNode.removeChild(d);this.getCanvas().insertBefore(d,this.insertPoint)
}this.scanItems()};PictureBarModule.prototype.getSendFiles=function(){var c,a,b;if(this.getSelectionCount()){b=this.getSelection()
}else{b=this.getItems()}a=[];for(c in b){if(!b[c].disabled){a.push(b[c].file)}}return a
};PictureBarModule.prototype.displayInfoMessage=function(c){var b,a;for(b=0,a=this.infoMessages.length;
b<a;b++){this.infoMessages[b].style.display=this.infoMessages[b].id==c?"block":"none"
}};function PictureBarModuleFactory(){}PictureBarModuleFactory.modules=new Object();
PictureBarModuleFactory.register=function(a,b){PictureBarModuleFactory.modules[a]=b
};PictureBarModuleFactory.createModule=function(a,c,b){var d;d=PictureBarModuleFactory.modules[a];
if(!d){throw new Error("No module with name '"+a+"' found")}return new d(a,c,b)};
var PictureBarFile,HTMLUtils,pbHTMLClientFiles;function PictureBarLocalModule(a,c,b){this.PictureBarModule(a,c,b);
this.onProgress=null;this.onFinished=null;this.onAborted=null;this.onStartError=null;
this.onCanceled=null;this.onBackup=null;this.onRestore=null;PictureBarLocalModule.instance=this
}VarUtils.inherit(PictureBarLocalModule,PictureBarModule);PictureBarModuleFactory.register("local",PictureBarLocalModule);
PictureBarLocalModule.jordanLoaded=false;PictureBarLocalModule.jordanId=null;PictureBarLocalModule.prototype.start=function(){if(this.pictureBar.client=="java"||this.pictureBar.client=="activex"){jade.Log.debug("Waiting for Jordan to come up...");
this.connect()}else{PictureBarFile.jordanPort=0;this.ready()}this.PictureBarModule_start();
if(this.onRestore){backup=VarUtils.serialize(this.onBackup());document.getElementById("pbBackup").value=backup
}};PictureBarLocalModule.prototype.PictureBarModule_start=PictureBarModule.prototype.start;
PictureBarLocalModule.prototype.initEvents=function(){var a;a=document.getElementById("pbUploadForm");
if(a){a.control=this;a.onsubmit=this.handleUpload}this.PictureBarModule_initEvents()
};PictureBarLocalModule.prototype.PictureBarModule_initEvents=PictureBarModule.prototype.initEvents;
PictureBarLocalModule.eolasWorkaround=function(a){document.write(a)};PictureBarLocalModule.eolasWorkaroundForLazyLoading=function(b,a){b.innerHTML=a
};PictureBarLocalModule.prototype.connect=function(b){if(!PictureBarLocalModule.jordanLoaded){window.setTimeout("PictureBarLocalModule.instance.connect()",150);
return}jade.Log.debug("Jordan says it's ready. Trying to connect...");if(PictureBarLocalModule.jordan){this.jordan=PictureBarLocalModule.jordan
}else{this.jordan=document.getElementById("pictureBarJordan")}try{var a=this.jordan.run();
jade.Log.debug("jordan.run() result is "+a)}catch(c){if(b===undefined){b=1}else{b++
}if(b<2){jade.Log.debug("Not able to call run() method of jordan applet. Trying this again...");
window.setTimeout("PictureBarLocalModule.instance.connect("+b+")",150);return}this.handleJordanStartError(this.jordanId,"Not able to call run() method of jordan applet. Looks like applet was not successfully loaded.");
throw new Error("Not able to call run() method of jordan applet. Looks like applet was not successfully loaded.")
}if(window.jordan&&jordan.Picture){jordan.Picture.setJordanPort(this.jordan.getThumbnailServerPort())
}this.displayInfoMessage("pbNoPictures-local");this.refreshThumbnails();jade.Log.debug("Connected to Jordan");
PictureBarLocalModule.resetFocus();this.ready()};PictureBarLocalModule.prototype.uploadFiles=function(b,a){jade.Log.debug("Telling Jordan to upload files: "+b);
var c=this.jordan.uploadFiles(b,a);if(typeof c=="string"&&c){jade.Log.debug("Jordan.uploadFiles delivered error, reason: "+c);
handleJordanUploadAborted(this.jordan.getAppletId(),c)}};PictureBarLocalModule.prototype.refreshThumbnails=function(){var c,g,e,b,d,a,f;
a=this.jordan.getThumbnailServerPort();PictureBarFile.jordanPort=a;jade.Log.debug("Refreshing thumbnails with server port "+a);
c=document.getElementsByTagName("img");f=false;for(e=0,b=c.length;e<b;e++){g=c[e];
d=g.src;if(d.indexOf("http://localhost:")===0||d.indexOf("http://127.0.0.1:")===0){if(!f&&this.getItems().length>0){this.displayInfoMessage("");
f=true}g.src=d.replace(/http:\/\/(localhost|127\.0\.0\.1):[0-9]+/,"http://127.0.0.1:"+a);
jade.Log.debug("reloaded "+g.src)}}if(this.pictureBar.onThumbnailRefresh){this.pictureBar.onThumbnailRefresh(a)
}};PictureBarLocalModule.handleJordanLoad=function(b,a){jade.Log.debug("Jordan has finished loading");
PictureBarLocalModule.jordanLoaded=true;jade.Log.debug("Jordan instance: "+a);PictureBarLocalModule.jordan=a;
if(PictureBarLocalModule.jordanId&&PictureBarLocalModule.jordanId!=b){jade.Log.debug("overwriting already set jordanId: "+PictureBarLocalModule.jordanId+" -> "+b)
}PictureBarLocalModule.jordanId=b;PictureBarLocalModule.resetFocus()};PictureBarLocalModule.prototype.handleJordanChange=function(c,a){var b;
this.displayInfoMessage("");a=String(a);b=PictureBarFile.createFiles(a,this.pictureBar.pbFileMimeTypeWhiteList);
this.setPictures(b);jade.Log.debug("handleJordanChange")};PictureBarLocalModule.prototype.handleJordanChangeStart=function(d,c,b,a){jade.Log.debug("handleJordanChangeStart");
jade.Log.debug("amountFiles: %s",b);if(b==0){this.displayInfoMessage("pbNoPictures-local")
}else{this.setPicturesStart(c,b,a)}};PictureBarLocalModule.prototype.handleJordanChangeSlice=function(f,e,d,a,c){var b;
jade.Log.debug("handleJordanChangeSlice");this.displayInfoMessage("");c=String(c);
b=PictureBarFile.createFiles(c,this.pictureBar.pbFileMimeTypeWhiteList);this.setPicturesSlice(e,d,a,b)
};PictureBarLocalModule.resumeDirChange=function(b){var a;a=document.getElementById("pictureBarJordan");
if(a.waitBeforeDirChange!==undefined&&a.waitBeforeDirChange!==null&&a.waitBeforeDirChange==1){jade.Log.debug("resumeDirChange");
a.resumeDirChange()}};PictureBarLocalModule.prototype.handleJordanBeforeChange=function(a){this.clearItems();
this.displayInfoMessage("pbModuleChange-local");jade.Log.debug("handleJordanBeforeChange");
if(this.pictureBar.client=="activex"){window.setTimeout("PictureBarLocalModule.resumeDirChange()",10)
}};PictureBarLocalModule.prototype.handleJordanUploadStart=function(c,a,b){a=parseInt(a);
b=parseInt(b);jade.Log.debug("upload start: files="+a+", totalBytes="+b);this.progressCurrentFileNo=0;
this.progressTotalFileNo=a;this.progressCurrentBytes=0;this.progressTotalBytes=b};
PictureBarLocalModule.prototype.handleJordanUploadFile=function(jordanId,fileData){var totalPercent;
fileData=String(fileData);this.progressCurrentFileNo++;if(fileData.charAt(0)=="{"){fileData=eval("{var_="+fileData+"}");
this.progressCurrentFile=PictureBarFile.fromJSONObject(fileData)}else{this.progressCurrentFile=PictureBarFile.unserialize(fileData)
}jade.Log.debug("upload start file: name="+this.progressCurrentFile.name);totalPercent=Math.round(100*this.progressCurrentBytes/this.progressTotalBytes);
if(this.onProgress){this.onProgress(this.pictureBar,this.progressCurrentFile,this.progressCurrentFileNo,this.progressTotalFileNo,0,totalPercent)
}};PictureBarLocalModule.prototype.handleJordanUploadProgress=function(e,b,d){var c,a;
b=parseInt(b);d=parseInt(d);jade.Log.debug("upload progress: currentFileBytes="+b+", currentBytes="+d);
this.progressCurrentBytes=d;if(this.onProgress){c=Math.round(100*b/this.progressCurrentFile.length);
a=Math.round(100*this.progressCurrentBytes/this.progressTotalBytes);this.onProgress(this.pictureBar,this.progressCurrentFile,this.progressCurrentFileNo,this.progressTotalFileNo,c,a)
}};PictureBarLocalModule.prototype.handleJordanUploadFinished=function(a){jade.Log.debug("Finished");
if(this.onFinished){this.onFinished(this.pictureBar)}};PictureBarLocalModule.prototype.handleJordanUploadCanceled=function(b,a){jade.Log.debug("Canceled");
if(this.onCanceled){this.onCanceled(this.pictureBar,a)}};PictureBarLocalModule.prototype.handleJordanUploadAborted=function(b,a){jade.Log.debug("Aborted");
if(this.onAborted){this.onAborted(this.pictureBar,a)}};PictureBarLocalModule.prototype.handleJordanStartError=function(b,a){jade.Log.debug("Start Error");
if(this.onStartError){this.onStartError(this.pictureBar,a)}};PictureBarLocalModule.prototype.activate=function(){var a;
this.PictureBarModule_activate();a=document.getElementById("pictureBarJordan");if(a){a.style.height=this.content.style.height;
if(window.Workarounds){Workarounds.maskElementIfNeeded(a)}}};PictureBarLocalModule.prototype.PictureBarModule_activate=PictureBarModule.prototype.activate;
PictureBarLocalModule.prototype.handleUpload=function(b){var a;if(this.control){return this.control.handleUpload(b?b:window.event)
}Buttons.disable("pbSendButton");this.clearItems();this.displayInfoMessage("pbHTMLUpload-local");
if(this.onBackup){a=VarUtils.serialize(this.onBackup());document.getElementById("pbBackup").value=a
}};PictureBarLocalModule.prototype.cancelUpload=function(){jade.Log.debug("Telling Jordan to cancel the upload...");
this.jordan.cancelUpload()};PictureBarLocalModule.resetFocus=function(){var a;a=document.getElementById("pictureBarJordan");
if(a){a.focus();window.focus()}};function PictureBarMyPhotosModule(a,c,b){this.PictureBarModule(a,c,b)
}VarUtils.inherit(PictureBarMyPhotosModule,PictureBarModule);PictureBarModuleFactory.register("myPhotos",PictureBarMyPhotosModule);
PictureBarMyPhotosModule.prototype.start=function(){this.PictureBarModule_start();
this.ready()};PictureBarMyPhotosModule.prototype.PictureBarModule_start=PictureBarModule.prototype.start;
function PictureBarPublicAlbumsModule(a,c,b){this.PictureBarModule(a,c,b)}VarUtils.inherit(PictureBarPublicAlbumsModule,PictureBarModule);
PictureBarModuleFactory.register("publicAlbums",PictureBarPublicAlbumsModule);PictureBarPublicAlbumsModule.prototype.start=function(){this.PictureBarModule_start();
this.ready()};PictureBarPublicAlbumsModule.prototype.PictureBarModule_start=PictureBarModule.prototype.start;
var PictureBarModuleFactory,PictureBarModule;function PictureBar(){this.thumbnailSizes=[{width:40,height:40}];
this.thumbnailSize=this.thumbnailSizes[0];this.thumbnailPixelSize=null;this.thumbnailOrder=0;
this.thumbnailSizeSliderSteps=0;this.multipleSelection=true;this.client="unknown";
this.sendPictureOnDblClick=true;this.element=document.getElementById("pictureBar");
if(!this.element){throw new Error("HTML element 'pictureBar' not found")}this.treeModulesElement=document.getElementById("pictureBarTreeModules");
if(!this.treeModulesElement){throw new Error("HTML element 'pictureBarTreeModules' not found")
}this.listModulesElement=document.getElementById("pictureBarListModules");if(!this.listModulesElement){throw new Error("HTML element 'pictureBarListModules' not found")
}this.sendFilesIfNoSelected="learning";this.pbFileMimeTypeWhiteList=null;this.onSend=null;
this.onSendStartSlice=null;this.onSendSlice=null;this.onLoad=null;this.onModuleReady=null;
this.onThumbnailRefresh=null;this.onSelect=null;this.directoryScanning=false;this.loadingPictures=false;
this.onDirectoryScanStart=this.handleDirectoryScanStart;this.onDirectoryScanEnd=this.handleDirectoryScanEnd;
this.onAllPicturesLoaded=this.handleAllPicturesLoaded;this.element.control=this;this.assimilateControls();
this.createModules();this.init()}PictureBar.prototype.setSendPictureOnDblClick=function(a){this.sendPictureOnDblClick=a
};PictureBar.prototype.setMultipleSelection=function(a){this.multipleSelection=a};
PictureBar.prototype.setClient=function(a){this.client=a};PictureBar.prototype.setThumbnailSizes=function(a){this.thumbnailSizes=a
};PictureBar.prototype.assimilateControls=function(){var a,b;a=document.getElementById("pbSelectionSetup");
if(a){b=document.getElementById("pbSelectionSetupTarget");if(!b){throw new Error("HTML element 'pbSelectionSetupTarget' not found")
}a.parentNode.removeChild(a);b.appendChild(a);a.style.display="block"}};PictureBar.prototype.start=function(){var b,a;
jade.Log.debug("Starting PictureBar");for(b=0,a=this.modules.length;b<a;b++){jade.Log.debug("Starting PictureBar module "+this.modules[b].name);
this.modules[b].start()}if(this.onLoad){this.onLoad(this)}};PictureBar.prototype.init=function(){var a;
jade.Log.debug("Initializing picture bar state");for(a in this.modules){if(this.modules[a].init()){jade.Log.debug("Using "+this.modules[a].name+" module as default active module");
this.activeModule=this.modules[a]}}};PictureBar.prototype.setDropTargets=function(c){var b,a;
for(b=0,a=this.modules.length;b<a;b++){this.modules[b].setDropTargets(c)}};PictureBar.prototype.activateModule=function(c){var b,a;
if(typeof(c)=="string"){for(b=0,a=this.modules.length;b<a;b++){if(this.modules[b].name==c){c=this.modules[b];
break}}if(typeof(c)=="string"){throw new Error("Can't find a module with the name:"+c)
}}if(this.activeModule==c){return}if(this.activeModule){this.activeModule.deactivate()
}c.activate();this.activeModule=c};PictureBar.prototype.getMaxTreeContentHeight=function(){var b,a;
a=this.treeModulesElement.offsetHeight;for(b in this.modules){a-=this.modules[b].getButtonHeight()
}return a};PictureBar.prototype.createModules=function(){var c,d,a,b;c=this.treeModulesElement.childNodes;
this.modules=[];for(b=0;b<c.length;b++){d=c[b];if(PictureBarModule.isValidElement(d)){a=d.id.split("-")[1];
this.modules.push(PictureBarModuleFactory.createModule(a,this,d))}}return true};PictureBar.prototype.send=function(b,a){if(b===undefined){b=false
}if(this.onSend){if(!this.activeModule.getSelectionCount()){if(this.loadingPictures){return false
}switch(this.sendFilesIfNoSelected){case"never":return false;case"learning":break
}}if(!b&&this.onBeforeSend){if(this.onBeforeSend(this,this.activeModule.getSendFiles())===false){return false
}}this.onSend(this,this.activeModule.getSendFiles(),null,a)}return false};PictureBar.prototype.sendStartSlice=function(b,a){if(b===undefined){b=false
}if(this.onSendStartSlice){jade.Log.debug("PictureBar.prototype.sendStartSlice");
this.onSendStartSlice(this,this.activeModule.getSendFiles(),null,a)}return false};
PictureBar.prototype.sendSlice=function(b,a){if(b===undefined){b=false}if(this.onSendSlice){jade.Log.debug("PictureBar.prototype.sendSlice");
this.onSendSlice(this,this.activeModule.getSendFiles(),null,a)}return false};PictureBar.prototype.select=function(a){this.activeModule.select(a)
};PictureBar.prototype.deselect=function(a){this.activeModule.deselect(a)};PictureBar.prototype.selectAll=function(){this.activeModule.selectAll()
};PictureBar.prototype.deselectAll=function(){this.activeModule.deselectAll()};PictureBar.prototype.toggleAll=function(){this.activeModule.toggleAll()
};PictureBar.prototype.updateSelectedPhotos=function(a){var b;b=document.getElementById("pbSelectedPhotos");
if(b){if(!a&&this.activeModule){b.innerHTML=this.activeModule.getItemsCount();HTMLUtils.addClassName(b,"all")
}else{b.innerHTML=a;HTMLUtils.removeClassName(b,"all")}}};PictureBar.prototype.getThumbnailSize=function(){var c,b,f,a,d,e;
if(this.thumbnailSizeSliderSteps>0){f=Math.max(this.thumbnailSizes[this.thumbnailSizes.length-1]["width"],this.thumbnailSizes[this.thumbnailSizes.length-1]["height"]);
a=Math.max(this.thumbnailSize.width,this.thumbnailSize.height);d=f/this.thumbnailSizeSliderSteps;
e=d;for(c=1,b=this.thumbnailSizeSliderSteps;c<=b;c++){if(e>=a){return c}e+=d}return 1
}else{return this.thumbnailSize}};PictureBar.prototype.setThumbnailSize=function(f,e){var g,d,c,h,b,j,a;
if(this.thumbnailSizeSliderSteps>0){g=[];d=Math.max(this.thumbnailSizes[this.thumbnailSizes.length-1]["width"],this.thumbnailSizes[this.thumbnailSizes.length-1]["height"]);
h=d/this.thumbnailSizeSliderSteps;c=h;for(b=0,j=this.thumbnailSizeSliderSteps;b<j;
b++){g.push({width:c,height:c});c+=h}if(e!==undefined&&!e){a=Math.min(this.thumbnailSizes.length,Math.ceil((f/(this.thumbnailSizeSliderSteps/this.thumbnailSizes.length))-1));
this.thumbnailSize=this.thumbnailSizes[a];this.thumbnailPixelSize=g[f-1];this.activeModule.reloadThumbnails(this.thumbnailSize)
}else{this.activeModule.resizeThumbnails(g[f-1],e)}}else{this.thumbnailSize=this.thumbnailSizes[f];
this.activeModule.resizeThumbnails(this.thumbnailSize,e)}};PictureBar.prototype.setThumbnailOrder=function(a){if(this.directoryScanning){return
}this.thumbnailOrder=a;this.activeModule.sort()};PictureBar.prototype.updateSelectAllLink=function(b){var a,c;
a=document.getElementById("pbLnkSelectAll");c=document.getElementById("pbLnkDeselectAll");
if(a&&c){a.style.display=b?"none":"block";c.style.display=b?"block":"none"}};PictureBar.prototype.selectHandler=function(a){this.updateSelectedPhotos(a);
if(this.activeModule){this.updateSelectAllLink(a>0&&this.activeModule.getItemsCount()==a)
}if(this.sendFilesIfNoSelected=="learning"&&a>0){this.sendFilesIfNoSelected="never"
}if(this.onSelect){this.onSelect(a)}};PictureBar.getPictureSrc=function(c,d,a,b){if(c.url.indexOf("showPicture.do")!=-1||c.url.indexOf("localhost:10")!=-1||c.url.indexOf("127.0.0.1:10")!=-1){b=b!==undefined?b:c.transformations.imageOperation;
return PictureBarFile.fixUrl(c.url)+"/"+d+"x"+a+(b?"@"+b:"")}return c.url};PictureBar.getPictureWidth=function(a){return a.width
};PictureBar.getPictureHeight=function(a){return a.height};PictureBar.prototype.reAdjustActiveModule=function(){if(this.activeModule){this.activeModule.activate();
this.activeModule.fixCanvasSize()}};PictureBar.prototype.setThumbnailSizeSliderSteps=function(a){this.thumbnailSizeSliderSteps=a
};PictureBar.prototype.setSendFilesIfNoSelected=function(a){if(a=="always"||a=="never"||a=="learning"){this.sendFilesIfNoSelected=a
}};PictureBar.prototype.getSelectionCount=function(){return this.activeModule.getSelectionCount()
};PictureBar.prototype.setPbFileMimeTypeWhiteList=function(a){this.pbFileMimeTypeWhiteList=a
};PictureBar.prototype.handleDirectoryScanStart=function(){this.directoryScanning=true;
this.loadingPictures=true;LnkStatus.changeStatus("pbSortContextButton","off");LnkStatus.changeStatus("pbSelectAllButton","off")
};PictureBar.prototype.handleDirectoryScanEnd=function(){this.directoryScanning=false;
LnkStatus.changeStatus("pbSortContextButton","");if(window.pbViewSizeSlider&&window.pbViewSizeSlider instanceof jade.compat.Slider){this.setThumbnailSize(window.pbViewSizeSlider.getValue(),true)
}};PictureBar.prototype.handleAllPicturesLoaded=function(){this.loadingPictures=false;
LnkStatus.changeStatus("pbSelectAllButton","")};