// now write the iframe with the right options

// calculate the widget height and widget width


function w_getWidth()
{
    if (typeof(edelight_wd_width) != "undefined")
        return edelight_wd_width;
    var _width = (edelight_wd_maxcols)*(edelight_wd_imagesize+2) + 6;
    return _width + 'px';
}

function w_getHeight()
{
    if (typeof(edelight_wd_height) != "undefined")
        return edelight_wd_height;
    var _zw = (edelight_wd_maxitems / edelight_wd_maxcols);
    if (_zw > Math.floor(_zw))
        _zw = Math.floor(_zw) + 1;

    var _height = _zw*(edelight_wd_imagesize+2) + 10 + 30;
    return _height + 'px';
}

if (edelight_wd_title == null || edelight_wd_title == "undefined" )
    edelight_wd_title = "";

var _tohtml = ('<iframe  name="edelight_frame" id="edelight_frame" width="' + w_getWidth()  +
               '" height="' +  w_getHeight() +
               '" src="http://' +  edelight_wd_domain   + '/widget/show_widget/' + edelight_wd_list_path   + '/' +
               '?maxItems='    + edelight_wd_maxitems +
               '&maxCols='     + edelight_wd_maxcols +
               '&imageSize='   + edelight_wd_imagesize +
               '&imageBorder=' + edelight_color_imageborder +
               '&widgetBorder='+ edelight_color_widgetborder +
               '&Bg='          + edelight_color_bg +
               '&Title='       + encodeURIComponent(edelight_wd_title) +
               '&nocache=true' +
               '" scrolling="no" frameborder="0"></iframe>' );
document.write(_tohtml);
