$(document).ready(function(){$("#tweet_body").focus();$("#tweet_body").keypress(function(){setTimeout(function(){update_share()},50)});$("#copylink").click(function(){$(this).select()});init_clipboard()});function update_share(){var f=encodeURI($("#tweet_body").val());var c=encodeURI($("#copylink").val());var b="http://twitter.com/home?status="+f;var a="http://friendfeed.com/share/bookmarklet/frame#title="+f;var e="http://www.facebook.com/share.php?u="+c;$("#share_tw").attr("href",b);$("#share_ff").attr("href",a);$("#share_fb").attr("href",e);var d=parseInt(140-$("#tweet_body").val().length);$("#charcount").toggleClass("negative",d<0).text(d)}function share(b){var a=$("#share_"+b).attr("href");switch(b){case"ff":window.open(a,"ff","toolbar=no,width=500,height=350");break;case"fb":window.open(a,"fb","toolbar=no,width=1000,height=550");break;case"tw":window.open(a,"tw","toolbar=no,width=800,height=550");break}return false}var clip;function init_clipboard(){if(!$("#copylink").length){return}clip=new ZeroClipboard.Client();clip.glue("copylink");var a=$("#copylink").val();clip.setText(a);clip.addEventListener("complete",function(b,c){html_pulse("#copybox h2","Copied!")});$("#copylink").css({backgroundPosition:"130% 50%"});clip.addEventListener("onMouseOver",function(b,c){$("#copylink").select().animate({backgroundPosition:"100% 50%"},300)});clip.addEventListener("onMouseOut",function(b,c){$("#copylink").blur().animate({backgroundPosition:"130% 50%"},300)});$("#"+clip.movieId).css("height","35px")};
