// JavaScript Document

window.onload = rolloverInit;
//window.onload = rolloverInit2;

var url = "http://www.brettbarrett.com";

function rolloverInit()
{
	for(var i = 0; i < document.images.length; i++)
	{
		if(document.images[i].className == "menuButton")
		{
			setupRollover(document.images[i]);	
		}
		
		if(document.images[i].className == "projectButton" && document.images[i].className != "currentProject")
		{
			setupProjectRollover(document.images[i]);	
		}
		
		if(document.images[i].className == "pressButton" && document.images[i].className != "currentPress")
		{
			setupPressRollover(document.images[i]);	
		}
	}
}

function setupRollover(thisImage)
{
	thisImage.outImage = new Image();
	thisImage.outImage.src = url + "/images/menu/" + thisImage.id + "-up.png";
	thisImage.onmouseout = rollOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = url + "/images/menu/" + thisImage.id + "-over.png"; //Change path to rollover image.
	thisImage.onmouseover = rollOver;
}

function setupProjectRollover(thisImage)
{
	thisImage.outImage = new Image();
	thisImage.outImage.src = url + "/images/graphics/projects-menu/" + thisImage.id + "-up.png";
	thisImage.onmouseout = rollProjectOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = url + "/images/graphics/projects-menu/" + thisImage.id + "-over.png"; //Change path to rollover image.
	thisImage.onmouseover = rollProjectOver;
}

function setupPressRollover(thisImage)
{
	thisImage.outImage = new Image();
	thisImage.outImage.src = url + "/images/graphics/press-menu/" + thisImage.id + "-up.png";
	thisImage.onmouseout = rollPressOut;
	
	thisImage.overImage = new Image();
	thisImage.overImage.src = url + "/images/graphics/press-menu/" + thisImage.id + "-over.png"; //Change path to rollover image.
	thisImage.onmouseover = rollPressOver;
}

function rollOut()
{
	this.src = this.outImage.src;	
}

function rollOver()
{
	this.src = this.overImage.src;	
}

function rollProjectOut()
{
	this.src = this.outImage.src;	
}

function rollProjectOver()
{
	this.src = this.overImage.src;	
}

function rollPressOut()
{
	this.src = this.outImage.src;	
}

function rollPressOver()
{
	this.src = this.overImage.src;	
}
