$(function(){var c=$("#result");var e=$("#submit");var d=$("#shortName");var b=$("#aliases ul");var a=false;if($("#noAliasesYet").length!=0){a=true}e.click(function(g){if(e.hasClass("disabled")){return false}var f=d.val();Appstore.clearShortnameResult();$.post(serverRoot+"cmd.php",{action:"new_alias",alias:f,id:Appstore.app.id},function(h){if(h.substring(0,2)=="OK"){try{pageTracker._trackEvent(Appstore.GA.CREATE_A_NEW_ALIAS_CATEGORY,Appstore.GA.GRAB_IT_ACTION,Appstore.GA.GRAB_IT_SUCCESS)}catch(i){}e.addClass("disabled");c.addClass("great-success").html('<span>Great success:</span><div class="copyShare"><a href="http://appsto.re/'+f+'" class="copyUrl">Copy URL</a><a href="'+Appstore.app.name+'" class="share">Share</a></div>');c.find(".copyUrl").bind("click",Appstore.copyUrlClick).bind("mouseleave",Appstore.copyUrlMouseleave);c.find(".share").bind("mouseover",Appstore.shareMouseover).bind("mouseout",Appstore.shareMouseout).bind("click",Appstore.shareClick);if(a){b.empty()}var j=$('<li><div class="copyShare"><a href="http://appsto.re/'+f+'" class="copyUrl">Copy URL</a><a href="'+Appstore.app.name+'" class="share">Share</a></div><div class="shortUrlWrapper"><a href="http://appsto.re/'+f+'" class="shortUrl" rel="external" >http://appsto.re/'+f+"</a></div></li>");j.find(".copyUrl").bind("click",Appstore.copyUrlClick).bind("mouseleave",Appstore.copyUrlMouseleave);j.find(".share").bind("mouseover",Appstore.shareMouseover).bind("mouseout",Appstore.shareMouseout).bind("click",Appstore.shareClick);b.append(j)}else{try{pageTracker._trackEvent(Appstore.GA.CREATE_A_NEW_ALIAS_CATEGORY,Appstore.GA.GRAB_IT_ACTION,Appstore.GA.GRAB_IT_ERROR)}catch(i){}c.addClass("message-error").html("error: "+h)}});return false})});