function switch_value(ctrl) {
	if (ctrl.checked) {
	  ctrl.value = "1";
	} else {
		ctrl.value = "0";
	}
}
function checkFields(frm)
{
    var bRetVal=true;
    var sErrMessage;
    var i=0;
    //----------------------------------
    // For input fields on the form.
    ///----------------------------------
    
    while (i<frm.elements.length && bRetVal==true)
    {
        var ctl = frm.elements[i];
        //-----------------------------------------------------
        // Check if a default value is specified.
        // If the user did not enter a value, assign the default.
        //-----------------------------------------------------
        if(null!=ctl.getAttribute("_default"))     {
            if(ctl.value==null || ctl.value=="")
                ctl.value=ctl.getAttribute("_default");
        }
            
        //-----------------------------------------------------
        // Check if a value is required for the control.
        // Report an error and exit if no value is entered
        // by the user.
        //-----------------------------------------------------
        if(null!=ctl.getAttribute("_required")) {
            if(ctl.value==null || ctl.value=="")    {
                if (null!=ctl.getAttribute("_descr")) {
                	sDescr = ctl.getAttribute("_descr")
                } else {
	                sDescr = ctl.name
                }
                sErrMessage = "Veld: " + sDescr + " is een verplicht veld.";
                bRetVal=false;
                break;
            }
        }

        
    i++;
    }//end while
    
    //--------------------------------------------------------------
    // Report the error message if the input is invalid and cancel
    // the submitting.
    //--------------------------------------------------------------
    if (bRetVal==false)    {
        alert(sErrMessage);
        if (ctl!=null) {
            ctl.focus();
        }
    }
    return bRetVal;
} 