
/* ----- global nav description thingy */

$(document).ready(function(){
	$("#global-nav").hover(function() {
	  $("#global-nav-desc").fadeIn("fast");
	}, function() {
	  $("#global-nav-desc").fadeOut("fast");
	});
	
	$("#global-nav a").hover(function() {
	  // $("#global-nav-desc").fadeIn("fast", function(){ 
	  var hoverText = $(this).attr("title");
	  $("#global-nav-desc span").text(hoverText);
	  // $("#global-nav-desc span").text(hoverText).fadeIn("fast");
	}, function() {
	  $("#global-nav-desc span").text("");
	  // $("#global-nav-desc span").fadeOut("fast").text("");
	});
	
});



/* ----- site nav dropdown menu */

$(document).ready(function(){
	$("ul#site-nav").superfish({
		animation: {opacity:'show',height:'show'},
		autoArrows: false,
		dropShadows: false
	});
});



/* ----- forum button stuff */

function navHover(which)
{					
	if ($(which.id))
	{
		cur = $(which.id).className;
		if (cur == 'buttonLarge') { $(which.id).className = 'buttonLargeHover' }
		else if (cur == 'buttonSmall') { $(which.id).className = 'buttonSmallHover' }
	}
}

function navReset(which)
{					
	if ($(which.id))
	{
		cur = $(which.id).className;
		if (cur == 'buttonLargeHover') { $(which.id).className = 'buttonLarge' }
		else if (cur == 'buttonSmallHover') { $(which.id).className = 'buttonSmall' }
	}
}

function navJump(where)
{
	window.location=where;
}



/* ----- jQuery listify plugin  */

/**
  *
  * http://www.dyve.net/jquery/?listify
  *
  * @name  listify
  * @type  jQuery
  * @param Hash    settings             settings 
  * @param String  settings[selector]   selector to use
  * @param String  settings[hoverClass] class to apply to items that the mouse is over an item
  * @param String  settings[cursorType] cursor type to change to when the mouse is over an item
  * @param Bool    settings[hideLink]   whether or not to hide the link
  */
(function($) {
	$.fn.listify = function(settings) {
		settings = $.extend({
			hoverClass: "hover",
			cursorType: "pointer",
			selector: "tbody tr",
			hideLink: false
		}, settings);
		$(settings.selector, this).each(function() {
			var anchor = $("a", this);
			if (anchor.length == 1) {
				anchor = $(anchor.get(0));
				var thickbox = anchor.is(".thickbox");
				var link = anchor.attr("href");
				if (link) {
					if (settings.hideLink) {
						var text = anchor.html();
						anchor.after(text).hide();	
					}
					$(this)
						.css("cursor", settings.cursorType)
						.hover(
							function() { $(this).addClass(settings.hoverClass) },
							function() { $(this).removeClass(settings.hoverClass) }
						)
						.click(function() {
							if (thickbox) {
								anchor.click();
							} else {
								window.location.href = link;
							}
						});
				}
			}
		});
		return this;
	}
})(jQuery)