// JavaScript Document

function makeArray(n){
  this.length = n;
  for (i=1;i<=n;i++){
    this[i]=0;
  }
  
  return this;
}
function fecha() {
                var dia = 1;
                var today = new Date();
                if (today.getDate() > 15) {
                               dia = 15;
                }
                var this_month = new makeArray(12);
                this_month[0]  = "Enero";
                this_month[1]  = "Febrero";
                this_month[2]  = "Marzo";
                this_month[3]  = "Abril";
                this_month[4]  = "Mayo";
                this_month[5]  = "Junio";
                this_month[6]  = "Julio";
                this_month[7]  = "Agosto";
                this_month[8]  = "Septiembre";
                this_month[9]  = "Octubre";
                this_month[10] = "Noviembre";
                this_month[11] = "Deciembre";

                return(dia + " de " + this_month[today.getMonth()] + " hasta el " + (dia + 15) );
}

function semana() {
	
	var dia1 = 1;
	var mes1 = 1;
	var dia2 = 2;
	var mes2 = 2;
	
	var fecha = new Date();

	
	switch (fecha.getDay()) {
	case 0:
	  fecha.setDate(fecha.getDate() - 5);
	  break;
	case 1:
	  fecha.setDate(fecha.getDate() - 6);
	  break;
	case 3:
	  fecha.setDate(fecha.getDate() - 1);
	  break;
	case 4:
	  fecha.setDate(fecha.getDate() - 2);
	  break;
	case 5:
	  fecha.setDate(fecha.getDate() - 3);
	  break;
	case 6:
	  fecha.setDate(fecha.getDate() - 4);
	  break;
	default:
		break;
	}

	
	dia1 = fecha.getDate();
	mes1 = fecha.getMonth();
	fecha.setDate(fecha.getDate() + 7);
	dia2 = fecha.getDate();
	mes2 = fecha.getMonth();
	
	var meses = new makeArray(12);
	meses[0]  = "ENERO";
	meses[1]  = "FEBRERO";
	meses[2]  = "MARZO";
	meses[3]  = "ABRIL";
	meses[4]  = "MAYO";
	meses[5]  = "JUNIO";
	meses[6]  = "JULIO";
	meses[7]  = "AGOSTO";
	meses[8]  = "SEPTIEMBRE";
	meses[9]  = "OCTUBRE";
	meses[10] = "NOVIEMBRE";
	meses[11] = "DICIEMBRE";
					
	return("-A PARTIR DEL MARTES " + dia1 + " DE " + meses[mes1] + " HASTA EL MARTES " + dia2 + " DE " + meses[mes2]);
}
