var fecha=new Date();
var diames=fecha.getDate();
var diasemana=fecha.getDay();
var mes=fecha.getMonth() +1 ;
var ano=fecha.getFullYear();

var textosemana = new Array (7); 
	textosemana[0]="Domingo";
	textosemana[1]="Lunes";
	textosemana[2]="Martes";
	textosemana[3]="Miércoles";
	textosemana[4]="Jueves";
	textosemana[5]="Viernes";
	textosemana[6]="Sábado";

var textomes = new Array (12);
	textomes[1]="Enero";
	textomes[2]="Febrero";
	textomes[3]="Marzo";
	textomes[4]="Abril";
	textomes[5]="Mayo";
	textomes[6]="Junio";
	textomes[7]="Julio";
	textomes[8]="Agosto";
	textomes[9]="Septiembre";
	textomes[10]="Octubre";
	textomes[11]="Noviembre";
	textomes[12]="Diciembre";

var weekdaystxt=["", "", "", "", "", "", ""];

function formatField(num, isHour){
	if (typeof isHour!="undefined"){ //if this is the hour field
		var hour=(num>12)? num-12 : num
		return (hour==0)? 12 : hour
	}
	return (num<=9)? "0"+num : num//if this is minute or sec field
}

function httpajax() {
	var xmlhttp=false; 
	try { 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e) { 
		try { 
			// Creacion del objeto AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
} 

function suscripcion_boletin() {
	ajax=httpajax();
	variables = 'email=' + escape(document.frmboletin.email.value);
	ajax.open('post', './suscribir.php', true);
	ajax.onreadystatechange = handleResponsemail;
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	ajax.send(variables);
	return false;
}

function handleResponsemail() {
	if(ajax.readyState == 4 && ajax.status == 200){
		var response = ajax.responseText;
		if(response) {
			document.frmboletin.email.value = "";
			document.getElementById("box").innerHTML = response;
		}
	} else {
		document.getElementById("box").innerHTML = '<strong>Enviando datos...</strong>';
	}
}

