/* custom jQuery functions ===================================================================*/
(function($) {
	// testing plugins
	$.fn.test = function() {
		return this.css({'border' : '1px solid red'});
	};
	$.fn.test2 = function(color) {
		return this.css({'border' : '1px solid' + ' ' + color});	
	};
	
	// return first word in string
	$.fn.firstWord = function() {
	    var mystring = $(this).text();
	    var stringarray = mystring.split(" ");
	    var firstword = mystring.split(" ")[0];
	    
	    return firstword;
	};
	
	// return the colors name from string
	$.fn.colorName = function() {
	    var mystring = $(this).text();
	    var theColorName = mystring.split(/(\s\/\s|\s\\\s|\s\-\s|\s\+|\s\|)/)[0];
	    
	    return theColorName;
	};
	
	$.fn.colorNameDashed = function() {
	    var mystring = $(this).text();
	    var theColorName = mystring.split(/(\s\/\s|\s\\\s|\s\-\s|\s\+|\s\|)/)[0];
	    var theColorNameDashed = theColorName.replace(/\s+/g, '-');
	    
	    return theColorNameDashed;
	};
	
	$.fn.colorNameLowerCase = function() {
	    var mystring = $(this).text();
	    var theColorName = mystring.split(/(\s\/\s|\s\\\s)/)[0];
	    var theColorNameDashedLower = theColorName.replace(/\s+/g, '-').toLowerCase();
	    
	    return theColorNameDashed;
	};
	
	$.fn.colorType = function() {
	    var mystring = $(this).text();
	    var theColorType = mystring.split(/(\s\/\s|\s\\\s)/)[1];
	    
	    return theColorType;
	};
	
	
	
	
	// scroll follow any object
	$.fn.osScrollFollow = function() {
       	// thx css-tricks
       	var $sidebar   = $(this),
       	    $window    = $(window),
       	    offset     = $sidebar.offset(),
       	    topPadding = 15;
       	    
       	if (offset !== null) {
       	    $window.scroll(function() {
       	        if ($window.scrollTop() > offset.top) {
       	            $sidebar.stop().animate({
       	                marginTop: $window.scrollTop() - offset.top + topPadding
       	            });
       	        } else {
       	            $sidebar.stop().animate({
       	                marginTop: 0
       	            });
       	        }
       	    });
	    } else {
	        return false;
	    }
        
	}
})(jQuery);


var j = jQuery.noConflict(); 

