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}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}
function ds_template_main_above(a){return'<table cellpadding="3" cellspacing="1" class="ds_tbl" border="0"><tr><td class="ds_head" style="cursor: pointer" onmousedown="ds_pm();">&lt;</td><td colspan="5" class="ds_head">'+a+'</td><td class="ds_head" style="cursor: pointer" onmousedown="ds_nm();">&gt;</td></tr><tr></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+'"  style="background-color: #fff;"></td>'}function ds_template_day(a,b,c,f){return f==""?'<td class="ds_cell" onmousedown="ds_onclick('+a+","+b+","+c+')">'+a+"</td>":'<td class="selected_day" onmousedown="ds_onclick('+a+","+b+","+c+')">'+a+"</td>"}function ds_template_main_below(){return"</tr></table>"}var pastDates=false;
function ds_draw_calendar(a,b){var c=a,f="";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 d=new Date;d.setDate(1);d.setMonth(a-1);d.setFullYear(b);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;d=d.getDay();if(d==0)d=6;else d-=1;c=1;ds_echo(ds_template_new_week());d!=0&&ds_echo(ds_template_blank_cell(d));var g=d;for(i=0;i<days;i++){g==0&&!c&&ds_echo(ds_template_new_week());
c=a;var e=new String(c);f=dia_formateado=i+1;if(dia_formateado<10&&dia_formateado>0)dia_formateado="0"+dia_formateado;if(c<10&&c>0&&e.substr(0,1)!=0)c="0"+c;e=new Date;e=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);var h=new Date(b,a-1,i+1,0,0,0);if(pastDates&&e<h||!pastDates&&e>h)ds_echo('<td class="ds_cell_desactivated">'+f+"</td>");else dia_formateado+"/"+c+"/"+b==ds_element.value?ds_echo(ds_template_day(i+1,a,b,"mismodia")):ds_echo(ds_template_day(i+1,a,b,""));c=0;g++;g%=7}a=0;if((d+
days)%7!=0){a=7-(d+days)%7;ds_echo('<td style="background-color: #fff;"colspan='+a+">&nbsp;</td>")}ds_echo(ds_template_main_below());ds_ob_flush()}
function ds_sh(a){ds_element=a;var b=new Date,c=new String(mes_elegido);primer_caracter_mes=c.substr(1);if(primer_caracter_mes<0&&primer_caracter_mes>10)mes_elegido=c.substr(0,1);if(dia_elegido!=""&&mes_elegido!=""&&anio_elegido!=""){ds_c_month=mes_elegido;ds_c_year=anio_elegido}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="block";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_format_date(a,b,c){m2="00"+b;m2=m2.substr(m2.length-2);d2="00"+a;d2=d2.substr(d2.length-2);if(ds_element.addEventListener)clickvalido=0;dia_elegido=d2;mes_elegido=m2;anio_elegido=c;return d2+"/"+m2+"/"+c}
function listen(a,b,c){if(b.addEventListener)b.addEventListener(a,c,false);else if(b.attachEvent)return b.attachEvent("on"+a,c)}function checkIfClose(){try{if(clickvalido){layerdisplay(ds_ce.id,"none");clickvalido=0}else if(ds_ce.style.display=="block")clickvalido=1}catch(a){}};
