/* <![CDATA[ */function ajaxSubmitComment(){function c(b){var a=$(b+"</li>");if(!scriptParams.threadcmnts||$(".comment #respond").length==0)b=$("ol.comment-list").append(a);else{var c=$("#respond"),b=c.next("ul.children");b.length==0&&(b=$("<ul></ul>"),b.attr("class","children"),c.after(b));b.append(a)}$(".new-comment").removeClass("new-comment");a.animate({opacity:"hide",height:"hide"},0).addClass("new-comment").click(function(){$(this).removeClass("new-comment").unbind("click")});processComments();a.animate({opacity:"show", height:"show"},500,function(){$(this).removeAttr("style").ScrollTo(500)})}$("#commentform");var a=$("#respond"),d={};d.author=$("#author").val();d.email=$("#email").val();d.url=$("#url").val();d.comment=$("#comment").val();d.comment_post_ID=$("#comment_post_ID").val();d.comment_parent=$("#comment_parent").val();d.comment_edit_ID=$("#comment_edit_ID").val();if(scriptParams.threadcmnts&&(a=a.parent("li.comment").length>0?a.next().children("li:last"):$("ol.comment-list li:last"),a.length>0&&(a.hasClass("even")|| a.hasClass("thread-even"))))d.comment_alt="1";$.ajax({url:scriptParams.tmpldir+"/ajax-comments-post.php",type:"POST",data:d,dataType:"html",beforeSend:function(){$(".fade").stop().fadeOut(500,function(){$(this).remove()});$("#author, #email, #url, #comment, .entry .textbox, #submit").attr("disabled","disabled").animate({opacity:0.5},500);$("#cancel-comment-reply-link").fadeOut(500);$("#submit").after('<span class="processing"></span>')},complete:function(){$("#commentform span.processing").remove()}, success:function(b){var a=b.split("<\!-- AJAX Comment Data Separator --\>");meta=eval("("+a[1]+")");if(meta.type=="new"){!$("ol.comment-list").length>0?$("#comments").append('<ol class="comment-list"></ol>').find("p.message").animate({opacity:"hide",height:"hide",marginBottom:"hide"},500,function(){$(this).remove();c(a[0])}):c(a[0]);$("#comment").val("");var d=$(".comment-count"),h=d.text()-0;d.animate({opacity:"hide"},500,function(){d.text(h+1).animate({opacity:"show"},500,function(){$(this).removeAttr("style")})}); var g=$(".comment-link");g.animate({opacity:"hide"},500,function(){var b;b=g.text()==ajaxParams.cmntinfotxt.zero?ajaxParams.cmntinfotxt.one:ajaxParams.cmntinfotxt.more.replace("%",h+1);g.text(b).animate({opacity:"show"},500,function(){$(this).removeAttr("style")})})}else if(meta.type=="edit"){var b=$(a[0]),e=$("#comment-"+$("#comment_edit_ID").val());e.children(".avatar").attr("src",b.children(".avatar").attr("src"));e.children(".comment-meta").html(b.children(".comment-meta").html());e.children().children(".comment-text").val(b.children().children(".comment-text").val()); e.children(".comment-body").html(b.children(".comment-body").html());$(".new-comment").removeClass("new-comment");e.addClass("new-comment").click(function(){$(this).removeClass("new-comment").unbind("click")});processComments();e.ScrollTo(500)}scriptParams.threadcmnts?cancelCommentReplyOrEdit():meta.type=="edit"&&cancelCommentEdit();showMessage(meta.message,function(){$("#author, #email, #url, #comment, .entry .textbox, #submit").removeAttr("disabled").animate({opacity:1},500,function(){$(this).removeAttr("style")})}); window.RCJS&&RCJS.page(scriptParams.blogurl,scriptParams.rcparams,0,"Loading")},error:function(b){showError(b.responseText,function(){$("#author, #email, #url, #comment, .entry .textbox, #submit").removeAttr("disabled").animate({opacity:1},500,function(){$(this).removeAttr("style")});$("#respond").parent("li").length>0&&$("#cancel-comment-reply-link").fadeIn(500,function(){$(this).removeAttr("style")})})}})} function ajaxGetComment(c,a,d){$.ajax({url:scriptParams.blogurl+"?action=cget_ajax&id="+c,type:"get",dataType:"html",beforeSend:function(){a.append('<span class="processing"></span>').css({textAlign:"center",paddingTop:10,paddingBottom:10,backgroundColor:"#222",width:240},200)},complete:function(){a.find(".processing").remove()},success:function(b){var c=$(b);a.fadeOut(200,function(){a.children().remove();a.append(c.children().clone());a.addClass(c.attr("class")).css({textAlign:"",padding:"",backgroundColor:"", width:""}).find(".actions").remove();a.fadeIn(200,function(){d&&typeof d=="function"&&d()})})},error:function(b){a.css("line-height","16px").append('<p class="ajax-comment-error">'+b.responseText+"</p>")}})}var paginateCommentsCallback;function ajaxPaginateComments(c,a){paginateCommentsCallback=a;$.ajax({url:c,type:"get",dataType:"html",beforeSend:commentPaginating,complete:commentPaginateComplete,success:commentPaginateSuccess,error:commentPaginateError})}var commentNavs; function commentPaginating(){$(".fade").stop().fadeOut(500,function(){$(this).remove()});commentNavs=$(".commentnavi a, .commentnavi span").detach();$(".commentnavi").append('<span class="processing"></span>')}function commentPaginateComplete(){} function commentPaginateSuccess(c){var a=c.split("<\!-- AJAX Comment Paginate Data Separator --\>");$(".comment-list, .commentnavi").animate({opacity:"hide",height:"hide"},500,function(){$(this).empty();$(".comment-list").html(a[0]);$(".commentnavi").html(a[1]);processComments();$(this).each(function(){$(this).animate({opacity:"show",height:"show"},500,function(){$(this).removeAttr("style");paginateCommentsCallback&&typeof paginateCommentsCallback=="function"?paginateCommentsCallback():$("#comments").ScrollTo(500)})})})} function commentPaginateError(){$(".commentnavi span.processing").remove();commentNavs.appendTo(".commentnavi");commentNavs=null} function ajaxPaginatePosts(c){$.ajax({url:c,type:"get",dataType:"html",beforeSend:function(){postnavs=$(".pagenavi").children().detach();$(".pagenavi").append('<span class="processing"></span>')},complete:function(){$(".pagenavi span.processing").remove()},success:function(a){contentSection=$("#content");loadContent(a,contentSection,!0)},error:function(){postnavs.appendTo($("pagenavi"));postnavs=null}})} function ajaxPaginateSingular(c){$.ajax({url:c,type:"get",dataType:"html",beforeSend:function(){var a=$(".post-pages");postnavs=a.html();a.text("").children().remove();a.append('<span class="processing"></span>')},complete:function(){$(".post-pages span.processing").remove()},success:function(a){contentSection=$("body.single .entry, body.page .entry");loadContent(a,contentSection,!1)},error:function(){$("post-pages").html(postnavs);postnavs=null}})} function ajaxSearch(c){$.ajax({url:c,type:"get",dataType:"html",beforeSend:function(){$("#search-form").append('<span class="processing"></span>')},complete:function(){$("#search-form span.processing").remove()},success:function(a){contentSection=$("#content");searched&&loadContent(a,contentSection,!0)},error:function(){$("#search-form span.processing").remove();loadContent(contentCache,$("#content"),!0);searched=!1}})} function loadContent(c,a,d,b){a.animate({opacity:"hide",height:"hide"},500,function(){$("#header").ScrollTo(500);a.empty();a.html(c);d&&$("#paginator").length>0&&fixPaginator(c);a.animate({opacity:"show",height:"show"},500,function(){b&&typeof b=="function"&&b();processContent()})})}function fixPaginator(c){$.browser.msie&&(c=c.match(/id="paginator">[\s\S]+<script[^>]+>([\s\S]+?)<\/script>/i),c!=null&&eval(c[1].match(/(pag = new.+\);)/i)[1]))}var contentCache,searched=!1; $(document).ready(function(){ajaxParams.cmntpost&&$("#commentform").submit(function(){ajaxSubmitComment();return!1});ajaxParams.cmntpagenav&&$(".commentnavi").delegate("a","click",function(){var b=$(this).attr("href").split(/(\?|&)action=cpage_ajax.*$/)[0],a=1;/comment-page-/i.test(b)?a=b.split(/comment-page-/i)[1].split(/(\/|#|&).*$/)[0]:/cpage=/i.test(b)&&(a=b.split(/cpage=/i)[1].split(/(\/|#|&).*$/)[0]);var c=$("#cp_post_id").text(),d=b.split(/#.*$/)[0];d+=/\?/i.test(b)?"&":"?";d+="action=cpage_ajax&post="+ c+"&page="+a;scriptParams.threadcmnts&&cancelCommentReplyOrEdit();ajaxPaginateComments(d);return!1});ajaxParams.postcntntpagnav&&$("body.single .entry, body.page .entry").delegate(".post-pages a","click",function(){if(searched)return!0;var b=$(this).attr("href").split(/(\?|&)action=spage_ajax.*$/)[0],a=1;if(/page=/i.test(b))a=b.split(/page=/i)[1].split(/(\/|#|&).*$/)[0];else if(/\/[\d+]\/?$/.test(b)){var c=b.match(/\/([\d+])\/?$/);c!=null&&(a=c[1])}c=b.split(/#.*$/)[0];c+=/\?/i.test(b)?"&":"?";c+= "action=spage_ajax";/page=/i.test(c)||(c+="&page="+a);ajaxPaginateSingular(c);return!1});ajaxParams.postpagenav&&$("body.home #content, body.archive #content, body.search #content, #content.search").delegate(".pagenavi a","click",function(){var a=$(this).attr("href");/action=/i.test(a)?a=a.replace(/action=[^#&]+/ig,"action=ppage_ajax"):(a+=/\?/i.test(a)?"&":"?",a+="action=ppage_ajax");ajaxPaginatePosts(a);return!1});if(ajaxParams.search){var c=$("#fixed-nav .cmnts"),a,d;$("#search-form").submit(function(){a&& clearTimeout(a);var b=$(this).find("#s").val(),b=$(this).attr("action")+"?s="+encodeURIComponent(b)+"&action=search_ajax";ajaxSearch(b);$("#content").addClass("search");c.detach();$(".top-menu").find(".current_page_item, .current-cat, .current_menu_item, .current-menu-item, .current_page_ancestor, .current-cat-parent, .current-menu-ancestor").each(function(){$(this).attr("class",$(this).attr("class").replace(/current/g,"kurrent"))});return!1});$("#s").bind("keyup",function(){a&&clearTimeout(a);a= setTimeout(function(){var a=$("#s"),f=a.val();if(f.length==0)searched&&(loadContent(contentCache,$("#content"),!0,function(){a.focus();$(".top-menu").find(".kurrent_page_item, .kurrent-cat, .kurrent_menu_item, .kurrent-menu-item, .kurrent_page_ancestor, .kurrent-cat-parent, .kurrent-menu-ancestor").each(function(){$(this).attr("class",$(this).attr("class").replace(/kurrent/g,"current"))});c.insertAfter($("#fixed-nav .top"));$("#content").removeClass("search")}),$("#search-form span.processing").remove(), searched=!1),d=f;else if(f!=d){if(!searched)contentCache=$("#content")[0].innerHTML,searched=!0;d=f;$("#search-form").submit()}},800)})}});/* ]]> */
