
$(document).ready(function()
 {
	 time=0;
	 $(".submit").click(function(){
			obj = $(".validForm").FValidate();
			if($("#B_year").val()=='' || $("#B_month").val()=='' ||  $("#B_day").val()=='')
			{ obj.msg+="Enter Your Birth Date"+"<br/>";obj.res=false;}
			if($("#S_year").val()=='' || $("#S_month").val()=='' ||  $("#S_day").val()=='')
			{obj.msg+="Enter Your Start Date"+"<br/>";obj.res=false;}
			 clearTimeout(time);
			 if(obj.msg!='')
			$(".errorDiv").siMsg({Msg : obj.msg , timeout : 6000, icon : 'error'});
			 return obj.res;
	});
		 
		$("#B_date").css({'width':'0px','height':'0px'});
		$("#S_date").css({'width':'0px','height':'0px'});
		$("#B_date").datepick({dateFormat: 'yyyy-mm-dd',yearRange:'1950 : 2011',onSelect:function(){CalDate('B');}});
		$("#S_date").datepick({dateFormat: 'yyyy-mm-dd',yearRange:'2011 : 2020',onSelect:function(){CalDate('S');}});
		$("#AB_date").click(function(){$("#B_date").focus();})
		$("#AS_date").click(function(){$("#S_date").focus();})
	
});
	  
//-------------------------CalDate
function CalDate(x)
{
	var date =  $("#"+x+"_date").val();	
	var year = date.substr(0,date.indexOf('-'));	
	var temp =date.substr(date.indexOf('-'));
	var month = temp.substr(1,date.indexOf('-')-2);	
	var day = temp.substr(date.indexOf('-'));
	$("#"+x+"_year").val(year);
	$("#"+x+"_month").val(month);
	$("#"+x+"_day").val(day);
}
