//--- Image Mouseover ----------------------------------

var base= "/img/global/";
var outArr = new Array();
var overArr = new Array();
var stuff = new Array('home','background','currentrelease','buy','whentodrink','tastings','newsletters','gallery','contact');

// preload
if (document.images) {
	for (i=0; i < stuff.length; i++) {
		outArr[i] = new Image;
		outArr[i].src = base + stuff[i] + "_off.png"
		overArr[i] = new Image;
		overArr[i].src = base + stuff[i] + "_on.png";
	}
}

function over(n) {
		document.images[stuff[n]].src = overArr[n].src;
}

function out(n) {
	if (((location.pathname.indexOf(stuff[n]) == -1) && (n != 0)) || ((n == 0) && (location.pathname != "/")))
		document.images[stuff[n]].src = outArr[n].src;
}

function startupCheck() {
	for (x = 0; x < 9; x++) {
		if (location.pathname.indexOf(stuff[x]) == 1) {
			document.images[stuff[x]].src = overArr[x].src;
		}
		else if (location.pathname == "/") {
			document.images['home'].src = overArr[0].src;
		}
	}
}

//--- Popup windows ----------------------------------

function popup(url,name,w,h) {  // status bar, scroll bars, not resizable
	var winW = (screen.width - w) / 2;
	var winH = (screen.height - h) / 2;
	var win1 = window.open(url,name,'width='+w+',height='+h+',top='+winH+',left='+winW+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
	win1.focus();
}

window.onload = startupCheck;