Ah i am not sure - but before i put in your code above - it was calling upon the value that was keyed in the 'longdesc' area. and by default yours was showing that value.
So when i put in your new JS into the footer - now the image alt tag value shows (good good) and the longdesc value is ignored and not showing. i was hoping to show both values - with a br break - between the two :)