// Colour-handling code by David Turover, Nov. 2003
// This code is public domain

function RGBArray(s){
	// Takes a CSS colour and returns an array whose values are:
	// 	[0] -- original value
	// 	[1] -- red 	[2] -- green	[3] -- blue

	var c = new Array;

	// Check for colour in #000000 format
	if ((c = s.match(/#(..)(..)(..)/)) == null){
		// Check for colour in rgb(0,0,0) format
		if((c = s.match(/rgb\(([^,]*),([^,]*),([^\)]*)\)/)) == null){
			// Unknown format, not a colour, or undefined
			return null;
		}
	} else {
		// Clean up #000000; convert hex format to dec
		c[1] = parseInt(c[1],16);
		c[2] = parseInt(c[2],16);
		c[3] = parseInt(c[3],16);
	}

	//alert(c);
	return c;
}

