I think an easier way to do this would be to set all of the links to the same color. Then use Javascript and cookies to change the links that the user clicked on to a different color and have all of those links stored in a cookie that expires after the browser session, or a few minutes. Then everytime a user accesses the site, have Javascript check for that cookie, and if it's there, have it change the link(s) color. Agreed?
I'm not proficient in Javascript, so I can't help you write it unless you have a very specific question.