var ms_wp_post_viewer = {
	pvCurrent:	1,
	pvcId:		1,
	pvMax:		5,
	pvId:		"showPostId",
	pvSelect:	"showPostSelect",
	pvMore:		"showPostMore",
	pvCon:		"showPostCon",
	pvNav:		"showPostNav",
	showPost:	function(id)
	{
		var tempOld = this.pvcId;

		if(id == "p")
		{
			if(this.pvcId == 1)
			{
				this.pvcId = this.pvMax;
			}
			else
			{
				this.pvcId -= 1;
			}
		}
	
		if(id == "n")
		{
			if(this.pvcId == this.pvMax)
			{
				this.pvcId = 1;
				
			}
			else
			{
				this.pvcId += 1;
				
			}
		}
	
		if(id != "p" && id != "n")
		{
			this.pvcId = parseInt(id);
		}
		
		var tempObj = this;
		
		
		//$("#" + this.pvCon).css("height", $("#" + this.pvId + tempOld).height() + 20 + "px");
	
		$("#" + this.pvId + tempOld).fadeOut("slow", function()
		{
			//$("#" + tempObj.pvCon).animate({height: $("#" + tempObj.pvId + tempObj.pvcId).height() + 20 + "px"}, function()
			//{
				
			//});
		});
		$("#" + tempObj.pvId + tempObj.pvcId).fadeIn("slow");
	},
	showMore:	function()
	{
		//$("#" + this.pvMore + this.pvcId).show("slow");
		//alert('test');
		//alert(this.pvcId);
		location.href= $("#showPostPermaLink" + this.pvcId).val();
	},
	displayNav:	function()
	{
		var temp = $('div[id*="' + this.pvId + '"]');
		
		var outputHtml = "";
		
		
		if(temp.length > 1)
		{
			this.pvMax = temp.length;
		
			if(this.pvMax > 1)
			{
				
				setTimeout("ms_wp_post_viewer.showOnTimer()", 5000);
				//alert('test');
			}
			/*outputHtml += "<span onclick='ms_wp_post_viewer.showPost(\"p\")'  style='cursor: pointer; color: white;'>&lt;</span>&nbsp;";
			
			for(var i = 0; i < temp.length; i++)
			{
				outputHtml += "<span onclick=\"ms_wp_post_viewer.showPost('" + (i + 1) + "')\" id=\"showPostSelect" + (i + 1) + "\" style='cursor: pointer; color: white;'>" + (i + 1) + "</span>&nbsp;";
			}
			
			outputHtml += "<span onclick='ms_wp_post_viewer.showPost(\"n\")'  style='cursor: pointer; color: white;'>&gt;</span>&nbsp;";
		
			$("#" + this.pvNav).html(outputHtml);*/
		}
		
	},
	showOnTimer: function()
	{
		this.pvCurrent++;

		if(this.pvCurrent > this.pvMax)
			this.pvCurrent = 1;

		ms_wp_post_viewer.showPost(this.pvCurrent);

		
		

		

		setTimeout("ms_wp_post_viewer.showOnTimer()", 6000);
	}


}
