jQuery.noConflict();

function ajax_cart_close() {
    jQuery("#ajax_cart_holder").css('display', 'none');
    jQuery('#btn_shopping_bag').removeClass('active');
	jQuery('.qty').css('visibility', 'visible');
	jQuery('.size-select').css('visibility', 'visible');
}

function validateBeforeSubmit(){

	if(jQuery(".colour-options").length > 0 && jQuery(".colour-options .active").length == 0){
		jQuery(".validation-advice-colour").fadeIn();
		return false;
	}
	else if(jQuery('#fancybox-inner .quick-buy .colour-options').length > 0 && jQuery("#fancybox-inner .quick-buy .colour-options .active").length == 0){
		jQuery(".validation-advice-colour").fadeIn();
		return false;
	}
	else{
		jQuery(".validation-advice-colour").fadeOut();
		productAddToCartForm.submit();
	}
}

 
var InfieldLabels = {
	
	init : function()
	{
		jQuery('label.infield').each(function() {
			jQuery(this).hide();
			var field_id = jQuery(this).attr('for');
			jQuery('#'+field_id)
				.data('label_text', jQuery(this).text())
				.focus(function() { InfieldLabels.clear(this); })
				.blur(function() { InfieldLabels.populate(this); });	
			InfieldLabels.populate('#'+field_id);
		});
	},
	populate : function(element)
	{
		if (jQuery(element).val() == '') {
			jQuery(element).val(jQuery(element).data('label_text'));
		}
	},
	clear : function(element)
	{
		if (jQuery(element).val() == jQuery(element).data('label_text')) {
			jQuery(element).val('');
		}
	}
};

var Navigation = {
	
	init : function()
	{
		jQuery('#navigation li').not('.dropdown li').mouseenter(function() {
			if (jQuery('.dropdown', this).length > 0) {
				jQuery(this).addClass('hover');
				Navigation.postiionDropdown(jQuery('.dropdown', this)[0]);
			}
		});
		jQuery('#navigation li').not('.dropdown li').mouseleave(function() {
			if (jQuery('.dropdown', this).length > 0) {
				jQuery(this).removeClass('hover');
			}
		});
	},
	
	postiionDropdown : function(dropdown)
	{
		var dropdown_width = jQuery(dropdown).outerWidth();
		var dropdown_position = jQuery(dropdown).offset();
		
		var navigation_width = jQuery('#navigation').outerWidth();
		var navigation_position = jQuery('#navigation').offset();
		
		var left_coord = dropdown_position.left - navigation_position.left;
		
		if (left_coord + dropdown_width > navigation_width) {
			var difference = (left_coord + dropdown_width) - navigation_width;
			jQuery(dropdown).css('left', '-'+difference+'px');
			jQuery('.marker', dropdown).css('margin-left', difference+'px');
		}
	}
};

var HomepageSlideshow = {
	
	init : function()
	{
		HomepageSlideshow.addControls();
		jQuery('.slideshow').each(function() {
			jQuery('.slides', this).cycle({
				prev: jQuery('.prev', this), 
				next: jQuery('.next', this),
				timeout: 5000,
				speedIn:  800, //       true,  // speed of the 'in' transition 
    			speedOut: 1000, //       false,  // speed of the 'out' transition 
				startingSlide: 0,
				fx: 'scrollHorz'
			});
		});
	},
	
	addControls : function()
	{
		var controls = '<ul class="controls">';
		controls += '<li><a href="#" class="prev">Previous</a></li>';
		controls += '<li><a href="#" class="next">Next</a></li>';
		controls += '</ul>';
		
		jQuery('.slideshow').append(controls);
	}
};

