if(document.images) {
	// preload
	image1 = new Image();
	image1.src = "/images/nav-weddings-over.gif";
	image2 = new Image();
	image2.src = "/images/nav-engagements-over.gif";
	image3 = new Image();
	image3.src = "/images/nav-about-over.gif";
	image4 = new Image();
	image4.src = "/images/nav-blog-over.gif";
	image5 = new Image();
	image5.src = "/images/nav-contact-over.gif";
	image6 = new Image();
	image6.src = "/images/nav-raves-over.gif";
	image7 = new Image();
	image7.src = "/images/nav-portraits-over.gif";
	image8 = new Image();
	image8.src = "/images/nav-fashion-over.gif";
	image9 = new Image();
	image9.src = "/images/nav-associates-over.gif";
}
function nav(imgName, state) {
	document.images[imgName].src = "/images/nav-" + imgName + "-" + state + ".gif";
}
var siteWidth = 980;
function getWidth() {
	var n_win = window.innerWidth ? window.innerWidth : 0;
	var n_docel = document.documentElement ? document.documentElement.clientWidth : 0;
	var n_body = document.body ? document.body.clientWidth : 0;
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	var currentWidth = n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	if(currentWidth < siteWidth)
		return siteWidth;
	else
		return currentWidth;
}
var old_index = 0;
var old_state = "";
var timeout_id;
function clear_timeouts() {
	if(document.getElementById) {
		if(timeout_id != null)
			self.clearTimeout(timeout_id);
	}
}
function popupon(index, leftPx, state) {
	if(document.getElementById) {
		clear_timeouts();
		if(old_index != 0) {
			if(document.getElementById(old_index + "Sub"))
				document.getElementById(old_index + "Sub").style.display = "none";
			nav(old_index, old_state);
		}
		if(document.getElementById(index + "Sub")) {
			document.getElementById(index + "Sub").style.top = 57;
			document.getElementById(index + "Sub").style.left = ((getWidth() - siteWidth) / 2) + leftPx; 
			document.getElementById(index + "Sub").style.display = "inline";
		}
		nav(index, "over");
		old_index = index;
		old_state = state;
	}
}
function popupoff() {
	if(document.getElementById) {
		if(old_index != 0)
			timeout_id = setTimeout("if(document.getElementById(old_index + 'Sub'))document.getElementById(old_index + 'Sub').style.display = 'none';nav(old_index, old_state);", 100);
	}
}
