function popunder() { // Check if the DOM is supported if(!document.getElementById || !document.createTextNode){return;} // Define variables var pa=document.getElementById('popad');//popad var ft=document.getElementById('popad_footage'); var closeLinkTitle='Activate to close'; var closeLinkId='popad_close'; var closeLinkText='remove this ad'; var dynamicClass='dynamic'; // check if all elements are available if(!pa || !ft){return;} // set class to indicate dynamic functionality pa.className=dynamicClass; // function to remove the ad function killad(e) { // if the link is the close link, don't follow it. if(this.id==closeLinkId) { stoplink(e); } // if the link has a rel external, then open it in a new window if(this.rel=='external') { window.open(this.href); stoplink(e); } pa.parentNode.removeChild(pa); } // create new link to close the ad, and set its attributes var closelink=document.createElement('a'); closelink.setAttribute('href','#'); closelink.setAttribute('title',closeLinkTitle); closelink.setAttribute('id',closeLinkId); closelink.appendChild(document.createTextNode(closeLinkText)); ft.getElementsByTagName('a')[0]?ft.insertBefore(closelink,ft.firstChild):ft.appendChild(closelink); // append the kill ad function var popadlinks=pa.getElementsByTagName('a'); for(var i=0;i