// THIS FILE CONTAINS ALL THE SETTINGS FOR THE JQUERY PLUGINS USED
jQuery(document).ready(function () {


//ACCORDION
	jQuery("#sideNav").accordion({
		collapsible: true,
		autoHeight: false,
		active: 'li.active .hasChildrenLink'
	});
// BRING BACK HIDDEN PANES AFTER JS LOADED TO PREVENT FOUC
	jQuery('#panes .paneBody').css('visibility','');
	
//JQUERY TOOLS TABS 
	jQuery("#tabs").tabs("#panes > div").history(); 
	
// JQUERY TOOLS SLIDESHOW (CYCLE)
	jQuery("#focusControllers").tabs("#focusSlides > div", { 
	        effect: 'fade', 
			rotate: true
	 
	}).slideshow({
			autoplay: true,
			interval: 7500	
	});
	
// BEAUTY TIPS (TOOLTIP)
	jQuery('.tooltip').bt({
		ajaxPath: ["$(this).attr('href')", "div#summary"],
		//contentSelector: "$('#summary28')",		
		fill: '#FFF',
		cornerRadius: 3,
		shadow: true,
		shadowOffsetX: 1,
		shadowOffsetY: 1,
		shadowBlur: 5,
		shadowColor: 'rgba(0,0,0,.4)',
		shadowOverlap: false,
		noShadowOpts: {strokeStyle: '#999', strokeWidth: 2},
		width: 220,
		spikeLength: 26,
		spikeGirth: 9,
		padding: 15,
		strokeWidth: 0,
		strokeStyle: '#ABABAB',
		strokeWidth: 1,

		hoverIntentOpts: {
	    	interval: 500,
	    	timeout: 750
	  	},
	  
		showTip: function(box){
			jQuery(box).fadeIn(500);
	  	},

		hideTip: function(box, callback){
			jQuery(box).animate({opacity: 0}, 500, callback);
		}
	});
	
// ADD CLASS TO HYDRAULIC LINKS WITH NO PREVIEWS LINKED
    jQuery("#hydraulicList").find('a[href="javascript:;"],a[href=""]').addClass('disabled').removeClass('zoom').attr('title', 'Not Available');
    
//FANCYZOOM
 	jQuery('.viewCutaway,.zoom').fancybox({
		'hideOnOverlayClick' 	: true,
		'hideOnContentClick' 	: false,
		'imageScale'			: false,
		'centerOnScroll'		: false,
		'imageScale'			: true,
		'overlayOpacity'		: .8
	});
	
	jQuery('.askQuestion').fancybox({
		'hideOnOverlayClick' 	: false,
		'hideOnContentClick' 	: false,
		'centerOnScroll'		: true,
		'frameHeight'			: 500,
		'overlayOpacity'		: .5
	});
	
	jQuery('[href*=".gif"],[href*=".jpg"],[href*=".png"],[href*=".GIF"],[href*=".JPG"],[href*=".PNG"]').fancybox({
		'hideOnOverlayClick' 	: true,
		'hideOnContentClick' 	: false,
		'imageScale'			: false,
		'centerOnScroll'		: false,
		'imageScale'			: true,
		'overlayOpacity'		: .8
	});
	

// CYCLE PLUGIN
/*    jQuery('#focusSlides').cycle({ 
		fx:	'fade', 
		timeout: 5500,
		pager:  '#focusControllers',
		cleartypeNoBg: true,
		pagerAnchorBuilder: function(idx, slide) { 
        // add click control to slideshow with thumbnails
        return '#focusControllers li:eq(' + idx + ') a'; 
		}
	});
*/

//CUSTOM JQUERY STUFF
	jQuery('#featuredProducts li:nth-child(even)').addClass('even');
	jQuery('#featuredProducts li:nth-child(4n), #featuredProducts li:nth-child(4n-1)').addClass('alt');

	jQuery('#compareTable tr:nth-child(even),.errorReference tr:nth-child(even),#rfqForm tr:nth-child(even)').addClass('alt');
	jQuery('#rfqForm.mixerRfq tr:nth-child(even)').addClass('alt2');

	// SHOW + HIDE COLUMNS
	jQuery('input[type="checkbox"]').click(function() {
        var index = jQuery(this).attr('name').substr(3);
        index--;
        jQuery('table tr').each(function() { 
            jQuery('td:eq(' + index + ')',this).toggle();
        });
        jQuery('th.' + jQuery(this).attr('name')).toggle();
    });

// CHECK ALL BOXES ON LOAD
        jQuery("#compareChecks").find("[type='checkbox']").each(function(){
            this.checked = true;
        });

// HIGHLIGHT ROWS ON HOVER
	jQuery('#rfqForm td').mouseover(function () {
		 jQuery(this).parent('tr').addClass('rowHover')
    });

	jQuery('#rfqForm td').mouseout(function () {
		 jQuery(this).parent('tr').removeClass('rowHover')
    });
//HIGHLIGHT FIELDS ON FOCUS

    jQuery('#rfqForm input[type="text"], #rfqForm textarea').focus(function () {
		 jQuery(this).addClass('currentField')
    });
    jQuery('#rfqForm input[type="text"], #rfqForm textarea').blur(function () {
		 jQuery(this).removeClass('currentField')
    });

/*
// CHECK ALL BOXES
    jQuery("a.checkAll").click(function(){
        jQuery("#compareChecks").find("input[@name=" + name + "][type='checkbox']").each(function(){
            this.checked = true;
        });
    });
// UNCHECK ALL BOXES
    jQuery("a.uncheckAll").click(function(){
        jQuery("#compareChecks").find("input[@name=" + name + "][type='checkbox']").each(function(){
            this.checked = false;
        });
    });
*/


// CUFON
	Cufon.replace('#content h1, #modalHeading', {
		fontFamily 	: 'DIN',
		fontSize	: 22
	});
		Cufon.replace('#sidebar h3', {
		fontFamily 	: 'DIN',
		fontSize	: 15
	});

});//end document ready
