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 checkval(campo)
{
	if (campo == "" || campo == null ) return false;
	return true;
}

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 shownews(elem)
{
	if(elem.length < 1) { return; }
	var allnews = document.getElementsByTagName("DIV");	
	for(var ind=0;ind<allnews.length;ind++)
	{
		if(allnews[ind].id.substring(0,4) == "news") {
			if(allnews[ind].id == elem) {
				allnews[ind].style.display = "block" ;
			} else { 
				allnews[ind].style.display = "none" ;
			}
		}
	}
}

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;
}

var http_ajaxobj = null;

function ajaxread(url,cap)
{
  if(window.XMLHttpRequest){
      http_ajaxobj = new XMLHttpRequest();
  } else if(window.ActiveXObject){
      http_ajaxobj = new ActiveXObject("Microsoft.XMLHTTP");
  } else {
      return;
  }
	http_ajaxobj.open('GET', url, true); 
	http_ajaxobj.onreadystatechange = function() {
		if (http_ajaxobj.readyState==1) {
			document.getElementById(cap).innerHTML="<img src='_imgs_/img_loader.gif'>";
		}
		else if (http_ajaxobj.readyState==4) { 
			document.getElementById(cap).innerHTML = http_ajaxobj.responseText;
		}	
	} 	
	http_ajaxobj.send(null); 	
}	

if (top.location != location) top.location.href = document.location.href;