﻿function ClearDropDownOptions(DropDownControl) { for (index = DropDownControl.options.length - 1; index > 0; index--) { DropDownControl.remove(index) } } function DatePickerEnabled(datePickerControlId, enable) { if (enable) { jQuery("#" + datePickerControlId).datepicker("enable") } else { jQuery("#" + datePickerControlId).datepicker("disable") } } function AddDaysToDate(sourceDate, daysNumber, incrementDays) { var updatedDate = new Date(); updatedDate.setFullYear(sourceDate.getFullYear(), sourceDate.getMonth(), sourceDate.getDate()); if (incrementDays) { updatedDate.setDate(updatedDate.getDate() + daysNumber) } else { updatedDate.setDate(updatedDate.getDate() - daysNumber) } return updatedDate } function UpdateDate(DatePickerControlId, sourceDate, daysNumber, incrementDays) { var updatedDate = AddDaysToDate(sourceDate, daysNumber, incrementDays); jQuery("#" + DatePickerControlId).datepicker("setDate", updatedDate) } function CalculateDifferencesBetweenTwoDates(startDate, endDate) { if (startDate > endDate) { return -1 } var one_day = 1000 * 60 * 60 * 24; return Math.round((endDate.getTime() - startDate.getTime()) / (one_day)) } function RefreshPeriodDetails(nightCountRowControlId, startDate, endDate, dayNames) { var nightCountRow = document.getElementById(nightCountRowControlId); var nightCountSpan = document.getElementById("nightCountSpan"); var startWeekDayRow = document.getElementById("startWeekDayRow"); var endWeekDayRow = document.getElementById("endWeekDayRow"); startWeekDayRow.innerHTML = dayNames[startDate.getDay()]; endWeekDayRow.innerHTML = dayNames[endDate.getDay()]; var nightsCount = CalculateDifferencesBetweenTwoDates(startDate, endDate); if (nightsCount == -1) { nightCountRow.style.display = "none" } else { nightCountRow.style.display = ""; nightCountSpan.innerHTML = nightsCount } } function AddDropDownOption(dropDownControl, text, value) { var option = document.createElement("option"); option.text = text; option.value = value; dropDownControl.options.add(option) } function ValidateForm(ValidationGroup) { var isValid = Page_ClientValidate(ValidationGroup); if (isValid) { SetWaitingView(true); jQuery(function () { jQuery("#s4-workspace").css({ cursor: "wait" }) }); return true } else { SetWaitingView(false); jQuery(function () { jQuery("#s4-workspace").css({ cursor: "default" }) }); return false } };
