Cleaned up a bit of code to avoid unnecessary string manipulation. jQuery to the rescue!