var basedirectory = '';
var rolloversDir = '/images/menu/';
var menuPreloadFlag = false;
var loadedImages = new Array();
var imageNames = new Array(
	'about',
	'cart',
	'collections',
	'contact',
	'events',
	'home',
	'shop'
);

function init()
{
	//	Load header images.
	var nextName;
	var nextIndex;
	for (nextIndex in imageNames)
	{
		nextName = imageNames[nextIndex];
		loadedImages[nextName] = new Array(new Image(), new Image());
		loadedImages[nextName][0].src = basedirectory + rolloversDir + nextName + '_off.jpg';
		loadedImages[nextName][1].src = basedirectory + rolloversDir + nextName + '_over.jpg';
	}
	menuPreloadFlag = true;
}

function swapImageOn(imageName)
{
	if (document.images && menuPreloadFlag)
		document.images[imageName + 'Image'].src = loadedImages[imageName][1].src;
}

function swapImageOff(imageName)
{
	if (document.images && menuPreloadFlag)
		document.images[imageName + 'Image'].src = loadedImages[imageName][0].src;
}

// POPUPS

var popup = null;
function getPopup(page) {
	if ('customer_service' == page) var newLocation = 'http://www.voudooproductions.com/customer_service.php';
	else if ('privacy' == page) var newLocation = 'http://www.voudooproductions.com/privacy.php';
	else return false;

	parameters = "width=460,height=460,top=12,left=12,scrollbars=auto,resizable=no";
	if (null == popup || popup.closed)
		popup = window.open(newLocation, "popup", parameters);
	else if (popup.location.pathname + popup.location.search == newLocation) popup.focus();
	else
	{
		popup.location = newLocation;
		popup.focus();
	}
	return false;
}

var sizeChartPopup = null;
function getSizeChart() {
	newLocation = basedirectory + "/size_chart.php";
	parameters = "width=600,height=320,top=12,left=12,scrollbars=no,resizable=no";
	if (null == sizeChartPopup || sizeChartPopup.closed)
		sizeChartPopup = window.open(newLocation, "sizeChartPopup", parameters);
	else if (sizeChartPopup.location.pathname + sizeChartPopup.location.search == newLocation) sizeChartPopup.focus();
	else
	{
		sizeChartPopup.location = newLocation;
		sizeChartPopup.focus();
	}
	return false;
}
