Move the weblink initialization stuff back to the top to make it global (so it can be used in function declrations too and not just at run-time). This is cleaner than the javascript window. syntax I originally used