thanks Jason, I'll look at that tomorrow.
One final question with respect to this.
my add to cart button now has 2 functions, on click it fires the javascript to set the session value, then posts the form.
it works, but I wondered, is this intrinsic behavior, will the javascript always fire before the form is posted or do I need to set this behavior.