var Footer = {
	
	open : false,
	gap : null,
	height : {
		closed : 20,
		open : null,
		min_inner : null,
		max_inner : null,
		min_outer : null,
		max_outer : null
	},
	
	init : function()
	{
		Footer.addControls();
		Footer.calculateHeights();
		Footer.position();
		
		jQuery(window).resize(function() { Footer.position(); });
	},
	
	calculateHeights : function()
	{
		this.height.open = jQuery('#footer-sections').height();
		this.height.max_inner = jQuery('#footer-sections').outerHeight();
		this.height.max_outer = jQuery('#footer').outerHeight();
		jQuery('#footer-sections').height(this.height.closed+'px');
		this.height.min_inner = jQuery('#footer-sections').outerHeight();
		this.height.min_outer = jQuery('#footer').outerHeight();
	},
	
	addControls : function()
	{
		if (jQuery('#footer .container:first .controls').length == 0) {
			var controls = '<ul class="controls">';
			controls += '<li><a href="#" class="open">Open</a></li>';
			controls += '<li><a href="#" class="close">Close</a></li>';
			controls += '</ul>';
			jQuery('#footer .container:first').append(controls);
		}
	
		jQuery('#footer .container:first .open, #footer-sections h6').click(function(e) { e.preventDefault(); Footer.update('open'); });
		jQuery('#footer .container:first .close').hide().click(function(e) { e.preventDefault(); Footer.update('close'); });
	
		jQuery('#footer-sections h6').css('cursor', 'pointer');
		jQuery('#footer-sections h6 a').click(function(e) { e.stopPropagation() });
	},
	
	position : function()
	{
		if (Footer.isStatic()) {
			jQuery('#footer').css('position', 'static');
		} else {
			jQuery('#footer').css({
				'position' : 'absolute',
				'bottom' : 0
			});
		}
	},
	
	update : function(action)
	{
		if ((action == 'open' && this.open) || (action == 'close' && !this.open)) return;
		
		jQuery('#footer .container:first .open').toggle();
		jQuery('#footer .container:first .close').toggle();
		
		var gap = Footer.availableSpace() - Footer.height.min_outer;
		
		if (action == 'open') {
			
			Footer.open = true;
			if (Footer.isStatic()) {
				Footer.openScroll();
			} else {
				var open_height = (Footer.availableSpace() > Footer.height.max_outer) ? Footer.height.open : '+='+gap;
				jQuery('#footer-sections').animate({ height : open_height+'px' }, function() {
					Footer.position();
					if (open_height != Footer.height.open) {
						Footer.openScroll();
					}
				});
			}
			
		} else {
			
			Footer.open = false;
			
			var close_height = (Footer.availableSpace() <= Footer.height.min_outer) ? Footer.height.closed : Footer.height.closed+gap-1;
			if (close_height >= Footer.height.max_outer) close_height = Footer.height.closed;
			jQuery('#footer-sections').animate({ height : close_height+'px' }, function() {
				Footer.position();
				if (close_height != Footer.height.closed) {
					jQuery('#footer-sections').animate({ height : Footer.height.closed+'px' });
				}
			});
		}
	},
	
	openScroll : function()
	{
		jQuery('#footer-sections').height(Footer.height.open+'px');
	 	jQuery(window).scrollTo('max', 400);
	},
	
	isStatic : function()
	{
		var page_height = jQuery('#page').outerHeight();
		
		if(jQuery('.category-boutiques').length==0){
			var store_nav = jQuery('#store-nav').outerHeight();
		}else{
			var store_nav = 0;	
		}
		
		var footer_height = jQuery('#footer').outerHeight();
		var window_height = jQuery(window).height();
		
		var total_height = page_height + store_nav + footer_height;
		
		if (total_height >= window_height) {
			//alert("page" + page_height + "footer" + footer_height + "store nav " + store_nav + " total height " + total_height  + " window_height " + window_height + "footer static"); 
			return true;
		} else {
			//alert("footer" + footer_height + "store nav " + store_nav + "total height " + total_height + " window_height " + window_height + "footer absolute"); 
			return false;
		}
	},
	
	availableSpace : function()
	{
		var page_height = jQuery('#page').outerHeight();
		var window_height = jQuery(window).height();
		
		return window_height - page_height;
	}
};

var WeLove = {

	init : function()
	{
		jQuery('#we-love ul.carousel').jcarousel({
			//wrap : 'circular',
			scroll : 1
		});
	}
};

