function txtfecha()
{
	var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")
	var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
	var fecha_actual = new Date()
	dia_mes = fecha_actual.getDate()
	dia_semana = fecha_actual.getDay()
	mes = fecha_actual.getMonth() + 1
	anio = fecha_actual.getYear()
	if (anio < 100)
		anio = '19' + anio
	else if ( ( anio > 100 ) && ( anio < 999 ) ) {	
		var cadena_anio = new String(anio)
		anio = '20' + cadena_anio.substring(1,3)
	}
	document.write(dia_mes + " de " + nombres_meses[mes - 1] + " " + anio)
}

function display(elem) 
{
	if(elem.length < 1) { return; }
	if(document.getElementById(elem).style.display == "none") { document.getElementById(elem).style.display = "block"; }
	else { document.getElementById(elem).style.display = "none"; }
}

function checkval(campo)
{
	if (campo == "" || campo == null ) return false;
	return true;
}

function magic(s) { o=""; for (i=0; i<s.length; i++) o+=String.fromCharCode(s.charCodeAt(i)-1); return o; }

var http_request = null;

function ajaxread(url){

  if(window.XMLHttpRequest){
      http_request = new XMLHttpRequest();
  } else if(window.ActiveXObject){
      http_request = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
      return;
  }
	http_request.onreadystatechange = ajaxupdate; 
	http_request.open('GET', url, true); 
	http_request.send(null); 	
}	

function ajaxupdate()
{ 
	if (http_request.readyState == 4) { 
			 document.getElementById('ajaxdata').innerHTML = http_request.responseText;
	 }
}

function selectme(thisfield)
{
	thisfield.select();	
}

function checkform(thisform)
{
	for(i=0; i<thisform.elements.length; i++)
	{
		if (checkval(thisform.elements[i].getAttribute("req")))
		{
			if(!checkval(thisform.elements[i].value))
			{		
				alert("Introduzca un valor en el campo: " + thisform.elements[i].getAttribute("req"));					
				thisform.elements[i].focus();		
				return false;                    
			}
		}
	}
	if (thisform.AceptaCondiciones && !(thisform.AceptaCondiciones.checked))
	{
		thisform.AceptaCondiciones.focus();
		alert("Debe de aceptar las condiciones del servicio");	
		return false;			
	}	
	if(thisform.procesar) {
		thisform.procesar.disabled = "true";
		thisform.procesar.value = "Enviado Formulario ...";
	}
	return true;
}

function maxtext(obj,counter)
{
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
	document.getElementById(counter).innerHTML = mlength - obj.value.length
}

function cuentatras()
{
	var ahora = new Date();
	tahora = parseInt(ahora.getTime() / 1000, 10);
	
	if (tahora < tfecha)
	{
		restan = tfecha - tahora;
		dias = parseInt((restan / (60 * 60 * 24)), 10);
		hora = parseInt((restan / (60 * 60) - dias * 24), 10);
		minu = parseInt((restan / 60 - dias * 24 * 60 - hora * 60), 10);
		secs = parseInt((restan - dias * 24 * 60 * 60 - hora * 60 * 60 - minu * 60), 10);
		document.getElementById('cuentatras').innerHTML = "Quedan " + dias + " d&iacute;as " + hora + " horas " + minu + " minutos y " + secs + " segundos para la Asamblea de Santiago de Compostela (A Coru&ntilde;a). ";
		setTimeout('cuentatras()', 1000);
   }
}

if (top.location != location) top.location.href = document.location.href;

var fecha = new Date('May 6, 2010 17:30:00');
var tfecha = parseInt(fecha.getTime() / 1000, 10);