function NuevoAjax(){
        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 Cargar(url){
        var contenido;
        contenido = document.getElementById('contenido');
        //creamos el objeto XMLHttpRequest
        ajax=NuevoAjax(); 
        //peticionamos los datos, le damos la url enviada desde el link
        ajax.open("GET", url,true); 
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                        //modificamos el estilo de la div, mostrando una imagen de fondo
                        //contenido.style.background = "url('/images/loading.gif') left center no-repeat";
                }else if(ajax.readyState==4){
                        if(ajax.status==200){
                                //mostramos los datos dentro de la div
                                contenido.innerHTML = ajax.responseText;
                                contenido.style.background = "transparent"; 
                        }else if(ajax.status==404){
                                contenido.innerHTML = "La página no existe";
                        }else{
                                //mostramos el posible error
                                contenido.innerHTML = "Error:".ajax.status; 
                        }
                }
        }
        ajax.send(null);
}

  function changeLink (id, url) {
    var busco=document.getElementById("busco").value;
    document.getElementById(id).href = "javascript:Cargar('/"+id+"?buscar="+busco+"')";
    return false;
    }
    
function ahi() {
  alert('hola');
  }
  
  function buscar_imagenes() {
  if(document.getElementById("source1").checked==true){var source1=document.getElementById("source1").value} else {var source1=''}
  if(document.getElementById("source2").checked==true){var source2=document.getElementById("source2").value} else {var source2=''}
  location.href='/buscar/images/source'+source1+source2+'/'+encodeURIComponent(document.getElementById("busco").value).replace(/%20/g, '+')+'';
  }
  

