function openPopup(url,width,height,name,scrollbars,resize) {
	var h;
	if(arguments.length < 4) {name = 'popup';}
	if(arguments.length < 5) {scrollbars = 'yes';}
	if(arguments.length < 6) {resize = 'yes';}
	if(h != null && !h.closed) {h.close();}
	h = window.open(url,name,'toolbar=no,location=no,directories=no,status=no,scrollbars='+scrollbars+',resizable='+resize+',width='+width+',height='+height);
	h.focus();
}

function loadProduct(url) {
	$('main-column').setOpacity(0.2);
	currentColour = '';
	new Ajax.Updater('main-column',url + "?ajax=1",
	{
		'method':'get',
		evalScripts:true,
		asynchronous:true,
		onComplete:new function() { $('main-column').setOpacity(1.0); setTimeout("refreshShadowBox()",500); }
	});
	return false;
}
function refreshShadowBox() {
	Shadowbox.clearCache();
	sbLinks = document.getElementsByClassName('shadowbox-link');
	Shadowbox.setup(sbLinks);
}

var currentColour = '';
function selectColour(colourName,colour) {
	var photos = "";
	if(colour != currentColour) {
		if (currentColour != '') {
			$('product-image-' + currentColour).hide();
		} else {
			photos = $$('.product-photo');
			for(i=0;i<=photos.length;i++) {
				photos[i].hide();
			}
		}
		$('product-image-'+colour).show();
		currentColour = colour;
		document.paypalAdd.os0.value = colourName;
	}
}
function setCurrentColour(c) {
	currentColour = c;
}