/*<![CDATA[*/function ajaxSubmitComment(){function c(e){var d;if(scriptParams.threadcmnts){var g=$("#respond");d=g.next();if(d.length==0){d=$("<ul></ul>");d.attr("class","children");g.after(d)}else if(d.attr("id")=="pings")d=$("ol.comment-list");d.append(e+"</li>")}else d=$("ol.comment-list").append(e);$(".new-comment").each(function(){$(this).removeClass("new-comment")});var h=d.children("li:last");h.addClass("new-comment").click(function(){$(this).removeClass("new-comment").unbind("click")}); processComments();fadingSlideDown(h,function(){h.ScrollTo(500)})}var a=$("#commentform"),f=$("#respond"),b={};b.author=a.find("#author").val();b.email=a.find("#email").val();b.url=a.find("#url").val();b.comment=a.find("#comment").val();b.comment_post_ID=a.find("#comment_post_ID").val();b.comment_parent=a.find("#comment_parent").val();if(scriptParams.threadcmnts){a=f.parent("li.comment").length>0?f.next().children("li:last"):$("ol.comment-list li:last");if(a.length>0)if(a.hasClass("even")||a.hasClass("thread-even"))b.comment_alt= "1"}$.ajax({url:scriptParams.tmpldir+"/ajax-comments-post.php",type:"POST",data:b,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(e){var d=e.split("<!-- AJAX Comment Data Separator --\>"); !$("ol.comment-list").length>0?$("#comments").append('<ol class="comment-list"></ol>').find("p.message").animate({opacity:0,height:0,marginBottom:0},500,function(){$(this).remove();c(d[0])}):c(d[0]);scriptParams.threadcmnts&&cancelCommentReply();$("#comment").val("");var g=$(".comment-count"),h=g.text()-0;g.animate({opacity:0},500,function(){g.text(h+1).animate({opacity:1},500,function(){$(this).removeAttr("style")})});var i=$(".comment-link");i.animate({opacity:0},500,function(){var j;j=i.text()== ajaxParams.cmntinfotxt.zero?ajaxParams.cmntinfotxt.one:ajaxParams.cmntinfotxt.more.replace("%",h+1);i.text(j).animate({opacity:1},500,function(){$(this).removeAttr("style")})});window.RCJS&&RCJS.page(scriptParams.blogurl,scriptParams.rcparams,0,"Loading");showMessage(d[1],function(){$("#author, #email, #url, #comment, .entry .textbox, #submit").removeAttr("disabled").animate({opacity:1},500,function(){$(this).removeAttr("style")})})},error:function(e){showError(e.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 ajaxGetComment(c,a,f){$.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 e=$(b);a.fadeOut(200,function(){a.children().remove();a.append(e.children().clone());a.addClass(e.attr("class")).css({textAlign:"",padding:"",backgroundColor:"", width:""}).find(".actions").remove();a.fadeIn(200,function(){f&&typeof f=="function"&&f()})})},error:function(b){a.css("line-height","16px").append('<p class="ajax-comment-error">'+b.responseText+"</p>")}})}function ajaxPaginateComments(c){$.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:0,height:0},500,function(){$(this).empty();$(".comment-list").html(a[0]);$(".commentnavi").html(a[1]);processComments();$(this).each(function(){fadingSlideDown($(this),function(){$("#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,true)},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,false)},error:function(){$("post-pages").html(postnavs);postnavs=null}})} function ajaxSearch(c){$.ajax({url:c,type:"get",dataType:"html",beforeSend:function(){$("#search-form div").append('<span class="processing"></span>')},complete:function(){$("#search-form span.processing").remove()},success:function(a){contentSection=$("#content");searched&&loadContent(a,contentSection,true)},error:function(){$("#search-form span.processing").remove();loadContent(contentCache,$("#content"),true);searched=false}})} function loadContent(c,a,f,b){a.animate({opacity:0,height:0},500,function(){$("#header").ScrollTo(500);a.empty();a.html(c);f&&$("#paginator").length>0&&fixPaginator(c);processContent();fadingSlideDown(a,b)})}function fixPaginator(c){if($.browser.msie){c=c.match(/id="paginator">[\s\S]+<script[^>]+>([\s\S]+?)<\/script>/i);c!=null&&eval(c[1].match(/(pag = new.+\);)/i)[1])}} function showMessage(c,a){$("#commentform .fade").remove();$("#submit").after('<span class="fade ajax-comment-msg">'+c+"</span>");$("#commentform .fade").delay(2E3).fadeOut(500,function(){$(this).remove();a&&typeof a=="function"&&a()})}function showError(c,a){$("#commentform .fade").remove();$("#submit").after('<span class="fade ajax-comment-error">'+c+"</span>");$("#commentform .fade").delay(2E3).fadeOut(500,function(){$(this).remove();a&&typeof a=="function"&&a()})}var contentCache,searched=false; $(document).ready(function(){ajaxParams.cmntpost&&$("#commentform").submit(function(){ajaxSubmitComment();return false});ajaxParams.cmntpagenav&&$(".commentnavi a").live("click",function(){var b=$(this).attr("href").split(/(\?|&)action=cpage_ajax.*$/)[0],e=1;if(/comment-page-/i.test(b))e=b.split(/comment-page-/i)[1].split(/(\/|#|&).*$/)[0];else if(/cpage=/i.test(b))e=b.split(/cpage=/i)[1].split(/(\/|#|&).*$/)[0];var d=$("#cp_post_id").text(),g=b.split(/#.*$/)[0];g+=/\?/i.test(b)?"&":"?";g+="action=cpage_ajax&post="+ d+"&page="+e;ajaxPaginateComments(g);return false});ajaxParams.postcntntpagnav&&$("body.single .post-pages a, body.page .post-pages a").live("click",function(){if(searched)return true;var b=$(this).attr("href").split(/(\?|&)action=spage_ajax.*$/)[0],e=1;if(/page=/i.test(b))e=b.split(/page=/i)[1].split(/(\/|#|&).*$/)[0];else if(/\/[\d+]\/?$/.test(b)){var d=b.match(/\/([\d+])\/?$/);if(d!=null)e=d[1]}d=b.split(/#.*$/)[0];d+=/\?/i.test(b)?"&":"?";d+="action=spage_ajax";/page=/i.test(d)||(d+="&page="+ e);ajaxPaginateSingular(d);return false});ajaxParams.postpagenav&&$("body.home .pagenavi a, body.archive .pagenavi a, body.search .pagenavi a").live("click",function(){var b=$(this).attr("href");if(/action=/i.test(b))b=b.replace(/action=[^#&]+/ig,"action=ppage_ajax");else{b+=/\?/i.test(b)?"&":"?";b+="action=ppage_ajax"}ajaxPaginatePosts(b);return false});if(ajaxParams.search){var c=$("#fixed-nav .cmnts");$("#search-form").submit(function(){var b=$(this).find("#s").val();b=$(this).attr("action")+"?s="+ encodeURIComponent(b)+"&action=search_ajax";ajaxSearch(b);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 false});var a,f;$("#s").bind("keyup",function(){clearTimeout(a);a=setTimeout(function(){var b=$("#s"),e=b.val();if(e.length==0){if(searched){loadContent(contentCache,$("#content"), true,function(){b.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"))});$("#search-form span.processing").remove();searched=false}f=e}else if(e!=f){if(!searched){contentCache=$("#content")[0].innerHTML;searched=true}f=e;$("#search-form").submit()}},800)})}});/*]]>*/
