// JavaScript Document
function checkfield(theForm){ 
	standardMsg = "Veuillez cocher au moins une des rubriques:\nSujets, Personnes, Lieu!";
	standardMsg2 = "Veuillez indiquer au moins un terme de recherche!";

	if(theForm.index.value.length == 0){
		alert(standardMsg2);
		theForm.index.focus();
		return false;
	}
	//checking for checkBoxes	
	checkBoxArray = new Array('ins','inp','inl');
	for(x = 0; x < checkBoxArray.length; x++){
		if(theForm.elements[checkBoxArray[x]].checked == true){
			return true;
		}
	}
	alert(standardMsg);
	return false;
} // end checkfield()

function uncheck(theForm){
	//checks rubAll if nothing else or all the other checkboxes are checked
	//OR unchecks rubAll when other checkBox is checked
	oneChecked = false;
	allChecked = true;
	
	for(x = 0; x < checkBoxArray.length; x++){
		if(theForm.elements[checkBoxArray[x]].checked == true){
			oneChecked = true;
		}else if(theForm.elements[checkBoxArray[x]].checked == false){
			allChecked = false;
		}
	}
	
	if(allChecked == true){
		for(x = 0; x < checkBoxArray.length; x++){
			theForm.elements[checkBoxArray[x]].checked = false;
		}
		theForm.rubAll.checked = true;
	}else if(theForm.rubAll.checked == true && oneChecked == true){
		theForm.rubAll.checked = false;
	}else if(theForm.rubAll.checked == false && oneChecked == false){
		theForm.rubAll.checked = true;
	}
}

function check(theForm){
	if(theForm.rubAll.checked == true){
		for(x = 0; x < checkBoxArray.length; x++){
			theForm.elements[checkBoxArray[x]].checked = false;
		}
	}
}
	
