most affiliate links wouldn't allow you to change to format and some are pure javascript and are harder to change but basic links can be done alright.
what are you using? PHP, ASP, etc...
It can be done many ways so any particular reason you want this done?
BTW: Happy Christmas 2 u 2.