var ProductScroller = {
	
	// Settings
	container_padding : 39,
	infinite : false,
	
	current_item : 1,
	item_count : 0,
	item_width : null,
	total_width : null,
	animating : false,
	
	init : function()
	{
		if (jQuery('#products.scroller').length > 0) {
			this.current_item = 1;
			this.prepare();
			this.addControls();
			this.updateOffset();
			jQuery(window).resize(function() { ProductScroller.updateOffset(); });
		}
	},
	
	addControls : function()
	{
		var controls = '<div class="controls">';
		controls += '<div class="container">';
		controls += '<a href="#" id="products-prev">PREV</a>';
		controls += '<a href="#" id="products-next">NEXT</a>';
		controls += '</div>';
		controls += '</div>';
		
		jQuery('#products').prepend(controls);
		ProductScroller.updateControls();
		
		jQuery('#products-prev').click(function(e) { 
			e.preventDefault();
			if (ProductScroller.infinite || ProductScroller.current_item != 1) {
				ProductScroller.scroll('prev');
			} else {
				if (!jQuery(this).hasClass('disabled')) {
					if(jQuery('#adv_search').length > 0){
						jQuery('.pagination .prev:first').trigger('click');
					}else{
						var url = jQuery('.pagination .prev:first').attr('href');
						if(url)	location.replace(url);
					}
				}
			}
		});
		jQuery('#products-next').click(function(e) {
			e.preventDefault();
			if (ProductScroller.infinite || ProductScroller.current_item + 2 < ProductScroller.item_count) {
				ProductScroller.scroll('next');
			} else {
				if (!jQuery(this).hasClass('disabled')) {
					if(jQuery('#adv_search').length > 0){
						jQuery('.pagination .next:first').trigger('click');
					}else{
						var url = jQuery('.pagination .next:first').attr('href');
						if(url)	location.replace(url);
					}
				}
			}
		});
	},
	
	updateControls : function()
	{
		if (!this.infinite) {
			if (this.current_item == 1 && jQuery('.pagination .prev').length == 0) {
				jQuery('#products-prev').addClass('disabled');
			} else {
				jQuery('#products-prev').removeClass('disabled');
			}
			if ((this.current_item + 2 == this.item_count || this.item_count <= 3) && jQuery('.pagination .next').length == 0) {
				jQuery('#products-next').addClass('disabled');
			} else {
				jQuery('#products-next').removeClass('disabled');
			}
		}
	},
	
	prepare : function()
	{
		jQuery('#products.scroller').removeClass('container');
		jQuery('#products.scroller>ul').addClass('scroller-container');
		jQuery('#products.scroller>ul').wrap('<div id="products-clip" />');
		
		var elements = jQuery('#products.scroller .scroller-container>li');
		
		ProductScroller.item_count = elements.length;
		ProductScroller.item_width = jQuery(elements[0]).outerWidth();
		ProductScroller.total_width = ProductScroller.item_width * ProductScroller.item_count;
		
		jQuery('#products.scroller .scroller-container').css({
			float : 'none',
			top : 0,
			width : (this.infinite) ? ProductScroller.total_width * 3 : ProductScroller.total_width,
			position : 'absolute'
		});
		
		jQuery('#products-clip, #products').height(jQuery('#products .scroller-container').outerHeight());
		
		if (this.infinite) {
			elements.filter(':first').before(elements.clone().addClass('cloned'));
			elements.filter(':last').after(elements.clone().addClass('cloned'));
		}
	},
	
	updateOffset : function()
	{
		var controls_offset = jQuery('#products .controls .container').offset();
		if (controls_offset){
		    if (this.infinite == true) {
			var offset = this.total_width + ((this.current_item - 1) * this.item_width) - controls_offset.left - this.container_padding;
			offset = '-'+offset+'px';
			//alert(offset);
		    } else {
			    var offset = controls_offset.left + this.container_padding - ((this.current_item - 1) * this.item_width);
			    offset = offset+'px';
			    //alert(offset);
		    }
		    
		    jQuery('#products.scroller .scroller-container').css({
			    left : offset
		    });
		}
	},
	
	scroll : function(direction)
	{	
		if (!this.animating) {
			
			this.animating = true;

			var op = (direction == 'next') ? '-=' : '+=';
			var next = (direction == 'next') ? 1 : -1;

			ProductScroller.nextItem(next);
			jQuery('#products.scroller .scroller-container').animate({
				left : op+this.item_width+'px'
			}, function() { 
				ProductScroller.animating = false;
				if (ProductScroller.infinite) {
					ProductScroller.updateOffset(); 
				}
			});
		}
	},
	
	nextItem : function(next)
	{
		next_item = this.current_item + next;
		if (next_item < 1) {
			next_item = this.item_count;
		} else if (next_item > this.item_count) {
			next_item = 1;
		}
		this.current_item = next_item;
		this.updateControls();
	}
};

