/*
This file is assembled by studiVZ Ltd.
It contains files from different sources with the following copyrights:

SWF-Upload
2007-2009 Jake Roberts, http://www.swfupload.org
Licensed under the MIT (MIT-LICENSE.txt)
*/
var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)
}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(a){delete SWFUpload.instances[this.movieName];
throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Beta 3";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};
SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]
};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");
this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);
this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);
this.ensureDefault("button_placeholder_id",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;
this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);
this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;
if(this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+"?swfuploadrnd="+Math.floor(Math.random()*999999999)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){if(this.settings.button_placeholder_id!==""){this.replaceWithFlash()}else{this.appendFlash()}};
SWFUpload.prototype.appendFlash=function(){var b,a;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}b=document.getElementsByTagName("body")[0];if(b==undefined){throw"Could not find the 'body' element."}a=document.createElement("div");
a.style.width="1px";a.style.height="1px";a.style.overflow="hidden";b.appendChild(a);a.innerHTML=this.getFlashHTML();if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.replaceWithFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"
}a=document.getElementById(this.settings.button_placeholder_id);if(a==undefined){throw"Could not find the placeholder element."}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()
}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")
};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString();var a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(a),"&amp;params=",encodeURIComponent(b),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")
};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params;
var b=[];if(typeof(c)==="object"){for(var a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var a=null;a=this.getMovieElement();if(a){for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null
}}catch(d){}}try{a.parentNode.removeChild(a)}catch(b){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(d){return false
}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))
};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];
var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"
}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])
};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])
};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])
};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;
this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;
this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;
this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;
this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])
};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";
b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;
this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;
this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)
});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i;
var f={};var d;if(c!=undefined){for(var a in c.post){if(c.post.hasOwnProperty(a)){d=a;var b;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(typeof(a.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(b){}}}this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)
};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(a,b){this.queueEvent("file_dialog_complete_handler",[a,b])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);
this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"
}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])
};SWFUpload.prototype.uploadSuccess=function(b,a){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)
};SWFUpload.prototype.debugMessage=function(c){if(this.settings.debug){var a,d=[];if(typeof c==="object"&&typeof c.name==="string"&&typeof c.message==="string"){for(var b in c){if(c.hasOwnProperty(b)){d.push(b+": "+c[b])}}a=d.join("\n")||"";d=a.split("\n");a="EXCEPTION: "+d.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(a)
}else{SWFUpload.Console.writeLine(c)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(d){var b,a;try{b=document.getElementById("SWFUpload_Console");if(!b){a=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(a);b=document.createElement("textarea");b.id="SWFUpload_Console";
b.style.fontFamily="monospace";b.setAttribute("wrap","off");b.wrap="off";b.style.overflow="auto";b.style.width="700px";b.style.height="350px";b.style.margin="5px";a.appendChild(b)}b.value+=d+"\n";b.scrollTop=b.scrollHeight-b.clientHeight}catch(c){alert("Exception: "+c.name+" Message: "+c.message)}};Phx.Application.Modules.PhotoMoving=new function(){var A=this;
var z=null;var e=null;var g=null;var u=false;var l=null;var p=function(){var I=z.getElements();var D=e.getElements();var G;var H=false;var F=[];for(G=0;G<I.length;G++){if(I[G].inserted){H=true}else{I[G].selected=0;I[G].moved=false;F.push(I[G])}}if(H){z.setElements(F)}else{z.refresh()}H=false;var E=[];
for(G=0;G<D.length;G++){if(D[G].inserted){H=true}else{D[G].selected=0;D[G].moved=false;E.push(D[G])}}if(H){e.setElements(E)}else{e.refresh()}r(false);i(false)};var x=function(){if(g===null){return}var H="&firstAlbumId="+l;H+="&secondAlbumId="+g;var G=z.getElements();var D=e.getElements();var E;var F=false;
for(E=0;E<G.length;E++){if(G[E].inserted){H+="&firstAlbumPhotos[]="+G[E].i;F=true}}for(E=0;E<D.length;E++){if(D[E].inserted){H+="&secondAlbumPhotos[]="+D[E].i;F=true}}if(!F){return}Phx.AJAX.call("Photos_movePhotos",function(J,I){u=true;b(J.module.data.json)},A,H)};var n=function(D){D=D||{};l=D.albumId;
Phx.AJAX.call("Photos_movePhotosDialog",function(G,E){var F=new Phx.UI.Dialog.ButtonDialog(i18n.getText("photos_move_title"),{buttons:[new Phx.UI.Button.Submit(i18n.getText("photos_move_save"),"save"),new Phx.UI.Button.Cancel(i18n.getText("photos_move_revert"),"revert"),new Phx.UI.Button.Cancel(i18n.getText("photos_move_close"),"cancel")],message:G.module.data.html,events:{onButtonClicked:function(H){if(H=="save"){x();
v(false);return false}else{if(H==="revert"){p();v(false);return false}else{if(s()){var I=new Phx.UI.Dialog.Confirm(i18n.getText("photos_move_dialogclose_title"),{message:i18n.getText("photos_move_dialogclose_message"),events:{onButtonClicked:function(J){if("false"===J||false===J){return}F.close();if(D.callback){D.callback(u||D.alwaysChanged)
}}}});I.show();return false}if(D.callback){D.callback(u||D.alwaysChanged)}}}}}});F.show();d(G.module.data.json);v(false);q(F)},A,"&albumId="+l)};var c=function(E,D){return'<div style="padding: 5px;"><img src="'+E.u+'" alt="'+E.t+'"/></div>'};var C=function(E,D){if(E.moved){return"photoentry disabled"
}else{if(E.selected){return"photoentry highlighted"}else{return"photoentry"}}};var b=function(E){var D;for(D=0;D<E.f.p.length;D++){E.f.p[D].html=c;E.f.p[D].styleClass=C}z.setElements(E.f.p);for(D=0;D<E.s.p.length;D++){E.s.p[D].html=c;E.s.p[D].styleClass=C}e.setElements(E.s.p)};var d=function(E){g=E.s.a;
u=false;var D;for(D=0;D<E.f.p.length;D++){E.f.p[D].html=c;E.f.p[D].styleClass=C}z=$("#PhotoAlbums_MovePhotos_LeftContainer").longlist({elements:E.f.p,width:210,count:3,elementHeight:90});for(D=0;D<E.s.p.length;D++){E.s.p[D].html=c;E.s.p[D].styleClass=C}e=$("#PhotoAlbums_MovePhotos_RightContainer").longlist({elements:E.s.p,width:210,count:3,elementHeight:90});
i();r()};var s=function(){var F=false;var E=z.getElements();var D;for(D=0;D<E.length;D++){if(E[D].moved||E[D].inserted){F=true;break}}return F};var v=function(D){if(D===null||D===undefined){D=s()}if(D){$("#Photos_targetAlbum")[0].disabled=true;$($(".dialog-buttons a")[0]).removeClass("disabled");$($(".dialog-buttons a")[1]).removeClass("disabled")
}else{$("#Photos_targetAlbum")[0].disabled=false;$($(".dialog-buttons a")[0]).addClass("disabled");$($(".dialog-buttons a")[1]).addClass("disabled")}};var y=function(E){var D;for(D=0;D<E.s.p.length;D++){E.s.p[D].html=c;E.s.p[D].styleClass=C}e.setElements(E.s.p)};var q=function(D){$("#Mod-Photos-MovePhotos-Close").unbind("click.close").bind("click.close",function(){D.close()
});$("#PhotoAlbums_MovePhotos_LeftContainer").bind("itemclick",function(E,F){if(F.element.moved){F.htmlElement.addClass("disabled");F.htmlElement.removeClass("highlighted")}else{if(F.element.selected){F.element.selected=0;F.htmlElement.removeClass("disabled");F.htmlElement.removeClass("highlighted");
i()}else{F.element.selected=1;F.htmlElement.removeClass("disabled");F.htmlElement.addClass("highlighted");i(true)}}});$("#PhotoAlbums_MovePhotos_LeftContainer").bind("itemdblclick",function(E,F){if(F.element.moved){F.htmlElement.addClass("disabled");F.htmlElement.removeClass("highlighted")}else{w("#PhotoAlbums_MovePhotos_MoveRight",z,e,F.element,F.htmlElement);
i()}});$("#PhotoAlbums_MovePhotos_RightContainer").bind("itemclick",function(E,F){if(g===null){return}if(F.element.moved){F.htmlElement.addClass("disabled");F.htmlElement.removeClass("highlighted")}else{if(F.element.selected){F.element.selected=0;F.htmlElement.removeClass("disabled");F.htmlElement.removeClass("highlighted");
r()}else{F.element.selected=1;F.htmlElement.removeClass("disabled");F.htmlElement.addClass("highlighted");r(true)}}});$("#PhotoAlbums_MovePhotos_RightContainer").bind("itemdblclick",function(F,G){if(g===null){return}var E=$("#PhotoAlbums_MovePhotos_IsMobileAlbum").val();if(E=="1"){return}if(G.element.moved){G.htmlElement.addClass("disabled");
G.htmlElement.removeClass("highlighted")}else{w("#PhotoAlbums_MovePhotos_MoveLeft",e,z,G.element,G.htmlElement);r()}});$("#Photos_targetAlbum").bind("change",function(E,F){var G=$("#Photos_targetAlbum").val();if(G!==""){g=G;m(g)}else{$("#Photos_targetAlbum").val(g)}});$("#PhotoAlbums_MovePhotos_MoveRight").bind("click",function(E,F){B()
});$("#PhotoAlbums_MovePhotos_MoveLeft").bind("click",function(E,F){k()})};var w=function(J,G,D,N,H){if(g===null){return}var Q=G.getElements();var I=D.getElements();var O;var F=[];var M=false;var L=false;N.selected=0;if(N.inserted){N.remove=true;M=true;var E=[];for(O=0;O<Q.length;O++){if(!Q[O].remove){E.push(Q[O])
}else{for(j=0;j<I.length;j++){if(I[j].i==Q[O].i){I[j].moved=false}}}}G.setElements(E);D.add(-1,F,true);D.refresh();if(F.length){D.scrollToEnd()}v(L===true?true:null);return}var K={};var P;for(P in N){K[P]=N[P]}if(K.a==0){t(K,N,F,G,D)}else{K.inserted=true;N.moved=true;L=true;F.push(K);G.refresh();D.add(-1,F,true);
D.refresh();if(F.length){D.scrollToEnd()}v(L===true?true:null)}};var t=function(J,F,E,I,G,D){var H=new Phx.UI.Dialog.Confirm(i18n.getText("photos_move_restriction_confirm_title"),{message:i18n.getText("photos_move_restriction_confirm_dbc",F.u),events:{onButtonClicked:function(K){if("false"===K||false===K){I.refresh();
G.refresh();return}J.inserted=true;F.moved=true;changed=true;E.push(J);I.refresh();G.add(-1,E,true);G.refresh();if(E.length){G.scrollToEnd()}v(changed===true?true:null);if(D){$(D).removeClass("disabled");f(D,I,G)}}}});H.show()};var f=function(I,F,D){if($(I).hasClass("disabled")){return}var N=F.getElements();
var H=D.getElements();var L;var G=[];var M=[];var K=false;var J=false;for(L=0;L<N.length;L++){if(!N[L].selected){continue}N[L].selected=0;if(N[L].inserted){N[L].remove=true;K=true}else{M.push(N[L])}}if(M.length===1){w(I,F,D,M[0],M);return}if(K){var E=[];for(L=0;L<N.length;L++){if(!N[L].remove){E.push(N[L])
}else{for(j=0;j<H.length;j++){if(H[j].i==N[L].i){H[j].moved=false}}}}F.setElements(E);D.add(-1,G,true);D.refresh();if(G.length){D.scrollToEnd()}v(J===true?true:null);return}a(G,M,0,F,D)};var a=function(F,K,G,E,D){var H=false;if(!K.length||G===2){if(G===2){F=[]}E.refresh();D.add(-1,F,true);D.refresh();
if(F.length){H=true;D.scrollToEnd()}v(H===true?true:null);return}var J=K.pop();if(G===1||J.a===1){var I={};var M;for(M in J){I[M]=J[M]}I.inserted=true;J.moved=true;F.push(I);return a(F,K,G,E,D)}var L=new Phx.UI.Dialog.Confirm("foo",{message:i18n.getText("photos_move_restriction_confirm",J.u),events:{onButtonClicked:function(N){var Q=$("#confirmChoice").get(0).checked;
if("false"===N||false===N){if(Q){G=2}window.setTimeout(function(){return a(F,K,G,E,D)},200);return}if(Q){G=1}var P={};var O;for(O in J){P[O]=J[O]}P.inserted=true;J.moved=true;F.push(P);window.setTimeout(function(){return a(F,K,G,E,D)},200)}}});L.show()};var B=function(){f("#PhotoAlbums_MovePhotos_MoveRight",z,e);
i(false)};var k=function(){f("#PhotoAlbums_MovePhotos_MoveLeft",e,z);r(false)};var r=function(G){if(!g){G=false}if(G===null||G===undefined){var E=e.getElements();var D;G=false;for(D=0;D<E.length;D++){if(E[D].selected){G=true;break}}}var F=$("#PhotoAlbums_MovePhotos_IsMobileAlbum").val();if(G&&F!="1"){$("#PhotoAlbums_MovePhotos_MoveLeft").removeClass("disabled")
}else{$("#PhotoAlbums_MovePhotos_MoveLeft").addClass("disabled")}};var i=function(F){if(!g){F=false}if(F===null||F===undefined){var E=z.getElements();var D;F=false;for(D=0;D<E.length;D++){if(E[D].selected){F=true;break}}}if(F){$("#PhotoAlbums_MovePhotos_MoveRight").removeClass("disabled")}else{$("#PhotoAlbums_MovePhotos_MoveRight").addClass("disabled")
}};var m=function(D){Phx.AJAX.call("Photos_albumPhotos",function(F,E){b(F.module.data.json);i();r()},A,"&firstAlbumId="+l+"&secondAlbumId="+D)};this.init=function(){};this.movePhotosShowDialog=n}();Phx.Application.Modules.PhotoSorting=new function(){var me=this;this.captionShortLength=10;this.PHOTO_ID_STRING="photo_";
this.rotatedPictureStack={};var _lastSaveState=null;var _bindRotating=function(){var _$scope=$("#photoList");var _$rotateRight=$(".rotateRight",_$scope);var _$rotateLeft=$(".rotateLeft",_$scope);_$rotateRight.bind("click.photoSorting",me.rotatePicture);_$rotateLeft.bind("click.photoSorting",me.rotatePicture)
};this.rotatePicture=function(){var _albumId=$("#albumId").val();var _photoId=$(this).parents(".editPhotoBox").attr("id").substr(me.PHOTO_ID_STRING.length);var _direction=$(this).attr("class")=="rotateRight"?1:-1;var _$photo=$("#"+me.PHOTO_ID_STRING+_photoId);if(!me.rotatedPictureStack[_photoId]){me.getRotatedPictureStack(_direction,_albumId,_photoId);
return}for(var i=0,len=me.rotatedPictureStack[_photoId].length;i<len;i++){var _$scope=me.rotatedPictureStack[_photoId][i];if(_$scope.currentlyDisplayed===0){continue}_$scope.currentlyDisplayed=0;if(_direction===-1){var _pointer=((i-1)===-1)?3:(i-1);var _src=me.rotatedPictureStack[_photoId][_pointer].url;
me.rotatedPictureStack[_photoId][_pointer].currentlyDisplayed=1;break}if(_direction===1){var _pointer=((i+1)===4)?0:(i+1);var _src=me.rotatedPictureStack[_photoId][_pointer].url;me.rotatedPictureStack[_photoId][_pointer].currentlyDisplayed=1;break}}_$photo.css("background-image","url("+_src+")")};this.getRotatedPictureStack=function(direction,albumId,photoId){var metaForm="Photos_rotatePhoto";
var paramString="&albumId="+albumId+"&photoId="+photoId;var _$photo=$("#"+me.PHOTO_ID_STRING+photoId);Phx.Application.RequestRegistry.append({1:metaForm,2:function(data){if(data.module.data.error){if(data.module.data.error==100){Phx.UI.Dialog.Alert(i18n.getText("photos_error_rotating_headline"),i18n.getText("photos_error_rotating_message")).show()
}else{Phx.UI.Dialog.Alert(i18n.getText("error_head"),i18n.getText("error_ajax_"+Phx.Util.getPlatformId())).show()}return}var _sources=eval(data.module.data.rotatedImages);var _pointer=(direction===-1)?3:1;var _newSrc="";me.rotatedPictureStack[photoId]=[];for(var i=0,len=_sources.length;i<len;i++){if(i===_pointer){_newSrc=_sources[i]
}var _helper={url:_sources[i],currentlyDisplayed:(i===_pointer)?1:0};me.rotatedPictureStack[photoId].push(_helper)}_newSrc=(_newSrc==="")?_sources[0]:_newSrc;_$photo.css("background-image","url("+_newSrc+")")},3:this,4:paramString})};var _getSaveState=function(){var state="";var sortedPhotos="";var deletedPhotos="";
$("#photoList .editPhotoBox").each(function(){var fields=this.id.split("_");if($(this).children("input").get(0).checked){deletedPhotos+="&deletedPhotos[]="+fields[1]}else{sortedPhotos+="&sortedPhotos[]="+fields[1]}});var _rotateParams="";for(var _photoId in me.rotatedPictureStack){var _len=me.rotatedPictureStack[_photoId].length;
for(var i=0;i<_len;i++){if(me.rotatedPictureStack[_photoId][i].currentlyDisplayed===1&&i!==0){_rotateParams+="&photoIds"+i+"[]="+_photoId;break}}}return sortedPhotos+deletedPhotos+_rotateParams};var _updateLastSaveState=function(){_lastSaveState=_getSaveState()};var _isStateSaved=function(){return _lastSaveState===_getSaveState()
};this.saveChanges=function(e,d,callback){if(e){Phx.Event.stop(e)}var sortedPhotos="";var deletedPhotos="";var deletedPhotosArray=[];$("#photoList .editPhotoBox").each(function(){var fields=this.id.split("_");if($(this).children("input").get(0).checked){deletedPhotos+="&deletedPhotos[]="+fields[1];deletedPhotosArray.push(fields[1])
}else{sortedPhotos+="&sortedPhotos[]="+fields[1]}});if($("#photoList .editPhotoBox").length==0){$("#listContainer").hide();$("#emptyMsg").show()}var _rotateParams="";for(var _photoId in me.rotatedPictureStack){var _len=me.rotatedPictureStack[_photoId].length;for(var i=0;i<_len;i++){if(me.rotatedPictureStack[_photoId][i].currentlyDisplayed===1&&i!==0){_rotateParams+="&photoIds"+i+"[]="+_photoId;
break}}}if(deletedPhotos){var confirmDialog=Phx.UI.Dialog.Confirm(i18n.getText("photos_delete_confirm"),{message:i18n.getText("photos_delete_confirm"),events:{onButtonClicked:function(result){if("false"===result||false===result){return}$.each(deletedPhotosArray,function(key,id){$("#"+me.PHOTO_ID_STRING+id).remove()
});me.saveAlbumChanges(callback,sortedPhotos,deletedPhotos,_rotateParams)}}});confirmDialog.show()}else{me.saveAlbumChanges(callback,sortedPhotos,deletedPhotos,_rotateParams)}};this.saveAlbumChanges=function(callback,sortedPhotos,deletedPhotos,_rotateParams){Phx.AJAX.call("Photos_saveAlbumChanges",function(data,$ptr){me.rotatedPictureStack={};
if(data.module.data.photoIdMapping.length){eval("var _photoIdMapping = "+data.module.data.photoIdMapping+";");for(var _oldPhotoId in _photoIdMapping){var _newPhotoId=_photoIdMapping[_oldPhotoId];$("#"+me.PHOTO_ID_STRING+_oldPhotoId).attr("id",me.PHOTO_ID_STRING+_newPhotoId);$("#"+_oldPhotoId).val(_newPhotoId);
$("#"+_oldPhotoId).attr("id",_newPhotoId);$("label[for="+_oldPhotoId+"]").attr("for",_newPhotoId)}}if(!callback){Phx.UI.Dialog.Alert(i18n.getText("changes_saved_head"),i18n.getText("changes_saved_content")).show()}_updateLastSaveState();if(callback){callback()}},me,"&albumId="+$("#albumId").val()+sortedPhotos+deletedPhotos+_rotateParams)
};this.toggleImg=function(e){var id=this.value;var el=$("#photo_"+id).get(0);if(this.checked){me.bgStyles[id]=el.style.backgroundImage;el.style.backgroundImage="url("+$("#deleteImg").attr("src")+")";$(".rotateLeft",el).hide();$(".rotateRight",el).hide()}else{$(".rotateLeft",el).show();$(".rotateRight",el).show();
el.style.backgroundImage=me.bgStyles[id]}};this.changeCaption=function(e,obj){Phx.Event.stop(e);var $this=$(this);var fields=$this.parents(".editPhotoBox").get(0).id.split("_");var photoId=fields[1];var _captionHidden=$("input[name=fullCaption]",$this.parent());var pictureTitle=_captionHidden.val().trim();
if(pictureTitle=="Titel geben"){pictureTitle=""}Phx.AJAX.call("Photos_editPhoto",function(data,$ptr){var editDialog=new Phx.UI.Dialog.HTML(i18n.getText("change_photo_title"),{message:data.module.data.html});editDialog.show();var obj=$("#Photos_caption");obj.val(pictureTitle);Phx.Application.Setup.Core();
$("#Photos_EditTitle .link-face-button").unbind().bind("click",function(e){Phx.Event.stop(e);editDialog.close()});$("#Photos_EditTitle form").submit(Phx.Application.Modules.Forms.bindAjaxForms).bind("formSuccess",function(event,data){var caption=obj.val();if(caption!=""){$this.text(me.truncate(caption,me.captionShortLength,"..."));
_captionHidden.val(caption)}else{$this.text(i18n.getText("assign_title"));_captionHidden.val(i18n.getText("assign_title"))}editDialog.close()});$("#Photos_caption").focus()},me,"&photoId="+photoId+"&albumId="+$("#albumId").val()+"&ajaxGet=1")};this.onStopSort=function(){if($.browser.msie){_bindSortables()
}};this.truncate=function(str,length,add){return(str.length>length?str.substr(0,length)+(add?add:""):str)};this.init=function(){if($("#photoList").length==0){return}me.bgStyles=[];$("#photoListForm").submit(this.saveChanges);_bindSortables();_bindRotating();_bindMovePhotos();_updateLastSaveState()};var _movePhotosFinished=function(changed){if(changed){document.location.reload()
}};var _movePhotosShowDialog=function(param){if(param===undefined){param=false}Phx.Application.Modules.PhotoMoving.movePhotosShowDialog({callback:_movePhotosFinished,alwaysChanged:param,albumId:$("#albumId").val()})};var _movePhotos=function(ev,data){if(!_isStateSaved()){var movePhotoConfirmDialog=new Phx.UI.Dialog.ButtonDialog(i18n.getText("photos_move_confirm_title"),{buttons:[new Phx.UI.Button.Submit(i18n.getText("photos_move_confirm_save"),"save"),new Phx.UI.Button.Cancel(i18n.getText("photos_move_confirm_revert"),"revert"),new Phx.UI.Button.Cancel(i18n.getText("photos_move_confirm_cancel"),"cancel")],message:i18n.getText("photos_move_confirm_message"),events:{onButtonClicked:function(decision){if(decision=="save"){me.saveChanges(null,null,_movePhotosShowDialog)
}else{if(decision==="revert"){_movePhotosShowDialog(true)}else{}}}}});movePhotoConfirmDialog.show();return}_movePhotosShowDialog()};var _bindMovePhotos=function(){$("#Mod-Photos-Action-Movephotos").unbind("click.movephotos").bind("click.movephotos",_movePhotos)};var _bindSortables=function(){$("#photoList .editPhotoBox input").unbind("click.toggle").bind("click.toggle",me.toggleImg);
$("#photoList .captionLink").attr("href","javascript:;").unbind("click.caption").bind("click.caption",me.changeCaption);$("#photoList").sortable({start:function(){$("#photoList").sortable("disable")},opacity:0.6,revert:true,scroll:true,stop:function(){$("#photoList>*:hidden").css("visibility","");$("#photoList").sortable("enable");
$(".editPhotoBox").css("opacity",1)}})}}();Phx.namespace("Phx.Application.Modules.PhotosDiashow",new function(){var self=this;var photoData=[];var loadedImages={};var current=-1;var count=0;var timer;var lastdone=true;var lasttime=(new Date).valueOf();var waitForPhoto=null;var diaShowInterval=3000;var ivwEventData=null;
var __showPhoto=function(idx){if(current==idx||!lastdone){return}lastdone=false;var data=photoData[idx];if(data){__showPhotoDataCallback(idx);idx+=3;if(idx>=count){idx=0}if(!photoData[idx]){self.load(idx)}return}self.load(idx,function(){__showPhotoDataCallback(idx)})};var __showPhotoDataCallback=function(idx){var url=photoData[idx].imageBig;
_countPhotoHit(photoData[idx].photoId);if(loadedImages[url]){waitForPhoto=null;__showPhotoPreloaderCallback(idx);return}waitForPhoto=idx};var _countPhotoHit=function(photoId){if($("#photoHitsInactive").length!=0){return}Phx.AJAX.call("Photos_hitcounter",function(data,$ptr){},self,{photoGuid:photoId})
};var __domPreloaderCallback=function(){loadedImages[this.src]=true;this.onload=null;this.onerror=null;if(waitForPhoto==this.index){__showPhotoPreloaderCallback(this.index);waitForPhoto=null}};var __showPhotoPreloaderCallback=function(idx){var old=current;current=idx;function markDone(){lastdone=true;
lasttime=(new Date).valueOf()}function fadeIn(fade){var domPos=photoData[idx].dom;var winWidth=$(window).width();var winHeight=$(window).height();var photoEl=$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")")[0];var photoWidth=photoEl.offsetWidth;var photoHeight=photoEl.offsetHeight;var photoLeft=Math.round((winWidth-photoWidth)/2);
var photoTop=Math.min(30,Math.max(0,Math.round((winHeight-photoHeight)/2)));$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").css("display","none").css("visibility","visible").css("left",photoLeft+"px").css("top",photoTop+"px");if(fade===false){$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").show();
markDone()}else{$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").fadeIn("slow",markDone)}$(".Snipplet-Photos-Diashow .control .current").html(idx+1);$(".Snipplet-Photos-Diashow .title").css("left",photoLeft+"px").css("top",(photoTop+photoHeight+20)+"px").css("width",photoWidth+"px").html($(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").attr("alt"))
}function switchHide(){var domPos=photoData[old].dom;$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").css("visibility","hidden").css("display","inline");fadeIn()}function fadeOut(){var domPos=photoData[old].dom;$(".Snipplet-Photos-Diashow .photo img:eq("+domPos+")").fadeOut("fast",switchHide)}if(old!=-1){fadeOut()
}else{fadeIn(false);self.start()}};var __interval=function(){var now=(new Date).valueOf();if(lastdone&&now>(lasttime+diaShowInterval)){if((current+1)<count){__showPhoto(current+1)}else{__showPhoto(0)}}};var __resize=function(){var controlOffset=(Math.round($(window).width()/2)-30-136-300)+"px";$(".Snipplet-Photos-Diashow .header, .Snipplet-Photos-Diashow .control").css("left",controlOffset);
var currentImg=$(".Snipplet-Photos-Diashow .photo img:visible")[0];if(currentImg){var leftPos=Math.round(($(window).width()-currentImg.offsetWidth)/2);currentImg.style.left=leftPos+"px";$(".Snipplet-Photos-Diashow .title")[0].style.left=leftPos+"px"}};this.open=function(){if(ReloadPixelImages&&ivwEventData){ReloadPixelImages.apply(self,ivwEventData)
}current=-1;if(!$.browser.mozilla){$("body").css("overflow","hidden");$("html").css("overflow","hidden");if($.browser.opera){$(".Snipplet-Photos-Diashow").css("position","fixed")}}else{$(".Snipplet-Photos-Diashow").css("position","fixed")}document.body.scrollTop=document.documentElement.scrollTop=0;$(".Snipplet-Photos-Diashow").show();
if(!this._controlsInitialized){$(".Snipplet-Photos-Diashow .control .exit").click(function(){self.exit()});$(".Snipplet-Photos-Diashow .control .play").click(function(){self.start()});$(".Snipplet-Photos-Diashow .control .stop").click(function(){self.stop()});$(".Snipplet-Photos-Diashow .control .next").click(function(){self.next()
});$(".Snipplet-Photos-Diashow .control .previous").click(function(){self.previous()});$(".Snipplet-Photos-Diashow .control .slow").click(function(){diaShowInterval=10000});$(".Snipplet-Photos-Diashow .control .medium").click(function(){diaShowInterval=6000});$(".Snipplet-Photos-Diashow .control .fast").click(function(){diaShowInterval=3000
});count=parseInt($(".Snipplet-Photos-Diashow input[name=photoCount]").val(),10);$(".Snipplet-Photos-Diashow .control .all").html(count);this._controlsInitialized=true;$(window).resize(__resize)}__resize();__showPhoto(parseInt($(".Snipplet-Photos-Diashow input[name=currentIdx]").val(),10))};this.exit=function(){var data=photoData[current];
if(data){$(".Snipplet-Photos-Diashow .photo img:eq("+data.dom+")").hide()}this.stop();$(".Snipplet-Photos-Diashow").hide();if(!$.browser.mozilla){$("body").css("overflow","");$("html").css("overflow","")}if("function"==typeof ResetPixelImages){ResetPixelImages()}ivwEventData=null};this.start=function(){if(!timer){timer=window.setInterval(__interval,200);
$(".Snipplet-Photos-Diashow .control .stop").show();$(".Snipplet-Photos-Diashow .control .play").hide()}};this.stop=function(){if(timer){window.clearInterval(timer);timer=null;$(".Snipplet-Photos-Diashow .control .play").show();$(".Snipplet-Photos-Diashow .control .stop").hide()}};this.next=function(){this.stop();
__showPhoto(Math.min(count-1,current+1))};this.previous=function(){this.stop();__showPhoto(Math.max(0,current-1))};this.load=function(offset,callback){var data="&offset="+offset;$(".Snipplet-Photos-Diashow input[type=hidden]").each(function(){var name=$(this).attr("name");if(!(name=="photoCount"||name=="currentIdx"||name=="diashowInterval")){data+="&"+name+"="+$(this).val()
}});Phx.Application.RequestRegistry.append({1:"Photos_getDiashowData",2:function(data){var photos=eval(data.module.data.photoData);if(data.module.data.eventData!=null&&ivwEventData===null){ivwEventData=JSON.parse(data.module.data.eventData);if(ReloadPixelImages){ReloadPixelImages.apply(this,ivwEventData)
}}for(var i=0,l=photos.length;i<l;i++){if(photoData[offset+i]){continue}photoData[offset+i]=photos[i];if(photos[i].imageBig==null){throw new Error("Missing or invalid image data!")}var img=new Image;img.index=offset+i;img.onload=__domPreloaderCallback;img.onerror=__domPreloaderCallback;img.src=photos[i].imageBig;
img.alt=photos[i].title;img.oncontextmenu=function(){return false};$(".Snipplet-Photos-Diashow .photo")[0].appendChild(img);photoData[offset+i].dom=$(".Snipplet-Photos-Diashow .photo")[0].childNodes.length-1}if(callback!=null){callback()}},3:self,4:data})};this.init=function(){var diashowContainer=$(".Snipplet-Photos-Diashow")[0];
if(diashowContainer){document.body.appendChild(diashowContainer);$("a.diashow").click(function(){self.open()})}}});Phx.Application.Modules.PhotosEditAlbum=new function(){var a=this;this.init=function(){this.bindSelectors()};this.bindSelectors=function(){this.visibilityState=$("#Photos_visibility").get(0)?$("#Photos_visibility").get(0).value:null;
this.visibilityStateExt=$("#Photos_visibilityExt").get(0)?$("#Photos_visibilityExt").get(0).value:null;$("#Photos_visibility").change(function(){if(this.value>a.visibilityState){$("#Photo_HintVisibility").show()}else{$("#Photo_HintVisibility").hide()}});$("#Photos_visibilityExt").change(function(){if(this.value>a.visibilityStateExt){$("#Photo_HintVisibilityExt").show()
}else{$("#Photo_HintVisibilityExt").hide()}})}}();Phx.Application.Modules.MigrationHelper={init:function(){if($("#PhotoAlbums_Migration").length>0){$("#continueMigrationHint").hide();this.disableButtons()}},disableButtons:function(){var b=$("#disabledButtons").val().split(",");for(var a in b){if(b[a]){this.hideSecureButton(b[a])
}}},showWriteDialog:function(c,b){var a=c;var d=this;Phx.Application.RequestRegistry.append({1:"Photos_writeMsg",2:Phx.Util.createDelegate(function(l,g){var k=Phx.UI.Dialog.HTML(i18n.getText("message_write"),{message:l.module.data.html});k.show();$("#del_"+a).hide();$("#Messages_searchfield").hide();
if(typeof Phx.Application.Modules.MessagesEmoticons!=="undefined"){Phx.Application.Modules.MessagesEmoticons.init()}if(typeof Phx.Application.Modules.WriteMessage!=="undefined"){Phx.Application.Modules.WriteMessage.init();Phx.Application.Modules.WriteMessage.setResultboxPosition()}var f=$("#Messages_WriteForm");
if(typeof Phx.Application.Modules.Messages!=="undefined"){Phx.Application.Modules.Messages.bindHistory("Photos_history")}var e=$("#backLink",f);e.attr("href","javascript:;");e.unbind("click.closeDialog").bind("click.closeDialog",function(){k.close()});var i=$("#write-message-buttonArea");f.submit(Phx.Application.Modules.Forms.bindAjaxForms).bind("formSuccess",function(n,p){k.close();
d.hideSecureButton($(b).attr("id"));d.sendButtonIds($(b).attr("id"));var m=Phx.UI.Dialog.Alert(i18n.getText("message_sent_head"),{message:i18n.getText("message_sent_content")});m.show()}).bind("formError",function(m,n){if(n.module.errors&&n.module.errors.form.fields[0]=="recipientIds"){$("#Messages_searchfield").addClass("invalidNested");
$(".autocompleteContainer").addClass("invalid");$("#recipientError").html(n.module.errors.form.messages.recipientIds).removeClass("hidden")}})},this),3:this,4:"&recipientIds[]="+a+"&type=migration"})},sendButtonIds:function(a){Phx.AJAX.call("Photos_ajaxDisabledButtons",function(b){},this,"&buttonId="+a)
},hideSecureButton:function(a){$("#"+a).attr("disabled","disabled").fadeTo(500,0.5);$(".continueMigration").attr("disabled","disabled").fadeTo(500,0.5);$("#continueMigrationHint").show()}};function PhotoNoteContainer(b,a){var c={element:b,notes:new Array(),editing:false,editMode:false};for(var d in c){this[d]=(!a||typeof a[d]=="undefined")?c[d]:a[d]
}}PhotoNoteContainer.prototype.DeleteNote=function(c){c.UnSelect();this.element.removeChild(c.gui.ElementRect);this.element.removeChild(c.gui.ElementNote);var b=[];for(var a=0;a<this.notes.length;a++){if(this.notes[a]==c){result=true}else{b.push(this.notes[a])}}this.notes.length=0;for(var a=0;a<b.length;
a++){this.notes.push(b[a])}b=null};PhotoNoteContainer.prototype.DeleteAllNotes=function(){var d=this.notes.concat();for(var c=0,a=d.length;c<a;c++){var b=this.notes[c];var e=this.GetNote(b.taggedId);e.UnSelect();this.element.removeChild(e.gui.ElementRect);this.element.removeChild(e.gui.ElementNote)}d.length=0
};PhotoNoteContainer.prototype.AddNote=function(a){if(this.editing){return}this.notes[this.notes.length]=a;a.container=this;this.element.appendChild(a.gui.ElementRect);this.element.appendChild(a.gui.ElementNote)};PhotoNoteContainer.prototype.HideAllNoteTexts=function(){for(var a=0;a<this.notes.length;
a++){this.notes[a].HideNoteText()}};PhotoNoteContainer.prototype.HideAllNotes=function(){for(var a=0;a<this.notes.length;a++){this.notes[a].HideNote();this.notes[a].HideNoteText()}};PhotoNoteContainer.prototype.ShowAllNotes=function(){for(var a=0;a<this.notes.length;a++){this.notes[a].ShowNote()}};PhotoNoteContainer.prototype.GetNote=function(a){for(var b=0;
b<this.notes.length;b++){if(this.notes[b].taggedId==a){return this.notes[b]}}};function PhotoNote(g,d,b,f,a){var c={id:g,rect:d,selectOptions:b,text:f,selected:false,container:null,oldRect:null,onsave:null,ondelete:null,gui:null,taggedId:a};for(var e in c){this[e]=c[e]}this.CreateElements();return this
}PhotoNote.prototype.Select=function(){if(this.container.editing){return}if(!this.isOwner){Phx.UI.Dialog.Alert(i18n.getText("error_head"),i18n.getText("error_link_ownership_"+Phx.Util.getPlatformId())).show();return}this.ShowNoteText();this.selected=true;this.SetEditable(true);this.PositionNote();this.container.selectedNote=this
};PhotoNote.prototype.UnSelect=function(){this.selected=false;this.SetEditable(false);this.HideNoteText();this.container.selectedNote=null};PhotoNote.prototype.Save=function(){if(this.gui.SelectBox.selectedIndex<0){return}this.oldRect=null;this.gui.TextTitle.innerHTML=this.text;this.UnSelect()};PhotoNote.prototype.Cancel=function(){if(this.id==0){this.container.DeleteNote(this)
}else{if(this.oldRect!=null){this.rect=this.oldRect}this.oldRect=null;this.UnSelect()}};PhotoNote.prototype.Highlight=function(){this.gui.ElementRect.firstChild.src=$("#crosshairHighlight").get(0).src};PhotoNote.prototype.UnHighlight=function(){this.gui.ElementRect.firstChild.src=$("#crosshair").get(0).src
};PhotoNote.prototype.ShowNoteText=function(){this.StopFadeOutNoteText();if(this.container.editing){return}this.container.HideAllNoteTexts();this.gui.ElementNote.style.display="block";$(this.gui.ElementNote).show();this.PositionNote()};PhotoNote.prototype.FadeOutNoteText=function(){var a=this;this.__fadeOutTimer=window.setTimeout(function(){a.HideNoteText();
a.__fadeOutTimer=null},200)};PhotoNote.prototype.StopFadeOutNoteText=function(){if(this.__fadeOutTimer){window.clearTimeout(this.__fadeOutTimer);this.__fadeOutTimer=null}};PhotoNote.prototype.HideNoteText=function(){this.gui.ElementNote.style.display="none"};PhotoNote.prototype.HideNote=function(){this.gui.ElementRect.style.display="none"
};PhotoNote.prototype.ShowNote=function(){this.gui.ElementRect.style.display="block"};PhotoNote.prototype.SetEditable=function(a){this.container.editing=a;if(a){this.gui.TextTitle.style.display="none";this.gui.EditArea.style.display="block";if(this.id==0){this.gui.ButtonOk.style.display="inline";this.gui.ButtonDelete.style.display="none";
if(this.gui.SelectBox.options.length==0){this.gui.SelectSearchBox.style.display="none";this.gui.SelectBox.style.display="none";this.gui.Hint.style.display="none";this.gui.ErrorNoFriends.style.display="block"}else{this.gui.SelectSearchBox.style.display="block";this.gui.SelectBox.style.display="block";
var b=this;setTimeout(function(){b.gui.SelectBox.style.visibility="visible"},200);this.gui.Hint.style.display="block";this.gui.ErrorNoFriends.style.display="none";this.HighlightSelectSearchBox()}}else{this.gui.ButtonOk.style.display="none";this.gui.Hint.style.display="none";this.gui.SelectSearchBox.style.display="none";
this.gui.SelectBox.style.display="none";this.gui.DeleteText.innerHTML=Phx.Application.Modules.PhotoTagging.getDeleteText(this.taggedId);this.gui.DeleteText.style.display="block";this.gui.ButtonDelete.style.display="inline"}}else{this.gui.TextTitle.style.display="block";this.gui.EditArea.style.display="none"
}};PhotoNote.prototype.HighlightSelectSearchBox=function(){if(this.gui.EditArea.style.display=="block"){var a=this.gui.SelectSearchBox;setTimeout(function(){try{a.focus();a.select()}catch(b){}},200)}};PhotoNote.prototype.HighlightTextbox=function(){if(this.gui.EditArea.style.display=="block"){var a=this.gui.TextBox;
setTimeout(function(){try{a.focus();a.select()}catch(b){}},200)}};PhotoNote.prototype.CreateElements=function(){this.gui=new PhotoNoteGUI();var c=document.createElement("div");c.className="fn-area";c.id="fn-area-"+this.taggedId;var s=document.createElement("img");s.alt="";s.src=$("#crosshair").get(0).src;
var k=this;addEvent(c,"mouseover",function(){k.Highlight();k.ShowNoteText();$("#tag-"+k.taggedId+" a.text").addClass("highlighted")});addEvent(c,"mouseout",function(){if(!k.selected){k.FadeOutNoteText();k.UnHighlight();$("#tag-"+k.taggedId+" a.text").removeClass("highlighted")}});addEvent(c,"click",function(v){if(!k.container.editMode){window.location=k.href;
return}if(!k.selected){cancelEvent(v,true);k.Select()}});c.appendChild(s);var t=document.createElement("div");t.className="fn-note";addEvent(t,"mousemove",function(){k.StopFadeOutNoteText()});addEvent(t,"mouseout",function(){if(!k.container.editing){k.FadeOutNoteText()}});var p=document.createElement("div");
p.className="fn-note-text";p.innerHTML=this.text;t.appendChild(p);var g=document.createElement("div");g.className="fn-note-edit";var b=document.createElement("div");var r=document.createElement("input");r.type="button";r.className="button disabled";r.value=i18n.getText("ok");r.disabled="disabled";r.onclick=function(w){cancelEvent(w,true);
if(k.onsave){k.taggedId=k.gui.SelectBox.options[k.gui.SelectBox.selectedIndex].value;var v=k.onsave(k);if(v>0){k.id=v;k.Save()}else{alert("error saving note");k.Cancel()}}else{alert("onsave must be implemented in order to *actually* save");k.Cancel()}};r.setDisabled=function(v){if(v){k.gui.ButtonOk.className="button disabled";
k.gui.ButtonOk.disabled="disabled";return}k.gui.ButtonOk.className="button";k.gui.ButtonOk.disabled=null};var u=document.createElement("input");u.type="button";u.className="button";u.value=i18n.getText("remove");u.onclick=function(w){cancelEvent(w,true);if(k.ondelete){var v=k.ondelete(k);if(v){k.container.DeleteNote(k)
}else{alert("error deleting note")}}else{alert("ondelete must be implemented in order to *actually* delete")}};if(this.selectOptions){var n=document.createElement("div");var m=function(w,v){newOption=document.createElement("option");newOption.value=w;if(v.disabled){newOption.disabled="disabled"}if(v.festival){newOption.style.backgroundColor="#cccccc"
}newOption.appendChild(document.createTextNode(v.content));return newOption};n.className="fn-note-edit-select";var a=document.createElement("input");a.type="text";a.value="";a.onkeyup=function(x){k.gui.ButtonOk.setDisabled(true);k.gui.SelectBox.options.length=0;var v=0;var w=null;for(var y in k.selectOptions){if("function"!=typeof(k.selectOptions[y])&&k.selectOptions[y].content.toLowerCase().indexOf(this.value.toLowerCase())!=-1){++v;
k.gui.SelectBox.appendChild(w=m(y,k.selectOptions[y]));w.selected=false}}if(1==v&&w){w.selected=true;r.setDisabled(false)}};a.onkeydown=function(v){var v=window.event?window.event:v;if(v.keyCode==13){cancelEvent(v,true);r.onclick();return false}};var q=document.createElement("select");q.size=7;var f=0;
var d=null;for(var l in this.selectOptions){if("function"!=typeof(this.selectOptions[l])){q.appendChild(d=m(l,this.selectOptions[l]));d.selected=false}}if(1==f&&d){d.selected=true;r.setDisabled(false)}q.onfocus=q.onblur=q.onchange=function(){k.gui.ButtonOk.setDisabled(this.selectedIndex<0)};newErrorNoFriends=document.createElement("p");
newErrorNoFriends.innerHTML=i18n.getText("photos_no_more_friends_to_link_"+Phx.Util.getPlatformId());newErrorNoFriends.style.display="none";n.appendChild(a);n.appendChild(q);n.appendChild(newErrorNoFriends);g.appendChild(n)}b.appendChild(r);b.appendChild(u);deleteText=document.createElement("div");deleteText.style.display="none";
deleteText.className="fn-delete-text";g.appendChild(deleteText);var e=document.createElement("input");e.type="button";e.className="button";e.value=i18n.getText("cancel");e.onclick=function(v){cancelEvent(v,true);k.Cancel()};b.appendChild(e);var i=document.createElement("div");i.className="Photos_hiddenFriendsHint";
i.appendChild(document.createTextNode(i18n.getText("photos_private_friends_are_hidden")));b.appendChild(i);g.appendChild(b);t.appendChild(g);this.gui.ElementRect=c;this.gui.Img=s;this.gui.ElementNote=t;this.gui.EditArea=g;this.gui.SelectSearchBox=a;this.gui.ErrorNoFriends=newErrorNoFriends;this.gui.SelectBox=q;
this.gui.TextTitle=p;this.gui.DeleteText=deleteText;this.gui.ButtonOk=r;this.gui.ButtonDelete=u;this.gui.Hint=i;this.PositionNote()};PhotoNote.prototype.PositionNote=function(){this.gui.ElementRect.style.position="absolute";this.gui.ElementRect.style.left=this.rect.left+"px";this.gui.ElementRect.style.top=this.rect.top+"px";
this.gui.ElementRect.style.width=this.rect.width+"px";this.gui.ElementRect.style.height=this.rect.height+"px";var a=this.gui.ElementNote.offsetWidth;if(a>50&&this.rect.left>350){this.gui.ElementNote.style.left=(this.rect.left+this.rect.width-a-3)+"px"}else{this.gui.ElementNote.style.left=(this.rect.left+5)+"px"
}this.gui.ElementNote.style.top=(this.rect.top+6+this.rect.height)+"px"};function PhotoNoteGUI(){this.ElementRect=null;this.ElementNote=null;this.TextTitle=null;this.EditArea=null;this.SelectSearchBox=null;this.SelectBox=null;this.ButtonDelete=null}function PhotoNoteRect(d,c,b,a){this.left=d;this.top=c;
this.width=b;this.height=a}PhotoNoteRect.prototype.toString=function(){return"left: "+this.left+", top: "+this.top+", width: "+this.width+", height: "+this.height};var aeOL=[];function addEvent(m,p,k,e){var d="addEventListener",i="on"+p,c="",g="";if(m[d]&&!e){return m[d](p,k,false)}m._c|=0;if(m[i]){c="_f"+m._c++;
m[c]=m[i]}g="_f"+m._c++;m[g]=k;m[i]=function(b){b=b||window.event;var a=true;if(c){a=m[c](b)!=false&&a}a=m[g](b)!=false&&a;return a};aeOL[aeOL.length]={o:m,h:i}}addEvent(window,"unload",function(){for(var i=0;i<aeOL.length;i++){with(aeOL[i]){o[h]=null;for(var c=0;o["_f"+c];c++){o["_f"+c]=null}}}});function cancelEvent(a,b){if(!a){a=window.event
}if(!a){return}a.returnValue=false;if(a.preventDefault){a.preventDefault()}if(b){a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation()}}}function addLoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}}Phx.Application.Modules.PhotoTagging=new function(){var b=this;
var a=2;b.taggedUsers={};this.fixSeparators=function(){var d=$("#Mod-Photos-Album .photo-tagging span.tag");for(var f=0,c=d.length;f<c;f++){var k=d[f];var g=d[f+1];var e=true;if(g){if(k.className.indexOf("user-delete")!=-1||g.className.indexOf("user-delete")!=-1){e=false}}else{e=false}e?$(k).removeClass("last-child"):$(k).addClass("last-child")
}};this.toggleEditNote=function(){var c=$("#Mod-Photos-Album .photo-tagging span.tag");if(b.notes.editMode&&c.length==0){$("#Mod-Photos-Album .photo-tagging .edithint").show()}else{$("#Mod-Photos-Album .photo-tagging .edithint").hide()}if(c.length>0){$("#Mod-Photos-Album .photo-tagging .nolinksyet").hide()
}else{$("#Mod-Photos-Album .photo-tagging .nolinksyet").show()}};this.loadAllowedUsers=function(d,c){c=true!==c?false:true;if(b.allowedUsers){d();return}Phx.AJAX.call("Photos_allowedUsers",function(f,e){b.allowedUsers=f.module.data.allowedUsers;b.currentUser=f.module.data.user;d()},b,"&photoId="+$("#photoId").val()+"&albumId="+$("#albumId").val())
};this.resetAllowedUsers=function(){b.allowedUsers=null};this.addNote=function(i,f,c){if(this.notes.editing){return}var d=[];for(var g in b.allowedUsers){if("function"!=typeof(b.allowedUsers[g])&&a!=parseInt(b.allowedUsers[g]["permition"])){d[g]={temporary:true===b.allowedUsers[g]["temporary"],disabled:true===b.allowedUsers[g]["disabled"],content:b.allowedUsers[g].firstName+" "+b.allowedUsers[g].lastName,festival:b.allowedUsers[g]["festival"]}
}}var e=new PhotoNote(c?b.taggedUsers[c].id:0,new PhotoNoteRect(i,f,49,49),d,this.getNoteText(c),c);e.onsave=this.onSaveNote;e.ondelete=this.onDeleteNote;e.isOwner=c?b.taggedUsers[c].isOwner:true;e.href=c?b.profileLink+c:null;this.notes.AddNote(e);if(!c){e.Select()}};this.onSaveNote=function(k){b.taggedUsers[this.taggedId]=b.allowedUsers[this.taggedId];
delete b.allowedUsers[this.taggedId];var g=this;Phx.AJAX.call("Photos_addTag",function(n,m){g.id=n.module.data.tagId;b.taggedUsers[g.taggedId].id=g.id;if(true===n.module.data.temporary){b.taggedUsers[g.taggedId]["temporary"]=true;Phx.UI.Dialog.ButtonDialog(i18n.getText("hint_head"),{message:i18n.getText("photos_tag_is_temporarily").cc("<b>"+(b.taggedUsers[g.taggedId].firstName+" "+b.taggedUsers[g.taggedId].lastName).escapeHtml()+"</b>"),buttons:[new Phx.UI.Button.Submit(i18n.getText("close"),true)]}).show()
}},b,"&photoId="+$("#photoId").val()+"&albumId="+$("#albumId").val()+"&taggedId="+g.taggedId+"&x="+(g.rect.left+25)+"&y="+(g.rect.top+25));b.taggedUsers[this.taggedId].x=this.rect.left+25;b.taggedUsers[this.taggedId].y=this.rect.top+25;b.taggedUsers[this.taggedId].ownerId=b.currentUser.id;b.taggedUsers[this.taggedId].ownerFirstName=b.currentUser.firstName;
b.taggedUsers[this.taggedId].ownerLastName=b.currentUser.lastName;b.taggedUsers[this.taggedId].isOwner=true;this.text=b.getNoteText(this.taggedId);var i=b.taggedUsers[this.taggedId];this.href=this.taggedId?b.profileLink+this.taggedId:null;var f=document.createElement("span");f.className="tag user-delete removable";
f.id="tag-"+this.taggedId;if(this.taggedId!=b.currentUser.id){f.className+=" toggleable"}var l=document.createElement("a");l.className="text";l.href=b.profileLink+this.taggedId;l.innerHTML=(i.firstName+" "+i.lastName).escapeHtml();f.appendChild(l);var c=document.createElement("a");c.className="delete";
f.appendChild(c);var g=this;$(f).mouseover(function(){b.linkMouseOver(g)}).mouseout(function(){b.linkMouseOut(g)});$(c).click(function(){var m=this.parentNode.id.substring(4);b.removeTag(m)});if(b.taggedUsers[this.taggedId].festival===true){$(".photo-metainfo .photo-tagging")[0].appendChild(f)}else{var d=$("#removeall")[0];
if(d){d.parentNode.insertBefore(f,d)}else{var e=$(".photo-tagging")[0];e.appendChild(f)}}b.fixSeparators();b.toggleEditNote();if($("#Mod-Photos-Album span.removable").length>1){$("#removeall").fadeIn()}return 1};this.onDeleteNote=function(){var c=b.taggedUsers[this.taggedId];if(!c.isOwner){return 0}Phx.AJAX.call("Photos_removeTag",function(){},b,"&tagId="+c.id+"&albumId="+$("#albumId").val()+"&temporary="+(c.temporary==true?1:0));
if(b.allowedUsers){b.allowedUsers[this.taggedId]=b.taggedUsers[this.taggedId]}delete b.taggedUsers[this.taggedId];$("span#tag-"+this.taggedId).remove();b.fixSeparators();b.toggleEditNote();if($("#Mod-Photos-Album span.removable").length==1){$("#removeall").fadeOut()}return 1};this.getNoteText=function(c){if(!c){return""
}if(taggedUsers[c]){var d=b.taggedUsers[c];return"<b>"+(d.firstName+" "+d.lastName).escapeHtml()+"</b><br />"+d.uni+"<br /><br />"+i18n.getText("marked_by")+': <br /><a href="'+b.profileLink+d.ownerId+'">'+(d.ownerFirstName+" "+(d.ownerLastName!=null?d.ownerLastName:"")).escapeHtml()+"</a>"}};this.getDeleteText=function(c){var d=b.taggedUsers[c];
return"<b>"+(d.firstName+" "+d.lastName).escapeHtml()+"</b> <br />"+i18n.getText("marked_by")+"<br /><b>"+(d.ownerFirstName+" "+(d.ownerLastName!=null?d.ownerLastName:"")).escapeHtml()+"</b> <br />"+i18n.getText("remove")+"?<br />&nbsp;<br />"};this.mouseWithinContainer=function(d){var c=$("#PhotoContainer")[0];
var e=this.getEventOffset(d);return e.x>0&&e.y>0&&e.x<c.offsetWidth&&e.y<=c.offsetHeight};this.getEventOffset=function(d){var c=$("#PhotoContainer").offset();return{x:d.pageX-c.left,y:d.pageY-c.top}};this.bindContainer=function(){var c=true;var d;b.notes=new PhotoNoteContainer($("#PhotoContainer").get(0));
$("#PhotoContainer").mouseover(function(f){if(b.notes.editMode){return}if(!c){b.notes.ShowAllNotes()}c=true});$("#PhotoContainer").mouseout(function(f){if(b.notes.editMode){return}if(b.mouseWithinContainer(f)!=false){return}if(c){b.notes.HideAllNotes()}c=false});$("#PhotoContainer").click(function(f){if(!b.notes.editMode){return
}Phx.Event.stop(f);var g=b.getEventOffset(f);b.addNote(g.x-25,g.y-25,0)});$("#startEdit").click(function(f){b.loadAllowedUsers(function(){b.notes.editMode=true;$("#startEdit").hide();$("#stopEdit").fadeIn();if($("#Mod-Photos-Album span.removable").length>1){$("#removeall").fadeIn()}b.notes.ShowAllNotes();
$(".photo-tagging .toggleable").addClass("user-delete").removeClass("user-link");$("#PhotoContainer").addClass("edit-mode");b.fixSeparators();b.toggleEditNote()})});$("#stopEdit").click(function(f){if(b.notes.selectedNote){b.notes.selectedNote.Cancel()}b.notes.editMode=false;$("#stopEdit").hide();$("#startEdit").fadeIn();
$("#removeall").hide();$(".photo-tagging .toggleable").addClass("user-link").removeClass("user-delete");$("#PhotoContainer").removeClass("edit-mode");b.notes.HideAllNotes();c=false;b.fixSeparators();b.toggleEditNote()});for(var d in taggedUsers){b.addNote(b.taggedUsers[d].x-25,b.taggedUsers[d].y-25,d)
}$(".delete",$(".photo-tagging")).click(function(){var e=this.parentNode.id.substring(4);b.removeTag(e)});$(".photo-tagging span.tag").mouseover(function(){var e=$(this).attr("id").substring(4);b.linkMouseOver(b.notes.GetNote(e))}).mouseout(function(){var e=$(this).attr("id").substring(4);b.linkMouseOut(b.notes.GetNote(e))
});b.notes.HideAllNotes();if(typeof taggedUsers!="undefined"){if(taggedUsers[d]&&taggedUsers[d]["temporary"]){$("#Mod-Photos-Album span#tag-"+d).mouseover()}}c=false};this.removeTag=function(c){var d=function(f){if(f=="true"){var e=b.notes.GetNote(c);e.ondelete(e);b.notes.DeleteNote(e);$("#Mod-Photos-Album span#tag-"+c).remove();
$("#Mod-Photos-Album span.removable").length>1?$("#removeall").show():$("#removeall").hide();b.fixSeparators()}};if($("#PhotoContainer").hasClass("edit-mode")){return d("true")}Phx.UI.Dialog.Confirm(i18n.getText("remove_marker"),{message:i18n.getPText("sure_to_remove_marker"),buttons:[new Phx.UI.Button.Submit(i18n.getText("agree_remove_marker"),true),new Phx.UI.Button.Cancel(i18n.getText("disagree"),false)],events:{onButtonClicked:d}}).show()
};this.removeAllTags=function(){Phx.UI.Dialog.Confirm(i18n.getText("remove_marker"),{message:i18n.getPText("sure_to_remove_all_marker"),buttons:[new Phx.UI.Button.Submit(i18n.getText("agree_remove_all_marker"),true),new Phx.UI.Button.Cancel(i18n.getText("disagree"),false)],events:{onButtonClicked:function(c){if(c=="true"){Phx.AJAX.call("Photos_removeAllTags",function(e,d){if(true===e.module.data.html){b.notes.DeleteAllNotes();
$("#Mod-Photos-Album span.removable").remove();b.resetAllowedUsers();b.loadAllowedUsers(function(){},true);$("#removeall").hide();b.fixSeparators()}},b,"&photoId="+$("#photoId").val())}}}}).show()};this.linkMouseOver=function(c){if(b.notes.editMode){c.Highlight();c.ShowNoteText()}else{c.ShowNote();c.Highlight();
c.ShowNoteText()}};this.linkMouseOut=function(c){c.UnHighlight();if(!b.notes.editMode){c.HideNote();c.HideNoteText()}};this.init=function(){if($("#photoId").val()){$("#removeall a").click(function(c){Phx.Event.stop(c);b.removeAllTags()});$("#stopEdit").hide();if(typeof taggedUsers!="undefined"){b.taggedUsers=taggedUsers
}if(typeof profileLink!="undefined"){b.profileLink=profileLink}b.bindContainer();b.fixSeparators();b.toggleEditNote();$.each($(".fn-note-text"),function(){var c=$("b",$(this)).html();c=c.split("&amp;#34;").join('"');c=c.split("&amp;#39;").join("'");$("b",$(this)).html(c)})}}}();if(!Phx.Lang){Phx.Lang={}
}Phx.Lang.Function={bind:function(b,a){return function(){b.apply(a,arguments)}}};Phx.UploadItem=function(b,c){var a=Math.round(Math.max(1,b.size/1024));this.__file=b;this.__title=b.name;this.__size=a+" KB";this.__parent=c;this.render()};Phx.UploadItem.prototype.__maxWidth=180;Phx.UploadItem.prototype.isQuiteBig=function(){return(this.__file.size/1024/1024)>1.5
};Phx.UploadItem.prototype.render=function(){var f=document.createElement("div");var e=document.createElement("div");var c=document.createElement("div");var g=document.createElement("a");var d=document.createElement("div");var b=document.createElement("div");this.__elem=f;f.className="item clearfix";
e.className="box";c.className="label";g.className="close";d.className="size";b.className="progress";c.innerHTML=this.__title.escapeHtml();if(this.isQuiteBig()){d.innerHTML=this.__size+" - "+$("#flashUpload .flashtext .quitebig").html()}else{d.innerHTML=this.__size}e.appendChild(c);e.appendChild(g);e.appendChild(b);
f.appendChild(e);f.appendChild(d);this.__parent.appendChild(f);var a=this;$(g).click(function(){$(a.__elem).fadeOut();Phx.Application.Modules.PhotoUpload.closeItem(a)})};Phx.UploadItem.prototype.getFile=function(){return this.__file};Phx.UploadItem.prototype.progress=function(a){if(a==this.__percent){return
}this.__percent=a;this.__completed=Math.round(this.__file.size*a/100/1024);$(".size",this.__elem).html(this.__completed+"/"+this.__size);this.setProgressPercent(a)};Phx.UploadItem.prototype.done=function(a){$(".box",this.__elem).addClass("successful");this.setProgressPercent(100);$(".size",this.__elem).html($("#flashUpload .flashtext .success").html())
};Phx.UploadItem.prototype.start=function(){};Phx.UploadItem.prototype.cancel=function(){$(".box",this.__elem).addClass("cancelled");this.setProgressPercent(100)};Phx.UploadItem.prototype.tobig=function(){$(".box",this.__elem).addClass("tobig");this.setProgressPercent(100);$(".size",this.__elem).html($("#flashUpload .flashtext .tobig").html())
};Phx.UploadItem.prototype.error=function(){$(".box",this.__elem).addClass("errornous");this.setProgressPercent(100)};Phx.UploadItem.prototype.setProgressPercent=function(a){$(".progress",this.__elem).css("width",(a*this.__maxWidth/100)+"px")};Phx.Application.Modules.PhotoUpload={__items:{},__uploading:false,__maxSize:100,init:function(){var a=$("input[name=albumId]").val();
this.initFlash()},getTicketStatus:function(a){var b=$("input[name=janitorTicket]").val();if(b=="failed"){$("input[name=janitorTicket]").val(a);return"failed"}else{if(b.length>0){return b}}return"progress"},resetTicketUrl:function(){$("input[name=janitorTicket]").val("")},getTicketUrl:function(){var a=$("input[name=albumId]").val();
$.ajax({dataType:"json",url:"/Photos/AddPhotos/"+a,success:function(b){var c=document.location.protocol+"//"+document.location.host+b.url;$("input[name=janitorTicket]").val(c)},error:function(){$("input[name=janitorTicket]").val("failed")}})},logDebug:function(a){console.log("flash debug: "+a)},initFlash:function(){if($("#flashUpload").length==0){return
}if(!swfobject.hasFlashPlayerVersion("9")){$("#flashUploadIssue").show();return}$("#flashUpload").show();var d=function(f){var e=parseInt(f,10).toString(16);return e.length<2?"0"+e:e};var c=function(f){var e=/rgb\(([0-9]+)\, ([0-9]+), ([0-9]+)\)/g.exec(f);if(e){return"#"+d(e[1])+d(e[2])+d(e[3])}return f
};var b=function(g){var f={};var e=$("input[type=hidden]",g).each(function(){f[this.name]=this.value});var e=$("input[type=checkbox]",g).each(function(){f[this.name]=this.checked?"on":"off"});return f};var a={flash_url:"/Flash/swfupload-janitor-0.1.swf",upload_url:$("#flashUpload form")[0].getAttribute("action"),post_params:b($("#flashUpload form")[0]),file_size_limit:"500 MB",file_types:$("#flashUpload .flashtext .mimetypes").html(),file_types_description:$("#flashUpload .flashtext .mimelabel").html(),file_upload_limit:1000,file_queue_limit:100,button_width:"196",button_height:"18",button_image_url:"/Img/swfupload_bg.png",button_placeholder_id:"photoUploadSelect",button_text:'<span class="upbtn">'+$("#photoUploadSelect").html()+"</span>",button_text_style:".upbtn { font-family:Tahoma,Verdana,Arial,Helvetica,sans-serif; font-size:11px; color:"+c($("#flashUpload .flashtext .buttoncolor").css("color"))+" }",button_text_left_padding:3,button_text_top_padding:0,file_dialog_start_handler:Phx.Lang.Function.bind(this.dialogStart,this),file_dialog_complete_handler:Phx.Lang.Function.bind(this.dialogComplete,this),file_queue_error_handler:Phx.Lang.Function.bind(this.dialogError,this),upload_start_handler:Phx.Lang.Function.bind(this.uploadStart,this),upload_progress_handler:Phx.Lang.Function.bind(this.uploadProgress,this),upload_error_handler:Phx.Lang.Function.bind(this.uploadError,this),upload_success_handler:Phx.Lang.Function.bind(this.uploadSuccess,this),upload_complete_handler:Phx.Lang.Function.bind(this.uploadComplete,this),janitor_ticket_handler:Phx.Lang.Function.bind(this.getJanitorTicket,this),janitor_ticket_status_handler:Phx.Lang.Function.bind(this.getTicketStatus,this),upload_janitor_ticket:$("input[name=janitorTicket]").val()};
if(a.upload_url==""){a.upload_url=location.href}this.__swfu=new SWFUpload(a);this.__uploadButton=$("#flashUpload .form .upload")[0];this.__stopButton=$("#flashUpload .form .cancel")[0];this.__onUploadClick=Phx.Lang.Function.bind(this._onUploadClick,this);this.__onStopClick=Phx.Lang.Function.bind(this._onStopClick,this);
$(this.__uploadButton).bind("click",this.__onUploadClick);$(this.__stopButton).bind("click",this.__onStopClick)},_onUploadClick:function(a){this.startUpload()},_onStopClick:function(a){this.stopUpload()},_onSuccessDialog:function(a){if(a===true||a==="true"){window.location.href=$("#flashUpload .buttonbar .edit").attr("href")
}},closeItem:function(b){var a=b.getFile();delete this.__items[a.id];this.__swfu.cancelUpload(a.id)},startUpload:function(){if(this.__uploading){return}this.__swfu.addPostParam("autoCaption",$("#autoCaption")[0].checked?1:0);this.__uploading=true;this.__swfu.startUpload()},stopUpload:function(){if(this.__uploading){this.__swfu.stopUpload();
this.__swfu.cancelUpload();this.__uploading=false}},updateState:function(){var b=this.__swfu.getStats();if(this.__uploading){$("#flashUpload .list").show();$("#flashUpload .buttonbar .upload").hide();$("#flashUpload .buttonbar .edit").hide();$("#flashUpload .buttonbar .cancel").show();$("#flashUpload .legalnote").show();
$("#flashUpload .captionswitch").hide()}else{$("#flashUpload .buttonbar .cancel").hide();if(b.files_queued>0){$("#flashUpload .buttonbar .upload").show();$("#flashUpload .legalnote").show();$("#flashUpload .buttonbar .edit").hide();$("#flashUpload .captionswitch").show()}else{$("#flashUpload .buttonbar .upload").hide();
$("#flashUpload .legalnote").hide();$("#flashUpload .captionswitch").hide();if(b.successful_uploads>0){$("#flashUpload .buttonbar .edit").show()}}$("#flashUpload .list").show();if($("#flashUpload .list .item:visible").length===0){$("#flashUpload .list").hide()}}var a=this.__items;var c=0;for(var d in a){if(a[d].isQuiteBig()&&(++c)>1){break
}}if(this.__uploading||c==0){$("#flashUpload .quitebighelp-multi").hide();$("#flashUpload .quitebighelp-single").hide()}else{if(c>1){$("#flashUpload .quitebighelp-multi").show();$("#flashUpload .quitebighelp-single").hide()}else{if(c>0){$("#flashUpload .quitebighelp-multi").hide();$("#flashUpload .quitebighelp-single").show()
}}}},dialogStart:function(){$("#flashUpload .queueerror").hide()},dialogError:function(a,c,b){$("#flashUpload .queueerror").show()},dialogComplete:function(e,a){var l=$("#flashUpload .list")[0];var k=this.__items;var d=this.__swfu;var g=d.getStats();var m=g.files_queued+g.upload_cancelled+g.upload_errors+g.successful_uploads+g.queue_errors;
for(var f=m-a;f<m;f++){var c=d.getFile(f);var b=c.id;var n=k[b]=new Phx.UploadItem(c,l);if(c.size==0||(c.size/1024/1024)>this.__maxSize){n.tobig();d.cancelUpload(b)}}this.updateState()},uploadStart:function(a){this.__items[a.id].start();this.updateState()},uploadProgress:function(b,a,d){var c=Math.ceil((a/d)*100);
this.__items[b.id].progress(c)},uploadedFilePaths:[],uploadSuccess:function(a,b){this.uploadedFilePaths.push(JSON.parse(b));this.__items[a.id].done();this.updateState()},uploadError:function(a,d,c){var b=this.__items[a.id];if(b){if(d==-280){b.error()}else{b.cancel()}}if(console&&console.debug){console.debug("Error: "+a.id+": "+d+" :: "+c)
}this.updateState()},uploadComplete:function(d){var b=this.__items;var e=b[d.id];delete b[d.id];if(!this.__uploading){return}var c=this.__swfu.getStats();if(c.files_queued){for(var a in b){this.__swfu.startUpload();return}}this.__uploading=false;this.updateState()}};Phx.Application.Modules.Photos=new function(){var b=this;
var a=function(){var c=$(".comment-text");$.each(c,function(d){c[d].innerHTML=Phx.Util.linkify(c[d].innerHTML,{wrap:80})});$(".Snipplet-Photos-PhotoComments").fadeIn()};this.init=function(){if($(".Snipplet-Photos-PhotoComments").length>0){this.bindPhotoList()}};this.bindPhotoList=function(){a();var d=[".Snipplet-Photos-PhotoComments"];
$(".Snipplet-Photos-PhotoComments form").submit(Phx.Application.Modules.Forms.bindAjaxForms);$(".Snipplet-Photos-PhotoComments form").bind("formSuccess",function(f,g){var e=g.module.data.html;if(false!==e){$("textarea#Photos_comment").resetForm();$(".Snipplet-Photos-PhotoComments").fadeOut(300,function(){$(".Snipplet-Photos-PhotoComments").replaceWith(e);
var i=$("#Photos_comment").get(0);if(i){i.value=""}b.bindPhotoList()})}});var d=[".Snipplet-Photos-PhotoComments"];var c;while(c=d.shift()){$(".link-comment-delete",$(c)).click(function(f){f.preventDefault();var g=$(this);var e=function(n){if(n=="true"||n===true){var i=g.children('input[name="ownerId"]').val();
var k=g.children('input[name="photoGuid"]').val();var l=g.children('input[name="albumId"]').val();var m=g.children('input[name="commentId"]').val();Phx.AJAX.call("Photos_deleteComment",function(r,p){var q=$(".Snipplet-Photos-PhotoComments");if(q.length&&false!==r.module.data.html){q.fadeOut(300,function(){q.replaceWith(r.module.data.html);
b.bindPhotoList()})}},"","&commentId="+m+"&ownerId="+i+"&photoGuid="+k+"&albumId="+l)}};Phx.UI.Dialog.Confirm(i18n.getText("delete_confirm"),{message:i18n.getText("delete_confirm"),events:{onButtonClicked:e}}).show()})}};this.onSaveMyImagesButton=function(c,d,e){Phx.Util.createDelegate(Phx.Application.Modules.MigrationHelper.showWriteDialog,Phx.Application.Modules.MigrationHelper)(e.receipentId,d)
}}();Phx.namespace("Phx.Application.Modules.Album",new function(){this.init=function(){var a=new Phx.Application.ContextMenu();a.build();if($("#album-description").length!==0){$("#album-description").html(Phx.Util.linkify($("#album-description").html(),{wrap:100}));$("#album-description").fadeIn()}}}());
Phx.namespace("Phx.Application.Modules.PhotosAlbumLinking",(function(){return{init:function(){Phx.Application.Modules.PhotosAlbumLinking.controller.construct();var b=$(".group-album-remove-link");var a=$(".group-album-link");if(b.length===0&&a.length===0){return}b.unbind("click").bind("click",function(){var d=$("input[name=group-remove-albumid]",$(this).parent()).val();
var c=$("input[name=group-remove-objectid]",$(this).parent()).val();Phx.Application.Modules.PhotosAlbumLinking.controller.showConfirmDeleteDialog(d,c,"object")});a.unbind("click").bind("click",function(f){Phx.Event.stop(f);var g=$(this).parent().parent("li").attr("id");var d=g.split(":");var e=d["1"];
var c=$("input[name=groupid]").val();Phx.Application.Modules.PhotosAlbumLinking.controller.linkAlbumDialog(e,c,"group")})},bindContextUnlink:function(){var b=$("#linkedAlbumId").val();var a=$("#linkedObjectId").val();Phx.Application.Modules.PhotosAlbumLinking.controller.showConfirmDeleteDialog(b,a,"album")
},bindContextLink:function(){var a=$("#linkedAlbumId").val();Phx.Application.Modules.PhotosAlbumLinking.models.main.getLinkAlbumObjectDialog(a,"group","album")}}})());Phx.Application.Modules.PhotosAlbumLinking.models={};Phx.Application.Modules.PhotosAlbumLinking.models.main={getLinkAlbumObjectDialog:function(b,a,d){var c="";
c+="&objectType="+a;c+="&albumId="+b;Phx.AJAX.callproxy("Photos_linkAlbumDialog",function(f){var e=Phx.UI.Dialog.HTML(i18n.getText("photos_link_album_title"),{message:f.module.data.html});e.show();Phx.Application.Modules.PhotosAlbumLinking.controller.bindAlbumObjectLinkDialog(e,d)},"",c,"POST")},createObjectAlbum:function(c,b,a,e){var d="";
d+="&albumId="+c;d+="&objectType="+b;d+="&objectId="+a;d+="&redirect="+e;Phx.AJAX.callproxy("Photos_linkAlbum",function(){},"",d,"POST")},deleteObjectAlbum:function(c,b,a,e){var d="";d+="&albumId="+c;d+="&objectType="+b;d+="&objectId="+a;d+="&redirect="+e;Phx.AJAX.callproxy("Photos_unlinkAlbum",function(){},"",d,"POST")
},linkObjectAlbum:function(c,b,a,e){var d="";d+="&albumId="+c;d+="&objectType="+b;d+="&objectId="+a;Phx.AJAX.callproxy("Photos_linkAlbumFromGroup",function(){},"",d,"POST")}};Phx.Application.Modules.PhotosAlbumLinking.view=function(){this.linkToObjectAlbumLink=$("#link-object-album")};Phx.Application.Modules.PhotosAlbumLinking.controller=(function(){var b=new Phx.Application.Modules.PhotosAlbumLinking.view();
var a=Phx.Application.Modules.PhotosAlbumLinking.models;return{bindAlbumObjectLinks:function(){var g=$('#PhotoAlbums_Edit input[name="albumId"]').val();var e=this;b.linkToObjectAlbumLink.unbind("click").bind("click",function(){a.main.getLinkAlbumObjectDialog(g,"group","albumedit")});var f=$('#PhotoAlbums_Edit input[name="groupLinkNumber"]').val();
for(var k=0;k<f;k++){var d=$("#unlink-object-album-"+k);var c=$('#PhotoAlbums_Edit input[name="groupId-'+k+'"]').val();d.unbind("click").bind("click",{groupId:c},function(i){e.showConfirmDeleteDialog(g,i.data.groupId,"albumedit")})}},bindAlbumObjectLinkDialog:function(e,g){var d=$(".Snipplet-Photos-LinkAlbum ul > li > input");
var c=$(".Snipplet-Photos-LinkAlbum ul > li");d.unbind("click").bind("click",function(){c.removeClass("selected");$(this).parent().addClass("selected");var i=$("#linkalbum-submit");i.removeAttr("disabled").removeClass("disabled").unbind("click").bind("click",function(){var k=$(".Snipplet-Photos-LinkAlbum ul li.selected input").attr("value");
var l=$("#linkedAlbumId").val();a.main.createObjectAlbum(l,"group",k,g);e.close()})});var f=$("#linkalbum-cancel");f.unbind("click").bind("click",function(){e.close()})},showConfirmDeleteDialog:function(e,d,f){var c=$("meta[name=platformId]").attr("content").toLowerCase();Phx.UI.Dialog.ButtonDialog(i18n.getText("photos_unlink_album_title"),{message:i18n.getText("photos_unlink_album_message_"+c),buttons:[new Phx.UI.Button.Submit(i18n.getText("photos_unlink_album_submit"),true),new Phx.UI.Button.Cancel(i18n.getPText("dialogbutton_cancel"),false)],events:{onButtonClicked:function(g){if(g=="true"){a.main.deleteObjectAlbum(e,"group",d,f)
}}}}).show()},linkAlbumDialog:function(e,d){var c=$("meta[name=platformId]").attr("content").toLowerCase();Phx.UI.Dialog.ButtonDialog(i18n.getText("photos_link_album_title"),{message:i18n.getText("photos_link_album_message_"+c),buttons:[new Phx.UI.Button.Submit(i18n.getText("photos_link_album_submit"),true),new Phx.UI.Button.Cancel(i18n.getPText("dialogbutton_cancel"),false)],events:{onButtonClicked:function(f){if(f=="true"){a.main.linkObjectAlbum(e,"group",d)
}}}}).show()},construct:function(){this.bindAlbumObjectLinks()}}}());Phx.namespace("Phx.Application.Modules.PhotoDialog",new function(){var i=this;var t=null;var k=null;var p=-1;var q=-1;var c=-1;var d=null;var r=null;var n=null;var g=null;var b=function(v,u,w){return'<span class="photoframe"><img alt="" src="'+v.imageSmall+'"/></span><span class="name ellipsis">'+v.name.escapeHtml()+"</span>"
};var s=function(v,u,w){return'<span class="photoframe"><img alt="" src="'+v.imageSmall+'"/></span><span class="name ellipsis">'+v.title.escapeHtml()+"</span>"};var e=function(v,u){if(v.selected){return"selected"}else{return""}};var a=function(u){Phx.AJAX.call("Photos_getAlbumPhotos",function(x,v){c=-1;
d=null;if(!u.enableChooseAlbum){n.removeClass("hidden");r.addClass("hidden").hide()}var w;for(w=0;w<x.module.data.photos.length;w++){x.module.data.photos[w].html=s;x.module.data.photos[w].styleClass=e}k.setElements(x.module.data.photos)},i,"&offset=0&limit=999&albumId="+q)};var f=function(){if($("#notificationRefId").val()===undefined){return false
}if($("#notificationUserGuid").val()===undefined){return false}var v=$("#notificationRefId").val();var u=$("#notificationUserGuid").val();(new Image()).src="http://"+window.location.host+"/notificator/v1/ref/"+encodeURIComponent(v)+"/user/"+u;return true};var m;var l;this.closeDialog=function(){l.close();
if(m){m()}};this.choosePhoto=function(w,u){var v=$.extend({},{title:i18n.getText("blog_select_photo"),ok:i18n.getText("ok"),cancel:i18n.getPText("chat_logout_cancel"),leftHeader:null,rightHeader:null,prefix:null,prefixSanitize:true,suffix:null,enableChooseAlbum:false,callbackAfterDisplay:function(){},callbackAfterClose:function(){}},w);
m=v.callbackAfterClose;Phx.AJAX.call("Photos_getUserAlbums",function(z,x){l=Phx.UI.Dialog.ButtonDialog(v.title,{message:z.module.data.html,buttons:[new Phx.UI.Button.Submit(v.ok,true),new Phx.UI.Button.Cancel(v.cancel,false)],events:{onButtonClicked:function(A){if("false"===A||false===A){if(m){m()}return
}if(d){u(d)}else{if(g){u(g)}}}}});l.show();if(v.prefix){if(v.prefixSanitize){$("#PhxDialog0 .dialog-prefix").removeClass("hidden").text(v.prefix)}else{$("#PhxDialog0 .dialog-prefix").removeClass("hidden").html(v.prefix)}}if(v.suffix){$("#PhxDialog0 .dialog-suffix").removeClass("hidden").text(v.suffix)
}if(v.leftHeader){$("#PhxDialog0 .dialog-header-left").text(v.leftHeader)}if(v.rightHeader){$("#PhxDialog0 .dialog-header-right").text(v.rightHeader)}v.callbackAfterDisplay();r=$("#PhxDialog0 .dialog-buttons a:first-child");r.addClass("hidden").hide();$("#PhxDialog0 .dialog-buttons").prepend('<input class="button disabled" type="button" value="'+v.ok+'"/>');
n=$("#PhxDialog0 .dialog-buttons input:first-child");p=-1;q=-1;c=-1;d=null;var y;for(y=0;y<z.module.data.albums.length;y++){z.module.data.albums[y].html=b;z.module.data.albums[y].styleClass=e}t=$("#Blog-Albums-Container").longlist({elements:z.module.data.albums,width:210,count:3,elementHeight:95,renderType:"ul",elementHeightDiff:5});
k=$("#Blog-Photos-Container").longlist({elements:[],width:210,count:3,elementHeight:95,renderType:"ul",elementHeightDiff:5});$("#Blog-Albums-Container").bind("itemclick",function(A,B){if(B.listindex==p){return}B.element.selected=1;B.htmlElement.addClass("selected");if(p>=0){B.list.getElements()[p].selected=0;
B.list.refresh()}p=B.listindex;q=B.element.albumId;g=B.element;if(v.enableChooseAlbum){n.addClass("hidden");r.removeClass("hidden").show()}a(v)});$("#Blog-Photos-Container").bind("itemclick",function(A,B){if(B.element.selected===1){B.element.selected=0;B.htmlElement.removeClass("selected");c=-1;d=null;
B.list.refresh();if(!v.enableChooseAlbum){r.addClass("hidden").hide();n.removeClass("hidden")}return}B.element.selected=1;B.htmlElement.addClass("selected");if(c>=0){B.list.getElements()[c].selected=0;B.list.refresh()}c=B.listindex;d=B.element;n.addClass("hidden");r.removeClass("hidden").show()});$("#Blog-Photos-Container").bind("itemdblclick",function(A,B){d=B.element;
n.addClass("hidden");r.removeClass("hidden").show();u(d);l.close()})},i,"&offset=0&limit=999")};this.init=function(){$("document").ready(f)}}());Phx.namespace("Phx.Application.Modules.photorating",new function(){var D=24;var r=10;var B=5;var z="/v1/rating/api";var I;var K;var L;var k;var J;var F;var e;
var C;var w=null;var A;this.init=function(){I=$("#Rating-Photo-Wrapper");if(I.length==0){return}try{A=photorating.photoSignedObject}catch(M){return}I.html('<div class="obj-box full standalone" id="Rating"><span id="Rating-Meta-Pro">'+i18n.getPText("rating_like")+': <a href=""></a><span>'+i18n.getPText("rating_noone")+'</span></span><span id="Rating-Meta-Contra">'+i18n.getPText("rating_notlike")+": <span>"+i18n.getPText("rating_noone")+'</span></span><div id="Rating-Actions"><a class="rate-button" id="Rating-Contra" title="'+i18n.getPText("rating_notlike")+'"></a><span id="Rating-Pro-Clickzone" class="rate-button"><a id="Rating-Pro" title="'+i18n.getPText("rating_like")+'"></a>'+i18n.getPText("rating_like")+'</span><span id="Rating-Viewer-Pro">'+i18n.getPText("rating_youlike_photo")+'</span><span id="Rating-Viewer-Contra">'+i18n.getPText("rating_youlike_photo_not")+'</span></div><a id="Rating-Reset" href="">'+i18n.getPText("rating_reset")+"</a></div>");
K=$("#Rating-Pro");L=$("#Rating-Pro-Clickzone");k=$("#Rating-Contra");J=$("#Rating-Reset");F=$("#Rating-Viewer-Pro");_ratingViewerContra=$("#Rating-Viewer-Contra");e=$("#Rating-Meta-Pro a");_ratingProCounterEmpty=$("#Rating-Meta-Pro span");C=$("#Rating-Meta-Contra span");p()};var m=function(N,M,O){L.unbind("click.ratingLike").bind("click.ratingLike",N==1?g:b);
k.unbind("click.ratingDislike").bind("click.ratingDislike",N==-1?g:H);J.unbind("click._ratingReset").bind("click._ratingReset",N==0?g:x);if(N==1){L.addClass("active")}if(N==-1){k.addClass("active")}F[N==1?"show":"hide"]();_ratingViewerContra[N==-1?"show":"hide"]();J[N!=0?"show":"hide"]();e.html(Phx.Util.formatNumber(M));
if(M==0){_ratingProCounterEmpty.show();e.hide()}else{_ratingProCounterEmpty.hide();e.show()}e.unbind("click.rating").bind("click.rating",s);C.html(O>r?r+"+":O>0?O:i18n.getPText("rating_noone"));l()};var v=function(M,T,N,Q){if(T==0){p()}if(!w){w=new Phx.UI.Dialog.ButtonDialog(i18n.getPText("rating_likers_dialog_title"),{message:'<div id="ratingDetailsContainer"><div id="ratingDetails"></div></div>',buttons:[new Phx.UI.Button.Submit(i18n.getText("close"),true,13)],events:{onButtonClicked:function(Y){c(Q)
}}});w.show()}var X=$("#ratingDetails");X[0].innerHTML="";var O='<ul class="obj-thumbnaillist">';for(var S=0;S<M.length;S++){var R=M[S];var W=R.fullName.escapeHtml();var V=R.guid;O+='<li><a title="'+W+'" href="/Profile/'+V+'"><img alt="'+i18n.getPText("rating_photo_of",W)+'" src="'+R.imageUrl+'"></a><a title="'+W+'" href="/Profile/'+V+'">'+W+"</a></li>"
}O+="</ul>";var P=$("#Photo-Metainfo-Photoname").text().escapeHtml();var U=P?i18n.getPText("rating_likers_dialog_photoname",P):"";if(Q>1){X.append("<p>"+i18n.getPText("rating_likers_dialog_desc",Phx.Util.formatNumber(Q),U)+"</p>")}else{if(Q==1){X.append("<p>"+i18n.getPText("rating_likers_dialog_desc_one",U)+"</p>")
}else{X.append("<p>"+i18n.getPText("rating_likers_dialog_desc_none",U)+"</p>")}}if(N>1){X.append('<div id="ratingPager" class="obj-pager">'+i18n.getPText("rating_page")+": "+Phx.Util.getPager(Q,D,T,B)+"</div>");X.append("<br />");$("#ratingPager").find("a").each(function(){$(this).unbind("click.page").bind("click.page",i)
})}X.append(O)};var t=function(){if(w){w=null}};var l=function(){I.show()};var E=function(){I.hide()};var c=function(M){t();e.html(Phx.Util.formatNumber(M));if(M==0){_ratingProCounterEmpty.show();e.hide()}else{_ratingProCounterEmpty.hide();e.show()}e.unbind("click.rating").bind("click.rating",s)};var b=function(M){L.addClass("active");
k.removeClass("active");y(1);return false};var H=function(M){L.removeClass("active");k.addClass("active");y(-1);return false};var x=function(M){L.removeClass("active");k.removeClass("active");f();return false};var g=function(M){Phx.Event.stop(M);return false};var s=function(M){Phx.Event.stop(M);u(1);
return false};var i=function(M){Phx.Event.stop(M);u(parseInt($(this).attr("href")))};var p=function(){$.ajax({type:"GET",url:z+"/aggregated",dataType:"json",beforeSend:d,success:q,error:G})};var y=function(M){omnitureEventData={name:(M==1?"ratingLike":"ratingDislike"),itemType:"Photo"};updateRatingTracked=function(N){q(N);
$().trigger("OmnitureTracking",omnitureEventData)};$.ajax({type:"POST",url:z+"/",data:{ratingValue:M},dataType:"json",beforeSend:a,success:updateRatingTracked,error:G})};var f=function(){$.ajax({type:"DELETE",url:z+"/",dataType:"json",beforeSend:d,success:q,error:G})};var u=function(M){$.ajax({type:"GET",url:z+"/detailed",data:{page:M,pageSize:D},dataType:"json",beforeSend:d,success:n,error:G})
};var d=function(M){M.setRequestHeader("X-Signed-Mapping",rating_photo_mapping);M.setRequestHeader("X-Signed-Objects","["+A+"]")};var a=function(M){M.setRequestHeader("X-Signed-Mapping",rating_photo_create_mapping);M.setRequestHeader("X-Signed-Objects","["+A+"]")};var q=function(M){m(M.ratedByViewer,M.numLikes,M.numDislikes)
};var n=function(M){v(M.users,M.currentPage,M.numPages,M.numLikes)};var G=function(M,O,N){E()}});
