These variables are getting declared in the global scope, which is bad. There's two options here:

1) Move getAttribute down to where it's being used on line 4 and 7
2) Wrap this whole function, minus _gaq, in a closure

Either works!