var myNumber2 = document.getElementById(f.id.replace(/thumb_/,"tool"));
So when you hover over a thumbnail with an id 'thumb_2_2', it gets changed to tool2_2, which is the name of the corresponding paragraph element :
<p id="tool2_2" style="display: none;">
testing number 2 thumbnail
But I guess it's not that simple because all that happens is the text in the tooltip reads :
Tirna, many thanks for reply. Problem is the actual tooltip code came from a library so I don't really fully understand it. I'm trying to keep things simple by just varying the text inside it, but I can't get it to recognise the variable 'myNumber2' as text from the DOM. It just keeps writing [objectHTMLParagraphElement] inside the tooltip instead of the actual text I want.