function is_blank(s) {
	return $.trim(s).length === 0;
}

function val_form() {
	// these fields must be non-blank (name must be lowercase)
	var common = ['dest_ip_addr', 'dest_port', 'constant_bit_rate'];
	var dvb_nit = ['nit_network_id', 'nit_network_name', 'rate', 'frequency', 'symbol_rate'];
	var el, i;
	for (i=0; i<common.length; i++) {
		el = document.getElementsByName(common[i])[0];
		if (is_blank(el.value)) {
			alert(' '+(el.name).toUpperCase()+' is Empty ');
			return false;
		}
	}
	if (document.getElementsByName("nitenable").checked) {
		for (i=0; i<dvb_nit.length; i++) {
			el = document.getElementsByName(dvb_nit[i])[0];
			if (is_blank(el.value)) {
				alert(' '+(el.name).toUpperCase()+' is Empty ');
				return false;
			}
		}
	}
	selectAllOptions(document.getElementById("assigned_programs"));
	document.applyform.submit();
	return true;
}