function openWindow(name, width, height) {
    if (height > (screen.height - 50)) {
    	height = screen.height - 50;
    }
    settings = 'scrollbars=yes,resizable=yes,menuBar=0,' + 'height=' + height + ',width=' + width + ',top=' + 0 + ',left=' + 0;
    win = window.open(name, '', settings);
    if (win.window.focus) {
        win.window.focus();
        win.resizeTo(width, height + 30);
    }
}

function showFullImage(name) {
    settings = 'scrollbars=yes,resizable=yes,width=640,height=480,menuBar=0,top=0,left=0';
    win = window.open('', '', settings);
    win.document.open();
 	win.document.write("<html>");
 	win.document.write("<body leftmargin='0' topmargin='0'>");
 	win.document.write('<img src="'+ name + '" valign=top>');
 	win.document.write("<\/body><\/html>");
	win.document.close();
	win.document.images[0].onload = resizeOnload;
}

function resizeOnload() {
	var width;
	var height;
	var image = this;
	width = image.width + 30; 
    height = image.height + 36;
	if (height > (screen.height - 50)) {
    	height = screen.height - 50;
    }
    if (width > screen.width) {
    	width = screen.width;
    }
	win.resizeTo(width, height);
}
