+2  A: 

Maybe try putting your regex in a separate variable, like so:

  //...
  var re = /^\d{5}$/; // using Pointy's comment, which I think is well-advised

  if (re.test(orgnValue)) { // This is the problem area
    orgn.removeClass("invalid");  // The above line is '/\d{4}/g' for prog.
  } else {
    orgn.addClass("invalid");
  }
  //...
Robusto
Thanks Robusto and Pointy! It indeed was the /g flag and everything works as expected. The functions are a little cleaner too.
Joshua
A: 

This is a known problem with some browsers when using a regexp object, cause by the lastIndex property. You can easily reproduce it by:

var r = /\d{5}/g;

alert(r.test('12345')); //true
alert(r.test('12346')); //false

On you case, the regex is cached and you see the same effect. A simple solution is to reset the regexp lastIndex: r.lastIndex = 0, or, as suggested, to use a regex where this isn't an issue.

Kobi
.... or just leave off the "g" flag, which doesn't help anything here anyway.
Pointy