
if (jQuery) jQuery.noConflict();
jQuery(function($) {
	
	$('a.thickbox, area.thickbox, input.thickbox, .product-box map area, a[@href$=buy-mp3], a[@href$=buy-cd]').each(function() {
		$(this).click(function(){
			var t = this.title || this.name || null;
			var a = this.href || this.alt;
			if (a.indexOf('?') != -1) {
				a += '&TB_iframe=1';
			} else {
				a += '?TB_iframe=1';
			}
			var g = this.rel || false;
			tb_show(t,a,g);
			document.getElementById('TB_closeWindowButton').innerHTML = '<strong>Continue Shopping</strong>';
			this.blur();
			return false;
		});
	});
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
	
	// For all add to cart input buttons we need to look at the parent+sibling
	// select box and use its id to put into the href of the parent a href.
// 	var addToCartHref = 'https://www.e-junkie.com/ecom/gb.php?c=cart&i=%s&cl=1737&ejc=2';
	var addToCartHref = '/redir/?product=%s';
	
	$('a.add-product').each(function() {
		// add button
		$(this).append('<input type="button" value="Add to cart" />');
	}).click(function() {
		// handle click
		var select = $(this).prev('select.product-select');
		$(this).attr('href', addToCartHref.replace(/%s/, select.val()));
		var t = this.title || this.name || null;
		var a = this.href || this.alt;
		if (a.indexOf('?') != -1) {
			a += '&TB_iframe=1';
		} else {
			a += '?TB_iframe=1';
		}
		var g = this.rel || false;
		tb_show(t,a,g);
		document.getElementById('TB_closeWindowButton').innerHTML = '<strong>Continue Shopping</strong>';
		this.blur();
		return false;
					
// 		return EJEJC_lc(this);
	});
	
});
