
//alert('mouseover.js loaded');

var main = top;
var loaded = false;
var p_whoswho="";

//***Start Define Selector() and methods

function _add_image(imgname) {
	if (typeof(imgname) == "undefined") return;
	this[imgname] = new Object();
	this[imgname].on = new Image();
	this[imgname].off = new Image();
	this[imgname].over = new Image();
	this[imgname].status = "";
	
	this.names[this.names.length] = imgname; //reverse index
	this[imgname].rIdx = this.names.length;
}

function _reset_images() {
	for (var i=0;i<this.names.length;i++) {
		document.images[this.names[i]].src = this[this.names[i]].off.src
	}	
}

function imgObj(im)
{
	if (document.layers)
		return document.layers['body'].document.images[im]
	return eval("document."+im);
}

function _image_over(imgname) {
	if (typeof(imgname) == "undefined") return;
	if (imgname == this.selected) return;
	if (typeof(imgObj(imgname)) == "undefined") {
		alert("1 no img defined with this name:" + imgname)
	} else {
		imgObj(imgname).src = this[imgname].over.src
	}
}

function _image_out(imgname) {
	if (typeof(imgname) == "undefined") return;
	if (imgname == this.selected) return;
	if (typeof(imgObj(imgname)) == "undefined") {
		alert("2 no img defined with this name:" + imgname)
	} else {
		imgObj(imgname).src = this[imgname].off.src
	}
}

function _image_select(imgname) {
	if (typeof(imgname) == "undefined") return;
	if (imgname == this.selected) return;
	if (typeof(document.images[imgname]) == "undefined") {
		alert("no img defined with this name:" + imgname)
	} else {
		if (this.selected != "") document.images[this.selected].src = this[this.selected].off.src
		document.images[imgname].src = this[imgname].on.src
	}
	this.selected = imgname;
	this.selectedIdx = this[imgname].rIdx;
}


function Selector() {
	this.names = new Array();
	this.status="";
	this.selected = "";
	this.selectedIdx = -1;
}
new Selector();
Selector.prototype.AddImage = _add_image;
Selector.prototype.ResetImages = _reset_images;
Selector.prototype.ImageOut = _image_out;
Selector.prototype.ImageOver = _image_over;
Selector.prototype.ImageSelect = _image_select;
//***End Define Selector() and methods


var navs = new Selector();
with (navs) {

	AddImage("directors");
	directors.on.src="icns/directors_on.gif";
	directors.off.src="icns/directors_off.gif";
	directors.over.src="icns/directors_on.gif";
	directors.status="directors";

	AddImage("about");
	about.on.src="icns/about_on.gif";
	about.off.src="icns/about_off.gif";
	about.over.src="icns/about_on.gif";
	about.status="about";

	AddImage("showreel");
	showreel.on.src="icns/showreel_on.gif";
	showreel.off.src="icns/showreel_off.gif";
	showreel.over.src="icns/showreel_on.gif";
	showreel.status="showreel";

	AddImage("contact");
	contact.on.src="icns/contacts_on.gif";
	contact.off.src="icns/contacts_off.gif";
	contact.over.src="icns/contacts_on.gif";
	contact.status="contacts";
 
	AddImage("news");
	news.on.src="icns/news_on.gif";
	news.off.src="icns/news_off.gif";
	news.over.src="icns/news_on.gif";
	news.status="news";

	AddImage("home");
	home.on.src="icns/home_on.gif";
	home.off.src="icns/home_off.gif";
	home.over.src="icns/home_on.gif";
	home.status="home";

	AddImage("services");
	services.on.src="icns/services_on.gif";
	services.off.src="icns/services_off.gif";
	services.over.src="icns/services_on.gif";
	services.status="services";


}

function loadMain(page,imgname) {
	navs.ImageSelect(imgname);
	if (loaded==true) main.document.location.href=page;
}


var tempNav = null;
var tempSrc = null;

function keepOn(nav)
{
	if (tempNav != nav)
	{
		var swapper = eval("navs." + nav + ".off.src")
		eval ("navs." + nav + ".off.src = navs." + nav + ".on.src")
		if (tempNav != null)
		{
			eval ("navs." + tempNav + ".off.src = '" + tempSrc + "'")
			eval ("navs.ImageOut('" + tempNav + "')")
		}
		tempNav = nav
		tempSrc = swapper
	}
}
