// Documento JavaScript
function getFoco()
{
	var texto = document.getElementById("name");
	texto.value="";
	texto.focus();
	document.getElementById("email").value="";
}

function focusText(txt)
{
	txt.style.backgroundColor = "#5f738d";
	txt.style.color = "#d9d1ab";
	txt.style.borderColor = "#5f738d";
}

function nofocusText(txt)
{
	txt.style.backgroundColor = "#000000";
	txt.style.color = "#d9d1ab";
}

function focusBirth(txt)
{
	txt.style.backgroundColor = "#b4c6ec";
	txt.style.color = "#000000";
	txt.style.borderColor = "#b4c6ec";
}

function nofocusBirth(txt)
{
	if(txt.style.backgroundColor!="#e7bc24")
	{
		txt.style.color = "#7e9fe4";
		txt.style.borderColor = "#7e9fe4";
	}
}

function fechaNacimiento(txt)
{
	var key = window.event.keyCode;
	var i;

	for(i=0;i<txt.value.length;i++)
	{
		if(txt.value.substring(i,i+1)!=0 &&
		   txt.value.substring(i,i+1)!=1 &&
		   txt.value.substring(i,i+1)!=2 &&
		   txt.value.substring(i,i+1)!=3 &&
		   txt.value.substring(i,i+1)!=4 &&
		   txt.value.substring(i,i+1)!=5 &&
		   txt.value.substring(i,i+1)!=6 &&
		   txt.value.substring(i,i+1)!=7 &&
		   txt.value.substring(i,i+1)!=8 &&
		   txt.value.substring(i,i+1)!=9)
		{
			txt.style.backgroundColor = "#e7bc24";
		}
		else
		{
			txt.style.backgroundColor = "#000000";
		}
	}
	if(txt.value=="")
	{
		txt.style.backgroundColor = "#000000";
	}
}


function cerrarVentana()
{

window.close();
}

function redirect()
{
var name = document.getElementById("name").value;
var alias = document.getElementById("alias").value;
var email = document.getElementById("email").value;
var birth = document.getElementById("birth").value;
var country = document.getElementById("country").value;
var comments = document.getElementById("comments").value;

var url = "insert_user.php?name=" + name + "&";
url += "alias=" + alias + "&";
url += "email=" + email + "&";
url += "birth=" + birth + "&";
url += "country=" + country + "&";
url += "comments=" + comments;

llamadasin(url ,'contents');

}



function llamadasin(url, contenedor){
var pagina_requerida = false
if (window.XMLHttpRequest) {
// comprueba si el navegador es opera, safari, mozilla, etc.
	pagina_requerida = new XMLHttpRequest()
}
else if (window.ActiveXObject){
// comprueba si el navegador es internet explorer
	try {
		pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch (e){
// caso de versión antigua de internet explorer
		try{
			pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch (e){
		}
	}
}
else {
	return false
}


pagina_requerida.onreadystatechange=function(){
// llamada a la función que carga la página
		pintapagina(pagina_requerida, contenedor)
}
// métodos open y send
	pagina_requerida.open('GET', url, true)
	pagina_requerida.send(null)
}

// función que presenta la información
function pintapagina(pagina_requerida,contenedor){
	if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1))
		document.getElementById(contenedor).innerHTML=pagina_requerida.responseText
	}
