var ajaxParams=extractParams(); function ajaxSubmitComment(){function c(){jQuery(".fade").stop().fadeOut(500,function(){jQuery(this).remove()});jQuery("#author, #email, #url, #comment, .entry .textbox, #submit-button").attr("disabled","disabled").animate({opacity:0.5},500);jQuery("#submit-button").after('<span class="processing"></span>')}function b(h){showError(h.responseText,function(){jQuery("#author, #email, #url, #comment, .entry .textbox, #submit-button").animate({opacity:1},500).removeAttr("style").removeAttr("disabled")})}function a(h){var f= h.split("<!-- AJAX Comment Data Separator --\>");!jQuery("ol.comment-list").length>0?jQuery("#comments").append('<ol class="comment-list"></ol>').find("p.message").animate({opacity:0,height:0,marginBottom:0},500,function(){jQuery(this).remove();d(f[0])}):d(f[0]);jQuery("#comment").val("");var j=jQuery(".comment-count");j.animate({opacity:0},500,function(){jQuery(this).text(j.text()-0+1).animate({opacity:1},500).removeAttr("style")});RCJS&&RCJS.page("http://localhost/unborn/",ajaxParams.rcparams,0, "Loading");showMessage(f[1],function(){jQuery("#author, #email, #url, #comment, .entry .textbox, #submit-button").animate({opacity:1},500).removeAttr("style").removeAttr("disabled")})}function d(h){var f;if(ajaxParams.threadcmnts){var j=jQuery("#respond");f=j.next();if(f.length==0){f=jQuery("<ul></ul>");f.attr("class","children");j.after(f)}else if(f.attr("id")=="pings")f=jQuery("ol.comment-list");f.append(h+"</li>")}else f=jQuery("ol.comment-list").append(h);h=f.children("li:last");fadingSlideDown(h); h.ScrollTo(500)}function g(){jQuery("#comment-form span.processing").remove()}var e=jQuery("#comment-form"),i={};i.author=e.find("#author").val();i.email=e.find("#email").val();i.url=e.find("#url").val();i.comment=e.find("#comment").val();i.comment_post_ID=e.find("#comment_post_ID").val();i.comment_parent=e.find("#comment_parent").val();jQuery.ajax({url:baseParams.tmpldir+"/ajax-comments-post.php",type:"POST",data:i,dataType:"html",beforeSend:c,complete:g,success:a,error:b})} function ajaxGetComment(c,b,a){function d(){b.append('<span class="processing"></span>').css({textAlign:"center",paddingTop:10,paddingBottom:10,backgroundColor:"#222",width:240},200)}function g(){b.find(".processing").remove()}function e(h){b.css("line-height","16px").append('<p class="ajax-comment-error">'+h.responseText+"</p>")}function i(h){var f=jQuery(h);b.fadeOut(200,function(){b.children().remove();b.append(f.children().clone());b.addClass(f.attr("class")).css({textAlign:"",padding:"",backgroundColor:"", width:""}).find(".actions").remove();b.fadeIn(200,function(){a&&typeof a=="function"&&a()})})}jQuery.ajax({url:baseParams.blogurl+"?action=cget_ajax&id="+c,type:"get",dataType:"html",beforeSend:d,complete:g,success:i,error:e})}function ajaxPaginateComments(c){jQuery.ajax({url:c,type:"get",dataType:"html",beforeSend:commentPaginating,complete:commentPaginateComplete,success:commentPaginateSuccess,error:commentPaginateError})}var commentNavs; function commentPaginating(){jQuery(".fade").stop().fadeOut(500,function(){jQuery(this).remove()});commentNavs=jQuery(".commentnavi a, .commentnavi span").detach();jQuery(".commentnavi").append('<span class="processing"></span>')}function commentPaginateComplete(){} function commentPaginateSuccess(c){var b=c.split("<!-- AJAX Comment Paginate Data Separator --\>");jQuery(".comment-list, .commentnavi").animate({opacity:0,height:0},500,function(){jQuery(this).empty();jQuery(".comment-list").html(b[0]);jQuery(".commentnavi").html(b[1]);jQuery(this).each(function(){fadingSlideDown(jQuery(this),function(){jQuery("#comments").ScrollTo(500)})})})} function commentPaginateError(){jQuery(".commentnavi span.processing").remove();commentNavs.appendTo(".commentnavi");commentNavs=null} function ajaxPaginatePosts(c){function b(){postnavs=jQuery(".pagenavi").children().detach();jQuery(".pagenavi").append('<span class="processing"></span>')}function a(){jQuery(".pagenavi span.processing").remove()}function d(e){contentSection=jQuery("#content");loadContent(e,contentSection,true)}function g(){postnavs.appendTo(jQuery("pagenavi"));postnavs=null}jQuery.ajax({url:c,type:"get",dataType:"html",beforeSend:b,complete:a,success:d,error:g})} function ajaxPaginateSingular(c){function b(){var e=jQuery(".post-pages");postnavs=e.html();e.text("").children().remove();e.append('<span class="processing"></span>')}function a(){jQuery(".post-pages span.processing").remove()}function d(e){contentSection=jQuery(".entry");loadContent(e,contentSection,false)}function g(){jQuery("post-pages").html(postnavs);postnavs=null}jQuery.ajax({url:c,type:"get",dataType:"html",beforeSend:b,complete:a,success:d,error:g})} function ajaxSearch(c){function b(){jQuery("#search-form div").append('<span class="processing"></span>')}function a(){jQuery("#search-form span.processing").remove()}function d(e){contentSection=jQuery("#content");loadContent(e,contentSection,true)}function g(){jQuery("#search-form span.processing").remove();loadContent(contentCache,jQuery("#content"),true);searched=false}jQuery.ajax({url:c,type:"get",dataType:"html",beforeSend:b,complete:a,success:d,error:g})} function loadContent(c,b,a,d){b.animate({opacity:0,height:0},500,function(){jQuery("#header").ScrollTo(500);b.empty();b.html(c);a&&fixPaginator(c);processContent();fadingSlideDown(b,d)})}function fixPaginator(c){if(jQuery.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,b){jQuery("#comment-form .fade").remove();jQuery("#submit-button").after('<span class="fade ajax-comment-msg">'+c+"</span>");jQuery("#comment-form .fade").delay(2E3).fadeOut(500,function(){jQuery(this).remove();b&&typeof b=="function"&&b()})} function showError(c,b){jQuery("#comment-form .fade").remove();jQuery("#submit-button").after('<span class="fade ajax-comment-error">'+c+"</span>");jQuery("#comment-form .fade").delay(2E3).fadeOut(500,function(){jQuery(this).remove();b&&typeof b=="function"&&b()})}var contentCache,searched=false; jQuery(document).ready(function(){jQuery("#comment-form").submit(function(){ajaxSubmitComment();return false});jQuery(".commentnavi a").live("click",function(){var a=jQuery(this).attr("href").split(/(\?|&)action=cpage_ajax.*$/)[0],d=1;if(/comment-page-/i.test(a))d=a.split(/comment-page-/i)[1].split(/(\/|#|&).*$/)[0];else if(/cpage=/i.test(a))d=a.split(/cpage=/i)[1].split(/(\/|#|&).*$/)[0];var g=jQuery("#cp_post_id").text(),e=a.split(/#.*$/)[0];e+=/\?/i.test(a)?"&":"?";e+="action=cpage_ajax&post="+ g+"&page="+d;ajaxPaginateComments(e);return false});jQuery(".post-pages a").live("click",function(){var a=jQuery(this).attr("href").split(/(\?|&)action=spage_ajax.*$/)[0],d=1;if(/page=/i.test(a))d=a.split(/page=/i)[1].split(/(\/|#|&).*jQuery/)[0];var g=a.split(/#.*$/)[0];g+=/\?/i.test(a)?"&":"?";g+="action=spage_ajax";/page=/i.test(g)||(g+="&page="+d);ajaxPaginateSingular(g);return false});jQuery("body.home .pagenavi a, body.archive .pagenavi a, body.search .pagenavi a").live("click",function(){var a= jQuery(this).attr("href");if(/action=/i.test(a))a=a.replace(/action=[^#&]+/ig,"action=ppage_ajax");else{a+=/\?/i.test(a)?"&":"?";a+="action=ppage_ajax"}ajaxPaginatePosts(a);return false});jQuery("#search-form").submit(function(){var a=jQuery(this).find("#s").val();a=jQuery(this).attr("action")+"?s="+encodeURIComponent(a)+"&action=search_ajax";ajaxSearch(a);return false});var c,b;jQuery("#s").keyup(function(){clearTimeout(c);c=setTimeout(function(){var a=jQuery("#s"),d=a.val();if(d.length==0){if(searched){loadContent(contentCache, jQuery("#content"),true,function(){a.focus()});searched=false}b=d}else if(d!=b){if(!searched){contentCache=jQuery("#content")[0].innerHTML;searched=true}b=d;jQuery("#search-form").submit()}},800)})});