<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ 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();
String userName = null;
if ( request.getUserPrincipal() != null ) {
    userName = request.getUserPrincipal().getName();
}
%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>deegree MetadataSearch</title>
		<SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" src="./javascript/exception.js"></SCRIPT>
        <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" src="./javascript/utils.js"></SCRIPT>
        <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" src="./javascript/json2.js"></SCRIPT>       
        <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" src="./javascript/request_handler.js"></SCRIPT>
        <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript" src="./javascript/dialogs.js"></SCRIPT>        
        <script language="javascript1.2" TYPE="text/javascript" src="./javascript/codethatcalendarstd.js"></script>
        <script language="javascript1.2" TYPE="text/javascript" src="./javascript/scroller_ex.js"></script>
        <script language="javascript1.2" TYPE="text/javascript" src="./javascript/md_search.js"></script>
        <script src='http://openlayers.org/api/OpenLayers.js'></script>
        <!-- <script src="http://maps.google.com/maps/api/js?sensor=false"></script>-->
        <!-- <script src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&mkt=de-de"></script>-->
  
           
        <link href="./css/metadataclient.css"  type="text/css" rel="stylesheet">
        <script type="text/javascript">
        
            var boxes  = new OpenLayers.Layer.Boxes( "MD extent" );
            CATMANAGE_LOAD_FULL = '<%=Messages.get( loc, "CATMANAGE_LOAD_FULL" ) %>';
            CATMANAGE_SHOW_BBOX = '<%=Messages.get( loc, "CATMANAGE_SHOW_BBOX" ) %>';
            CATMANAGE_SHOW_OVERVIEW = '<%=Messages.get( loc, "CATMANAGE_SHOW_OVERVIEW" ) %>';
            CATMANAGE_NOOFRESULTS = '<%=Messages.get( loc, "CATMANAGE_NOOFRESULTS" ) %>';
            CATMANAGE_EDITMETADATSET = '<%=Messages.get( loc, "CATMANAGE_EDITMETADATSET" ) %>';
            CATMANAGE_LOADMDTEMPLATE = '<%=Messages.get( loc, "CATMANAGE_LOADMDTEMPLATE" ) %>';
            editor = <%="cmEditor".equals( userName ) %>;

            /**
            * this method should be fill with code that allows adding a layer assigned to selected
            * metadata set to a geo-portal. As an alternativ this method can be overwritten by a
            * geo-portal to provid this function
            */
            function addToPortal(dcp, serviceTitle, type, layer, csw, layerId, layerTitle, layerAbstract) {
               //alert( dcp + " | " + type + " | " + layer );
               // add your code here or override this method in your geo-portal
               
               // default: add to already available OpenLayer client 
               var lyr = new OpenLayers.Layer.WMS( layerTitle, dcp, {layers: layer, transparent: true, format: 'image/png'}, {singleTile: true} ); 
               map.addLayer(lyr);
               
               // implementation to be used with deegree iGeoPortal
               /*
               var l = parent.controller.mapModel.getLayerByName( layer );
               if ( l != null ) {
                   alert( 'layer: ' + layer + ' already exists in map model' );
               } else {               
                   var layers = new Array();
                   layers[0] = new Array();               
                   layers[0]['name'] = layer;
                   layers[0]['title'] = layerTitle;
                   layers[0]['queryable']  = false;
                   layers[0]['metadataURL'] = csw + '?request=GetRecordById&OUTPUTSCHEMA=http://www.isotc211.org/2005/gmd&service=CSW&version=2.0.2&ID=' + layerId;
                   layers[0]['minScale'] = '0';
                   layers[0]['maxScale'] = '99999999999';
                   layers[0]['visible'] = true;
                   layers[0]['abstract'] = layerAbstract;
                   parent.controller.addLayersToModel( serviceTitle, dcp, "1.1.1", layers, 'image/png', true, true );
               }
               */
            }
                       
        </script>
        
	</head>
	
	<body onLoad="init(); initOpenLayers();  ">
	
	<div id="boxSearch">
	<div class="menubarSearchs">
