(function($){

	$.fn.fptab = function() {
	
		return this.each(function() {
		
			var links = $(this).find('a');
						
			//nascondo i target...
			hideAll();
			
			//guardo se ne ho in querystring, altrimenti mostro la prima...
			var path = window.location.toString();
			var found = false;
			
			links.each(function() {
				var regex = eval('/' + $(this).attr('href') + '/gi');
				if ( path.match(regex) )
				{
					found = true;
					$($(this).attr('href')).show();
				}
			});
			
			if (!found)
			{
				$(links.eq(0).attr('href')).show();
			}
			
			links.click(function() {
			
				hideAll();
				$($(this).attr('href')).show();
				return false;
			
			});
			
			function hideAll()
			{
				links.each(function() {
					$($(this).attr('href')).hide();			
				});
			}
		
		});
	
	}

})(jQuery)
