//
// popup a new window with the given URL
//
function popUp(tempURL) {
	newwindow = window.open(tempURL, '_blank');
	if (window.focus) { 
		newwindow.focus(); 
	}
	return false;
}

//
// given a date, return the day of the week
//
function getDayOfWeek(adate) {
	var weekday = [ "Sunday", "Monday", "Tuesday" , "Wednesday", "Thursday", "Friday", "Saturday" ];
	return weekday[adate.getDay()];
}

//
// Determine if a date has passed or not.
//
function isDatePassed(iMonth, iDay, iYear) {
	var iDate = iYear*10000 + (iMonth-1)*100 + iDay;
	var dtToday = new Date();
	var iToday = dtToday.getFullYear()*10000 + dtToday.getMonth()*100 + dtToday.getDate();

	if (iDate < iToday) {
		return true;
	} else {
		return false;
	}
}

//
// Pop up a screen of a particular height and width
//
function popUpSized(sURL, iHeight, iWidth) {
	var iTop = (screen.height - iHeight) / 2;
	var iLeft = (screen.width - iWidth) / 2;
	var sOptions = "height=" + iHeight.toString();
	sOptions += ",width=" + iWidth.toString();
	sOptions += ",top=" + iTop.toString() + ",left=" + iLeft.toString() +",scrollbars=yes";

	newwindow = window.open(sURL, '_blank', sOptions);
	if (window.focus) { 
		newwindow.focus(); 
	}
	return false;
}

