(function() { function autoResize(mainDoc, id){ var newheight; var newwidth; if(document.getElementById){ newheight = mainDoc.getElementById(id).contentWindow.document.body.scrollHeight; newwidth = mainDoc.getElementById(id).contentWindow.document.body.scrollWidth; } document.getElementById(id).height = (newheight) + "px"; document.getElementById(id).width = (newwidth) + "px"; } var runIFrameScripts = function(code, containerEl, adPositionId) { var b = document.createElement('iframe'); var mainDoc = document; b.id = "pub_ad_iframe_pos_" + adPositionId; b.width = "0px"; b.height = "0px"; b.calledBefore = false; b.onload = function() { if(b.calledBefore == true) { b.onload = null; return; } b.calledBefore = true; b.contentWindow.document.open('text/html'); b.contentWindow.document.write('
'); b.contentWindow.document.write(code); b.contentWindow.document.write(''); b.contentWindow.document.close(); b.contentWindow.document.onreadystatechange = function(e) { autoResize(mainDoc, b.id); }; }; containerEl.appendChild(b); }; var runScripts = function(code, containerEl, adPositionId) { containerEl.innerHTML = ""; var b = document.createElement('div'); b.id = 'scripts' + adPositionId; b.innerHTML = code; // this can include stray