// jQuery plugin - Dolphin Top Menu
(function(jQuery){
	jQuery.fn.navigaciq = function() {
		return this.each( function(){
			
			var show = function() {
				var o = jQuery(this).attr('showsub');
				jQuery( o ? o : this ).attr( 'hover', 'true' ).show();
				
			};
			
			var hide = function() {
				var o = jQuery(this).attr('showsub');
				var jQueryo = jQuery( o ? o : this );
				
				jQueryo.attr( 'hover', 'false' );
				
				setTimeout( function() {
					if( jQueryo.attr( 'hover' ) != 'true' ) {
						jQueryo.hide();
						
						if( jQueryactiveSub != 'undefined' && jQueryinactiveSubs.filter('[hover=true]').length == 0 )
							jQueryactiveSub.show();
					}
				}, 100 );
			};
			
			var jQueryinactive  = jQuery( 'a', this );
			var jQueryactive    = jQuery( 'a.selected', this );
			
			var jQueryactiveSub;
			var jQueryinactiveSubs;
			
			if( jQueryactive.length && jQueryactive.attr('showsub') )
				jQueryactiveSub = jQuery( jQueryactive.attr('showsub') );
				jQueryactiveSub.show();
			
			jQueryinactive.hover( show, hide ).each( function() {
				if( !jQueryinactiveSubs )
					jQueryinactiveSubs = jQuery( jQuery(this).attr('showsub') );
				else
					jQueryinactiveSubs = jQueryinactiveSubs.add( jQuery(this).attr('showsub') );
					
			} );
		
			jQueryinactiveSubs.hover( show, hide );
		} );
	};
})(jQuery);