/** * Brilliant AdditionalCatalogView * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * * * Assumes existance of jQuery and instantiation before this script is loaded * * @category   Brilliant * @package    Brilliant_AdditionalCatalogView * @copyright  Copyright (c) 2010 Pod1 (http://www.pod1.com) * @license    ???  */ var colourSwatchAdditional = {	    /**     * @link http://www.snipplr.com/view/43518/check-if-object-exists/     */    objectExists: function (objToTest) {	    if (null == objToTest) {return false;};	    if ("undefined" == typeof(objToTest)) {return false;};	    return true;    },	productUrl : function(productID, baseUrl)	{		var productUrl = baseUrl;		productUrl += 'additionalcatalogview/product/viewajax/id/';		productUrl += productID;				return productUrl;	},		clickSwatch : function(element, productID, baseUrl)	{        if (jQuery(element).hasClass('active')) {           	if (jQuery('#overview.active').length == 0) {				GenericTabs.switchTo(jQuery('#overview'));			} else {				return false;			}        } else {            jQuery(".colour-options a").removeClass('active');            jQuery(element).addClass('active');						if (jQuery('#overview.active').length == 0) {				GenericTabs.switchTo(jQuery('#overview'), function() {					colourSwatchAdditional.swapImages(productID, baseUrl);				});			} else {				this.swapImages(productID, baseUrl);			}            return false;        }    },	swapImages : function(productID, baseUrl)	{		var product_url = this.productUrl(productID, baseUrl);				colourSwatchAdditional.showLoader();		jQuery('.tab-content.overview').fadeOut('slow', function () {						jQuery.ajax({				type : "GET",				async : false,				dataType : "html",				url : product_url,				cache : true,				error : function(data) {},				success : function(data) {					jQuery('.tab-content.overview').html(data);					if (colourSwatchAdditional.objectExists(thumbnailSwitcher) == true) thumbnailSwitcher.init();					if (colourSwatchAdditional.objectExists(lauchVideoOverlay) == true) lauchVideoOverlay.init();					if (colourSwatchAdditional.objectExists(lauchFullSize) == true) lauchFullSize.init();					if (						(jQuery('.cloud-zoom, .cloud-zoom-gallery').length > 0) &&						(colourSwatchAdditional.objectExists(jQuery('.cloud-zoom, .cloud-zoom-gallery').CloudZoom) == true)					) {						jQuery('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();					}										jQuery('.tab-content.overview').fadeIn('slow');					colourSwatchAdditional.hideLoader();				}			});		});	},		showLoader : function()	{		jQuery('.tab-content-wrap').append('<img class="colour-swatch-additional-loader" src="'+baseHREF+'images/backgrounds/loader_white.gif" style="position:absolute;top:318px;left:404px;z-index:-1;" />');		jQuery('.colour-swatch-additional-loader').fadeIn();	},		hideLoader : function()	{		jQuery('.colour-swatch-additional-loader').fadeOut(400, function() {			jQuery('.colour-swatch-additional-loader').remove();		});	}};
