// JavaScript Document

var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();
var imgs = new Array();
var subheads = new Array();
window.onload = init;
function init()
{
	if (!W3CDOM) return;

	imgs[0]= document.getElementById("ProductsTab");
	imgs[1]= document.getElementById("HistoryTab");
	imgs[2]= document.getElementById("TestimonialsTab");
	imgs[3]= document.getElementById("RitualsTab");
	imgs[4]= document.getElementById("MediaCoverageTab");
	imgs[5]= document.getElementById("OurRecipeTab");


	subheads[0] = document.getElementById("ProductsSubHead");
	subheads[1] = document.getElementById("HistorySubHead");
	subheads[2] = document.getElementById("TestimonialsSubHead");
	subheads[3] = document.getElementById("RitualsSubHead");
	subheads[4] = document.getElementById("MediaCoverageSubHead");
	subheads[5] = document.getElementById("OurMediaSubHead");

for (var i=0;i<imgs.length;i++)
	{
		if (i==1)
		{
		imgs[i].onmouseout = mouseGoesOut;
		subheads[i].onmouseout = mouseGoesOut2;
			
		}
		else
		{
		imgs[i].onmouseover = mouseGoesOver;
		imgs[i].onmouseout = mouseGoesOut;
		subheads[i].onmouseover = mouseGoesOver2;
		subheads[i].onmouseout = mouseGoesOut2;
		}
		var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
		mouseOuts[i] = new Image();
		mouseOuts[i].src = imgs[i].src;
		mouseOvers[i] = new Image();
		mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "-Black" + suffix;
		imgs[i].number = i;
		subheads[i].number = i;
	}
}

function mouseGoesOver()
{
	this.src = mouseOvers[this.number].src;
	subheads[this.number].style.color = "white";
}

function mouseGoesOut()
{
	this.src = mouseOuts[this.number].src;
	subheads[this.number].style.color = "black";
	if (this.number == 1)
		delayhidemenu();
}
//menu 1 is defined in drop-down-menu.js
function mouseGoesOver2()
{	

	imgs[this.number].src = mouseOvers[this.number].src;
	subheads[this.number].style.color = "white";
}

function mouseGoesOut2()
{
	imgs[this.number].src = mouseOuts[this.number].src;
	subheads[this.number].style.color = "black";
	if (this.number == 1)
		delayhidemenu();
}

function mouseGoesOverE(event)
{
	imgs[1].src = mouseOvers[1].src;
	subheads[1].style.color = "white";
	dropdownmenu(subheads[1], event, menu1, '');
}

function mouseGoesOver2E(event)
{	

	imgs[1].src = mouseOvers[1].src;
	subheads[1].style.color = "white";
	dropdownmenu(subheads[1], event, menu1, '');
}

