/**
* Envio del formulario de autentificacion
*/
function sendAuthForm() {
	message = "";
	if (document.authForm.username.value=="") message = message+'usuario';
	if (document.authForm.password) if (document.authForm.password.value==""){
		if(message!="") message = message+',';
		message = message+'password';
	}
	if (document.authForm.email) if (document.authForm.email.value==""){
		if(message!="") message = message+',';
		message = message+'email';
	}
	if(message!='')
	{
		message = 'Campos Vacios: '+message;
		var container = document.getElementById('contenido');
		if(document.getElementById('phpError'))
		document.getElementById('phpError').parentNode.removeChild(document.getElementById('phpError'));			 
		var error = document.createElement('p');
			error.setAttribute('id','error');
			error.setAttribute('class','mensajeError');
			error.textContent = message;
			container.appendChild(error);
			setTimeout("document.getElementById('contenido').removeChild(document.getElementById('error'))",4000);
	}
	else document.authForm.submit();
}

function firefox(capa1)
{
	var capaCont = 'contenido';
	if (typeof capa1 != 'undefined') capaCont = capa1; 
	if(document.all){
		var capa = document.getElementById(capaCont);
		capa.style.textAlign = 'center';
		capa.innerHTML = "<a href='http://www.mozilla-europe.org/es/firefox/'><img src='/scripts/img/logoFirefox.jpg' style='border:0'/></a><div>Usa Firefox para una mejor experiencia</div>";		
	}
			
}

function forgotPass(){
	var capa = document.getElementById('contenido');
		capa.innerHTML='';
	var form = document.createElement('form');
		form.setAttribute('method','POST');
		form.setAttribute('name','authForm');
		form.setAttribute('action',"");
		capa.appendChild(form);
		var title = document.createElement('h1');
			title.textContent = 'ACCESO AL SISTEMA';
			form.appendChild(title);
				var table = document.createElement('table');
					form.appendChild(table);
					//Usuario
					var row = document.createElement('tr');
						table.appendChild(row);
					var column = document.createElement('th');
						column.textContent = 'USUARIO';
						row.appendChild(column);
					var column = document.createElement('td');
						var input = document.createElement('input');
							input.setAttribute('type','text');
							input.setAttribute('name','username');
							//input.setAttribute('value','');
							column.appendChild(input);
						row.appendChild(column);
					//Email
					var row = document.createElement('tr');
						table.appendChild(row);
					var column = document.createElement('th');
						column.textContent = 'EMAIL';
						row.appendChild(column);
					var column = document.createElement('td');
						var input = document.createElement('input');
							input.setAttribute('type','text');
							input.setAttribute('name','email');
							//input.setAttribute('value','');
							column.appendChild(input);
						row.appendChild(column);
					
					//Botones
					var row = document.createElement('tr');
						table.appendChild(row);
					var column = document.createElement('td');
						column.setAttribute('class','botones');
						var button = document.createElement('button');
							button.setAttribute('name','envio');
							button.setAttribute('type','button');
							button.setAttribute('onClick','sendAuthForm()')
							button.textContent = 'Enviar';
							column.appendChild(button);						
						row.appendChild(column);
					var column = document.createElement('td');
						column.setAttribute('class','botones');
						var button = document.createElement('input');
							button.setAttribute('type','reset');
							button.setAttribute('value','Borrar');
							column.appendChild(button);						
						row.appendChild(column);		
}
