// preload the images for navigation
var artistsOn = new Image();
  artistsOn.src = 'images/menu/artists_on.jpg';
var thematicOn = new Image();
  thematicOn.src = 'images/menu/thematic_on.jpg';
var fineartOn = new Image();
  fineartOn.src = 'images/menu/fineart_on.jpg';
var photographyOn = new Image();
  photographyOn.src = 'images/menu/photography_on.jpg';
var handcraftedOn = new Image();
  handcraftedOn.src = 'images/menu/handcrafted_on.jpg';
var jewelryOn = new Image();
  jewelryOn.src = 'images/menu/jewelry_on.jpg';
var historicalitemsOn = new Image();
  historicalitemsOn.src = 'images/menu/historicalitems_on.jpg';
var homedecorOn = new Image();
  homedecorOn.src = 'images/menu/homedecor_on.jpg';
var miscOn = new Image();
  miscOn.src = 'images/menu/misc_on.jpg';

var newsOn = new Image();
  newsOn.src = 'images/menu/news_on.jpg';
var aboutusOn = new Image();
  aboutusOn.src = 'images/menu/aboutus_on.jpg';
var homeOn = new Image();
  homeOn.src = 'images/menu/home_on.jpg';

var menuSubmitOn = new Image();
  menuSubmitOn.src = 'images/buttons/m_submit_on.jpg';

var dhtmlTop = new Image();
  dhtmlTop.src = 'images/menu/dhtml_1_top.png';
var dhtmlBottom = new Image();
  dhtmlBottom.src = 'images/menu/dhtml_1_bottom.png';
 var dhtmlTop2 = new Image();
  dhtmlTop2.src = 'images/menu/dhtml_2_top.png';
var dhtmlBottom2 = new Image();
  dhtmlBottom2.src = 'images/menu/dhtml_2_bottom.png';


function showDiv(divID) {
	if (document.getElementById) {
		// get a handle to the div
		var theDiv = document.getElementById(divID);
		if (theDiv && theDiv.style.display == "none") {
			// show it
			theDiv.style.display = "block";
		}
	}
}

function hideDiv(divID) {
	if (document.getElementById) {
		// get a handle to the div
		var theDiv = document.getElementById(divID);
		if (theDiv && theDiv.style.display == "block") {
			// hide it
			theDiv.style.display = "none";
		}
	}
}

function hideUpperLevelDivs() {
	var idList = new Array('artistList', 'themeList', 'fineartList', 'photographyList', 'handcraftedList', 'jewelryList', 'historicalitemsList', 'homedecorList', 'miscList');
	for (var i = 0; i < idList.length; i++) {
		hideDiv(idList[i]);
	}
}

function highlightParent(parentElementID) {
	if (document.getElementById) {
		var theParent = document.getElementById(parentElementID);
		if (theParent) {
			theParent.className='subnavpointHover'
		}
	}
}

function dehighlightParent(parentElementID) {
	if (document.getElementById) {
		var theParent = document.getElementById(parentElementID);
		if (theParent) {
			theParent.className='subnavpoint'
		}
	}		
}

function hideAllSubDivs(parentElementID) {
	if (document.getElementById) {
		var theParent = document.getElementById(parentElementID);
		if (theParent) {
			var childDivs = theParent.getElementsByTagName('div');
			if (childDivs) {
				for (var i = 0; i < childDivs.length; i++) {
					if (childDivs[i].className == "subThemeDiv") {
						childDivs[i].style.display = "none";
					}
				}
			}			
		}
	}
}

function popupMedia(image, imageTitle, width, height) {
	// see if the id is really an id, or if an image filename was passed in instead
	var mediaURL = "media_popup.php?image="+image+"&title="+imageTitle;
	// make sure the width is a decent size for us
	if (width < 400){
		width = 400;
	}
	var newWindow = open(mediaURL, "MediaPopup", "width="+width+",height="+height+",scrollbars=no,resizable=no,toolbar=no,menubar=no,titlebar=no,status=no,screenX=0,screenY=0");
}

function disableEnterKey(evt) {
    evt = (evt) ? evt : ((window.event) ? window.event : "")
    if (evt) {
        // process event here
        return !( evt.keyCode==13 || evt.which==13 );
    }
}