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 change_(pagina_){
 //donde se mostrará los registros
 divContenido = document.getElementById('servicios_show');
 
 ajax=objetoAjax();
 //uso del medoto GET
 //indicamos el archivo que realizará el proceso de paginar
 //junto con un valor que representa el nro de pagina
 ajax.open("GET", "servicios/"+pagina_);
 divContenido.innerHTML= '<div class="servicios_loading">Cargando...<br/><img src="img/ajaxloadr.gif"></div>';
 ajax.onreadystatechange=function() {
  if (ajax.readyState==4) {
   //mostrar resultados en esta capa
   divContenido.innerHTML = ajax.responseText
  }
 }
 //como hacemos uso del metodo GET
 //colocamos null ya que enviamos 
 //el valor por la url ?pag=nropagina
 ajax.send(null)
}


//manda correo//////////////////////////////////////////////////////////////////////////////////
var READY_STATE_COMPLETE=4;
var peticion_http = null;
 
function inicializa_xhr() {
  if(window.XMLHttpRequest) {
    return new XMLHttpRequest(); 
  }
  else if(window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP");
  } 
}
//creo string con las varibles para pasarlas por url y procesarlas con mail.php
function crea_query_string() {
  var nombre = document.getElementById("nombre");
  var email = document.getElementById("email");
  var telefono = document.getElementById("telefono");
  var asunto = document.getElementById("asunto");
  var mensaje = document.getElementById("mensaje");
  
  return "nombre=" + encodeURIComponent(nombre.value) +
         "&email=" + encodeURIComponent(email.value) +
         "&telefono=" + encodeURIComponent(telefono.value) +
		 "&asunto=" + encodeURIComponent(asunto.value) +
		 "&mensaje=" + encodeURIComponent(mensaje.value) +
         "&nocache=" + Math.random();
}
 
function valida() {
  peticion_http = inicializa_xhr();
  if(peticion_http) {
    peticion_http.onreadystatechange = procesaRespuesta;
    peticion_http.open("POST", "mail.php", true);
 document.getElementById("respuesta").innerHTML = "<img src='img/ajaxloadr.gif' />"
    peticion_http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    var query_string = crea_query_string();
    peticion_http.send(query_string);
  }
}
 
function procesaRespuesta() {
  if(peticion_http.readyState == READY_STATE_COMPLETE) {
    if(peticion_http.status == 200) {
      document.getElementById("respuesta").innerHTML = peticion_http.responseText;
	  
    }
  }
}
function form_clear() {
	document.form_contacto.reset()
}

function load_page() {
	document.getElementById('box').style.visibility='visible';
	document.getElementById('loading').style.display='none';
	change_('web_design.html')
}