<!--
// Begin Script "binary_clock.js"

	var hbit0 = "#000000";
	var hbit1 = "#000000";
	var mbit0 = "#000000";
	var mbit1 = "#000000";
	var sbit0 = "#000000";
	var sbit1 = "#000000";
	var hours = 0;
	var minutesX10 = 0;
	var minutesX1 = 0;
	var secondsX10 = 0;
	var secondsX1 = 0;
	var meridian = " AM";
	
function initialize()
{
	document.getElementById( "h1" ).readOnly = true;		// no writing in display
	document.getElementById( "h2" ).readOnly = true;
	document.getElementById( "h4" ).readOnly = true;
	document.getElementById( "h8" ).readOnly = true;
	document.getElementById( "m10" ).readOnly = true;
	document.getElementById( "m20" ).readOnly = true;
	document.getElementById( "m40" ).readOnly = true;
	document.getElementById( "m80" ).readOnly = true;
	document.getElementById( "m1" ).readOnly = true;
	document.getElementById( "m2" ).readOnly = true;
	document.getElementById( "m4" ).readOnly = true;
	document.getElementById( "m8" ).readOnly = true;
	document.getElementById( "s10" ).readOnly = true;
	document.getElementById( "s20" ).readOnly = true;
	document.getElementById( "s40" ).readOnly = true;
	document.getElementById( "s80" ).readOnly = true;
	document.getElementById( "s1" ).readOnly = true;
	document.getElementById( "s2" ).readOnly = true;
	document.getElementById( "s4" ).readOnly = true;
	document.getElementById( "s8" ).readOnly = true;

	UpdateClock();				// start clock update routine
}

function UpdateClock()				//loop to keep time displays current 
{
	var now = new Date();			// get current date & time from computer clock

	hours = Math.floor(now.getHours());

	if( hours > 11 )
	{
	hbit0 = "#000099";				// select BGR PM colors
	hbit1 = "#3366ff";
	mbit0 = "#006600";
	mbit1 = "#00ff00";
	sbit0 = "#990000";
	sbit1 = "#ff0000";
	meridian = " PM";
	}
	else
	{
	hbit0 = "#990000";				// select RGB AM colors
	hbit1 = "#ff0000";
	mbit0 = "#006600";
	mbit1 = "#00ff00";
	sbit0 = "#000099";
	sbit1 = "#3366ff";
	meridian = " AM";
	}

	if( hours > 12 )
	{
	hours -= 12;					// force 12 hour mode
	}
	else if( hours == 0 )
	{
	hours = 12;
	}

	minutesX10 = Math.floor( now.getMinutes() / 10 );
	minutesX1 = Math.floor( now.getMinutes() % 10 );	// mod 10 remainder

	secondsX10 = Math.floor( now.getSeconds() / 10 );
	secondsX1 = Math.floor( now.getSeconds() % 10 );	// mod 10 remainder

	document.getElementById( "time" ).innerHTML = hours + ":" + minutesX10 + minutesX1 + ":" + secondsX10 + secondsX1 + meridian;

	if(secondsX1 & 1)
	{
	document.getElementById( "s1" ).style.backgroundColor = sbit1;	// set element colors with bitwise comparisons
	}
	else 
	document.getElementById( "s1" ).style.backgroundColor = sbit0;

	if(secondsX1 & 2)
	{
	document.getElementById( "s2" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s2" ).style.backgroundColor = sbit0;

	if(secondsX1 & 4)
	{
	document.getElementById( "s4" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s4" ).style.backgroundColor = sbit0;

	if(secondsX1 & 8)
	{
	document.getElementById( "s8" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s8" ).style.backgroundColor = sbit0;

	if(secondsX10 & 1)
	{
	document.getElementById( "s10" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s10" ).style.backgroundColor = sbit0;

	if(secondsX10 & 2)
	{
	document.getElementById( "s20" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s20" ).style.backgroundColor = sbit0;

	if(secondsX10 & 4)
	{
	document.getElementById( "s40" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s40" ).style.backgroundColor = sbit0;

	if(secondsX10 & 8)
	{
	document.getElementById( "s80" ).style.backgroundColor = sbit1;
	}
	else 
	document.getElementById( "s80" ).style.backgroundColor = sbit0;


	if(minutesX1 & 1)
	{
	document.getElementById( "m1" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m1" ).style.backgroundColor = mbit0;

	if(minutesX1 & 2)
	{
	document.getElementById( "m2" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m2" ).style.backgroundColor = mbit0;

	if(minutesX1 & 4)
	{
	document.getElementById( "m4" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m4" ).style.backgroundColor = mbit0;

	if(minutesX1 & 8)
	{
	document.getElementById( "m8" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m8" ).style.backgroundColor = mbit0;

	if(minutesX10 & 1)
	{
	document.getElementById( "m10" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m10" ).style.backgroundColor = mbit0;

	if(minutesX10 & 2)
	{
	document.getElementById( "m20" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m20" ).style.backgroundColor = mbit0;

	if(minutesX10 & 4)
	{
	document.getElementById( "m40" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m40" ).style.backgroundColor = mbit0;

	if(minutesX10 & 8)
	{
	document.getElementById( "m80" ).style.backgroundColor = mbit1;
	}
	else 
	document.getElementById( "m80" ).style.backgroundColor = mbit0;

	if(hours & 1)
	{
	document.getElementById( "h1" ).style.backgroundColor = hbit1;
	}
	else 
	document.getElementById( "h1" ).style.backgroundColor = hbit0;

	if(hours & 2)
	{
	document.getElementById( "h2" ).style.backgroundColor = hbit1;
	}
	else 
	document.getElementById( "h2" ).style.backgroundColor = hbit0;

	if(hours & 4)
	{
	document.getElementById( "h4" ).style.backgroundColor = hbit1;
	}
	else 
	document.getElementById( "h4" ).style.backgroundColor = hbit0;

	if(hours & 8)
	{
	document.getElementById( "h8" ).style.backgroundColor = hbit1;
	}
	else 
	document.getElementById( "h8" ).style.backgroundColor = hbit0;

	newtime = window.setTimeout("UpdateClock();", 1000);		// update clock display once per second
}
// End Script "binary_clock.js"
// unhide -->
