
/* --------------------------------------------------- */
/* PRELOAD IMAGES */
/* --------------------------------------------------- */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


/* --------------------------------------------------- */
/* POP-UP WINDOW */
/* --------------------------------------------------- */
function openwin(URL,theHeight,theWidth,addScroll) {
	var nXpos = (screen.availWidth - theWidth) / 2; 
	var nYpos = (screen.availHeight - theHeight) / 2; 
	var win = window.open(URL, 'popupWin', 'top=' + nYpos + ',left=' + nXpos + ',screenY=' + nYpos + ',screenX=' + nXpos + ',height=' + theHeight + ',width=' + theWidth + 'toolbar=0,scrollbars=' + addScroll + ',location=0,statusbar=0,menubar=0');
	win.focus();
}



/* --------------------------------------------------- */
/* SELECT COUNTRY FROM STATE */
/* --------------------------------------------------- */
function selectCountry(theState) {
	var selectVars = theState.value.split("+");
	var theRegion = selectVars[1];
	if (theRegion !== 0) {
		if (theRegion == 1) {
			document.forms.contact.country.value = 'United States';
			document.forms.contact.province.value = '';
		} else if (theRegion == 2) {
			document.forms.contact.country.value = 'Canada';
			document.forms.contact.province.value = '';
		} else if (theRegion == 3) {
			document.forms.contact.country.value = 'United States';
			document.forms.contact.province.value = '';
		}
	}
}



/* --------------------------------------------------- */
/* SELECT COUNTRY FROM STATE */
/* --------------------------------------------------- */
function provinceActive() {
	document.forms.contact.state.value = '0';
	document.forms.contact.country.value = '0';
}


/* --------------------------------------------------- */
/* CLEAR DEFAULT IN KEYWORDS */
/* --------------------------------------------------- */
function clearField() {
	var toClear = document.forms.searchForm.keywords;
	if (toClear.value == 'Search Our Site') {
		toClear.value = '';
	}
}


/* --------------------------------------------------- */
/* TOGGLE LAYER */
/* --------------------------------------------------- */
function toggleLayer(whichLayer)
{
	if (document.getElementById)
		{var style2 = document.getElementById(whichLayer).style;}
	else if (document.all)
		{var style2 = document.all[whichLayer].style;}
	else if (document.layers)
		{var style2 = document.layers[whichLayer].style;}
	if (style2.display == "none") {
		style2.display = "block";
		style2.visibility = "visible";
	}
	else {
		style2.display = "none";
		style2.visibility = "hidden";
	}
}


/* --------------------------------------------------- */
/* DROP DOWN MENUS */
/* --------------------------------------------------- */
function showMenu(divId) {
	var subMenu = document.getElementById(divId);
	
	subMenu.style.visibility = 'visible';
}

function hideMenu(divId) {
	var subMenu = document.getElementById(divId);
	
	subMenu.style.visibility = 'hidden';
}
