// JavaScript Document

var hexBase = "";

window.onload = function()
{
	var buttons = document.getElementsByName("button");
	for( var i = 0; i < buttons.length; i++ ){
		var hex = getRandomHex();
		buttons[i].style.backgroundColor = hex;
		buttons[i].innerHTML += "<span class='hex'>" + hex.toUpperCase() + "</span>";
	}
};

function getRandomHex(){
	var colors = ["0", "3", "6", "9", "c", "f"];
	var hex = "";
	for( var i = 0; i < 6; i++ ){
		var index = Math.floor(Math.random()*colors.length);
		hex += colors[index];
	}
	return "#" + hexBase + hex;
}

function repaint(){
	window.location = window.location;
}

function getDateString(){
	var now = new Date();
	var month = now.getMonth() + 1;
	var date = now.getDate();
	var year = now.getYear();
	var season;
	if (month >= 1 && month <= 3) season = "Winter";
	if (month == 3 && date > 19) season = "Spring";
	if (month > 3 && month <= 6) season = "Spring";
	if (month == 6 && date > 20) season = "Summer";
	if (month > 6 && month <= 9) season = "Summer";
	if (month == 9 && date > 21) season = "Fall";
	if (month > 9 && month <= 12) season = "Fall";
	if (month == 12 && date > 20) season = "Winter";
	if (year < 2000) year = year + 1900;
	if (season == "Winter") year = year - 1;
	var dateString = season + year;
	return dateString.toUpperCase();
}