String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
};
function validaBoxLogin(){
	var formulario = document.login;
	
	if(formulario.email.value.trim()==""){
		alert('Por favor, informe seu email.');
	}else if(formulario.email.value.indexOf('@')==-1){
		alert('Por favor, informe seu email corretamente.');
	}else if(formulario.senha.value.trim()==""){
		alert('Por favor, informe sua senha.');
	}else{
		Executa('login.asp?u='+ formulario.email.value.trim() +'&p=' + formulario.senha.value.trim(),'membros');
	}
};



function AjaxRequest() {
  Ajax = false;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		Ajax = new XMLHttpRequest();

	} else if (window.ActiveXObject) { // IE
		try {
			Ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				Ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}	
   
};

function Executa(url,id) {
				this.processaResposta = function(){							 
						
						if (Ajax.readyState == 4) {
							
							if(Ajax.status==200) {
								if(Ajax.responseText.trim() == "ok"){
									//Executa('includes/box_logado.asp',id);
									location.reload();
								}else if(Ajax.responseText.length>0){
									document.getElementById(id).innerHTML=unescape(Ajax.responseText);
									for(var i=0,cpo;cpo=document.getElementsByTagName('div')[i];i++){
										if(cpo.id=="mascaragif"){
											cpo.style.display='none';	
										}
									}
										
								}else{
									alert('Por favor, verifique se seu email e senha estão corretos.');	
								}
								return true;
								
							} 
						}
						return false;
					};
		//document.getElementById(id).innerHTML='<table border="0" width="100%" height="100%" ><tr><td width="100%" align="center"></td></tr></table><center><img src="img/loading.gif"></center>';
		AjaxRequest();	
		Ajax.onreadystatechange = this.processaResposta;
		Ajax.open('GET', url, true);
		Ajax.send(null);
		
	
};

