/**************************************************************************
 *  libajax.js
 *
 *  Implementacion de procedimientos generales para utilizar ajax.
 *
 *  Autor: Manuel Palma Martín.
 *
 *  Copyright (c) 2007 FerSoft Informática S.L.
 *  Todos los derechos reservados.
 */ 

function HttpProc(cURL)
{
   var oCon;
   try { oCon = new ActiveXObject("Msxml2.XMLHTTP"); } 
   catch(e) { try { oCon = new ActiveXObject("Microsoft.XMLHTTP"); } 
               catch(ex) { oCon = false; } }
   if(!oCon && typeof XMLHttpRequest != 'undefined') {
      oCon = new XMLHttpRequest();
   }
   if(typeof oCon == 'object') {
      oCon.open("GET", cURL, false);
      oCon.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
      oCon.onreadystatechange = function() {
         try {
            if(oCon.readyState == 4) {
               if(oCon.status == 200) {
                  eval(oCon.responseText);
               } else {
                  if(oCon.status == 404) {
                     alert("Aplicacion no disponible.");
                  } else if(oCon.status == 500) {
                     var win = window.open("", "Error", "width=600,height=450,toolbar=no,status=no,menubar=no");
                     win.document.open();
                     win.document.clear();
                     win.document.write(oCon.responseText);
                     win.document.close();
                  }
               }
            }
         } catch(e) {
            alert("Error en conexion con el servidor: " + e.message);
         }
      }
      oCon.send(null);
   } else {
      alert("Su navegador no esta soportado por esta aplicacion.");
   }
}

function VerImg(cImg)
{
   window.open('verimg.asp?key=' + cImg, '', 'width=1,height=1,toolbar=no,status=no,menubar=no');
}
