skus = [];

// COLOR: Grey/Black/Green
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_90',
  color:            'Grey/Black/Green',
  large_image:      '/usa/images/assets/390/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/390/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '986',
  availability:     'Direct from Italy. Usually ships in 3-4 weeks',
  upc_id:           '90',
  price:            '$145.00',
  sku_number:       'RB3016-06',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_90'] = sku;

// COLOR: Green/Black/Green
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_91',
  color:            'Green/Black/Green',
  large_image:      '/usa/images/assets/168/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/168/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '983',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '91',
  price:            '$145.00',
  sku_number:       'RB3016-05',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_91'] = sku;

// COLOR: Ebony/Arista/G-15 XLT
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_92',
  color:            'Ebony/Arista/G-15 XLT',
  large_image:      '/usa/images/assets/269/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/269/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       'W0365',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '92',
  price:            '$145.00',
  sku_number:       'RB3016-01',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_92'] = sku;

// COLOR: Tort/Arista/G-15 XLT
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_93',
  color:            'Tort/Arista/G-15 XLT',
  large_image:      '/usa/images/assets/515/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/515/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       'W0366',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '93',
  price:            '$145.00',
  sku_number:       'RB3016-02',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_93'] = sku;

// COLOR: Red Marble/Black/Green
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_94',
  color:            'Red Marble/Black/Green',
  large_image:      '/usa/images/assets/334/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/334/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '985',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '94',
  price:            '$145.00',
  sku_number:       'RB3016-03',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_94'] = sku;

// COLOR: White Marble/Crystal Grey Gradient
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_95',
  color:            'White Marble/Crystal Grey Gradient',
  large_image:      '/usa/images/assets/597/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/597/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '988/32',
  availability:     'Direct from Italy. Usually ships in 3-4 weeks',
  upc_id:           '95',
  price:            '$145.00',
  sku_number:       'RB3016-04',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_95'] = sku;

// COLOR: Beige Marble/Brown Gradient
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_96',
  color:            'Beige Marble/Brown Gradient',
  large_image:      '/usa/images/assets/55/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/55/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '989/51',
  availability:     'Direct from Italy. Usually ships in 3-4 weeks',
  upc_id:           '96',
  price:            '$145.00',
  sku_number:       'RB3016-07',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_96'] = sku;

// COLOR: Violet/White/Crystal Grey Gradient
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_97',
  color:            'Violet/White/Crystal Grey Gradient',
  large_image:      '/usa/images/assets/20/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/20/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '998/32',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '97',
  price:            '$139.00',
  sku_number:       'RB3016-10',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_97'] = sku;

// COLOR: Cobalt Blue/Black/Green
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_98',
  color:            'Cobalt Blue/Black/Green',
  large_image:      '/usa/images/assets/557/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/557/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '/usa/images/assets/866/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/867/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/868/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/869/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/870/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/871/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/872/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/873/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/874/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/875/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/876/c8885fd01aac198f1672f376ed310a6b.png,/usa/images/assets/877/c8885fd01aac198f1672f376ed310a6b.png', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '984',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '98',
  price:            '$145.00',
  sku_number:       'RB3016-09',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: true
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_98'] = sku;

// COLOR: Gold Marble/Black/Brown
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_99',
  color:            'Gold Marble/Black/Brown',
  large_image:      '/usa/images/assets/542/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/542/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '987',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '99',
  price:            '$145.00',
  sku_number:       'RB3016-08',
  overlay_message:  '',
  is_polarized:     false,
  is_new_release:   false,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_99'] = sku;

// COLOR: Black/Ray-Ban Logo Mania/Greygreen
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_806',
  color:            'Black/Ray-Ban Logo Mania/Greygreen',
  large_image:      '/usa/images/assets/2716/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/2716/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '1016',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '806',
  price:            '$145.00',
  sku_number:       'RB3016-15',
  overlay_message:  'New Release',
  is_polarized:     false,
  is_new_release:   true,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_806'] = sku;

// COLOR: Top Striped on White/G-15 XLT
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_807',
  color:            'Top Striped on White/G-15 XLT',
  large_image:      '/usa/images/assets/2717/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/2717/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '1013',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '807',
  price:            '$145.00',
  sku_number:       'RB3016-16',
  overlay_message:  'New Release',
  is_polarized:     false,
  is_new_release:   true,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_807'] = sku;

// COLOR: Top Striped on Violet/G-15 XLT
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_808',
  color:            'Top Striped on Violet/G-15 XLT',
  large_image:      '/usa/images/assets/2718/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/2718/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '1014',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '809',
  price:            '$145.00',
  sku_number:       'RB3016-17',
  overlay_message:  'New Release',
  is_polarized:     false,
  is_new_release:   true,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_808'] = sku;

// COLOR: Black on White Logo Text/G-15 XLT
sku = {
  style_name:       'Clubmaster',
  style_number:     'RB3016',
  id:               'sku_809',
  color:            'Black on White Logo Text/G-15 XLT',
  large_image:      '/usa/images/assets/2719/3e1db755d529579af5155b21ee4b160a.png?from=0x0&resize_to=529x390&size=2400x1400',
  lightbox_image:   '/usa/images/assets/2719/2f75c4bad9553397c4db8c38286519e3.png?from=0x0&resize_to=800&size=2400x1400',
  product_spins:    '', // OPTIMIZE: The asset_path helper adds default params to the image path which the 3d spin swf does not like. We need to prevent these additional params from appearing. 
  color_code:       '1017',
  availability:     'Usually Ships in 24-48 hours.',
  upc_id:           '810',
  price:            '$145.00',
  sku_number:       'RB3016-18',
  overlay_message:  'New Release',
  is_polarized:     false,
  is_new_release:   true,
  can_sell:         true,
  has_product_spin: false
};

