function insertYearsIntoDropdown(E,H,B,I,F,D,C){var A=E.options;if(F!=-1&&F!=0){if(F<D){D=F}if(F>C){C=F}}A.length=0;if(H){A[0]=new Option(B,0,false,false)}for(var G=D;G<=C;G++){A[A.length]=new Option(G,G,false,false)}A[A.length]=new Option(I,"other",false,false);if(F!=-1){E.selectedIndex=F-D+(H?1:0)}else{E.selectedIndex=0}}function selectYearFromDropdown(E,D,C,H,A,F,G){if(E.options[E.selectedIndex].value!="other"){return true}var B=prompt("Please enter a year:",A==0?"":A);if(B+0<1900){B=A}insertYearsIntoDropdown(E,D,C,H,B,F,G);return true}function DatePicker_GetPointer(xiSomeHandle){if(!xiSomeHandle){return false}if(typeof (xiSomeHandle)=="string"){xiSomeHandle=GetElementInDocument(xiSomeHandle)}if(typeof (xiSomeHandle)!="object"){return false}if(xiSomeHandle.firstChild&&xiSomeHandle.firstChild.JavascriptPointerVarName){xiSomeHandle=xiSomeHandle.firstChild}if(xiSomeHandle.JavascriptPointerVarName){xiSomeHandle=eval(xiSomeHandle.JavascriptPointerVarName);if((!xiSomeHandle)||(typeof (xiSomeHandle)!="object")){return false}}return xiSomeHandle}function DatePicker_GetSelectedDate(G){var B=DatePicker_GetPointer(G);if(!B){return false}if(B.getDateTextBox()){if(B.getDateTextBox().value==""||B.getDateTextBox().value==B.DateFormatUserPrompt){return null}var F=B.getDateTextBox().value.split("/");if(F[0]!=null&&DatePicker_IsNonNegativeInteger(F[0])&&F[1]!=null&&DatePicker_IsNonNegativeInteger(F[1])&&F[2]!=null&&DatePicker_IsNonNegativeInteger(F[2])){var E=(F[2]-0);E=(E<100)?(E+2000):E;return DatePicker_MakeNewDate(E,F[1]-1,F[0]-0)}else{return false}}var C="",D="",A="";if(B.getDayTextBox()){if(B.getDayTextBox().value!=""){C=B.getDayTextBox().value-0}}else{if(B.getDayDropDown()){if(B.getDayDropDown().value!="0"){C=B.getDayDropDown().value-0}}else{return false}}if(B.getMonthTextBox()){if(B.getMonthTextBox().value!=""){D=B.getMonthTextBox().value-1}}else{if(B.getMonthDropDown()){if(B.getMonthDropDown().value!="0"){D=B.getMonthDropDown().value-1}}else{if(B.getMonthYearDropDown()){if(B.getMonthYearDropDown().value!="-1"){D=DatePicker_getMonthFromEncoding(B.getMonthYearDropDown().value)}}else{return false}}}if(B.getYearTextBox()){if(B.getYearTextBox().value!=""){var E=(B.getYearTextBox().value-0);E=(E<100)?(E+2000):E;A=E.toString()}}else{if(B.getYearDropDown()){if(B.getYearDropDown().value!="0"){A=B.getYearDropDown().value-0}}else{if(B.getMonthYearDropDown()){if(B.getMonthYearDropDown().value!="-1"){A=DatePicker_getYearFromEncoding(B.getMonthYearDropDown().value)}}else{return false}}}if(C==""||(D==""&&D!=0)||A==""){return null}else{if(DatePicker_IsNonNegativeInteger(C)&&DatePicker_IsNonNegativeInteger(D)&&DatePicker_IsNonNegativeInteger(A)){return DatePicker_MakeNewDate(A-0,D-0,C-0)}else{return false}}}function DatePicker_IsNonNegativeInteger(B){if(B==null||B.length==0){return false}var A;for(A=0;A<B.length;A++){if("0123456789".indexOf(B.charAt(A))==-1){return false}}return true}function DatePicker_SetSelectedDate(D,F){var B=DatePicker_GetPointer(F);if(!B){return false}var A=0;var E=0;var G=0;var C=-1;if(D){A=D.getFullYear();E=D.getMonth()+1;G=D.getDate();C=DatePicker_encodeMonthYear(E,A)}if(B.getDateTextBox()){if(D){B.getDateTextBox().value=(G<10?"0"+G:G)+"/"+(E<10?"0"+E:E)+"/"+(A<10?"0"+A:A)}else{B.getDateTextBox().value=B.DateFormatUserPrompt}}if(B.getDayDropDown()){DatePicker_setValueInDropdown(B.getDayDropDown(),G)}if(B.getMonthDropDown()){DatePicker_setValueInDropdown(B.getMonthDropDown(),E)}if(B.getYearDropDown()){DatePicker_setValueInDropdown(B.getYearDropDown(),A)}if(B.getMonthYearDropDown()){DatePicker_setValueInDropdown(B.getMonthYearDropDown(),C)}if(B.getDayTextBox()){B.getDayTextBox().value=D?G:""}if(B.getMonthTextBox()){B.getMonthTextBox().value=D?E:""}if(B.getYearTextBox()){B.getYearTextBox().value=D?A:""}}function DatePicker_encodeMonthYear(B,A){return(A-2000)*12+(B-1)}function DatePicker_getMonthFromEncoding(A){var B=(A%12);if(B<0){B=(B+12)%12}return B.toString()}function DatePicker_getYearFromEncoding(A){return((A-(A%12))/12)+2000}function DatePicker_setValueInDropdown(B,C){for(var A=0;A<B.options.length;A++){if(B.options[A].value==C){B.selectedIndex=A;break}}}function DatePicker_MakeNewDate(C,D,B){var A=new Date(C,D,B);if(C!=A.getFullYear()||D!=A.getMonth()||B!=A.getDate()){return false}else{return A}};
