function doajax(){
			var xmlhttp=false;
			/* for IE...*/
			try{
				xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
			}catch(e){
				try{
					xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
				}catch(E){
					xmlhttp = false;
				}
			}
			/* for Mozilla...*/
			if(!xmlhttp && typeof XMLHttpRequest!='undefined'){
				xmlhttp = new XMLHttpRequest();
			}
			return xmlhttp;
		}

function onClickk(control, word){
	if(control.value==word){
		control.value='';
	}
}
function onLostFocus(control, word){
	if (control.value=='' || control.value.length<1){
		control.value=word;
	}
}

function createStringPost(idfrm){
	var frm=document.getElementById(idfrm);
	var lenfrm=frm.elements.length;
	var stringPOST="";
	var separator="";
	for(var i=0; i<lenfrm; i++){
		if (frm.elements[i].name!="" && frm.elements[i].name && frm.elements[i].name.length>0){
			stringPOST+=separator+frm.elements[i].name+'='+encodeURI(frm.elements[i].value);
			separator="&";
		}
	}
	//alert(stringPOST);
	return stringPOST;
	
}

function validateUserAjax(Req, idf){

	if (Req.readyState==4){
		//alert(Req.responseText);
		if (!isNaN(parseInt(Req.responseText))){
			if (parseInt(Req.responseText)==1){
				var frm=document.getElementById(idf);
				frm.submit();
			}else{
				alert('usuario o clave incorectos');
				//alert('Die Authentifizierung hat nicht funktioniert. Versuchen Sie es bitte noch einmal.');
			}
			return false;
		}
	}
	


}



function verificarMiembro(idform){
	    var Req=doajax();
		if (Req){
			Req.onreadystatechange=function (){
				validateUserAjax(Req, idform);
			}
			Req.open("POST", "confirmUser.php", true );
			Req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			Req.send(createStringPost(idform));
			return false;
		}else{
			alert("Bitte keine Leerzeichen");
			return false;
		}
	
	
}



