var Global;$("document").ready(function(){Global=new GlobalHandler()});$.ajaxSetup({cache:true});var g_isLoading=false;$(document).ajaxStart(function(){$("body").addClass("loading");g_isLoading=true;showLoading()});$(document).ajaxStop(function(){$("body").removeClass("loading");g_isLoading=false;hideLoading()});var GLOBALS={ArchiveId:null,ArchiveType:"",Columns:4,Rows:1,ThumbnailSize:170,Sorting:"ModifiedTimeAsc",Search:"",Preview:false,PreviewAccess:false,PostBackUrl:"",KeywordMetaFieldId:0};var CONFIG={SelectionSyncDelay:1250,HoverPreviewSize:450};function showLoading(){$(".loadingIndicator .background").css("opacity",0.2);$(".loadingIndicator").fadeIn(300)}function hideLoading(){window.setTimeout(function(){if(g_isLoading){return}$(".loadingIndicator").fadeOut(300)},500)}function GlobalHandler(){var f={show:150,hide:150};var C={show:300,hide:300};var K={show:300,hide:300};var x={show:100,hide:100};var a=10;var q=5;var t=TRANSLATIONS.Search;var z=false;var p;var c=false;var g=false;var A=170;var e=0;var G=CONFIG.HoverPreviewSize;function o(){if($("body.page-default").length){return}j();D();s();I();NavigationPaneControl.call($("#NavigationPaneControl")[0]);h();v();d();w();E();y()}function j(){GLOBALS.ArchiveId=parseInt(GLOBALS.ArchiveId);GLOBALS.Rows=parseInt(GLOBALS.Rows);GLOBALS.Columns=parseInt(GLOBALS.Columns);GLOBALS.ImagesPerPage=GLOBALS.Rows*GLOBALS.Columns;GLOBALS.PreviewAccess=parseInt(GLOBALS.PreviewAccess)}function D(){if(!$(".SelectableImage").length){return}$(".SelectableImage").each(function(){Thumbnail.call(this)})}function J(L){var N=4;var M=L/N;var O=window.location.toString();if(window.location.search.length){O=O.replace(/#/,"");if(O.match(/columns=/)){O=O.replace(/columns=\d*/,"columns="+N+"")}else{O=O+"&columns="+N+""}if(O.match(/rows=/)){O=O.replace(/rows=\d*/,"rows="+M)}else{O=O+"&rows="+M}}else{O=O+"?columns="+N+"&rows="+M}window.location=O}function k(L){var M=window.location.toString();if(window.location.search.length){M=M.replace(/#/,"");if(M.match(/sorting=/)){M=M.replace(/sorting=\w*/,"sorting="+L)}else{M=M+"&sorting="+L}}else{M=M+"?sorting="+L}window.location=M}function m(){if($.cookie("directPreview")==1){$("#directPreview").attr("checked","checked")}else{if($.cookie("directPreview")==0){$("#directPreview").removeAttr("checked")}else{$("#directPreview").attr("checked","checked")}}if($.cookie("extendedInfo")==1){$("#extendedInfo").attr("checked","checked")}else{$("#extendedInfo").removeAttr("checked")}if($.cookie("showRating")==1){$("#showRating").attr("checked","checked")}else{$("#showRating").removeAttr("checked")}$("#ImagesPerPage option").each(function(){if($(this).val()==GLOBALS.ImagesPerPage){$(this).attr("selected","selected")}});$("#ImageQuickSorter option").each(function(){if($(this).val()==GLOBALS.Sorting){$(this).attr("selected","selected")}})}function B(M){if($("#directPreview").attr("checked")){$.cookie("directPreview",1,{expires:30});$(".SelectableImage .Thumb img").tooltip({delay:200,track:true,showURL:false,bodyHandler:function(){var N=this.src.replace(/sz=\d*/,"sz="+G);return $("<img/>").attr("src",N)}})}else{$.cookie("directPreview",0,{expires:30});$(".SelectableImage img").unbind("mouseover").unbind("mouseout")}if($("#showRating").attr("checked")){$.cookie("showRating",1,{expires:30});if(M){$(".ThumbContainer .Rating").fadeIn(K.show)}else{$(".ThumbContainer .Rating").show()}}else{$.cookie("showRating",0,{expires:30});if(M){$(".ThumbContainer .Rating").fadeOut(K.hide)}else{$(".ThumbContainer .Rating").hide()}}var L=false;if($("#extendedInfo").attr("checked")){$.cookie("extendedInfo",1,{expires:30});L=true}else{$.cookie("extendedInfo",0,{expires:30});L=false}if(L&&e>100){if(M){$(".ThumbContainer .Info").fadeIn(C.show)}else{$(".ThumbContainer .Info").show()}}else{if(M){$(".ThumbContainer .Info").fadeOut(C.hide)}else{$(".ThumbContainer .Info").hide()}}if(c){J($("#ImagesPerPage").val())}if(g){k($("#ImageQuickSorter").val())}}function E(){if(!$("#LayoutSwitch").length){return}m();B(false);$("#LayoutSwitch").click(function(){if($(this).hasClass("Active")){n("revert")}else{b()}});$("#LayoutSwitch").add("#LayoutDropdown").click(function(L){L.stopPropagation()});$("#btnLayoutSave").click(function(){B(true);n()});$("#btnLayoutCancel").click(function(){n("revert")});$("#ImagesPerPage").change(function(){if($(this).val()!=GLOBALS.ImagesPerPage){c=true}else{c=false}});$("#ImageQuickSorter").change(function(){if($(this).val()!=GLOBALS.Sorting){g=true}else{g=false}});$("html").click(function(){n("revert")})}function b(){$("#LayoutSwitch").addClass("Active");$("#LayoutDropdown").slideDown(f.hide)}function n(L){$("#LayoutDropdown").slideUp(f.show,function(){$("#LayoutSwitch").removeClass("Active");if(L=="revert"){m()}})}function s(){if(!GLOBALS.PreviewAccess){H();return}e=$.cookie("ImageScale")?$.cookie("ImageScale"):A;i(e);$("#ImageScaleSlider").slider({value:e,min:100,max:450,step:70,stop:function(L,M){e=M.value;i(M.value);B(true)}})}function i(L){$(".SelectableImage").each(function(){this.resize(L)});$.cookie("ImageScale",L,{expires:30})}function H(){$(".SelectableImage").each(function(){var M=$(this).find("img")[0];var N=$(this).attr("id").replace(/\D/g,"");var L=this;e=GLOBALS.ThumbnailSize;M.onload=function(){$(this).fadeIn(300)};$(L).find(".ThumbContainer").width(e+"px");$(L).find(".Thumb").width(e+"px");$(L).find(".Thumb").height(e+"px");var O=$(M).attr("src");O="/fotoweb/fwbin/preview.dll?D="+GLOBALS.ImageInfos[N].thumbnailId;$(M).attr("src",O)})}function I(){$(".Panel").each(function(L){Panel.call(this,"Panel_"+L)})}function h(){if(!$("#ArchiveMenu").length){return}$.get("/fotoweb/cmdrequest/rest/ArchiveList.fwx",{rd:+new Date},function(L){var M=r(L);$(M).attr("id","ArchiveList");$("#ArchiveMenu").append(M);$("#ArchiveMenu").parent().addClass("multilvl-menu horizontal scrollable");MultiLvlMenu.call($("#ArchiveMenu").parent()[0]);$("#ArchiveMenu").find(".scroller").append('<div class="bottom"></div>');F()},"xml")}function r(N){var T=$(N).find("Archive");var P=document.createElement("ul");var U=new Array();var M;var S;var Q;var R;for(M=0;M<T.length;M++){Q=$(T[M]).attr("Id");S=document.createElement("li");$(S).attr("id","Archive_"+Q);R=document.createElement("a");$(R).attr("href","/fotoweb/Grid.fwx?archiveId="+Q+"&position=1&search=");$(R).text($(T[M]).attr("Name"));try{if(GLOBALS.ArchiveId==Q){$(R).addClass("isCurrent");GLOBALS.KeywordMetaFieldId=$(T[M]).attr("KeywordCloudField")}}catch(O){}$(S).append(R);$(P).append(S);U.push(S)}var L;for(M=0;M<U.length;M++){L=$(T[M]).attr("ParentId");if(L==0){continue}ParentNode=$(P).find("#Archive_"+L);CurrentNode=U[M];$(ParentNode).append(CurrentNode)}$(P).find("li:has(li)").each(function(){$(this).children("li").wrapAll("<ul/>")});$(P).find("a").wrap("<span/>");return P}function v(){if(!$("#TopMenuToolsList").length){return}$.get("/fotoweb/cmdrequest/rest/ToolsMenu.fwx",{rd:+new Date},function(L){$("#TopMenuToolsList").empty();$(L).find("ToolsMenu > MenuItem > MenuItem").each(function(){var M=$(this).attr("JavaScript")?$(this).attr("JavaScript"):$(this).attr("Url");$("#TopMenuToolsList").append("<li><span><a href='"+M+"'>"+$(this).attr("DisplayName")+"</a></span></li>")})},"xml")}function w(){if(!$("#TopMenuAdministrationList").length){return}$("#TopMenuAdministration").hide();$.get("/fotoweb/cmdrequest/rest/AdministrationMenu.fwx",{rd:+new Date},function(L){$("#TopMenuAdministrationList").empty();$(L).find("AdministrationMenu > MenuItem > MenuItem").each(function(){var M=$(this).attr("JavaScript")?$(this).attr("JavaScript"):$(this).attr("Url");$("#TopMenuAdministrationList").append("<li><span><a href='"+M+"'>"+$(this).attr("DisplayName")+"</a></span></li>")});if($("#TopMenuAdministrationList li").length){$("#TopMenuAdministration").show()}},"xml")}function d(){if(!$("#TopMenuViewList").length){return}var L=new Object();L.ts=+new Date;if(typeof GLOBALS!="undefined"){if(typeof GLOBALS.Preview!="undefined"&&GLOBALS.Preview){L.pm=1}if(typeof GLOBALS.ArchiveType!="undefined"&&GLOBALS.ArchiveType!=""){L.at=GLOBALS.ArchiveType}}$("#TopMenuViewList").empty();$.get("/fotoweb/cmdrequest/rest/ViewMenu.fwx",L,function(M){$(M).find("ViewMenu > MenuItem > MenuItem").each(function(){var N=$(this).attr("JavaScript")?$(this).attr("JavaScript"):$(this).attr("Url");$("#TopMenuViewList").append("<li><span><a href='"+N+"'>"+$(this).attr("DisplayName")+"</a></span></li>")})},"xml")}function y(){if(!$("#searchInputField").length){return}$("#searchInputField").addClass("searchInputField_Inactive");if(GLOBALS.Search==""){$("#searchInputField").val(t)}else{$("#searchInputField").val(GLOBALS.Search)}$("#MainFrameOpacityLayer").css("opacity",0);$("#searchInputField").focus(function(){$("#SearchPopUp").slideDown(x.show);if($(this).val()==t){$("#searchInputField").val("")}$("#searchInputField").addClass("searchInputField_Active");$("#searchInputField").removeClass("searchInputField_Inactive")});$("#SearchPopUp,#searchInputField,#SearchSubmit").click(function(){z=true});$("html").click(function(){if(z){z=false;return}if($("#searchInputField").val()==""){$("#searchInputField").val(t)}$("#searchInputField").addClass("searchInputField_Inactive");$("#searchInputField").removeClass("searchInputField_Active");$("#SearchPopUp").slideUp(x.hide)})}function F(){if(!$("#KeywordsPopUpTrigger")[0]){return}$("#KeywordsPopUpTrigger").hide();var L={ar:GLOBALS.ArchiveId,md:GLOBALS.KeywordMetaFieldId,cc:a,ic:q};$.get("/fotoweb/cmdrequest/rest/KeywordCloud.fwx",L,function(M){if($(M).find("KeywordCloud")){var N=u(M);l(N);$("#KeywordsPopUpTrigger").show()}},"xml");$("#KeywordsPopUpTrigger").click(function(){if(p){p.show()}return false})}function u(U){var P=$(U).find("Category");var T;var Q;var O;var L;var M="";var X=new Array();var S=null;for(T=0;T<a;T++){if(!P[T]){continue}S=$(P[T]).find("Value");for(Q=0;Q<q;Q++){if(!S[Q]){continue}L=S[Q];O=(a-T);M="/fotoweb/Grid.fwx?archiveId="+GLOBALS.ArchiveId+"&position=1&search="+$(L).attr("Value");X.push($('<a rel="'+O+'" href="'+M+'">'+$(L).attr("Value")+"</a>"))}}var R=X.length;var W;var V;for(T=0;T<R;T++){W=Math.floor(Math.random()*X.length)+1;V=X[W];X[W]=X[T];X[T]=V}var N=$("<div/>");$(X).each(function(){N.append(this).append("\n")});$(N).find("a").tagcloud({size:{start:1,end:2,unit:"em"},color:{start:"#999",end:"#333"}});return N}function l(L){p=new PopDiv("KeywordCloudPopUp");p.setCaption($("#KeywordsPopUpTrigger").text());p.setContent(L);p.setOverlaySpeed(200,200);p.setPopDivSpeed(200,200)}o()}function DownloadPopup(){var a;this.show=function(k,h,g){if(!a){this.create()}var d;var c=document.createElement("div");var l=document.createElement("div");$(l).addClass("downloadpopup-images");if(k.length==1){$(l).addClass("single")}for(d=0;d<k.length;d++){l.appendChild(k[d])}$(l).find("img").wrap('<div class="downloadpopup-image-container"><div><div></div></div></div>').addClass("downloadpopup-image");var j=document.createElement("div");$(j).addClass("downloadpopup-profile-container");var e=$(h).find("DirectDownloads ProcessingProfile");for(d=0;d<e.length;d++){var f=document.createElement("a");$(f).attr("href",g+"&pp="+encodeURIComponent($(e[d]).attr("Name")));$(f).attr("title",$(e[d]).attr("Description"));var b=$(e[d]).attr("DisplayName");$(f).text(b);$(f).addClass("downloadpopup-profile");j.appendChild(f)}c.appendChild(l);c.appendChild(j);a.setContent(c);a.show()};this.create=function(){a=new PopDiv("DownloadPopUp");a.setCaption(TRANSLATIONS.Download);a.setOverlaySpeed(200,200);a.setPopDivSpeed(200,200)}}function TopRowDropDown(b){var d=b;var a;var h;var g={up:150,down:150};function i(){$(d).find(".TopRowDropDownSwitch").click(function(){if($(this).hasClass("Active")){c()}else{f()}});$(d).find(".TopRowDropDownSwitch, .TopRowDropDown").click(function(){a=true});$("html").click(function(){if(a){a=false;return}c()})}function f(){$(d).find(".TopRowDropDownSwitch").addClass("Active").next(".TopRowDropDown").slideDown(g.down)}function c(){$(d).find(".TopRowDropDown").slideUp(g.up,function(){$(d).find(".TopRowDropDownSwitch").removeClass("Active")});if(h){h()}}function e(j){h=j}this.hide=c;this.setHideEvent=e;i()}function Panel(d){var i={show:200,hide:200};var p=false;var l=true;var f=false;var j=false;var m=false;var c=false;var o=false;var h=false;var g=false;var k=false;var b=false;var e=false;var a="";var n=this;this.construct=function(q){this.id=q;a=q+"_status_on_"+window.location.pathname.replace(/\//g,"");if($.cookie(a)){if($.cookie(a)=="open"){p=true}}else{if($(this).hasClass("OpenedPanel")){p=true}}$(this).find(".PanelHeader").click(function(){n.toggle()});this.update()};this.toggle=function(){if(p){this.hide()}else{this.show()}};this.show=function(){if(typeof f=="function"){b=f}if(typeof j=="function"){e=j}p=true;this.update()};this.hide=function(){if(typeof m=="function"){b=m}if(typeof c=="function"){e=c}p=false;this.update()};this.disable=function(){l=false;this.update()};this.activate=function(){if(typeof o=="function"){b=o}if(typeof h=="function"){e=h}l=true;this.update()};this.update=function(){if(l){if(typeof b=="function"){b()}b=false;if(typeof g=="function"){g()}$(this).removeClass("DisabledPanel")}else{$(this).addClass("DisabledPanel")}if(p&&l){$(this).addClass("OpenedPanel");$.cookie(a,"open",{expires:30});$(this).find(".InnerContainer").slideDown(i.show,function(){if(typeof e=="function"){e()}if(typeof k=="function"){k()}})}else{$.cookie(a,"closed",{expires:30});$(this).find(".InnerContainer").slideUp(i.hide,function(){$(this).closest(".Panel").removeClass("OpenedPanel");if(typeof e=="function"){e()}if(typeof k=="function"){k()}e=false})}};this.setPreShowEvent=function(q){f=q};this.setPostShowEvent=function(q){j=q};this.setPreActivateEvent=function(q){o=q};this.setPostActivateEvent=function(q){h=q};this.setPreHideEvent=function(q){m=q};this.setPostHideEvent=function(q){c=q};this.setPreUpdateEvent=function(q){g=q};this.setPostUpdateEvent=function(q){k=q};this.construct(d)}function Thumbnail(){this.foxtoken="";this.thumbnailId="";this.position=0;this.fckCheckbox=false;this.isMarked=false;this.previewUrl="";this.downloadId="";this.filename="";var c=false;var a=this;this.init=function(){this.position=this.id.replace(/\D/g,"");this.foxtoken=GLOBALS.ImageInfos[this.position].foxtoken;this.thumbnailId=GLOBALS.ImageInfos[this.position].thumbnailId;this.previewUrl=GLOBALS.ImageInfos[this.position].PreviewUrl;this.downloadId=GLOBALS.ImageInfos[this.position].downloadId;this.filename=GLOBALS.ImageInfos[this.position].filename;this.fckCheckbox=$("#fck"+this.position)[0];this.isMarked=this.fckCheckbox.checked;$(this).click(this.processClick);$(this).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});this.initRatings()};this.initRatings=function(){$(this).find(".Rating .submitrating").rating({callback:function(f){if(!f){return}var e=parseInt(this.parentNode.id.replace(/\D/g,""));$.get("/fotoweb/cmdrequest/FileAction.fwx?fwSetRating=1&rating="+parseInt(f)+"&f="+GLOBALS.ImageInfos[e].foxtoken)}});$(this).find(".Rating").css("visibility","visible");$(this).find(".rating-cancel").click(function(h){h.stopImmediatePropagation();var g=0;var f=parseInt(this.parentNode.parentNode.id.replace(/Rating/,""));$(this).rating("select");$.get("/fotoweb/cmdrequest/FileAction.fwx?fwSetRating=1&rating="+parseInt(g)+"&f="+GLOBALS.ImageInfos[f].foxtoken)});$(this).find(".Rating .submitrating").click(function(f){f.stopImmediatePropagation()})};this.processClick=function(g){var f=g.target;if($(f).hasClass("Download")){g.stopImmediatePropagation();$("#NavigationPaneControl")[0].processDownloadRequest.call(this)}else{if($(f).hasClass("Rating")){}else{if($(f).hasClass("Selection")){g.stopImmediatePropagation();this.toggle()}else{if($(f).hasClass("Zoom")){g.stopImmediatePropagation();this.goToPreview()}else{if($(f).hasClass("Thumbnail")&&GLOBALS.PreviewAccess){g.stopImmediatePropagation();this.goToPreview()}else{if($(f).hasClass("Priority")){g.stopImmediatePropagation();this.showPrioritySelector()}}}}}}};this.showPrioritySelector=function(){if(c){$(".PrioSelector:visible").not(c).trigger("hide");var f=$(c).find(":hidden").length?"show":"hide";$(c).trigger(f);return}$(".PrioSelector:visible").trigger("hide");$.ajax({url:"/fotoweb/cmdrequest/rest/ActionsMenu.fwx",data:{f:this.foxtoken,pm:1,at:GLOBALS.ArchiveType,ar:GLOBALS.ArchiveId,rd:+new Date()},success:function(e){c=b(e);if(!c){return}$(c).bind("show",function(){$(this).slideDown(300)});$(c).bind("hide",function(){$(this).slideUp(300)});$(document).click(function(){$(c).trigger("hide")});$(c).find("a").click(function(g){g.preventDefault();d(this)});$(c).hide();$(a).find(".ThumbContainer").append(c);$(c).trigger("show")},error:function(){}})};function d(e){$.ajax({url:$(e).attr("href"),success:function(){var f=$(e).attr("href").match(/priority=(\d)/);f=f&&f[1]?f[1]:"";var g=$(a).find(".Priority");$(g).removeClass();$(g).addClass("Priority Prio"+f);$(c).trigger("hide")}})}function b(f){var e=$(f).find("[Url*=fwSetPriority]");if(!$(e).length){return false}var i=$('<div class="PrioSelector"></div>');var g=$("<ul/>");var h=null;$(e).each(function(){h=$('<li><a href="'+$(this).attr("Url")+'"><span>'+$(this).attr("DisplayName")+"</span></a></li>");$(h).find("a").css("background-image","url("+$(this).attr("IconUrl")+")");$(h).click(function(j){j.stopImmediatePropagation()});$(g).append(h)});$(i).append(g);return i}this.goToPreview=function(){var e="/fotoweb/Preview.fwx?";e+="&position="+this.position;e+="&archiveType="+GLOBALS.ArchiveType;e+="&archiveId="+GLOBALS.ArchiveId;e+="&albumId="+GLOBALS.ArchiveId;e+="&sorting="+GLOBALS.Sorting;e+="&search="+GLOBALS.Search;e+="&fileId="+this.foxtoken;window.location=e};this.showZoom=function(){OpenCompingImageWindow("Zoom.fwx?position="+this.position+"&archiveId="+GLOBALS.ArchiveId+"&sorting="+GLOBALS.Sorting+"&columns="+GLOBALS.Columns+"&row="+GLOBALS.Rows+"&search="+GLOBALS.Search+"&fileId="+this.foxtoken+"&archiveType="+GLOBALS.ArchiveType,475,370)};this.toggle=function(){if(this.isMarked){this.unselect()}else{this.select()}};this.select=function(){if(!$("#NavigationPaneControl")[0].SelectionPanel){return}$("#NavigationPaneControl")[0].addToSelection(this,function(){a.fckCheckbox.checked=true;a.update()},"xml")};this.unselect=function(){if(!$("#NavigationPaneControl")[0].SelectionPanel){return}$("#NavigationPaneControl")[0].removeFromSelection(this,function(){a.fckCheckbox.checked=false;a.update()},"xml")};this.update=function(){if(this.fckCheckbox.checked){$(this).addClass("DocMtxSelectedCell");$(this).removeClass("DocMtxCell");this.isMarked=true}else{$(this).removeClass("DocMtxSelectedCell");$(this).addClass("DocMtxCell");this.isMarked=false}};this.resize=function(h){var e=$(this).find(".Thumb img")[0];var g=$(this).attr("id").replace(/\D/g,"");var f=this;var i="";if(window.location.search.match(/reload=1/)){i="&dp="+new Date().getTime()}e.onload=function(){$(this).fadeIn(300)};$(e).fadeOut(300,function(){$(f).find(".ThumbContainer").width(h+"px");$(f).find(".Thumb").width(h+"px");$(f).find(".Thumb").height(h+"px");var j=$(e).attr("src");j="/fotoweb/cmdrequest/rest/Preview.fwx?rt=1&f="+GLOBALS.ImageInfos[g].foxtoken+"&sz="+h+i;$(e).attr("src",j)})};this.init()}function NavigationPaneControl(){var q=this;var b=new DownloadPopup();var n=false;var o=false;var c=[];var m=[];this.updateSelectionRecallTimeoutIndicator=0;this.ActionPanel=$(q).find(".ActionsMenu")[0];this.SelectionPanel=$(q).find(".Selection")[0];this.StructurePanel=$(q).find(".Structure")[0];this.DataMiningPanel=$(q).find(".DataMining")[0];this.SizesPanel=$(q).find(".SizesMenu")[0];this.KeywordPanel=$(q).find(".KeywordMenu")[0];this.SearchtreePanel=$(q).find(".Searchtree")[0];this.construct=function(){h();$.asap(function(){if(!$(".Thumbnail").length){return true}var r=true;$(".Thumbnail").each(function(){if(!this.complete){r=false}});return r},function(){q.initSelection();g();d();e();i();j();a();q.initOutboxMenu()},{delay:500})};function j(){if(!q.SizesPanel){return}$(q.SizesPanel).hide();f();var s={ar:GLOBALS.ArchiveId};var r=function(u){showLoading();$("body").addClass("loading");var t=new Image();t.onload=function(){n.show();$("body").removeClass("loading");hideLoading()};t.src="/fotoweb/cmdrequest/rest/preview.fwx/"+GLOBALS.filename+"?rt=1&f="+GLOBALS.foxtoken+"&sz="+u;n.setCaption(TRANSLATIONS.PreviewSize+" - "+u);n.setContent(t)};$.get("/fotoweb/cmdrequest/rest/PreviewSizeList.fwx",s,function(t){var u=$(q.SizesPanel).find("ul").empty();$(t).find("PreviewSize").each(function(){var v=$(this).attr("Name");var w=$(this).attr("Size");var x=$('<li><a href="javascript:">'+v+" - "+w+"</a></li>");$(x).find("a").click(function(){r(w)});$(u).append(x)});$(q.SizesPanel).fadeIn(300)})}function f(){n=new PopDiv("PreviewSizePopUp");n.setOverlaySpeed(200,200);n.setPopDivSpeed(200,200)}this.initOutboxMenu=function(){if($("#OutboxMenuList").length){this.updateOutboxMenu()}};this.updateOutboxMenu=function(r){this.updateMenu("/fotoweb/cmdrequest/rest/outboxMenu.fwx","",$("#OutboxMenuList")[0],r)};this.updateMenu=function(r,t,s,u){$.get(r,t,function(w){$(s).empty();var v="";if($(w).find("FotoWebRest > *:first-child > MenuItem").length>1){v="FotoWebRest > *:first-child > MenuItem"}else{v="FotoWebRest > *:first-child > MenuItem > MenuItem"}$(w).find(v).each(function(){q.integrateIntoMenu(this,$(s))});$(s).closest(".multilvl-menu")[0].update();if(u){u()}},"xml")};this.integrateIntoMenu=function(x,v){var t=$(x).attr("DisplayName");var s=$(x).attr("Url");var r=$(x).attr("IconUrl");var A="";if(t=="---"){v.append("<li><div class='MenuSeperator'></div></li>");return}s=typeof s=="undefined"?"":s;var y=document.createElement("a");if(s.match(/DeleteFiles/i)&&GLOBALS.deleteReturnUrl){s=GLOBALS.deleteReturnUrl}if(!s.match(/SetRating/i)){$(y).text(t)}if(s.match(/download/i)){$(y).click(q.processDownloadRequest)}$(y).attr("href",s);$(y).css("background-image","url("+r+")");var u=document.createElement("div");$(u).addClass("submenu-indicator");y.appendChild(u);A=document.createElement("li");var z=document.createElement("span");z.appendChild(y);$(z).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});A.appendChild(z);if(x.hasChildNodes()){$(u).addClass("active");var w=document.createElement("ul");$(x).children("MenuItem").each(function(){q.integrateIntoMenu(this,w)});$(A).append(w)}$(v).append(A)};this.initSelection=function(){if(!this.SelectionPanel){return}$(".Grid").add(".gridTable").explore(".SelectableImage","DocMtxSelectedCell");$(".SelectionItemRemove").live("click",function(){q.removeFromSelectionBySelectionItem(this)});$("#btnClearSelection").live("click",function(r){$("body").append('<form name="ClearSelectionForm" method="post" action="/fotoweb/cmdrequest/ClearSelection.fwx"></form>');document.ClearSelectionForm.submit()});$(this.SelectionPanel).find(".PanelHeader").append('<span id="btnClearSelection" title="'+TRANSLATIONS.ClearSelection+'"></span>');$("#btnClearSelection").hide();q.updateSelection()};function h(){if(q.ActionPanel){q.ActionPanel.setPreActivateEvent(function(){g()})}if(q.StructurePanel){q.StructurePanel.setPostShowEvent(function(){$(q).find(".StructureList li").filter(":has(>ul:hidden)").addClass($.fn.treeview.classes.expandable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastExpandable);$(q).find(".StructureList li").not(":has(>ul:hidden)").addClass($.fn.treeview.classes.collapsable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastCollapsable)})}if(q.DataMiningPanel){q.DataMiningPanel.setPostShowEvent(function(){$(q).find(".DataMining li").filter(":has(>ul:hidden)").addClass($.fn.treeview.classes.expandable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastExpandable);$(q).find(".DataMining li").not(":has(>ul:hidden)").addClass($.fn.treeview.classes.collapsable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastCollapsable)})}if(q.KeywordPanel){q.KeywordPanel.setPostShowEvent(function(){$(q).find(".KeywordList li").filter(":has(>ul:hidden)").addClass($.fn.treeview.classes.expandable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastExpandable);$(q).find(".KeywordList li").not(":has(>ul:hidden)").addClass($.fn.treeview.classes.collapsable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastCollapsable)})}if(q.SearchtreePanel){q.SearchtreePanel.setPostShowEvent(function(){$(q).find(".SearchtreeList li").filter(":has(>ul:hidden)").addClass($.fn.treeview.classes.expandable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastExpandable);$(q).find(".SearchtreeList li").not(":has(>ul:hidden)").addClass($.fn.treeview.classes.collapsable).replaceClass($.fn.treeview.classes.last,$.fn.treeview.classes.lastCollapsable)})}}function i(){if(!q.SearchtreePanel){return}var s=$(q.SearchtreePanel).find("ul")[0];var r=function(v){var w="";w=$(v).attr("Name");var u="";if($(v).attr("Search")){u="?search="+encodeURIComponent($(v).attr("Search"))}else{u="javascript:"}return{display:w,href:u}};var t=function(){var w=this;var x=$(this).data("Name");var v="?ar="+GLOBALS.ArchiveId+"&nm="+$(this).data("Name")+"&r=1&rt="+$(this).data("Root");var u={url:"fotoweb/cmdrequest/rest/SearchTreeContent.fwx"+v,async:false,datatype:"xml",success:function(y){var z=document.createElement("ul");$(y).find("SearchTreeContent > SearchNode").each(function(){var A=k(this,z,r);$(A).data("Name",x);$(A).data("Root",$(this).attr("Root"))});$(s)[0].addBranch(w,z)}};$.ajax(u)};$.get("/fotoweb/cmdrequest/rest/SearchTreeList.fwx",{ar:GLOBALS.ArchiveId},function(u){$(s).empty();$(u).find("SearchTree").each(function(){var v=k(this,s,r);$(v).append($("<ul><li></li></ul>"));$(v).data("Name",$(this).attr("Name"));$(v).data("Root","/")});if($(s).find("li").length){$(s).xenview({collapsed:true,persist:"cookie",cookieId:"SearchTreeFor"+GLOBALS.ArchiveId},function(){t.call(this)});$(q.SearchtreePanel).fadeIn(300)}},"xml")}function a(){if(!q.KeywordPanel){return}var t=$(q.KeywordPanel).find("ul")[0];var r=function(v){var w="";w=$(v).attr("Element")?$(v).attr("Element"):$(v).attr("Name");var u="";if($(v).attr("Element")){u="?search="+encodeURIComponent($(v).attr("Element"))}else{u="javascript:"}return{display:w,href:u}};var s=function(){var w=this;var v="?ar="+GLOBALS.ArchiveId+"&id="+$(this).data("Id");var u={url:"fotoweb/cmdrequest/rest/KeywordListContent.fwx"+v,async:false,datatype:"xml",success:function(x){var y=document.createElement("ul");$(x).find("KeywordListContent > KeywordList").each(function(){k(this,y,r)});$(t)[0].addBranch(w,y)}};$.ajax(u)};$.get("/fotoweb/cmdrequest/rest/KeywordList.fwx",{ar:GLOBALS.ArchiveId},function(u){$(t).empty();$(u).find("KeywordList").each(function(){var v=k(this,t,r);$(v).append($("<ul><li></li></ul>"));$(v).data("Id",$(this).attr("Id"))});if($(t).find("li").length){$(t).xenview({collapsed:true,persist:"cookie",cookieId:"KeywordListFor"+GLOBALS.ArchiveId},function(){s.call(this)});$(q.KeywordPanel).fadeIn(300)}},"xml")}function d(){if(!q.StructurePanel){return}var t=$(q.StructurePanel).find("ul")[0];var r=function(v){var w=$(v).attr("DisplayName");var u="/fotoweb/Grid.fwx?search="+$(v).attr("SearchString");return{display:w,href:u}};var s=function(){var x=this;var u=$(this).data("Root");var w="?ar="+GLOBALS.ArchiveId+"&rt="+u+"&r=1";var v={url:"fotoweb/cmdrequest/rest/FolderList.fwx"+w,async:false,datatype:"xml",success:function(y){var z=document.createElement("ul");$(y).find("FolderList > Folder > Folder").each(function(){var A=k(this,z,r);$(A).data("Root",$(this).attr("Root"))});$(t)[0].addBranch(x,z)}};$.ajax(v)};$.get("/fotoweb/cmdrequest/rest/FolderList.fwx",{ar:GLOBALS.ArchiveId,r:1},function(u){$(t).empty();$(u).find("FolderList > Folder").each(function(){var v=k(this,t,r);$(v).data("Root",$(this).attr("Root"))});if($(t).find("li").length){$(t).xenview({collapsed:true,persist:"cookie",cookieId:"StructureFor"+GLOBALS.ArchiveId},function(){s.call(this)});$(q.StructurePanel).fadeIn(300)}},"xml")}function e(){if(!q.DataMiningPanel){return}var s=$(q.DataMiningPanel).find("ul")[0];var r=function(v){var w=$(v).attr("Name")?$(v).attr("Name"):$(v).attr("Display");var u=$(v).attr("Search")?"?search="+encodeURIComponent($(v).attr("Search")):"javascript:";return{display:w,href:u}};var t=function(){var x=this;var u=$(this).data("Root");var w="?ar="+GLOBALS.ArchiveId+"&rt="+u;var v={url:"fotoweb/cmdrequest/rest/DataMining.fwx"+w,async:false,datatype:"xml",success:function(y){var z=document.createElement("ul");$(y).find("DataMining > Value").each(function(){k(this,z,r)});$(s)[0].addBranch(x,z)}};$.ajax(v)};$.ajax({url:"/fotoweb/cmdrequest/rest/DataMining.fwx",data:{ar:GLOBALS.ArchiveId},contentType:"xml",success:function(u){$(s).empty();$(u).find("DataMining > Field").each(function(){var v=k(this,s,r);$(v).append($("<ul><li></li></ul>"));$(v).data("Root",$(this).attr("Root"))});if($(s).find("li").length){$(s).xenview({collapsed:true,persist:"cookie",cookieId:"DataMiningFor"+GLOBALS.ArchiveId},function(){t.call(this)});$(q.DataMiningPanel).fadeIn(300)}}})}function k(x,v,w,t){t=typeof t=="undefined"?true:t;var y=w(x);var r=document.createElement("li");var s=document.createElement("a");$(s).attr("href",y.href);$(s).text(y.display);$(r).append(s);if(t&&x.hasChildNodes()){var u=document.createElement("ul");$(x).children().each(function(){k(this,u,w)});$(r).append(u)}$(v).append(r);return r}function g(){if(typeof GLOBALS=="undefined"){return}if(!q.ActionPanel||!$(q.ActionPanel).find(".ActionsList").length){return}var r=GLOBALS.PostBackUrl.match(/\?(.*)/)?GLOBALS.PostBackUrl+"&reload=1":GLOBALS.PostBackUrl+"?reload=1";var s={rn:r,at:GLOBALS.ArchiveType,rd:+new Date().getTime()};if(GLOBALS.ArchiveId){s.ar=GLOBALS.ArchiveId}if(GLOBALS.Preview){s.pm="1";s.f=GLOBALS.foxtoken}else{s.pm="0"}q.updateMenu("/fotoweb/cmdrequest/rest/ActionsMenu.fwx",s,$(q.ActionPanel).find(".ActionsList")[0])}this.processDownloadRequest=function(){var r="";var s="";var t="single";if($(this).attr("href")&&$(this).attr("href").match(/download.dll/i)){s=GLOBALS.foxtoken;r=$(this).attr("href")}else{if(this.foxtoken){s=this.foxtoken;r="/fotoweb/fwbin/download.dll/"+this.filename+"?D="+this.downloadId+"&ForceSaveDialog=yes"}else{r="/fotoweb/cmdrequest/Download.fwx?incsel=1";t="selection"}}$.ajax({url:"/fotoweb/cmdrequest/rest/ProcessingProfileList.fwx",data:{ar:GLOBALS.ArchiveId},datatype:"xml",success:function(x){var u=$(x).find("DirectDownloads");var w=$(u).attr("Type");if(w!="Custom"){window.location=r}else{if(t=="single"){var v=new Image();v.onload=function(){b.show([v],x,r)};v.src="/fotoweb/cmdrequest/rest/Preview.fwx?rt=1&f="+s+"&sz=240"}else{p(function(){$(this).fadeIn(300)},function(y){b.show(y,x,r)})}}},error:function(){window.location=r}});return false};function p(r,s){r=typeof r=="function"?r:function(){};$.get("/fotoweb/cmdrequest/GetSelection.fwx?sendXML=1",{sendXML:1,rd:+new Date},function(v){var y=new Array();var u;var w;var x=$(v).find("Item");var t="&sz=240";if(x.length>1){t="&as=rt&asw=82&ash=82"}$(x).each(function(){u=new Image();w=$(this).attr("foxToken");u.onload=r;u.src="/fotoweb/cmdrequest/rest/Preview.fwx?rt=1&f="+w+t+"&rd="+new Date;y.push(u)});s(y)},"xml")}function l(){var r,s,t=[];s=m.length;for(r=0;r<s;r++){t.push("f="+m[r].foxtoken)}t.push("sendXML=yes");if(s>0){$.ajax({url:"/fotoweb/cmdrequest/RemoveFromSelection.fwx",data:t.join("&"),async:false,dataType:"xml",type:"POST"})}t=[];s=c.length;for(r=0;r<s;r++){t.push("f="+c[r].foxtoken)}t.push("sendXML=yes");if(s>0){$.ajax({url:"/fotoweb/cmdrequest/AddToSelection.fwx",data:t.join("&"),async:false,dataType:"xml",type:"POST"})}q._updateSelectionStatus();c=[];m=[]}this.updateSelection=function(){var r={sendXML:1,dp:+new Date};$.ajax({url:"/fotoweb/cmdrequest/GetSelection.fwx",data:r,async:false,success:function(s){q.updateSelectionByXML(s)}})};this.updateSelectionByXML=function(z){var x=$(z).find("Item");var B=$(q.SelectionPanel).find(".SelectionItem.node-tpl").clone().removeClass("node-tpl");var C="";var t="";var u="";var y=0;var w=0;var E=$(q.SelectionPanel).find(".SelectionList");var D=$(E).find(".SelectionItem");var s=false;var F=x.length;var A=D.length;var v=new Array();for(y=0;y<F;y++){s=false;C=$(B).clone();t=$(x[y]).attr("foxToken");u=$(x[y]).attr("pvToken");for(w=0;w<A;w++){if(D[w].id=="foxtoken_"+t){s=true;v[w]=true;break}}if(s){continue}$(C).attr("id","foxtoken_"+t);var r=new Image();$(r).css("visibility","hidden");$(r)[0].onload=function(){$(this).hide();$(this).css("visibility","visible");$(this).fadeIn(300);$(this).closest(".SelectionItem").removeClass("loading")};$(C).find("img").replaceWith(r);$(C).addClass("loading");if(GLOBALS.PreviewAccess){$(r).attr("src","/fotoweb/cmdrequest/rest/Preview.fwx?rt=1&f="+t+"&as=rt&asw=63&ash=63&rd="+(+new Date()))}else{$(r).attr("src","/fotoweb/fwbin/preview.dll?D="+u)}E.append(C)}for(w=0;w<A;w++){if(v[w]==true){continue}$(D[w]).fadeOut("fast",function(){var G=this;window.setTimeout(function(){$(G).remove();delete G},3000)})}this._updateSelectionStatus()};this._updateSelectionStatus=function(){if($(q.SelectionPanel).find(".SelectionList .SelectionItem").length>0){if(q.ActionPanel){q.ActionPanel.activate();q.ActionPanel.show()}if(q.SelectionPanel){q.SelectionPanel.activate();q.hideSelectionHintText();q.SelectionPanel.show();$("#btnClearSelection").show()}}else{if(q.ActionPanel){q.ActionPanel.disable()}if(q.SelectionPanel){q.showSelectionHintText()}$("#btnClearSelection").hide()}$(q.SelectionPanel).fadeIn(300)};this.showSelectionHintText=function(){if($(q.SelectionPanel).find(".Hint").length){$(q.SelectionPanel).find(".Hint").slideDown(300);return}$(q.SelectionPanel).find(".SelectionList").load("/fotoweb/SelectionHint.fwx");q.SelectionPanel.show()};this.hideSelectionHintText=function(){$(q.SelectionPanel).find(".Hint").slideUp(300)};this.removeFromSelectionBySelectionItem=function(t){var w=$(t).closest(".SelectionItem")[0];var u=$(w).attr("id").replace(/foxtoken_/,"");var s=0;var r=false;var v;for(s in GLOBALS.ImageInfos){v=$("#imgCell"+s)[0];if(u==v.foxtoken){r=true;v.unselect()}}if(!r){$.get("/fotoweb/cmdrequest/RemoveFromSelection.fwx",{sendXML:1,fileId:u,dp:+new Date},function(){q.updateSelection()},"xml")}};this.addToSelection=function(s,r){if($("body").hasClass("loading")){return}c.push(s);this._injectIntoSelection(s);if(typeof r=="function"){r()}if(o){window.clearTimeout(o)}o=window.setTimeout(function(){l()},CONFIG.SelectionSyncDelay)};this.removeFromSelection=function(s,r){if($("body").hasClass("loading")){return}m.push(s);this._stripFromSelection(s);if(typeof r=="function"){r()}if(o){window.clearTimeout(o)}o=window.setTimeout(function(){l()},CONFIG.SelectionSyncDelay)};this._stripFromSelection=function(r){$(q.SelectionPanel).find(".SelectionItem").each(function(){if(this.id=="foxtoken_"+r.foxtoken){var s=this;$(this).fadeOut(300,function(){$(s).remove();delete s})}})};this._injectIntoSelection=function(t){var s=$(q.SelectionPanel).find(".SelectionItem.node-tpl").clone();s.removeClass("node-tpl");$(s).attr("id","foxtoken_"+t.foxtoken);var r=new Image();$(r).css("visibility","hidden");$(r)[0].onload=function(){$(this).hide();$(this).css("visibility","visible");$(this).fadeIn(300);$(this).closest(".SelectionItem").removeClass("loading")};$(s).find("img").replaceWith(r);$(s).addClass("loading");$(q.SelectionPanel).find(".SelectionList").append(s);if(GLOBALS.PreviewAccess){$(r).attr("src","/fotoweb/cmdrequest/rest/Preview.fwx?rt=1&f="+t.foxtoken+"&as=rt&asw=63&ash=63&rd="+(+new Date()))}else{$(r).attr("src","/fotoweb/fwbin/preview.dll?D="+t.thumbnailId)}};this.construct()}function OpenBarView(){var a="BarView.fwx";a+="?position="+GLOBALS.postition;a+="&archiveId="+GLOBALS.ArchiveId;a+="&columns="+GLOBALS.Columns;a+="&rows="+GLOBALS.Rows;a+="&sorting="+GLOBALS.Sorting;a+="&search="+GLOBALS.Search;windowFeatures="dependent,width=200,height=800,left=0,top=0,menubar=0,scrollbars=1,status=1,titlebar=0,toolbar=0,resizable=1";window.open(a,"FWBarView",windowFeatures)}function OpenAlbumBarView(){var a="AlbumBarView.fwx";a+="?position="+GLOBALS.postition;a+="&albumId="+GLOBALS.ArchiveId;a+="&columns="+GLOBALS.Columns;a+="&rows="+GLOBALS.Rows;a+="&sorting="+GLOBALS.Sorting;windowFeatures="dependent,width=200,height=800,left=0,top=0,menubar=0,scrollbars=1,status=1,titlebar=0,toolbar=0,resizable=1";window.open(a,"FWBarView",windowFeatures)};