function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function contactoSmall(){
	divResultado = document.getElementById('div_contacto_small');
	var nombre = document.formaContactoSmall.txtNombre.value;
	var email = document.formaContactoSmall.txtEmail.value;
	var comentarios = document.formaContactoSmall.txaComentarios.value;
	var estado = document.formaContactoSmall.cmbEstado.value;
	
	ajax=objetoAjax();
	ajax.open("POST", "contactocapuchinos.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==1) {
             divResultado.innerHTML="<center><img src=\"images/polling2.gif\" width=\"131\" height=\"23\" /><br />Cargando.......</center>";
        }
		if (ajax.readyState==3) {
			divResultado.innerHTML = "<center><img src=\"images/polling2.gif\" width=\"131\" height=\"23\" /><br />Espere un momento........</center>";
		}
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText;
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("txtNombre="+nombre+"&txtEmail="+email+"&txaComentarios="+comentarios+"&cmbEstado="+estado);
}

function validaContactoSmall(forma){
	var msg="Favor de verificar los siguientes datos \n";
	if(document.formaContactoSmall.txtNombre.value == ""){
		msg+=" * Su nombre \n";
	}
	if(document.formaContactoSmall.txtEmail.value == ""){
			msg+=" * Su e-mail \n";
		}else{
			if(!valEmail(document.formaContactoSmall.txtEmail.value)) 
			{
				msg+="  * El formato de su e-mail no es correcto \n";
				document.formaContactoSmall.txtEmail.focus();
			}	
		}
	if(document.formaContactoSmall.cmbEstado.value == "0"){
		msg+=" * Seleccione su estado \n";
	}
	if(document.formaContactoSmall.txaComentarios.value == ""){
		msg+=" * Sus comentarios \n";
	}
	
	if(msg!="Favor de verificar los siguientes datos \n"){
		alert(msg);
		return false;
	}else{
		return true;
	}
}
function valEmail(valor){
	re=/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/
	if(!re.exec(valor))    {
		return false;
	}else{
		return true;
	}
}