

self.onerror = null;


var GG_debug;
function d(V,Clear) {
	if (!GG_debug) {
		var GG_debug_win = window.open('', 'GG_debug_win', 'height=300,width=300,resizable,scrollbars');
		with (GG_debug_win.document) {
			open();
			write('<html><body bgcolor="#ffffff"><form name="debug"><textarea name="out" rows="20" cols="80">Debug output:\n</textarea></form></body></html>');
			close();
		}
		GG_debug = GG_debug_win.document.debug.out;
	}
	if (GG_debug) {
		if (Clear) GG_debug.value = "";
		GG_debug.value += V + "\n";
	}
	else addToOnLoad('alert("'+V+'");');
}



var NN4 = (document.layers)         ? true : false;
var IE4 = (document.all)            ? true : false;
var DOM = (document.getElementById) ? true : false;




function addToOnLoad(Code) {
	var PrevLoad = (self.onload) ? self.onload.toString() : "{}";
	if (Code.charAt(Code.length -1) != ";") Code += ";";
	self.onload = new Function(
		PrevLoad.substring(PrevLoad.indexOf('{') +1, PrevLoad.lastIndexOf('}')) + 
		Code
	);
}



var PageLoaded = false;
addToOnLoad("PageLoaded = true;");










function GG_rollPrep() {
	for (var xx=0; xx<document.images.length; xx++) {
		var I = document.images[xx];
		if (I.src.indexOf('_off') +1 && !I.on) {
			I.off = new Image();
			I.on	= new Image();
			I.off.src = I.src;
			I.state   = false;
			I.on.src	 = I.src.substring(0, I.src.indexOf('_off')) + "_on" + I.src.substring(I.src.indexOf('_off') +4);
		}
		if (I.state) {
			I.src   = I.off.src;
			I.state = false;
		}
	}
}


function GG_roll(Nm) {
	var I = document.images[Nm];
	if (I && I.on) {
		I.src   = (I.state) ? I.off.src : I.on.src;
		I.state = !I.state;
	}
}


/* Make some sort of Navigator DOM updater
|* that will merge layer.document.image arrays
|* with the main document.images array (push()?)
|*/


addToOnLoad("GG_rollPrep();");






// add stickiness to the navbar image indicating where we are
function GG_stickyNav(Nm) {
	var I = document.images[Nm];
	if (I && I.on) {
		I.off = I.on;
		I.src = I.on.src;
	}
}






