function ClearDropDownOptions(a){for(index=a.options.length-1;index>0;index--){a.remove(index)}}function ClearDropDownOptionGroups(a){jQuery("#"+a.id).children().remove("optgroup")}function DatePickerEnabled(a,b){if(b){jQuery("#"+a).datepicker("enable")}else{jQuery("#"+a).datepicker("disable")}}function AddDaysToDate(a,b,d){var c=new Date();c.setFullYear(a.getFullYear(),a.getMonth(),a.getDate());if(d){c.setDate(c.getDate()+b)}else{c.setDate(c.getDate()-b)}return c}function UpdateDate(d,a,b,e){var c=AddDaysToDate(a,b,e);jQuery("#"+d).datepicker("setDate",c)}function GetDateDifferenceDays(b,a){return(a-b)/(1000*60*60*24)}function CalculateDifferencesBetweenTwoDates(a,c){if(a>c){return -1}var b=1000*60*60*24;return Math.round((c.getTime()-a.getTime())/(b))}function RefreshPeriodDetails(b,e,a,f,c,h,d){var l=document.getElementById(f);var j=document.getElementById(c);var g=document.getElementById(h);var i=document.getElementById(d);g.innerHTML=a[b.getDay()];i.innerHTML=a[e.getDay()];var k=CalculateDifferencesBetweenTwoDates(b,e);if(k==-1){l.style.display="none"}else{l.style.display="";j.innerHTML=k}}function GetOptionGroupControl(b,a){var c=jQuery("#"+b.id).find('optgroup[label="'+a+'"]').first();if(c==null||c.length==0){AddDropDownOptionGroup(b,a);c=jQuery("#"+b.id).find('optgroup[label="'+a+'"]').first()}return c}function AddDropDownOptionGroup(a,b){var c="<optgroup label='"+b+"'></optgroup>";jQuery("#"+a.id).append(c)}function AddDropDownOption(c,f,d,a){if(a==null||a==undefined){var b="<option value='"+d+"'>"+f+"</option>";jQuery("#"+c.id).append(b)}else{var b="<option value='"+d+"'>"+f+"</option>";var e=GetOptionGroupControl(c,a);e.append(b)}}function ValidateForm(c,a){var b=Page_ClientValidate(c);RefreshErrorInfoVisibility(null,a);if(b){SetWaitingView(true);jQuery(function(){jQuery("body").css({cursor:"wait"})});RefreshErrorInfoVisibility(null,a);return true}else{SetWaitingView(false);jQuery(function(){jQuery("body").css({cursor:"default"})});return false}};
