anchor.diff:  			data: {id: <%=id%>},
   			success: function(data) {
   				for (i = 0; i < data.length; i++)
  -					$('#tickettypes').append('<button type="button" class="type" value="'
  -						+ data[i].type +'">' + String.fromCharCode(data[i].type+64) + '</button>');
  +					$("#showtickets").append("<button value='"+ data[i].type + "' "
  +						+ "title='Show "+ String.fromCharCode(data[i].type+64) +" tickets'>"
  +						+ String.fromCharCode(data[i].type+64) + "</button>");
   			}
   		});
   		
   		$.ajax({
   			url: "http://<%=request.getServerName()%>:7001/rms/restaurant",
  -			data: {id: <%=id%>},
  +			data: {id: id},
   			cache: false,
   			success: function(data) {
   				changeStatus(data.availability);
  -				$('#content').append('Welcome to the Reservation Management System of ' + data.name + '.');
  +				$("h2").append("Welcome to the Reservation Management System for " + data.name + ".");
   			}
   		});
   		
   		$(".content").hide();
   		
  -		$(".type").click(function(){
  -		alert();
  -			$('#waitinglist').show();
  -// 			$.ajax({
  -<%-- 				url : "http://<%=request.getServerName()%>:7001/rms/tickets", --%>
  -<%-- 				data: {id: <%=id%>, type: $(this).val()}, --%>
  -// 				cache: false,
  -// 				success: function(data) {
  -// 					//if (data == true) changeStatus($('#status').val() == 'true');
  -// 					for (i = 0; i < data.length; i++);
  -// 						//data[i].
  -// 				}
  -// 			});
  +		$("#showtickets").on("click", "button", function(){
  +			type = $(this).val();
  +			$("h2").text($(this).text() + " Tickets");
  +			$(".content").hide();
  +			$("#waitinglist").show();
  +			showTickets();
  +			$.ajax({
  +				url : "http://<%=request.getServerName()%>:7001/rms/tickettypes",
  +				data: {id: id},
  +				cache: false,
  +				success: function(data) {
  +					if (type == 1) i = 1;
  +					else i = data[type-2].maxSize + 1;
  +					$("#add").empty();
  +					$("#add").append("<option>Add Ticket</option>")
  +					for (; i <= data[type-1].maxSize; i++)
  +						$("#add").append("<option>" + i + "</option>");
  +				}
  +			});
  +			$("#call").val($(this).val());
  +		});
  +		
  +		$("#add").hover(function(){
  +		    $("#add option:first-child").text("Select Size");
  +		}, function(){
  +		    $("#add option:first-child").text("Add Ticket");
  +		});
  +		
  +		$("#add").change(function(){
  +			$.ajax({
  +				url : "http://<%=request.getServerName()%>:7001/rms/ticket/create",
  +				data: {id: id, type: type, size: $("#add").val()},
  +				cache: false,
  +				success: function(data) {
  +					$("#waitinglistbody").empty();
  +					showTickets();
  +				}
  +			});
  +			$("#add")[0].selectedIndex = 0;
   		});
   		
   		$("#status").click(function(){
   			$.ajax({
   				url : "http://<%=request.getServerName()%>:7001/rms/restaurant/waitinglist",
  -				data: {id: <%=id%>, status: $('#status').val()},
  +				data: {id: id, status: $("#status").val()},
   				cache: false,
   				success: function(data) {
  -					if (data == true) changeStatus($('#status').val() == 'true');
  +					if (data == true) changeStatus($("#status").val() == "true");
   				}
   			});
   		});
  
positive.code: <%@ page language="java" contentType="text/html; charset=UTF-8"
  	pageEncoding="UTF-8"%>
  <%!
  	int id = 2;
  %>
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <html>
  
negative.code: <script
  	src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  <script>
  	var id = <%=id%>, type;
  	function showTickets(){
  		$("#waitinglistbody").empty();
  		$.ajax({
  			url : "http://<%=request.getServerName()%>:7001/rms/tickets",
  			data: {id: <%=id%>, type: type},
  			cache: false,
  			success: function(data) {
  				for (i = 0; i < data.length; i++){
  					str = "<tr>"
  						+ "<td>" + data[i].number + "<td>"
  						+ "<td>" + data[i].size + "<td>"
  						+ "<td>" + toTime(data[i].getTime) + "<td>"
  						+ "<td>";
  					if (data[i].callTime != null){
  						str += toTime(data[i].callTime);
  					}
  					str += "</td></tr>";
  					$("#waitinglistbody").append(str);
  				}
  			}
  		});
  	}
  	
  	function changeStatus(availability){ 
  		if (availability == false){
  			$("#status").val("true");
  			$("#status").text("Start");
  			$("#status").attr({"title" : "Start distributing tickets"});
  		}
  		else{
  			$("#status").val("false");
  			$("#status").text("Stop");
  			$("#status").attr({"title" : "Stop distributing tickets"});
  		}
  	}
  	
  	var date = new Date();
  	function toTime(timestamp){
  		date.setTime(timestamp);
  		return ("00" + date.getHours()).slice(-2) + ":" + ("00" + date.getMinutes()).slice(-2);
  	}
  	
  	$(document).ready(function() {
  