<%@ page session="false" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
	<title>IHTA Registration</title>
	<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"></META>
	<link rel="stylesheet" type="text/css" href="css/reset-fonts-grids.css">
	<link rel="stylesheet" type="text/css" href="css/ccht-global-style.css">
	<link rel="shortcut icon" href="/ccht/images/ihta_logo.png" type="image/x-icon">
	<script type="text/javascript">
		function setFocus()	
		{
			if( document.getElementById('visn') ) 
			{
				document.getElementById('visn').focus();
			}
			else if( document.getElementById('facility') )
			{
				document.getElementById('facility').focus();
			}
			else if( document.getElementById('vendor') )
			{
				document.getElementById('vendor').focus();
			}
		}
		function hide(id_show,id_hide,hide_element) 
		{
			document.getElementById(id_show).style.display = 'inline-block';
			document.getElementById(id_hide).style.display = 'none';
			document.getElementById(hide_element).value="";
		}		
	</script>
</head>
<body onload="setFocus()">
	<div id="doc4">
		<div id="hd">
			<jsp:include page="ccht_header.jsp"/>
		</div>
		<div id="bd">
			<table width="100%" border="0">
			    <tr>
			    	<td align="center" valign="top">
			    		<form:form modelAttribute="command" action="register_2.html" method="post" name="registrationForm">
						<table align="left" width="100%" border="0" cellpadding="0" cellspacing="3">
						<tr><td><img src="/ccht/images/spacer.gif" height="3" alt=""></td></tr>
					    <tr>
							<td align="left" valign="top">
								<c:if test="${visnRequired}">
									<c:if test="${visnRequired}">
										<span class="bodyTextBold">Please select either a VISN or a facility to register.</span>
									</c:if>
								</c:if>
								<c:if test="${empty visnRequired}">
									<c:if test="${facilityRequired}">
										<span class="bodyTextBold">Please select a facility to register.</span>
									</c:if>
								</c:if>
								<c:if test="${vendorRequired}">
									<span class="bodyTextBold">Please select a vendor to register.</span>
								</c:if>
							</td>
					    </tr>
					    <tr>
							<td align="left" valign="top">
								<table align="left" border="0" cellpadding="0" cellspacing="0">
								  <tr>
								      <td class="error">
					      		      	<a href=# class="errorLink">
											<span class="errorMessage" id="error">
												<form:errors path="*" id="error" htmlEscape="false" class="errorMessage"/>
								      		</span>
							      		</a>
								      </td>
								  </tr>
								</table>
							</td>
					    </tr>
						<tr><td><img src="/ccht/images/spacer.gif" height="3" alt=""></td></tr>
						<tr>
							<td align="center" valign="top">
								<form:hidden path="username" value="${username}"/>
								<form:hidden path="description" value="${description}"/>
						    	<table width="100%" border="2" cellpadding="0" cellspacing="0">
								<tr>
									<td>
								    	<table width="100%" border="0" cellpadding="0" cellspacing="5">
										<c:if test="${visnRequired}">
											<tr>
												<td align="right" width="50%" height="25" valign="middle"><span class="bodyTextBold">VISN :&nbsp;</span><span id="visn_field" style="display:inline-block" class="requiredField">*&nbsp;</span></td>										
												<td align="left" width="50%" height="25" valign="middle">
													<form:select path="visn" id="visn" name="visn" onchange="hide('visn_field','facility_field','facility')">
												    	<form:option value="" label="Select"/>
												    	<form:options items="${visns}" itemValue="name" itemLabel="name"/>
												    </form:select>
												    <input type="hidden" name="visnRequired" value="true"/>
												</td>
											</tr>
										</c:if>			    	
										<c:if test="${facilityRequired}">
											<tr>
												<td align="right" width="50%" height="25" valign="middle"><span class="bodyTextBold">Facility :&nbsp;</span><span id="facility_field"  style="display:inline-block" class="requiredField">*&nbsp;</span></td>										
												<td align="left" width="50%" height="25" valign="middle">
													<form:select path="facility" id="facility" name="facility" onchange="hide('facility_field','visn_field','visn')">
												    	<form:option value="" label="Select"/>
												    	<form:options items="${facilities}" itemValue="stationNumber" itemLabel="description"/>
												    </form:select>
												    <input type="hidden" name="facilityRequired" value="true"/>
												</td>
											</tr>							
										</c:if>			    	
										<c:if test="${vendorRequired}">
				                            <tr>
												<td align="right" width="50%" height="25" valign="middle"><span class="bodyTextBold">Vendor :&nbsp;</span><span class="requiredField">*&nbsp;</span></td>										
												<td align="left" width="50%" height="25" valign="middle">
													<form:select path="vendor" id="vendor" name="vendor" onchange="hide('facility_field','visn_field','visn')">
												    	<form:option value="" label="Select"/>
												    	<form:options items="${vendors}" itemValue="name" itemLabel="name"/>
												    </form:select>			
												    <input type="hidden" name="vendorRequired" value="true"/>					    
												</td>
											</tr>													
										</c:if>			    	
										<tr>	
											<td align="right" width="50%" valign="middle" style="padding-top: 5px;" nowrap>
												<input type="image" src="/ccht/images/btn_register.jpg" alt="Register"/>
											</td>
											<td align="left" width="50%" valign="middle" style="padding-top: 5px;" nowrap>
												<a href="/ccht/register_1"><img src="/ccht/images/btn_cancel.jpg" alt="Cancel"/></a>
											</td>					
										</tr>
									    </table>
									</td>
								</tr>
								</table>
							</td>
					    </tr>
					  	</table>
					  	</form:form>
			      	</td>
			      </tr>
 				  <tr><td><img src="/ccht/images/spacer.gif" alt="" height="3"></td></tr>
			      <tr>
					<td align="center" valign="middle">
						<a href="/help/register/index.html" target="_blank">Registration Help</a>
					</td>
			      </tr>
			  </table> 
		</div>
		<div id="ft">
			<jsp:include page="ccht_footer.jsp"/>
		</div>	 
	</div>   
</body>
</html>