var colorBlur="#AAA";var colorFocus="#000";var default_display_status=false;$(document).ready(function(){var a=function(d,c){var e=tell_story_content_default;if(c==true){return(d==e)?"":d}else{if(d==""){return e}else{b(d);return d}}};var b=function(c){$.ajax({url:URL_FIND_TAGS,type:"post",dataType:"json",data:{content:c},success:function(d){$("#tag_list").empty();if(d.length>0){$("#tag_tip").show();$(d).each(function(e,f){$("#tag_list").append($("<a></a>").addClass("tag").attr("href","#").text(f).append($("<span></span>").addClass("tag_tail").html("&nbsp;")).click(function(j){j.preventDefault();var k=this.innerText||this.textContent;k=$.trim(k);$("#tell_story_tags").removeClass("grey");if($("#tell_story_tags")[0].value==tell_story_tag_default){$("#tell_story_tags")[0].value=""}var h=($.trim($("#tell_story_tags")[0].value)!="")?$("#tell_story_tags")[0].value.split(/[\s,]+/g):new Array();if(this.className=="tag"){this.className="on";if($("#tell_story_tags")[0].value.match(k)){return}h.push(k)}else{this.className="tag";for(var g in h){if(h[g].match(new RegExp(k,"i"))){h.splice(g,1)}}}$("#tell_story_tags")[0].value=h.join(", ")}))})}else{$("#tag_tip").hide()}}})};$("#tell_story_content").val(a($("#tell_story_content").val())).focus(function(){$(this).val(a($(this).val(),true));$(this).css("color",colorFocus)}).blur(function(){$(this).val(a($(this).val()));if($(this).val()==tell_story_content_default){$(this).css("color",colorBlur)}}).keyup(function(){$(this).css("height","auto");$(this).css("height",$(this)[0].scrollHeight)});$("#tell_story_content").css("height",$("#tell_story_content")[0].scrollHeight);if(!$('input[name="tell_story[user_description_id]"]:last').is(":checked")){$("#tell_story_user_description_text").attr("disabled",true)}$('input[name="tell_story[user_description_id]"]').click(function(){if(this.value!==""){$("#tell_story_user_description_text").attr("disabled",true)}else{$("#tell_story_user_description_text").attr("disabled",false).focus()}});if(!$('input[name="tell_story[audience_id]"]:last').is(":checked")){$("#tell_story_audience_text").attr("disabled",true)}$('input[name="tell_story[audience_id]"]').click(function(){if(this.value!==""){$("#tell_story_audience_text").attr("disabled",true)}else{$("#tell_story_audience_text").attr("disabled",false).focus()}});$("#topic_box").hide();if(tellHidden===true){$("#tell_more").css({marginTop:"-"+$("#tell_more").height()+"px",opacity:0})}$("#tell_more_toggle").click(function(c){c.preventDefault();if(tellHidden==true){$("#tell_more").show().animate({marginTop:0,opacity:1},1000,"easeOutQuint");tellHidden=false}else{$("#tell_more").animate({marginTop:"-"+$("#tell_more").height()+"px",opacity:0},1000,"easeOutQuint");tellHidden=true}});$("#topic_box_link").click(function(c){c.preventDefault();$("#topic_box").slideToggle()});$('input[name="tell_story[topic_id]"]').click(function(){$("#topic_selected").text($(this).next().text())});$("#topic_selected").text($('input[name="tell_story[topic_id]"]:checked ~ label').text());if($("#tell_story_tags").val()==""){$("#tell_story_tags").val(tell_story_tag_default).addClass("grey")}$("#tell_story_tags").focus(function(){if(this.value==tell_story_tag_default){$(this).val("")}$(this).removeClass("grey")}).blur(function(){if(this.value==""){$(this).val(tell_story_tag_default).addClass("grey")}});$("#tell_story_reference_url").val($("#tell_story_reference_url").val()||"http://").focus(function(){$(this).removeClass("grey")}).blur(function(){$(this).val($(this).val()||"http://");if($(this).val()=="http://"){$(this).addClass("grey")}});$("#story_form_sign_in").click(function(){$.post(URL_SAVE_FORM,$("#story_submit_form").serialize());return true});if(isRestricted===true){$("#story_submit_form :input[type=submit]").attr("disabled",true)}});