  function createmap(img, scalebar, legend, ref, title) {
    var d = new Date()
    var mapimg = img;
    var sbimg = scalebar;
    var legendimg = legend;
    var refmap = ref;
    var maptitle = title;
    var northArrow = "/mapserver/data/graphics/north.bmp";
    var logo = "/mapserver/data/graphics/Horizontal_Logo.jpg";
    
    top.NewWin=window.open('', 'printWin','width=800,height=600,resizable=yes,toolbar=1,menubar=1,scrollbars=1');
    printWin = top.NewWin.document.open("text/html", "replace");                                                                    
    printWin.write('<html>\n');                                                                    
    printWin.write('<head>\n');                                                                    
    printWin.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">\n');
    printWin.write('<title>AGS Web Maps</title>\n');                                               
    printWin.write('</head>\n');                                                                   
    printWin.write('<body text="#14004F">\n');            
    printWin.write('<h2><font face="Arial">' + maptitle + '</font></h2>\n');
    printWin.write('<div>\n');
    printWin.write('  <table border="1" cellspacing="0" cellpadding="3" width="600" bordercolor="#000000">\n');
    printWin.write('    <tr>\n');
    printWin.write('      <td width="50%" ><img SRC="' + img + '" width=450 height=450 border=0><br><font face="Arial" size="1"><strong>©  ' 
                           + d.getFullYear() + ' Alberta Geological Survey</strong><img SRC="/MapServer/data/graphics/spacer.gif">www.ags.gov.ab.ca</font></td>\n');
    printWin.write('      <td width="50%" valign="top">\n');
    printWin.write('        <div align="left">\n');
    printWin.write('          <table border="0" cellspacing="1" cellpadding="2" >\n');
    printWin.write('            <tr>\n');
    printWin.write('              <td valign="top">&nbsp</td>\n');
    printWin.write('            </tr>\n');
    printWin.write('              <td valign="top"><u><font face="Arial"><strong>Legend</strong></font></u></td>\n');
    printWin.write('            <tr>\n');
    printWin.write('                <td height="320" valign="top"><img border="0" src="' + legendimg + '">\n');
    printWin.write('                </td>\n');
    printWin.write('            </tr>\n');
    printWin.write('            <tr>\n');
    printWin.write('                <td align="left"><img SRC="' + refmap + '" border="0"  width="40" height="40">&nbsp;&nbsp;&nbsp;\n');
    printWin.write('                <img border="0" src="' + sbimg + '" align="center" width="80" height="17">\n');
    printWin.write('                </td>\n');
    printWin.write('            </tr>\n');
    printWin.write('          </table>\n');
    printWin.write('        </div>\n');
    printWin.write('      &nbsp;&nbsp;&nbsp;<img border="0" src="' + logo + '" width="129" height="28" valign="bottom"><font face="Arial" size="1"></font></td>\n');
    printWin.write('    </tr>\n');
    printWin.write('  </table>\n');
    printWin.write('</div>\n');
    printWin.write('</body>\n');
    printWin.write('</html>\n');
    printWin.close();
    }

