function writeYear(id)
{
	var elem = document.getElementById(id);
	if (elem != null)
	{
		elem.innerHTML = new Date().getFullYear();
	}
}

function openWindow( url, winWidth, winHeight ) 
{
	try
	{
		var left = ( ( screen.width - winWidth ) / 2 );
		var top = ( ( screen.height - winHeight ) / 2 );
		var theWin = window.open( url, 'results', 'toolbar=no,locationbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + winWidth + ',height=' + winHeight + ',left=' + left + ',top=' + top );
		theWin.focus();
	}
	catch ( ex )
	{
		debug( "exception thrown : " + ex.message );
	}
}

function URLDecode(psEncodeString)
{
  var lsRegExp = /\+/g;
  return unescape(String(psEncodeString).replace(lsRegExp, " "));
}

function preload(name)
{
	var path = 'images/header/';
	var img = new Image(); img.src = path + name + '.png';
	img = new Image(); img.src = path + name + '_on.png';
	img = new Image(); img.src = path + name + '_over.png';
	
	var elem = document.getElementById(name);
	if (elem == null)
	{
		return;
	}
	
	elem.src = path + name + '.png';
	
	if (window.location.href.indexOf(name) > 0)
	{
		elem.src = path + name + '_on.png';
	}

	elem.onmouseover = function()
	{
		if (elem.src.indexOf('_on') == -1)
		{
			elem.src = path + name + '_over.png';
			elem.style.cursor = 'pointer';
		}
	};
	elem.onmouseout = function()
	{
		if (elem.src.indexOf('_on') == -1)
		{
			elem.src = path + name + '.png';
		}
	};
	elem.onclick = function()
	{
		if (elem.src.indexOf('_on') == -1)
		{
			//elem.src = path + name + '_on.png';
			window.location = name + '.html';
		}
	}
}	

window.onload = function()
{
	preload('index');
	preload('map');
	preload('list');
	preload('crewers');
	writeYear('year');
	
	if (onloadCallback && typeof onloadCallback == 'function') 
		onloadCallback();
};

