function loadBanner(banner, clickUrl, divName)
{
        var adDiv = document.getElementById(divName);

        // Remove old ads
        var old_iframe = document.getElementById("instream_iframe");
        if (old_iframe) {
                adDiv.removeChild(old_iframe);
        }
        var old_span = document.getElementById("instream_span");
        if (old_span) {
                adDiv.removeChild(old_span);
        }
        var old_a = document.getElementById("instream_a");
        if (old_a) {
                adDiv.removeChild(old_a);
        }

        // If there is a iframe, use it
        var htmlUrl = (banner.indexOf(".htm") != -1);
        var swfUrl = (banner.indexOf(".swf") != -1);
        var imageUrl = (banner.indexOf(".jpg") != -1) || (banner.indexOf(".gif") != -1);

        if (htmlUrl) {
                // Create the iframe
                var iframe = document.createElement("iframe");
                iframe.setAttribute("id", "instream_iframe");
                iframe.style.width = "300px";
                iframe.style.height = "250px";
                iframe.style.border = "0";
                iframe.scrolling = "no";
                iframe.marginWidth = "0";
                iframe.marginHeight = "0";
                iframe.frameBorder = "no";
                adDiv.appendChild(iframe);

                // IE has a weird caching issue, so we have to append the
                // iframe, then set the src
                var new_iframe = document.getElementById("instream_iframe");
                new_iframe.src = banner;
                new_iframe.frameborder = "no";

        // Otherwise if there is a SWF URL, use that
        } else if (swfUrl) {
                // Get the object HTML
                var objHtml = '<object';
                objHtml += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="250" id="instream_swf">';
                objHtml += '<param name="movie" value="' + banner + '" />';
                objHtml += '<param name="quality" value="high" />';
                objHtml += '<param name="wmode" value="transparent" />';
                objHtml += '<param name="allowfullscreen" value="true" />';
                objHtml += '<param name="allowscriptaccess" value="always" />';
                objHtml += '<!--[if !IE]>-->';
                objHtml += '<object type="application/x-shockwave-flash" data="' + banner + '" width="300" height="250" id="instream_swf">';
                objHtml += '<param name="quality" value="high" />';
                objHtml += '<param name="wmode" value="transparent" />';
                objHtml += '<param name="allowfullscreen" value="true" />';
                objHtml += '<param name="allowscriptaccess" value="always" />';
                objHtml += '<!--<![endif]-->';
                objHtml += '<a href="http://www.adobe.com/go/getflashplayer">';
                objHtml += '<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />';
                objHtml += '</a>';
                objHtml += '<!--[if !IE]>-->';
                objHtml += '</object>';
                objHtml += '<!--<![endif]-->';
                objHtml += '</object>';

                // Create the iframe
                var iframe = document.createElement("iframe");
                iframe.setAttribute("src", banner);
                iframe.setAttribute("id", "instream_iframe");
                iframe.style.width = "300px";
                iframe.style.height = "250px";
                iframe.style.border = "0";
                iframe.scrolling = "no";
                iframe.marginWidth = "0";
                iframe.marginHeight = "0";
                iframe.frameBorder = "no";
                adDiv.appendChild(iframe);

                // IE has a weird caching issue, so we have to append the
                // iframe, then set the src
                //var new_iframe = document.getElementById("instream_iframe");
                //new_iframe.frameborder = "no";
                //new_iframe.body.innerHTML = 'this is a test';//objHtml;

        // Otherwise if there is an image, use that
        } else if (imageUrl) {
                // Create the anchor tag
                var a = document.createElement("a");
                a.setAttribute("href", clickUrl);
                a.setAttribute("target", "_blank");
                a.setAttribute("id", "instream_a");

                // Create the image tag
                var img = document.createElement("img");
                img.setAttribute("src", banner);
                img.setAttribute("border", 0);
                img.setAttribute("width", 300);
                img.setAttribute("height", 250);
                a.appendChild(img);

                // Add the tag
                adDiv.appendChild(a);
        }
}
