// JavaScript Document
$(document).ready(function(){
/// hide lists
$('.list-h2').hide();
$('.list-h3').hide();
/// random colors
randomColor();
/// random grays
//randomGrays();
/// slide / open close toggle
$("h2").click(function () {
$(this).find("span").toggle();
$(this).next().slideToggle(800);
});
$("h3").click(function () {
$(this).find("span").toggle();						
$(this).next().slideToggle(1200);
});
//close brace
});
////////////////////////////
function randomColor(){
	$('*').css('background', function(index) {
  	return getHex();
});
//$('*').css('background', getHex());
//$("h2").css("background", getHex());
}
////////////////////////////
function randomGrays(){
	$('*').css('background', function(index) {
 	 return getHexGray();
});
//$('*').css('background', getHex());
//$("h2").css("background", getHex());
}
function intToHex(n){
 	n = n.toString(16);
 	if( n.length < 2)
 	n = "0"+n;
 	return n;
}
function getHex(){
    var r = Math.floor(Math.random()*240);//256 for all colors - 240 to weed out light colors
 	var g = Math.floor(Math.random()*240);
 	var b = Math.floor(Math.random()*240);
 	return '#'+intToHex(r)+intToHex(g)+intToHex(b);
}
///use gray colors instead 
function getHexGray(){
    var r = Math.floor(Math.random()*232);
 	var g =r
 	var b =r
 	return '#'+intToHex(r)+intToHex(g)+intToHex(b);
}

var now = new Date();
// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
var milli = currentTime.getMilliseconds()
  var suffix = "AM";
  if (hours >= 12) {
  suffix = "PM";
  hours = hours - 12;
  }
  if (hours == 0) {
  hours = 12;
  }
  if (minutes < 10)
  minutes = "0" + minutes
// Calculate four digit year.
function fourdigits(number)	{
return (number < 1000) ? number + 1900 : number;}
// Join it all together
today =  days[now.getDay()] + ", " + months[now.getMonth()] + " " + date + ", " + (fourdigits(now.getYear())) + " " + hours + ":" + minutes + ":" + seconds + ":" + milli + " " + suffix ;
// Print out the data.
//document.write(today);
