var CUSTOM_TEXT_DEFAULT="(type myself ...)";var CONTENT_TEXT_DEFAULT="(limited to 200 charachters)";var BtnBgStyle=[{style:"background-position: left -360px; height:16px; line-height:16px; padding-left:17px;",lineheight:" line-height:16px;"},{style:"background-position: left -360px; height:16px; line-height:16px; padding-left:17px;",lineheight:" line-height:16px;"},{style:"background-position: left -250px; height:25px; line-height:25px; padding-left:27px;",lineheight:" line-height:25px;"},{style:"background-position: left 0; height:59px; line-height:59px; padding-left:58px;",lineheight:" line-height:59px;"},{style:"background-position: left -330px; height:16px; line-height:16px; padding-left:17px;",lineheight:" line-height:16px;"},{style:"background-position: left -210px; height:25px; line-height:25px; padding-left:27px;",lineheight:" line-height:25px;"},{style:"background-position: left -70px; height:59px; line-height:59px; padding-left:58px;",lineheight:" line-height:59px;"},{style:"background-position: left -390px; height:16px; line-height:16px; padding-left:17px;",lineheight:" line-height:16px;"},{style:"background-position: left -290px; height:25px; line-height:25px; padding-left:27px;",lineheight:" line-height:25px;"},{style:"background-position: left -140px; height:59px; line-height:59px; padding-left:58px;",lineheight:" line-height:59px;"}];var tellBtn={style:1,text:"",url:"",content:"",user:"",previewBtn:null,codeArea:null,init:function(a){for(var b in a){this[b]=a[b]}},setStyle:function(a){if(a=parseInt(a)){this.style=a;$("span",this.previewBtn).attr("class","btn_"+this.style);this.genCode()}},setUrl:function(a){if(a=="http://"){a=""}var b=/^(http|https|ftp):\/\//i;if(a!==""&&!b.test(a)){this.url="http://"+a}else{this.url=a}this.genCode()},setText:function(a){this.text=a;$("span",this.previewBtn).text(this.text);this.genCode()},setContent:function(a){this.content=a;this.genCode()},setUser:function(a){a=a||"";this.user=a;this.genCode()},genCode:function(){var f="";var g="";var a=this.style||1;var c=this.text.replace(/([\/|'|\\])/g,"\\$1")||"";if(this.url!=""){f=this.url.replace(/([\/|'|\\])/g,"\\$1")}f=f?f:"'+encodeURIComponent(window.location)+'";var b=this.content.replace(/([\/|'|\\])/g,"$1").replace(/\n/g,"\n");b=(b)?encodeURIComponent(b):"'+encodeURIComponent(document.title)+'";if(this.user!=""){g=this.user.replace(/([\/|'|\\])/g,"\\$1")}g=(g)?encodeURIComponent("@"+g+" "):"";var d=TELL_STORY_URL+"?content="+g+b+"&ref_url="+f;var h='<a style="color:#0080bc; '+BtnBgStyle[a].lineheight+'" href="#" onclick="javascript:this.href=\''+TELL_STORY_URL+"?content="+g+b+"&ref_url="+f+"';\">";var e="";e='<div style="font-size: 12px; font-weight:bold; font-family:Trebuchet MS,Helvetica,Sans-Serif;" id="my_tell_button">';e+=h;e+='<div style="background:transparent url('+buttonBgImage+") no-repeat scroll 0 0; float:left; "+BtnBgStyle[a].style+'">';e+="</div>"+c+"</a></div>";this.codeArea.text(e);var d=TELL_STORY_URL+"?content="+(this.user?encodeURIComponent("@"+this.user+" "):"")+encodeURIComponent(this.content?this.content:document.title)+"&ref_url="+encodeURIComponent(this.url?this.url:window.location);this.previewBtn.attr("href",d)}};function getDimensions(){var a={width:0,height:0};if(document.documentElement){a.width=document.documentElement.offsetWidth;a.height=document.documentElement.offsetHeight}else{if(window.innerWidth&&window.innerHeight){a.width=window.innerWidth;a.height=window.innerHeight}}return a}$(document).ready(function(){$("#the_login_link").click(function(){$("#AjaxLoginPanel").fadeIn(200,function(){var c=getDimensions();var b=769*0.5*0.33;var d=(c.height*0.33);$(this).css({right:b+"px",top:d+"px"}).show()})});var a=document.getElementById("tellbtn_form");tellBtn.init({previewBtn:$("#tellbtn_link"),codeArea:$("#btn_code")});$(a.custom_text).val(CUSTOM_TEXT_DEFAULT).focus(function(){if(this.value===CUSTOM_TEXT_DEFAULT){this.value=""}}).blur(function(){if(this.value===""){this.value=CUSTOM_TEXT_DEFAULT}}).keyup(function(){a.text[a.text.length-1].value=this.value;tellBtn.setText(this.value)});tellBtn.setStyle($(a.icon+":checked").val());$(a.icon).click(function(){tellBtn.setStyle(this.value)});if(!$(a.text+":last").is(":checked")){$(a.custom_text).attr("disabled",true)}$(a.text).each(function(b){if($(this).is(":checked")){tellBtn.setText(this.value)}$(this).click(function(){if(b===a.text.length-1){$(a.custom_text).attr("disabled",false).focus()}else{$(a.custom_text).attr("disabled",true)}$("#preview_btn").text(this.value);tellBtn.setText(this.value)})});$(a.url).keyup(function(){tellBtn.setUrl(this.value)});$(a.content).val(CONTENT_TEXT_DEFAULT).focus(function(){if(this.value===CONTENT_TEXT_DEFAULT){this.value=""}}).blur(function(){if(this.value===""){this.value=CONTENT_TEXT_DEFAULT}}).keydown(function(){if(this.value.length>=200){this.value=this.value.substring(0,200)}}).keyup(function(b){if(this.value.length>=200){this.value=this.value.substring(0,200)}tellBtn.setContent(this.value)});$(a.mention).bind("click",function(){tellBtn.setUser(($(this).is(":checked"))?this.value:false)});if(a.mention.value==""){$(a.mention).attr("disabled",true)}else{a.mention.click()}$("#copy_btn").click(function(){if(window.clipboardData){window.clipboardData.setData("text",$("#btn_code").text());$("#copy_msg").show().fadeOut(1000)}else{var b=$("#btn_code").get(0);b.select();b.focus()}return false})});