<%-- 
/**
  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
  *
  * 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 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
  *
  * Component of: Red Hat Application Server
  * 
  * Initial Developers: Aizaz Ahmed
  *                     Vivek Lakshmanan
  *                     Andrew Overholt
  *                     Matthew Wringe
  * Developers: Greg Lapouchnian
  * 			Patrick Smith
  */
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<SCRIPT LANGUAGE="JavaScript" SRC="<c:url value="/general/moduser.js"/>"></SCRIPT>

<jsp:include page="common/header.jsp" />

    <!-- Content begins here -->

    <div id="form">

    <jsp:include page="messages.jsp" />

    <!-- Include the form itself -->
    <form class="modForm" action="<c:url value="/store/editUser.do"/>" method="post">
    
    <div class="formheader">
        <span>Account Information for <c:out value="${command.user.username}"/></span>
    </div>

	<!-- include the form that is shared with the register.jsp -->
	<jsp:include page="common/userForm.jsp" />
    
    
   <div class="row">
		<table>
			<tr><th>All Users</th><th></th><th>Your Friends</th></tr>
			<tr><td>
			<select id="allUsers" name="allUsersListSelected" size="10" multiple="true" style="WIDTH:200px"
				ondblclick="move('allUsers', 'friendsList')">
					<c:forEach var="user" items="${command.user.allUsersList}">
						<option value="<c:out value="${user}"/>"><c:out value="${user}"/></option>
					</c:forEach>
			</select>
			</td><td>

			<table>
				<tr><td>
				<input type="button" value=">" name="AddFriends"
					onclick="move('allUsers', 'friendsList')"/>
				</td></tr><tr><td>
				<input type="button" value="<" name="RemoveFriends"
					onclick="move('friendsList', 'allUsers')"/>
				</td></tr>
			</table>

			</td><td>
			<spring:bind path="command.user.friendsListSelected">
			  	<select id="friendsList" name="<c:out value="${status.expression}"/>" size="10" multiple="true" style="WIDTH:200px"
					ondblclick="move('friendsList', 'allUsers')">
				   <c:forEach var="user" items="${command.user.friendsList}">
							<option value="<c:out value="${user}"/>"><c:out value="${user}"/></option>
				   </c:forEach>
				</select>
			</spring:bind>
			</td></tr>
		</table>
	</div>

<p/>
<div class="spacer"></div>
	<p/>
	<input onclick="selectAll()" type="submit" name="save-user" value="Save"/>

    </form>

    <!-- This is necessary to force the parent to expand and include floating divs -->
    <br style="clear:both">
</div>

<jsp:include page="common/footer.jsp" />