// 	Melissa Pangborn
//	Javascript 
//	Created for "Civic Institute" website
window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A") {
			setupRollover(document.images[i]);
		}
	}
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

//	thisImage.clickImage = new Image();
//	thisImage.clickImage.src = "../images/menubuttons/selected" + thisImage.id + ".gif";
//	thisImage.onclick = rollClick;	
//	thisImage.onmousedown = rollClick;	
	thisImage.overImage = new Image();
	thisImage.overImage.src = "../images/menubuttons/on" + thisImage.id + ".gif";
	thisImage.onmouseover = rollOver;	
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollClick() {
	this.src = this.clickImage.src;
}

function goLastMonth(month, year) { 
//this function is for calendar.php
// If the month is January, decrement the year 
	if(month == 1) { 
		--year; 
		month = 13; 
	} 

	document.location.href = 'calendar.php?month='+(month-1)+'&year='+year; 
} 


function goNextMonth(month, year) { 
//this function is for calendar.php
// If the month is December, increment the year 
	if(month == 12) { 
		++year; 
		month = 0; 
	} 
	document.location.href = 'calendar.php?month='+(month+1)+'&year='+year; 
} 

function open_graph(pictureid){
//this function is for charts.php
//when a graph or map is available with a chart
//a link is available that opens the image into a new window
//by calling to this function
newurl='http://www.civicinstitute.org/ci/data/graph.php?id='+pictureid;
window.open(newurl,'_blank','width=400,height=300,titlebar=0,menubar=0,resizable=1');

}