(function(jQuery) {
	jQuery.fn.biggerlink = function(options) {

		// Default settings
		var settings = {
			hoverclass:'hover', // class added to parent element on hover
			clickableclass:'boxAnchor', // class added to parent element with behaviour
			follow: true	// follow link? Set to false for js popups
		};
		if(options) {
			jQuery.extend(settings, options);
		}
		jQuery(this).filter(function(){
			 return jQuery('a',this).length > 0;

		}).addClass(settings.clickableclass).each(function(i){
		
			// Add title of first link with title to parent
			jQuery(this).attr('title', jQuery('a[title]:first',this).attr('title'));
			jQuery(this).attr({title: jQuery('h3',this).text()});
			
			// hover and trigger contained anchor event on click
			jQuery(this)
			.mouseover(function(){
				//window.status = jQuery('a:first',this).attr('href');
				jQuery(this).css('cursor', 'pointer');
				jQuery(this).addClass(settings.hoverclass);
			})
			.mouseout(function(){
				//window.status = '';
				jQuery(this).removeClass(settings.hoverclass);
			})
			.bind('click',function(){
				jQuery(this).find('a:first').trigger('click');
			})
			
			// triggerable events on anchor itself
			
			.find('a').bind('focus',function(){
				jQuery(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass);
			}).bind('blur',function(){
				jQuery(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass);
			}).end()
			
			.find('a:first').bind('click',function(e){
				if(settings.follow == true)
				{
					var chkScriptNum = this.href.indexOf('cript:');
					if(chkScriptNum == -1){
						if (this.href != undefined)
						{
							if (this.target == "_blank")
							{
								var win = window.open (this.href);
								win.focus ();
								e.preventDefault();
							} else
							{
								window.location = this.href;
							}
						}
					}else{
						eval(this.href.substr(chkScriptNum+6));
					}
				}
				e.stopPropagation(); // stop event bubbling to parent
			}).end()
			
			.find('a',this).not(':first').bind('click',function(){
				jQuery(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click');
				return false;
			});
		});
		return this;
	};
})(jQuery);

jQuery(function(){
	jQuery('.boxAnchor').biggerlink();
	//jQuery('.boxAnchor div').biggerlink({clickableclass:'linkActive',hoverclass:'hover'});
});

