<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<script>
	function updateExample() {
		var ex = document.getElementById("exampleText");
		ex.style.color = document.getElementById("fgColour").value;
		ex.style.backgroundColor = document.getElementById("bgColour").value;
	}
</script>
<smvc:form modelAttribute="subscriptionForm" id="form" action="../calendar/subscription.form" method="post">
	<%@ include file="../../tiles/colorPickerPopup.jsp" %>
	<input type="hidden" name="redirectParams" value="<c:out value="${requestScope['javax.servlet.forward.query_string']}" />" />
	<table>
		<tr>
			<td>
				<tags:dialogBox title="Edit Subscription">
					<table>
						<tr>
							<td class="label">Name</td>
							<td class="input"><smvc:input path="subscription.name" maxlength="255"/></td>
						</tr>
						<tr>
							<td class="label">Foreground colour</td>
							<td class="input">
								<smvc:input path="subscription.fgColour" maxlength="30" id="fgColour"/>
								<a  onclick="javascript:openColorPickerPopup('fgColour');">
									<img src="../images/16x16/colorpicker.png"/>
								</a>
							</td>
						</tr>
						<tr>
							<td class="label">Background colour</td>
							<td class="input">
								<smvc:input path="subscription.bgColour" maxlength="30" id="bgColour"/>
									<a onclick="javascript:openColorPickerPopup('bgColour');">
									<img src="../images/16x16/colorpicker.png"/>
								</a>
							</td>
						</tr>
						<tr>
							<td colspan="2" class="label" align="center" onmouseover="updateExample()">
								<span id="exampleText" style="padding: 2 2 2 2;color:${subscriptionForm.subscription.fgColour};background-color:${subscriptionForm.subscription.bgColour}">aAbBcCdDeEfFgG123456</span>
							</td>
						</tr>
						<tiles:insertTemplate template="editSub_${subscriptionForm.subscription.implementationClass}.jsp"/>
						<tr>
							<td colspan="2" align="right"><input type="submit" value="Save"/></td>
						</tr>
					</table>
				</tags:dialogBox>			
			</td>
		</tr>
	</table>
</smvc:form>
