function urlParams(e){var t=(new RegExp("[\\?&]"+e+"=([^&#]*)")).exec(window.location.href);return t?t[1]||0:0}function updatePostLoad(e,t){loadable=!0;main_height=$main.outerHeight();typeof _gaq!="undefined"&&_gaq.push(["_trackPageview"])}function load_topics(){var e=window.location.pathname+"?page="+page,t=$("#topic_list");newHash="page- "+page;$.get(e,function(n){t.append('<h1 id="#'+newHash+'">Page '+page+"</h1>"+n);updatePostLoad(e,newHash)})}function load_posts(){var e=topic_short_url+page+"/",t=$("#comment-list"),n="page- "+page;$.get(e,function(r){t.append('<h1 id="#'+n+'">Page '+page+"</h1>"+r);load_images();current_page.html(original_page+"-"+page);loaded.push(page);updatePostLoad(e)})}var $main=$("#content"),main_height=$main.outerHeight(),$forum_search=$("#forum_search"),$img_field=$("#id_image").closest("p");$img_field.hide().addClass("breakout");$forum_search.hide();$("#search-box-trigger").click(function(e){e.preventDefault();$forum_search.slideToggle()});$("#topic_list article.toxic").click(function(e){confirm("Are you sure you want to see this? It could get ugly.")||e.preventDefault()});$("form.toxic input[type=submit]").click(function(e){if(!confirm("Are you really sure you want to contribute to this mess?")){e.preventDefault();$(this).closest("form").find("textarea").val("")}});$("#reply #id_text").markItUp(gp_markdown_settings);$(".tool_trigger").click(function(){$(this).hide();$(this).parent().find(".post-admin").show()});if(Modernizr.localstorage&&lscache){var new_topic=urlParams("new_topic"),new_post=urlParams("new_post"),topics=lscache.get("topics");topics||(topics=[]);new_topic&&new_topic!==null&&$.inArray(new_topic,topics)===-1&&topics.push(new_topic);new_post&&new_post!==null&&$.inArray(new_post,topics)===-1&&topics.push(new_post);topics.length>201&&topics.splice(0,1);if(topics!==null){lscache.set("topics",topics);var $topics_link=$("#commented_topics a");if($topics_link.length){$topics_link.prepend('<span class="left counter">'+topics.length+"</span>");$topics_link[0].search+="?topics="+topics}}}$("#comment-list .avatar-hold a").each(function(){var e=!1,t=$(this).parent();$(this).click(function(n){n.preventDefault();e===!1?$.getJSON(this.href,function(n){var r='<ul class="profile_preview fancy"><li>'+n.name+"</li>"+"<li><strong>Joined:</strong> "+n.joined+"</li>";n.location&&(r+="<li><strong>Location:</strong> "+n.location+"</li>");n.website&&(r+='<li><a href="'+n.website+'">Web Site</a></li>');r+='<li><a href="'+n.contact_url+'">Contact</a></li>'+'<li><a href="'+n.profile_url+'">View Full Profile</a></li></ul>';t.append(r);e=!0}):t.find("ul.profile_preview").toggle()})});$("ul.postcontrols li a[href=#reply]").click(function(e){e.preventDefault();$(this).closest("footer").append($("#reply").slideDown("fast"))});$("#reply").on("click touchend","li.icon-photo",function(e){$img_field.toggle()});if(typeof loadable!="undefined"&&loadable===!0){var didScroll=!1;$(window).scroll(function(){didScroll=!0});setInterval(function(){if(didScroll){didScroll=!1;main_offset=getYOffset();if(main_offset>main_height*.75&&loadable===!0&&page<=page_max){loadable=!1;page+=1;typeof topiclist!="undefined"&&load_topics();typeof postlist!="undefined"&&$.inArray(page+1,loaded)===-1&&load_posts()}}},250)};