// JavaScript Document

function newWindow (doc) {
	var winHeight = 480;
	var winWidth = 640;
	var winTop = (screen.height - winHeight) / 2;
	var winLeft = (screen.width - winWidth) / 2;
	discWindow = window.open(doc, 'discWin','left='+winLeft+', top='+winTop+', width='+winWidth+',height='+winHeight+', scrollbars=yes, resizable=yes');
	discWindow.focus();
	}
	
function newBrowser(url) {
	newWind = window.open(url, 'extWind');
	newWind.focus();
	}
	
/* 
Function to open a pop-up window and pass it an image name variable for display,
including image/window width and height.
*/

var myImg; // image variable for pickup by pop-up window
function popPhotos(path, winWidth, winHeight) { // path means path to popPhoto.html
	var winTop = (screen.height - winHeight) / 2;
	var winLeft = (screen.width - winWidth) / 2;
	var myPath = path + 'popPhoto.html';
	photoWindow = window.open(myPath, 'discWin','left='+winLeft+', top='+winTop+', width='+winWidth+',height='+winHeight+', scrollbars=no, resizable=no');
	photoWindow.focus();
}

function launchPlayer() {
	var winHeight = 150;
	var winWidth = 409;
	var winTop = (screen.height - winHeight) / 2;
	var winLeft = (screen.width - winWidth) / 2;
	discWindow = window.open("/audio/player.html", 'discWin','left='+winLeft+', top='+winTop+', width='+winWidth+',height='+winHeight+', scrollbars=no, resizable=no');
	discWindow.focus();
}

/* 
JavaScript Clock Version 1.3
Written by Kevin Futter Feb 2004
Modified January 2005 to display date only
*/

function calcDate() {
	// initialise Date object variables
	var myCalendar = new Date();
	var myYear = myCalendar.getFullYear();
	var myMonth = myCalendar.getMonth();
	var myDate = myCalendar.getDate();
	var myDay = myCalendar.getDay();
	// convert returned day numbers to strings
	if (myDay == 0) {
		myDay = "Sunday";
	} else if (myDay == 1) {
		myDay = "Monday";
	} else if (myDay == 2) {
		myDay = "Tuesday";
	} else if (myDay == 3) {
		myDay = "Wednesday";
	} else if (myDay == 4) {
		myDay = "Thursday";
	} else if (myDay == 5) {
		myDay = "Friday";
	} else if (myDay == 6) {
		myDay = "Saturday";
	}
	// convert returned month numbers to strings
	if (myMonth == 0) {
		myMonth = "January";
	} else if (myMonth == 1) {
		myMonth = "February";
	} else if (myMonth == 2) {
		myMonth = "March";
	} else if (myMonth == 3) {
		myMonth = "April";
	} else if (myMonth == 4) {
		myMonth = "May";
	} else if (myMonth == 5) {
		myMonth = "June";
	} else if (myMonth == 6) {
		myMonth = "July";
	} else if (myMonth == 7) {
		myMonth = "August";
	} else if (myMonth == 8) {
		myMonth = "September";
	} else if (myMonth == 9) {
		myMonth = "October";
	} else if (myMonth == 10) {
		myMonth = "November";
	} else if (myMonth == 11) {
		myMonth = "December";
	}
	// initialise display variables and format
	var displayDate = (myDay + " " + myDate + " " + myMonth + " " + myYear);
	// write date to document
	document.getElementById('dateTime').innerHTML = displayDate;
}

/* Son of Suckerfish expanding menu script */

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/* function to place cursor focus in first field of login form */

function putCursor() {
	document.getElementById('username').focus();
}