var GenericTabs = {
	
	init : function()
	{
		jQuery('.tab-titles a').click(function(e){
			e.preventDefault();
			GenericTabs.switchTo(this);
		});
	},
	
	switchTo : function(e, callback)
	{
		var clickedTabId = jQuery(e).get(0).id;
		jQuery(e).parent().siblings().find('.active').removeClass('active');
		jQuery(e).addClass('active');
		jQuery(e).parentsUntil('.tabs').parent().find('.tab-content').hide();
		jQuery(e).parentsUntil('.tabs').parent().find('.' +clickedTabId).fadeIn(400, callback);
	}
};

var thumbnailSwitcher = {
	
	init : function()
	{
		jQuery('.thumbnails a').click(function(e){
			e.preventDefault();											   
			jQuery('.thumbnails a').removeClass('active');
			jQuery(this).addClass('active');
			jQuery('.l_fullsize').attr('href',jQuery(this).attr('href'));
			jQuery('#gallery-big-image').attr('src',jQuery(this).attr('href'));
    	});
	}
};

var thumbnailScroller = {

	init : function()
	{
		jQuery('#more-views .carousel').jCarouselLite({
			scroll : 1,
			visible: 4,
			vertical: true,
            btnNext: '.jcarousel-next',
            btnPrev: '.jcarousel-prev',
            circular: false
		});
	}
};

var lauchFullSize = { // View full size image popup (fancybox)

	init : function()
	{
	jQuery('.l_fullsize').fancybox({
			type	: 'image',
			autoScale     	: true,
			transitionIn		: 'fade',
			transitionOut		: 'fade',
			overlayOpacity		:	0.6,
			padding: 0,
			titleShow: false,
			overlayColor: '#fff',
			centerOnScroll: true			
		});
	}
};	

var lauchQuickBuy = { // View full size image popup (fancybox)

	init : function()
	{
	jQuery('.product-quick-buy').fancybox({
			type: 'ajax',
			autoDimensions	: false,
			width: 560,
			transitionIn		: 'fade',
			transitionOut		: 'fade',
			overlayOpacity		:	0.6,
			padding: 0,
			titleShow: false,
			overlayColor: '#fff',
			centerOnScroll: true,
			onStart : function () {
				jQuery(this.orig).after('<p class="product-quick-buy-loading" style="position:absolute;margin:6px 0 0 74px"><img src="'+baseHREF+'images/backgrounds/loader_white.gif" /></p>');
			},
			onComplete : function () {
				jQuery('.product-quick-buy-loading').remove();
				productAddToCartForm.submit = function () {
					if(this.validator && this.validator.validate()){					
						jQuery.fancybox.close();
						sendcart('', 'form');
					}
				}
				
				/*jQuery.ajax({
                    url: baseURL + 'additionalcatalogview/product/getconfig/id/' + '4543',
                    dataType: 'json',
                    //data: null,
					error: function (data) {
						console.log('error result');
					},
                    success: function(data) {
                        var spConfig = new Product.Config(data);
						spConfig.configureElement($('attribute158'));
						console.log('dupa');
						console.log(spConfig);
                    }
                    });*/
				
			}
		});
	}
};

