check = []; //this is an array that stores all the true/false values for each checkbox 

function checkBox(id) 
    { 

    if(check[id] != true) //if a value is not true, use this rather than == false, 'cos the first time no value will be set and it will be undefined, not true or false 
        { 
        document.getElementById('favoriteImage' + id).src = "images/quiz/checkbox-checked.gif"; //change the image 
        document.getElementById('favorite' + id).value = "YES"; //change the field value 
        check[id] = true; //change the value for this checkbox in the array 
        } 
    else 
        { 
        document.getElementById('favoriteImage' + id).src = "images/quiz/checkbox-UNchecked.gif"; 
        document.getElementById('favorite' + id).value = "NO"; 
        check[id] = false; 
        } 
    }

function ChangeRadioButton(buttonchecked)
	{
	if(buttonchecked == 0)
		{
		document.getElementById('RadioButtonYes').src = "images/quiz/checkbox-checked.gif"; 
		document.getElementById('RadioButtonNo').src = "images/quiz/checkbox-UNchecked.gif"; 
		document.getElementById('Send-me-an-application').value = "Yes"; 
		} 
	else 
		{ 
		document.getElementById('RadioButtonNo').src = "images/quiz/checkbox-checked.gif"; 
		document.getElementById('RadioButtonYes').src = "images/quiz/checkbox-UNchecked.gif"; 
		document.getElementById('Send-me-an-application').value = "No"; 
		}
	}

