Add last date into current add task in lightbox popup.

I am getting problem is that when I want to add new task so by default click task date will be shown in lightbox, but I want that what task is having date for last task should be the start date of new task in the light box and auto select date for start date in light box.
I have tried many times for solve this problem.
but no luck, please help me ASAP, It’s very urgent to me, please, please

sample code given below:


Basic initialization

<script type="text/javascript" src="../common/testdata.js"></script>
<style type="text/css">
	html, body{ height:100%; padding:0px; margin:0px; overflow: hidden;}
var tasks = { data:[ {id:1, text:"Project #2", start_date:"01-04-2013", duration:18,order:10, progress:0.4, open: true}, {id:2, text:"Task #1", start_date:"05-04-2013", duration:8, order:10, progress:0.6, parent:1}, {id:3, text:"Task #2", start_date:"11-04-2013", duration:8, order:20, progress:0.6, parent:1} ], links:[ { id:1, source:1, target:2, type:"1"}, { id:2, source:2, target:3, type:"0"}, { id:3, source:3, target:4, type:"0"}, { id:4, source:2, target:5, type:"2"}, ] };


you can amend a date of newly created task using onTaskCreated event. In the handler you can select end date of the latest task, and make this date the the start date of the new task. Here is the code

[code]gantt.attachEvent(“onTaskCreated”, function(task){
var tasks = gantt.getTaskByTime(),
last_date = 0;

for(var i=0; i < tasks.length; i++){//get latest task
	if(tasks[i].end_date.valueOf() > last_date){
		last_date = tasks[i].end_date.valueOf();
if(last_date > 0){
	task.start_date = new Date(last_date);

});[/code] … event.html