function ShowHideNaviLink(id)
{
	$('#headernavi ul').slideUp();
	if(id != "body")
	{
		var navTop = "#" + id + "Top";
		var pos = $(navTop).offset();
		var style = $("body").css("background-color");
		$('#' + id).css({"background-color": style, "left": (pos.left - 20) + "px", "top": (pos.top + 20) + "px"});
		$('#' + id).slideToggle();
	}
}
function changeTo(myId){$("#" + myId).attr("class", "myHighlight");}
function changeBack(myId){$("#" + myId).attr("class", "myDefault");}
function searchFic()
{
	var srchFic = $("#srchFic").val();
	var srchCat = $("#srchCat").val();
	var sort = $("#sort").val();
	$.get("searchFic.php", {"srchFic": srchFic, "srchCat": srchCat, "sort": sort}, 
		function(data)
		{
			$("#result").html(data);
			var sortText = "";
			switch(sort)
			{
				case "title": sortText = "Sorted By: Series (Alphabetically Ascending), Title (Alphabetically Ascending)"; break;
				case "author": sortText = "Sorted By: Author (Alphabetically Ascending, disregarding upper vs. lower case and pennames that start with 'The'), Series (Alphabetically Ascending), Title (Alphabetically Ascending)"; break;
				case "rating": sortText = "Sorted By: Rating (G > G to PG > PG > PG to PG-13 > PG-13 > PG-13 to R > R > R to NC-17 > NC-17), Series (Alphabetically Ascending), Title (Alphabetically Ascending)"; break;
				case "complete": sortText = "Sorted By: Completion Status (Incomplete > Complete), Title (Alphabetically Ascending)"; break;
				default: sortText = "Sorted By: Updated Status (New > Updated > Not Updated), Series (Alphabetically Ascending), Title (Alphabetically Ascending)";
			}
			$("#sorted").html(sortText);
			CheckStyle();
		}
	);
}
function CheckStyle()
{
	var style;
	if($.cookie("style6x2") != null){style = $.cookie("style6x2");}
	else{style = "white";}
	ChangeStyle(style);
}
function ChangeStyle(style)
{
	$.cookie("style6x2", style, {expires: 1, path: "/"});
	$("link.customStyle").attr("href", style + ".css");
}
var naviTO;
function SetNavTO(){naviTO = window.setTimeout(function(){ShowHideNaviLink('body');}, 500);}
function ClearNavTO(){window.clearTimeout(naviTO);}
