// Sort Query Results on Admin Pages
function SortAll(mySort) {
	var formFlag = 0;
	
	if (document.all) {
		myForm = document.forms['ViewAllForm'];
		formFlag = 1;
	} else if (document.getElementById) {
		myForm = document.forms['ViewAllForm'];
		formFlag = 1;
	} else if (document.layers) {
		myForm = document.layers['body1'].document.forms['ViewAllForm'];
		formFlag = 1;
	}
	
	if (formFlag == 1) {
		myForm.sort.value = mySort;
		myForm.submit();
	}
}

//Delete Learning Material from System
function DeleteMaterial()
{
	var answer = confirm("This will remove this item from the Learning Materials of your system.\n  This material may be assigned to multiple classes in the system.\n Removing it will remove it from all classes it is assigned to.\n                            Are you sure you want to proceed?");
	if(answer)
		return true;
	else
		return false;
}

// Logout the user when they close the browser
function Logout()
	{ window.open('logout.cfm', '', 'width=10, height=10, menubar=0,scrollbars=0,status=0,toolbar=0'); }
	

function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}	


function LoginFormCheck()
{
	myForm = document.forms['login'];

	if (myForm.username.value == "") {
		alert("Please enter a username.");
		myForm.username.focus();
		return false;
	}

	if (myForm.password.value == "") {
		alert("Please enter a password.");
		myForm.password.focus();
		return false;
	} else {
		//alert("Submit");
		myForm.submit();
	}
}	


function goToURL() { //v3.0
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}