﻿//preload the images
function BLDG_preLoader () {
	
	//scope in to this DOM
	var thisDoc = document;
	
	
	//check to see if the image SRC array has already been made
	//if not, make one
	if(!thisDoc.preLoadsrc) {
		 var preLoadsrc = new Array();
	}
	
	//which items are we preloading?
	preLoadsrc[0] = "images/nav/janiesjournal_on.gif";
	preLoadsrc[1] = "images/nav/janiesfixins_on.gif";
	preLoadsrc[3] = "images/nav/beerwineandhooch_on.gif";
	preLoadsrc[4] = "images/nav/theroutetojanies_on.gif";
	preLoadsrc[5] = "images/nav/cateringandgettogethers_on.gif";
	preLoadsrc[6] = "images/nav/givejanieaholler_on.gif";
	
	
	//check to see if the image OBJECT array has already been made
	//if not, make one and establish j as an iterator
	if(!thisDoc.preLoad) {
		 var preLoad = new Array();
		 var j = 0;
	}
	
	
	//loop through the array and make an image OBJECT and set the SRC for each
	for (i = 0; i < preLoadsrc.length; i++){
	   preLoad[j] = new Image();
	   preLoad[j].src = preLoadsrc[i];
	   j++;
	}

}


//image swapper
function switchMe(node, mode) {
	var node = document.getElementById(node);
	
	nodeString = node.id;
	match = "url(images/nav/" + nodeString + "_on.gif)";
	opposite = "url(images/nav/" + nodeString + "_off.gif)";
				
	//see if it's already on
	if (mode == "off") {
		node.style.backgroundImage = match;
	} else {
		node.style.backgroundImage = opposite;
	}
	
}
