var preloadFlag = false;

//function preloadImages() {
//if (document.images) {


img1 = new Image();
img1.src = "/images/nav-news-01.gif";

img2 = new Image();
img2.src = "/images/nav-retailersupport-01.gif";

img3 = new Image();
img3.src = "/images/nav-events-01.gif";

img4 = new Image();
img4.src = "/images/nav-productportfolio-01.gif";

img5 = new Image();
img5.src = "/images/nav-partnerprogram-01.gif";


preloadFlag = true;

//	}
//}

//for the live site

function swap(whichImage, whichFile, whichDiv) {
	if(preloadFlag) {
	if (document.images) {
		if( document[whichDiv] )
			document[whichDiv].document[whichImage].src = "/retail/images/" + whichFile;
		else
			document.getElementById(whichImage).src = "/retail/images/" + whichFile;
	}
}}

var imagePath = "/retail/images/";

//for the local
/*
function swap(whichImage, whichFile, whichDiv) {
	if(preloadFlag) {
	if (document.images) {
		if( document[whichDiv] )
			document[whichDiv].document[whichImage].src = "/images/" + whichFile;
		else
			document.getElementById(whichImage).src = "/images/" + whichFile;
	}
}}
var imagePath = "/images/";
*/


// -- Main nav -- //
//for the live

//for the local


sfHover = function() {
	if( document.getElementById("mainNav") ) {
		var sfEls = document.getElementById("mainNav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
				if (this.id)
					navHold(this.id + '_imgID', this.id + '-01.gif');
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				if (this.id)
					navHold(this.id + '_imgID', this.id + '-00.gif');
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function navHold(objId, replacementSource){
	var objImg = document.getElementById(objId);
	objImg.src = imagePath + replacementSource;
}




//-- pest menu --//
sfHover = function() {
	if( document.getElementById("pest_menu") ) {
		var sfEls = document.getElementById("pest_menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}


if (window.attachEvent) window.attachEvent("onload", sfHover);


//-- product title menu --//

sfHover = function() {
	if( document.getElementById("title_menu") ) {
		var sfEls = document.getElementById("title_menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}


if (window.attachEvent) window.attachEvent("onload", sfHover);




// -- accordian menu --//
	function displayBlock(id, state){
		if (state == 'view'){
			document.getElementById(id + "_content").style.display = "block";
			document.getElementById(id + "_button").innerHTML = '<a href="javascript:displayBlock(\'' + id + '\', \'close\')" class="close">close</a>';
		} else {
			document.getElementById(id + "_content").style.display = "none";			document.getElementById(id + "_button").innerHTML = '<a href="javascript:displayBlock(\'' + id + '\', \'view\')" class="view">view</a>';
		}
	}
