function dochange(changer)
{
	var the_colour = changer.colour.value;

	if(the_colour.charAt(0) != '#' )
		the_colour = '#' + the_colour;

	if( the_colour.length != 7 )
	{
		alert('The string is invalid. it must be 6 valid characters in length, and start with the # symbol, e.g. #1A2a30.');
		return;
	}

	for (ii = 1; ii < the_colour.length; ii++)
	{
		thisChar = the_colour.charAt( ii );


		if ( thisChar != '1' && 
			thisChar != '2' && 
			thisChar != '3' && 
			thisChar != '4' && 
			thisChar != '5' && 
			thisChar != '6' && 
			thisChar != '7' && 
			thisChar != '8' && 
			thisChar != '9' && 
			thisChar != '0' && 
			thisChar.toLowerCase() != 'a' && 
			thisChar.toLowerCase() != 'b' && 
			thisChar.toLowerCase() != 'c' && 
			thisChar.toLowerCase() != 'd' && 
			thisChar.toLowerCase() != 'e' && 
			thisChar.toLowerCase() != 'f' )
		{
			alert('The character ' + thisChar + ' is not valid. Colour must be between 0 and 9, or a, b, c, d, e or f.');
			return;
		}
	}


	if(document.getElementById)
	{
		the_div = document.getElementById('change_colour');
		the_div.style.backgroundColor = the_colour; 
		return;
	}	
	else if(document.layers)
	{ // browser="NN4";
		document.layers["q"].bgColor = the_colour; 
	}
	else if(document.all)
	{ // browser="IE"; 
		document.all.q.style.backgroundColor = the_colour; 
	}
	else if(!document.all && document.getElementById)
	{ // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff"; 
		document.getElementById('change_colour').style.backgroundColor = the_colour;
	}

}