function is_email(str) {
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported)
   {
  if (!((str.indexOf(".") > 2) && (str.indexOf("@") > 0)))
     {
       alert ("Por favor, introduzca un email correcto");
       return false;
     }
    }
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  if (!(!r1.test(str) && r2.test(str)))
    {
    alert ("Por favor, introduzca un email correcto");
    return false;
    }
}