/* 	File: dhtml_mouseover_v2.js
 *	Include: <script language="JavaScript" src="scripts/dhtml_mouseover_v2.js"></script>	
 */

var mo_api = true

//uncommment this and paste this into your page - fixes yet another bug in Netscrap.
//if (typeof mo_api == "undefined") window.location.reload();

//Global Variables.
var mo_isNS4 = (document.layers) ? true : false;
var mo_overSufx;
var mo_downSufx;
var mo_highSufx;
var mo_currHigh = false;

// Set to true to allow multiple highlighed buttons
var mo_multiHigh = false;

function setSuffix(OVER,DOWN,HIGH) {
	mo_overSufx = OVER;
	if (DOWN) mo_downSufx = DOWN;
	if (HIGH) mo_highSufx = HIGH;
}
// Use this in your script it you use a different suffix in the following order: OVER,DOWN,HIGH
setSuffix("_over","_down","_high");

// Object constructor -- use "none" for layer or the layer ID, DOWN and HIGH are optional
// mouseOverObj(WINDOW[obj],ID[str],SRC[str],DOWN[bol],HIGH[bol],LAYER[str])
function mouseOverObj(WINDOW,ID,SRC,DOWN,HIGH,LAYER) {
	this.window = WINDOW
	this.id = ID;	
	var srcBase = SRC.substring(0,SRC.lastIndexOf("."));
	var ext = SRC.substring(SRC.lastIndexOf("."));
	
	this.defaultImg = new Image();
	this.defaultImg.src = srcBase + ext;
	
	this.overImg =  new Image();
	this.overImg.src = srcBase + mo_overSufx + ext;
	
	if (DOWN) {
		this.downImg =  new Image();
		this.downImg.src = srcBase + mo_downSufx + ext;
	}
	
	if (HIGH) {
		this.highImg =  new Image();
		this.highImg.src = srcBase + mo_highSufx + ext;
	}
	
	this.layer = (LAYER) ? LAYER : false;
	this.loaded = false;
	
}

mouseOverObj.prototype.init =  function() {
	this.loaded = true;
	this.imgId = (this.layer && mo_isNS4) ? this.window.document.layers[this.layer].document[this.id] : this.window.document[this.id];
}

mouseOverObj.prototype.out =  function() {
	if (!this.loaded) this.init(); 
	this.imgId.src = this.defaultImg.src;
}

mouseOverObj.prototype.over =  function() {
	if (!this.loaded) this.init(); 
	this.imgId.src = this.overImg.src;
}

mouseOverObj.prototype.down =  function() {
	if (!this.loaded) this.init(); 
	this.imgId.src = this.downImg.src;
}

mouseOverObj.prototype.high =  function() {
	if (!this.loaded) this.init(); 
	var temp = new Image();
	temp.src = this.defaultImg.src;
	if (this.highImg) {
		this.defaultImg.src = this.highImg.src;
		this.highImg.src = temp.src;
		
		if (mo_currHigh) {
		temp.src = mo_currHigh.defaultImg.src;
		mo_currHigh.defaultImg.src = mo_currHigh.highImg.src;
		mo_currHigh.highImg.src = temp.src;
		mo_currHigh.out();
		}
	}
	else {
		this.defaultImg.src = this.overImg.src;
		this.overImg.src = temp.src;
		
		if (!(mo_multiHigh) && mo_currHigh) {
		temp.src = mo_currHigh.defaultImg.src;
		mo_currHigh.defaultImg.src = mo_currHigh.overImg.src;
		mo_currHigh.overImg.src = temp.src;
		mo_currHigh.out();
		}
	}
	this.imgId.src = this.defaultImg.src;
	mo_currHigh = this;
}