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 enviarSugerencia(){

        //mensaje = document.getElementById('mensaje');
        comentario = document.getElementById('comentario').value;
        provincia = document.getElementById('provinciaBox').value;
        municipio = document.getElementById('municipioBox').value;
        valoracion = document.getElementById('valoracion').value;


        ajax=objetoAjax();

        ajax.open("POST", "get_sugerencias.php");

        ajax.onreadystatechange=function() {
            if (ajax.readyState==4) {

                document.getElementById('mensaje').innerHTML = ajax.responseText
                if(ajax.responseText=="Hemos recibido su comentario, gracias."){
                   document.forms.sugerenciasform.reset();

                }
            }
        }
        ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        //enviando los valores
        ajax.send("comentario="+comentario+"&provincia="+provincia+"&municipio="+municipio+"&valoracion="+valoracion)
}

function enviarContacto(){

        //mensaje = document.getElementById('mensaje');
        nombre = document.getElementById('nombre').value;
        mail = document.getElementById('mail').value;
        motivo = document.getElementById('motivo').value;


        ajax=objetoAjax();

        ajax.open("POST", "get_contacto.php");

        ajax.onreadystatechange=function() {
            if (ajax.readyState==4) {

                document.getElementById('mensaje').innerHTML = ajax.responseText
                if(ajax.responseText=="En breve nos pondremos en contacto."){
                   document.forms.contactoform.reset();

                }
            }
        }
        ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        //enviando los valores
        ajax.send("nombre="+nombre+"&mail="+mail+"&motivo="+motivo);
}




