$(document).ready(function(){$("img").one("error",function(){$(this).attr("src","/images/transparent.gif")});$(".join #check-username").click(function(){var a=this;$(a).hide();$("#throbber").show();$(".username-error").hide();$.getJSON("/user/check",{username:$("#username").val()},function(b){$('<label class="username-error '+b.status+'" for="username" generated="generated">'+b.message+"</label>").insertAfter($("#username"));$("#throbber").hide();$(a).show()})});$(".join #password").keyup(function(){$("#cleartext").val($(this).val())});
$(".join #cleartext").keyup(function(){$("#password").val($(this).val())});$(".join #reveal-password").click(function(){$("#password").hide();$("#cleartext").show();$("#reveal-password").hide();$("#mask-password").show()});$(".join #mask-password").click(function(){$("#cleartext").hide();$("#password").show();$("#mask-password").hide();$("#reveal-password").show()});0!=$("#notification").length&&setInterval("$('#notification').slideUp()",3E3);$("#notification, .ajax-form-message, .ajax-form-error").live("click",
function(){$(this).slideUp()});$(".stream .wrapper, .statuses .wrapper, .comments .wrapper, .gallery #comments .wrapper").live("mouseenter",function(){$(".remove",this).fadeIn("fast")}).live("mouseleave",function(a){var b=$(this).offset(),d=b.left,b=b.top,c=d+$(this).width(),e=b+$(this).height();if(a.pageX>c||a.pageX<d||a.pageY>e||a.pageY<b)return $(".remove",this).fadeOut("slow"),!1});$(".current-status .remove, .statuses .remove").live("click",function(){var a=$(this);$.get("/user/status/delete",
{status_id:$(this).attr("id")},function(){a.parent().parent().slideUp("slow",function(){$(this).remove()})},"json")});$("#stream .remove, .comments .remove").live("click",function(){var a=$(this);$.get("/user/comment/delete",{status_id:$(this).attr("id")},function(){a.parent().parent().slideUp("slow",function(){$(this).remove()})},"json")});$(".gallery #comments .remove").live("click",function(){var a=$(this);$.get("/user/photo/comment/remove",{comment_id:$(this).attr("id")},function(){a.parent().parent().slideUp("slow",
function(){$(this).remove()})},"json")});"#comment"==window.location.hash&&($("#status").length&&$("#status").slideDown("normal",function(){$("#status input[name=message]").focus()}),$("#new-comment").length&&$("#new-comment").slideDown("normal",function(){$("#new-comment input[name=message]").focus()}));$(window).scroll(function(){if($(".profile-tools").length&&0==$("#is_mobile").val()){var a=$(".profile-tools");65<$(this).scrollTop()?a.addClass("fixed"):a.removeClass("fixed")}});$("#sorting").change(function(){switch($(this).val()){case "popularity":location.href=
"/";break;case "newest":location.href="/newest"}});$("#mail-indicator").length&&setTimeout("checkMail();",6E4);$(".mail_compose #message").focus();$("#mailbox #all").change(function(){$("#mailbox input[type=checkbox]").attr("checked",$(this).is(":checked"))});$("#mailbox .action").click(function(){$("#mailbox #action").val($(this).val());$.post("/mail/update",$("#mailbox form").serialize(),function(){location.href="/mail/inbox"},"json")});$("#mailbox #page").change(function(){location.href="/mail/inbox/"+
$(this).val()});$(".gallery input#caption").focus(function(){$(this).removeClass("blended");"Click to edit the caption"==$(this).val()&&$(this).select();$(".gallery #instructions").removeClass("hidden")}).blur(function(){$(this).addClass("blended");$(".gallery #instructions").addClass("hidden")}).keypress(function(a){13==a.which&&($.post("/user/photo/caption",{image_id:$("#image_id").val(),caption:$(this).val()}),$(this).blur())});$("#header-status-button").click(function(){$(this).hasClass("header-status-active")?
($(this).removeClass("header-status-active"),$("#header-status-form").fadeOut()):($(this).addClass("header-status-active"),$("#header-status-form").css("left",$("#header-status-button").offset().left-273+"px").fadeIn(),$("#header-status-form textarea").focus());return!1});$("#header-status-form textarea").keypress(function(a){13==a.keyCode&&!a.shiftKey&&(a.preventDefault(),$("#header-status-form #submit").click(),$("#header-status-form").fadeOut(),$("#header-status-button").removeClass("header-status-active"))})});
function updateStatus(a){setInterval("$('.ajax-form-message').slideUp()",3E3);if(a.update){$("#status").slideUp();var b="#"+("STATUS"==a.type?"current-status":"stream");$(b).is(":visible")||$(b).fadeIn();var d="STATUS"==a.type?'<div class="hidden wrapper existing">    <div class="data">        <div class="status">'+a.stream+'</div>        <div class="time">Just Now</div>        <div class="remove" id="'+a.status_id+'">Remove</div>        <br class="clear" />    </div>    <br class="clear" /></div>':
'<div class="hidden wrapper">    <a href="/'+a.username+'"><img class="photo" src="'+a.image+'" /></a>    <div class="data">        <div class="title"><a href="/'+a.username+'" class="blue">'+a.username+'</a></div>        <div class="status">'+a.stream+'</div>        <div class="time">Just Now</div>        <br class="clear" />    </div>    <br class="clear" /></div>';$(b+" .existing").fadeOut("fast");$(d).insertAfter(b+" h3").delay(100).fadeIn();10<$(b+" div.wrapper").length&&$(b+" div.wrapper:last").fadeOut("slow",
function(){$(this).remove()})}return a}function updateProposal(a){setInterval("$('.ajax-form-message').slideUp()",3E3);$("#proposal").slideUp();return a}
function updateImageComment(a){setInterval("$('.ajax-form-message').slideUp()",3E3);$("#new-comment").slideUp();$("#comments").is(":visible")||$("#comments").fadeIn();$('<div class="hidden wrapper">    <a href="/'+a.username+'"><img class="photo" src="'+a.image+'" /></a>    <div class="data">        <div class="title"><a href="/'+a.username+'" class="blue">'+a.username+'</a></div>        <div class="status">'+a.comment+'</div>        <div class="time">Just Now</div>        <br class="clear" />    </div>    <br class="clear" /></div>').insertAfter("#comments .placeholder").delay(100).fadeIn();
return a}
function displaySearchResults(a){$("#results").slideUp("fast");$("#results .results").html("");var b="";0==a.results.length?b+="No users were found :(":$.each(a.results,function(a,c){b+='<div class="wrapper"><a href="/'+c.username+'"><img class="photo" src="'+c.image+'" /></a><div class="data"><div class="title"><a href="/'+c.username+'" class="blue" target="_blank">'+c.username+'</a></div><div class="details">'+c.details+'</div><div class="location">'+c.city+" - "+c.country+"</div>"+(null==c.bio?
"":'<div class="status">'+c.bio+"</div>")+'<div class="time">Joined '+c.added_at+'</div><br class="clear" /></div><br class="clear" /></div>'});$("#results .results").html(b);$("#results").slideDown("fast");return a}function checkMail(){$.getJSON("/mail/count",function(a){if("undefined"!=typeof a.unread&&"undefined"!=typeof a.has){var b="/images/inbox";if(0<a.unread||0<a.has.length)b+="-new";$("#mail-indicator").attr("src",b+".png")}});setTimeout("checkMail();",6E4)}
function removeMessage(a){a.message_id&&$("#message-"+a.message_id).slideUp();return a};

