function to_decimal(hex) {
	if(hex=='F')return 255; if(hex=='C')return 204; return (hex/3)*51;
}
function boxcolor(c) {
	document.getElementById('blackbox').style.backgroundColor = c;
}
function info(c, alertbox) {
	var red = c.substring(0,1); var green = c.substring(2,3); var blue = c.substring(4,5);
	var info = '#'+ c +'  RGB=('+ to_decimal(red) +', '+ to_decimal(green) +', '+ to_decimal(blue) +')';
	if(alertbox) alert(info); else document.inform.box.value = info;
	document.inform.sample.style.backgroundColor = '#'+c;
}
function matrix_init()
{
var list = new Array('00','33','66','99','CC','FF');
var red, green, blue;
// -----
document.write('<table align="center" cellpadding="0" cellspacing="0" border="0" id="matrix">');
for(r=0; r<6; r++)
{
	document.write('<tr>\n');
	red = list[r];
	for(g=0; g<6; g++)
	{
		green = list[g];
		for(b=0; b<6; b++)
		{
			blue=list[b]; bg=''+red+green+blue;
			document.write('<td class="x2" bgcolor="#'+ bg +'" title="#'+ bg +'" onmouseover="info(\''+ bg +'\',0);" onclick="boxcolor(\''+bg+'\');info(\''+ bg +'\',1);">&nbsp;</td>');
		}
	}
	document.write('</tr>\n');
}
document.write('</table>');
// -----
}
