HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Tue, 12 Apr 2016 06:23:24 GMT
Content-Type: application/javascript
Content-Length: 2355
Date: Fri, 15 Apr 2016 12:05:49 GMT

function sendAjax() {
	$.ajax({
		type : "GET",
		url : "/GanttView/list",
		cache : false,
		dataType : 'json',
		contanttype : 'application/json',
		async : false,
		success : function(data) {

			//var ddate=[];
			ddate = new Array(data.length);
			//alert(data.length);
			//alert(ddate.length);
			for(var i=0;i<data.length;i++)
			{
				var date1 = new Date(data[i]);
				if(date1.getDate()<10)
				{
					var day="0" + date1.getDate();
				}
				else
				{
					var day=date1.getDate();
				}



				if ((date1.getMonth() + 1) < 10) {
					var month = "0" + (date1.getMonth() + 1);
				} 
				else {
					var month = (date1.getMonth() + 1);
				}
				var date2 = day + "/" + month + "/"+ date1.getYear();
				ddate[i] = date2;
			}
			//var date1 = new Date(data[0]);
			//var date2 = date1.getDate() + "/" + (date1.getMonth() + 1)	+ "/" + date1.getYear();
			//alert(ddate[0]);
		}
	});
}

function GetForm() {
	method = "get";
	path = "/GanttView/AddConstraint";
	//var form = document.createElement("form");
	//form.setAttribute("method", method);
	//form.setAttribute("action", path);
	//document.body.appendChild(form);
	//form.submit();
	window.open("/GanttView/AddConstraint", 'window', 'width=200,height=100');

}

$(document).ready(
		function() {

			sendAjax();
			
			//alert(ddate);
			$(function() {
				$("#datepicker").datepicker();
			});
		});

$(document).ready(function() {
	$(function() {
		$("#datepicker1").datepicker({
			onSelect : function(date) {
				// Your CSS changes, just in case you still need them        
				//alert('select!');
				//GetForm();
			}
		});
	});

	//tips are optional but good to have
	var tips = [ 'some description',
	             'some rer other description' ];
	
	$(function() {
		$("#datepicker3").datepicker({
			
			dateFormat : 'dd/mm/yy',
			beforeShowDay : function(date) {
				var datestring = jQuery.datepicker.formatDate('dd/mm/yy', date);
				var hindex = $.inArray(datestring,ddate);
				if (hindex > -1) {
					return [ true, 'highlight',tips[hindex] ];
				}

				return [ hindex == -1 ];
			},
			onSelect : function(date) {
				// Your CSS changes, just in case you still need them        
				//alert('select!');
				GetForm();
				alert('select!');
			}

		});
	});
});
