$(document).ready(function() {
	
	$('#masthead li.nav_link a')
		.css( {backgroundPosition: "0px 0px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0px -10px)", color:"#0099ff"}, {duration:300})
			})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0px 0px)", color:"#333333"}, {duration:300})
		})

		$('div#footer ul.navigation li.products a').click(function() {
          $("div#products_nav").animate({marginTop: "0px", opacity: "1"}, {duration:600, easing: "easeInOutCubic"});
        });
	

	$('a#products, div#products_nav')
		.mouseover(function(){
			$("a#products").stop().animate({backgroundPosition:"(0px -10px)", color:"#0099ff"}, {duration:300})
			$("div#products_nav").stop().animate({marginTop: "0px", opacity: "1"}, {duration:600, easing: "easeInOutCubic"})
			})
		.mouseout(function(){
			$("a#products").stop().animate({backgroundPosition:"(0px 0px)", color:"#333"}, {duration:300})
			$("div#products_nav").stop().animate({marginTop: "-314px", opacity: "0"}, {duration:600, easing: "easeInOutCubic"})
		})
		
	$('#vid_header #preview')
		.mouseover(function(){
			$("#vid_header #preview img").stop().animate({opacity: "0"}, 600);
			})
		.mouseout(function(){
			$("#vid_header #preview img").stop().animate({opacity: "1"}, 600);
		})
		
	 	$('#vid_header #preview').click(function() {
          $("#vid_header #preview").fadeOut(600);
          $("#intro_video").show(0);
        });
                
        $('.close').click(function() {
          $("#vid_header #preview").fadeIn(600);
          $("#intro_video").animate({opacity: "1", top: "0"}, 600).hide(0);
          $("div#products_nav").animate({marginTop: "0px", opacity: "1"}, {duration:600, easing: "easeInOutCubic"});
        });

    $('#slideshow').before("<div id='slideshow_nav'></div>").cycle({
		fx: 'fade', 
		speed:  600, 
   		timeout:  5000,
    	pager:  '#slideshow_nav', 
   		pause: 1,
   		next: '#slideshow',
	});
		
	$('div.thumbnails_big div.thumbnail')
		.css( {backgroundPosition: "0 190px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 150px)"}, {duration:200})
			$(this).find("a").stop().animate({color: "#0099ff"}, {duration:200})
			})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 190px)"}, {duration:200})
			$(this).find("a").stop().animate({color: "#333333"}, {duration:200})
		})
		
	$('div.thumbnails_small div.thumbnail')
		.css( {backgroundPosition: "0 134px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 104px)"}, {duration:200})
			$(this).find("a").stop().animate({color: "#0099ff"}, {duration:200})
			})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 134px)"}, {duration:200})
			$(this).find("a").stop().animate({color: "#333333"}, {duration:200})
		})
		
	$('div#vid_header div#preview').animate({opacity: "1"}, {duration:500}).css("background","#000 url(/_images/homepage/header_over.jpg) no-repeat");
		
	$('div.header.homepage img')
		.css( {opacity: "0"} )
		.mouseover(function(){
			$(this).stop().animate({opacity: "1"}, {duration:500})
			})
		.mouseout(function(){
			$(this).stop().animate({opacity: "0"}, {duration:500})
	})
		
		$("li.distributor").equalHeights(50);
		$("div.two.content").equalHeights(100);
		$("div.four.content").equalHeights(100);
		
		$('div.one.title a#buy')
		.css( {backgroundPosition: "0 -42px"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)", color: "#ffffff"}, {duration:200})
			})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 -42px)", color: "#999999"}, {duration:200})
		})
});
