function control(myform) {
	var frmvalidator  = new Validator(myform);
	frmvalidator.clearAllValidations();
	
	if(myform=='anag_user') {
		frmvalidator.addValidation("name","req","Name required");
		frmvalidator.addValidation("usr","req","User required");
	}
	
	if(myform=='anag_group') {
		frmvalidator.addValidation("name","req","Name required");
		frmvalidator.addValidation("email","req","E-mail required");
	}

	if(myform=='anag_customer') {
		frmvalidator.addValidation("name","req","Name required");
	}

	if(myform=='anag_area') {
		frmvalidator.addValidation("idgroup","dontselect=0","Group required");
		frmvalidator.addValidation("idcustomer","dontselect=0","Customer required");
		frmvalidator.addValidation("name","req","Name required");
	}
	
	if(myform=='anag_machine') {
		frmvalidator.addValidation("idgroup","dontselect=0","Group required");
		frmvalidator.addValidation("idcustomer","dontselect=0","Customer required");
		frmvalidator.addValidation("idarea","dontselect=0","Area required");
		frmvalidator.addValidation("name","req","Name required");
	}
	
	if(myform=='anag_channel') {
		frmvalidator.addValidation("idgroup","dontselect=0","Group required");
		frmvalidator.addValidation("idcustomer","dontselect=0","Customer required");
		frmvalidator.addValidation("idarea","dontselect=0","Area required");
		frmvalidator.addValidation("idmachine","dontselect=0","Machine required");
		frmvalidator.addValidation("name","req","Name required");
		frmvalidator.addValidation("prefix","req","Prefix required");
	}

	if(myform=='anag_timechannel') {
		frmvalidator.addValidation("starttime","req","Start time required");
		frmvalidator.addValidation("endtime","req","End time required");
		frmvalidator.addValidation("starttime","regexp=[0-9]{2}:[0-9]{2}:[0-9]{2}","Format time HH:MM:SS");
		frmvalidator.addValidation("endtime","regexp=[0-9]{2}:[0-9]{2}:[0-9]{2}","Format time HH:MM:SS");
		if($('#endtime').val()<$('#starttime').val()) {
			$('#endtime').val('');
		}
		if($('#starttime').val()=='00:00:00' && $('#endtime').val()=='00:00:00') $('#endtime').val('');
		if($('#starttime').val()>'24:00:00') $('#starttime').val('');
		if($('#endtime').val()>'24:00:00') $('#endtime').val('');
	}

	if(document.getElementById(myform).onsubmit()) document.getElementById(myform).submit();
}