var lauchVideoOverlay = { // Video overlay (loaded via iframe)

	init : function()
	{
	jQuery('.l_videoOverlay').fancybox({
			/* type	: 'inline', */
			'scrolling'		: 'no',
			autoDimensions	: false,
			width: 570,
			height: 350,
			autoScale     	: true,
			transitionIn	: 'fade',
			transitionOut	: 'fade',			
			'titleShow'		: false,
			overlayColor: '#fff',
			overlayOpacity	:	0.6,
			centerOnScroll: true			
		});
	}
};

/*var launchNewsletterPopup = { // 

	init : function()
	{
	jQuery('#me').fancybox({
			type	: 'inline', 
			'scrolling'		: 'no',
			autoDimensions	: false,
			width: 570,
			height: 350,
			autoScale     	: true,
			transitionIn	: 'fade',
			transitionOut	: 'fade',			
			'titleShow'		: false,
			overlayColor: '#fff',
			overlayOpacity	:	0.6,
			centerOnScroll: true			
		});
	}
}; */

var ProductsInPost = {

	init : function()
	{
		jQuery('#products-in-post ul.carousel').jcarousel({
			wrap : 'circular',
			scroll : 1
		});
	}
};

var ExpandPost = { //Product description drawer
	init : function()
	{
	jQuery('.l_read-more').click(function(e){
            e.preventDefault();
			jQuery(this).hide();
			postTextHeight = jQuery('#post-content-text .folder').height();
			if(postTextHeight > jQuery('#post-content-text').height()){			
				jQuery('#post-content-text').animate({height: postTextHeight },600);
			}
    });
	}
};

var gridCaptionAnimate = { 	//Grid hover show/hide
	init : function()
	{
	jQuery('.grid li a').hover(function(e){
		jQuery(this).find('.caption').fadeIn();		
    },function(e){
		jQuery(this).find('.caption').fadeOut();	
	});
	}
};

var activePoints = { //Boutiques image hotspots
	init : function()
	{
		jQuery('.active-point').hover(function(e){
			activePoints.closePopup();
			jQuery(this).parent().find('.active-point-popup').fadeIn();		
		},function(e){
			jQuery(this).parent().find('.active-point-popup').addClass('open');	
		});	
	},
	
	closePopup : function(e)
	{
			jQuery('.active-point-popup').hide();
	}
};


var StyledSelects = {
	
	init : function()
	{
		jQuery('.custom-select').styledSelect();
	}
};

var BackToTop = {
	init : function()
	{
		jQuery('#top a, .page-controls .top a').click(function(e) {
			e.preventDefault();
			jQuery(window).scrollTo(0, 600);
		});
	}
};

var BlogPosts = {
	init : function()
	{
		if (jQuery('#blog #posts').length > 0) {
			jQuery('#blog #posts').masonry({ columnWidth: 2 });
		}
	},
	showComments : function()
	{
		jQuery('#show-comments').click(function(e){
			jQuery('.post-comments-form').slideDown();
			jQuery(this).hide();
		});
	}
};


var ListingColorSwatches = {
		init : function()
		{
			jQuery('#products .colour-options a').click(function(e){	
			e.preventDefault();	
			if(!jQuery(this).is('.active')){
				var swatch = jQuery(this);
				var new_image = swatch.attr('href');
				var new_product_url = swatch.attr('rel');
				var image = swatch.parent().parent().parent().parent().parent().find('.product_image');
				swatch.parent().parent().find('.active').removeClass('active');
				//var loading = swatch.parent().parent().parent().children('.loading');
				//loading.fadeIn('slow');
				swatch.addClass('active');
				image.fadeOut('slow', function(){
				   jQuery(this).attr('src', new_image);
				   //image.parent().attr('href', new_product_url).parent().siblings('.actions').children('.product-view-details').attr('href', new_product_url);
				   //image.parent().attr('href', new_product_url).parent().siblings('.actions').children('.product-quick-buy').attr('href', new_product_url + '?mode=overlay');
				   //image.parent().parent().parent().find('h3 a').attr('href', new_product_url);
				   });
				image.load(function() {
					image.fadeIn('slow');
					//loading.fadeOut('slow');
					});
			}
		});
		}
	};
	


