// FUNCTIONS FOR CHECKBOX AND RADIO BUTTON RESPONSES IN THE INTERVIEW		
		// make sure a radio button is checked 
	function checked(sCheckCondition) {
		
		bChecked = false;
		aElements = document.forms[0].elements
		for (i=0; i<aElements.length; i++){
			
			if(aElements[i].checked){
				bChecked = true;
				return(true);
			}
		}
			
			if(sCheckCondition == "submit") {
				alert("Please make a selection to continue"); 
			}
			return(false);
	}
	
	
	function selectControl(sControlType, nChoice, nControls) {
		
		if(sControlType == "radio"){
			for (i=1; i< nControls +1; i++){
				sID = "choice" + i;
				oImg = document.getElementById(sID);
				oImg.src = "../img/interview/radio-up.gif";
			}
		}
		
		sSelected = "choice" + nChoice;
		
		
		if(sControlType == "radio"){
			document.forms['pageForm'].elements['choice'].value = nChoice;
		document.getElementById(sSelected).src = "../img/interview/" + sControlType + "-down.gif";
		}
		
		// if it's a checkbox
		else {
			bCheckedState = document.getElementById(sSelected).src.indexOf("up") > -1;
			//alert(bCheckedState)
			if(bCheckedState){
				return(setCheckBox("down", nChoice))
				}
			else {
				return(setCheckBox("up", nChoice))
			}
		}
		
	}
	
	var aChecked = new Array()

	function setCheckBox(sUpDown, nChoice){
		document.getElementById(sSelected).src = "../img/interview/checkbox-" + sUpDown + ".gif"
		
		if(sUpDown == "down") {
		aChecked.push(nChoice);
		document.forms['pageForm'].elements['choice'].value = aChecked; 
		}
		else {
		nIndex = getPos(aChecked, nChoice);
		aChecked = deleteElement(aChecked, nChoice);
		//alert(aChecked);
		document.forms['pageForm'].elements['choice'].value = aChecked;
		}
	}
	
	
	function getPos(aArray, oElement){
		for (i=0; i< aArray.length; i++) {
			if(aArray[i]== oElement){
				return(i);
			}
		}
	}
	
	function deleteElement(aArray, oElement){
		aTemp = new Array();
		for (i in aArray){
			if(aArray[i] != oElement) {
				aTemp[aTemp.length] = aArray[i];
			}
		}
		return(aTemp);
	}
	
	function checkSelected(sCheckCondition) {
		
		bChecked = document.forms['pageForm'].elements['choice'].value != "";
		
		if(bChecked == true) {
			return(bChecked);
		}
	
			if(sCheckCondition == "submit") {
				alert("\n\tPlease make a selection to continue\t\t\n\n"); 
			}
			return(false);
	}
	

// ETC.

	
function delayAndGo(sLocation, nSeconds){
	window.setTimeout("location = '" + sLocation + "'", nSeconds)
}