$(function(){
	
	$('#testimonials p').hide();
	$('#testimonials').find("p:random").show();
	
	$('#sidebar-testimonials div').hide();
	$('#sidebar-testimonials').find('div:random').show();
	
	$('#category-product-list li').addClass('clearfix');
	$('.ProductList').addClass('clearfix');
	$('.SubCategoryListGrid').addClass('clearfix');
	$('.SubCategoryListGrid li:odd').hide();
	$('.storycontent').addClass('clearfix');
		
	imgSrc = $('#LightBoxImages').find('a:first').attr('href');

	$('#product-large-image').find('img').attr('src', imgSrc);
	
	$('#slide-wrap').cycle({ 
	    fx:     'fade', 
	    speed:  'fast', 
	    timeout: 9000, 
	    next:   '#next', 
	    prev:   '#prev' 
	});
	
	$('#main-nav > li').bind("mouseover", function(){
     	$(this).children("ul").show();
    });
    $('#main-nav > li').bind("mouseout", function(){
     	$(this).children("ul").hide();
    });

	$("#content-block h2:contains('Accessories')").siblings("div, h3").hide();
	
	$("#content-block h2:contains('Testimonials')").siblings("div").addClass('testimonials-wrap').find('p:has("em")').addClass('clearfix right-line').after("<div class='clear'></div>");

	$("#content-block h2:contains('Testimonials')").siblings("div").find('p:has("img")').addClass('test-image');
	
	
	$('.blog-content #main #content-block #PageContent .BlockContent').children('a').addClass('blog-post-title').bind('click', function(){
		return false;
	});
	
	$('.SubCategoryListGrid ul li').find('a:first').css({
		'height': '120px'
	});

});

$(function(){

	$(".section-panel").equalHeights();

});

$(function(){
	
	$('#home-video-box div').hide();
	
	$('#home-video-box div:first').show();

	$('#video-list').find('li a.vid-link').bind("click", function(){
		
		tabHref = $(this).attr('href');
		
		$('#home-video-box div').hide();
		
		$(tabHref).show();
		
		return false;
		
	});

});


$(window).load(function() {

	flowplayer("a.video-link", "http://www.yeticoolers.com/templates/YETI/assets/swf/flowplayer.commercial-3.1.1.swf", { 
    // product key from your account 
    key: '$8880dba84aa37c35a55'
});

});


$(function(){
	
	$('a[href=#video-grizzly-shorter]').hide();
	$('#video-grizzly-longer').hide();
	
	$('a[href=#video-grizzly-longer]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#video-grizzly-shorter').hide();
      $(this).hide();
      $('a[href=#video-grizzly-shorter]').show();
      return false;
    });
    $('a[href=#video-grizzly-shorter]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#video-grizzly-longer').hide();
      $(this).hide();
      $('a[href=#video-grizzly-longer]').show();
      return false;
    });


});

$(function(){
	
	$('a[href=#video-500-shorter]').hide();
	$('#video-500-longer').hide();
	
	$('a[href=#video-500-longer]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#video-500-shorter').hide();
      $(this).hide();
      $('a[href=#video-500-shorter]').show();
      return false;
    });
    $('a[href=#video-500-shorter]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#video-500-longer').hide();
      $(this).hide();
      $('a[href=#video-500-longer]').show();
      return false;
    });
    
    $('#map-illustrated').hide();
    $('a[href=#map-google]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#map-illustrated').hide();
      return false;
    });
    $('a[href=#map-illustrated]').bind("click", function(){
      var tarGet = $(this).attr("href");
      $(tarGet).show();
      $('#map-google').hide();
      return false;
    });

$("h2:contains('YETI Videos')").next().addClass('video-page');

});



function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';
 params += ', menubar=no';
 params += ', location=no';
 params += ', status=no';
 params += ', toobar=no';

 newwin=window.open(url,'flip', params);
 if (window.focus) {newwin.focus()}
 return false;
}
