function getFocus() { 
	if (document.forms[0] != null) { 
		for (i=0; i<document.forms[0].length; i++) { 
			if (document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "password") {
				document.forms[0].elements[i].focus(); 
				break; 
			} 
		} 
	} 
}

function popUpWin(myurl, width, height) {
	var wh = "width=" + width + ",height=" + height;
	var temp = window.open(myurl, "categoryWin", wh);
}

function checkPW(newpw, retypepw) {
	if (newpw != retypepw)
	{
		alert("The CONFIRM password does NOT match the NEW password.\nPlease try again.");
		return false;
	}
	return true;
}

function forgotPword() {
	var x = document.forms[0].adminUsername.value;
	if (x == '') {
		x = prompt("What is the admin username?", "");
	}
	if (x == null || x == '') {
		return false;
	}
	else {
		document.forms[0].adminUsername.value = x;
		return true;
	}
}

function checkTitle(x) {
	if (x == '') {
		alert("Please provide the Title of the Survey.");
		return false;
	}
	return true;
}

function move(myformlist,x) {
	var i = myformlist.selectedIndex;
	var delta = i + x;
	if (i!=-1 && (delta>=0 && delta<myformlist.length)) {
			temp1 = myformlist.options[delta].text;
			temp2 = myformlist.options[delta].value;
			myformlist.options[delta].text = myformlist.options[i].text;
			myformlist.options[delta].value = myformlist.options[i].value;
			myformlist.options[i].text = temp1;
			myformlist.options[i].value = temp2;
			myformlist.selectedIndex = delta;
	}
}

function createList(myform) {
	var list = "";
	for (i=0; i<myform.questions.length; i++) {
		list += myform.questions.options[i].value;
		if (i != myform.questions.length-1)
			list += ",";
	}
	myform.orderList.value = list;
}

