
jQuery(document).ready(function(){
	
	/* hover effect to menu items */
	if( jQuery('ul.products-menu').length > 0  ) {
		
		jQuery("ul.products-menu li").hover(
			function(){ jQuery(this).addClass('slctNav') },
			function(){ jQuery(this).removeClass('slctNav') }
		);
		
	}
	
	/* remove empty ul form DOM */
	if( jQuery('ul.sub-menu').length > 0  ) {
		
		jQuery("ul.sub-menu").each( function(){
												
			var noOfAnchorTag = jQuery(this).find('a').length;
			if( noOfAnchorTag == 0 ) jQuery(this).remove();
												
		} );
		
	}
	
	/* add li wrapper and h3 to submenus */
	if( jQuery('ul.sub-menu').length > 0  ) {
		
		jQuery("ul.products-menu ul.sub-menu").each( function(){
			
			var menuTextH3 = "";
			var menuText = jQuery(this).parent().find('a:first').text();
			if( menuText != "" ) {
				menuTextH3 = '<h3>'+ menuText +'</h3>';
			}
			
			var innerHtmlOfSubmenu = jQuery(this).find('li').html();
			jQuery(this).find('li').html( menuTextH3 + innerHtmlOfSubmenu );
									
		} );
		
	}
	
	/* initiate cycle */
	if( jQuery('#rotate').length > 0  ) {
		jQuery('#rotate').cycle({
			fx: 'fade',
			speed: 600
		});
	}
		
});
