function loadRevAd(siteId) { var css = document.createElement('link'); css.rel = 'stylesheet'; css.href = 'http://js.thefivepillars.org/css'; document.getElementsByTagName("head")[0].appendChild(css); var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'http://js.thefivepillars.org/1496643026559/showAd'; document.getElementsByTagName("head")[0].appendChild(script); }; function getParameterByName(name, url) { if (!url) url = document.currentScript.src; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } function showAd(response) { for (var i = 0; i < response.length; i++) { var elementExists = document.getElementById(response[i].TARGET); if(elementExists) { elementExists.innerHTML = response[i].CONTENT; } } } loadRevAd(getParameterByName('siteid'));