// JavaScript Document - Comun TodoCostaRica.com //

function eval_pag_synch(url){ 
  var xmlhttp = null;
  var resultado = null;
  
  // Crea el objeto //
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
  try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
  try { xmlhttp = new XMLHttpRequest(); } catch(e) {}
  //
  
  // Ejecuta la petición //
  xmlhttp.open("GET",url,false)
  xmlhttp.send(null)
  var resultado = xmlhttp.responseText;
  //
  
  // Retorna el resultado //
  if (xmlhttp.status == 200) {
   return resultado;
  }
  //
}

function cargando(interruptor){
  if (interruptor == 1){
   document.getElementById('cargando').style.visibility = 'visible';
   document.getElementById('cargando').style.top = document.documentElement.scrollTop+'px';
  }
  
  if (interruptor == 0){
   document.getElementById('cargando').style.visibility = 'hidden';
  }
}

function trim(texto) {
  return texto.replace(/^\s+|\s+$/g,"");
}

function ltrim(texto) {
  return texto.replace(/^\s+/,"");
}

function rtrim(texto) {
  return texto.replace(/\s+$/,"");
}