// Version 1.0 - October 19, 2007 (with a local IE bug fix (patch submitted) and target handling)
// Requires http://jquery.com version 1.2.1
(function($) {
	$.fn.biggerlink = function(options) {

		// Default settings
		var settings = {
			hoverclass:     'hover',	// class added to parent element on hover
			clickableclass: 'hot',		// class added to parent element with behaviour
			follow:          true		// follow link? Set to false for js popups
		};
		if(options) {
			$.extend(settings, options);
		}
		$(this).filter(function() {
			 return $('a', this).length > 0;

		}).addClass(settings.clickableclass).each(function(i) {
		
			// Add title of first link with title to parent
			$(this).attr('title', $('a[title]:first', this).attr('title'));
			
			// hover and trigger contained anchor event on click
			$(this)
			.mouseover(function() {
				window.status = $('a:first', this).attr('href');
				$(this).addClass(settings.hoverclass);
			})
			.mouseout(function() {
				window.status = '';
				$(this).removeClass(settings.hoverclass);
			})
			.bind('click', function() {
				//
				// Triggering 'click' with IE only triggers the href,
				// IE wants you to trigger onclick to execute the
				// onclick handler. Safari and Firefox include the
				// onclick handler when you trigger('click').
				//
				var $a = $(this).find('a:first');
				if($a.attr('onclick')) {
					$a.trigger('onclick');
				}
				else {
					$a.trigger('click');
				}
			})
			
			// triggerable events on anchor itself
			
			.find('a').bind('focus', function() {
				$(this).parents('.' + settings.clickableclass).addClass(settings.hoverclass);
			}).bind('blur', function() {
				$(this).parents('.' + settings.clickableclass).removeClass(settings.hoverclass);
			}).end()
			
			.find('a:first').bind('click', function(e) {
				if(this.target
				&& this.target == '_blank') {
					window.open(this.href);
				}
				else if(settings.follow == true) {
					window.location = this.href;
				}
				e.stopPropagation();
			}).end()
			
			.find('a', this).not(':first').bind('click', function() {
				$(this).parents('.' + settings.clickableclass).find('a:first').trigger('click');
				return false;
			});
		});
		return this;
	};
})(jQuery);

