var FBinitialized=0;var disableAlbumSettingsPanelThemePreview=false;var horizontalTabs=false;var QpRequest;var selectboxSeeAllStyle=false;var processingTimerId=null;var processingTimerInterval=3000;var thumbnailDef=new Array();thumbnailDef.T75={height:75,width:75,cropped:1};thumbnailDef.T100={height:100,width:100,cropped:1};thumbnailDef.T100U={height:100,width:100,cropped:0};thumbnailDef.T150={height:150,width:150,cropped:1};thumbnailDef.T150U={height:150,width:150,cropped:0};thumbnailDef.T400300={height:300,width:400,cropped:0};thumbnailDef.T600450={height:450,width:600,cropped:0};thumbnailDef.T800600={height:600,width:800,cropped:0};thumbnailDef.T1024768={height:768,width:1024,cropped:0};thumbnailDef.T1200800={height:800,width:1200,cropped:0};$(document).ready(function(){if(!getCookie("sessionTransfered")){jQuery.getScript(domainName+"/requestsession.seam?customdomain="+location.host)}$("body").click(function(f){var a=$(f.target);var d=a.attr("class");var c=$(f.target).parent().attr("class");var b=$(f.target).parent().parent().attr("class");if((d!="search")&&(c!="search")&&(b!="search")){$("#headInnerContainer div.search").css("display","none")}});$(".removeMarkIconContainer").live("mouseenter",function(){var a=$(this).find(".removeMarkIconT16");a.removeClass("removeMarkIconT16");a.addClass("removeMarkIconT16Enlarged");$(this).css("top","-4px").css("right","-5px");showThumbTooltip(this,"REMOVE")});$(".removeMarkIconContainer").live("mouseleave",function(){var a=$(this).find(".removeMarkIconT16Enlarged");a.removeClass("removeMarkIconT16Enlarged");a.addClass("removeMarkIconT16");$(this).css("top","0").css("right","0");hideThumbTooltip(this)});$(".selectMarkIconContainer").live("mouseenter",function(){var a=$(this).find(".selectMarcIconT16");if(a.length!=0){a.removeClass("selectMarcIconT16");a.addClass("selectMarcIconT16Enlarged");$(this).css("top","-4px").css("left","-5px");showThumbTooltip(this,"SELECT")}});$(".selectMarkIconContainer").live("mouseleave",function(){var a=$(this).find(".selectMarcIconT16Enlarged");if(a.length!=0){a.removeClass("selectMarcIconT16Enlarged");a.addClass("selectMarcIconT16");$(this).css("top","0").css("left","0");hideThumbTooltip(this)}});$("#selectboxThumbnailSrc img[id='removeIconImgTag']").live("click",function(){var a=$(this).parents("#selectboxThumbnailSrc").data("itemid");var c=$("div.thumbnail[id="+a+"]");if(c.length>0){unselectItem($(c).find("#selectedIconImgTag"))}else{removeFromSelectBox(a)}if(typeof(thumbnailsCache)!="undefined"){var b=itemList.index(itemList.filter("[id='"+a+"']"));thumbnailsCache[b]=null}});renderSelectBox(true);if(typeof(loaded_processingJobsCount)!="undefined"&&loaded_processingJobsCount>0){updateRunningJobsCount(loaded_processingJobsCount);clearTimeout(processingTimerId);processingTimerId=setTimeout("runStateUpdater();",processingTimerInterval)}setTimeout("preloadPanelsIntoStorage()",120000)});function updateRunningJobsCount(a){loaded_processingJobsCount=a;if(a==0){$("#processingJobsCountSpan").text("");if($("#processingJobsDiv").is(":visible")){$("#processingJobsDiv").fadeOut()}}else{if(a==1){$("#processingJobsCountSpan").text("1 Photo");if($("#processingJobsDiv").is(":hidden")){$("#processingJobsDiv").fadeIn()}}else{if(a>0){$("#processingJobsCountSpan").text(a+" Photos");if($("#processingJobsDiv").is(":hidden")){$("#processingJobsDiv").fadeIn()}}}}}function runStateUpdater(){var b=[{name:"method",value:"bluemelon.processes.getstate"}];if(typeof(processingOrUpdatingList)!="undefined"){b.push({name:"itemlist",value:processingOrUpdatingList});b=b.concat(getCommonApiParameters());var a=getAdditionalParamsToApi();if(a!=null){b=b.concat(getAdditionalParamsToApi())}}$.post("/api/ajax/",b,function(c){$(c).find("rsp").each(function(){if($(this).attr("status")!="ok"){hideMainLoading();alert("Image load error: "+$(this).attr("errormsg"));return}else{clearTimeout(processingTimerId);var d=0;$(this).find("jobs").each(function(){d=$(this).attr("total");updateRunningJobsCount(d)});$(this).find("item").each(function(){updateProcessingItem(this)});$(this).find("error").each(function(){if(typeof(processingOrUpdatingList)!="undefined"&&typeof(removeItemInternalJS)=="function"){var e=$(this).attr("errorid");processingOrUpdatingList=processingOrUpdatingList.replace(";"+loaded_folderId+"-"+e+";",";");removeItemInternalJS(e)}});if(typeof(processingOrUpdatingList)!="undefined"&&processingOrUpdatingList.length>1){processingTimerId=setTimeout("runStateUpdater();",processingTimerInterval)}else{if(d>0){processingTimerId=setTimeout("runStateUpdater();",processingTimerInterval)}else{processingTimerId=null}}}})})}function showThumbTooltip(a,c){var d=$(a).parents(".thumbnail").find("img").height();var b=$(a).parents(".topSide").find(".topSideTooltip");b.css("height",(d+2)+"px");b.find(".topSideTooltipText").html(c);b.find(".topSideTooltipText").css("margin-top",-(d/2)-10);b.show()}function hideThumbTooltip(a){var b=$(a).parents(".topSide").find(".topSideTooltip");b.hide()}function selectboxClear(){if(typeof(JSON)=="undefined"){getJSONscript()}if(!confirm("Are you sure you want to clear all selected items?")){return}var a={items:[]};HTML5_SetLocalStorage("HTML5_SELECTED_ITEMS",JSON.stringify(a));$(".selectMarcIconT16").filter(":hidden").fadeIn();$(".selectedMarkIconContainer").filter(":visible").css("display","none");renderSelectBox(true)}function unselectItem(c){$(this).die("click");var d=$(c).parents("div.thumbnail");var e=$(d).attr("id");var b=$(d).find(".selectedMarkIconContainer");$(b).css("display","none");var a=$(d).find("#selectIconImgTag");a.fadeIn();removeFromSelectBox(e)}function removeFromSelectBox(a){if(typeof(JSON)=="undefined"){getJSONscript()}data=HTML5_GetSelectedItems();newdata=jsonRemoveId(data,a);HTML5_SetLocalStorage("HTML5_SELECTED_ITEMS",JSON.stringify(newdata));renderSelectBox(true)}function renderSelectBox(b){data=HTML5_GetSelectedItems();itemsCount=data.items.length;var c=HTML5_GetLocalStorage("HTML5_SELECTBOX_STYLE");if(c==null){c="MEDIUM"}if(c=="MINI"){$("#selectboxMediumContainer").css("display","none");if(itemsCount>0){$(".selectboxItemsCount").text(itemsCount);$("#selectboxMiniContainer").fadeIn()}else{$("#selectboxMiniContainer").fadeOut()}}else{$("#selectboxMiniContainer").css("display","none");if(itemsCount>0){$(".selectboxItemsCount").text(itemsCount);if(itemsCount>7){if(selectboxSeeAllStyle){$("#mediumSelectboxDisplayAll #selectBoxSeeAll").hide();$("#mediumSelectboxDisplayAll #selectBoxSeeLess").show()}else{$("#mediumSelectboxDisplayAll #selectBoxSeeLess").hide();$("#mediumSelectboxDisplayAll #selectBoxSeeAll").show()}$("#mediumSelectboxDisplayAll").fadeIn()}else{$("#mediumSelectboxDisplayAll").fadeOut()}if(b){fillSelectboxMedium(data)}var a=getSelectboxOwnerItemscount(data);if(a==0){$("#selectboxTools").fadeOut()}else{$(".selectboxOwnItemsCount").text(a);$("#selectboxTools").fadeIn()}$("#selectboxMediumContainer").fadeIn()}else{$("#selectboxMediumContainer").fadeOut()}}}function getSelectboxOwnerItemscount(b){var a=0;if(loaded_authenticatedUserId<=0){return 0}$.each(b.items,function(c,d){if(d.ownerid==loaded_authenticatedUserId){a++}});return a}function fillSelectboxMedium(g){if(typeof(JSON)=="undefined"){getJSONscript()}var a=g.items.length;var b=0;if(a>7){if(selectboxSeeAllStyle){b=0}else{b=a-7}}$("#mediumSelectboxThumbs").empty();var c=$("#selectboxThumbnailSrc");for(var d=a-1;d>=b;d--){var e=g.items[d];var h=getThumbnailUrl(e.id,e.albumid,"T75");var f=c.clone();f.data("itemid",e.id);f.find(".selectboxThumbnailImg").error(function(){$(this).unbind("error");var j=$(this).parent().data("itemid");newdata=HTML5_GetSelectedItems();newdata=jsonRemoveId(g,j);HTML5_SetLocalStorage("HTML5_SELECTED_ITEMS",JSON.stringify(newdata));$(this).parent().remove();renderSelectBox(false)});f.find(".selectboxThumbnailImg").attr("src",h);f.show();f.hover(function(){$(this).find("div.topSide").fadeIn("fast")},function(){$(this).find("div.topSide").fadeOut("fast")});$("#mediumSelectboxThumbs").append(f)}$("#mediumSelectboxThumbs").append("<div class='cleaner'></div>")}function selectBoxSeeAll(){$("#mediumSelectboxThumbs").removeClass("mediumSelectboxThumbs");$("#mediumSelectboxThumbs").addClass("seeAllSelectboxThumbs");data=HTML5_GetSelectedItems();selectboxSeeAllStyle=true;renderSelectBox(true)}function selectBoxSeeLess(){$("#mediumSelectboxThumbs").removeClass("seeAllSelectboxThumbs");$("#mediumSelectboxThumbs").addClass("mediumSelectboxThumbs");data=HTML5_GetSelectedItems();selectboxSeeAllStyle=false;renderSelectBox(true)}function getThumbnailUrlFromXml(a,b){if(typeof a.attr("albumid")!="undefined"){return getThumbnailUrl(a.attr("id"),a.attr("albumid"),b,a.attr("version"))}else{if(typeof a.attr("collectionid")!="undefined"){return getCollectionThumbnailUrl(a.attr("id"),a.attr("collectionid"),b,a.attr("version"))}else{return getUnsortedThumbnailUrl(a.attr("id"),b,a.attr("version"))}}}function getUnsortedThumbnailUrl(c,b,a){if(typeof a=="undefined"||a==""||a=="0"){return"/photo/"+c+"-"+b+".jpg"}else{return"/photo/"+c+"-"+b+"."+a+".jpg"}}function getThumbnailUrl(d,b,c,a){if(typeof a=="undefined"||a==""||a=="0"){return"/photo/"+b+"/"+d+"-"+c+".jpg"}else{return"/photo/"+b+"/"+d+"-"+c+"."+a+".jpg"}}function getCollectionThumbnailUrl(d,c,b,a){if(typeof a=="undefined"||a==""||a=="0"){return"/photo/collection-"+c+"/"+d+"-"+b+".jpg"}else{return"/photo/collection-"+c+"/"+d+"-"+b+"."+a+".jpg"}}function getThumbnailSize(h,g,e){var b=thumbnailDef[e];if(b.cropped){return({height:b.height,width:b.width})}if(h<b.width&&g<b.height){return({height:g,width:h})}var f;var a;var c=h/g;var d=b.width/b.height;if(d<c){f=b.width;a=Math.round(b.width/c)}else{f=Math.round(b.height*c);a=b.height}return({height:a,width:f})}function selectboxMedium(){HTML5_SetLocalStorage("HTML5_SELECTBOX_STYLE","MEDIUM");renderSelectBox(true)}function selectboxMini(){HTML5_SetLocalStorage("HTML5_SELECTBOX_STYLE","MINI");renderSelectBox(true)}function selectBoxOrganizerPanel(){showQuickPanelPreload(660,"Loading Tools panel...");QpRequest=$.get("/snippets/owner/organizer.qp.seam",function(b,a){if(a!="success"){alert("Error Loading Panel: "+$(this).attr("errormsg"));return}$(".quickPanel").html(b);showQuickPanel(660)})}function selectBoxBuyPanel(){showQuickPanelPreload(905,"Loading Buy panel...");var a="";var b="";for(i=0;i<data.items.length;i++){a=a+data.items[i].id+";";b=b+data.items[i].albumid+";"}QpRequest=$.get("/snippets/cart/selectbox-productselector.qp.seam?itemids="+a+"&albumids="+b,function(d,c){if(c!="success"){alert("Error Loading Panel: "+$(this).attr("errormsg"));return}$(".quickPanel").html(d);showQuickPanel(905)})}function getJSONscript(){$.ajaxSetup({async:false});$.getScript("/js-import/json2.js",function(a,b){});$.ajaxSetup({async:true})}function jsonContainsId(b,c){var a=false;$.each(b.items,function(d,e){if(e.id==c){a=true;return false}});return a}function jsonRemoveId(b,c){var a={items:[]};$.each(b.items,function(d,e){if(e.id!=c){a.items.push(e)}});return a}function jsonOwnerData(b,c){var a={items:[]};$.each(b.items,function(d,e){if(e.ownerid==c){a.items.push(e)}});return a}function HTML5_GetSelectedItems(){var a=HTML5_GetLocalStorage("HTML5_SELECTED_ITEMS");if(a==null){data={items:[]}}else{if(typeof(JSON)=="undefined"){getJSONscript()}data=JSON.parse(a)}return data}function preloadPanelsIntoStorage(){var b=[["HTML5_CHANGE_ALBUM_PANEL_","/local-panels/change-album.seam"],["HTML5_GET_LINKS_PANEL_","/local-panels/get-links.seam"]];if("localStorage" in window&&window.localStorage!=null){$.ajaxSetup({async:false});for(i=0;i<b.length;i++){var a=HTML5_GetLocalStorage(b[i][0]+"VERSION");if(a==null||a<current_localstorage_versions){$.post(b[i][1],function(d,c){if(c=="success"){HTML5_SetLocalStorage(b[i][0]+"CONTENT",d);HTML5_SetLocalStorage(b[i][0]+"VERSION",current_localstorage_versions)}})}}$.ajaxSetup({async:true})}}function searchBoxShow(){$("#headInnerContainer div.search").css("display","inline")}function hideAndGetNewMessage(){showMainLoading("Loading new message");var a=[{name:"method",value:"bluemelon.users.hidelastmessage"}];$.post("/api/ajax/",a,function(b){$(b).find("rsp").each(function(){if($(this).attr("status")!="ok"){hideMainLoading();alert("The changes are not saved: "+$(this).attr("errormsg"));return}else{a=[{name:"method",value:"bluemelon.users.getlastmessage"}];$.post("/api/ajax/",a,function(c){$(c).find("rsp").each(function(){if($(this).attr("status")!="ok"){hideMainLoading();alert("The changes are not saved: "+$(this).attr("errormsg"));$("div.instantMessages").fadeOut("slow");return}else{hideMainLoading();if($(this).find("text").length==0){$("div.instantMessages").fadeOut("slow");return}var d=$(this).find("text").text();var e=$(this).find("fromUserLogin").text();$("div.instantMessages").fadeOut("fast",function(){$("div.instantMessages")[0].innerHTML="Message from "+e+" : "+d+" [<a href='javascript:hideAndGetNewMessage();' class='hideMessage' >Hide</a>]";$("div.instantMessages").fadeIn("fast")})}})})}})})}function showQuickPanel(a){$(".quickPanel").attr("style","");if(a!=null){$(".quickPanel").css("width",a);$(".quickPanel").css("margin-left",-1*a/2)}if($(".quickPanel .quickPanelPreloadContainer").length==1){$(".quickPanel").fadeIn("fast");$(".quickPanelBack").css("opacity",0.7);$(".quickPanelBack").fadeIn("fast")}else{$(".quickPanel").stop(true,true);$(".quickPanelBack").stop(true,true);$(".quickPanel").show();$(".quickPanelBack").show()}if($(".quickPanel").height()+120>$(window).height()){$(".quickPanel").css("position","absolute");$(".quickPanel").css("top",$(window).scrollTop()+60)}else{$(".quickPanel").css("top",60)}}function showQuickPanelPreload(c,a,b){$(".quickPanel").html($(".quickPanelPreload").html());if(a!=null){$(".quickPanel .quickPanelTitle").html(a)}if(b!=null){$(".quickPanel .quickPanelContent").css("min-height",b)}showQuickPanel(c)}function showQuickPanelLoadingMsg(b,a){hideQuickPanelLoadingMsg();showLoadingMsg(".quickPanel .quickPanelContent",b,a,"quickPanelContent");$(".quickPanel .quickPanelHeaderFooter").eq(1).find(".largeButton").addClass("invisibleButton")}function showQuickPanelDialog(g,h,a,e,k,d){if(d!=null){$(".quickPanel").html("<div class='quickPanelContainer'><div class='quickPanelHeaderFooter' style='width: auto; height: auto; padding:10px; font-size:1.2em;'>"+d+"</div><div class='quickPanelContent'><div style='width:100%; height:200px;'/></div><div class='quickPanelHeaderFooter' style='width: auto; height:35px'></div></div>");showQuickPanel(600)}hideQuickPanelLoadingMsg();dialogHtml=g+"<br/><table style='margin-left:auto;margin-right:auto;margin-top:10px;'><tr><td><div class='largeButton' style='float: none; padding-left: 5px; padding-right: 5px;'><a href='javascript:"+a+"' title='"+h+"'>"+h+"</a></div></td><td><div class='largeButton' style='float: none; padding-left: 5px; padding-right: 5px;'><a href='javascript:"+k+"' title='"+e+"'>"+e+"</a></div></td></tr></table>";var f=$(".quickPanel .quickPanelContent");var b=f.width();var j=f.height();var c="quickPanelLoadingMsgContainer quickPanelContent";f.after("<div class='"+c+"'><div class='quickPanelLoadingMsgContent' style='text-align:center;'>"+dialogHtml+"</div></div>");$(".quickPanelLoadingMsgContainer").width(b);$(".quickPanelLoadingMsgContainer").height(j);$(".quickPanelLoadingMsgContent").css("margin-top",(j-$(".quickPanelLoadingMsgContent").height())/2+"px");f.hide();$(".quickPanelLoadingMsgContainer").show();$(".quickPanel .quickPanelHeaderFooter").eq(1).find(".largeButton").addClass("invisibleButton")}function showLoadingMsg(d,h,b,e){if(b==null||b=="LOADING_GIF"){h=addAjaxToLoadingMessage(h)}else{if(b=="OKAY_BUTTON"){h=h+"<div class='largeButton' style='width:60px;float: none;margin-left:auto;margin-right:auto;margin-top:10px;'><a href='javascript:hideQuickPanel();' title='Okay'>Okay</a></div>"}}var g=$(d);var f=g.width();var a=g.height();var c="quickPanelLoadingMsgContainer "+e;g.after("<div class='"+c+"'><div class='quickPanelLoadingMsgContent' style='text-align:center;'>"+h+"</div></div>");$(".quickPanelLoadingMsgContainer").width(f);$(".quickPanelLoadingMsgContainer").height(a);$(".quickPanelLoadingMsgContent").css("margin-top",(a-$(".quickPanelLoadingMsgContent").height())/2+"px");g.hide();$(".quickPanelLoadingMsgContainer").show()}function addAjaxToLoadingMessage(a){return"<img src='/images/ajax/rectangle-loader.gif'/><br/>"+a}function hideQuickPanelLoadingMsg(){hideLoadingMsg(".quickPanel .quickPanelContent");$(".quickPanel .quickPanelHeaderFooter").eq(1).find(".largeButton").removeClass("invisibleButton")}function hideLoadingMsg(a){$(".quickPanelLoadingMsgContainer").remove();$(a).show()}function abortQuickPanel(){QpRequest.abort();hideQuickPanel();hideMainLoading()}function hideQuickPanel(a){if(a==null||a==1){$("div.quickPanelBack").stop();$("div.quickPanelBack").fadeOut("fast",function(){$(this).hide();$(this).css("opacity",0.7)})}$("div.quickPanel").fadeOut("fast",function(){$(this).hide();$(this).css("top","auto")})}function showMainLoading(b,a){$("#mainLoading").html("<span class='loadingContainer'>"+b+"</span>");if($("img.logo").offset()==null){$("#mainLoading").css({left:52})}else{$("#mainLoading").css({left:$("img.logo").offset().left+52})}if(a!=null&&a==true){$("#mainLoading span").show()}else{$("#mainLoading span").fadeIn("fast")}}function hideMainLoading(){setTimeout('$("#mainLoading span").fadeOut("slow");',1000)}function showGoToAlbumPanel(){var c=500;showQuickPanelPreload(c,"Go to Album...",500);var b="HTML5_CHANGE_ALBUM_PANEL_";var a=HTML5_GetLocalStorage(b+"VERSION");if(a!=null&&a==current_localstorage_versions){$(".quickPanel").html(HTML5_GetLocalStorage(b+"CONTENT"));showQuickPanel(c)}else{QpRequest=$.get("/local-panels/change-album.seam",function(e,d){if(d!="success"){alert("Error loading Go to Album Panel: "+$(this).attr("errormsg"));hideQuickPanel();return}HTML5_SetLocalStorage(b+"CONTENT",e);HTML5_SetLocalStorage(b+"VERSION",current_localstorage_versions);$(".quickPanel").html(e);showQuickPanel(c)})}}function showShareInvitations(){var a="";if(typeof(actualView)!="undefined"&&actualView=="item"){a="?folderid="+loaded_folderId+"&itemid="+actualItemId}else{if(typeof(loaded_folderId)!="undefined"){a="?folderid="+loaded_folderId}else{if(typeof(loaded_categoryId)!="undefined"&&loaded_categoryId!=0){a="?categoryid="+loaded_categoryId}else{a="?userid="+loaded_userId}}}showQuickPanelPreload(650,"Loading Invitation panel...");QpRequest=$.get("/snippets/owner/share-quickpanel-invitations.qp.seam"+a,function(c,b){if(b!="success"){alert("Error loading Send an Email: "+$(this).attr("errormsg"));return}$(".quickPanel").html(c);showQuickPanel(650)})}function showShareGetLinks(){var b="HTML5_GET_LINKS_PANEL_";var a=HTML5_GetLocalStorage(b+"VERSION");if(a!=null&&a==current_localstorage_versions){$("#mainMovablePanel").html(HTML5_GetLocalStorage(b+"CONTENT"))}else{$.ajaxSetup({async:false});QpRequest=$.get("/local-panels/get-links.seam",function(d,c){if(c!="success"){alert("Error loading get links Panel: "+$(this).attr("errormsg"));hideQuickPanel();return}HTML5_SetLocalStorage(b+"CONTENT",d);HTML5_SetLocalStorage(b+"VERSION",current_localstorage_versions);$("#mainMovablePanel").html(d)});$.ajaxSetup({async:true})}$("#mainMovablePanel").attr("name","sharePanel");if(typeof(itemPanelCache)!="undefined"){fillSharedEntries();showMovablePanel();movablePanelTabClick($("#mainMovablePanel .tabs-span:visible:first")[0])}else{$("#mainMovablePanel").hover(function(){$(this).find(".movablePanelBackgroundHover").stop();$(this).find(".movablePanelBackgroundHover").hide();$(this).find(".movablePanelBackgroundHover").css("opacity",1);$(this).find(".movablePanelBackgroundHover").fadeIn("fast")},function(){$(this).find(".movablePanelBackgroundHover").stop();$(this).find(".movablePanelBackgroundHover").css("opacity",1);$(this).find(".movablePanelBackgroundHover").fadeOut("fast")});fillSharedEntries();$("#mainMovablePanel").show();movablePanelTabClick($("#mainMovablePanel .tabs-span:visible:first")[0]);$("#mainMovablePanel .movablePanelHeader").css("cursor","default");$("#mainMovablePanel").css("position","fixed");$("#mainMovablePanel").css("left","50%");$("#mainMovablePanel").css("margin-left","-260px");$("#mainMovablePanel").css("top","50%");$("#mainMovablePanel").css("margin-top","-180px");$("#mainMovablePanel").show()}}function showShareOnFacebook(){if(typeof(loaded_folderAccessMode)!="undefined"&&loaded_folderAccessMode=="PRIVATE"){alert("The album's access mode is set to 'Private', whence you cannot share this album.");return}if(typeof(loaded_categoryAccessMode)!="undefined"&&loaded_categoryAccessMode=="PRIVATE"){alert("The category's access mode is set to 'Private', whence you cannot share this category.");return}var a="";if(typeof(actualView)!="undefined"&&(actualView=="item"||actualView.indexOf("combined")===0)){if(actualItemAccessMode=="PRIVATE"){alert("This photo is not public and as such cannot be viewed by others");return}a="?folderid="+loaded_folderId+"&itemid="+actualItemId}else{if(typeof(loaded_folderId)!="undefined"&&loaded_folderId!=null){a="?folderid="+loaded_folderId}else{if(typeof(loaded_categoryId)!="undefined"&&loaded_categoryId!=0){a="?categoryid="+loaded_categoryId}else{a="?userid="+loaded_userId}}}showQuickPanelPreload(400,"Loading Facebook panel...");QpRequest=$.get("/snippets/share-quickpanel-facebook.qp.seam"+a,function(c,b){if(b!="success"){alert("Error loading Facebook panel: "+$(this).attr("errormsg"));return}$(".quickPanel").empty();$(".quickPanel").html(c)})}function showShareOnTwitter(){if(typeof(loaded_folderAccessMode)!="undefined"&&loaded_folderAccessMode=="PRIVATE"){alert("The album's access mode is set to 'Private', whence you cannot share this album.");return}if(typeof(loaded_categoryAccessMode)!="undefined"&&loaded_categoryAccessMode=="PRIVATE"){alert("The category's access mode is set to 'Private', whence you cannot share this category.");return}var a="";if(typeof(actualView)!="undefined"&&(actualView=="item"||actualView.indexOf("combined")===0)){if(actualItemAccessMode=="PRIVATE"){alert("This photo is not public and as such cannot be viewed by others");return}a="?folderid="+loaded_folderId+"&itemid="+actualItemId}else{if(typeof(loaded_folderId)!="undefined"){a="?folderid="+loaded_folderId}else{if(typeof(loaded_categoryId)!="undefined"&&loaded_categoryId!=0){a="?categoryid="+loaded_categoryId}else{a="?userid="+loaded_userId}}}showQuickPanelPreload(400,"Loading Twitter panel...");QpRequest=$.get("/snippets/share-quickpanel-twitter.qp.seam"+a,function(c,b){if(b!="success"){hideMainLoading();alert("Error loading Twitter panel: "+$(this).attr("errormsg"));return}$(".quickPanel").html(c)})}function showShareSocial(){if(typeof(loaded_folderAccessMode)!="undefined"&&loaded_folderAccessMode=="PRIVATE"){alert("The album's access mode is set to 'Private', whence you cannot share this album.");return}if(typeof(loaded_categoryAccessMode)!="undefined"&&loaded_categoryAccessMode=="PRIVATE"){alert("The category's access mode is set to 'Private', whence you cannot share this category.");return}var c="";var a="";if(typeof(actualView)!="undefined"&&actualView=="item"){if(actualItemAccessMode=="PRIVATE"){alert("This photo is not public and as such cannot be viewed by others");return}var b=itemList.filter("[id='"+actualItemId+"']");c="http://www.bluemelon.com/"+loaded_userUrl+"/"+loaded_folderUrl+"/photo/"+actualItemId+"/"+loaded_itemSubviewExt;a=b.attr("title")}else{if(typeof(loaded_folderId)!="undefined"){c="http://www.bluemelon.com/"+loaded_userUrl+"/"+loaded_folderUrl;a=$("title").text()}else{if(typeof(loaded_categoryId)!="undefined"&&loaded_categoryId!=0){c="http://www.bluemelon.com/"+loaded_userUrl+"/"+loaded_categoryUrl;a=$("title").text()}else{c="http://www.bluemelon.com/"+loaded_userUrl;a="homepage"}}}$("#shareAddThisPanel .quickPanelContent").css("padding-left","35px");$("#shareAddThisPanel .quickPanelContent").html("<iframe src ='/snippets/share-quickpanel-addthis.qp.seam?sharedUrl="+c+"&sharedTitle="+a+"' width='305' height='385' frameborder='0'></iframe>");$("#shareAddThisPanel .quickPanelContent").css("overflow","hidden");$(".quickPanel").html($("#shareAddThisPanel").html());showQuickPanel(400)}function showThemePanel(){disableAlbumSettingsPanelThemePreview=false;var a=urldecode(loaded_url_parameters);showQuickPanelPreload(600,"Loading Theme panel...",520);QpRequest=$.get("/snippets/owner/theme-selector.qp.seam?"+a,function(c,b){if(b!="success"){alert("Error loading Theme Panel: "+$(this).attr("errormsg"));return}$(".quickPanel").html(c);$("li#tools_themes").parent().hide();showQuickPanel(600)})}function setCookie(c,e,a,h,d,g){var b=new Date();b.setTime(b.getTime());if(a){a=a*1000*60*60*24}var f=new Date(b.getTime()+(a));document.cookie=c+"="+escape(e)+((a)?";expires="+f.toGMTString():"")+((h)?";path="+h:"")+((d)?";domain="+d:"")+((g)?";secure":"")}function deleteCookie(a,c,b){if(getCookie(a)){document.cookie=a+"="+((c)?";path="+c:"")+((b)?";domain="+b:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"}}function getCookie(a){var f=document.cookie.split(";");var b="";var d="";var e="";var c=false;for(i=0;i<f.length;i++){b=f[i].split("=");d=b[0].replace(/^\s+|\s+$/g,"");if(d==a){c=true;if(b.length>1){e=unescape(b[1].replace(/^\s+|\s+$/g,""))}return e;break}b=null;d=""}if(!c){return null}}function dismissGlobMsg(){$("ul.globalMessages").fadeOut("slow")}function URLDecode(b){try{b=decodeURIComponent(b.replace(/<WBR\/>/g,"").replace(/\+/g,"%20"))}catch(a){}return b}function HTML5_SetLocalStorage(a,b){try{if("localStorage" in window&&window.localStorage!=null){localStorage.setItem(a.toUpperCase(),b);return true}return false}catch(c){return false}}function HTML5_GetLocalStorage(a){try{if("localStorage" in window&&window.localStorage!=null){return localStorage.getItem(a.toUpperCase())}return null}catch(b){return null}}function HTML5_RemoveLocalStorage(a){try{if("localStorage" in window&&window.localStorage!=null){localStorage.removeItem(a.toUpperCase())}}catch(b){return}}function toggleVisitorView(){window.location=(domainName+"/toggleVisitorView.seam?url="+escape(window.location.href))}function showVisitorShareCart(a){showQuickPanelPreload(400,"Loading Sent Cart panel...");QpRequest=$.get("/snippets/visitors-share-cart.qp.seam?itemOwnerId="+a,function(c,b){if(b!="success"){alert("Error loading Sent Cart: "+$(this).attr("errormsg"));return}$(".quickPanel").html(c);showQuickPanel(400)})}function apiErrorHandler(b){var f=b.find("error");$("div.errorMessage").hide();f.each(function(){$("div#"+$(this).attr("errorid")+"_errorMsg").text($(this).find("errormsg").text()).show()});var a=null;var d=0;var e=new Array();f.each(function(){var g=$(this).attr("alertmsg");if(g!=null&&g!=""){if(a==null){a=g}e.push($(this).attr("errorid"));d++}});if(d==1){alert("Error saving: "+a)}else{if(d>1){var c=d.length-1;alert("Error saving: "+a+" \n("+c+" more...)")}}return e}function enableBluemelonButton(b){var a=buttonDivContainer.find("a");a.attr("href",a.data("href"));a.attr("onclick",a.data("onclick"));buttonDivContainer.removeClass("disabledButton");a.removeData("href");a.removeData("onclick")}function disableBluemelonButton(b){var a=b.find("a");if(a.data("href")!=null){return}a.data("href",a.attr("href"));a.data("onclick",a.attr("onclick"));a.attr("href","javascript:void(0);");a.attr("onclick","");b.addClass("disabledButton")}function disableOnclickButton(a){if(a.hasClass("disabledButton")){return}a.attr("data-disabled-js-function",a.attr("onclick"));a.attr("onclick","");a.addClass("disabledButton")}function enableOnclickButton(a){if(!a.hasClass("disabledButton")){return}a.attr("onclick",a.attr("data-disabled-js-function"));a.attr("data-disabled-js-function","");a.removeClass("disabledButton")}function isNumeric(a){return(a-0)==a&&a.length>0}function hideMovablePanel(a){var d=$(a).parents(".movablePanel").attr("name");$(a).parents(".movablePanel").attr("name","");if(d=="infoPanel"){var c=HTML5_GetLocalStorage("HTML5_INFOPANEL_ITEMVIEW_POSITION");if(c!=null){var b="HIDDEN"+c.substring(c.indexOf(";"));HTML5_SetLocalStorage("HTML5_INFOPANEL_ITEMVIEW_POSITION",b)}c=HTML5_GetLocalStorage("HTML5_INFOPANEL_COMBINEDVIEW_POSITION");if(c!=null){b="HIDDEN"+c.substring(c.indexOf(";"));HTML5_SetLocalStorage("HTML5_INFOPANEL_COMBINEDVIEW_POSITION",b)}}$(a).parents(".movablePanel").eq(0).hide()}function movablePanelTabClick(a){$("#mainMovablePanel .tabs-span").removeClass("tabs-selected");$(a).addClass("tabs-selected");$("#mainMovablePanel .tabs-panel").hide();$("#mainMovablePanel div[id='"+a.id.substr(1)+"']").show();if(a.id=="texifFragment"){loadExifInfo()}movablePanelCorrectVisibility()}function movablePanelCorrectVisibility(){var a=0;var b=$("#mainMovablePanel");if(b.offset().left<a){b.css("left",0)}if($("#mainBox").width()-b.offset().left-b.width()<a){b.css("left",$("#mainBox").width()-b.width())}if(b.offset().top<a){b.css("top",0)}if($("#mainBox").height()-b.offset().top-b.height()<a){b.css("top",$("#mainBox").height()-b.height())}}function showThemeDesigner(){var a="";if(typeof(loaded_url_parameters)!="undefined"){a=loaded_url_parameters}window.location="/themedesigner.seam?"+a}function updateCartTotals(d){var c=d.find("carts > totals > summary > items").text();$("#cartsummary-items").html(c);var a=d.find("carts > totals > summary > subtotal").text();$("#cartsummary-subtotal").html(a);var e=d.find("carts > totals > summary > shipping").text();$("#cartsummary-shippingprice").html(e);var b=d.find("carts > totals > summary > ordertotal").text();$("#cartsummary-ordertotal").html(b);if(c>0){$("#cartItemCount").html("("+c+")")}else{$("#cartItemCount").html("")}}function showSendEmail(){var a=urldecode(loaded_url_parameters)+"&ismailform=true";showQuickPanelPreload(550,"Loading Send E-Mail panel...");QpRequest=$.get("/snippets/sendemail.qp.seam",a,function(c,b){if(b!="success"){alert("The panel could not be loaded");hideQuickPanel();return}$(".quickPanel").html(c);showQuickPanel(500)})}function sendUserMail(){showQuickPanelLoadingMsg("Sending email...");var a=$("form[id='addNewComment1']").serializeArray();param=$(a);param.each(function(){$(this).value=encodeURIComponent($(this).value)});param.push({name:"method",value:"bluemelon.users.sendEmail"});$.post("/api/ajax/",param,function(b){$(b).find("rsp").each(function(){if($(this).attr("status")!="ok"){alert("Your e-mail has not been sent: "+$(this).attr("errormsg"));hideQuickPanelLoadingMsg();return}else{showQuickPanelLoadingMsg("Your e-mail has been sent successfully","OKAY_BUTTON")}})})}function urldecode(d){var c={};var a=d.toString();var b=function(g,f,h){var e=[];e=h.split(g);return e.join(f)};c["!"]="%21";c["%20"]="+";for(replace in c){search=c[replace];a=b(search,replace,a)}a=decodeURIComponent(a);return a}function createAlbumWizard(){showQuickPanelPreload(700,"Loading Create Album Wizard...");QpRequest=$.get("/snippets/owner/create-album.qp.seam",function(b,a){if(a!="success"){alert("Error loading Create Album Wizard: "+$(this).attr("errormsg"));hideQuickPanel();return}$(".quickPanel").html(b);showQuickPanel(700)})}function showChangePassword(){showQuickPanelPreload(600,"Loading Change password panel...");QpRequest=$.get("/snippets/owner/myaccount-change-password.qp.seam",function(b,a){if(a!="success"){alert("Error loading Change password panel: "+$(this).attr("errormsg"));hideQuickPanel();return}$(".quickPanel").html(b);showQuickPanel(600)})}function showEmailSettings(){showQuickPanelPreload(600,"Loading Email settings panel...");QpRequest=$.get("/snippets/owner/myaccount-email-settings.qp.seam",function(b,a){if(a!="success"){alert("Error loading Email settings panel: "+$(this).attr("errormsg"));hideQuickPanel();return}$(".quickPanel").html(b);showQuickPanel(600)})}function showAboutYourself(){showQuickPanelPreload(750,"Loading About yourself panel...");QpRequest=$.get("/snippets/owner/myaccount-about-yourself.qp.seam",function(b,a){if(a!="success"){alert("Error loading About yourself panel: "+$(this).attr("errormsg"));hideQuickPanel();return}$(".quickPanel").html(b);showQuickPanel(750)})}function formatForHTML(a){if(a==null){return null}return a.replace(/\n/g,"<br/>")}function formatFromHTML(b){if(b==null){return null}var a=b.replace(/\n/g,"");a=a.replace(/<br>/gi,"\n");return a};
