<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Getdates</title>
          <script type='text/javascript' src='zapatec.js'></script>
        
        <!-- Custom includes -->	
                <!-- import the calendar script -->
        <script type="text/javascript" src="calendar.js"></script>
        
        <!-- import the language module -->
        <script type="text/javascript" src="calendar-en.js">
            
           
        </script>
        
        <!-- Theme css -->
        <link href="forest.css" rel="stylesheet" type="text/css">
        
        <script>
            function findRoomsUsingList(){
                var seltype=document.getElementById('roomtype');
                var value=seltype.options[seltype.selectedIndex].text;
               //alert(value);
                var selobj=document.getElementById('datechoice');
                datetimelist=new Array(selobj.options.length);
                for(var i=0;i<selobj.options.length;++i){
                    datetimelist[i]=selobj.options[i].text;
                   // alert(datetimelist[i]);
                }
                location.href="regnegroomlist?type="+value+"&datetimelist="+datetimelist+"&agenda="+document.getElementById("txtAgenda").value;
            }
             function addDateTime(){
                var startdate=document.getElementById("sel2").value;
                var enddate=document.getElementById("sel3").value;
                if(document.getElementById("datechoice").options.length<3){
                    var opt = document.createElement("option");
                    document.getElementById("datechoice").options.add(opt);
                    opt.text = startdate+"-"+enddate;
                    opt.value = startdate+"-"+enddate;
                    document.getElementById("sel2").value="";
                    document.getElementById("sel3").value="";
                }
                else
                    {
                        alert("only three dates allowed");
                    }
            }
        </script>
    </head>
    <%@ page import = "java.util.*" %>
        <%@ page import = "com.test.DataBase;" %>
    <body>

   <body background="_themes/aftrnoon/background_aftrnoon.gif" bgcolor="#FFFFFF" text="#000000" link="#983738" vlink="#703637" alink="#C76565"><!--mstheme-->
            
        <form action="negotiatemeeting" method="post"  onsubmit="confirmpage()">
           
            <table  width="100%">
                <tr>
                    <td align="center" colspan="2" width="100%">
                        <jsp:include page="banner.html"></jsp:include>
                    </td>
                    
                    
                </tr>
                
            </table>
            
            <table align="center" width="100%">
                <tr>
                    <td align="center" width="90%">
                        <h3>
                            <u>
                                Renegotiate Meeting Request
                            </u>
                        </h3>
                    </td>
                    <td align="center" nowrap width=10%">
                        <a href="welcome.jsp">Home</a>
                    </td>
                    <td align="right" nowrap width=10%">
                        
                        <a href="#" onclick="logoff();">Sign out</a>
                    </td>
                </tr>
                
            </table>
                        <%
String id=(String)request.getSession().getAttribute("id");
System.out.println("id :"+id);
session.setAttribute("id", id);
String agenda =(String)request.getSession().getAttribute("agenda");
%>
            <table cellpadding = "10" align="center" width="80%">
                <font size="3">
                    <tr>
                        <td>
                            Agenda :
                        </td>
                        <td nowrap>
                            <%
                            
                                String agendass = (String)session.getAttribute("agendaaa");
                                  System.out.println("agenda :"+agendass);
                            %>
                            <input type="text" name="txtAgenda" id="txtAgenda" value = "<%=agendass %>" size="50" readonly>	

                        </td>
                       
                    </tr>
                     
                             <% String[] finaldatelist = request.getParameterValues("finaldateList");
                            System.out.println("final date :"+ finaldatelist.length);
                            session.setAttribute("finaldatelist",finaldatelist);
                             System.out.println("attributes set in sesiion");
                             for(int i=0;i<finaldatelist.length;i++)
                                {
                                
                                System.out.println("final date 2:"+ finaldatelist[i].toString()); 
                                }
                                
                                
                                
                                 ArrayList<ArrayList<String[]>> totallist = new ArrayList<ArrayList<String[]>>();
                                 totallist =  (ArrayList<ArrayList<String[]>>)session.getAttribute("totallist");
                                 System.out.println("totallisttotallisttotallist"+totallist.size());
                                 if(!totallist.isEmpty())
                                {
                                  session.setAttribute("totallist",totallist);
                                }
                                %>
                             
                    <tr>
                        <td>
                            Select Start Date	:
                        </td>
                        <td nowrap>
                            <input type="text" name="date2" id="sel2" size="30">	
                            <img alt=' Zapatec Calendar' src='calendar2.gif' border='0' id='button2'  onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Select End Date :
                        </td>
                        <td nowrap>
                            <input type="text" name="date3" id="sel3" size="30">	
                            <img alt=' Zapatec Calendar' src='calendar2.gif' border='0' id='button3'  onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'">
                               &nbsp;&nbsp; <input type="button" value="add" name="add" onclick="addDateTime()"> 
                        </td>
                        
                        
                    </tr>
                     
                    <tr>
                        <td>
                            Date Choice	:
                        </td>
                        <td>
                           
                            <select name = "datechoice" size ="1" id="datechoice">
                             </select>
                            
                        </td>
                        
                        
                    </tr>
                    <tr>
                        <td>
                            Room Type	:
                        </td>
                        <td>
                           
                            <select name = "roomType" size ="1" id="roomtype" onchange="popup('virtual.jsp')">
                                <option value = "Auditorium">Auditorium</option>
                                <option value = "Conference">Conference</option>
                                <option value = "Virtual" id="virtual">Virtual</option>
                            </select>
                            &nbsp;&nbsp; <input type="button" name="findroom" onclick="findRoomsUsingList()" value="Find">
                        </td>
                        
                        
                    </tr>
                    <tr>
                        
                        <td>
                            <script type="text/javascript">
                                var cal = new Zapatec.Calendar.setup({
                                
                                    inputField     :    "sel2",     // id of the input field
                                    singleClick    :     false,     // require two clicks to submit
                                    ifFormat       :    '%a, %b %e, %Y [%H:%M]',     // format of the input field
                                    showsTime      :     true,     // show time as well as date
                                    button         :    "button2"  // trigger button 
                                });
                
                            </script>
                            
                        </td>
                        
                    </tr>
                    <tr>
                        <td>
                            <script type="text/javascript">
                                var cal = new Zapatec.Calendar.setup({
                                
                                    inputField     :    "sel3",     // id of the input field
                                    singleClick    :     false,     // require two clicks to submit
                                    ifFormat       :    '%a, %b %e, %Y [%H:%M]',     // format of the input field
                                    showsTime      :     true,     // show time as well as date
                                    button         :    "button3"  // trigger button 
                                });
                
                            </script>
                            
                        </td>
                        
                    </tr>
                    
                   
                    
    
    
    </body>
</html>
