// JavaScript Document

  var carousel_index = 0;
  var options = [];
  var visible = 6;
  var blocksize = 1;

  function xcarouselSlide(d) {
    //var amt = 42;
    //var visible = 7;
      //var amt = 47;
      var amt = 45;
      var visible = 6;
      var c = jQuery("#color-pick").children(".carousel");
    var holder = c.children(".carousel-items");
    var item = holder.children(".carousel-item");
    amt = item.width();
    holder.width(amt*visible);
    visible = holder.width()/amt;
    //alert("width of one = " + item.width() + "number visible = " + visible + ", width of holder = " + holder.width());
  	
    carousel_index += d;
    if(carousel_index < 0) carousel_index = 0;
    if(carousel_index > options.length - visible) carousel_index = options.length - visible;

    var left = (0 - carousel_index * amt);
    left = carousel_index * amt;
    alert("left = " + left);
    //if(left > 0) left = 0;
    //if(left < c.width() - (options.length * amt)) left = c.width() - (options.length * amt);
  	
    //holder.stop(null, true).animate({left: left + "px"}, "fast");
    holder.scrollLeft(left);
  }

  function carouselSlide(d) {
    //var visible = 6;
    var c = jQuery("#color-pick").children(".carousel");
    var holder = c.children(".carousel-items");

    carousel_index += d;
    if(carousel_index < 0) carousel_index = 0;
    if(carousel_index > options.length - visible) carousel_index = options.length - visible;
    //get the left position of the item we are point at
    var left = (0 - jQuery("#color_" + carousel_index).position().left);
  	
    holder.stop(null, true).animate({left: left + "px"}, "fast");
    //c.scrollLeft(left);
  }


  jQuery(document).ready(function(){
    resizer.resizeCustom = function(obj) {
	    // this increases the top margin of the #main divs down as the screen gets bigger
	    var mt = (obj.h - (page_min_width * page_aspect_ratio)) / 2;
	    jQuery("#main").children(".middle").css("margin-top", mt);
	}
	
	
	jQuery('#panel-long-description').jScrollPane({ showArrows: true });
	jQuery('#panel-seen-in').jScrollPane({ showArrows: true });
	jQuery('#panel-tips').jScrollPane({ showArrows: true });

	makeScrollable("div.Menu_Wrapper", "ul.Product_Menu", "div.info-up", "div.info-down");
  jQuery("#slide-out").stop().animate({right:"0px"},"slow");
  jQuery("#slide-out").animate({right:(0 - jQuery("#slide-out").width()) + "px"}, "slow");

  });


