	
// Utility di controllo validazione campi per Form generici
// Le funzioni e le classi devono essere ridotte al limite essenziale.


	CControllaCampi = new Class({
                _idObj:null,
                initialize: function(idObj){
                        // -----------------------------------
                        // Ricevo l' ID del Form corrente
                        // -----------------------------------

                        if (idObj != null)
                                this._idObj = idObj;
                },
                trim: function(stringa){
                        stringa = stringa.replace(/^\s+/, "");
                        stringa = stringa.replace(/\s+$/, "");
                        return stringa;
                },
                ControlloNullo: function(objField){
                        if (objField != null){
                                // se il campo effettivamente esiste
                                // tolgo tutti gli spazi e controllo
                                // che ci sia almeno un dato.

                                // Controllo che sia un campo di tipo testo
                                if ((objField.type == "text") || (objField.type == "password")){
                                        var stringa = this.trim(objField.value);
                                        //alert("--->" + stringa + "<---");

                                        if (stringa != ""){
                                                return true;
                                        }

                                }

                                return false;
                        }
                },
                dotCheckField: function(objField){
                        // Controllo che il campo di tipo 'text'
                        // sia un dominio un sito FTP o qualunque altro dato che deve contenere di punti
                        // al suo interno.
                        if (objField != null){
                                // se il campo effettivamente esiste
                                // tolgo tutti gli spazi e controllo
                                // che ci sia almeno un dato.

                                // Controllo che sia un campo di tipo testo
                                if (objField.type == "text"){
                                        var stringa = this.trim(objField.value);
                                        //alert("--->" + stringa + "<---");

                                        var reg = new RegExp(".");

                                        //alert(stringa);
                                        if (stringa.match(/\./)){
                                                return true;
                                        }
                                }

                                return false;
                        }

                },
		checkValidEmail: function(objField){
                        // Controllo che il campo di tipo 'text'
                        // sia un dominio un sito FTP o qualunque altro dato che deve contenere di punti
                        // al suo interno.
                        if (objField != null){
                                // se il campo effettivamente esiste
                                // tolgo tutti gli spazi e controllo
                                // che ci sia almeno un dato.

                                // Controllo che sia un campo di tipo testo
                                if (objField.type == "text"){
                                        var stringa = this.trim(objField.value);
                                        //alert("--->" + stringa + "<---");

                                        //alert(stringa);
                                        if (stringa.match(/^(.*){1,64}\@(.*){1,64}\.[a-z1-9]{1,64}$/)){
                                                return true;
                                        }
                                }

                                return false;
                        }

                }
	
        });

