<!--

function toggleShow(toggleThis) {
	var el = document.getElementById(toggleThis);
	//var ig = document.getElementById("viewhide")
	
	
		
		/*if ( el.style.display != 'none' ) {
			el.style.display = 'none';
			//ig.src = 'images/viewans.gif';
		}
		else {*/
			el.style.display = 'inline';
			//ig.src = 'images/hideans.gif';
		//}
	
	
}

function checkSelected(){ 
	var formObj = document.chapSelect
	var count = 0;
	for (i=0;i<formObj.length; i++){
		if(formObj[i].checked && formObj[i].name != "showMastered")
		count++;		
	}

	if (count < 1){
		alert ("Please select from the Chapter or Sections list.");
		return false
	}
	else{
		clearCookie();
		return true;
		}
}

function clearCookie(){
	var date = new Date();
	date.setTime(date.getTime()+(-1*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	document.cookie = 'STEMNUMBERS=""'+expires+'; path="/"';
	document.cookie = 'TOTALSELECTED=""'+expires+'; path="/"';
}

function submitForm(navDirection){
	
	if (navDirection == "next"){
		document.enterAnswer.qs.value = Math.floor(document.enterAnswer.qs.value)+1;
	}
	if (navDirection == "back"){
		document.enterAnswer.qs.value = Math.floor(document.enterAnswer.qs.value)-1;
	}
	document.enterAnswer.submit();
}

function checkAll(elementID, element){
	var el = document.chapSelect
	var count = 0;
	for (i=0;i<el.length; i++){
		if (el[i].id == elementID){
		if (el[i].disabled == false){
				if (element.checked == true)
					el[i].checked = true;
				else
					el[i].checked = false;
		}
		}
	}
	
}

function incMastered(mChapters){
	if (mChapters != null){
		
		//el are the elements from the chapter select form
		var el = document.chapSelect;
		
		//mChapters is a list of Mastered Chapters
		aChapters = mChapters.split(",");
		
		//if the showMastered checkbox is being unchecked
		//disable and uncheck the chapters that have been mastered (unless they are section checkboxes)
		if (el.showMastered.checked == false){
			for (i=0;i<aChapters.length; i++){
				for (e=0;e<el.length;e++){
					if (el[e].value == aChapters[i] && el[e].name != "sec"){
							el[e].disabled = true;
							el[e].checked = false;
					}
				}
			}
		}
		//If we are selecting to showMastered questions
		//Go through and enable the checkboxes (unless they are section checkboxes)
		else{
			for (i=0;i<el.length; i++){
				if (el[i].disabled == true && el[i].name != "sec")
						el[i].disabled = false;		
			}
		}
	}
}


function disableBox(elementID){
	el = document.getElementById(elementID);
	el.disabled = true;
}

function textCounter(field) {
	var maxlimit = 1800;
	if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

-->
