var newWindow;
function makeNewAds(lnk,uwidth,uheight) {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("","ads_viewer","height="+uheight+",width="+uwidth+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes,dependent=yes");
        if (!newWindow.opener) {
            newWindow.opener = window;
        }
        setTimeout("writeToAdsHtml('"+lnk+"',"+uwidth+","+uheight+")", 500);
    } else if (newWindow.focus) {
        newWindow.focus();
    }
}
function writeToAdsHtml(lnk,uwidth,uheight) {
    var newContent = "<html><head><title>Viewer</title></head>";
    newContent += "<body style=\"margin:0px;\" onblur=\"window.close();\">";
    newContent += "<img src=\""+lnk+"\" width=\""+uwidth+"\" height=\""+uheight+"\" border=\"0\" />";
    newContent += "</body></html>";
    newWindow.document.write(newContent);
    newWindow.document.close(); // close layout stream
}

