//SCRIPT FOR THE ROTATING IMAGES PART/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////



function load(){
    var randomVar = 1;
}


//an array of the top relative position of the div in order to display the correct picture
var positions = new Array();
positions[0] = 0;
positions[1] = 0;
positions[2] = -195;
positions[3] = -390;
positions[4] = -585;
positions[5] = -780;

var dater = new Date();
var numImages = 5; // the number of images to be displayed
var scrollAmount = 0;  // a number that will be used to determine the distance between two slides
var toScroll = 0;  // a number that will determine the amount of scroll for each iteration through the function
var timer;
var counter=setTimeout("autoScroll()",8000);
var thePastButton;
var thePresentButton;

var theImage = ((dater.getDay()+1)%numImages);

if(theImage == 0){
	theImage = numImages;
}
var theLocation = positions[theImage];  // the location top relative position of the div
var imageOn = theImage;  // the image displayed, starts on the 1st image


function setUpImage(){
	document.getElementById('thePics').style.top = theLocation + 'px';
	thePresentButton = "image" + imageOn;
	document.getElementById(thePresentButton+'Text').style.display = "block";
	document.getElementById(thePresentButton).style.background = "#89b652";
	load();
}



function autoScroll(){
	counter=setTimeout("autoScroll()",8000);
	if(imageOn <= numImages - 1){
		calculateScroll(imageOn + 1);
	}else{
		calculateScroll(1);
	}	
}


function calculateScroll(theOne){
	clearTimeout(counter);
	thePastButton = "image" + imageOn;
	thePresentButton = "image" + theOne;
	document.getElementById(thePastButton).style.background = "#c5bdb2";
	document.getElementById(thePresentButton).style.background = "#89b652";
	document.getElementById(thePastButton+'Text').style.display = "none";
	document.getElementById(thePresentButton+'Text').style.display = "block";
	scrollAmount = (theLocation - positions[theOne]);
	clearTimeout(timer);
	scroller();
	imageOn = theOne;
}


function scroller(){
	toScroll = scrollAmount/5;
	theLocation -= toScroll;
	scrollAmount -= toScroll;
	document.getElementById('thePics').style.top = theLocation + 'px';
	timer = setTimeout("scroller()",50);
	if(scrollAmount <= .5 && scrollAmount >= -.5){
		counter=setTimeout("autoScroll()",8000);
		clearTimeout(timer);
		theLocation = positions[imageOn];
		document.getElementById('thePics').style.top = theLocation + 'px';
	}
}

//function for button mouseOver
function swapImages(theOne){
	document.getElementById(theOne).style.background = '#89b652';
}
//function for button mouseOut
function swapBack(theOne){
	if(theOne != thePresentButton){
		document.getElementById(theOne).style.background = '#c5bdb2';
	}
}

//////////////////////////////////////////END ROTATING IMAGE SCRIPT
///////////////////////////////////////////////////////////////////




//////////////////////////////////////////NAVIGATION SCRIPTS//////
//////////////////////////////////////////////////////////////////

function dropItems(toDrop){
    document.getElementById(toDrop).style.display = "block";
}

function collapseItems(toCollapse){
    document.getElementById(toCollapse).style.display = "none";    
}