

function AdController(iId, iWidth, iHeight, iAdUrl)
{
    var This = this;

    This.Id = iId;
    This.Width = iWidth;
    This.Height = iHeight;
    This.AdUrl = iAdUrl;

    This.Refresh = function()
    {
        var container = document.getElementById(This.Id);
        var iframe;

        // remove all children
        while (container.hasChildNodes())
            container.removeChild(container.firstChild);

        // create iframe
        iframe = document.createElement('iframe');
        iframe.style.width = This.Width + 'px';
        iframe.style.height = This.Height + 'px';
        iframe.scrolling = 'no';

        // add to container
        container.appendChild(iframe);

        // load ad
        iframe.src = This.AdUrl;
    }

}