function openPopup(URL, ww, hh, winName, sBars) {
	var xcoord, ycoord, popWidth, popHeight;
	
	if(ww != null) {
		popWidth = ww;
	}
	else {
		popWidth = 450;
	}
	
	if(hh != null) {
		popHeight = hh;
	}
	else {
		popHeight = 550;
	}
	
	if(winName == null) {
		winName = "popupWindow"
	}
	
	if(sBars == null) {
		sBars = "yes"
	}
	
	if(document.all || document.layers) {
		xcoord = Math.round((screen.availWidth - popWidth) / 2);
		ycoord = Math.round((screen.availHeight - popHeight) / 2);
	}
	
    myPopup = window.open(URL, winName, 'width=' + popWidth + ',height=' + popHeight + ',left=' + xcoord + ',top=' + ycoord + ',directories=no,menubar=no,status=no,resizable=1,scrollbars=' + sBars);
    if (!myPopup.opener) {
         myPopup.opener = self;
	}
	
	myPopup.focus();
}

function overMenuItem(element) {
	element.className = "menuItemOver"
}

function outMenuItem(element) {
	element.className = "menuItem"
}

function overButton(element) {
	element.className = "actionButtonOver"
}

function outButton(element) {
	element.className = "actionButton"
}

function inTextBox(element) {
	element.className = "inTextBox"
}

function outTextBox(element) {
	element.className = "outTextBox"
}

function inTextAreaBox(element) {
	element.className = "inTextAreaBox"
}

function outTextAreaBox(element) {
	element.className = "outTextAreaBox"
}


function verifyEmailAdress(addr)
{
	var atPos;
	if (addr.length != 0)
	{
		atPos = addr.indexOf("@");
		if ((atPos == -1) ||
		    (addr.indexOf(" ") != -1) ||
			(addr.indexOf("/") != -1) ||
			(addr.indexOf(";") != -1) ||
			(addr.indexOf(":") != -1) ||
			(addr.indexOf(",") != -1) ||
			(addr.indexOf("<") != -1) ||
			(addr.indexOf(">") != -1) )
		{
			return false;
		}
		else
		{
			if ((addr.indexOf("@", atPos+1) != -1) || (addr.indexOf(".",atPos) == atPos+1) || (addr.indexOf(".",atPos) == -1))
			{
				return false
			}
		}
	}
	else
	{
		return false;
	}
	
	return true;
}


var daysInMonth = new Array(12);
daysInMonth[1] = 31;
daysInMonth[2] = 29;   // must programmatically check this
daysInMonth[3] = 31;
daysInMonth[4] = 30;
daysInMonth[5] = 31;
daysInMonth[6] = 30;
daysInMonth[7] = 31;
daysInMonth[8] = 31;
daysInMonth[9] = 30;
daysInMonth[10] = 31;
daysInMonth[11] = 30;
daysInMonth[12] = 31;

function daysInFebruary (year)
{   // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
}

function isValidDate (tempDate)
{   
		var month, day, year;
		var intMonth, intDay, intYear;
		
		month = tempDate.substr(0,tempDate.indexOf("/"));
		day = tempDate.substr(tempDate.indexOf("/")+1,tempDate.lastIndexOf("/")-tempDate.indexOf("/")-1);
		year = tempDate.substr(tempDate.lastIndexOf("/")+1,tempDate.length-tempDate.lastIndexOf("/"));
		
		var intYear = parseInt(year);
    // catch invalid years (not 2- or 4-digit) and invalid months and days.
		if (((year.length != 2) && (year.length != 4)) || (intYear < 1))
		{
			return false;
		}
		
    var intMonth = parseInt(month);
		if ((intMonth < 1) || (intMonth > 12))
		{
			return false;
		}
		
		var intDay = parseInt(day);
    // catch invalid days, except for February
    if (intDay > daysInMonth[intMonth]) return false; 
    if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;

    return true;
}