﻿// JScript File
// parses date string in format dd/MM/yyyy and returns Date object
function parseDate2(date)
      {
         var d = new String(date);
         var slash = d.indexOf("/");
         var day = d.substr(0, slash);
         //alert(day);
         d = d.substr(slash+1, d.length-slash-1);
         slash = d.indexOf("/");
         var month = d.substr(0, slash);
         month = parseInt(month, 10) - 1;
         //alert(month);
         d = d.substr(slash+1, d.length-slash-1);
         var year = d;     
         //alert(year);
         var dateObj = new Date();
         dateObj.setFullYear(year, month, day);
        // alert(dateObj);
         return dateObj;
      }

function parseDate3(date)
      {
      
         var d = new String(date);
         var slash = d.indexOf("/");
         var month = d.substr(0, slash);
         //alert(day);
         d = d.substr(slash+1, d.length-slash-1);
         slash = d.indexOf("/");
         var day = d.substr(0, slash);
         day = parseInt(day, 10);
         //alert(month);
         d = d.substr(slash+1, d.length-slash-1);
         var year = d;     
         //alert(year);
         //var dateObj = new Date();
         //dateObj.setFullYear(year, month, day);
        // alert(dateObj);
         //return dateObj;
         return day + "/" + month + "/" +year;
       }
       
    function GetDateFormat(date,_daysAdd)
    {
         //copy the date from + 7 days
           var _fromDateObj  = parseDate2(date); //convert to date object
        //alert("_fromDate " + _fromDate);
        //alert("_fromDateObj " + _fromDateObj);
           var _fromDateObj1= parseInt(_fromDateObj.getMonth() + 1).toString() + "/" + parseInt(_fromDateObj.getDate()+_daysAdd) + "/" + _fromDateObj.getFullYear(); // '12/25/2006'; 
           return  parseDate3(_fromDateObj1);
          // alert("_fromDateObj2 " + _fromDateObj2); 
    }