j(function(){
 	
 /* important variables =======================================================================*/	
	var themeURL = 'http://' + top.location.host.toString() + '/skin/frontend/fresh-beany/default/images2/', // kb
	    mediaURL = 'http://' + top.location.host.toString() + '/media';
 
	
 /* All Pages/ Misc jQuery ==================================================================================*/
	// LavaLamp
	if (!jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7) {
    	j('.lavaLamp').lavaLamp({
    		fx: 'easeOutBack',
    		speed: 800
    	});
    	j('.sideLavaLamp').lavaLamp({
    		fx: 'easeOutBack',
    		speed: 800
    	});
	}
    // cart sidebar
    j('#cart-sidebar > li:first').addClass('first'); // add rouned top corners to first item 
	  
    // tool tips
    j('#twitter img')
        .after('<div class="tooltip-wrapper"><div class="tooltip"><a href="http://twitter.com/kingbeany">twitter</a></div></div>')
    	.tooltip({effect: 'slide', delay: 150, offset:[5, 0]})
    j('#facebook img')
        //.after('<div class="tooltip-wrapper"><div class="tooltip"><a href="http://www.facebook.com/pages/King-Beany/107082636029123">facebook</a></div></div>')
        //.after('<div class="tooltip-wrapper"><div class="tooltip"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FKing-Beany%2F107082636029123&amp;layout=button_count&amp;show_faces=false&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe></div></div>')
    	.tooltip({effect: 'slide', delay: 150, offset:[5, 0]})
    	
    if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7) {	
        
        // header area
        DD_belatedPNG.fix('.logo img, .quick-cart, #nav, #nav li, .backLava');
        
        // content area
        DD_belatedPNG.fix('.social-intro h4, .block-content, .product-name, .page-title, .block-layered-nav li a:hover, #product-options-wrapper .size-title, .price-box, #product-options-wrapper .color-title, #product-options-wrapper .personalize-title');
        
        // footer area
        DD_belatedPNG.fix('.footer-container h4');
      
	};
	// cufon text replacement
	//Cufon.replace('h1 ');
	
	
 /* Product Page Magic	=======================================================================*/

// Performance Timer
console.time('swatch load time');    

if (jQuery('.product-view')) { // if product page
	
    // cache context selectors
	var $pIB = j('.product-img-box'),
	    $pI = j('img', $pIB),
	    $pIa = j('#image-a', $pIB),
	    $pIZoom = j('#smd-zoom-content', $pIB), 
	    $secondPrice = j('.product-essential .price-box:eq(1)').hide();
	var $secondPriceClone = $secondPrice,
	    $realPrice = j('span > span', $secondPrice);
	    
	var $pOW = j('#product-options-wrapper'),
	    $sizeTitle = j('dl > dt:eq(0)', $pOW),
	    $sizeOptionsWrapper = j('dl > dd:eq(0)', $pOW), 
	    $sizeOptions = j('dl > dd:eq(0) > select', $pOW), 
	    $colorTitle = j('dl > dt:eq(1)', $pOW),
	    $colorOptionsWrapper = j('dl > dd:eq(1)', $pOW), 
	    $colorOptions = j('dl > dd:eq(1) > select', $pOW),
	    $personilizeOptions = j('dl:eq(1)', $pOW), 
	    
	    $stepPrice = j('.price-box', '.product-shop')
	 
	    
    // css
    $sizeTitle.addClass('size-title');
    $sizeOptionsWrapper.addClass('size-options-wrapper');
    $colorTitle.addClass('color-title');
    $colorOptionsWrapper.addClass('color-options-wrapper');
    $colorOptions.addClass('color-options');
    $personilizeOptions.addClass('personalize-options');
    	    	
    // build html
    var sizeInfo = '<p class="size-info">WIDTH x DEPTH x HEIGHT</p>',
    	sizeSmallBag = '<img class="size-small" alt="Small" src="http://kingbeany.com/media/product-images/Sizes/Small-Bag.jpg">',
        sizeLargeBag = '<img class="size-large" alt="Large" src="http://kingbeany.com/media/product-images/Sizes/Large-Bag.jpg">',
        sizeSmallSack = '<img class="size-small" alt="Small" src="http://kingbeany.com/media/product-images/Sizes/Small-Sack.jpg">',
        sizeLargeSack = '<img class="size-large" alt="Large" src="http://kingbeany.com/media/product-images/Sizes/Large-Sack.jpg">',
        sizeXLargeSack = '<img class="size-x-large" alt="X-Large" src="http://kingbeany.com/media/product-images/Sizes/X-Large-Sack.jpg">',
        sizeTwo = '<img class="size-two" alt="Two" src="http://kingbeany.com/media/product-images/Sizes/2.jpg">',
        sizeSix = '<img class="size-six" alt="Six" src="http://kingbeany.com/media/product-images/Sizes/6.jpg">';
        
    		
	// init
	// large preview	
	$pIB.osScrollFollow();
	    
	//j('#image', $pIB)
	    //.after($secondPriceClone).next().addClass('second-price').show();
	    //$stepPrice.clone().appendTo(j('.product-image', $pIB)).addClass('second-price').show();  
	
	$sizeOptions.before(sizeInfo).hide();
	$sizeTitle.append('<span class="chosen-option"></span>');
	$colorTitle.append('<span class="chosen-option"></span>').hide();
	$colorOptionsWrapper.hide();
	$colorOptions.hide();
	$personilizeOptions.before('<h2 class="personalize-title">Customize your Bean Bag:</h2>').hide();
	j('p.required').remove(); // text showing what feilds are required
	
	// some blas
	var swatchList = '<ul id="swatch-list"></ul>' // bla1
	$colorOptionsWrapper.append(swatchList); // bla1
	var $swatchList = j('#swatch-list', $colorOptionsWrapper) // bla1

	if (jQuery('.product-name > h1').text() == 'Removable Cover Bean Bags' || jQuery('.product-name > h1').text() == 'Replacement COVERS for Bean Bags') {
    	// more blas
    	var cottonList = '<li id="cotton-list"><h2>Cotton <small></small></h2><ul></ul></li>',
    	    ultraList = '<li id="ultra-list"><h2>Ultra Suede <small></small></h2><ul></ul></li>', 
    	    furList = '<li id="fur-list"><h2>Faux Fur <small></small></h2><ul></ul></li>',
    	    tieList = '<li id="tie-list"><h2>Tie Dye <small></small></h2><ul></ul></li>',
    	    denimList = '<li id="denim-list"><h2>Denim <small></small></h2><ul></ul></li>',
    	    leatherList = '<li id="leather-list"><h2>Leather <small></small></h2><ul></ul></li>';   
    	    

    	$swatchList.append(cottonList);
    	$swatchList.append(ultraList);
    	$swatchList.append(furList);
    	$swatchList.append(tieList);
    	$swatchList.append(denimList);
    	$swatchList.append(leatherList);
    	
    	
    	var $cottonList = j('#cotton-list > ul', $colorOptionsWrapper),
    	    $ultraList = j('#ultra-list > ul', $colorOptionsWrapper),
    	    $furList = j('#fur-list > ul', $colorOptionsWrapper),
    	    $tieList = j('#tie-list > ul', $colorOptionsWrapper),
	        $denimList = j('#denim-list > ul', $colorOptionsWrapper);
	        $leatherList = j('#leather-list > ul', $colorOptionsWrapper);
	        

    	// Step One & Two
    	$sizeOptionsWrapper
    	    .append(sizeSmallBag)
    	    .find('.size-small')
    	    .click(function() {

        	    jQuery('#attribute514').val(12).trigger('change'); // jquery change
        	    $('attribute514').simulate('change'); // prototype change
        	    
        	    $personilizeOptions.hide();
        	    jQuery('.chosen-option', $sizeTitle).text('Small');
        	    jQuery('.chosen-option', $colorTitle).text('');
        	    
        	    buildList1('Small/');
        	    jQuery('.personalize-title').fadeIn();
        	    $personilizeOptions.fadeIn();

        	    // dont need leather list on small
        	    $leatherList.parent().hide();
    	       
    	    }).end()
    	    .append(sizeLargeBag)
    	    .find('.size-large')
    	    .click(function() {
    	        
        	    jQuery('#attribute514').val(14).trigger('change'); // jquery change
        	    $('attribute514').simulate('change'); // prototype change
        	    
        	    $personilizeOptions.hide();
        	    jQuery('.chosen-option', $sizeTitle).text('Large');
        	    jQuery('.chosen-option', $colorTitle).text('');
        	     
        	    buildList1('Large/');
        	    jQuery('.personalize-title', $pOW).fadeIn();
        	    $personilizeOptions.fadeIn();
        	    
        	    // need leather list for large
        	    $leatherList.parent().show();
 	       
    	    });
    	    
    	    function buildList1(listSize) {
    	    
    	        $colorOptionsWrapper.hide();
    	        $cottonList.html("");
    	        $ultraList.html("");
    	        $furList.html("");
    	        $tieList.html("");
    	        $denimList.html("");
    	        $leatherList.html("");

    	        
        	    var $cottonColorsArray = $colorOptions.find('option:not(:first):contains(Cotton)'),
        	        $ultraColorsArray = $colorOptions.find('option:not(:first):contains(Ultra)'),
        	        $furColorsArray = $colorOptions.find('option:not(:first):contains(Fur)'),
        	        $tieColorsArray = $colorOptions.find('option:not(:first):contains(Tie)'),
        	        $denimColorsArray = $colorOptions.find('option:not(:first):contains(Denim)'),
        	        $leatherColorsArray = $colorOptions.find('option:not(:first):contains(Leather)');
        	       	       
    	        var chosen_pI,
    	            chosen_pIa,
    	            chosen_pIZoom;
    	            
	                $pI.attr('src', mediaURL + '/product-images/Removable/Cotton/'  + listSize + 'Black.jpg'),
	                $pIa.attr('src', mediaURL + '/product-images/Removable/Cotton/' +  listSize + '.Black.jpg'),
	                $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/Removable/Cotton/' + listSize + '.Black.jpg)'); 
        	       
        	       
    	        jQuery.fn.appendSwatches = function(colorType, colorArray) {    
    	            jQuery(this)
        	            .append('<li class="swatch"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/></li>')
        	            .append('<li class="tooltip-wrapper"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/><span></span></li>')
    	        };
    	            	        
    	        
    	        for (var i = 0; i < $cottonColorsArray.length; i++) {
    	            $cottonList.appendSwatches('Removable/Cotton/', $cottonColorsArray);
    	        }
    	        for (var i = 0; i < $ultraColorsArray.length; i++) {
    	           $ultraList.appendSwatches('Removable/Ultra-Suede/', $ultraColorsArray);
    	        }
    	        for (var i = 0; i < $furColorsArray.length; i++) {
    	           $furList.appendSwatches('Removable/Faux-Fur/', $furColorsArray);
    	        }
    	        for (var i = 0; i < $tieColorsArray.length; i++) {
    	           $tieList.appendSwatches('Removable/Tie-Dye/', $tieColorsArray);
    	        }
    	        for (var i = 0; i < $denimColorsArray.length; i++) {
    	           $denimList.appendSwatches('Removable/Denim/', $denimColorsArray); 
    	        }
    	        for (var i = 0; i < $leatherColorsArray.length; i++) {
    	           $leatherList.appendSwatches('Removable/Leather/', $leatherColorsArray);
    	        }
    	        
    	        
    	        
    	        jQuery('li.swatch', $cottonList).each(function(i) {
    	             function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview() {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute515').val(jQuery($cottonColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($cottonColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Cotton/', $cottonColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Cotton/', $cottonColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $cottonList).find('span').append(jQuery($cottonColorsArray[i]).colorName())
    	               
    	        });
    	        
    	        jQuery('li.swatch', $ultraList).each(function(i) {
    	            function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute515').val(jQuery($ultraColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($ultraColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Ultra-Suede/', $ultraColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Ultra-Suede/', $ultraColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $ultraList).find('span').append(jQuery($ultraColorsArray[i]).colorName())
    	                 
    	        });
    	        
    	        jQuery('li.swatch', $furList).each(function(i) {
    	            function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {
    
    	                     jQuery('#attribute515').val(jQuery($furColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($furColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Faux-Fur/', $furColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Faux-Fur/', $furColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $furList).find('span').append(jQuery($furColorsArray[i]).colorName())

    	        });
    	         
    	        jQuery('li.swatch', $tieList).each(function(i) {
                    function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute515').val(jQuery($tieColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($tieColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Tie-Dye/', $tieColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Tie-Dye/', $tieColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $tieList).find('span').append(jQuery($tieColorsArray[i]).colorName())
    	        });
    	        
    	        jQuery('li.swatch', $denimList).each(function(i) {
                    function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview() {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute515').val(jQuery($denimColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($denimColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Denim/', $denimColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Denim/', $denimColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $denimList).find('span').append(jQuery($denimColorsArray[i]).colorName())
    	        });
    	        
    	        jQuery('li.swatch', $leatherList).each(function(i) {
                    function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview() {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute515').val(jQuery($leatherColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute515').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($leatherColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Removable/Leather/', $leatherColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Removable/Leather/', $leatherColorsArray);
    	                     
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $leatherList).find('span').append(jQuery($leatherColorsArray[i]).colorName())
    	        });
    	       
    	        
    	        
    	        $colorTitle.fadeIn(500);
    	        $colorOptionsWrapper.fadeIn(500);
    	    
    	    
    	    } // end buildList()
    	    
	       
    }; // end if removable cover =======================================================================================
    //==================================================================================================================
    
    if (jQuery('.product-name > h1').text() == 'Non-Removable Cover Bean Bags') {
        	// more blas
        	var classicList = '<li id="classic-list"><h2>Classic Vinyl <small></small></h2><ul></ul></li>',
        	    wetList = '<li id="wet-list"><h2>Wet Look Vinyl <small></small></h2><ul></ul></li>';   
        	    
            $swatchList.append(classicList);
        	$swatchList.append(wetList);
        	
        	
        	var $classicList = j('#classic-list > ul', $colorOptionsWrapper),
        	    $wetList = j('#wet-list > ul', $colorOptionsWrapper);
    	        
    
        	// Step One & Two
        	$sizeOptionsWrapper
        	    .append(sizeSmallBag)
        	    .find('.size-small')
        	    .click(function() {
        	        jQuery('#attribute514').val(12).trigger('change'); // jquery change
            	    $('attribute514').simulate('change'); // prototype change
            	    
            	    $personilizeOptions.hide();
            	    jQuery('.chosen-option', $sizeTitle).text('Small');
            	    jQuery('.chosen-option', $colorTitle).text('');
            	    
            	    buildList2('Small/');
            	    jQuery('.personalize-title').fadeIn();
            	    $personilizeOptions.fadeIn();
            	    
        	       
        	    }).end()
        	    
        	    .append(sizeLargeBag)
        	    .find('.size-large')
        	    .click(function() {
        	        
        	        jQuery('#attribute514').val(14).trigger('change'); // jquery change
            	    $('attribute514').simulate('change'); // prototype change
            	    
            	    $personilizeOptions.hide();
            	    jQuery('.chosen-option', $sizeTitle).text('Large');
            	    jQuery('.chosen-option', $colorTitle).text('');
            	     
            	    buildList2('Large/');
            	    jQuery('.personalize-title', $pOW).fadeIn();
            	    $personilizeOptions.fadeIn();
            	    
        	    });
        	    
        	    function buildList2(listSize) {
        	        
    	            $classicList.html("");
    	            $wetList.html("");
    	            
        	        $colorOptionsWrapper.hide();
        	        //$colorOptionsWrapper.show();
        	        
        	        var $classicColorsArray = $colorOptions.find('option:not(:first):contains(Classic)'),
            	        $wetColorsArray = $colorOptions.find('option:not(:first):contains(Wet)');
            	       	       
        	        var chosen_pI,
        	            chosen_pIa,
        	            chosen_pIZoom;
        	            
    	                
            	       
            	       
        	        jQuery.fn.appendSwatches2 = function(colorType, colorArray) {    
        	            jQuery(this)
            	            .append('<li class="swatch"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/></li>')
            	            .append('<li class="tooltip-wrapper"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/><span></span></li>')
        	        };
        	            	        
        	        
        	        for (var i = 0; i < $classicColorsArray.length; i++) {
        	            $classicList.appendSwatches2('Non-Removable/Classic-Vinyl/', $classicColorsArray);
        	        }
        	        for (var i = 0; i < $wetColorsArray.length; i++) {
        	           $wetList.appendSwatches2('Non-Removable/Wet-Look-Vinyl/', $wetColorsArray);
        	        }
        	        
        	        
        	        
        	        
        	        jQuery('li.swatch', $classicList).each(function(i) {
        	             function onClickChoosePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
      	                 
        	                 chosen_pI = $pI.attr('src');
        	                 chosen_pIa = $pIa.attr('src');
        	                 chosen_pIZoom = $pIZoom.css('background-image');
        	                 
        	             }
        	             
        	             function onHoverChangePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
        	                 
        	             }
        	             
        	             function onHoverOutChangeToChosenPreview () {
        	                $pI.attr('src', chosen_pI);
        	                $pIa.attr('src', chosen_pIa);
        	                $pIZoom.css('background-image', chosen_pIZoom);
        	                
        	             }
        	             
        	             jQuery(this)
        	                 .click(function() {
    
        	                     jQuery('#attribute516').val(jQuery($classicColorsArray[i]).val()).trigger('change'); // jquery change
        	                     $('attribute516').simulate('change'); // prototype change
        	                     
        	                     jQuery('.chosen-option', $colorTitle).text(jQuery($classicColorsArray[i]).colorName());
        	                     
        	                     onClickChoosePreview('Non-Removable/Classic-Vinyl/', $classicColorsArray);
        	                 
        	                 }) 
        	                 .hover(function() {
        	                     onHoverChangePreview('Non-Removable/Classic-Vinyl/', $classicColorsArray);
        	                 }, function() {
        	                     onHoverOutChangeToChosenPreview();
        	                 })
        	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
        	                 .next('.tooltip-wrapper', $classicList).find('span').append(jQuery($classicColorsArray[i]).colorName())
        	               
        	        });
        	        
        	        jQuery('li.swatch', $wetList).each(function(i) {
        	            function onClickChoosePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
      	                 
        	                 chosen_pI = $pI.attr('src');
        	                 chosen_pIa = $pIa.attr('src');
        	                 chosen_pIZoom = $pIZoom.css('background-image');
        	                 
        	             }
        	             
        	             function onHoverChangePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
        	                 
        	             }
        	             
        	             function onHoverOutChangeToChosenPreview () {
        	                $pI.attr('src', chosen_pI);
        	                $pIa.attr('src', chosen_pIa);
        	                $pIZoom.css('background-image', chosen_pIZoom);
        	                
        	             }
        	             
        	             jQuery(this)
        	                 .click(function() {
    
        	                     jQuery('#attribute516').val(jQuery($wetColorsArray[i]).val()).trigger('change'); // jquery change
        	                     $('attribute516').simulate('change'); // prototype change
        	                     
        	                     jQuery('.chosen-option', $colorTitle).text(jQuery($wetColorsArray[i]).colorName());
        	                     
        	                     onClickChoosePreview('Non-Removable/Wet-Look-Vinyl/', $wetColorsArray);
        	                 
        	                 }) 
        	                 .hover(function() {
        	                     onHoverChangePreview('Non-Removable/Wet-Look-Vinyl/', $wetColorsArray);
        	                 }, function() {
        	                     onHoverOutChangeToChosenPreview();
        	                 })
        	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
        	                 .next('.tooltip-wrapper', $wetList).find('span').append(jQuery($wetColorsArray[i]).colorName())
        	                 
        	        });
        	        
        	                	       
        	        
        	        
        	        $colorTitle.fadeIn(500);
        	        $colorOptionsWrapper.fadeIn(500);
        	    
        	    
        	    } // end buildList()
        	    
    	       
        }; // end if non-removable cover =======================================================================================
    //==========================================================================================================================

	if (jQuery('.product-name > h1').text() == 'Royal Sacks' || jQuery('.product-name > h1').text() == 'Replacement COVERS for Royal Sacks') {
    	// more blas
    	var twillList = '<li id="twill-list"><h2>Twill <small></small></h2><ul></ul></li>',
    	    ultraList = '<li id="ultra-list"><h2>Ultra Suede <small></small></h2><ul></ul></li>', 
    	    furList = '<li id="fur-list"><h2>Faux Fur <small></small></h2><ul></ul></li>',
    	    denimList = '<li id="denim-list"><h2>Denim <small></small></h2><ul></ul></li>';   
    	    

    	$swatchList.append(twillList);
    	$swatchList.append(ultraList);
    	$swatchList.append(furList);
    	$swatchList.append(denimList);
    	
    	
    	var $twillList = j('#twill-list > ul', $colorOptionsWrapper),
    	    $ultraList = j('#ultra-list > ul', $colorOptionsWrapper),
    	    $furList = j('#fur-list > ul', $colorOptionsWrapper),
	        $denimList = j('#denim-list > ul', $colorOptionsWrapper);
	        

    	// Step One & Two
    	$sizeOptionsWrapper
    	    .append(sizeSmallSack)
    	    .find('.size-small')
    	    .click(function() {

        	    jQuery('#attribute514').val(12).trigger('change'); // jquery change
        	    $('attribute514').simulate('change'); // prototype change
        	    
        	    $personilizeOptions.hide();
        	    jQuery('.chosen-option', $sizeTitle).text('Small');
        	    jQuery('.chosen-option', $colorTitle).text('');
        	    
        	    buildList3('Small/');
        	    jQuery('.personalize-title').fadeIn();
        	    $personilizeOptions.fadeIn();

        	    
    	       
    	    }).end()
    	    .append(sizeLargeSack)
    	    .find('.size-large')
    	    .click(function() {
    	        
        	    jQuery('#attribute514').val(14).trigger('change'); // jquery change
        	    $('attribute514').simulate('change'); // prototype change
        	    
        	    $personilizeOptions.hide();
        	    jQuery('.chosen-option', $sizeTitle).text('Large');
        	    jQuery('.chosen-option', $colorTitle).text('');
        	     
        	    buildList3('Large/');
        	    jQuery('.personalize-title', $pOW).fadeIn();
        	    $personilizeOptions.fadeIn();
        	    
        	    
 	       
    	    }).end()
    	    .append(sizeXLargeSack)
    	    .find('.size-x-large')
    	    .click(function() {
    	        
    	        jQuery('#attribute514').val(15).trigger('change'); // jquery change
    	        $('attribute514').simulate('change'); // prototype change
    	        
    	        $personilizeOptions.hide();
    	        jQuery('.chosen-option', $sizeTitle).text('X-Large');
    	        jQuery('.chosen-option', $colorTitle).text('');
    	         
    	        buildList3('XLarge/');
    	        jQuery('.personalize-title', $pOW).fadeIn();
    	        $personilizeOptions.fadeIn();
    	        
    	    });
    	    
    	    function buildList3(listSize) {
    	    
    	        $colorOptionsWrapper.hide();
    	        $twillList.html("");
    	        $ultraList.html("");
    	        $furList.html("");
    	        $denimList.html("");

    	        
        	    var $twillColorsArray = $colorOptions.find('option:not(:first):contains(Twill)'),
        	        $ultraColorsArray = $colorOptions.find('option:not(:first):contains(Ultra)'),
        	        $furColorsArray = $colorOptions.find('option:not(:first):contains(Fur)'),
        	        $denimColorsArray = $colorOptions.find('option:not(:first):contains(Denim)');
        	       	       
    	        var chosen_pI,
    	            chosen_pIa,
    	            chosen_pIZoom;
    	            
	                $pI.attr('src', mediaURL + '/product-images/Royal-Sacks/Twill/'  + listSize + 'Black.jpg'),
	                $pIa.attr('src', mediaURL + '/product-images/Royal-Sacks/Twill/' +  listSize + '.Black.jpg'),
	                $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/Royal-Sacks/Twill/' + listSize + '.Black.jpg)'); 
        	       
        	       
    	        jQuery.fn.appendSwatches = function(colorType, colorArray) {    
    	            jQuery(this)
        	            .append('<li class="swatch"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/></li>')
        	            .append('<li class="tooltip-wrapper"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/><span></span></li>')
    	        };
    	            	        
    	        
    	        for (var i = 0; i < $twillColorsArray.length; i++) {
    	            $twillList.appendSwatches('Royal-Sacks/Twill/', $twillColorsArray);
    	        }
    	        for (var i = 0; i < $ultraColorsArray.length; i++) {
    	           $ultraList.appendSwatches('Royal-Sacks/Ultra-Suede/', $ultraColorsArray);
    	        }
    	        for (var i = 0; i < $furColorsArray.length; i++) {
    	           $furList.appendSwatches('Royal-Sacks/Faux-Fur/', $furColorsArray);
    	        }
    	        for (var i = 0; i < $denimColorsArray.length; i++) {
    	           $denimList.appendSwatches('Royal-Sacks/Denim/', $denimColorsArray); 
    	        }
    	        
    	        
    	        
    	        jQuery('li.swatch', $twillList).each(function(i) {
    	             function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute518').val(jQuery($twillColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute518').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($twillColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Royal-Sacks/Twill/', $twillColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Royal-Sacks/Twill/', $twillColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $twillList).find('span').append(jQuery($twillColorsArray[i]).colorName())
    	               
    	        });
    	        
    	        jQuery('li.swatch', $ultraList).each(function(i) {
    	            function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute518').val(jQuery($ultraColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute518').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($ultraColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Royal-Sacks/Ultra-Suede/', $ultraColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Royal-Sacks/Ultra-Suede/', $ultraColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $ultraList).find('span').append(jQuery($ultraColorsArray[i]).colorName())
    	                 
    	        });
    	        
    	        jQuery('li.swatch', $furList).each(function(i) {
    	            function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {
    
    	                     jQuery('#attribute518').val(jQuery($furColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute518').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($furColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Royal-Sacks/Faux-Fur/', $furColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Royal-Sacks/Faux-Fur/', $furColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $furList).find('span').append(jQuery($furColorsArray[i]).colorName())

    	        });
    	         
    	            	        
    	        jQuery('li.swatch', $denimList).each(function(i) {
                    function onClickChoosePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
  	                 
    	                 chosen_pI = $pI.attr('src');
    	                 chosen_pIa = $pIa.attr('src');
    	                 chosen_pIZoom = $pIZoom.css('background-image');
    	                 
    	             }
    	             
    	             function onHoverChangePreview(colorType, colorArray) {
    	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
    	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
    	                 
    	             }
    	             
    	             function onHoverOutChangeToChosenPreview () {
    	                $pI.attr('src', chosen_pI);
    	                $pIa.attr('src', chosen_pIa);
    	                $pIZoom.css('background-image', chosen_pIZoom);
    	                
    	             }
    	             
    	             jQuery(this)
    	                 .click(function() {

    	                     jQuery('#attribute518').val(jQuery($denimColorsArray[i]).val()).trigger('change'); // jquery change
    	                     $('attribute518').simulate('change'); // prototype change
    	                     
    	                     jQuery('.chosen-option', $colorTitle).text(jQuery($denimColorsArray[i]).colorName());
    	                     
    	                     onClickChoosePreview('Royal-Sacks/Denim/', $denimColorsArray);
    	                 
    	                 }) 
    	                 .hover(function() {
    	                     onHoverChangePreview('Royal-Sacks/Denim/', $denimColorsArray);
    	                 }, function() {
    	                     onHoverOutChangeToChosenPreview();
    	                 })
    	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
    	                 .next('.tooltip-wrapper', $denimList).find('span').append(jQuery($denimColorsArray[i]).colorName())
    	        });
    	        
    	    
    	       
    	        
    	        
    	        $colorTitle.fadeIn(500);
    	        $colorOptionsWrapper.fadeIn(500);
    	    
    	    
    	    } // end buildList()
    	    
	       
    }; // end if removable cover =======================================================================================
    //==================================================================================================================
	
    if (jQuery('.product-name > h1').text() == 'Refill Packs') {
        	// more blas
        	var fillList = '<li id="fill-list"><h2>Fill Types <small></small></h2><ul></ul></li>';   
        	 
        	$swatchList.append(fillList);
        	
        	var $fillList = j('#fill-list > ul', $colorOptionsWrapper);
    	        
    
        	// Step One & Two
        	$sizeOptionsWrapper
        	    .append(sizeTwo)
        	    .find('.size-two')
        	    .click(function() {
        	        jQuery('#attribute520').val(255).trigger('change'); // jquery change
            	    $('attribute520').simulate('change'); // prototype change
            	    
            	    $personilizeOptions.hide();
            	    jQuery('.chosen-option', $sizeTitle).text('Two Cubic Feet');
            	    jQuery('.chosen-option', $colorTitle).text('');
            	    
            	    buildList4('Images/');
            	    jQuery('.personalize-title').fadeIn();
            	    $personilizeOptions.fadeIn();
            	    
        	       
        	    }).end()
        	    
        	    .append(sizeSix)
        	    .find('.size-six')
        	    .click(function() {
        	        
        	        jQuery('#attribute520').val(254).trigger('change'); // jquery change
            	    $('attribute520').simulate('change'); // prototype change
            	    
            	    $personilizeOptions.hide();
            	    jQuery('.chosen-option', $sizeTitle).text('Six Cubic Feet');
            	    jQuery('.chosen-option', $colorTitle).text('');
            	     
            	    buildList4('Images/');
            	    jQuery('.personalize-title', $pOW).fadeIn();
            	    $personilizeOptions.fadeIn();
            	    
        	    });
        	    
        	    function buildList4(listSize) {
        	        
    	            $fillList.html("");
    	           
        	        $colorOptionsWrapper.hide();
        	        //$colorOptionsWrapper.show();
        	        
        	        var $fillColorsArray = $colorOptions.find('option:not(:first)');

            	       	       
        	        var chosen_pI,
        	            chosen_pIa,
        	            chosen_pIZoom;
        	            
    	            jQuery.fn.appendSwatches = function(colorType, colorArray) {    
        	            jQuery(this)
            	            .append('<li class="swatch"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/></li>')
            	            .append('<li class="tooltip-wrapper"><img src="' + mediaURL + '/product-images/' + colorType + 'Swatches/' + jQuery(colorArray[i]).colorNameDashed() + '.jpg"/><span></span></li>')
        	        };
        	            	        
        	        
        	        for (var i = 0; i < $fillColorsArray.length; i++) {
        	            $fillList.appendSwatches('Refill-Packs/', $fillColorsArray);
        	        }
        	        
        	        jQuery('li.swatch', $fillList).each(function(i) {
        	             function onClickChoosePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
      	                 
        	                 chosen_pI = $pI.attr('src');
        	                 chosen_pIa = $pIa.attr('src');
        	                 chosen_pIZoom = $pIZoom.css('background-image');
        	                 
        	             }
        	             
        	             function onHoverChangePreview(colorType, colorArray) {
        	                 $pI.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIa.attr('src', mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg');
        	                 $pIZoom.css('background-image', "url(" + mediaURL + '/product-images/' + colorType + listSize + jQuery(colorArray[i]).colorNameDashed() + '.jpg)');
        	                 
        	             }
        	             
        	             function onHoverOutChangeToChosenPreview () {
        	                $pI.attr('src', chosen_pI);
        	                $pIa.attr('src', chosen_pIa);
        	                $pIZoom.css('background-image', chosen_pIZoom);
        	                
        	             }
        	             
        	             jQuery(this)
        	                 .click(function() {
    
        	                     jQuery('#attribute521').val(jQuery($fillColorsArray[i]).val()).trigger('change'); // jquery change
        	                     $('attribute521').simulate('change'); // prototype change
        	                     
        	                     jQuery('.chosen-option', $colorTitle).text(jQuery($fillColorsArray[i]).colorName());
        	                     
        	                     onClickChoosePreview('Refill-Packs/', $fillColorsArray);
        	                 
        	                 }) 
        	                 .hover(function() {
        	                     onHoverChangePreview('Refill-Packs/', $fillColorsArray);
        	                 }, function() {
        	                     onHoverOutChangeToChosenPreview();
        	                 })
        	                 .tooltip({effect: 'slide', delay: 0, offset:[6, 0]})
        	                 .next('.tooltip-wrapper', $fillList).find('span').append(jQuery($fillColorsArray[i]).colorName())
        	               
        	        });
        	        
        	        
        	        $colorTitle.fadeIn(500);
        	        $colorOptionsWrapper.fadeIn(500);
        	    
        	    
        	    } // end buildList()
        	    
    	       
        }; // end if refill packs =======================================================================================
    //==========================================================================================================================	
    
    
    // Step Three
    // cache step 3 selectors
    var $fillTypeOptions = j('> dl > dt > label:contains(Fill)', $pOW).parent().next(),
        $fillTypeSmallTitle = j('> dl > dt > label:contains(Small)', $pOW).parent(),
        $fillTypeSmallOptions = j('> dl > dt > label:contains(Small)', $pOW).parent().next(),
        $fillTypeLargeTitle = j('> dl > dt > label:contains(Large):first', $pOW).parent(),
        $fillTypeLargeOptions = j('> dl > dt > label:contains(Large):first', $pOW).parent().next(),
        $fillTypeXLargeTitle = j('> dl > dt > label:contains(X-Large)', $pOW).parent(),
        $fillTypeXLargeOptions = j('> dl > dt > label:contains(X-Large)', $pOW).parent().next(),
        $personalizeTitle = j('> dl > dt > label:contains(Personalize)', $pOW).parent(), 
        $personalizeOptions = j('> dl > dt > label:contains(Personalize)', $pOW).parent().next(),
        $fontTypeTitle = j('> dl > dt > label:contains(Font)', $pOW).parent(),  
        $fontTypeOptions = j('> dl > dt > label:contains(Font)', $pOW).parent().next(),
        $threadColorTitle = j('> dl > dt > label:contains(Thread)', $pOW).parent(),
        $threadColorOptions = j('> dl > dt > label:contains(Thread)', $pOW).parent().next(),
        $embroideryTitle = j('> dl > dt > label:contains(Embroidery)', $pOW).parent(),  
        $embroideryOption = j('> dl > dt > label:contains(Embroidery)', $pOW).parent().next();
        
    // add some css
    $fillTypeSmallTitle.addClass('fill-type-option');
    $fillTypeSmallOptions.addClass('fill-type-option');
    $fillTypeLargeTitle.addClass('fill-type-option');
    $fillTypeLargeOptions.addClass('fill-type-option');
    $personalizeTitle.addClass('personalize-option');
    $personalizeOptions.addClass('personalize-option');
    $fontTypeTitle.addClass('font-type-option').hide();
    $fontTypeOptions.addClass('font-type-option').hide();
    $threadColorTitle.addClass('thread-color-option').hide();
    $threadColorOptions.addClass('thread-color-option').hide();
    $embroideryTitle.addClass('embroidery-option').hide();
    $embroideryOption.addClass('embroidery-option').hide();
        
    // remove fill types
    $fillTypeSmallTitle.hide();
    $fillTypeSmallOptions.hide().find('option:eq(1)').attr('selected', 'selected');
    $fillTypeLargeTitle.hide();
    $fillTypeLargeOptions.hide().find('option:eq(1)').attr('selected', 'selected');
    $fillTypeXLargeTitle.hide();
    $fillTypeXLargeOptions.hide().find('option:eq(1)').attr('selected', 'selected');
    
    // change Fill Type option values based on bag size
    j('img[alt ^= Small]', $sizeOptionsWrapper).click(function() {
       $fillTypeLargeTitle.hide();
       $fillTypeLargeOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeXLargeTitle.hide();
       $fillTypeXLargeOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeSmallTitle.show();
       $fillTypeSmallOptions.show().find('option:eq(1)').attr('selected', 'selected');
       
       if (jQuery('.product-name > h1').text() == 'Removable Cover Bean Bags') {
           
           jQuery('#cotton-list', $colorOptionsWrapper).find('small').text('$129.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$129.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$129.99');
           jQuery('#tie-list', $colorOptionsWrapper).find('small').text('$134.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$129.99');
           
           jQuery('#leather-list', $colorOptionsWrapper).hide();
       }
       
       if (jQuery('.product-name > h1').text() == 'Replacement COVERS for Bean Bags') {
           
           jQuery('#cotton-list', $colorOptionsWrapper).find('small').text('$74.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$74.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$74.99');
           jQuery('#tie-list', $colorOptionsWrapper).find('small').text('$79.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$74.99');

           jQuery('#leather-list', $colorOptionsWrapper).hide();
       }
       
       if (jQuery('.product-name > h1').text() == 'Non-Removable Cover Bean Bags') {
            jQuery('#classic-list', $colorOptionsWrapper).find('small').text('$69.99');
            jQuery('#wet-list', $colorOptionsWrapper).find('small').text('$69.99 ');
       }
       
       if (jQuery('.product-name > h1').text() == 'Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$99.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$124.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$119.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$104.99');
       }
       
       if (jQuery('.product-name > h1').text() == 'Replacement COVERS for Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$64.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$89.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$84.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$69.99');
       }
       
       
       
       
       opConfig.reloadPrice();
    });
    
    j('img[alt ^= Large]', $sizeOptionsWrapper).click(function() {
       $fillTypeSmallTitle.hide();
       $fillTypeSmallOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeXLargeTitle.hide();
       $fillTypeXLargeOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeLargeTitle.show();
       $fillTypeLargeOptions.show().find('option:eq(1)').attr('selected', 'selected');
       
       if (jQuery('.product-name > h1').text() == 'Removable Cover Bean Bags') {
       
            jQuery('#cotton-list', $colorOptionsWrapper).find('small').text('$171.99');
            jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$171.99');
            jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$171.99');
            jQuery('#tie-list', $colorOptionsWrapper).find('small').text('$191.99');
            jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$171.99');
            jQuery('#leather-list', $colorOptionsWrapper).show().find('small').text('$499.99');
            
       }
       
       if (jQuery('.product-name > h1').text() == 'Replacement COVERS for Bean Bags') {
       
            jQuery('#cotton-list', $colorOptionsWrapper).find('small').text('$104.99');
            jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$104.99');
            jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$104.99');
            jQuery('#tie-list', $colorOptionsWrapper).find('small').text('$124.99');
            jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$104.99');
            jQuery('#leather-list', $colorOptionsWrapper).show().find('small').text('$199.99');
            
            jQuery('#leather-list', $colorOptionsWrapper).hide();
       
       }
       
       if (jQuery('.product-name > h1').text() == 'Non-Removable Cover Bean Bags') {
            jQuery('#classic-list', $colorOptionsWrapper).find('small').text('$105.99');
            jQuery('#wet-list', $colorOptionsWrapper).find('small').text('$105.99 ');
       }
       
       if (jQuery('.product-name > h1').is(':contains(Royal Sacks)')) {
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('[+$40]');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('[+$50]');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('[+$20]');
           
       };
       
       if (jQuery('.product-name > h1').text() == 'Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$134.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$184.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$174.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$154.99');
       }
       
       if (jQuery('.product-name > h1').text() == 'Replacement COVERS for Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$99.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$149.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$139.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$119.99');
       }
       opConfig.reloadPrice();
    });
    
    j('img[alt ^= X-Large]', $sizeOptionsWrapper).click(function() {
       $fillTypeSmallTitle.hide();
       $fillTypeSmallOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeLargeTitle.hide();
       $fillTypeLargeOptions.hide().find('option[value=""]').attr('selected', 'selected');
       $fillTypeXLargeTitle.show();
       $fillTypeXLargeOptions.show().find('option:eq(1)').attr('selected', 'selected');
    
       if (jQuery('.product-name > h1').text() == 'Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$254.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$299.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$294.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$274.99');
       }
       
       if (jQuery('.product-name > h1').text() == 'Replacement COVERS for Royal Sacks') {
           jQuery('#twill-list', $colorOptionsWrapper).find('small').text('$199.99');
           jQuery('#ultra-list', $colorOptionsWrapper).find('small').text('$244.99');
           jQuery('#fur-list', $colorOptionsWrapper).find('small').text('$239.99');
           jQuery('#denim-list', $colorOptionsWrapper).find('small').text('$219.99');
       }
       
       opConfig.reloadPrice();
    });
    
    //show/ hide personalization options
    j('.options-list', $personalizeOptions)
    	.find('li:contains(Yes)')
    	.bind('click', function() {
    		$fontTypeTitle.fadeIn()
    		$fontTypeOptions.fadeIn()
    		$threadColorTitle.fadeIn()
    		$threadColorOptions.fadeIn()
    		$embroideryTitle.fadeIn();
    	 	$embroideryOption.fadeIn();
    	 	jQuery('#font-options-preview').fadeIn()
    	}).end()
    	.find('li:contains(No)')
    	.bind('click', function() {
    	    $fontTypeTitle.fadeOut();
    		$fontTypeOptions.fadeOut();
    		$fontTypeOptions.children('select').val('');
    		$threadColorTitle.fadeOut();
    		$threadColorOptions.fadeOut();
    		$threadColorOptions.children('select').val('');
    	 	$embroideryTitle.fadeOut();
    	 	$embroideryOption.fadeOut();
    	 	$embroideryOption.children('input').val('');
    	 	jQuery('#font-options-preview').fadeOut()
    	 	//j('#embroidery-text').text('');
    	 	
    	});
    
     j('> input', $embroideryOption)
     	.counter({
     		goal: 10
     	}).end()
     	.find('div').addClass('embroidery-counter').end()
     	.find('p').remove().end();
     	/*.find('div').after($embroideryPreview).nextAll().hide().end().prev()
     	.click(function() {
     		$embroideryPreview.fadeIn()
     	}).end().prev()
     	.keyup(function () {
           var value = j(this).val();
           j('#embroidery-text').text(value);
         }).keyup(); */	 
     
    // tool tips
    j('.size-small')
        .after('<div class="tooltip-wrapper"><div class="tooltip">For Children 8 And Under</div></div>')
    	.tooltip({effect: 'slide', delay: 50, offset:[32, -4]})
    
    j('.size-large', $sizeOptionsWrapper)
        .after('<div class="tooltip-wrapper"><div class="tooltip">For Children And Adults</div></div>')
    	.tooltip({effect: 'slide', delay: 50, offset:[8, 12]})
     
    $fillTypeOptions
        .find('select').after('<div class="tooltip-side-wrapper"><div class="tooltip"><div id="fill-options-preview"><h4>About our Fill options</h4><p>Our recycled beads are polystyrene particles that have been ground into chunks.<br/><br/>Our virgin beads are round circular BB shaped polystyrene beads.<br/><br/>Our Royal Mix is a special blend of the beads and shredded foam.</p></div></div></div>')
        .tooltip({effect: 'slide', delay: 50, offset:[163, -247]})
     
    $fontTypeOptions
        .find('select').after('<div class="tooltip-side-wrapper"><div class="tooltip"><p id="font-options-preview"></p></div></div>')
        .tooltip({effect: 'slide', delay: 50, offset:[206, -242]})  
      
    	
}; // end if product page    	
    	
    	
    	
    	
    	
    	
    	  
    	//obj.anmd
    	//obj['anmd']
    	
    	
    	/*
    	colorObj = {}
    	
    	jQuery("#attribute515").children().each(function(option) { 
    	    values = option.val().split(" / ")  // name, type
    	    if (colorObj[values[1]]) {
    	        colorObj[values[1]].append(values[0])
    	    } else {
    	        colorObj[values[1]] = [values[0]]
    	    }
    	})
    	
    	
    	colorObj.cotton.each(function(color) {    
    	    
    	});
    	
    	colorObj.keys()
    	
    	*/
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	
    	        	
    	
    

	    
	   // Performance Timer
	   console.timeEnd('swatch load time');
   
});

