function display(image, name, wdth, hght)
{
    w = wdth;
    h = hght;

    w += 32;
    h += 160;

    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

    s1 ="<title>"+name+"</title>"
    s2 ="<center>"
    s3 ="<img src='"+image+"' border=0 />"
    //s4 ="<h6 onclick='self.close()'>[ CLOSE WINDOW ]</h6>"
    s4 ="<br><br><form><input type='button' value='Close Window'"+ " onclick='self.close()'></form>"
    s5 = +wdth+ " x " +hght 
    s6 ="<br></center>"

    imagewindow = window.open('',
        name,
        'width=' + w + ', height=' + h + ', ' +
        'left=' + wleft + ', top=' + wtop + ', ' +
        'location=no, menubar=no, ' +
        'status=no, toolbar=no, scrollbars=no, resizable=no');

    imagewindow.document.write(s1+s2+s3+s4+s5+s6);
    //imagewindow.document.write("hello");
    
    // Just in case width and height are ignored
    imagewindow.resizeTo(w, h);
    // Just in case left and top are ignored
    imagewindow.moveTo(wleft, wtop);
    imagewindow.focus();
}

function displayOLD(image, name, wdth, hght, title, desc)
{
    w = wdth;
    h = hght;

    w += 32;
    h += 300;

    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

    s1 ="<title>"+name+"</title>"
    s2 ="<center>"
    s3 ="<h5>"+title+"</h5>"
    s4 ="<p>"+desc+"</p>"
    s5 ="<img src='"+image+"' border=0 />"
    s6 ="<br><br><form><input type='button' value='Close Window'"+ " onclick='self.close()'></form>"
    s7 = +wdth+ " x " +hght 
    s8 ="<br></center>"

    imagewindow = window.open('',
        name,
        'width=' + w + ', height=' + h + ', ' +
        'left=' + wleft + ', top=' + wtop + ', ' +
        'location=no, menubar=no, ' +
        'status=no, toolbar=no, scrollbars=no, resizable=no');

    imagewindow.document.write(s1+s2+s3+s4+s5+s6+s7+s8);
    //imagewindow.document.write("hello");
    
    // Just in case width and height are ignored
    imagewindow.resizeTo(w, h);
    // Just in case left and top are ignored
    imagewindow.moveTo(wleft, wtop);
    imagewindow.focus();
}
function getImgSize(id){
    //var pic = document.getElementById(id);
    //var ht = pic.offsetHeight;
    //var wt = pic.offsetWidth;
    //alert ('The image size is '+wt+'*'+ht);
    var pic = document.getElementById(id);
    alert(pic.height);
}

function displays(image)
{
    // get set image width and height
    var w = 800;
    var h = 600;
    w += 32;
    h += 96;
    wleft = (screen.width - w) / 2;
    wtop = (screen.height - h) / 2;

    // IE5 and other old browsers might allow a window that is
    // partially offscreen or wider than the screen. Fix that.
    // (Newer browsers fix this for us, but let's be thorough.)
    if (wleft < 0) {
        w = screen.width;
        wleft = 0;
    }
    if (wtop < 0) {
        h = screen.height;
        wtop = 0;
    }

    var win = window.open(image,
        name,
        'width=' + w + ', height=' + h + ', ' +
        'left=' + wleft + ', top=' + wtop + ', ' +
        'location=no, menubar=no, ' +
        'status=no, toolbar=no, scrollbars=no, resizable=no');
    
    // Just in case width and height are ignored
    win.resizeTo(w, h);
    // Just in case left and top are ignored
    win.moveTo(wleft, wtop);
    win.focus();
}

function displayc(image) {
    var s1 ="<title>image</title>"
    var s2 ="<center>"
    var s3 ="<img src='"+image+"' border=0 >"
    var s4 ="<form><input type='button' value='close window'"+ " onclick='self.close()'></form>"
    var s5 ="<h6 onclick='self.close()'>CLOSE</a>"
    var s6 ="</center>"

    imagewindow=window.open("", "newwin","height=600, width=800, toolbar=no,scrollbars=no,menubar=no");
    imagewindow.document.write(s1+s2+s3+s4+s5+s6)
    //imagewindow.document.write (screen.width + ' x ' + screen.height)
    imagewindow.document.write (width + ' x ' + height)
    imagewindow.document.close()
}

function displaya(image, width, height) {
    var s1 ="<title>image</title>"
    var s2 ="<center>"
    var s3 ="<img src='"+image+"' border=0 onload='window.resizeto('"+width+"','"+height+"')'>"
    var s4 ="<form><input type='button' value='close window'"+ " onclick='self.close()'></form>"
    var s5 ="<h6 onclick='self.close()'>CLOSE</a>"
    var s6 ="</center>"

    imagewindow=window.open("", "newwin","height='"+width+"', width='"+height+"', toolbar=no,scrollbars=no,menubar=no");
    imagewindow.document.write(s1+s2+s3+s4+s5+s6)
    //imagewindow.document.write (screen.width + ' x ' + screen.height)
    imagewindow.document.write (width + ' x ' + height)
    imagewindow.document.close()
}

function displayb(image) {
    html =  "<html><head><title>photo</title>" 
            + "</head><body leftmargin=0 " 
            + "marginwidth=0 topmargin=0 marginheight=0><center>" 
            + "<img src='" + image + "' border=0 name=image " 
            + "onload='window.resizeto(document.image.width,document.image.height)'>"
            + "</center>" 
            + "</body></html>";
    popup=window.open('','myimage',
    'toolbar=0,location=0,directories=0,menubar=0,scrollbars=0,resizable=1');
    popup.document.open();
    popup.document.write(html);
    popup.document.focus();
    popup.document.close()
}

/*
<a href="page.html" target="popup" onClick="wopen('page.html', 'popup', 300, 200); return false;">
Click here to open the page in a new window.</a>
*/

function wopen(url, name, w, h) {
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}

function popuponclick() {
    my_window = window.open('', 'mywindow','status=1,width=350,height=150');
    my_window.document.write('<h1>the popup window</h1>');
    my_window.document.write('<a href="javascript: closepopup()">Close the Popup Window</a>');
    my_window.document.write('<a href="javascript:window.close();">Close Window</a>');  
}

function closepopup() {
    my_window.close ();
}