 $(document).ready(function() {

$('#gallery').cycle({ 
    fx:     'fade', 
    timeout: 5000, 
    after:   onAfter,
    before:  onBefore,
	next:   '.next, #gallery', 
    prev:   '.prev', 
    pause:	1,
    pager:  '#gallery-controls li.center'      
 });

function onBefore() { 
	// $("#caption").html($(this).children().attr("title"));
	$("#caption").html($(this).attr("alt"));	
	$("#caption").addClass("active");
} 

 $(".gallery-container").hoverIntent(
      function () {
         $("#caption").addClass("hover");
      	 $('#caption:not(.active)').slideDown(500);
      }, 
      function () {
        $("#caption").removeClass("hover");      
        $('#caption').slideUp(250)
      }
    );


function onAfter() { 
	$("#caption").removeClass("active");
}
 
	//suggested products
	$('.suggested-products h2').toggle(
      function () {
        $(this).parent().css({height:'auto'});
        $(this).parent().addClass('open');
        //$(this).css({overflow:'auto'});
      },
      function () {
        $(this).parent().animate({height:'30'});
        $(this).parent().removeClass('open');      
      }
    );
	
	// remove styling on product variations
	$("table:not(.no-style) td").css({'border':'0', 'border-bottom' : '2px solid #FFFFFF'});
	$("table:not(.no-style)  tr:eq(0) td").css({'background-color' : '#CCCCCC', 'border-bottom' : '0px'})
	$("table:not(.no-style)  tr:eq(1) td").css({'background-color' : '#CCCCCC'})

	// remove alt tags from gallery
	$("#gallery img, #gallery a").attr({'title' : '', 'alt' : ''});

});


