///class PD.Web.Utilities.DownloadManager

PD.Web.Utilities.DownloadManager =
Class.extend({
});

PD.Web.Utilities.DownloadManager.download =
function (url, params, iframeId) {

    var $frame = PD.Web.Utilities.DownloadManager.getFrame(iframeId);

    params = $.extend({
        uid: uuid.v4(),
        "iframe-request": true
    }, params || {});

    if ($frame.length > 0) {
        $frame.prop("src", PD.Path.resolve(url + (params ? "?" + $.param(params) : "")));
    }

};

PD.Web.Utilities.DownloadManager.getFrame =
function (iframeId) {

    iframeId = iframeId || "-pd-downloads";

    var frame = "<iframe id='" + iframeId + "' style='display:none;'></iframe>",
        $frame = $("#" + iframeId);

    if ($frame.length === 0) {
        $frame = $(frame);
        $frame.appendTo("body");
    };

    return $frame;

};