jQuery(document).ready(function(){
	InfieldLabels.init();
	Navigation.init();
	HomepageSlideshow.init();
	WeLove.init();
	StyledSelects.init();
	ProductScroller.init();
	BackToTop.init();
	//BlogPosts.init();
	
	GenericTabs.init();
	//thumbnailScroller.init(); 
	thumbnailSwitcher.init();
	lauchFullSize.init();
	lauchQuickBuy.init();
	lauchVideoOverlay.init();
	//launchNewsletterPopup.init();
	ProductsInPost.init();
	ExpandPost.init();
	//gridCaptionAnimate.init();
	activePoints.init();
	//Custom.init();
	
	
	jQuery('#show-add-reviews-form').click(function(e){
		e.preventDefault();												
		jQuery('#add-review-form').slideDown('slow');										   
	});
	jQuery('#show-all-reviews').click(function(e){
		e.preventDefault();	
		jQuery('.reviews-second-part').slideDown('slow');										   
	});
	
	jQuery('.custom-select li .opt').click(function(e) {
		jQuery(this).toggleClass('adj-nav-attribute-selected');
		var checkbox = jQuery(this).find('input');
		if(checkbox.is(':checked')){
			checkbox.attr('checked',false);
		}else{
			checkbox.attr('checked',true);	
		}
		filter_selection();		
	});
	
	jQuery('.colour-options a').click(function(e) {
		e.preventDefault();
	});
	
	//Press archive accordion sidebar
	jQuery('#additional-content.press-archives .level-1-link').click(function(e) {
		e.preventDefault();	
		jQuery(this).next().slideToggle('fast');
	});
	//jQuery('#product-filter .container').css('overflow','visible');
	
	//Ajax shopping cart scrollable on many items
	jQuery('#ajax_cart_container').css('max-height', ''+ jQuery(window).height() +'px');
});

jQuery(window).load(function(){
  BlogPosts.init();
  Footer.init();
});


jQuery(document).ready(function(){   
	if (!jQuery('body').hasClass('catalogsearch-result-index')) jQuery('#products_list').delegate('a.listing_pager', 'click', function(e){
		e.preventDefault();
		jQuery('#products_list').addClass('opacityClass');
		jQuery('#contentLoading').css('display','block');
		var content = jQuery('#products_list');
		var url = jQuery(this).attr('href');
		if (typeof(catalogAjaxUrl) != "undefined"  )
		{
			url = catalogAjaxUrl + '&' + url.substr(url.indexOf('?')+1);
		}
		jQuery.post(url, function (data) {
			content.fadeOut('slow', function() {
				jQuery('#products').remove();			
				content.html(data);
				jQuery('#products_list').removeClass('opacityClass');
				jQuery('#contentLoading').css('display','none');
				content.fadeIn('slow', function() {
					ListingColorSwatches.init();
					tooltip.init();
					if(jQuery('#adv_search').length > 0){
						lauchQuickBuy.init();
						ProductScroller.init();
						Footer.init();
					}
				});			
			});
		}, "html");
	});

	jQuery('#products_list').delegate('.catalog-category-view a.listing_mode', 'click', function(e){
		e.preventDefault();
		jQuery('#products_list').addClass('opacityClass');
		jQuery('#contentLoading').css('display','block');
		var content = jQuery('#products_list');
		jQuery.post(jQuery(this).attr('href'), function (data) {    
			content.fadeOut('slow', function() {
				jQuery('#products').remove();			
				content.html(data);
				jQuery('#products_list').removeClass('opacityClass');
				jQuery('#contentLoading').css('display','none');
				content.fadeIn('slow', function() {
					ListingColorSwatches.init();
					tooltip.init();
					if(jQuery('#adv_search').length > 0){
						lauchQuickBuy.init();
						ProductScroller.init();
						Footer.init();
					}
				});		
			});
		}, "html");
    });
	if (jQuery('body').hasClass('catalog-category-view') || jQuery('body').hasClass('catalogsearch-result-index'))
	{
		ListingColorSwatches.init();
		tooltip.init();
		
		if(jQuery('#adv_search').length > 0){
		lauchQuickBuy.init();
		ProductScroller.init();
		Footer.init();
		}

        if (jQuery('#products[class*="scroller"]').length > 0) {
            //console.log('scroller exists');
        }
	}
});

