// Show / hide synopsis

function toggleMe(a){
	var e=document.getElementById(a);

	if(!e)return true;

	if(e.style.display=="none"){
		e.style.display="block"
	} else {
		e.style.display="none"
	}

	return true;
}


//Fuction to clear the radio groups individually 
function clearButtons(buttonGroup1, buttonGroup2){

	for (i=0; i < buttonGroup1.length; i++) {
		if (buttonGroup1[i].checked == true) {
			buttonGroup1[i].checked = false
		}
	}

	for (i=0; i < buttonGroup2.length; i++) {
		if (buttonGroup2[i].checked == true) {
			buttonGroup2[i].checked = false
		}
	}

}


function clearButton(buttonGroup1){
	for (i=0; i < buttonGroup1.length; i++) {
		if (buttonGroup1[i].checked == true) {
			buttonGroup1[i].checked = false
		}
	}
}


//Form validation function to insure the user selects 2 x 1 hr sessions or a single 2hr session
//Also must enter a Name, email and Department!
//This is pretty crud but should do the trick!

function valbutton(thisform) {

	w1value = -1;	//2hours
	w2value = -1;	//1st lot of 1 hour
	w3value = -1;	//2nd lot of 1 hour
	w4value = -1;	//1 hour PM
	w5value = 1;	//last 1 in PM

	for (i=thisform.Two_Hour_Workshop_Choice.length-1; i > -1; i--) {
		if (thisform.Two_Hour_Workshop_Choice[i].checked) {
			w1value = i;
		}
	}

	for (a=thisform.Hour_Workshop_Choice_One.length-1; a > -1; a--) {
		if (thisform.Hour_Workshop_Choice_One[a].checked) {
			w2value = a;
		}
	}

	for (c=thisform.Hour_Workshop_Choice_Two.length-1; c > -1; c--) {
		if (thisform.Hour_Workshop_Choice_Two[c].checked) {
			w3value = c;
		}
	}

	for (d=thisform.Hour_Workshop_Choice_Three_pm.length-1; d > -1; d--) {
		if (thisform.Hour_Workshop_Choice_Three_pm[d].checked) {
			w4value = d;
		}
	}

	if ((w1value != -1) && (w2value == -1) && (w3value == -1) && (w4value != -1) && (w5value != -1) && thisform.Name.value != "" && thisform.Email.value != "" && thisform.Department.value != "") {
		thisform.submit();
		return true;
	} 
	
	if ((w1value == -1) && (w2value != -1) && (w3value != -1) && (w4value != -1) && (w5value != -1) && thisform.Name.value != "" && thisform.Email.value != "" && thisform.Department.value != ""){
		thisform.submit();
		return true;
	} 
	alert("Please check your submission \n-----------------------------------\n\n- You must choose two 1 hour workshops or a single 2 hour. \n\nMake sure you have included: \n- Your name \n- Department \n- Contact Email");
	return false;
}
