function popUpImage(id, width, height, title){
    var content = "<html><head><title>" + title + "</title><style type=\"text/css\">body{margin: 0; padding: 0;}</style></head><body><img src=\"image.do?id=" + id + "&binary=true\" width=\"" + width + "\" height=\"" + height + "\" border=\"0\"></body></html>";
    var popupimage = window.open("", "popupimage", "width=" + width + ",height=" + height + ",status=no,resizable=yes,scrollbars=0,top=200,left=400");
    popupimage.focus();
    popupimage.opener = self;
    var popupDoc = popupimage.document;
    popupDoc.innerHTML = "";
    popupDoc.write (content);
    popupimage.resizeTo(width,height+2);
    popupDoc.close();

    popupDoc = popupimage.document;
    
    if ( popupDoc.documentElement ){
	var pWidth = popupDoc.documentElement.offsetWidth;
	var pHeight = popupDoc.documentElement.offsetHeight;
	if ( width > pWidth || height > pHeight ){
	    popupimage.resizeTo(2*width-pWidth+4,2*height-pHeight+5);
	}
    }
    


}


function showPrintPage(printPage){
    if ( !printPage ){
	printPage = document.location + "&printpage=true";
    }
    var width = 800;
    var height = 600;
    var popupimage = window.open(printPage, "printpage", "width=" + width + ",height=" + height + ",toolbar=1,menubar=1,status=no,resizable=yes,scrollbars=1,top=100,left=100");
    popupimage.focus();
}
