// *************************************************************************
// * ©2004 Este script de javascript es propiedad de:                      *
// * <dcr.team@gmail.com>                         http://dcrteam.sf.net    *
// *************************************************************************
// * Bajo licencia MPL v1.1 / Under MPL v1.1 License                       *
// *************************************************************************
// * Spanish Calendar for website *
// ********************************


function calendario() {
monthnames = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
var linkcount=0;
function addlink(month, day, href) {
var entry = new Array(3);
entry[0] = month;
entry[1] = day;
entry[2] = href;
this[linkcount++] = entry;
}
Array.prototype.addlink = addlink;
linkdays = new Array();
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0) && !(thisyear % 100 == 0)) ||(thisyear % 400 == 0)) 
monthdays[7]++;
startspaces=thisdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces;
if (startspaces < 0) startspaces+=7;
document.write("<table border=2 bgcolor='#000040'");
document.write("bordercolor='#ffffff'><font color=white>");
document.write("<tr><td colspan=7><center><strong>" + monthnames[thismonth] + " " + thisyear + "</strong></center></font></td></tr>");
document.write("<tr>");
document.write("<td align=center><strong><font color='ED8232'>L</strong></font></td>");
document.write("<td align=center><strong><font color='ED8232'>M</strong></font></td>");
document.write("<td align=center><strong><font color='ED8232'>X</strong></font></td>");
document.write("<td align=center><strong><font color='ED8232'>J</strong></font></td>");
document.write("<td align=center><strong><font color='ED8232'>V</strong></font></td>");
document.write("<td align=center><strong><font color='ED8232'>Sa</strong></font></td>"); 
document.write("<td align=center><strong><font color='ED8232'>Do</strong></font></td></strong>");
document.write("</tr>");
document.write("<tr>");
for (s=0;s<startspaces;s++) {
document.write("<td> </td>");
}
count=1;

while (count <= monthdays[thismonth]) {

for (b = startspaces;b<7;b++) {
if (b == 5) { 
var barthez = count;
var psab = barthez;	
var snk1 = barthez;
var snk2 = (snk1 +7);
var snk3 = (snk2 +7);
var snk4 = (snk3 +7);
}
if (b == 6) {
var alkar = count;
var gwerty = alkar;
var vanely = (gwerty + 7);
var giant = (vanely + 7);
var alinuki = (giant + 7);
}
linktrue=false;
document.write("<td>");

if (count != "32") { 

if (count == thisdate) {
document.write("<a href='http://www.google.com/url?q=http://www.efe.es/tiempo/' target='_blank'><strong><font color='00ffff'>");
}
if (count <= monthdays[thismonth]) {
if (count == psab) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(psab);
}
if (count == gwerty) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(gwerty);
}
if (count == snk2) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(snk2);
}
if (count == vanely) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(vanely);
}
if (count == snk3) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(snk3);
}
if (count == giant) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(giant);
}
if (count == snk4) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(snk4);
}
if (count == alinuki) { 
document.write("<strong><font color='ff0000'>");
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
document.write(alinuki);
}
if ((count != gwerty) && (count != psab) && (count != vanely) && (count != giant) && (count != alinuki) && (count != snk2) && (count != snk3) && (count != snk4)) { 
document.write("<strong>"); 
document.write(count);
}
if (count == thisdate) {
document.write("<strong><font color='00ffff'>");
}
}
else {
document.write(" ");
}
}
if (count == thisdate) {
document.write("</strong></font>");
}
if (linktrue)
document.write("</a>");
document.write("</td>");
count++;
}
document.write("</tr>");
document.write("<tr>");
startspaces=0;
}
document.write("</table></p>");
}  
calendario();