// JavaScript Document

function processme(id) {
    // modify the form formaccueil and set action to univers.php
    myform = document.formaccueil;
    myform.action = "univers.php";
    myform.id_menu.value = id;
    myform.submit();
    
}

function processdevis(id, targetElemName) {
    // modify the form formaccueil
    myform = document.formaccueil;
    myform.elements['activite'].value = id;
}

function checknull(idstring) {
    //alert('str.length');
    //convert the string into an array
    str = idstring.split(",")
    var flag = 0;
    for (i = 0; i< str.length; i++) {
	if (!document.getElementById(str[i]).value.length) {
	    flag = 1;
	    document.getElementById(str[i]).className='preFielderror';
	}
    }
    if (flag == '1')
	return false
    else if (!validateform())
	return false
    else 
	return true;
}

function check_checkbox(name_of_checkbox) {
    // check if the check box in the file annulaire_rub.php is checked
    mycheckbox = document.getElementsByName(name_of_checkbox)
    len = document.getElementsByName(name_of_checkbox).length;
    counter = 0;
    for (i = 0; i<len; ++i) {
	if (mycheckbox[i].checked == true)
	    ++counter;
    }
    if (counter == 0) {
	alert("Choisissez au moins un rubrique.");
	return false
    } else {
	document.formaccueil.submit();
	return true;
    }
}
