// Custom Functions for DS Ergonomics


// Tab navigation - adds a fade transition between tabs
$(function() { $('#tabs-container-main').tabs({ fxFade: true, fxSpeed: 'fast' }); });

// Tab navigation - adds margin zero to final list item so it works in IE6
$(function(){ $(".tab-products li:last-child").css("margin-right","0px" ) })

// Tab navigation - Makes entire link clickable and sends to primary URL
$(function(){
		var block = $(".tab-products li");
		block.click(function(){
			window.location = $(this).find("a:first").attr("href")
		});
		block.addClass("clickable");
		block.hover(function(){
			window.status = $(this).find("a:first").attr("href")
		}, function(){
			window.status = ""
		})
});

// Product Thumbnails - Makes entire link clickable and sends to primary URL
$(function(){
		var block = $(".logo-thumbs li");
		block.click(function(){
			window.location = $(this).find("a:first").attr("href")
		});
		block.addClass("clickable");
		block.hover(function(){
			window.status = $(this).find("a:first").attr("href")
		}, function(){
			window.status = ""
		})
});

// Product Thumbnails - Hover State
$(document).ready(function(){
	$(".logo-thumb-view").fadeTo(300, 0);
	$(".logo-thumb-view").hover(function(){
	$(this).fadeTo(300, .95);
	},function(){
	$(this).fadeTo(300, 0);
	});
});

// Featured Panel - Makes entire link clickable and sends to primary URL
$(function(){
		var block = $(".content-side-featured");
		block.click(function(){
			window.location = $(this).find("a:first").attr("href")
		});
		block.addClass("clickable");
		block.hover(function(){
			window.status = $(this).find("a:first").attr("href")
		}, function(){
			window.status = ""
		})
});

// Anchor Link scrolls smoothly to top of page
$(document).ready(function() {
    $('a[href=#pagetop]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
});

	 
// Slide Panel Toggle
$(document).ready(function() { 
	//hide the all of the element with class slidepanel_body
	$(".slidepanel-body").hide();
	//toggle the componenet with class slidepanel_body
	$(".slidepanel-head").click(function() {
		$(this).toggleClass('active');
		$(this).next(".slidepanel-body").slideToggle(250);
	});
}); 



// Health and Safety Menu Image Rollover
$(document).ready(function() {
	$('img[data-hover]').hover(function() {
        $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    }).each(function() {
        $('<img />').attr('src', $(this).attr('data-hover'));
    });;
});


// Cufon Replace
$(document).ready(function(){
	Cufon.replace('.tel');
	Cufon.replace('.content h1');
	Cufon.replace('.content h2');
	Cufon.replace('.content .intro');
	Cufon.replace('#featured-slider h1');
	Cufon.replace('#featured-slider p');
});


	 
