var ie5 = (document.getElementById && document.all);
var ns6 = (!document.all && document.getElementById);

function closeWin(color)
{
	if(ie5 || ns6)
	{
		if (color)
		{
			i.value = color;
			i.style.background = color;
		}

		m.style.visibility = "hidden";
	}
}

function openWin(id)
{
	if(ie5 || ns6)
	{
		m = document.getElementById("modal");
		i = document.getElementById(id);
	
		m.style.visibility = "visible";
	}
}

function makeArray(q)
{
	for (i=1 ; i <= q ; i++)
	{
		this[i]=0;
	}
}

Colors = new makeArray(7);
Colors[1] = "00";
Colors[2] = "33";
Colors[3] = "66";
Colors[4] = "99";
Colors[5] = "CC";
Colors[6] = "FF";

function colors()
{
	document.writeln("<div id=\"modal\">");
	document.writeln("<div class=\"container\">");

	document.writeln("<div class=\"title\">");
	document.writeln("<strong>Click On A Color</strong>");
	document.writeln("<a href=\"javascript:closeWin();\">");
	document.writeln("<img src=\"images/close.gif\" />");
	document.writeln("</a>");
	document.writeln("</div>");

	document.writeln("<div class=\"palette\">");
	
	var ii = -1;
	
	for (i = 1; i <= 6; i++) {
	for (j = 1; j <= 6; j++) {
	for (k = 1; k <= 6; k++) {
	
	var thiscolor = Colors[i] + Colors[j] + Colors[k];
	
	document.writeln("<a href=\"javascript:closeWin('#" +thiscolor+ "')\" style=\"background-color:#" + thiscolor + "\"></a>");

	}
	}
	}
	
	document.writeln("</div>");

	document.writeln("</div>");
	document.writeln("</div>");
}

d = document;

function body_background_check()
{
	d.getElementById("body_background_image").style.display = "inline";
	d.getElementById("body_background_checkbox").onclick = function() { body_background_uncheck(); }
}

function body_background_uncheck()
{
	d.getElementById("body_background_image").style.display = "none";
	d.getElementById("body_background_checkbox").onclick = function() { body_background_check(); }
}