var tooltip={
	init: function(){
		jQuery(".tip[title]").not('.tooltip-init').addClass('tooltip-init').tooltip({
			tip: '#qTip',
			predelay: 50,
			offset: [-3, -3],
			position: "bottom right"
		});
	}
};

jQuery(function($){
	$('body').append($('<div id="qTip"/>'));
	tooltip.init();
});

//faq
jQuery(document).ready(function($){
	$('.faq dd').hide();
    $('.faq dt').click(function(e){
        e.preventDefault();
        if ($(this).hasClass('current')){
            $(this).removeClass('current').next('dd').removeClass('current').slideUp('fast');
        } else {
            $('.faq dt.current').removeClass('current').next('dd').removeClass('current').slideUp('fast');
            $(this).addClass('current').next('dd').addClass('current').slideDown('fast');
        }
    });
});

// Checkout help
jQuery(document).ready(function() {
	jQuery("#checkout-help-order").fancybox({	
		'titlePosition'		: 'none',
		'scrolling'		: 'auto',
		autoDimensions	: false,
		width: 600,
		height: 450,
		transitionIn		: 'fade',
		transitionOut		: 'fade',
		overlayOpacity		:	0.6,
		padding: 10,
		titleShow: false,
		overlayColor: '#fff',
		centerOnScroll: true			
		});
		
	jQuery("#checkout-ukdelivery").fancybox({
		'titlePosition'		: 'none',
		'scrolling'		: 'auto',
		autoDimensions	: false,
		width: 600,
		height: 450,
		transitionIn		: 'fade',
		transitionOut		: 'fade',
		overlayOpacity		:	0.6,
		padding: 10,
		titleShow: false,
		overlayColor: '#fff',
		centerOnScroll: true		
		});

	jQuery("#checkout-intdelivery").fancybox({
		'titlePosition'		: 'none',
		'scrolling'		: 'auto',
		autoDimensions	: false,
		width: 600,
		height: 450,
		transitionIn		: 'fade',
		transitionOut		: 'fade',
		overlayOpacity		:	0.6,
		padding: 10,
		titleShow: false,
		overlayColor: '#fff',
		centerOnScroll: true		
		});

	jQuery("#checkout-returns").fancybox({
		'titlePosition'		: 'none',
		'scrolling'		: 'auto',
		autoDimensions	: false,
		width: 600,
		height: 450,
		transitionIn		: 'fade',
		transitionOut		: 'fade',
		overlayOpacity		:	0.6,
		padding: 10,
		titleShow: false,
		overlayColor: '#fff',
		centerOnScroll: true		
		});		
});

/* UNCOMMENT ONCE TICKET: 3029 	'Ajax pop up for email harvesting' IS READY TO GO LIVE
function doPopup() {	

	jQuery("#launch-pop-newsletter").fancybox({				
		autoDimensions	: false,
		width			: 703,
		height			: 407,
		transitionIn	: 'fade',
		transitionOut	: 'fade',
		overlayOpacity	: 0.6,
		padding			: 0,
		titleShow		: false,
		overlayColor	: '#fff',
		centerOnScroll	: true,			
	});

	var message_dom = jQuery(".messages");
	console.log(message_dom);
	jQuery("#subscribe-message").append(message_dom);			
	jQuery("#launch-pop-newsletter").click();					
}

jQuery(document).ready(function() {
		var msg = jQuery(".messages li ul li").html();

		if ( (jQuery.cookie('newsletter')) && (msg == "There was a problem with the subscription: Please enter a valid email address.")) {
			doPopup();				
		}

		if ( (jQuery.cookie('newsletter')) && (msg == "There was a problem with the subscription: Sorry, but your can not subscribe email adress assigned to another user.")) {
			doPopup();				
		}
		
		if ((jQuery.cookie('newsletter') == null)) {
			doPopup();	
	
		}
		
		jQuery.cookie("newsletter", "1", { expires: 30 });
		jQuery.cookie('newsletter'); //gets the value
	
			
    });		
	*/	

