replaceImages = new Array(
	'Robina Rich Bouffault|images/header-about.png',
	'Robina Rich Bouffault Biography|images/header-biography.png',
	'Academics|images/header-academics.png',
	'Construction|images/header-construction.png',
	'The Money|images/header-money.png',
	'Contact Me|images/header-contact.png',
	'The Budget|images/header-budget.png',
	'The Schools Budget Priorities|images/header-budget-priorities.png',
	'The Jay Mathews Challenge Index|images/header-mathews-challenge.png',
	'Other School Capacity Needs|images/header-capacity-needs.png',
	'The 71 Acre Site|images/header-71-acre-site.png',	
	'Test Results|images/header-test-results.png'
);

/* old text replacement
	'Home|images/nav-home.png',
	'Biography|images/nav-bio.png',
	'Academics|images/nav-academics.png',
	'Construction|images/nav-construction.png',
	'The Money|images/nav-money.png',
	'Contact Me|images/nav-contact.png'
*/

  Rollimages = new Array();
	
  Rollimages[0]= new Image(185,36);
  Rollimages[0].src = "./images/nav-home.png";
  
  Rollimages[1]= new Image(185,36);
  Rollimages[1].src = "./images/nav-home-on.png";  

  Rollimages[2]= new Image(185,36);
  Rollimages[2].src = "./images/nav-bio.png";
  
  Rollimages[3]= new Image(185,36);
  Rollimages[3].src = "./images/nav-bio-on.png"; 
  
  Rollimages[4]= new Image(185,36);
  Rollimages[4].src = "./images/nav-academics.png";
  
  Rollimages[5]= new Image(185,36);
  Rollimages[5].src = "./images/nav-academics-on.png";  
  
  Rollimages[6]= new Image(185,36);
  Rollimages[6].src = "./images/nav-construction.png";
  
  Rollimages[7]= new Image(185,36);
  Rollimages[7].src = "./images/nav-construction-on.png";  

  Rollimages[8]= new Image(185,36);
  Rollimages[8].src = "./images/nav-money.png";
  
  Rollimages[9]= new Image(185,36);
  Rollimages[9].src = "./images/nav-money-on.png"; 
  
  Rollimages[10]= new Image(185,36);
  Rollimages[10].src = "./images/nav-contact.png";
  
  Rollimages[11]= new Image(185,36);
  Rollimages[11].src = "./images/nav-contact-on.png";     

function enableButtons()
{
	//get the navigation div
	var navigation = document.getElementById('navigation');

	//if it doesn't exist, then exit to avoid errors
	if (!navigation) { return; }

	//get images from the navigation area
	var imgs = navigation.getElementsByTagName("img");
	
	
	
	// loop through each image and assign the proper style
    for (var i = 0; i < imgs.length; i++) 
    {		
		if (imgs[i].src.indexOf(navpage) == -1)
		{
			imgs[i].onmouseover = highlight;	
			imgs[i].onmouseout = unhighlight;
		}
		else
		{
			var num = imgs[i].id;
			num = num.substring(3) * 1;
			imgs[i].src = Rollimages[num+1].src;
		}
	}
}

function highlight()
{
	var num = this.id;
	num = num.substring(3) * 1;
	this.src = Rollimages[num+1].src;	
}

function unhighlight(num)
{
	var num = this.id;
	num = num.substring(3) * 1;	
	this.src = Rollimages[num].src;
}

function firdom()
{
	if(document.getElementsByTagName && document.createElement)
	{
		for (l=1;l<=6;l++)
		{
			h1s=document.getElementsByTagName('h'+l);
			scanandreplace(h1s,'h'+l);
		}
	}
}

function scanandreplace(h1s,tag)
{
	for(i=0;i<h1s.length;i++)
	{
		for(f=0;f<replaceImages.length;f++)
		{
			chunks=replaceImages[f].split('|');
			thish1=document.getElementsByTagName(tag)[i];
			if(thish1.firstChild.nodeValue==chunks[0])
			{
				newImg=document.createElement('img');			
				newImg.setAttribute('alt',chunks[0])
				newImg.setAttribute('src',chunks[1])
				// or newImg.src=chunks[1];
				thish1.replaceChild(newImg,thish1.firstChild)
			}
		}
	}
}

function go()
{
	firdom();
	enableButtons();	
}

window.onload=go;
