// JavaScript Document
function openInfoWindow(url) 
	{popupWin = window.open(url, 'info',
	'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=no, resizable=yes, dependent, width=780, height=580')
}

function openAssessmentWindow(url) 
	{popupWin = window.open(url, 'assessment',
	'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, dependent, width=780, height=580')
}

function openCourseWindow(url) 
	{popupWin = window.open(url, 'course',
	'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, dependent, width=780, height=580')
}

function closeAssessmentWindow(window) {
  opener.location.href = opener.location.href;
  window.close();
}

function checkAll(form, checkBox, matchID) { 
	var check = checkBox.checked; 
	var elements = document.forms[form] ? document.forms[form].elements : document.getElementById(form).elements; 
	var regex = new RegExp(matchID); 
	for( var i = 0; i < elements.length; i++ ) { 
		if( !regex.test(elements[i].alt)) { 
			continue; 
		} 
		if( elements[i].type != 'checkbox' ) { 
			continue; 
		} 
		if( check ) { 
			elements[i].checked = true; 
		} else { 
			elements[i].checked = false; 
		} 
	}
} 

function confirmCancel(url) {
  if(confirm('Are you sure that you wish to cancel?  You will lose any changes made.')) {
    document.location.href = url;
  }
}

function confirmDelete(name, url) {
	if(confirm('Are you sure you want to delete "' + name + '"?')) {
		document.location.href = url;
	}
}