var titulos = new Array();
var imagenes = new Array();
var dia = new Array();
var fecha = new Array();
var ambito = new Array();
diahoy=05;
meshoy=2;
anohoy=2012;
dia["25-2-2012"]=764;
titulos["25-2-2012"]="Proyección de 'Tukki, la huella ambiental' e...";
imagenes["25-2-2012"]="/upload/actividades/thumb_foto2-764.jpg";
fecha["25-2-2012"]="25-2-2012";
ambito["25-2-2012"]="25-2-2012 / 25-2-2012";
var flg = 0;
var fs = 1;
var bg = "white";
M = new Array("January","February",
"March","April","May","June",
"July","August","September",
"October","November","December");
D = new Array("L","M","X","J","V","S","D");
M2 = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
M2b = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Sep.","Octubre","Nov.","Dic.");
qURL = "http://www.fundacion-ipade.org/?contentid=";
messiguiente = M2b[2];
mesanterior = M2b[0];
anosiguiente = 2012;
anoanterior = 2012;
function getBgn(soloactual) {
//pdy = new Date(); // today
//pmo = pdy.getMonth(); // present month
//pyr = pdy.getYear(); // present year
// indicar el mes desde php
pdy = 5; // today
pmo = 1; // present month
pyr = 2012; // present year
if (pyr < 2000) // Y2K Fix, Isaac Powell
pyr = pyr + 1900; // http://onyx.idbsu.edu/~ipowell
document.write('
| ');
document.write(' |
| ');
if(!soloactual){
yr = yr1 = (pmo==0?pyr-1:pyr); // last month's year
mo = (pmo==0?11:pmo-1); // last month
bgn = new Date(M[mo]+" 1,"+yr1); // assign to date
Calendar(); // Send last month to screen
document.write(' | ');
}
yr = pyr; // present year
mo = pmo; // present month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send this month to screen
document.write(' | ');
if(!soloactual){
// mes tres
nmes = pmo+1;
yr = (nmes>=12?pyr+1:pyr); // next month's year
mo = (nmes>=12?(nmes-12):pmo+1); // next month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send next month to screen
document.write(' |
| ');
// mes cuatro
nmes = pmo+2;
yr = (nmes>=12?pyr+1:pyr); // next month's year
mo = (nmes>=12?(nmes-12):pmo+2); // next month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send next month to screen
document.write(' | ');
// mes cinco
nmes = pmo+3;
yr = (nmes>=12?pyr+1:pyr); // next month's year
mo = (nmes>=12?(nmes-12):pmo+3); // next month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send next month to screen
document.write(' | ');
// mes seis
nmes = pmo+4;
yr = (nmes>=12?pyr+1:pyr); // next month's year
mo = (nmes>=12?(nmes-12):pmo+4); // next month
bgn = new Date(M[mo]+" 1,"+yr); // assign to date
Calendar(); // Send next month to screen
document.write(' | ');
}
document.write('
'); // Finish up
}
function cambiatextofoto(ultimavalida,fcomp){
// comprobar si existe fecha y buscar en caso contrario
if(!titulos[fcomp]){
//poner última fecha válida
fcomp = ultimavalida;
for(bi=diahoy;bi<=31;bi++){
nuevofcomp = bi+'-'+meshoy+'-'+anohoy;
if(titulos[nuevofcomp]){
fcomp = nuevofcomp;
break;
}
}
}
if(fcomp!=0){
qURL = '?contentid='+dia[fcomp];
if(document.getElementById("txtactividad")){
document.getElementById("txtactividad").innerHTML = ''+ambito[fcomp]+': '+titulos[fcomp]+'';
document.getElementById("imgactividad").innerHTML = '
';
}
}
}
window.onload = function (){
cambiatextofoto('25-2-2012','');
}
function Calendar(){
dy = bgn.getDay();
if(dy==0)dy=7;
yr = eval(yr);
d = "312831303130313130313031";
if (yr / 4 == Math.floor(yr / 4)) {
d = d.substring(0, 2) + "29" + d.substring(4, d.length);
}
pos = (mo * 2);
ld = eval(d.substring(pos, pos + 2));
document.write(""
+ "" + M2[mo] + " " + yr+ "<\/td><\/tr>|
");
for (var i = 0;i < 7;i ++) {
document.write(""+"" + D[i] + "<\/td>");
}
document.write("<\/tr>");
ctr = 0;
emul = 0;
for (var i = 1;i < 8; i++){
if (i < dy) {
document.write("| "+"<\/td>");
}
else {
ctr++;
queclass = 'lnknormal';
qlink = '';
queover = '';
fcomparar = ctr+'-'+(mo+1)+'-'+yr;
if(fecha[fcomparar]==fcomparar){
qlink = qURL+dia[fcomparar];
queclass = 'lnkdestacado';
queover = ' onmouseover="cambiatextofoto(\''+fcomparar+'\')"';
}
document.write(' | '+ '' + ctr + ''+ '<\/td>');
}
}
document.write("<\/tr> | ");
while (ctr < ld) {
for (var i = 1;i < 8; i++){
ctr++;
emul++;
if (ctr > ld){
document.write("| "+ " <\/td>");
}
else {
queclass = 'lnknormal';
qlink = '';
queover = '';
fcomparar = ctr+'-'+(mo+1)+'-'+yr;
if(fecha[fcomparar]==fcomparar){
qlink = qURL+dia[fcomparar];
queclass = 'lnkdestacado';
queover = ' onmouseover="cambiatextofoto(\''+fcomparar+'\')"';
}
document.write(' | '+ '' + ctr + ''+ '<\/td>');
}
}
document.write("<\/tr> | ");
}
document.write("<\/tr><\/table>");
}
//solo el mes actual
getBgn(true);
| |