﻿function SetCheckOutDate(ciExtId, coExtId)
{
    var ciExt = $find(ciExtId); 
    var coExt = $find(coExtId); 
    if (ciExt != null && coExt != null)
    {
        coExt._selectedDate = ciExt._selectedDate;
    }
}

function todayValidate(oSrc, args) 
{
    //debugger;
    var d = new Date(args.Value);
    var today = new Date();
    today.setHours(0, 0, 0, 0);

    args.IsValid = d >= today;
}

function validateDate(oSrc, args)
{
    var iDay, iMonth, iYear;
    var arrValues;
    arrValues = args.Value.split("/");
    iMonth = arrValues[0];
    iDay = arrValues[1];
    iYear = arrValues[2];

    var testDate = new Date(iYear, iMonth - 1, iDay);
    if ((testDate.getDate() != iDay) ||
      (testDate.getMonth() != iMonth - 1) ||
      (testDate.getFullYear() != iYear))
    {
         args.IsValid = false;
         return false;
    } 
    args.IsValid = true;
    return true;
}
