if(typeof PHOTOZIG==="undefined"){var PHOTOZIG={}}function pzescape(b){var a=encodeURIComponent(b);a=a.replace("%2F","/");a=a.replace("%40","@");return a}function pzunescape(b){var a=decodeURIComponent(b);return a}PHOTOZIG.Default=function(){var MAX_ERROR_REFRESH=3;var self={refreshSession:function(){var action=function(){try{var sid=PHOTOZIG.Utils.getCookie("PHPSESSID")}catch(e){var sid=getCookie("PHPSESSID")}var url="/__api/pz.php?c=WAMHubRefreshSession&r="+PHOTOZIG.Properties.RELEASE;if(typeof $!=="undefined"&&typeof $.ajax!=="undefined"){$.ajax({url:url,dataType:"text",success:function(){setTimeout(self.refreshSession,PHOTOZIG.Properties.SESSION_REFRESH_TIMEOUT||60000)},error:function(){setTimeout(self.refreshSession,PHOTOZIG.Properties.SESSION_REFRESH_TIMEOUT||60000)}});return}if(typeof YAHOO!=="undefined"&&typeof YAHOO.util!=="undefined"&&typeof YAHOO.util.Connect!=="undefined"){var callback={success:function(){setTimeout(self.refreshSession,PHOTOZIG.Properties.SESSION_REFRESH_TIMEOUT||60000)},failure:function(){setTimeout(self.refreshSession,PHOTOZIG.Properties.SESSION_REFRESH_TIMEOUT||60000)},argument:{url:url}};YAHOO.util.Connect.asyncRequest("GET",url,callback)}};action()},checkCookiesEnabled:function(){if(typeof document.cookie==="undefined"||!document.cookie){$("body #content, body .content").prepend('<div id="nocookies" class="errors_panel">COOKIES are not enabled or they are not supported in this browser.</div>')}},registerGlobalAjaxResponsesObserver:function(){var action=function(serverError,script,parsedResponse){var isErrorException=function(script,errorMessage,errorCode){if(!script.match(/WAT|WAM|WAS/)){return true}if(script.match("WAMLogin")){return true}if(script.match("WAMSignup")){return true}if(script.match("WAMForgotPassword")){return true}if(script.match("WAMChangeUserThemes")){return true}if(script.match("WAMValidateAlbumProtected")){return true}if(script.match("WAMCreateEZPQuickAlbum")){return true}if(script.match("WAT")){alert(errorMessage);return true}if(script.match(/WASReadCommunity|WASReadCommunity|WASSearchCommunities/)){alert(errorMessage);return true}if((location.href.match(PHOTOZIG.Properties.RELEASE_ROOT)||location.href.match(PHOTOZIG.Properties.RELEASE_TOP_ROOT))&&errorCode==504){alert(errorMessage);return true}if(script.match("WAMNewAlbumHit")&&errorCode==504){return true}if((location.href.match("/wog/")||location.href.match("i.php?xm=w"))&&script.match(/WAMReadFullAlbumList|WAMReadFullPhotoList/)&&errorCode==504){alert(errorMessage);return true}if(script.match("WAMHubRefreshSession")){return true}return false};var isServerErrorException=function(script){if(script.match("WAMHubRefreshSession")){return true}if(!script.match(/WAT|WAM|WAS/)){return true}if(script.match("WAMForgotPassword")){return true}if(script.match("WAMLogin")){return true}if(script.match("WAMSignup")){return true}if(script.match(".json")){return true}return false};try{var errorRefreshCounter=Number(PHOTOZIG.Utils.getCookie("errorRefreshCounter"))}catch(e){var errorRefreshCounter=Number(getCookie("errorRefreshCounter"))}if(!serverError){if(parsedResponse.result==="error"){var errorMessage=parsedResponse.error||"Service unavailable.";var errorCodeMatch=errorMessage.match(/ID\=(\d+)/i)||[];var errorCode=(typeof errorCodeMatch[1]!=="undefined"?errorCodeMatch[1]:0);if(!isErrorException(script,errorMessage,errorCode)&&errorRefreshCounter<MAX_ERROR_REFRESH){document.cookie="errorRefreshCounter="+(errorRefreshCounter+1)+";path=/";alert(errorMessage);$(window).unbind("unload");document.location.reload()}}}else{if(!isServerErrorException(script)&&errorRefreshCounter<MAX_ERROR_REFRESH){document.cookie="errorRefreshCounter="+(errorRefreshCounter+1)+";path=/";alert("This page may still be loading or service may be temporarily unavailable. Please wait a moment and try again.");document.location.reload()}}};if(typeof $!=="undefined"&&typeof $.ajax!=="undefined"){$(document).ajaxSuccess(function(event,xhr,options){var script=options.url;var parsedResponse={};switch(options.dataType){case"json":parsedResponse=eval("("+xhr.responseText+")");break;default:try{parsedResponse=PHOTOZIG.Utils.parseKeyValue(xhr.responseText)}catch(e){parsedResponse=parseKeyValue(xhr.responseText)}break}action(false,script,parsedResponse)});$(document).ajaxError(function(event,xhr,options){var script=options.url;action(true,script)});return}if(typeof YAHOO!=="undefined"&&typeof YAHOO.util!=="undefined"&&typeof YAHOO.util.Connect!=="undefined"){YAHOO.util.Connect.successEvent.subscribe(function(eventType,args){var script=args[0].argument.url;var parsedResponse={};try{parsedResponse=YAHOO.lang.JSON.parse(args[0].responseText)}catch(e1){try{parsedResponse=PHOTOZIG.Utils.parseKeyValue(args[0].responseText)}catch(e2){parsedResponse=parseKeyValue(args[0].responseText)}}action(false,script,parsedResponse)});YAHOO.util.Connect.failureEvent.subscribe(function(eventType,args){var script=args[0].argument.url;action(true,script)})}},registerGlobalWindowUnloadObserver:function(){var action=function(){document.cookie="errorRefreshCounter=0;path=/"};if(typeof YAHOO!=="undefined"&&typeof YAHOO.util!=="undefined"&&typeof YAHOO.util.Event!=="undefined"){YAHOO.util.Event.addListener(window,"unload",action)}else{if(typeof $!=="undefined"){$(window).unload(action)}}},screenAdjustments:function(equivalentContainerHeight){var isAllowed=($("body.webalbum, body.community").length>0)&&($(".content").outerHeight()!==null);var equivalentContainerHeight=equivalentContainerHeight||0;if(isAllowed){var action=function(){var contentHeight=($(".content").height()!==null)?$(".content").height():0;var contentHeightSaved=contentHeight;if(contentHeight>0){var mainHeight=(typeof $(".main").outerHeight()!=="undefined"&&$(".main").outerHeight()!==null)?$(".main").outerHeight():0;var suggestedHeight=(typeof $("#suggested").outerHeight()!=="undefined"&&$("#suggested").outerHeight()!==null)?$("#suggested").outerHeight():0;var leftHeight=(typeof $(".left").outerHeight()!=="undefined"&&$(".left").outerHeight()!==null)?$(".left").outerHeight():0;if(suggestedHeight>0){try{suggestedHeight=suggestedHeight+$("#suggested").position().top}catch(err){suggestedHeight=suggestedHeight+($("#suggested").css("top").replace("px","")*1)}}var floater1Height=(typeof $("#floater1").outerHeight()!=="undefined"&&$("#floater1").outerHeight()!==null)?$("#floater1").outerHeight():0;if(floater1Height>0){floater1Height=floater1Height+($("#floater1").css("top").replace("px","")*1)}var floater2Height=(typeof $("#floater2").outerHeight()!=="undefined"&&$("#floater2").outerHeight()!==null)?$("#floater2").outerHeight():0;if(floater2Height>0){floater2Height=floater2Height+($("#floater2").css("top").replace("px","")*1)}var floater3Height=(typeof $("#floater3").outerHeight()!=="undefined"&&$("#floater3").outerHeight()!==null)?$("#floater3").outerHeight():0;if(floater3Height>0){floater3Height=floater3Height+($("#floater3").css("top").replace("px","")*1)}var floater4Height=(typeof $("#floater4").outerHeight()!=="undefined"&&$("#floater4").outerHeight()!==null)?$("#floater4").outerHeight():0;if(floater4Height>0){floater4Height=floater4Height+($("#floater4").css("top").replace("px","")*1)}var screenHeight=320;if(typeof(window.innerHeight)=="number"){screenHeight=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientHeight)){screenHeight=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientHeight)){screenHeight=document.body.clientHeight}}}contentHeight=(contentHeight>=leftHeight)?contentHeight:leftHeight;contentHeight=(contentHeight>=mainHeight)?contentHeight:mainHeight;contentHeight=(contentHeight>=suggestedHeight)?contentHeight:suggestedHeight;contentHeight=(contentHeight>=floater1Height)?contentHeight:floater1Height;contentHeight=(contentHeight>=floater2Height)?contentHeight:floater2Height;contentHeight=(contentHeight>=floater3Height)?contentHeight:floater3Height;contentHeight=(contentHeight>=floater4Height)?contentHeight:floater4Height;contentHeight=(contentHeight>=equivalentContainerHeight)?contentHeight:equivalentContainerHeight;if(suggestedHeight>0||floater1Height>0||floater2Height>0||floater3Height>0||floater4Height>0){$(".content").css("min-height",contentHeight)}if(typeof isIE6Browser!=="undefined"&&isIE6Browser){var bottonHeight=(typeof $("#bottom").outerHeight()!=="undefined"&&$("#bottom").outerHeight()!==null)?$("#bottom").outerHeight():0;var headerHeight=$(".toggle_header").hasClass("less")?78:22;var adjustHeight=17;screenHeight=screenHeight-headerHeight-bottonHeight-adjustHeight;contentHeight=(contentHeight>=screenHeight)?contentHeight:screenHeight;$(".content").animate({height:contentHeight},"fast");$("#container").animate({height:(contentHeight+headerHeight+bottonHeight)},"slow")}}};action()}},init:function(){self.registerGlobalAjaxResponsesObserver();self.registerGlobalWindowUnloadObserver();self.refreshSession();self.checkCookiesEnabled()}};self.init();return self}();