// Body Height (For absolutely positioned container)
jQuery.fn.setMinWidth = function() {
	return this.each(function() {
		var ow = $(this).outerWidth();
		$(this, 'body').css("width", ow + "px");	
	});	
}

jQuery.fn.setMinHeight = function() {
	return this.each(function() {
		var oh = $(this).outerHeight();
		var wrapper = $(this).parents('div#wrapper');
		$(wrapper, 'body').css("min-height", (oh + 50) + "px");	
	});	
}

// Delay function used for delaying animations
jQuery.fn.delay = function(time, func) {
	this.each(function() {
		setTimeout(func, time);
	});
	return this;
};

// Vertical Align
jQuery.fn.vAlign = function(offset) {
	return this.each(function() {
	var oh = $(this).outerHeight();
	var mt = oh / 2;	
	$(this).css("margin-top", "-" + (mt + offset) + "px");	
	$(this).css("top", "50%");
	$(this).css("position", "absolute");	
	});	
}

// Horizontal Align
jQuery.fn.hAlign = function() {
	return this.each(function() {
	var ow = $(this).outerWidth();	
	var ml = ow / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	});
}

// Displays link title inside link
jQuery.fn.hoverTitles = function(element, speed) {
	if (speed === undefined) { speed = 250; }
	return this.each(function() {
		$(this).prepend("<" + element + ">" + $(this).attr("title") + "</" + element + ">")
			.mouseenter(function() { $(element, this).fadeIn(speed); })
			.mouseleave(function() { $(element, this).fadeOut(speed); })
			// Fix: Not Very Accessible
			.attr("title", "");
	});
}