var curr;
	function nextPage(){
		jQuery("#mod-buttons").text("Loading...");
			if(typeof jQuery(".navigation .alignright *:last").attr("href") != "undefined")
				{window.location = jQuery(".navigation .alignright *:last").attr("href") +"#continue";}
			else
				jQuery("#mod-buttons").html('<p>You are all done voting!!!</p>');
	}
	function prevStory(){
		curr = curr.slideToggle().prev(".post").slideToggle();
		if(!curr.prev(".post").html())
			jQuery("#mod-prev").hide();
	}
	function nextNew(){
		if(!curr.next(".post").html())
			nextPage();
		curr = curr.slideToggle().next(".post").slideToggle();
		jQuery("#mod-prev").show();
	}
	
		
jQuery(document).ready(function($){
		$("#votebox").append('<div id="mod-buttons"><div><input id="mod-report" type="submit" value="No" accesskey="n" /><input id="mod-skip" type="submit" value="Skip" accesskey="k" onclick="javascript:nextNew();"/><input id="mod-vote" type="submit" value="Yes" accesskey="y" /><input id="mod-prev" type="submit" value="Back" onclick="javascript:prevStory(); return false;"/></div></div>');
		curr = $("div.post").eq(0).show();
		$(".votelink a, .reportlink a").click(function(e){
			nextNew();
		});
		$("#mod-vote").click(function(e){
			if(typeof $(curr).find(".bartext a").eq(0).attr("href") != "undefined")
			{window.location = $(curr).find(".bartext a").eq(0).attr("href");}
			nextNew();
		});
		$("#mod-report").click(function(e){
		if(typeof $(curr).find(".bartext a").eq(1).attr("href") != "undefined")
			{window.location = $(curr).find(".bartext a").eq(1).attr("href");}
			nextNew();
		});
	});
