function showForm(linkID,formID,focusField,divHide1,divHide2) {
	var lid = document.getElementById(linkID);
	var fid = document.getElementById(formID);
	var ff = document.getElementById(focusField);
	if(divHide1){
		var d1 = document.getElementById(divHide1); 
	}
	if(divHide2) {
		var d2 = document.getElementById(divHide2);
	}
	
	if(lid.value == 'Edit'){
		lid.value = 'Cancel Edit';
		fid.style.display = 'inline';
		if(d1){ d1.style.display = 'none'; }
		if(d2){ d2.style.display = 'none'; }
		ff.focus();
	} else {
		lid.value = 'Edit';
		fid.style.display = 'none';
		if(d1){ d1.style.display = 'block'; }
		if(d2){ d2.style.display = 'block'; }			
	}
}

function addQs(linkIH,fieldName,focusField){
	var fn = document.getElementById(fieldName);
	var lih = document.getElementById(linkIH);
	if(focusField){
		var ff = document.getElementById(focusField);
	}
	
	if(fn.style.display == 'inline'){
		fn.style.display = 'none';
		lih.innerHTML = 'Add More Answers';
	} else {
		fn.style.display = 'inline';
		lih.innerHTML = 'Cancel Addition';
		if(ff){ff.focus();}
	}
}
	
function changeURL(url){  
	//alert(location.href);
	location.href = url;
}

function confirmDel(actType,url){
	switch (actType){
		case "test":
			if(confirm('Are you sure that you want to delete this test?')){
				if (confirm('Are you SURE that you want to DELETE this test?  Doing so will cause all of the questions and answers to be deleted as well!')){
					if (confirm('Are you POSITIVE you want to delete ALL QUESTIONS and ALL ANSWERS associated with this test?  Press \'OK\' one more time to process this deletion - this CANNOT be undone!')){
						changeURL(url);
						return false;
					}
				}
			}
			break;
		case "question":
			if(confirm('Are you sure that you want to delete this question?')){
				if (confirm('Are you SURE that you want to DELETE this question?  Doing so will cause all of the related answers to be deleted as well!')){
					if (confirm('Are you POSITIVE you want to delete THIS QUESTION and ALL ANSWERS associated with this question?  Press \'OK\' one more time to process this deletion - this CANNOT be undone!')){
						changeURL(url);
						return false;
					}
				}
			}
			break;
		case "answer":
			if(confirm('Are you sure that you want to delete this answer?')){
				if (confirm('Are you SURE that you want to DELETE this answer forever?')){
					if (confirm('Are you POSITIVE you want to delete THIS ANSWER?  Press \'OK\' one more time to process this deletion - this CANNOT be undone!')){
						//alert(document.href);
						changeURL(url);
						return false;
					}
				}
			}
			break;
		case "myShare":
			if(confirm('Are you sure you want to delete your access to this test?')){
				if (confirm('Warning: This will permanently remove your access to this test.  This action cannot be undone.\n\nTo confirm that you wish to delete your access to this test, press the \'OK\' button.\n\nTo cancel, press \'Cancel\'')){
					return true;
				} else {
					return false;
				}
			} else {
				return false;
			}
			break;
	}
	return true;
}

function loadShareLookup(){
	var ac1 = new AC('getUsers', 'getUsers');
	ac1.typing_timeout = 50;
	ac1.highlight = true;
	document.getElementById('getUsers').focus();
}

function fillTF() {
	document.getElementById('answer1').value = 'True';
	document.getElementById('answer2').value = 'False';
}

//test results toggle
function testResultsDispToggle(state,tid,li){
	if(state.innerHTML == 'Show Details'){
		document.getElementById('generalPerformance'+li).style.display = 'inline';
		document.getElementById('chartDiv'+li).style.display = 'inline';
		state.innerHTML = 'Hide Details';
		showChart('generalPerformance',tid,li);
	} else {
		document.getElementById('generalPerformance'+li).style.display = 'none';
		document.getElementById('chartDiv'+li).style.display = 'none';
		state.innerHTML = 'Show Details';
	}
}

