var ds_i_date=new Date;ds_c_month=ds_i_date.getMonth()+1;ds_c_year=ds_i_date.getFullYear();StartDateTimestamp=EndDateTimestamp=0;OwnerControlID="";function ds_getel(a){return document.getElementById(a)}function ds_getleft(a){var b=a.offsetLeft;for(a=a.offsetParent;a;){b+=a.offsetLeft;a=a.offsetParent}return b}function ds_gettop(a){var b=a.offsetTop;for(a=a.offsetParent;a;){b+=a.offsetTop;a=a.offsetParent}return b}var ds_oe=ds_getel("ds_calclass"),ds_ce=ds_getel("ds_conclass"),ds_ob="";
function ds_ob_clean(){ds_ob=""}function ds_ob_flush(){ds_oe.innerHTML=ds_ob;ds_ob_clean()}function ds_echo(a){ds_ob+=a}
var ds_element,ds_monthnames=["\u042f\u043d\u0432\u0430\u0440\u044c","\u0424\u0435\u0432\u0440\u0430\u043b\u044c","\u041c\u0430\u0440\u0442","\u0410\u043f\u0440\u0435\u043b\u044c","\u041c\u0430\u0439","\u0418\u044e\u043d\u044c","\u0418\u044e\u043b\u044c","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u041e\u043a\u0442\u044f\u0431\u0440\u044c","\u041d\u043e\u044f\u0431\u0440\u044c","\u0414\u0435\u043a\u0430\u0431\u0440\u044c"],ds_daynames=["\u041f\u043d",
"\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041f\u0442",'<font color="Red">\u0421\u0431</font>','<font color="Red">\u0412\u0441</font>'];
function ds_template_main_above(a){return'<table cellpadding="3" cellspacing="1" class="ds_tbl"><tr><td class="ds_head" style="cursor: pointer">&nbsp;</td><td class="ds_head" style="cursor: pointer" onclick="ds_pm();">&lt;</td><td class="ds_head" style="cursor: pointer" onclick="ds_hi();" colspan="3">\u0417\u0430\u043a\u0440\u044b\u0442\u044c</td><td class="ds_head" style="cursor: pointer" onclick="ds_nm();">&gt;</td><td class="ds_head" style="cursor: pointer">&nbsp;</td></tr><tr><td colspan="7" class="ds_head">'+a+
"</td></tr><tr>"}function ds_template_day_row(a){return'<td class="ds_subhead">'+a+"</td>"}function ds_template_new_week(){return"</tr><tr>"}function ds_template_blank_cell(a){return'<td colspan="'+a+'"></td>'}
function ds_template_day(a,b,c){var d=true,e=new Date(c,b-1,a);if(d=e>ds_i_date)if(OwnerControlID=="StartDate"&&EndDateTimestamp!=0)d=EndDateTimestamp>e;else if(OwnerControlID=="DueDate"&&StartDateTimestamp!=0)d=StartDateTimestamp<e;return d?'<td class="ds_cell" onclick="ds_onclick('+a+","+b+","+c+')">'+a+"</td>":'<td class="ds_cell_nonactive">'+a+"</td>"}function ds_template_main_below(){return"</tr></table>"}
function ds_draw_calendar(a,b){ds_ob_clean();ds_echo(ds_template_main_above(ds_monthnames[a-1]+" "+b));for(i=0;i<7;i++)ds_echo(ds_template_day_row(ds_daynames[i]));var c=new Date;c.setMonth(a-1);c.setFullYear(b);c.setDate(1);days=a==1||a==3||a==5||a==7||a==8||a==10||a==12?31:a==4||a==6||a==9||a==11?30:b%4==0?29:28;var d=c.getDay();d=d==0?6:d-1;c=1;ds_echo(ds_template_new_week());d!=0&&ds_echo(ds_template_blank_cell(d));d=d;for(i=0;i<days;i++){d==0&&!c&&ds_echo(ds_template_new_week());ds_echo(ds_template_day(i+
1,a,b));c=0;d++;d%=7}ds_echo(ds_template_main_below());ds_ob_flush()}
function ds_sh(a){ds_element=a;OwnerControlID=ds_element.id;var b=new Date;if(OwnerControlID=="DueDate"&&StartDateTimestamp!=0&&EndDateTimestamp==0){ds_c_month=StartDateTimestamp.getMonth()+1;ds_c_year=StartDateTimestamp.getFullYear()}else if(OwnerControlID=="DueDate"&&EndDateTimestamp!=0){ds_c_month=EndDateTimestamp.getMonth()+1;ds_c_year=EndDateTimestamp.getFullYear()}else if(OwnerControlID=="StartDate"&&StartDateTimestamp!=0){ds_c_month=StartDateTimestamp.getMonth()+1;ds_c_year=StartDateTimestamp.getFullYear()}else{ds_c_month=
b.getMonth()+1;ds_c_year=b.getFullYear()}ds_draw_calendar(ds_c_month,ds_c_year);ds_ce.style.display="";the_left=ds_getleft(a);the_top=ds_gettop(a)+a.offsetHeight;ds_ce.style.left=the_left+"px";ds_ce.style.top=the_top+"px"}function ds_hi(){ds_ce.style.display="none"}function ds_nm(){ds_c_month++;if(ds_c_month>12){ds_c_month=1;ds_c_year++}ds_draw_calendar(ds_c_month,ds_c_year)}function ds_pm(){ds_c_month-=1;if(ds_c_month<1){ds_c_month=12;ds_c_year-=1}ds_draw_calendar(ds_c_month,ds_c_year)}
function ds_ny(){ds_c_year++;ds_draw_calendar(ds_c_month,ds_c_year)}function ds_py(){ds_c_year-=1;ds_draw_calendar(ds_c_month,ds_c_year)}function ds_format_date(a,b,c){m2="00"+b;m2=m2.substr(m2.length-2);d2="00"+a;d2=d2.substr(d2.length-2);return d2+"."+m2+"."+c}
function ds_onclick(a,b,c){ds_hi();if(typeof ds_element.value!="undefined"){if(ds_element.id=="StartDate"){StartDateTimestamp=new Date(c,b-1,a);document.getElementById("StartDate").value=ds_format_date(a,b,c);if(isPresearchPage==true){var d=ds_format_date(a,b,c);a="notChaged";ChangeDatesLinkURL(d,a)}}else if(ds_element.id=="DueDate"){EndDateTimestamp=new Date(c,b-1,a);document.getElementById("DueDate").value=ds_format_date(a,b,c);if(isPresearchPage==true){d="notChaged";a=ds_format_date(a,b,c);ChangeDatesLinkURL(d,
a)}}if(document.getElementById("StartDate").value!="")document.getElementById("DueDate").disabled=false;else document.getElementById("DueDate").disabled=true}else if(typeof ds_element.innerHTML!="undefined")ds_element.innerHTML=ds_format_date(a,b,c);else alert(ds_format_date(a,b,c))};