jQuery(document).ready(function(){
	
//Subnav Events
	$("ul#navigation li a.timber-services-a").hover(function() {
								 $("#dropdown-timber-services").stop(true, true).slideToggle('medium'); },
								 function() {
								 $("#dropdown-timber-services").stop(true, true).slideToggle('medium');
	});
	
	$("ul#navigation li a.fencing-gates-a").hover(function() {
								 $("#dropdown-fencing-gates").stop(true, true).slideToggle('medium'); },
								 function() {
								 $("#dropdown-fencing-gates").stop(true, true).slideToggle('medium');
	});	
	
	$("ul#navigation li a.indoor-products-a").hover(function() {
								 $("#dropdown-indoor-products").stop(true, true).slideToggle('medium'); },
								 function() {
								 $("#dropdown-indoor-products").stop(true, true).slideToggle('medium');
	});
	
	$("ul#navigation li a.outdoor-buildings-a").hover(function() {
								 $("#dropdown-outdoor-buildings").stop(true, true).slideToggle('medium'); },
								 function() {
								 $("#dropdown-outdoor-buildings").stop(true, true).slideToggle('medium');
	});		
	
	
	$("#dropdown-timber-services, #dropdown-fencing-gates, #dropdown-indoor-products, #dropdown-outdoor-buildings").hover(function() {
								 $(this).stop(true, true).show(); },
	function() {
								 $(this).stop(true,true).slideUp('medium');
								 
	});	
	
	// Lightbox
	$(function() {
		$(".lightbox").lightbox();
	});

	// Hide/Show Specifications
	$("p.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();
	
	// Moving and zooming Slideshow
$('#test1').crossSlide({
	fade: 1
}, [
  {
    src:  'images/misc/slide-1.jpg',
     <!--href: 'http://flickr.com/photos/spacetrucker/94209642/',--> <!-- add this to make photo a hyperlink-->
    from: '100% 80% 1x',
    to:   '100% 0% 1.3x',
    time: 5
  }, {
    src:  'images/misc/slide-2.jpg',
    from: 'top left',
    to:   'bottom right 1.3x',
    time: 5
  }, {
    src:  'images/misc/slide-3.jpg',
    from: '100% 80% 1.3x',
    to:   '80% 0% 1.2x',
    time: 5
  }, {
    src:  'images/misc/slide-4.jpg',
    from: '100% 50%',
    to:   '30% 50% 1.3x',
    time: 5
  }
]);

//Hover Events
	$("#buckets a").css("opacity","1");
	
	$("#buckets a").hover(function() {
		 $(this).css("opacity","0.8"); },
	function() {
		 $(this).css("opacity","1"); });

});

// SlideShow
	function slideSwitch() {
		var $active = $('#slideshow img.active');
	
		if ( $active.length == 0 ) $active = $('#slideshow img:last');
	
		var $next =  $active.next().length ? $active.next()
			: $('#slideshow img:first');
	
		$active.addClass('last-active');
	
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
			});
	}
	
	$(function() {
		setInterval( "slideSwitch()", 3000 );
	});
