	var mes_activo_fotos = "";
	var meses_calendario = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
	function fotos_calendario(accion) {
		var calendario_html = '';
		var diaHoy = new Date();
		var mesHoy = diaHoy.getFullYear() + ((diaHoy.getMonth() < 9) ?  "0" + ((diaHoy.getMonth() + 1).toString()) : (diaHoy.getMonth() + 1).toString());
		if(((parseInt(mes_activo_fotos) <= parseInt(mesHoy)) && (accion == "+")) || ((parseInt(mes_activo_fotos) > 200812) && (accion == "-"))) {
			var mes = (accion == "+") ? parseInt(mes_activo_fotos.substring(4,6)) + 1 : parseInt(mes_activo_fotos.substring(4,6)) - 1;
			var ano = parseInt(mes_activo_fotos.substring(0,4));
			if(mes == 0) {
				mes = 12;
				ano = ano - 1;
			}
			if(mes == 13) {
				mes = 1;
				ano = ano + 1;
			}
			mes_activo_fotos = ano.toString() + ((mes < 10) ? "0" + mes.toString() : mes.toString());
			var semanas = new Array();
			var diaInicio = new Date(ano,(mes - 1),1);
			var diaFin = new Date(ano,mes,0);
			var diaLimite = new Date(2009,1,6);
			for(var dia = diaInicio; dia <= diaFin; dia = new Date(dia.getFullYear(), dia.getMonth(), (dia.getDate() + 1))) {
				indiceSemana = ((dia.getDate() == 1) || (dia.getDay() == 1)) ? semanas.length : indiceSemana;
				if(typeof(semanas[indiceSemana]) != "undefined") {
					indiceDia = semanas[indiceSemana].length;
					semanas[indiceSemana][indiceDia] = dia;
				}
				else {
					semanas[indiceSemana] = new Array();
					semanas[indiceSemana][0] = dia;
				}
			}
			calendario_html = '<tbody><tr><th scope="col"><abbr title="Lunes">L</abbr></th><th scope="col"><abbr title="Martes">M</abbr></th><th scope="col"><abbr title="Miercoles">X</abbr></th><th scope="col"><abbr title="Jueves">J</abbr></th><th scope="col"><abbr title="Viernes">V</abbr></th><th scope="col"><abbr title="Sábado">S</abbr></th><th scope="col" class="domingo"><abbr title="Domingo">D</abbr></th></tr>';
			for(indiceSemana = 0; indiceSemana < semanas.length; indiceSemana++) {
				calendario_html += '<tr>';
				if(indiceSemana == 0) {
					for(indiceDia = 0; indiceDia < (7 - semanas[indiceSemana].length); indiceDia++) {
						dia = semanas[indiceSemana][indiceDia];
						calendario_html += '<td class="calvacio">&nbsp;</td>';
					}
				}
				for(indiceDia = 0; indiceDia < semanas[indiceSemana].length; indiceDia++) {
					dia = semanas[indiceSemana][indiceDia];
					var clase = ((dia.getFullYear() == diaHoy.getFullYear()) && (dia.getMonth() == diaHoy.getMonth()) && (dia.getDate() == diaHoy.getDate())) ? "caldia_activo" : "caldia";
					var fechaDia = dia.getFullYear().toString() + ((dia.getMonth() < 9) ? "0" + ((dia.getMonth() + 1).toString()) : (dia.getMonth() + 1).toString()) + ((dia.getDate() < 10) ? "0" + dia.getDate().toString() : dia.getDate().toString());
					calendario_html += ((dia >= diaLimite) && (dia < diaHoy)) ? '<td class="' + clase + '"><a href="/fotos/' + fechaDia + '">' + dia.getDate() + '</a></td>' : '<td class="' + clase + '">' + dia.getDate() + '</td>';
				}
				if(indiceSemana == (semanas.length - 1)) {
					for(indiceDia = 0; indiceDia < (7 - semanas[indiceSemana].length); indiceDia++) {
						dia = semanas[indiceSemana][indiceDia];
						calendario_html += '<td class="calvacio">&nbsp;</td>';
					}
				}
				calendario_html += '</tr>';
			}
			calendario_html += '</tbody>';
			$("#fotos-calendario-mes").html(meses_calendario[diaInicio.getMonth()] + " " + diaInicio.getFullYear());
			$("#fotos-calendario").html(calendario_html);
		}
	}

