<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
    <HEAD>
        <TITLE> Schedule 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>
        
        <!-- 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 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 addDateTime(){
                var startdate=document.getElementById("sel2").value;
                var enddate=document.getElementById("sel3").value;
                var currDate=new Date();
                
                
                if(document.getElementById("datechoice").options.length<3){
                    if(startdate==""||enddate==""){
                        alert("Date field should not be empty")
                    }
                    
                    else{
                        var st=startdate.substring(0, startdate.indexOf("["));
                        var sttime=startdate.substring(startdate.indexOf("[")+1, startdate.indexOf("]"))
                        var startDate=st+" "+sttime;
                        var dt=new Date(startDate);
                        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");
                    }
            }
            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="Roomlist?type="+value+"&startdatetime="+startdatetime+"&enddatetime="+enddatetime;
            }
             function findRoomsUsingList(){
                var seltype=document.getElementById('roomtype');
                var value=seltype.options[seltype.selectedIndex].text;
               
                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;
                }
                location.href="Roomlist?type="+value+"&datetimelist="+datetimelist+"&agenda="+document.getElementById("txtAgenda").value;
            }
            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 background="_themes/aftrnoon/background_aftrnoon.gif" bgcolor="#FFFFFF" text="#000000" link="#983738" vlink="#703637" alink="#C76565"><!--mstheme-->
            
        <form action="NewMeeting" 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>
                                New 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>
            <table cellpadding = "10" align="center" width="80%">
                <font size="3">
                    <tr>
                        <td>
                            Agenda :
                        </td>
                        <td nowrap>
                            <%
                            if(request.getParameter("agenda")==null){
                                
                            %>
                            <input type="text" name="txtAgenda" id="txtAgenda" size="50">	
                            <%}
                            else{%>
                                <input type="text" name="txtAgenda" id="txtAgenda" readonly size="50" value="<%=request.getParameter("agenda")%>">	
                            <%}%>
                            
                            
                        </td>
                    </tr>
                     <%
                                if((request.getAttribute("list")==null)||(request.getAttribute("emplist")==null)){
                            %>
                    <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>
                    <%
                                if((request.getAttribute("list")==null)||(request.getAttribute("emplist")==null)){
                            %>
                   
                    <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>
                    <%}%>
                    
                    
                    <tr>
                        <%
                        if((request.getAttribute("list")!=null)||(request.getAttribute("emplist")!=null)){
                                java.util.ArrayList<String> list=(java.util.ArrayList<String>)request.getAttribute("list");
                                java.util.ArrayList<String> employeelist=(java.util.ArrayList<String>)request.getAttribute("emplist");
                                
                            %>
                        <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"  >
                               
                               </select>
                            &nbsp;&nbsp;
                             <input type="button" value="Delete" onclick="testDelete()"/>
                        </td>
                   </tr>
                    
                    <tr>
                        <td>
                            Please select the participants from the List	:
                        </td>
                        <td colspan="2">
                            <select name="emplist" size="3" multiple ="multiple" >
                                <%
                                    for(int i=0;i<employeelist.size();++i){%>
                                    <option value="<%=i%>"><%=employeelist.get(i)%></option>
                                    <%}%>
                               
                            </select>
                            
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <input type="checkbox" value="Active" id="active">Active
                            
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            
                            <input type="button" value="Add" onclick="addtoparticipantList()">
                        </td>
                        
                    </tr>
                    <tr>
                        <td>
                            Active Participants         :
                            
                            
                        </td>
                        
                        <td>
                            
                            <select name="activelist" size="3" multiple ="multiple"  id="activelist">
                                </select>
                            &nbsp;
                            <input type="button" value="Delete" onclick="removeActiveParticipant()"/>
                            
                        </td>
                        
                        
                    </tr>
                    <tr>
                        <td>
                            Participants         :
                        </td>
                        <td>
                            <select name="participantlist" size="3" multiple ="multiple" id="participantlist" >
                                
                             </select>
                            &nbsp;
                            <input type="button" value="Delete" onclick="removeParticipant()"/>
                        </td>
                        
                        
                    </tr>
                    
                             <tr>
                        <td>
                            &nbsp;
                        </td>
                        
                        <td > <input type ="submit" value="Submit"></td>
                    </tr>
                    <%}%>
                </font>
            </table>
        </form>
    <!--mstheme--></body>
</HTML>
