  function xmlhttp_get(pagina,parametros,activa_editor) {
	 var texto = "";
	 
    if (pagina=="") {
	  alert("Debe indicar la pagina que será llamada...");
	  return false; 
	}
	if (parametros=="") {
	  enviar = null;
	} else {
	  enviar = parametros;
	}
    var xmlhttp=false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
      // JScript gives us Conditional compilation, we can cope with old IE versions.
      // and security blocked creation of the objects.
      try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
        try {
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
          xmlhttp = false;
        }
      }
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  try {
		xmlhttp = new XMLHttpRequest();
	  } catch (e) {
		xmlhttp=false;
	  }
    }
    if (!xmlhttp && window.createRequest) {
	  try {
	    xmlhttp = window.createRequest();
	  } catch (e) {
        xmlhttp=false;
	  }
    }
    if (enviar != null) {
	  xmlhttp.open("GET", pagina+"?"+enviar, true);
	} else {
      xmlhttp.open("GET", pagina, true);
	}
	  
		mostrarCargando(true);
		
    xmlhttp.onreadystatechange=function() {
      if (xmlhttp.readyState==4) {
        if (xmlhttp.status==200) {
		  if (document.getElementById('xmlhttp_datos')) {
		    document.getElementById('xmlhttp_datos').innerHTML = xmlhttp.responseText;
		  } else {
				texto = xmlhttp.responseText;
  			eval(texto);
		  }

        }
        else if (xmlhttp.status==404) alert("La página solicitada no existe...")
        else alert("Status is "+xmlhttp.status)
      }
    }

		mostrarCargando(false);

    xmlhttp.send(null);
		
		return texto;
  }


    /* this function shows the pop-up when
     user moves the mouse over the link */
    function ShowPopUp()
    {
        var winW = 630, winH = 460;
        if (parseInt(navigator.appVersion)>3) {
         if (navigator.appName=="Netscape") {
          winW = window.innerWidth;
          winH = window.innerHeight;
         }
         if (navigator.appName.indexOf("Microsoft")!=-1) {
          winW = document.body.offsetWidth;
          winH = document.body.offsetHeight;
         }
        }


        var Popup = document.getElementById("Popup");

        if((Popup != null)&&(Popup != 'undefined'))
    		{
    				Popup.style.display="block";
    				Popup.style.height = winH;
    				
    				var imagen = document.getElementById("imgCargando");
    
    				var top = (winH - imagen.height) / 2;
    				var left = (winW - imagen.width) / 2
    				imagen.top = top;
    				imagen.left = left;
			}
    }

    function HidePopUp()
    {
        var Popup = document.getElementById("Popup");
        if((Popup != null)&&(Popup != 'undefined'))
				{
				   Popup.style.display="none";
				}
    }

		

	function mostrarCargando(mostrar)
	{
	 if(mostrar){
	 		ShowPopUp();
	 }else{
//		setTimeout("HidePopUp()", 2000);
 			HidePopUp();
	 }
	return true;	
	}
	


function check_all(checkbox)
{
 var tabla = $('tblDatos');
 var checks = tabla.getElementsByTagName('input');
 for(var i=0; i < checks.length; i++)
 {
 	  checks[i].checked = checkbox.checked;
 }
}

function marca_celda(idR, colorMarcado, colorDesmarcado)
{
  var check = $("eliminar_varios_" + idR);
	if(check.checked)
	{
	   color = colorMarcado;
	}
	else
	{
	  color = colorDesmarcado;
	}
  	var fila = $("row_" + idR);
//		set_bgcolor(fila,color);
		 	 											
	/*
    while (fila.hasChild) {
  		//element.removeChild(element.firstChild);
    }
	*/		 
}


  function removeElements(idE)
	{
	    var fila = document.getElementById(idE);
	    while (fila.firstChild) {
  		 fila.removeChild(fila.firstChild);
     }
	}

	function initTable()
	{
	  cargarTabla(1);
	  var linkB = $("linkAtras");
		linkB.onclick = function(){
		   anterior();
		}

	  var linkN = $("linkAdelante");
		linkN.onclick = function(){
		   siguiente();
		}

	}
	
	function siguiente()
	{
	  pagina = pagina + 1;
	  cargarTabla(pagina);
	}
	
	function anterior()
	{
	  pagina = pagina - 1;
		if(pagina >= 0)
		{
  	  cargarTabla(pagina);
		}
		else
		{
		 hideBackButton();
		}
	}
	
	function hideBackButton()
	{
	  var aLink = $("linkAtras");
		aLink.style.display = 'none'; 
	}

	function hideNextButton()
	{
	  var aLink = $("linkAdelante");
		aLink.style.display = 'none'; 
	}
	
  var pagina = 1;

	
	