<%-- $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/apps/igeoportal-standard/branches/2.5_testing/printview.jsp $ --%>
<%-- 
 This file is part of deegree, http://deegree.org/
 Copyright (C) 2001-2009 by:
 - Department of Geography, University of Bonn -
 and
 - lat/lon GmbH -

 This library is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free
 Software Foundation; either version 2.1 of the License, or (at your option)
 any later version.
 This library is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 details.
 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, write to the Free Software Foundation, Inc.,
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 Contact information:

 lat/lon GmbH
 Aennchenstr. 19, 53177 Bonn
 Germany
 http://lat-lon.de/

 Department of Geography, University of Bonn
 Prof. Dr. Klaus Greve
 Postfach 1147, 53001 Bonn
 Germany
 http://www.geographie.uni-bonn.de/deegree/

 e-mail: info@deegree.org
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="org.deegree.i18n.Messages" %>
<%@ page import="java.util.Locale" %>
<%
    Locale loc = request.getLocale();
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="author" content="lat/lon GmbH">
        <meta name="KeyWords" content="OGC deegree iGeoPortal lat/lon" />
		<meta name="audience" content="">
        <meta http-equiv="imagetoolbar" content="no" />
        <meta http-equiv="cache-control" content="no-cache" />
        <title>deegree iGeoPortal print view</title>
        <link href="css/deegree.css" rel="stylesheet" type="text/css" />
        <script language="JavaScript1.2" type="text/javascript">
        <!--
            function printPage() {
                var e = document.getElementById( "printBT" );
                e.parentNode.removeChild( e );
                e = document.getElementById( "printCancelBT" );
                e.parentNode.removeChild( e );
                window.print();
                window.close();
            }
            
            /*
            function getPrintWidth() {
            	//the return value should be used for img.map.width
				var isWindows = true;
				var printWidth = 600;
				if ( navigator.appVersion.search("Windows") = -1 ){
					isWindows = false;
					printWidth = 1100;
				}
				alert( " isWindows = " +  isWindows + "\nprintWidth = " + printWidth );
				return printWidth;
			}
			*/
        // -->
        </script>
<%
        String file = (String)request.getAttribute( "ImageSource" );
        Integer width = (Integer)request.getAttribute( "ImageWidth" );
        Integer height = (Integer)request.getAttribute( "ImageHeight" );
        int h = 0;
        int w = 500;
        if ( file != null ) {
            double d = width.doubleValue()/500d;
            h = (int)(height.doubleValue()/d);
        }
%>
        <style type="text/css">
			@media screen { 
				body {
					background: #FFFFFF;
					color: #000000;
				}
				img.map{
					width: <%=w %>;
					height: <%=h %>;
				}
			} 
			@media print {
				PAGE {
				    font-size: small;
					size: portrait;
					margin: 1.5cm;
				}
				body { 
					font-size: 12pt;
					size: portrait;
					margin: 1.5cm;
					background: #FFFFFF;
					color: #000000;
				}
				img.map {
					width: 600; /* might need to be adjusted */
				}
			}
		</style>
    </head>
    <body class="pPrintView">
        <a id="printBT" href="javascript:printPage()" class="buttonArea"><%=Messages.get( loc, "IGEO_STD_BTN_PRINT" ) %></a>
        <a id="printCancelBT" href="javascript:window.close()" class="buttonArea"><%=Messages.get( loc, "IGEO_STD_BTN_CANCEL" ) %></a>
        <br/>
<%
        if ( file != null ) {
%>
			<img class="map" border="0" src="<%=file %>" />
<%
        }
%>
    </body>
</html>
