function encodemail(utente, dominio) {
	window.location.href = 'mailto:' + utente + '@' + dominio;
}

function valid_email(text) {
        // The Field Shouldn't be Empty
        if (text == "") {
                // Please Enter Your Email Address To Check
                return false
        }

        // Check For Bad Chars
        badchar = " ()<>\/[]{}*|;,'"
        for (i=0;i<text.length;i++) {
                for (j=0;j<badchar.length;j++) {
                        if (text.charAt(i) == badchar.charAt(j)) {
                                // Your Email Address May Has Some Bad Character or there is some space between letters
                                return false
                        }                        
                }
        }

        // There Should Be a dot (.) Symbol
        if (text.indexOf(".") == -1) {
                // Your Email Address Doesnot have any dot(.) symbol
                return false
        }

        // There Should Be an @ Symbol
        if (text.indexOf("@") == -1) {
                // Your Email Address Doesnot have any @ symbol
                return false
        } else {

        // Only one @ symbol should be found
                symbolfound = 0
                for (i=0;i<text.length;i++) {
                        if (text.charAt(i) == "@") {
                                symbolfound++
                        }
                        else {
                                continue
                        }
                }
                if (symbolfound != 1) {
                        // Ooops  Your Email Address Has More Than One @ Symbol
                        return false
                }
        }

        // Check For Syntax Errors Such as .@  or   @.  or  ..
        if (text.indexOf("@.") != -1 || text.indexOf(".@") != -1 || text.indexOf("..") != -1) {
                // Sorry Your Email Address has two symbol side by side and it is wrong
                return false
        }

        // The first character shouldn't be @ or .
        if (text.charAt(0) == "@" || text.charAt(0) == ".") {
                // OH your first character seem to be . or @ and it is wrong
                return false
        }

        // The last character shouldn't be @ or .
        if (text.charAt(text.length-1) == "@" || text.charAt(text.length-1) == ".") {
                // OH your last character seem to be . or @ and it is wrong
                return false
        }

        // Valid Email Address
        return true
}

