var popUpWin=0;

function popUpWindow(URLStr, left, top, width, height)

{

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}


function asincrona(){
        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 show(url,div,previmg){
        var contenido, preloader;
		var direc=url;
		if (direc=="")
		{
			contenido = document.getElementById(div);
			contenido.innerHTML = "";
		}
        contenido = document.getElementById(div);
		var c="&amp;r=";
		var cadurl="";
		cadurl=url.indexOf("?");
		if (cadurl==-1){c="?r="+Math.random();}
        ajax=asincrona(); 
        ajax.open("GET", url+c,true); 
        ajax.onreadystatechange=function(){
                if(ajax.readyState==1){
                        if (previmg.indexOf(".")!=-1)
						{
							contenido.innerHTML = "<br><center><img src='"+previmg+"' /></center>";
						}
                        else
						{
							contenido.innerHTML = "";
						}
                }else if(ajax.readyState==4){
                        if(ajax.status==200){
                                contenido.innerHTML = ajax.responseText; 
                        }else if(ajax.status==404){
                                contenido.innerHTML = "La página no existe";
                        }else{
                                contenido.innerHTML = "Error:".ajax.status; 
                        }
                }
        }
        ajax.send(null);
}

