/* SLIDESHOW */

function slideSwitch() {
    var $active = jQuery('#text-fader li.active');

    if ( $active.length == 0 ) $active = jQuery('#text-fader li:last');

    var $next =  $active.next().length ? $active.next()
        : jQuery('#text-fader li:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
jQuery(function() {
    setInterval( "slideSwitch()", 5500 );
});


/* SELECTOR DROPDOWN */

jQuery(function(){
	jQuery('#selector ul li').hover(function(){
		jQuery(this).removeClass('slider');
		jQuery(this).find('ul').slideDown('0');
	},
	function(){
		jQuery(this).find('ul').stop(true, true).slideUp('0');
	});

});

/* PRODUCT OPTION DROPDOWN */

jQuery(function(){
	jQuery('#products-options li').hover(function(){
		jQuery(this).find('ul').addClass('show');
	},
	function(){
		jQuery(this).find('ul').removeClass('show');
	});

});


/* CLEAR SEARCH BOX */

jQuery(function(){
	jQuery('#header form input').focus(function(){
		if(jQuery(this).attr('value') == 'enter a search term or part number') {
			jQuery(this).attr('value', '');
		}
	});
	/*
	jQuery('#search form input').blur(function(){
		jQuery(this).attr('value','enter a search term or part number')
	});
	*/
});

/* NEWSLETTER SIGNUP */

jQuery(function() {
	jQuery('#footer-content input').focus(function() {
		if(jQuery(this).attr('value') == 'enter your email address') {
			jQuery(this).attr('value', '');
		}
	});
});

jQuery(function() {
	jQuery('a.new-window').click(function() {
		window.open(jQuery(this).attr('href'));
		return false;
	});
});