if(!product_spins && sku.has_product_spin) {
	var product_spins = sku.product_spins;
}

skus['sku_809'] = sku;

function facebox_footer_info()
{
	$(".zoom").click(function() {
	$("#facebox .footer").addClass("zoom").empty().append(
		'<div>' +	'<span class="sku_number">' + selected_sku.style_number + '</span>' + 
			'<span class="style_name">' + selected_sku.style_name + '</span>' +
			'<span><span class="color_code_text">Color Code:</span> ' + selected_sku.color_code + '</span>' + 
		'</div>');
  });
}

function load_flash_movie() 
{	
  // attributes  = {};
  // params      = {wmode:"transparent"};
  // flashvars   = {pName: product_spins, pPath:"", controller:true};
  // swfobject.embedSWF("/usa/flash/360_spins/360_standalone_colorize.swf", "3d_view", "688", "480", "9.0.0","expressInstall.swf", flashvars, params, attributes);
  // return false;
}

function select_sku(sku_id)
{
  selected_sku = skus[sku_id];
  $(".product_color_code .value").html(selected_sku.color_code);
  $(".product_sku .value").html(selected_sku.sku_number);
  $(".product_status .value").html(selected_sku.availability);
  $(".price .value").html(selected_sku.price);
  $("select#product_colors").val(sku_id);
  $("input#upc_number").attr("value", selected_sku.upc_id);
  $("#product_detail_image #primary_image").attr("src", selected_sku.large_image);
  $("#product_detail_image #product_controls .product_control.zoom").attr("href", selected_sku.lightbox_image);
  $("#product_related_items a.selected").removeClass("selected");
  $("#thumb_" + selected_sku.id + " a").addClass("selected");
  if(product_spins) {
    $("#3d_view_button").show();
  } else {
    $("#3d_view_button").hide(); 
  }
  if(!selected_sku.can_sell) {
    $("input.submit").attr("disabled", true);
    $("input.submit").addClass("disabled");
    $("input.submit_b").attr("disabled", true);
    $("input.submit_b").attr('src', '/usa/images/css/ui/product_detail/addtocart_b_disabled.png?1283367658');
  } else {
    $("input.submit").removeAttr("disabled");
    $("input.submit").removeClass("disabled");
    $("input.submit_b").removeAttr("disabled");
    $("input.submit_b").attr('src', '/usa/images/css/ui/product_detail/addtocart_b.png?1283367658');
  }

  $("#product_detail_image .status").html(sku.overlay_message);
  
  if(selected_sku.is_polarized) {
    $("#product_detail_image  .hilight").removeClass("hide");
  } else {
    $("#product_detail_image .hilight").addClass("hide");
  }
	facebox_footer_info();
}

function inject3d() {
	$("#facebox .popup .footer").empty().append('<div id="3d_view_wrap"><div id="3d_view"><h1>Whoops!</h1><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p></div></div>').css({'margin' : '10px auto', 'width' : '688px'});
}

function showFormLayout(gwoLayout) {
	if(gwoLayout == "a" || gwoLayout == "b") {
		if(gwoLayout == "a") {
			$('div.form_layout_orig').remove();
			$('div.form_layout_b').remove();
		}	else if(gwoLayout == "b") {
			$('div.form_layout_orig').remove();
			$('div.form_layout_a').remove();
		}
		// NEW CHIKEZIE LAYOUTS
		$('body').addClass('split split_' + gwoLayout);
		$(document).ready(function() { $('form.jqtransform').jqTransform(); });		
	} else {
		$('div.form_layout_a').remove();
		$('div.form_layout_b').remove();
		// O.G. LAYOUT
		$('body').addClass('split_orig');
	}
}

$(document).ready(function() {
	
  var selected_sku = skus['sku_99'];
  select_sku(selected_sku.id);
  
  $("a.three-d").click(function() {    
		inject3d();
		var flashvars  = { pName: product_spins, pPath:"", controller: true, controllerColor:"0xd70000" };
		var params     = { movie: "/usa/flash/360_spins/360_standalone_colorize.swf"};
		var attributes = {};
		swfobject.embedSWF("/usa/flash/360_spins/360_standalone.swf", "3d_view", "688", "480", "9.0.0","expressInstall.swf", flashvars, params, attributes);
		return false;		
  });
  
  

  $("select#product_colors").change(function() {
    index    = $(this).find("option").index($(this).find("option:selected"));
		indexlast  = index -3;
    scroller = $("#product_scroller").scrollable().seekTo(indexlast);
    select_sku($(this).val());
  });
  
  $('.color .jqTransformSelectWrapper ul li a').livequery('click', function(event) {
		var jqIndex = parseFloat($(this).attr('index')) + 1; // -1 for zero based
  	var selectVal = $('#product_colors option:nth-child(' + jqIndex + ')').attr('value');
  	var selectText = $('#product_colors option:nth-child(' + jqIndex + ')').html();
  	//console.log(jqIndex + " | " + selectVal + " | " + selectText); 
    select_sku(selectVal);
  })
  
  $("ul.product_listing a").click(function() {
    // IF NORMAL DROP DOWN:
    select_sku($(this).attr("rel"));
    
    // IF JQ DROP DOWN:
	  var clickIndex = $("ul.product_listing li").index($(this).parent('li'));
  	$('.color .jqTransformSelectWrapper ul li:nth-child(' + (parseFloat(clickIndex) + 1) + ')').children('a').trigger('click');
  	
  	// EITHER WAY
    return false;
  });
  

  
  
  $(".facebox").facebox();

  
  $("#product_scroller").scrollable({
    size: 5
  });
  
  $("form.ajax").submitWithAjax();
 	
 	
 	
});