// Color code table
c = new Array('00', '33', '66', '99', 'cc', 'ff');
// Start color table
t = '<table border="1" cellpadding="6" style="border-collapse:collapse;">';
// Iterate red color
for (r = 0; r < 6; r++)
{
	// Iterate green color
	for (g = 0; g < 6; g++)
	{
		// Start color table row
		t += '<tr>';
		// Iterate blue color
		for (b = 0; b < 6; b++)
		{
			// Get RGB (background) color code
			L = '#' + c[r] + c[g] + c[b];
			// Get alternative/tooltip text
			A = L + ' = RGB('
			    + parseInt('0x' + c[r]) + ', '
			    + parseInt('0x' + c[g]) + ', '
			    + parseInt('0x' + c[b]) + ')'
			    ;
			// Get "inverted" RGB (foreground) color code
			F = '#' + c[5 - r] + c[5 - g] + c[5 - b];
			// Color table cell
			t += '<td align="center"'
			    + ' style="'
			    + 'background-color:' + L + ';'
			    + 'color:' + F + ';'
			    + 'font-family:Courier New;'
			    + 'cursor:hand;'
			    + '"'
			    + ' title="' + A + '"'
				+ ' onclick="alert(\'' + A + '\');"'
				+ ' onmouseover="window.status=\'' + A + '\';"'
				+ ' onmouseout="window.status=\' \';"'
			    + '>' + L + '</td>'
			    ;
		}
		// End color table row
		t += '</tr>';
	}
}
// Display color table
document.write(t + '</table>');

