beforeBefore the script part starts embed the item and add a ID:
<embed src="/sites/1827056.pdf" id="pdf_content" width="500" height="375"></embed>
in the script section update the src of the ID with the variable data. document.getElementById("pdf_content").src = IMAGEURL;:
document.getElementById("pdf_content").src = IMAGEURL;
It took me 3 hours to find that solution :-).