//
// Rollover Functions
// by Kimara Sajn
//
// (c) 2000 General Rubric
//

	var button_on, button_off, buttons_loaded;

	button_on = new Array();
	button_off = new Array();
	button_loaded = new Array();

	function loadButton(name,state,url) {
		var process = "";

		process = "button_loaded['"+name+"'] = false";
		eval(process);

		process = "button_"+state+"['"+name+"'] = new Image()";
		eval(process);

		process = "button_"+state+"['"+name+"'].src = '"+url+"'";
		eval(process);

		process = "button_loaded['"+name+"'] = true";
		eval(process);
	}

	function showLoadedButtons() {
		var i;
		var loaded = "";

		for (i in button_loaded) {
			if (button_loaded[i]) {
				loaded = loaded + i +"\n";
			}
		}

		alert(loaded);
	}

	function isNav() {
		return ((navigator.appName.indexOf("Netscape") != -1) && (parseInt(navigator.appVersion) >= 4) && (parseInt(navigator.appVersion) < 5));
	}

	function std_roll(btn1,state) {
		var i, j;
		if (isNav() && (document.layers.length != 0)) {

			for (i in document.layers) {
				for (j in document.layers[i].document) {
					if (j == btn1) {
					// only rollover if buttons are loaded and ready
						if (button_loaded[btn1]) {
							if (state == "on") {
								eval("document.layers[i].document."+btn1+".src = button_on[btn1].src");
							}
							if (state == "off") {
								eval("document.layers[i].document."+btn1+".src = button_off[btn1].src");
							}
						}
						else {
							// alert("Buttons are still loading ...");
						}

						break;
					}
				}
			}
		}
		else {
			if (document.images) {
			// only rollover if buttons are loaded and ready
				if (button_loaded[btn1]) {
					if (state == "on") {
						eval("document.images[btn1].src = button_on[btn1].src");
					}
					if (state == "off") {
						eval("document.images[btn1].src = button_off[btn1].src");
					}
				}
				else {
					// alert("Buttons are still loading ...");
				}
			}
		}
	}

	function fixed_roll(btn1,state,fixed_button) {
		var i, j;
		if (isNav() && (document.layers.length != 0)) {

			for (i in document.layers) {
				for (j in document.layers[i].document) {
					if (j == btn1) {
					// only rollover if buttons are loaded and ready
						if (button_loaded[btn1]) {
							if (state == "on") {
								eval("document.layers[i].document."+btn1+".src = button_on[btn1].src");
							}
							if (state == "off") {
								if (btn1 != fixed_button) {
									eval("document.layers[i].document."+btn1+".src = button_off[btn1].src");
								}
								else {
									eval("document.layers[i].document."+btn1+".src = button_on[btn1].src");
								}
							}
						}
						else {
							// alert("Buttons are still loading ...");
						}

						break;
					}
				}
			}
		}
		else {
			if (document.images) {
			// only rollover if buttons are loaded and ready
				if (button_loaded[btn1]) {
					if (state == "on") {
						eval("document.images[btn1].src = button_on[btn1].src");
					}
					if (state == "off") {
						if (btn1 != fixed_button) {
							eval("document.images[btn1].src = button_off[btn1].src");
						}
						else {
							eval("document.images[btn1].src = button_on[btn1].src");
						}
					}
				}
				else {
					// alert("Buttons are still loading ...");
				}
			}
		}
	}

	function swap_roll(btn1,btn2,state) {
		var i, j;
		if (isNav() && (document.layers.length != 0)) {

			for (i in document.layers) {
				for (j in document.layers[i].document) {
					if (j == btn1) {
					// only rollover if buttons are loaded and ready
						if (button_loaded[btn1] && button_loaded[btn2]) {
								eval("document.layers[i].document."+btn1+".src = button_"+state+"[btn2].src");
						}
						else {
							// alert("Buttons are still loading ...");
						}

						break;
					}
				}
			}
		}
		else {
			if (document.images) {
			// only rollover if buttons are loaded and ready
				if (button_loaded[btn1] && button_loaded[btn2]) {
						eval("document.images[btn1].src = button_"+state+"[btn2].src");
				}
				else {
					// alert("Buttons are still loading ...");
				}
			}
		}
	}

	function unfix(btn,active) {
		fixed_roll(btn,'off',active);
	}

// END OF ROLLOVER FUNCTIONS
