var d 	= new Date();
var nd 	= new Date(d.getFullYear(),d.getMonth(),d.getDate()+1,d.getHours()-1,d.getMinutes(),d.getSeconds());
if(datePickerDateFormat=='dd-mm-yy') {
    datePickerDateFormat = 'DD-MM-YYYY';
} else if(datePickerDateFormat=='yy-mm-dd') {
    datePickerDateFormat = 'YYYY-MM-DD';
} else if(datePickerDateFormat=='mm/dd/yy') {
    datePickerDateFormat = 'MM/DD/YYYY';
}
$(function() {
    
   
    function cb(start, end) {
        //$('#businessDate').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
        $('#businessDate').html(start.format(datePickerDateFormat) + ' - ' + end.format(datePickerDateFormat));
        
    }
    //alert("A "+moment())
    cb(moment().subtract(29, 'days'), moment());
   
    $('#businessDate').daterangepicker({
        ranges: {
           [lblToday]: [moment(), moment()],
           [lblYesterday]: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
           [lblLast7Days]: [moment().subtract(6, 'days'), moment()],
           [lblLast30Days]: [moment().subtract(29, 'days'), moment()],
           [lblThisMonth]: [moment().startOf('month'), moment().endOf('month')],
           [lblLastMonth]: [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
        },
		 locale: {
                     
      format: datePickerDateFormat,
    
          cancelLabel: cancelLabel,
          applyLabel: applyLabel,
		  customRangeLabel: customRangeLabel
      }
    }, cb);
});
	
$('.ui-daterangepicker-dateRange').addClass('ui-state-active');	
 $(function(){
		 $("#searchProduct").click(function(){
		if($.trim($('#businessDate').val())!=""){
		/* 	date = $.trim($('#businessDate').val());
			string = date.split(' - ');
			 var count = string.length;
			 string[1]= Date.parse(string[1]); 
			 string[0]= Date.parse(string[0]); 
			if((count !='1') && (string[0] > string[1])) {
			jAlert($("#searchAlert").val());
                           return false;
		   } else {
                            return true;  
		   } */
		}
         });
	 });
	 $('.main_menu li a[rel=payment]').addClass('active');	
