(function($){
	$.fn.elementLink = function(options) {

		// setting defaults
		var defaults = {
			hoverClass											: 'hovering',		// the hover class to be added to the element
			linkClass												: 'a.hideable',		// the link class which could be hidden
			hideLink												: true
		};

		var options = $.extend(defaults, options);

		return this.each(function() {
			var o_obj = this;


			// on mouse over {{{
			$(o_obj).bind('mouseenter', function () {
				$(this).addClass(options.hoverClass).css('cursor', 'pointer');
				$(this).bind('click', function () {
					window.location.href = jQuery(this).find('a').attr('href');
				});
			});
			// }}]

			// on mouse out {{{
			$(o_obj).bind('mouseleave', function () {
				$(this).removeClass(options.hoverClass).css('cursor', '');
				$(this).unbind('click');
			});
			// }}}


			// do we need to hide the link?
			if(options.hideLink == true) {
				$(options.linkClass).hide();
			}
		});
	};
})(jQuery);

