(function(){var c={userId:0,isScenery:0,photoId:0,page:0,npage:0,init:function(){if(typeof pageInfo!=="undefined")if(0<pageInfo.userId){$("#toolboxDelete").bind("click",this.openPhotoDeleteVerification);$("#toolboxFriendShare").bind("click",this.openShareOnStardoll);$("a.sharePage").click(function(){Social.open($(this).attr("href"),$(this).attr("title"),$(this).text(),{topPosition:140});return false});$("#ratePhoto a").bind("click",this.ratePhoto);$("#ratePhoto li").hover(function(){$(this).prevAll().andSelf().toggleClass("fill")},
function(){$(this).prevAll().andSelf().toggleClass("fill")});this.userId=pageInfo.userId;this.isScenery=pageInfo.isScenery;this.photoId=pageInfo.photoId;this.page=pageInfo.page;this.npage=pageInfo.npage;this.bindNavigationTriggers()}},ratePhoto:function(a){a.preventDefault();$(".ntt").hide();if($("#ratePhoto").hasClass("peav")){a=$(this).offset();$("#votecomplete").css("left",a.left-5+"px").css("top",a.top-254+"px").show()}a=$(this).attr("id").split("-");if(!(1>=a.length)){a=parseInt(a[1]);if(!(1>
a||5<a)){a={userId:c.userId,photoId:c.photoId,isScenery:c.isScenery,rating:a};$.post("/"+language+"/com/user/photos/castRating.php",a,function(b){if(undefined!=b.message&&undefined!=b.rating){var d=b.message;if($("#ratePhoto").hasClass("peav")){d=d+' <a href="/'+language+'/contest/">'+b.pae_message+" &gt;&gt;</a>";Minime.upPte(1)}$("#ratePhoto").html("<p>"+d+"</p>")}},"json")}}},openPhotoDeleteVerification:function(a){a.preventDefault();a=$(this).attr("href");a="<strong>"+photoToolbox.deleteBox.verificationMessage+
'</strong><p></p><form id="deleteForm" method="post" action=""><input type="hidden" name="deletePhoto" value="1" /></form><a id="allowDelete" class="button floatright small" href="'+a+'"><span>'+photoToolbox.deleteBox.okButton+'</span></a><a id="disallowDelete" class="button floatright small" style="margin-left:10px;" href="#_sdbtnoc5"><span>'+photoToolbox.deleteBox.cancelButton+"</span></a>";Overlay.openFramed(photoToolbox.deleteBox.headlineText,a,this);$("#allowDelete").bind("click",function(){$("#deleteForm").submit();
return false});$("#disallowDelete").bind("click",function(){Overlay.close();return false});return false},sendShareOnStardoll:function(){var a=$("#friendShare"),b={userId:c.userId,photoId:c.photoId,isScenery:c.isScenery,to:parseInt($("select:first",a).val())};a.before("<p>"+photoToolbox.share.sendingMessage+"</p>");0<b.to&&$.post("/"+language+"/com/user/photos/sendToFriend.php",b,function(d){d.status!="success"?Overlay.openFramed(photoToolbox.share.headlineText,photoToolbox.share.failedMessage,$("#toolboxFriendShare")):
Overlay.close()},"json")},openShareOnStardoll:function(){var a='<form id="friendShare" method="post" action=""><label for="shareWithFriend">'+photoToolbox.share.labelText+'</label><select name="friend" id="shareWithFriend">';for(var b in photoToolbox.share.friends)a+='<option value="'+b+'">'+photoToolbox.share.friends[b]+"</option>";a+='</select><a id="triggerFriendShare" class="button floatright small" href="#_sdbtnoc5"><span>'+photoToolbox.share.buttonText+"</span></a></form>";Overlay.openFramed(photoToolbox.share.headlineText,
a,this);$("#triggerFriendShare").bind("click",c.sendShareOnStardoll);return false},bindNavigationTriggers:function(){$("#photos table a").bind("click",this.paginateNavigation)},paginateNavigation:function(a){a.preventDefault();a=c.retrieveCurrentPaginationFromUrl($(this).attr("href"));var b={userId:c.userId,isScenery:c.isScenery,photoId:c.photoId,page:c.page,npage:a.navigation};$.get("/"+language+"/com/user/photos/getNavigation.php",b,function(d){if(undefined!=d)if(undefined!=d.navigation){$("#photos").html(d.navigation);
$('input[name="npage"]').val(parseInt(b.npage));c.bindNavigationTriggers()}},"json")},retrieveCurrentPaginationFromUrl:function(a){var b={comment:0,navigation:0},d=a.match("(&|\\?)page=[0-9]+");a=a.match("(&|\\?)npage=[0-9]+");if(null!=d)b.comment=parseInt(d[0].split("=")[1]);if(null!=a)b.navigation=parseInt(a[0].split("=")[1]);return b}};c.init()})();var scenPageTarget=null;
function scenCommentPages(c){if(scenPageTarget==null)scenPageTarget=document.getElementById("latestCommentedScene");ajaxEngine.sendRequest("latestCommentedSceneries","page="+c)}ajaxEngine.registerRequest("latestCommentedSceneries","/"+language+"/ajax/latestCommentedSceneries.php");
