// JavaScript Document
//Works

var lastDownloadPick = '';

function newWindow(location, wid, hei) {
	newWindow = window.open(""+location+"", "newWin", "toolbar=no, location=no, scrollbars=yes, width="+wid+", height="+hei+" ")
}

function iDownload(iframeSrc) {
    if (document.images) {
        document.getElementById('iframeimg').src = iframeSrc;
    }
    lastDownloadPick = iframeSrc;

}

function submitIt(assetForm) {
    assetOption = -1
    var assets = document.getElementsByName('assetCt');
 
    for (i=0; i< assets.length; i++) {
        if (assets[i].checked) {
            assetOption = i;
            var ifr = document.getElementById('iframeimg');
            if (ifr.document) {
                fname = document.getElementById('iframeimg').src
                iframeimg.document.execCommand('saveas', null ,fname)
                return true;
                //iframeimg.document.execCommand('saveas', null ,fname);
            }
            else {
                //alert("We're sorry.  This feature is only supported by Internet Explorer 6.0 and 7.0 Browsers.\n");
                //window.open("download/" + lastDownloadPick);
                document.getElementById('assetForm').action = "download/" + lastDownloadPick;
                return true;
            }
            return false;
        }
    }
    if (assetOption == -1) {
        alert("Please select an asset for download");
    }
    return false;
}

