/////////////////////// VALIDADOR DE Biblioacces ////////////////////////////

// Validador //

function validarBiblioacces (){
	if (document.getElementById ('usulog').value == ""){
		document.getElementById ('usulog').style.background = "#fb7862";
		return false;		
	}else if (document.getElementById ('usupass').value == ""){
		document.getElementById ('usupass').style.background = "#fb7862";
		return false;
	}	
	return true;
}

/// LIMPIAR BACKGROUND VALIDADO ///

function limpiarBg (campo){
	campo.style.background = "#ffffff";	
	document.getElementById("Biblioacces").style.display = "none";
	document.getElementById("rememberAccesBiblioacces").style.display = "none";
}
// LIMPIAR BACKGROUND EMAIL //

function limpiarBgContact (campo){
	campo.style.background = "#ffffff";	
	document.getElementById("Biblioacces").style.display = "none";
}

/// RECORDATORI DE PASSWORD ///

function rememberPassBiblioInput (campo){
	document.getElementById("rememberAccesBiblioacces").innerHTML = '<table width="98%" align="center" cellpadding="2" cellspacing="2" bgcolor="#CCCCCC" style="margin:0px 2px 2px 2px"><tr><td width="98" class="margen" style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#006600; font-weight:bold"><div align="right">Carnet:</div></td><td width="109"><input type="text" name="bibliocontact" id="bibliocontact" style="font-size:12px;" size="20" maxlength="12" onfocus="limpiarBgContact (this)" value="Nº DE CARNET"/></td><td width="69" align="center"><a style="font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#006600; font-weight:bold" href="javascript:void(0)" onclick="rememberPass()">Sol&middot;licitar</a></td></tr></table>';
	document.getElementById("rememberAccesBiblioacces").style.display = "block";
	document.getElementById("Biblioacces").style.display = "none";
}

// Mostrar error de logging en Biblioacces //

function recarga (error){
		document.getElementById("rememberAccesBiblioacces").style.display = "none";
		document.getElementById ('usulog').value = "";
		document.getElementById ('usupass').value = "";
	if (error == 1){
		document.getElementById("Biblioacces").style.display = "block";
		document.getElementById("errorBiblioacces").innerHTML = "Login Incorrecte";
	}else if (error == 2){
		document.getElementById("Biblioacces").style.display = "block";
		document.getElementById("errorBiblioacces").innerHTML = "Password Incorrecte";
	}else if (error == 3){
		document.getElementById("Biblioacces").style.display = "none";
		parent.location.href = "AreaClientBilioacces/";
	}
}

// Recordatori de password

function rememberPass (){
	var bibliocontact = document.getElementById("bibliocontact").value
	//La ubicación donde cargamos la pagina.
	var objID = "rememberAccesBiblioacces";
	var serverPage = "rememberPassBiblioAcces.php?bibliocontact=" + bibliocontact;
	var obj = document.getElementById(objID);
	xmlhttp = creaXmlhttp();
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState != 4){
			obj.innerHTML =  '<img src="img/mini_loader.gif">';
		}
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		} 
	}
	xmlhttp.send(null);
}
