function BrowserSniffer() {
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		
	else if (document.all) type="IE";		
	else if (document.layers) type="NN";		
	else if (!document.all && document.getElementById) type="MO";					
	else type = "IE";
}

function seleccionar_dpto(id) {
	//alert("ji "+unescape(id));
	ChangeContent('div_directorio', "<h2>Cargando informaci&oacute;n. Por favor espere</h2>");
	//alert ("id " + id);
	url = "/www/directorio.php?dpto_id="+id;
	//alert ("cargar pag " + url);
	if ( window.frames["directorio"] ) {
		window.frames["directorio"].location = url;   
		return false;
	} else {
		return true;
	}
}
//
dir = "";
ultimo_criterio = "";
//
function cambiar_direccion(){
	if(dir == "asc"){
		dir = "desc";	
	}else{
		dir = "asc";	
	}	
}
//
function returnObjById( id ) { 
	alert(id);
    if (document.getElementById) 
        var returnVar = document.getElementById(id); 
    else if (document.all) 
        var returnVar = document.all[id]; 
    else if (document.layers) 
        var returnVar = document.layers[id]; 
    return returnVar; 
}
//
function ordenar_biblioteca(criterio){
	
	//alert("*** "+returnObjById("btn_" + ultimo_criterio));
	//document["btn_" + ultimo_criterio].src = "http://www.microfinanzasparaeldesarrollo.net/tp/files/imagenes/botones/doc_autor.gif";

    //eval('document.btn_'+ultimo_criterio+'.src="http://www.microfinanzasparaeldesarrollo.net/tp/files/imagenes/botones/doc_autor.gif"'); 
 
//document.images["btn_" + ultimo_criterio].src = "popo";
	if(ultimo_criterio == criterio){
		cambiar_direccion();
	}else{
		dir = "asc";	
	}
	ultimo_criterio = criterio;
	//alert("dir "+dir);
	ChangeContent('div_biblioteca', "<h2>Cargando informaci&oacute;n. Por favor espere</h2>");
	url = "http://www.microfinanzasparaeldesarrollo.net/tp/biblioteca.php?criterio="+criterio+"&dir="+dir;	
	//alert ("url "+url);
	//alert ("abc "+window.frames["biblioteca"]);
	if ( window.frames["biblioteca"] ) {
		window.frames["biblioteca"].location = url;   
		//return false;
	} else {
		//return true;
	}	
}

function getContent(id){
	//alert("id "+id);
	if (type=="IE") {
		str = document.all[id].innerHTML;
	}
	if (type=="NN") { 
		/*document.layers[id].document.open();
		document.layers[id].document.write(str);
		document.layers[id].document.close();*/
		str = document.layers[id];
	}
	if (type=="MO" || type=="OP") {
		str = document.getElementById(id).innerHTML;
	}
	return str;
}

function ChangeContent(id, str) {			
	//alert("id "+id);
	//alert("str "+str);
	if (type=="IE") {
		document.all[id].innerHTML = str;
	}
	if (type=="NN") { 
		document.layers[id].document.open();
		document.layers[id].document.write(str);
		document.layers[id].document.close();
	}
	if (type=="MO" || type=="OP") {
		document.getElementById(id).innerHTML = str;
	}
}