function checkBrowser() {
    // false - nelze provezt zobrazeni obrazku
    // Neznamy prohlizec
    // Netscape (do 2.0) a Internet Explorer (do 3.0)

    // true - zobrazeni obrazku lze provest
    // Netscape 3.0 a vyssi
    // Internet Explorer 4.0 a vyssi

    // Netscape 3.0 a vyssi
    if ( navigator.appName == "Netscape" && parseInt( navigator.appVersion) >= 3) {
        return true;
    }

    // Internet Explorer 4.0 a vyssi
    if ( navigator.appName == "Microsoft Internet Explorer") {
                var sVersion;
                var nVersion;
                var nIndex;

                sVersion = new String( navigator.appVersion);
                sVersion = sVersion.substring( sVersion.indexOf( "MSIE") + 5);
                nVersion = parseInt( sVersion);

                if ( nVersion >= 4)
                        return true;
    }

    // Neznamy prohlizec
    return false;
}

// Zobrazeni obrazku ve zvlastnim okne
function view( image, width, height) {
    if ( checkBrowser()) {
        var autResize = false;
    	if (width == null || height == null) {
    	  autResize = true;
    	  width = 600;
    	  height = 400;
    	}
        var imgWindow = window.open( "", "view", "menubar=no,scrollbars=no,resizeable=no,width=" + width + ",height=" + height + ",top=150,left=150");
        var imgDoc = imgWindow.document;
        imgDoc.clear();
        imgDoc.open();
        imgDoc.writeln("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
        imgDoc.writeln("<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"cs\">");
        imgDoc.writeln("<head>");
        imgDoc.writeln("<title>", document.title, "<\/title>");
        if (autResize) {
          imgDoc.writeln("<script type=\"text/javascript\">\nfunction resize() {\n  if( typeof( window.innerWidth ) == 'number' ) {\n    //Non-IE\n    diffWidth = 8; diffHeight = 55;\n  } else {\n    diffWidth = 10; diffHeight = 35;\n  }\n  window.resizeTo(window.document.images[0].width + diffWidth, window.document.images[0].height + diffHeight);\n}\n<\/script>");
        }
        imgDoc.writeln("<\/head>");
        imgDoc.writeln("<body style=\"margin: 0; padding: 0;\"" + (autResize? " onload=\"resize()\"" : "") + ">");
        imgDoc.writeln("<a href=\"javascript:window.close()\">");
        imgDoc.writeln("<img src=\"",image,"\" border=\"0\" alt=\"\" />");
        imgDoc.writeln("<\/a>");
        imgDoc.writeln("<\/body>");
        imgDoc.writeln("<\/html>");
        imgDoc.close();
    }

}
