// wp-autopager-0.5.1.min.js
//  Released under the GPL license (http://www.gnu.org/copyleft/gpl.html)
var autopager=function(k,h,g,f){f=jQuery.extend({enable:true,remain:500,contentId:"content",postClass:"post",naviClass:"navigation",loadingSrc:"/wp-content/plugins/wp-autopager/images/ajax-loader.gif",loadingTxt:"Now Loading...",callback:function(){}},f);var d='<img src="'+f.loadingSrc+'" alt="'+f.loadingTxt+'" style="float:left;margin:0 1em;" /><p style="float:left;">'+f.loadingTxt+"</p>";var j=(h>g);var e=false;var l=function(){var p=window,r=document;var q=r.documentElement,o=r.body;var n=(p.pageYOffset?p.pageYOffset:(q&&q.scrollTop?q.scrollTop:(o?o.scrollTop:0)));return n};var m=function(){var p=window,r=document;var q=r.documentElement,o=r.body;var n=(p.innerHeight&&p.scrollMaxY?p.innerHeight+p.scrollMaxY:(o.scrollHeight>o.offsetHeight?o.scrollHeight:o.offsetHeight));var s=(p.innerHeight?p.innerHeight:(q&&q.clientHeight?q.clientHeight:(o?o.clientHeight:0)));return((n<s)?s:n)-s};var a=function(){if(e||j||!f.enable){return}if(m()-l()<f.remain){i()}var n=arguments.callee;setTimeout(n,100)};var c=function(){var o=jQuery("#"+f.contentId);var n=jQuery("div."+f.naviClass+":last",o);if(n.length<0){n=jQuery('<div class="'+f.naviClass+'"></div>');o.append(n)}return n};var i=function(){if(e||j||!f.enable){return}e=true;var n=k+h;if(n.indexOf("/page/")!=-1){n=n+"/"}n=n.replace("&amp;","&");jQuery.get(n,function(r,o){var q=c();var s=q.parent();q.remove();if(o==="success"){var t=jQuery.trim(r.replace(/[\r\n]/g,"").replace(/.*<body.*?>(.*?)<\/body>.*$/,"$1").replace(/<script.*?>.*<\/script>/g,""));var p=jQuery("div."+f.postClass+", div."+f.naviClass,jQuery("#"+f.contentId,jQuery(t)));s.append(p);if(typeof f.callback==="function"){f.callback(p)}h++}else{j=true}if(g!=0&&h>g){j=true}if(j){f.enable=false}e=false})};var b=function(){e=false;if(j){f.enable=false}jQuery(document).dblclick(function(){f.enable=f.enable?false:true;if(f.enable){a()}}).ajaxStart(function(){e=true;c().html(d)}).ajaxStop(function(){if(h>=g){j=true;f.enable=false;c().remove()}if(f.enable){a()}e=false});if(f.enable){a()}};b()};