<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<!--[if lt IE 7 ]><html lang="en" class="ie6 ielt7 ielt8 ielt9"><![endif]--><!--[if IE 7 ]><html lang="en" class="ie7 ielt8 ielt9"><![endif]--><!--[if IE 8 ]><html lang="en" class="ie8 ielt9"><![endif]--><!--[if IE 9 ]><html lang="en" class="ie9"> <![endif]--><!--[if (gt IE 9)|!(IE)]><!--> 
<html lang="en"><!--<![endif]--> 
	<head>
		<%@include file="/WEB-INF/navigation/JsAndCss.jsp" %>
		<script type="text/javascript" language="javascript">
		function seleCategory(){
		    var id= $("select[name='categoryId']").val();
		    $.post("seleCategory.do",{"categoryId":id},function(data){
		        var select01=document.form.select01;
		        select01.length=1;
		        if(data!=null){
		            for(var i=0;i<data.length;i++){
		                select01[i+1]=new Option(data[i].title,data[i].subclassId);
		            }
		        }
		        }
		    );
		}
		function seleSelect02(){
		    var pid= $("select[name='select01']").val();
		    $.post("selectSubclass.do",{"pid":pid},function(data){
		        var select02=document.form.select02;
		        select02.length=1;
		        if(data!=null){
		            for(var i=0;i<data.length;i++){
		                select02[i+1]=new Option(data[i].title,data[i].subclassId);
		            }
		        }
		        }
		    );
		}
		function seleSelect03(){
		    var pid= $("select[name='select02']").val();
		    $.post("selectSubclass.do",{"pid":pid},function(data){
		        var select03=document.form.select03;
		        select03.length=1;
		        if(data!=null){
		            for(var i=0;i<data.length;i++){
		                select03[i+1]=new Option(data[i].title,data[i].subclassId);
		            }
		        }
		        }
		    );
		}
		</script>
	</head>
	<body>
		<div class="container">
			<div class="navbar">
				<div class="navbar-inner">
					<%@include file="../navigation/menu.jsp"%>
				</div>
			</div>
			<div class="row">
				<%@include file="../navigation/navigation.jsp"%>
				<div class="span9">
					<form method="post" action="addSubclass.do" name="form">
						<fieldset>
						   <legend>新增分类</legend>
							<div class="control-group">
								<label class="control-label" for="input01">类别名称</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="title" value=""/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="select00">类别</label>
								<div class="controls">
								 <select id="select00" name="categoryId" readonly> <option value="">-- 选择类型 --</option>
								      <c:forEach items="${category}" var="c">
								       <option value="${c.categoryId}"
								       <c:if test="${c.categoryId==categoryId}">selected</c:if>
								       >${c.title}</option>
								      </c:forEach>
									</select> 
									
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="select01">父类型</label>
								<div class="controls">
								 <select id="select01" name="select01" onchange="seleSelect02()"> <option value="">-- 选择类型 --</option> 
									<c:forEach items="${subclass}" var="s">
									<option value="${s.subclassId}">${s.title}</option>
									</c:forEach>
									</select> 
									 <select id="select02" name="select02" onchange="seleSelect03()"> <option value="">-- 选择类型 --</option> 
									
									</select> 
									 <select id="select03" name="select03" > <option value="">-- 选择类型 --</option> 
									
									</select> 
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="textarea">说明</label>
								<div class="controls">
									<textarea class="input-xlarge" id="textarea" rows="5" name="description"></textarea>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input02">是否有效</label>
								<div class="controls">
									<input type="checkbox" class="input-xlarge" id="input02" name="status" value="1"/>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="input03">排序ID</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input03" name="sortId" />
								</div>
							</div>
							<div >
								<input type="submit" value="确定"/>
								<input type="button" value="返回" onclick="history.back();"/>
							</div>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>