/*
	Copyright Code Computerlove Ltd 2007-2009
	Build: 1.0.0.127
	Date: 05/10/2009 10:52:21
*/

jQuery.noConflict();
var $j = jQuery;
function swatchCallback(swatch,swatchPopup,html) {
	/* Set the HTML of the swatch popup to that of the AJAX result */
	swatchPopup.html(html);
	/* Attach hover events */
	swatch.hover(function() {
		swatch.css('position', 'relative');
		swatchPopup.css('left', '-58px');
	}, function() {
		swatchPopup.css('left', '-9999em');
		swatch.css('position', 'static');
	});
	swatchPopup.click(function() {
		window.location = $j('a',swatch).attr('href');
	});
}

function loadSwatch(swatch, blindTypeId, colourRangeId) {
	var swatchPopup = $j('.swatchPopup',swatch);
	if (swatchPopup.html().length === 0) {
		var url = "/colour_range_swatch.aspx";
		$j.ajax ({
			url: url,
			data: {blindTypeId: blindTypeId, colourRangeId: colourRangeId, numberOfItems: '16', isajaxrequest: "1"},
			type: "html",
			type: "GET",
			success: function(html){
				swatchCallback(swatch,swatchPopup,html);
			}
		});
	}
}
