function toggleBanner(type) {
	if (!type)
		type = ($("#banner:visible").length > 0) ? "hide" : "show";
	switch (type) {
		case "hide":
			$("#logo, #banner").slideUp("fast");
			$("#bannertoggle").text("v Show banner v");
			setCookie("banner", "false", 365);
			break;
		case "show":
			$("#logo, #banner").slideDown("fast");
			$("#bannertoggle").text("^ Hide banner ^");
			setCookie("banner", "true", 365);
			break;
	}
}
function setCookie(c_name, value, expiredays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie=c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
$(document).ready(function() {
	//menu hover fade effect
	var orgtext = $("#describer").html();
	var orgtimer = 200;
	$("#menu ul li a").hover(function() {
		var alink = this;
		$("#describer")
			.stop()
			.animate({opacity: 0}, orgtimer, null, function() {
				$("#describer")
					.html($(".desc", $(alink)).text())
					.animate({opacity: 1}, orgtimer);
			});
		delete alink;
	}).mouseout(function() {
		var oldtxt = orgtext;
		$("#describer")
			.stop()
			.animate({opacity: 0}, orgtimer, null, function() {
				var oldtxt2 = oldtxt;
				//animate property already set for a timeout
				$(this).animate({height: 'auto'}, 1100, null, function() {
						$(this)
							.html(oldtxt2)
							.animate({opacity: 1}, orgtimer*3);
					});
				delete oldtxt2;
			});
		delete oldtxt;
	});
	
	//search bar auto-fill
	var oldtext = $("#search .input-text").val();
	$("#search .input-text").focus(function() {
		if ($(this).val() == oldtext) {
			$(this).val("");
		}
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val(oldtext);
		}
	});
});
