var calDateFormat="yyyyMMDD";var monthArray=new Array('Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь');var monthShort=new Array('Янв.','Фев.','Март','Апр.','Май','Июнь','Июль','Авг.','Сент.','Окт.','Нояб.','Дек.');var weekdayList=new Array('Понедельник','Вторник','Среда','Четверг','Пятница','Суббота','Воскресенье');var weekdayArray=new Array('Пн','Вт','Ср','Чт','Пт','Сб','Вс');var today=new Date();var weekStartDay=0;var earlyYear=2003;var lateYear=today.getFullYear()+10;var windowOpen="N";var fullUpdate="Y";var updateCall=null;var onCalendarPopupClose=null;var topBackground="#EEEEEE";var bottomBackground="#EEEEEE";var tableBGColor="#CCCCCC";var cellColor="white";var headingCellColor="#99CA3C";var headingTextColor="#FFFFFF";var dateColor="#666666";var focusColor="#FFFFFF";var hoverColor="#000000";var fontStyle="11px arial, helvetica, sans-serif";var headingFontStyle="11px arial, helvetica, sans-serif";var bottomBorder=false;var tableBorder=0;var isNav=false;var isIE=false;if(navigator.appName=="Netscape"){isNav=true}else{isIE=true}buildCalParts();function setUpdateCall(a){updateCall=a};function setDateField(a,b,c,d){calOracleField=d;calDayField=a;calMonthField=b;calYearField=c;setInitialDate(d.value);calDocTop=buildTopCalFrame();calDocBottom=buildBottomCalFrame();fullUpdate="Y";windowOpen="Y"};function setInitialDate(a){var b=a.substring(0,4);var c=a.substring(4,6);var d=a.substring(6,8);calDate=new Date(b,c-1,d);calDay=calDate.getDate();calDate.setDate(1)};function buildTopCalFrame(){var a="<HTML>"+"<HEAD>"+"</HEAD>"+"<BODY BGCOLOR='"+topBackground+"'>"+"<FORM NAME='calControl' onSubmit='return false;'>"+"<CENTER>"+"<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>"+"<TR><TD COLSPAN=7>"+"<CENTER>"+getMonthSelect()+"<SELECT NAME='year' onChange='parent.opener.setYear()' STYLE='font:"+fontStyle+"'>";selectedYear=calDate.getFullYear();for(i=earlyYear;i<=lateYear;i++){if(i==selectedYear){a+="<OPTION VALUE='"+i+"' SELECTED>"+i+"</OPTION>"}else{a+="<OPTION VALUE='"+i+"'>"+i+"</OPTION>"}}a+="</SELECT>"+"</CENTER>"+"</TD>"+"</TR>"+"</TABLE>"+"</CENTER>"+"</FORM>"+"</BODY>"+"</HTML>";return a};function buildBottomCalFrame(){var a=calendarBegin;month=calDate.getMonth();year=calDate.getFullYear();day=calDay;var i=0;var b=getDaysInMonth();if(day>b){day=b}var c=new Date(year,month,1);var d=(c.getDay()+6-weekStartDay)%7;b+=d;var e=0;for(i=0;i<d;i++){a+=blankCell;e++}var f=0;var g="weekday";for(i=d;i<b;i++){var h="&nbsp;";if(i-d+1<10){padding="&nbsp;&nbsp;"}else{padding="&nbsp;"}f=i-d+1;if(f==day&&month==today.getMonth()&&year==today.getFullYear()){g="focusDay"}else{g="weekDay"}a+="<TD align=center bgcolor='"+cellColor+"' class='"+g+"'>"+"<a class='"+g+"' href='javascript:parent.opener.returnDate("+f+")'>"+padding+f+h+"</a></TD>";e++;if(e%7==0){a+="</TR><TR>"}}for(i=b;i<42;i++){a+=blankCell;e++;if(e%7==0){a+="</TR>";if(i<41){a+="<TR>"}}}a+=calendarEnd;return a};function writeCalendar(){calDocBottom=buildBottomCalFrame();self.newWin.frames['bottomCalFrame'].document.open();self.newWin.frames['bottomCalFrame'].document.write(calDocBottom);self.newWin.frames['bottomCalFrame'].document.close()};function setToday(){calDate=new Date();var a=calDate.getMonth();var b=calDate.getFullYear();self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=a;self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=b-earlyYear;writeCalendar()};function setYear(){var a=self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex+earlyYear;calDate.setFullYear(a);writeCalendar()};function setCurrentMonth(){var a=self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;calDate.setMonth(a);writeCalendar()};function setPreviousYear(){var a=self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex+earlyYear;if(isFourDigitYear(a)&&a>1000){a--;calDate.setFullYear(a);self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=a-earlyYear;writeCalendar()}};function setPreviousMonth(){var a=self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex+earlyYear;if(isFourDigitYear(a)){var b=self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;if(b==0){b=11;if(a>1000){a--;calDate.setFullYear(a);self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=a-earlyYear}}else{b--}calDate.setMonth(b);self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=b;writeCalendar()}};function setNextMonth(){var a=self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex+earlyYear;if(isFourDigitYear(a)){var b=self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex;if(b==11){b=0;a++;calDate.setFullYear(a);self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=a-earlyYear}else{b++}calDate.setMonth(b);self.newWin.frames['topCalFrame'].document.calControl.month.selectedIndex=b;writeCalendar()}};function setNextYear(){var a=self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex+earlyYear;if(isFourDigitYear(a)){a++;calDate.setFullYear(a);self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=a-earlyYear;writeCalendar()}};function getDaysInMonth(){var a;var b=calDate.getMonth()+1;var c=calDate.getFullYear();if(b==1||b==3||b==5||b==7||b==8||b==10||b==12){a=31}else if(b==4||b==6||b==9||b==11){a=30}else if(b==2){if(isLeapYear(c)){a=29}else{a=28}}return(a)};function isLeapYear(a){if(((a%4)==0)&&((a%100)!=0)||((a%400)==0)){return(true)}else{return(false)}};function isFourDigitYear(a){if(a.length!=4){self.newWin.frames['topCalFrame'].document.calControl.year.selectedIndex=calDate.getFullYear();self.newWin.frames['topCalFrame'].document.calControl.year.select();self.newWin.frames['topCalFrame'].document.calControl.year.focus()}else{return true}};function getMonthSelect(){var a=calDate.getMonth();monthSelect="<SELECT NAME='month' onChange='parent.opener.setCurrentMonth()' STYLE='font:"+fontStyle+"'>";for(i=0;i<monthArray.length;i++){if(i==a){monthSelect+="<OPTION SELECTED>"+monthArray[i]+"\n"}else{monthSelect+="<OPTION>"+monthArray[i]+"\n"}}monthSelect+="</SELECT>";return monthSelect};function buildCalParts(){var a="<TR BGCOLOR='"+headingCellColor+"'>";for(i=0;i<7;i++){a+="<TD class='heading' align=center>"+weekdayArray[(i+weekStartDay)%7]+"</TD>"}a+="</TR>";blankCell="<TD align=center bgcolor='"+cellColor+"'>&nbsp;&nbsp;&nbsp;</TD>";calendarBegin="<HTML>"+"<HEAD>"+"<STYLE type='text/css'>"+"<!--"+"TD.heading { text-decoration: none; color:"+headingTextColor+"; font: "+headingFontStyle+"; }"+"TD.focusDay { background-color: "+headingCellColor+"; }"+"A.focusDay:link { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.focusDay:visited { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.focusDay:hover { color: "+focusColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:link { color: "+dateColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:visited { color: "+dateColor+"; text-decoration: none; font: "+fontStyle+"; }"+"A.weekday:hover { color: "+hoverColor+"; font: "+fontStyle+"; }"+"-->"+"</STYLE>"+"</HEAD>"+"<BODY BGCOLOR='"+bottomBackground+"'"+"<CENTER>";if(isNav){calendarBegin+="<TABLE CELLPADDING=0 CELLSPACING=1 BORDER="+tableBorder+" ALIGN=CENTER BGCOLOR='"+tableBGColor+"'><TR><TD>"}calendarBegin+="<TABLE CELLPADDING=0 CELLSPACING=1 BORDER="+tableBorder+" ALIGN=CENTER BGCOLOR='"+tableBGColor+"'>"+a+"<TR>";calendarEnd="";if(bottomBorder){calendarEnd+="<TR></TR>"}if(isNav){calendarEnd+="</TD></TR></TABLE>"}calendarEnd+="</TABLE>"+"</CENTER>"+"</BODY>"+"</HTML>"};function jsReplace(a,b,c){var d="";if(!a){return""}if(a.indexOf(b)!=-1){t=a.split(b);return(t.join(c))}else{return a}};function doNothing(){};function makeTwoDigit(a){var b=parseInt(a,10);if(b<10){return("0"+b)}else{return b}};function updateDate(a,b,c,d){windowOpen="N";fullUpdate="Y";calOracleField=d;calDayField=a;calMonthField=b;calYearField=c;if(calDayField.type=="select-one"){inDay=calDayField.selectedIndex+1}else{inDay=calDayField.value}calDate=new Date();calDate.setDate(1);calDate.setMonth(calMonthField.selectedIndex);calDate.setYear(calYearField.selectedIndex+earlyYear);var e=getDaysInMonth();if(inDay>e){calDayField.value=e;inDay=e}returnDate(inDay)};function buildDaySelector(a){fullUpdate="N";setInitialDate(a.value);calOracleField=a;dayCode="";var i;for(i=1;i<=31;i++){if(calDay==i){dayCode+="<option value="+makeTwoDigit(i)+" selected>"+i+"</option>\n"}else{dayCode+="<option value="+makeTwoDigit(i)+">"+i+"</option>\n"}}returnDate(calDay);return dayCode};function buildMonthSelector(a){fullUpdate="N";setInitialDate(a.value);calOracleField=a;monthCode="";var i;for(i=0;i<12;i++){if(calDate.getMonth()==i){monthCode+="<option value="+monthShort[i]+" selected>"+monthShort[i]+"</option>\n"}else{monthCode+="<option value="+monthShort[i]+">"+monthShort[i]+"</option>\n"}}returnDate(calDay);return monthCode};function buildYearSelector(a){fullUpdate="N";setInitialDate(a.value);calOracleField=a;yearCode="";var i;for(i=earlyYear;i<=lateYear;i++){if(calDate.getFullYear()==i){yearCode+="<option value="+i+" selected>"+i+"</option>\n"}else{yearCode+="<option value="+i+">"+i+"</option>\n"}}returnDate(calDay);return yearCode};function setOracleField(a){var b=calDate.getFullYear();var c=calDate.getMonth()+1;var d=calDay;c=(c>9)?c:"0"+c;d=(d>9)?d:"0"+d;a.value=""+b+c+d};function returnDate(a){calDate.setDate(a);var b=calDate.getDate();var c=calDate.getMonth()+1;var d=calDate.getFullYear();var e=monthArray[calDate.getMonth()];var f=e.substring(0,3);var g=weekdayList[calDate.getDay()];var h=g.substring(0,3);outDate=calDateFormat;if(calDateFormat.indexOf("DD")!=-1){b=makeTwoDigit(b);outDate=jsReplace(outDate,"DD",b)}else if(calDateFormat.indexOf("dd")!=-1){outDate=jsReplace(outDate,"dd",b)}if(calDateFormat.indexOf("MM")!=-1){c=makeTwoDigit(c);outDate=jsReplace(outDate,"MM",c)}else if(calDateFormat.indexOf("mm")!=-1){outDate=jsReplace(outDate,"mm",c)}if(calDateFormat.indexOf("yyyy")!=-1){outDate=jsReplace(outDate,"yyyy",d)}else if(calDateFormat.indexOf("yy")!=-1){var i=""+d;var i=i.substring(2,4);outDate=jsReplace(outDate,"yy",i)}else if(calDateFormat.indexOf("YY")!=-1){outDate=jsReplace(outDate,"YY",d)}if(calDateFormat.indexOf("Month")!=-1){outDate=jsReplace(outDate,"Month",e)}else if(calDateFormat.indexOf("month")!=-1){outDate=jsReplace(outDate,"month",e.toLowerCase())}else if(calDateFormat.indexOf("MONTH")!=-1){outDate=jsReplace(outDate,"MONTH",e.toUpperCase())}if(calDateFormat.indexOf("Mon")!=-1){outDate=jsReplace(outDate,"Mon",f)}else if(calDateFormat.indexOf("mon")!=-1){outDate=jsReplace(outDate,"mon",f.toLowerCase())}else if(calDateFormat.indexOf("MON")!=-1){outDate=jsReplace(outDate,"MON",f.toUpperCase())}if(calDateFormat.indexOf("Weekday")!=-1){outDate=jsReplace(outDate,"Weekday",g)}else if(calDateFormat.indexOf("weekday")!=-1){outDate=jsReplace(outDate,"weekday",g.toLowerCase())}else if(calDateFormat.indexOf("WEEKDAY")!=-1){outDate=jsReplace(outDate,"WEEKDAY",g.toUpperCase())}if(calDateFormat.indexOf("Wkdy")!=-1){outDate=jsReplace(outDate,"Wkdy",h)}else if(calDateFormat.indexOf("wkdy")!=-1){outDate=jsReplace(outDate,"wkdy",h.toLowerCase())}else if(calDateFormat.indexOf("WKDY")!=-1){outDate=jsReplace(outDate,"WKDY",h.toUpperCase())}calOracleField.value=outDate;if(fullUpdate=="Y"){calDayField.selectedIndex=b-1;calMonthField.selectedIndex=c-1;calYearField.selectedIndex=d-earlyYear}if(windowOpen=="Y"){self.newWin.blur();self.newWin.close();if(onCalendarPopupClose){onCalendarPopupClose()}}if(updateCall!=null){eval(updateCall)}};function updateDateField(a,b,c){var d=document[a];var e=c.getFullYear();var f=c.getMonth()+1;var g=c.getDate();d["_day_"+b].selectedIndex=g-1;d["_month_"+b].selectedIndex=f-1;d["_year_"+b].selectedIndex=e-earlyYear;f=(String(f).length==2)?f:"0"+f;g=(String(g).length==2)?g:"0"+g;var h=""+e+f+g;d[b].value=h};function syncDateField(a,b,c,d){};function getJSDate(a){var b=a.getFullYear();var c=a.getMonth()+1;var d=a.getDate();c=(String(c).length==2)?c:"0"+c;d=(String(d).length==2)?d:"0"+d;return""+b+c+d};function getStringDate(a){return(a.substring(4,6)+"/"+a.substring(6,8)+"/"+a.substring(0,4))};