<%
if ( "cmEditor".equals( userName ) )  {
%>	
	   <a class="navi" href="md_editor.jsp">editor</a>
<%
}
%>	   
	   <!--
       <a class="navi" href="cswsetup.jsp">setup</a>
       -->
       <a class="navi" href="csw_main.jsp">home</a>  
	</div>
	<div class="topFrame">
		<table cellpadding="0" cellspacing="0" border="0" summary="">
			<tr>
				<td><img border="0" src="./images/logo-deegree.png" alt="logo"/></td>
				<td width="100"></td>
				<td><h2>catalogueManager search</h2></td>
			</tr>
	  </table>
   </div>

	
	<div id="main_content_search">
	   <div class="mainFrameSearch">
	       <div style="position:relative; left:15px; top:15px;">
                <%=Messages.get( loc, "CATMANAGE_SEARCH_ANYTEXT" ) %> <input title="tooltip" id="FREETXT" style="position: absolute; left: 200px; width: 400px;">
           </div>
           <div  style="position:relative; left:15px; top:35px;">
                <input id="CB_SPATIAL" type="checkbox"> <%=Messages.get( loc, "CATMANAGE_SEARCH_SPATIAL" ) %>
                	<select id="geogrDescription" title="tooltip" style="position: absolute; left: 200px; width: 400px;">
                       <option value="map.bbox_BRD">Germany</option>
                       <option value="map.bbox_Utah">Utah</option>
                       <option value="map.bbox_6">Hessen</option>
                    </select>
           </div>    
           
           <div style="position:relative; left:15px; top:50px;">
                <input id="CB_TIME" type="checkbox"> <%=Messages.get( loc, "CATMANAGE_SEARCH_DATE" ) %> 
                
                <form>
	                <script LANGUAGE="JavaScript1.2" TYPE="text/javascript" >
	                
	                var c1 = new CodeThatCalendar(caldef1);             
	            
	                </script>
	                <div  style="position: absolute; left: 200px; top:0px; width: 100px;"><%=Messages.get( loc, "CATMANAGE_SEARCH_DATE_FROM" ) %>
	                <input id="date1" name=id1 disabled type='textarea' style="position:absolute; left:40px; width:80px;">
	                <a style="position:absolute; left:130px;" href="javascript:c1.popup('id1');"><img src="images/calendar.gif" title="open calendar" alt="Calendar" border="0"></a>
	                </div>
	                
	                <div  style="position: absolute; left: 380px; top:0px; width: 100px;"><%=Messages.get( loc, "CATMANAGE_SEARCH_DATE_TO" ) %>
	                <input id="date2" name=id2 disabled type='textarea' style="position:absolute; left:30px; width:80px;">
                    <a style="position:absolute; left:120px;" href="javascript:c1.popup('id2');"><img src="images/calendar.gif" title="open calendar" alt="Calendar" border="0"></a>
	                </div>
                </form>
           </div>
           
           <div style="position:relative; left:15px; top:65px;">
           		 <a class="button" href="javascript:searchMetadata()"><%=Messages.get( loc, "CATMANAGE_SEARCH_SEARCHBUTTON" ) %></a>
           		 <a class="button" href="javascript:reset()"><%=Messages.get( loc, "CATMANAGE_SEARCH_RESETBUTTON" ) %></a>
<!--            		 
           		 <a class="button">store query</a>
           		 <a class="button">load query</a>
 -->           		 
           </div>
	   </div>
	  
	   <div class="mainFrameResult">
	       <table border="0" width="630px" cellspacing="2">
	            <tr>
                   <td width="15px"/>
                   <td width="150px"><%=Messages.get( loc, "CATMANAGE_SEARCH_RESULT" ) %></td>
                   <td width="200px">
                       <div id="NOOFRESULTS"></div>
                   </td>
                   <td align="right">
	                   <div id="PAGEING1" style="visibility:hidden" >
	                        <a class="pages" href="javascript:pageing(-1)">&lt;</a> 
	                        <a id="PAGE_TOP_0" class="pages" href="javascript:pageing(0)">1</a> 
	                        <a id="PAGE_TOP_1" class="pages" href="javascript:pageing(1)">2</a> 
	                        <a id="PAGE_TOP_2" class="pages" href="javascript:pageing(2)">3</a> 
	                        <a id="PAGE_TOP_3" class="pages" href="javascript:pageing(3)">4</a>
	                        <a class="pages" href="javascript:pageing(1000)">&gt;</a>
	                   </div>
                  </td>
               </tr>    
	       </table>	
	         
	   	<div class="innerFrameResult" id="RESULTTABLE"></div>	       
       </div>
       
       <div id="MapFrame" class="mainFrameMap">
            <div id='map'></div>   
            <br></br>    
            <a id="maximizeMap" style="visibility: visible" class="button" href="javascript:maximizeMap()"><%=Messages.get( loc, "CATMANAGE_MAP_MAX" ) %></a>&nbsp;
            <a id="normalizeMap" style="visibility: hidden" class="button" href="javascript:normalizeMap()"><%=Messages.get( loc, "CATMANAGE_MAP_NORMAL" ) %></a>
       </div>
     
      </div>
</div>
       
       <div id="dialog" class="dialog"></div>
       <div id="fullMDFrame" class="fullMetadata" >            
            
       </div>
       <div id="WAIT" class="waitWindow">
            <img style="position:absolute; left:30%; top:30%; " alt="-" src="./images/progress.gif">
        </div>
	</body>
</html>