var validationFuncs = {
    checkBox: function(elm) {
        if (jQuery("input[@type=checkbox]:checked").length>0){
            return true;
        } else{
            return false;
        }
    },
	
    checkBoxValidation: function(elm) {
        if (jQuery("input[name='"+elm.name+"']:checked").length>0){
            return true;
        } else{
            return false;
        }
    },

    checkSchool: function(elm) {
        if (elm.value == ""){
            if (jQuery("#school_custom").val() != ""){
                return true;
            }else{
                return false;
            }

        }else{
            return true;
        }
    }
}

function getFunc(func, elm) {
    if(func=='checkBox') {
        return validationFuncs.checkBox(elm);

    }else if(func=='checkBoxValidation'){
        var checkboxes = jQuery("input[name='"+elm.name+"']");
        var checkboxesLength = jQuery("input[name='"+elm.name+"']").length - 1;

        //validate only last checkbox, because validation validates all of them together
        if (checkboxes[checkboxesLength].id == elm.id){
            return validationFuncs.checkBoxValidation(elm);
        }else{
            return true;
        }
	
    }else if(func=='noValidation'){
        return true;

    }else if(func=='checkSchool'){
        return validationFuncs.checkSchool(elm);
                
    }else if(func=='checkRadioValidation'){
        return jQuery("input[name='"+elm.name+"']:checked").length>0;
    }
}
