jQuery(document).ready(function(){
	
//Slider Events

intervalSecconds = 5;

	$('#button a').click(function(){
		var integer = $(this).attr('rel');
		$('#slideshow .cover').animate({left:-940*(parseInt(integer)-1)})  /*----- Width of div mystuff (here 160) ------ */
		$('#button a').each(function(){
		$(this).removeClass('active');
			if($(this).hasClass('button'+integer)){
				$(this).addClass('active')}
		});
		clearInterval(interval);
		interval = window.setInterval(loopImage, intervalSecconds*1500);
		return false;
	});
	
	interval = window.setInterval(loopImage, intervalSecconds*1500);
	
	function loopImage() {
		if(!integer) {var integer = $("#button a.active").attr('rel');} //basicly just sets the integer to 1. 
		if(integer==3){ // if you're on the last slide
		$('#slideshow .cover').animate({left:+0}) // animate to start
		integer = 0; // reset integer
		} else {
		$('#slideshow .cover').animate({left:-940*(parseInt(integer))}) // animate to next slide width*slidenumber
		}
		$("a.active").removeClass('active'); // remove active class
		integer++; // +1 to integer
		$('.button'+integer).addClass('active'); // set active on current slide
		
	}
	
$("a img, a.tradeCta").css("opacity","1");

$("a img, a.tradeCta").hover(function() {
     $(this).css("opacity","0.8"); },
function() {
     $(this).css("opacity","1"); });

								
/*	// Lightbox
	$(function() {
		$(".lightbox").lightbox();
	});*/
	
	$(".lightbox").fancybox({
		'transitionIn'	:	'fade',
		'transitionOut'	:	'fade',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
	
	$(function () {
			var tabContainers = $('div.tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('div.tabs ul.tabNavigation a').click(function () {
					tabContainers.hide();
					tabContainers.filter(this.hash).fadeIn();
					$('div.tabs ul.tabNavigation a').removeClass('selected');
					$(this).addClass('selected');
					return false;
			}).filter(':first').click();
	});
	
	
	
	// Hide/Show Specifications
	$("img.spec").addClass("switchOff").click(function() {
													 
		if($(this).is(".switchOff")) {
			$(this).next().slideDown("slow", function() { 
				$(this).prev().removeClass("switchOff").addClass("switchOn");
			});
			
		} 
		if ($(this).is(".switchOn")) {
			$(this).next().slideUp("slow", function() { 
				$(this).prev().removeClass("switchOn").addClass("switchOff");
			});
		}
		
		return false;
		
	}).next().hide();
	
	
	$("#main #productMain2 a.areasCovered-a").click(function() {
		$("#main #productMain2 ul.areasCovered").stop(true, true).slideToggle('medium'); 
	});	
	
	$("#areasCta").click(function() {
		$("ul#areasDropdown").stop(true, true).slideToggle('medium'); 
	});		

});

