$(document).ready(function() {
  Cufon.replace(".cufon", {hover:true});
  Cufon.replace(".product #primary h4");

  $("#featured_products li").hover(
    function() {
      var pn = $(this).children("#prod_feature").children(".prod_title").children(".prod_name");
      Cufon.replace(pn, {
        color: '#000000'            
      });
    },
    function() {
      var pn = $(this).children("#prod_feature").children(".prod_title").children(".prod_name");
      Cufon.replace(pn, {
        color: '#ffffff'            
      });
    }
  );

  $(".search_result #featured_products li").hover(
    function() {
      var pn = $(this).children("#prod_feature").children(".prod_title").children("a").children(".prod_name");
      Cufon.replace(pn, {
        color: '#000000'            
      });
    },
    function() {
      var pn = $(this).children("#prod_feature").children(".prod_title").children("a").children(".prod_name");
      Cufon.replace(pn, {
        color: '#ffffff'            
      });
    }
  );
  
  $(".fancybox").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade'
	});

	$("#news_list_div").cycle({ 
    fx:     'scrollHorz', 
    speed:  'scrollRight', 
    timeout: 0, 
    next:   '#older_news', 
    prev:   '#latest_news',
    nowrap: 1
  });

  $("#cs_list_div").cycle({ 
    fx:     'scrollHorz', 
    speed:  'scrollRight', 
    timeout: 0, 
    next:   '#older_cs', 
    prev:   '#latest_cs',
    nowrap: 1
  });

  $('.columnizer').columnize({ width: 205, columns: 4 });

  $('.info-box').hide();

	var enlarged_product_image 			= $("img.enlarged_product_image").attr("src")
	var main_product_image_caption	= $("div.product_image_caption").html()

	$("a.enlarge_product_image").hover(
		function() {
			$("img.enlarged_product_image").attr("src",$(this).attr("href"))
			$("div.product_image_caption").html($(this).find("img").attr("alt"))
		},
		function() {
			$("img.enlarged_product_image").attr("src",enlarged_product_image)
			$("div.product_image_caption").html(main_product_image_caption)
		}
	);

	$("a.enlarge_product_image").click(function(){
		return false;
	})
});
