Need help with this one-liner

Hey guys,

I’m working closely with our resident intern web developer and he’s supplying code for field validation within flash 8. After commenting out a few lines, i’ve determined that the following line is causing the script to blow up :

 
var remainder = String(str).substr(iLen, iLen – lastIndexOfDot);

Looking in the Flash 8 help files, I found that the original ‘substring’ has been deprecated as of Flash 5 so I plugged in the now commonly-used ‘substr’. When I run a syntax check on the code I get 14 actionscript errors with the first error being 'expecting a ( or a , ’ on the line which the snippet above is located. Here’s the whole function i’m using for clarity sake :

 
function validateEmail( str, f) : Boolean
{
indexOfAt = str.indexOf("@");
lastIndexOfDot = str.lastIndexOf(".");
var iLen = String(str).length;
var remainder = String(str).substr(iLen, iLen – lastIndexOfDot);
 if (indexOfAt !=-1 && lastIndexOfDot !=-1){
  if (lastIndexOfDot <indexOfAt) {
   trace(f + " email is invalid");
   return false;
  }
  else if String(remainder).length < 2 {
   trace(f + " email is invalid");
   return false;
  }
  else {
   trace(f + " email seems okay");
      return true;
  }
 }
 else {
  trace(f + " email is invalid");
  return false;
 }
}

Not the most bullet-proof email validation, but it will serve our needs well enough for what it’s being used for. Any idea why Flash 8 isn’t liking this small block of code?