var image_path = new String(location.href.substr(0,location.href.lastIndexOf('/')+1) + "Images/");

function NavButton_Select()
{
	this.up = false;
	frames[this.frame].document[this.button_name].src = this.dn_image.src;
}

function NavButton_DeSelect()
{
	this.up = true;
	frames[this.frame].document[this.button_name].src = this.up_image.src;
}

function NavButton_MouseOver()
{
	if (this.up)
	{
		frames[this.frame].document[this.button_name].src = this.ov_image.src;
	}
}

function NavButton_MouseOut()
{
	if (this.up)
	{
		frames[this.frame].document[this.button_name].src = this.up_image.src;
	}
	else
	{
		frames[this.frame].document[this.button_name].src = this.dn_image.src;
	}
}

function NavButton_GetName()
{
	return this.button_name;
}

function NavButton(frm, btn_name, up_img, dn_img, ov_img)
{
	this.frame = frm;
	this.button_name = btn_name;
	this.up = true;
	this.up_image = new Image();
	this.up_image.src = image_path + up_img;
	this.dn_image = new Image();
	this.dn_image.src = image_path + dn_img;
	this.ov_image = new Image();
	this.ov_image.src = image_path + ov_img;
	this.select = NavButton_Select;
	this.deselect = NavButton_DeSelect;
	this.mouseover = NavButton_MouseOver;
	this.mouseout = NavButton_MouseOut;
	this.getname = NavButton_GetName;
}

function NavGroup_AddButton(frm, btn, up_img, dn_img, ov_img)
{
	if (this.no_of_nav_buttons < this.max_no_of_btns)
	{
		this.nav_buttons[this.no_of_nav_buttons] = new NavButton(frm, btn, up_img, dn_img, ov_img);
		this.no_of_nav_buttons++;
	}
	else
	{
		alert ("Too many navigation groups");
	}
}

function NavGroup_ButtonClick(img)
{
	var i;
	for (i = 0; i < this.no_of_nav_buttons; i++)
	{
		if (this.nav_buttons[i].getname() == img)
		{
			this.nav_buttons[i].select();
		}
		else
		{
			this.nav_buttons[i].deselect();
		}
	}
}

function NavGroup_MouseOver(img)
{
	var i;
	for (i = 0; i < this.no_of_nav_buttons; i++)
		if (this.nav_buttons[i].getname() == img)
		{
			this.nav_buttons[i].mouseover();
			break;
		}
}

function NavGroup_MouseOut(img)
{
	var i;
	for (i = 0; i < this.no_of_nav_buttons; i++)
		if (this.nav_buttons[i].getname() == img)
		{
			this.nav_buttons[i].mouseout();
			break;
		}
}

function NavGroup(no_of_btns)
{
	this.max_no_of_btns = no_of_btns;
	this.no_of_nav_buttons = new Number(0);
	this.nav_buttons = new Array(no_of_btns);
	this.add_button = NavGroup_AddButton;
	this.button_click = NavGroup_ButtonClick;
	this.mouseover = NavGroup_MouseOver;
	this.mouseout = NavGroup_MouseOut;
}

