function makeUnFocused(element, img) {
	// pass a pointer to the checkbox and the name of the image
	// if the checkbox is selected, the image will be changed to on_not_focused.
	// if the checkbox is not selected, the image will be changed to off_not_focused.
	if (document.getElementById) {
		if (element.checked)
			document.getElementById(img).src = "images/button_on_focus_no.gif";
		else document.getElementById(img).src = "images/button_off_focus_no.gif";
	}
}
function unFocusAllImages() {
	makeUnFocused(document.forms.questions.A,"imgA");
	makeUnFocused(document.forms.questions.B,"imgB");
	makeUnFocused(document.forms.questions.C,"imgC");
	makeUnFocused(document.forms.questions.D,"imgD");
	makeUnFocused(document.forms.questions.E,"imgE");
	makeUnFocused(document.forms.questions.F,"imgF");
	makeUnFocused(document.forms.questions.G,"imgG");
	makeUnFocused(document.forms.questions.H,"imgH");
	makeUnFocused(document.forms.questions.I,"imgI");
}
function syncCheckboxToImg(element,img,clearOthers) {
	// Call this onclick from the image
	// This sets the image to the correct state and will make the checkboxes the same as the images
	// First set all the images to not focused. 
	unFocusAllImages();
	// It does not matter whether we are selecting or unselecting, the image will need focus
	// Even though we are setting the checkboxes to be the same as the images,
	// we need to examine the checkboxes to know if we are selecting or deslecting the image.
	// get a handle on the image
	if (document.getElementById) {
		//var imgId = document.getElementById(img);
		if (element.checked) {
			// set the image to not checked but focused
			document.getElementById(img).src = "images/button_off_focus_yes.gif";
			element.checked = false;
			// Throws error in ie5
			//element.focus = true;
		}
		else {
			//set the image to checked and focused
			document.getElementById(img).src = "images/button_on_focus_yes.gif";
			element.checked = true;
			// Throws error in ie5
			//element.focus = true;
		}
	}
	if (clearOthers)
		clearToNone();
	else clearNone();
}
function syncImgToCheckbox(element,img,clearOthers) {
	// Call this onfocus and onclick from the input checkbox
	// This will make the images the same as the checkboxes
	unFocusAllImages();
	if (document.getElementById) {
		// get a handle on the image
		//var imgId = document.getElementById(img);
		// find the state of the checkbox
		if (element.focus) {
			if (element.checked)
				document.getElementById(img).src = "images/button_on_focus_yes.gif";
			else 
				document.getElementById(img).src = "images/button_off_focus_yes.gif";
		}
		else { // unchecked
			if (element.checked)
				document.getElementById(img).src = "images/button_on_focus_no.gif";
			else document.getElementById(img).src = "images/button_off_focus_no.gif";
		}
	}
	if (clearOthers && element.checked) {
		clearToNone();
	}
	else if (!clearOthers) {
		if (element.checked)
			clearNone();
	}
}
