jQuery(document).ready(function() {
    // Animate the reveal of the navigation thumbs
    jQuery('#navigation-feature').animate({
        right: -20
    },  350 );
    
    // In this specific case the 'hidden' case causes dynamic switching visual problems.
    // Replace them all with jQuery's hiding abilities
    jQuery('#feature li.feat.hidden').hide().removeClass( 'hidden' );

    // Set up the 5-secondly image rotator. This fires the click.machine event on each
    // image in the feature nav.
    // var rotatorCount = 0;
	var featureRotator;
	// 	var featureRotator = setInterval(function() {
	// 		rotatorCount = ( rotatorCount < 2 ) ? rotatorCount + 1 : 0;
	// 		jQuery('#navigation-feature a:eq(' + rotatorCount + ')').trigger( 'click.machine' );
	//  }, 9000);
    
    // Setup both the human click and machine click event handlers.
    // These both do the same thing except that the human click also performs a clearInterval
    // on the image rotator.
    jQuery('#navigation-feature a').bind('click click.machine', function(event) {
        event.preventDefault();
        
        var featureToShow = jQuery(this).parent().attr( 'id' ).replace( '-tab', '' );
        
        // Prevent clicking on already active feature images
        if( !jQuery(this).hasClass('active') ) {
            jQuery('#navigation-feature a.active').removeClass( 'active' );
            jQuery(this).addClass( 'active' );

            // Hide the image and text in the desired feature
            jQuery('#' + featureToShow + ' img.feature').hide();
            jQuery('#' + featureToShow + ' div').children().hide();

            // Show the desired feature
            jQuery('#' + featureToShow).show();

            // Hide all features
            jQuery('#feature li.feat:visible:not(#' + featureToShow + ')').hide();
            
            // Fade in the text and image of the feature
            jQuery('#' + featureToShow + ' img.feature').fadeIn();
            jQuery('#' + featureToShow + ' div').children().fadeIn();
        }
    })
    .click(function(event) {
        clearInterval(featureRotator);
    });
});



jQuery(document).ready(function() {
    // Animate the reveal of the navigation thumbs
    jQuery('#navigation-feature2').animate({
        right: -20
    },  350 );
    
    // In this specific case the 'hidden' case causes dynamic switching visual problems.
    // Replace them all with jQuery's hiding abilities
    jQuery('#feature li.feat.hidden').hide().removeClass( 'hidden' );

    // Set up the 5-secondly image rotator. This fires the click.machine event on each
    // image in the feature nav.
    //var rotatorCount = 0;
	var featureRotator;
   // var featureRotator = setInterval(function() {
   //     rotatorCount = ( rotatorCount < 4 ) ? rotatorCount + 1 : 0;
   //     jQuery('#navigation-feature2 a:eq(' + rotatorCount + ')').trigger( 'click.machine' );
    //}, 9000);
    
    // Setup both the human click and machine click event handlers.
    // These both do the same thing except that the human click also performs a clearInterval
    // on the image rotator.
    jQuery('#navigation-feature2 a').bind('click click.machine', function(event) {
        event.preventDefault();
        
        var featureToShow = jQuery(this).parent().attr( 'id' ).replace( '-tab', '' );
        
        // Prevent clicking on already active feature images
        if( !jQuery(this).hasClass('active') ) {
            jQuery('#navigation-feature2 a.active').removeClass( 'active' );
            jQuery(this).addClass( 'active' );

            // Hide the image and text in the desired feature
            jQuery('#' + featureToShow + ' img.feature').hide();
            jQuery('#' + featureToShow + ' div').children().hide();

            // Show the desired feature
            jQuery('#' + featureToShow).show();

            // Hide all features
            jQuery('#feature li.feat:visible:not(#' + featureToShow + ')').hide();
            
            // Fade in the text and image of the feature
            jQuery('#' + featureToShow + ' img.feature').fadeIn();
            jQuery('#' + featureToShow + ' div').children().fadeIn();
        }
    })
    .click(function(event) {
        clearInterval(featureRotator);
    });
});