var randomId;

function menuOn(menuCell, colourSpec)
{
	menuCell.style.background = colourSpec;
}

function menuOff(menuCell, colourSpec)
{
	menuCell.style.background = colourSpec;
}

function jumpToCourse(selectList)
{
	var pageName = selectList.options[selectList.selectedIndex].value;
	window.location='courses/' + pageName;
}

function jumpToCourse2(selectList)
{
	var pageName = selectList.options[selectList.selectedIndex].value;
	window.location=pageName;
}

function popWindow(url,w,h)
{
	var imageWin = window.open(url,"photo","width=" + w + ",height=" + h + ",scrollbars,resizable");
	imageWin.moveTo(screen.width/2 - w/2, screen.height/2 - h/2);
	imageWin.focus();
}

function showCourseImage(url)
{
	var w, h;
	w = 1080;
	h = 570;
	
	var imageWin = window.open("images/" + url,"photo","width=" + w + ",height=" + h + ",scrollbars,resizable");
	imageWin.moveTo(screen.width/2 - w/2, screen.height/2 - h/2);
	imageWin.focus();
}

function showImage(inThumb)
{
	var inImage = new String(inThumb);
	var index;
	var w, h;
	w = 1080;
	h = 570;
	
	index = inImage.slice(inImage.indexOf("_") + 1, inImage.lastIndexOf("."));
	
	//window.alert(inThumb + " : " + index + ".jpg");
	//window.alert(inImage.indexOf("_") + " | " + inImage.lastIndexOf("."));
	
	var imageWin = window.open("images/homePageImages/" + index + ".jpg","ss","width=" + w + ",height=" + h + ",scrollbars,resizable");
	imageWin.moveTo(screen.width/2 - w/2, screen.height/2 - h/2);
	imageWin.focus();
}

function showCourseImage(inThumb)
{
	var inImage = new String(inThumb);
	var index;
	var w, h;
	w = 1080;
	h = 570;
	
	index = inImage.slice(inImage.indexOf("_") + 1, inImage.lastIndexOf("."));
	
	//window.alert(inThumb + " : " + index + ".jpg");
	//window.alert(inImage.indexOf("_") + " | " + inImage.lastIndexOf("."));
	
	var imageWin = window.open("images/" + index + ".jpg","ss","width=" + w + ",height=" + h + ",scrollbars,resizable");
	imageWin.moveTo(screen.width/2 - w/2, screen.height/2 - h/2);
	imageWin.focus();
}

function getRandomNumber(inMin, inMax)
{
	return inMin + Math.floor(Math.random() * (inMax - inMin + 1));
}

function getRandomPhoto(inMin, inMax)
{
	randomId = getRandomNumber(inMin, inMax);
	return "thm_" + randomId + ".jpg";
}

function getBackground()
{
	return "bg_" + screen.width + "x" + screen.height + ".jpg";
}

function alertBrowser()
{
	uagent = window.navigator.userAgent.toLowerCase();
	IE=(uagent.indexOf('msie') != -1)?true:false;
	
	if (!IE)
	{
		window.alert('This site has been optimised for Internet Explorer 5 or later.\nSome features may be unavailable to other browsers.');
	}
}