$(document).ready(function() { jQuery.fn.fadeToggle = function(speed, easing, callback) { return this.animate({opacity: 'toggle'}, speed, easing, callback); }; function ajax_comments(aid, page_num) { $.ajax({ type: "GET", url: "/scripts/comments.php", data: "id=" + aid + "&page_num=" + page_num, cache: false, dataType: "html", success: function(comments_html) { $("#comments_list").append(comments_html); } }); } $("#comment_link").bind("click", function(e) { $.scrollTo("#comments", 1000, {offset: -24}); }); $("#join_link").bind("click", function(e) { $.scrollTo("#join", 1000, {offset: -24}); }); $('#article_content a[href^="http:"]').not("[href*='drivers.com']").attr("target", "_blank"); $("#notify_link").live("click", function(e) { var params = $(this).attr('rel').split(':'); var article_id = params[0]; var action = params[1]; if(action == 'subscribe') { $("#notify").addClass("remove"); $("#notify").removeClass("subscribe"); } if(action == 'remove') { $("#notify").addClass("subscribe"); $("#notify").removeClass("remove"); } $.ajax({ type: "GET", url: "/scripts/article_notify.php", data: "action=" + action + "&article_id=" + article_id, cache: false, success: function(html) { $("#notify").empty(); $("#notify").append(html); } }); }); ajax_comments(, 1); $("#show_more_comments").live("click", function(e) { params = $(this).attr('rel').split(':'); aid = params[0]; page_num = params[1]; $("#paging_wrapper").remove(); ajax_comments(aid, page_num); }); $("#comments_loader").hide(); $("#comments_loader").ajaxStart(function() { $(this).show(); }).ajaxStop(function() { $(this).hide(); }); });