/**
 * Embeds either <iframe> or <object> element as innerHTML for
 * container passed through its id. Embeded element gets its source
 * via passed url, element type depends on browser vendor.
 * Returns false if container not found.
 * Returns true when code is embeded.
 */
function embedCode(id, url, width, height) {
    var container = document.getElementById(id);
    if (container == null) {
        return false;
    }

    var ua = navigator.userAgent,isIE = (navigator.appName == 'Microsoft Internet Explorer');
    if (isIE) {
        isIE = ua.replace(/^.*?MSIE\\s+([0-9\\.]+).*$/, '$1');
    }
    var innerHTML;
    if (isIE) {
        innerHTML = "<iframe style='width:" + width + "px;height:" + height + "px;' src=\"" + url + "\"> </iframe>";
    } else {
        innerHTML = "<object style='width:" + width + "px;height:" + height + "px' data=\"" + url + "\" type='text/html'> </object>";
    }

    container.innerHTML = innerHTML;

    return true;
}


