
var icHead = 8;
var headArray = new Array(icHead);  
//determine month and quarter
var now = new Date();
var quarter;
var currentMonth = now.getMonth();
if (currentMonth >= 0 && currentMonth <= 3){
	quarter = "Q1"
}
else if(currentMonth >= 4 && currentMonth <= 7){
	quarter = "Q2"
}
else if(currentMonth >= 8 && currentMonth <= 10){
	quarter = "Q3"
}
else{
	quarter = "Q4"
}
headArray[0] = "images/headImages/"+ quarter +"/1.gif"; 
headArray[1] = "images/headImages/"+ quarter +"/2.gif"; 
headArray[2] = "images/headImages/"+ quarter +"/3.gif"; 
headArray[3] = "images/headImages/"+ quarter +"/4.gif";  
headArray[4] = "images/headImages/"+ quarter +"/5.gif"; 
headArray[5] = "images/headImages/"+ quarter +"/6.gif"; 
headArray[6] = "images/headImages/"+ quarter +"/7.gif"; 
headArray[7] = "images/headImages/"+ quarter +"/8.gif";  

function pickHeadRandom(range) 
{ 
if (Math.random) return Math.round(Math.random() * (range-1)); 
else {  
      return (now.getTime() / 1000) % range; } } 
var choiceHead = pickHeadRandom(icHead); 

function writeHeadImage(){
//document.writeln('<img src="'+ headArray[choiceHead] +'" />');
var test = document.getElementById("masthead");
test.style.background='url('+ headArray[choiceHead] +')';
}