<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <TITLE> Renegotiate Meeting </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    
    <script type='text/javascript' src='zapatec.js'></script>
    <%@ page import = "java.util.*" %>
    <!-- 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 sendList(){
            
            var selobj=document.getElementById('initiatorlist');
                datetimelist=new Array(selobj.options.length);
                for(var i=0;i<selobj.options.length;++i){
                    datetimelist[i]=selobj.options[i].text;
                    }
                 location.href="confirmnegotiate?datetimelist="+datetimelist;
            }
            function confirmpage(){
                var selobj=document.getElementById('initiatorlist');
                for(var i=0;i<selobj.options.length;++i){
                    selobj.options[i].selected=true;
                }
                
               var actobj=document.getElementById('activelist');
               for(var i=0;i<actobj.options.length;++i){
                    actobj.options[i].selected=true;
                }
                var parobj=document.getElementById('participantlist');
               for(var i=0;i<parobj.options.length;++i){
                    parobj.options[i].selected=true;
                }
               
                                    
            }
            function popup(url){
                var type=document.getElementById("roomtype").value;
                
                if(type=="Virtual"){
                    
                    newwindow=window.open(url,'','height=250,width=450');
                    if (window.focus) {newwindow.focus()}
                    return false;
                }
                return true;
            }
            
             function logoff()
            {
                var answer = confirm("Do you really want to Log off?");
                if(answer)
                {
                    location.href = "LogOut.jsp";
                }
                else
                {
                    return false;
                }

            }
           
            function findRooms(){
                var selobj=document.getElementById('roomtype');
                var value=selobj.options[selobj.selectedIndex].text;
                var startdatetime=document.getElementById('sel2').value;
                var enddatetime=document.getElementById('sel3').value;
                location.href="renegroomlist?type="+value+"&startdatetime="+startdatetime+"&enddatetime="+enddatetime;
            }
             
            function addtoList(){
                var selobj=document.getElementById('roomlist');
                var value=selobj.options[selobj.selectedIndex].text;
                if(document.getElementById("initiatorlist").options.length<3 ||selobj.selectedIndex!=-1){
                    var opt = document.createElement("option");
                    document.getElementById("initiatorlist").options.add(opt);
                    opt.text = value;
                    opt.value = value;
                    document.getElementById("roomlist").options.remove(selobj.selectedIndex);
                }
             
            }
            function testDelete()
            {
                
                var selobj=document.getElementById('initiatorlist');
                var value=selobj.options[selobj.selectedIndex].text;
                if (document.getElementById('initiatorlist').length!=0){
                     document.getElementById("initiatorlist").options.remove(selobj.selectedIndex);
                      var opt = document.createElement("option");
                      opt.text=value;
                      opt.value=value;
                     document.getElementById("roomlist").options.add(opt);
                }
                
            }
            function addtoparticipantList(){
                var selobj=document.getElementById('emplist');
                var value=selobj.options[selobj.selectedIndex].text;
                var opt = document.createElement("option");
                opt.text=value;
                opt.value=value;
                     
                if(document.getElementById("active").checked==true){
                    
                       document.getElementById("activelist").options.add(opt);
                       document.getElementById("emplist").options.remove(selobj.selectedIndex);
                       document.getElementById("active").checked=false;
                 }
                 else{
                     document.getElementById("participantlist").options.add(opt);
                     document.getElementById("emplist").options.remove(selobj.selectedIndex);
                     document.getElementById("active").checked=false;
                 }
            }

                                       </script>
    
</HEAD>
<body><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> 
    <tr>
        <%
        System.out.println("listlistlist"+session.getAttribute("rooomlist"));
        System.out.println("emplistemplist"+session.getAttribute("empllist"));
        if((session.getAttribute("rooomlist")!=null)||(session.getAttribute("empllist")!=null)){
            java.util.ArrayList<String> list=(java.util.ArrayList<String>)session.getAttribute("rooomlist");
            java.util.ArrayList<String> employeelist=(java.util.ArrayList<String>)session.getAttribute("empllist");
            System.out.println("listlistlist"+session.getAttribute("rooomlist"));
            System.out.println("emplistemplist"+session.getAttribute("empllist"));
        %>
        
        <td>Room	:
        </td>
        <td>
            
            <select name = "roomList" size ="3"  id ="roomlist">
                
                <%
                for(int i=0;i<list.size();++i){
                %>
                <option value = "<%=i%>"><%=list.get(i)%></option>
                
                <%}%>
            </select>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" value="Add" id='add' onclick="addtoList()">
            <input type="hidden" name="optionValue"/>
        </td>
    </tr>
    <tr>
        <td>
            Tentative Meeting dates & rooms	:
        </td>
        <td ><select name="meetingDetails" multiple size="3" id="initiatorlist"  >
                
                <% String[] sessiondate2 = (String[])session.getAttribute("finaldatelist");
                System.out.println("sessiondate2:"+sessiondate2.length);%>
                <% for(int i=0;i<sessiondate2.length;i++) {
                    System.out.println("sessiondate2:"+sessiondate2[i]);
                %>
                <option value = "<%=sessiondate2[i]%>"><%=sessiondate2[i]%></option>
                
                <%}%>
                
            </select>
            &nbsp;&nbsp;
           <% 
            ArrayList<ArrayList<String[]>> totallist = new ArrayList<ArrayList<String[]>>();
            totallist =  (ArrayList<ArrayList<String[]>>)session.getAttribute("totallist");%>
            <input type="button" value="Delete" onclick="testDelete()"/>
        </td>
    </tr>
    
    
    
    <tr>
        <td>
            &nbsp;
        </td>
        
        <td > <input type ="button" value="Submit" onclick="sendList()"></td>
    </tr>
    <%}%>
    </font>
</table>
</form>
<!--mstheme--></body>
</HTML>
