/**
 * Colour and Trim scripts
 */
function switchColour(el)
{
	var holder = document.getElementById('colours');
	if (!holder) return false;
	// set the header element and background from the <a> attributes
	var title = document.getElementById('colour_title');
	title.innerHTML = el.title;
	holder.style.backgroundImage = 'url('+el.href+')';
	el.onclick = function() {return false};
	return false;
}

function handle_onload()
{
	var holder = document.getElementById('colours');
	if (!holder) return false;
	var swatches = holder.getElementsByTagName('a');
	for (var i=0; i < swatches.length; i++) {
		swatches[i].onmousedown = function() {
			switchColour(this);
		}
	}
	// set the default colour
	switchColour(swatches[0]);

}

// attach events
Event.observe(window, 'load', handle_onload);
