This is an update, since Gaby was able to help me with my issue. This now works
DEMO TIME! http://media.apus.edu/it/ref/page1.htm
In a nutshell - this code will send the referring URL from page 1 to page 3 dynamically when you click the link. Why is this important?
We're not able to place analytical code (google analytics) on page 3 since it is a third party website. We should now be able to track leads from page 1, which is also a third party website, when they click to page 2 (our website that has google analytics) and then click a link to page 3 (third party site that can't by customized) as this site uses its own analytic code to track campaigns.
Page 1: Click link and it will take you to page 2.
Page 2: Page 2 knows you came from page 1 and will pass the referring URL from page 1 to page 3 when you click it. Also, the link is assigned a class that will call the function, because we are not able to assign an onclick to links in our CMS. Also, Gaby helped resolve the issue of having me use the same ID more than once and now I only need to use a class assigned to the link. No more ID is needed... Thank you! This will enable me to assign any link on the page to pass the referring URL if it's assigned the css class.
I'm sure someone out there will benefit from this code... please pass it along!
PS. I'm aware this code won't work if page 1 comes from a secure site.
Evan