﻿


if (!window.unFocus) var unFocus = {};



unFocus.EventManager = function() {
	this._listeners = {};
	for (var i = 0; i < arguments.length; i++) {
		this._listeners[arguments[i]] = [];
	}
};

unFocus.EventManager.prototype = {
	
	addEventListener: function($name, $listener) {
		
		for (var i = 0; i < this._listeners[$name].length; i++)
			if (this._listeners[$name][i] == $listener) return;
		
		this._listeners[$name].push($listener);
	},
	
	removeEventListener: function($name, $listener) {
		
		for (var i = 0; i < this._listeners[$name].length; i++) {
			if (this._listeners[$name][i] == $listener) {
				this._listeners.splice(i,1);
				return;
			}
		}
	},
	
	notifyListeners: function($name, $data) {
		for (var i = 0; i < this._listeners[$name].length; i++)
			this._listeners[$name][i]($data);
	}
};




unFocus.History = (function() {

function Keeper() {
	
	var _this = this,
		
		_pollInterval = 200, _intervalID,
		_currentHash;

	
	var _getHash = function() {
		return location.hash.substring(1);
	};
	
	_currentHash = _getHash();
	
	
	var _setHash = function($newHash) {
		window.location.hash = $newHash;
	};
	
	
	function _watchHash() {
		var $newHash = _getHash();
		if (_currentHash != $newHash) {
			_currentHash = $newHash;
			_this.notifyListeners("historyChange", $newHash);
		}
	}
	
	if (setInterval) _intervalID = setInterval(_watchHash, _pollInterval);
	
	
	_this.getCurrent = function() {
		return _currentHash;
	};
	
	
	_this.addHistory = function addHistory($newHash) {
		if (_currentHash != $newHash) {
			_currentHash = $newHash;
			_setHash($newHash);
			_this.notifyListeners("historyChange",$newHash);
		}
		return true;
	};

	
	
	if (history.navigationMode)
		history.navigationMode = 'compatible';
	
	
	
	
	if (/WebKit\/\d+/.test(navigator.appVersion) && navigator.appVersion.match(/WebKit\/(\d+)/)[1] < 420) {
		
		var _unFocusHistoryLength = history.length,
			_historyStates = {}, _form,
			_recentlyAdded = false;
		
		
		
		
		function _createSafariSetHashForm() {
			_form = document.createElement("form");
			_form.id = "unFocusHistoryForm";
			_form.method = "get";
			document.body.insertBefore(_form,document.body.firstChild);
		}
		
		
		_setHash = function($newHash) {
			_historyStates[_unFocusHistoryLength] = $newHash;
			_form.action = "#" + _getHash();
			_form.submit();
		};
		
		
		_getHash = function() {
			return _historyStates[_unFocusHistoryLength];
		};
		
		
		_historyStates[_unFocusHistoryLength] = _currentHash;
		
		function addHistorySafari($newHash) {
			if (_currentHash != $newHash) {
				_currentHash = $newHash;
				_unFocusHistoryLength = history.length+1;
				_recentlyAdded = true;
				_setHash($newHash);
				_this.notifyListeners("historyChange",$newHash);
				_recentlyAdded = false;
			}
			return true;
		}
		
		
		_this.addHistory = function($newHash) { 
			
			_createSafariSetHashForm();
			
			
			
			
			
			
			_this.addHistory = addHistorySafari;
			
			
			return _this.addHistory($newHash);
		};
		function _watchHistoryLength() {
			if (!_recentlyAdded) {
				var _historyLength = history.length;
				if (_historyLength != _unFocusHistoryLength) {
					_unFocusHistoryLength = _historyLength;
					
					var $newHash = _getHash();
					if (_currentHash != $newHash) {
						_currentHash = $newHash;
						_this.notifyListeners("historyChange", $newHash);
					}
				}
			}
		};
		
		
		clearInterval(_intervalID);
		
		_intervalID = setInterval(_watchHistoryLength, _pollInterval);
		
	
	} else if (0 && navigator.userAgent.match(/MSIE (\d+\.\d+)/)[1] >= 5.5) {
		
		
		if (document.documentMode && document.documentMode >= 8)
			return;
		
		
		var _historyFrameObj, _historyFrameRef;
		
		
		function _createHistoryFrame() {
			var $historyFrameName = "unFocusHistoryFrame";
			_historyFrameObj = document.createElement("iframe");
			_historyFrameObj.setAttribute("name", $historyFrameName);
			_historyFrameObj.setAttribute("id", $historyFrameName);
			
			_historyFrameObj.setAttribute("src", 'javascript:;');
			_historyFrameObj.style.position = "absolute";
			_historyFrameObj.style.top = "-900px";
			document.body.insertBefore(_historyFrameObj,document.body.firstChild);
			
			
			
			_historyFrameRef = frames[$historyFrameName];
			
			
			_createHistoryHTML(_currentHash, true);
		}
		
		
		function _createHistoryHTML($newHash) {
			with (_historyFrameRef.document) {
				open("text/html");
				write("<html><head></head><body onl",
					'oad="parent.unFocus.History._updateFromHistory(\''+$newHash+'\');">',
					$newHash+"</body></html>");
				close();
			}
		}
		
		
			
		function updateFromHistory($hash) {
			_currentHash = $hash;
			_this.notifyListeners("historyChange", $hash);
		}
		_this._updateFromHistory = function() {
			_this._updateFromHistory = updateFromHistory;
		};

		function addHistoryIE($newHash) { 
			if (_currentHash != $newHash) {
				
				
				_currentHash = $newHash;
				
				_createHistoryHTML($newHash);
			}
			return true;
		};
		_this.addHistory = function($newHash) {
			
			_createHistoryFrame();
			
			
			_this.addHistory = addHistoryIE;
			
			return _this.addHistory($newHash);
		};
		
		_this.addEventListener("historyChange", function($hash) { _setHash($hash) });
		
	}
}
Keeper.prototype = new unFocus.EventManager("historyChange");

return new Keeper();

})();
var google_analitycs_iniciado=0;
function google_analitycs (url)
{
	if (google_analitycs_iniciado == 0) google_analitycs_iniciado= (typeof pageTracker != "undefined")? 2: 1;
	if (google_analitycs_iniciado == 2) pageTracker._trackPageview("/"+url.split2("/",1)[1]); 
}


var azohc_ajax_xmlhttp=0;
function azohc_ajax_XMLHttpRequest() 
{
	if (azohc_ajax_xmlhttp) return azohc_ajax_xmlhttp;
	var req=0;
	if (window.ActiveXObject) { 
		try { req= new ActiveXObject("Msxml2.XMLHTTP"); }
		catch (e) { 
			try { req= new ActiveXObject("Microsoft.XMLHTTP"); }
			catch (E) { req= false; }
		}
	}
	if (!req && window.XMLHttpRequest) req= new XMLHttpRequest(); 
	return azohc_ajax_xmlhttp = req;
}

function azohc_ajax_envia (url, callback, data) 
{
	
	var req= azohc_ajax_XMLHttpRequest(); 
	
	
	if (!req) return 0;

	var local= url.substr(0,5) == "file:"; 

	if (callback && !local) { 
		req.open ('GET', url, true); 
		
		req.onreadystatechange=function() {
			if (this.readyState != 4) return; 
			
			if (this.status == 200) google_analitycs (url);
			callback (req, data) 
		}
		try { req.send (null); } catch (e) {}
	}
	else if (callback) { 
		req.open ('GET', url, false); 
		try { req.send (null); } catch (e) {}
		callback (req, data); 
	}
	else {
		req.open ('GET', url, false); 
		try { req.send (null); } catch (e) {}
		return azohc_ajax_recibe (req, url); 
	}
}
function azohc_ajax_recibe (req, url) 
 {
	
	if (req.readyState != 4) return null; 
	
	if (req.status == 200) google_analitycs (url);
	

	var a; try { a= req.responseText; } catch (e) { a=null; }
	return a;
}




function azohc_ajax_cargascript (url) 

{
	var script = document.createElement("script");
	script.src = url;
	

	document.body.appendChild(script);
}
var indice_script_onload=0;
function azohc_ajax_cargascript_onload() {  
	indice_script_onload++;
}

var indice_script=0;
function azohc_ajax_carga_js (url, espera)
{
	if (1) { 
		
		eval (azohc_ajax_envia (url));
		return;
	}
	if (!indice_script) {
		indice_script= document.createElement("script"); 
            indice_script.setAttribute("type","text/javascript");  
 		indice_script.setAttribute("src", url); 
		
		
	 	
	 	document.getElementsByTagName("head")[0].appendChild (indice_script); 
	}
	else {
		indice_script.src = url; 
	}
	
}

var ForReading=1
var ForWriting=2
var ForAppending=8

var azohc_arc_fso= null;
var azohc_arc_wss= null;

function azohc_arc_fso_lee()
	{ if (!azohc_arc_fso) azohc_arc_fso= new ActiveXObject ("Scripting.FileSystemObject"); return azohc_arc_fso; }
function azohc_arc_wss_lee()	
	{ if (!azohc_arc_wss) azohc_arc_wss= new ActiveXObject ("WScript.Shell"); return azohc_arc_wss; } 


function azohc_arc_ejecuta (comando, nuevaventana, esperaterminar)


{
	azohc_arc_eco ("Ejecutando: "+comando);
	var wss= azohc_arc_wss_lee ();
	var e= wss.Run (comando, nuevaventana, esperaterminar);	
	if (e) throw new Error(0,"Error ("+e+") al ejecutar ("+comando+")");
}

function azohc_arc_eco (rotulo) 
{
	
}
function azohc_arc_popup (titulo, texto, iconos_y_botones, segundos_de_espera) 



{
	if (!segundos_de_espera) segundos_en_espera=0;
	var wss= azohc_arc_wss_lee ();
	return wss.Popup (texto, segundos_en_espera, titulo, iconos_y_botones);
}
function azohc_arc_informa  (texto, botones, segundos) { 
	return azohc_arc_popup ("Información", texto, 64 & (botones? botones: 0), segundos); }
function azohc_arc_exclama  (texto, botones, segundos) { 
	return azohc_arc_popup ("Exclamación", texto, 48 & (botones? botones: 0), segundos); }
function azohc_arc_pregunta (texto, botones, segundos) { 
	return azohc_arc_popup ("Pregunta",    texto, 32 & (botones? botones: 0), segundos); }
function azohc_arc_error    (texto, botones, segundos) { 
	return azohc_arc_popup ("Error",       texto, 16 & (botones? botones: 0), segundos); }
function azohc_arc_catch (e)
{
	if (!e) return azohc_arc_informa ("Finalizado correctamante");
	return azohc_arc_error ("ERROR: "+e.description+" ("+(e.number>>16 & 0x1FFF)+"-"+(e.number & 0xFFFF)+")");
}

function azohc_arc_lee (arc) 
{
	var fso= azohc_arc_fso_lee ();
	var inc= fso.OpenTextFile (arc, ForReading);
	var a= inc.ReadAll();
	inc.Close();
	return a;
}
function azohc_arc_graba (arc, dat) 
{
	var fso= azohc_arc_fso_lee ();
	var des= fso.OpenTextFile (arc, ForWriting);
	des.write (dat); 
	des.Close();
}

function azohc_arc_split (arc)
{
	var a="",b= arc, c="";
	var i= b.lastIndexOf("/"); if (i>=0) { a= b.substr(0,i); b= b.substr(i+1); }
	var i= b.lastIndexOf("."); if (i>=0) { c= b.substr(i+1); b= b.substr(0,i); }
	return [a,b,c];
}
function azohc_arc_join (al)
{
	return al[0]+'/'+al[1]+'.'+al[2];
}
function azohc_arc_camino (arc)
{
	var i= arc.lastIndexOf("/"); if (i<0) return arc;
	return arc.substring(0,i);
}
function azohc_arc_nombre (arc, conextension)
{
	var i= arc.lastIndexOf("/"); if (i<0) return arc;
	var a= arc.substring(i+1); if (conextension) return a;
	var i= arc.lastIndexOf("."); if (i<0) return a;
	return a.substring(0,i);
}


function azohc_arc_extension (arc, ext)
{
	var i= arc.lastIndexOf("."); if (i<0) return "";
	if (arguments.length == 1) return arc.substring(i+1).toLowerCase(); 
	
	return arc.substring(0,i+1)+ext; 
}
function azohc_arc_copia (origen, destino) 	
{
	azohc_arc_eco ("Copiando archivo: "+origen+" a "+destino);
	fso.CopyFile (origen, destino, true); 
}
function azohc_arc_mueve (origen, destino) 	
{
	azohc_arc_eco ("Moviendo archivo: "+origen+" a "+destino);
	fso.MoveFile (origen, destino);
}
function azohc_arc_elimina (destino)		
{
	azohc_arc_eco ("Borrando archivos: "+destino);
	var fso= azohc_arc_fso_lee ();
	var i= destino.lastIndexOf("*");
	var j= destino.lastIndexOf("?");
	if (!i && !j) {
		if (fso.FileExists (destino)) fso.DeleteFile (destino);
	}
	else {
		try { fso.DeleteFile (destino); } 				
		catch (e) {}
	}
}
function azohc_arc_agrega (origen, destino)		
{
	azohc_arc_eco ("Agregando archivo: "+origen+" a "+destino);
	var fso= azohc_arc_fso_lee();
	var ori = fso.OpenTextFile (origen, ForReading, true);
	var des = fso.OpenTextFile (destino, ForAppending, true);
	while (!ori.AtEndOfStream) { 
		var a = ori.ReadLine ();
		des.writeline (a); 
	}
	ori.Close ();
	des.Close ();
}


function azohc_arc_dir () 
{
	var a= ""+document.location;
	var i= a.indexOf("file:///"); if (i>=0) a= a.substr(i+8);
	i= a.lastIndexOf("/"); if (i>=0) a= a.substr(0,i);
	return a;
}
function azohc_arc_dirlee (dir, ext) 
{
	fso= azohc_arc_fso_lee();
	
	var al=[];
	var fol = fso.GetFolder(dir);
	var fc = new Enumerator(fol.files);
	for (; !fc.atEnd(); fc.moveNext()) {
		var f= ""+fc.item(); 
		if (ext) { var fl= f.split('.'); if (fl.length!=2 || fl[1]!=ext) continue; }
		
		al[al.length]=f; 
	}
	
	return al;
}
function azohc_arc_dircrea (destino, eliminasiexiste) 
{
	var fso= azohc_arc_fso_lee();
	if (eliminasiexiste && fso.FolderExists (destino)) {
		azohc_arc_eco ("Eliminando carpeta: "+destino);
		fso.DeleteFolder (destino, true);
	}
	if (!fso.FolderExists (destino)) {
		azohc_arc_eco ("Creando carpeta: "+destino);
		fso.CreateFolder (destino);
	}
}
function azohc_arc_direlimina (destino) 		
{
	azohc_arc_eco ("Borrando directorio: "+destino);
	var i= destino.lastIndexOf("*");
	var j= destino.lastIndexOf("?");
	var fso= azohc_arc_fso_lee();
	if (!i && !j) {
		if (fso.FileExists (destino)) fso.DeleteFolder (destino, true); 	
	}
	else {
		try { fso.DeleteFolder (destino, true); } 				
		catch (e) {}
	}
}
function azohc_arc_dircopia (origen, destino, eliminasiexiste) 
{
	azohc_arc_eco ("Copiando directorios: "+origen+" a "+destino);
	azohc_arc_dircrea (destino, eliminasiexiste);
	var fso= azohc_arc_fso_lee();
	fso.CopyFolder (origen, destino, true);

}
function azohc_arc_dirmueve (origen, destino)		
{
	azohc_arc_eco ("Moviendo directorio/s: "+origen+" a "+destino);
	var i= destino.lastIndexOf("*");
	var j= destino.lastIndexOf("?");
	var fso= azohc_arc_fso_lee();
	if (!i && !j) {
		if (fso.FileExists (destino)) fso.MoveFolder (origen, destino);
	}
	else {
		try { fso.MoveFolder (origen, destino); } 				
		catch (e) {}
	}
}
function azohc_arc_dircambia (directorio, extori, extdes)
{
	var fso= azohc_arc_fso_lee();
	var f= fso.GetFolder(directorio);	
	var fc = new Enumerator(f.files);
	for (; !fc.atEnd(); fc.moveNext()) {
		var a= ""+fc.item()
		var i= a.lastIndexOf("."); if (i==-1) continue
		var e= a.substring(i+1); if (e!=extori) continue
		var b= a.substring(0,i+1)+extdes
		azohc_arc_movefile (a, b);
	}
}
var html_esp="&#160;"; 
var azohc_htm_htmesp="&#160;"; 

var azohc_htm_index="index.htm";
var azohc_htm_direc="";
function azohc_htm_htm (etiqueta, texto, t2h) 
{
	if (!texto) texto=""; texto= texto.trim();
	var i= etiqueta.indexOf(" ");
	var e= (i>=0)? etiqueta.substr(0,i): etiqueta;
	if (!texto && e=="td") { t2h=0; texto=azohc_htm_htmesp; } 
	return "<"+etiqueta+">"+(texto?t2h?azohc_htm_tex2htm(texto):texto:"")+"</"+e+">\r\n";  
}
function azohc_htm_htms (etiqueta, textos, t2h) 
{
	var a=""; for (var i=0; i<textos.length; i++) a+= azohc_htm_htm (etiqueta, textos[i], t2h); return a;
}
function azohc_htm_tex2htm (a)
{
	if (!a) return azohc_htm_htmesp;
	if (typeof(a)!="string") a=""+a;
	var b="";
	for (var i=0; i<a.length; i++) {
		var h= a.charAt(i);
		if (h=='\n') { b+="<br>"; continue; }
		if (h=='\r') continue;
		if (h=='"')  { b+="&quot;"; continue; }
		var n= h.charCodeAt(0);
		if (n>=128 || "$<>&'".indexOf(h)>=0) b+="&#"+n+";"; else b+=h;
	}
	return b;
}



function azohc_htm_evento (e)
{
	return document.all? window.event : e; 
}
function azohc_htm_evento_objeto (eve, registrado_al_evento)
{
	return document.all? eve.srcElement: (!registrado_al_evento? eve.target: eve.currentTarget); 
}
function azohc_htm_evento_agrega (obj, event_name, fun) 
{
	if (obj.addEventListener) { obj.addEventListener(event_name, fun, false); return true; } 
	else if (obj.attachEvent) { return obj.attachEvent("on"+event_name, fun); }			
	
	return -1; 
} 
function azohc_htm_evento_elimina (obj, streve, fun, useCapture){
	if (obj.removeEventListener)	{ obj.removeEventListener(streve, fun, useCapture); return true; } 
	else if (obj.detachEvent)	{ return obj.detachEvent("on"+streve, fun); }
	return -1; 
} 
function azohc_htm_evento_nopropaga   (eve) { if (document.all) eve.cancelBubble= true; else eve.stopPropagation(); } 
function azohc_htm_evento_nodefecto   (eve) { if (document.all) eve.returnValue= false; else eve.preventDefault(); } 
function azohc_htm_evento_mousewheel  (eve) { 
	
	var d=0;
	if (!eve) eve= window.event;
	if (eve.wheelDelta) { d= eve.wheelDelta/120; if (window.opera) d=-d; }
	else if (eve.detail) d= -eve.detail/3;
	return Math.round(d); 
}
function azohc_htm_evento_esboton1    (eve) { return document.all? eve.button==1: eve.button==0; } 
function azohc_htm_evento_boton (eve) { 
	if (azohc_htm_esie()) return eve.button;		
	
	
	return eve.button==0? 1: eve.button==1? 4: 2;	
}
function azohc_htm_evento_keyCode     (eve) { return document.all? eve.keyCode: eve.which; } 










function html_opaco (val)			{ return document.all? "filter:alpha(opacity="+val+");": "opacity:"+(val/100)+";"; } 
function dhtml_opaco (obj, val)		{ return document.all? obj.style.filter="alpha(opacity="+val+")": obj.style.opacity=val/100; }  
function html_transparente (val)		{ return html_opaco (100-val); } 
function dhtml_transparente (obj, val)	{ return html_opaco (obj, 100-val); } 




function azohc_htm_webdir (ruta, nivel) 
{
	
	
	
	
	var b= azohc_htm_direc;
	if (typeof nivel != "undefined" && !isNaN(nivel)) {
		for (var i=0; i<nivel; i++) {
			var a= b;
			j= a.lastIndexOf('/'); if (j<0) return "";
			b= a.substr(0,j);
		}
	}
	return b+"/"+ruta;	
}


var BrowserDetect = { 
	init: function () { 
          this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; 
          this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; 
          this.OS =      this.searchString(this.dataOS) || "an unknown OS"; 
       }, 
	searchString: function (data) { 
       for (var i=0;i<data.length;i++) { 
          var dataString = data[i].string; 
          var dataProp = data[i].prop; 
          this.versionSearchString = data[i].versionSearch || data[i].identity; 
          if (dataString) { 
             if (dataString.indexOf(data[i].subString) != -1) 
                return data[i].identity; 
          } 
          else if (dataProp) 
          return data[i].identity; 
       } 
    }, 
    searchVersion: function (dataString) { 
       var index = dataString.indexOf(this.versionSearchString); 
       if (index == -1) return; 
       return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); 
    }, 
	dataBrowser: [ 
	{ string: navigator.userAgent, subString: "OmniWeb",  identity: "OmniWeb", versionSearch: "OmniWeb/" }, 
	{ string: navigator.vendor,    subString: "Apple",    identity: "Safari"  }, 
	{ prop: window.opera,                                 identity: "Opera"  }, 
	{ string: navigator.vendor,    subString: "iCab",     identity: "iCab" }, 
	{ string: navigator.vendor,    subString: "KDE",      identity: "Konqueror" }, 
	{ string: navigator.userAgent, subString: "Firefox",  identity: "Firefox" }, 
	{ string: navigator.vendor,    subString: "Camino",   identity: "Camino" }, 
	{ string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, 
 	{ string: navigator.userAgent, subString: "MSIE",     identity: "Explorer", versionSearch: "MSIE"     }, 
	{ string: navigator.userAgent, subString: "Gecko",    identity: "Mozilla",  versionSearch: "rv"    }, 
	{ string: navigator.userAgent, subString: "Mozilla",  identity: "Netscape", versionSearch: "Mozilla" }],  
	dataOS : [ 
	{ string: navigator.platform, subString: "Win", identity: "Windows" }, 
	{ string: navigator.platform, subString: "Mac", identity: "Mac"     }, 
	{ string: navigator.platform, subString: "Linux", identity: "Linux" }] 

}; 
BrowserDetect.init(); 



function azohc_htm_esie6 () { return BrowserDetect.browser == "Explorer" && BrowserDetect.version<7; }
function azohc_htm_esie () { return BrowserDetect.browser == "Explorer"; }





function azohc_lis_maximo (lis) 
{
	if (!lis.length) return Math.NaN;
	var max= lis[0]; for (var i=1; i< lis.length; i++) if (max < lis[i]) max= lis[i];
	return max;
}
function azohc_lis_minimo (lis) 
{
	if (!lis.length) return Math.NaN;
	var min= lis[0]; for (var i=1; i< lis.length; i++) if (min > lis[i]) min= lis[i];
	return min;
}
function azohc_lis_media (lis) 
{
	if (!lis.length) return Math.NaN;
	return azohc_lis_suma(lis) / lis.length
}
function azohc_lis_suma (lis) 
{
	var sum=0; for (var i=0; i< lis.length; i++) sum += lis[i];
	return sum;
}
function azohc_lis_agrega (lis, val) 
{ 
	lis[lis.length]=val; 
}
function azohc_lis_inserta (lis, ind, val) 
{
	for (var i=lis.length; i>ind; i--) lis[i]=lis[i-1]; lis[i]=val;
}
function azohc_lis_agregan (lis, lis2) 
{
	for (var i=lis.length, j=0; j<lis2.length; i++,j++) lis[i]=lis2[j];
}
function azohc_lis_elimina (lis, ind, num) 
{
	if (!num) num=1; if (ind+num>lis.length) return; 
	for (var i=ind; i<lis.length-num; i++) lis[i]=lis[i+num]; lis.length-=num;
}
function azohc_lis_invierte (lis) 
{
	var n1=0,n2=lis.length-1;
	while (n2>n1) { var i=lis[n1]; lis[n1]=lis[n2]; lis[n2]=i; n1++; n2--; }
}
function azohc_lis_esnula (lis) 
{
	for (var n=0; n<lis.length; n++) if (lis[n]) break; return n==lis.length;
}
var azohc_lis_pos=0;
function azohc_lis_compara (i,j)  
{
	if (azohc_lis_pos) {
		if (azohc_lis_pos>0) return azohc_lis_compara(i[azohc_lis_pos],j[azohc_lis_pos]);
		if (azohc_lis_pos<0) return -azohc_lis_compara(i[azohc_lis_pos],j[azohc_lis_pos]);
	}
	if (i==undefined) return (j==undefined)? 0: -1;
	if (j==undefined) return 1;
	return (i>j)?1:(i<j)?-1:0; 
}
function azohc_lis_compara0 (i,j) { return liscompara00(i[0],j[0]); }
function azohc_lis_busca (lis, val, funcom, que, pos) 


{
	azohc_lis_pos= pos;
	if (!funcom) funcom=azohc_lis_compara;
	var i, i1= -1, i2= lis.length;
	while (1) {
		i= parseInt((i1+i2)/2);
		if (i == i1 || i == i2)	{
			if (que==1) { if (i2>=0) i=i2; azohc_lis_inserta (lis, i, val); return i; }
			return -1;  
		}
		var n= funcom (lis[i], val);
		if (!n) {
			if (que==-1) azohc_lis_elimina (lis, i);
			return i;
		}
		if (n > 0) i2= i; else i1= i;
	}
}
function azohc_lis_objeto (lis, val, funcom, que) 
{
	var i= azohc_lis_busca (lis,val,funcom,que); return i<0? null: lis[i];
}

function azohc_lis_and (lis1, lis2) 
{
	var lis=[];
	for (var i=0; i<lis2.length; i++) if (azohc_lis_busca (lis1, lis2[i])>=0) lis.push(lis2[i]);
	return lis;
}
function azohc_lis_or (lis1, lis2) 
{
	var lis=[]; lis.concat(lis2);
	for (var i=0; i<lis2.length; i++) azohc_lis_busca (lis1, lis2[i], 0, 1);
	return lis;
}


Array.prototype.max = function () {
	if (!this.length) return Math.NaN;
	var m= this[0]; for (var i=1; i< this.length; i++) if (m < this[i]) m= this[i]; return m;
}
Array.prototype.min = function () {
	if (!this.length) return Math.NaN;
	var m= this[0]; for (var i=1; i< this.length; i++) if (m > this[i]) m= this[i]; return m;
}
Array.prototype.sum = function () {
	if (!this.length) return Math.NaN;
	var m=0; for (var i=0; i< this.length; i++) m += this[i]; return m;
}
Array.prototype.med = function () {
	if (!this.length) return Math.NaN;
	return this.sum() / this.length;
}
Array.prototype.mas = function (a) {
	if (typeof(a)=="number") { for (var i=0; i<this.length; i++) this[i]+=a; return; }
	if (typeof(a)=="object") { for (var i=0; i<this.length && i<a.length; i++) this[i]+=a[i]; return; }
}
Array.prototype.men = function (a) {
	if (typeof(a)=="number") { for (var i=0; i<this.length; i++) this[i]-=a; return; }
	if (typeof(a)=="object") { for (var i=0; i<this.length && i<a.length; i++) this[i]-=a[i]; return; }
}
Array.prototype.por = function (a) {
	if (typeof(a)=="number") { for (var i=0; i<this.length; i++) this[i]*=a; return; }
	if (typeof(a)=="object") { for (var i=0; i<this.length && i<a.length; i++) this[i]*=a[i]; return; }
}
Array.prototype.cop = function (a) {
	this.slice(0,this.length); this.concat(a);
}
Array.prototype.compara = function (i,j) { return i-j; } 
Array.prototype.ordena = function () { return this.sort(this.compara); } 
Array.prototype.busca = function (val, que) 

{
	var i, i1=-1, i2=this.length;
	while (1) {
		i= parseInt((i1+i2)/2);
		if (i == i1 || i == i2)	{ if (que==1) { if (i2>=0) i=i2; this.splice(i,0,val); return i+1; } return 0; }
		var n= this.compara (this[i], val);
		if (!n) { if (que==-1) this.splice(i,1); return i+1; }
		if (n > 0) i2= i; else i1= i;
	}
}


function azohc_mat_recta (x1, y1, x2, y2, x)	{ return (x1==x2) ? 0 : y1 - (x1-x)*(y1-y2)/(x1-x2); }

var azohc_mat_pi=3.1415926535897932384626433832795;
function azohc_mat_rad (grados) { return grados*azohc_mat_pi/180; } 
function azohc_mat_gra (radianes) { return radianes*180/azohc_mat_pi; } 

function azohc_mat_bitpon (va, bit, val) { if (val) va |= (1 << bit); else va &= ~(1 << bit); return va; }  
function azohc_mat_bit (va, bit) { return (va >> bit) & 1; } 

function clone(o)
{
	if (typeof(o) != 'object' || o == null) return o;
	var b= new Object(); for (var i in o) b[i] = clone(o[i]);
	return b;
}

function azohc_pun_copia () { 
	var as= arguments; var p= {};
	if (as.length == 2) { p.x=as[0]; p.y=as[1]; }
	else if (as.length == 1) {
		var q= as[0];
		if (!q.length) { p.x=q.x;  p.y=q.y; }
		else           { p.x=q[0]; p.y=q[1]; }
	}
	else { p.x=p.y=0; }
	return p;
}
function azohc_pun_ac (pun, sep) 		{ return pun.x+ sep+ pun.y; }
function azohc_pun_mas (pun, pun2)		{ return { x:pun.x+pun2.x, y:pun.y+pun2.y }; }
function azohc_pun_menos (pun, pun2)	{ return { x:pun.x-pun2.x, y:pun.y-pun2.y }; }


function azohc_rec_copia () 
{
	var as= arguments; var r= {};
	if (as.length == 4) { r.x1=as[0]; r.y1=as[1]; r.x2=as[2]; r.y2=as[3]; }
	else if (as.length == 1) {
		var q= as[0];
		if (!q.length) { r.x1=q.x1; r.y1=q.y1; r.x2=q.x2; r.y2=q.y2; }
		else           { r.x1=q[0]; r.y1=q[1]; r.x2=q[2]; r.y2=q[3]; }
	}
	else { r.x1=r.y1=r.x2=r.y2=0; }
	return r;
}
function azohc_rec_ac (r, s, contamano)	{ return r.x1+ s+ r.y1+ s+ r.x2+ s+ r.y2+ (contamano? s+(r.x2-r.x1)+s+(r.y2-r.y1): ""); }
function azohc_rec_tamano (rec)		{ return { x:rec.x2-rec.x1, y:rec.y2-rec.y1 }; }
function azohc_rec_area (rec)			{ return (rec.x2-rec.x1) * (rec.y2-rec.y1); }
function azohc_rec_perimetro (rec)		{ return 2*((rec.x2-rec.x1) + (rec.y2-rec.y1)); }
function azohc_rec_medio (rec)		{ return { x:(rec.x1+rec.x2)/2, y:(rec.y1+rec.y2)/2 }; }
function azohc_rec_dentro (rec, pun)	{ return !(rec.x1 > pun.x || rec.x2 < pun.x || rec.y1 > pun.y || rec.y2 < pun.y); }
function azohc_rec_mas (rec, rec2) 		{ return { x1:rec.x1+rec2.x1, y1:rec.y1+rec2.y1, x2:rec.x2+rec2.x2, y2:rec.y2+rec2.y2 }; }
function azohc_rec_menos (rec, rec2) 	{ return { x1:rec.x1-rec2.x1, y1:rec.y1-rec2.y1, x2:rec.x2-rec2.x2, y2:rec.y2-rec2.y2 }; }
function azohc_rec_intersecta (rec1, rec2) {
	if (rec1.x1 >= rec2.x2 || rec1.x2 <= rec2.x1) return 0;
	if (rec1.y1 >= rec2.y2 || rec1.y2 <= rec2.y1) return 0;
	return 1;
}
function azohc_rec_mete (zom, ori) { 
	var z= azohc_rec_copia (zom);
	if (z.x1 < ori.x1) { z.x1= ori.x1; z.x2= z.x1+zom.x2-zom.x1; } 
	if (z.y1 < ori.y1) { z.y1= ori.y1; z.y2= z.y1+zom.y2-zom.y1; } 
	if (z.x2 > ori.x2) { z.x2= ori.x2; z.x1= z.x2-zom.x2+zom.x1; } 
	if (z.y2 > ori.y2) { z.y2= ori.y2; z.y1= z.y2-zom.y2+zom.y1; } 
	return z;
}

function azohc_rec_recta (rec1, rec2, rec) { 
	var r= {};
	if (rec.x1 == undefined) { 
		r.x= azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x); 
		r.y= azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y); 
	}
	else {
		r.x1= azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x1); 
		r.y1= azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y1); 
		r.x2= azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x2); 
		r.y2= azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y2); 
	}
	return r;
}
function azohc_rec_rectai (rec1, rec2, rec) { 
	var r= {};
	if (rec.x1 == undefined) { 
		r.x= Math.round (azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x)); 
		r.y= Math.round (azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y)); 
	}
	else {
		r.x1= Math.round (azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x1)); 
		r.y1= Math.round (azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y1)); 
		r.x2= Math.round (azohc_mat_recta (rec1.x1, rec2.x1, rec1.x2, rec2.x2, rec.x2)); 
		r.y2= Math.round (azohc_mat_recta (rec1.y1, rec2.y2, rec1.y2, rec2.y1, rec.y2)); 
	}
	return r;
}



function azohc_punl_area (punl)
{
	if (!punl || punl.length<3) return 0;
	var t=0;
	for (var i=0, j=punl.length-1; i< punl.length; j= i++) {
		var pi=punl[i], pj=punl[j]; 
		
		t+= (pi.x-pj.x)*(pi.y-pj.y);
	}
	return t/2.0;
}
function azohc_punl_dentro (punl, pun) 
{
	if (!punl || punl.length<3) return 0;
	
	var c=0;
	
	for (var i= 0, j= punl.length-1; i < punl.length; j= i++) {
		var pi=punl[i], pj=punl[j]; 
		
		if ( ((pi.y > pun.y) != (pj.y > pun.y)) && (pun.x < (pj.x-pi.x) * (pun.y-pi.y) / (pj.y-pi.y) + pi.x) ) c = !c;
		
	}
	
	return c;
}


String.prototype.left = function (total_chars) { return this.substring(0,total_chars); }
String.prototype.right = function (total_chars) { return this.substring(this.length-total_chars); }
String.prototype.change = function (source, target) { 
	var al= this.split(source);
	var a=al[0]; for (var i=1; i<al.length; i++) a+=target+al[i];
	return a;
}
String.prototype.ltrim = function (conpuntuacion) {
	var b=" \t\r\n"; if (conpuntuacion) b+=".,:;";
	for (var i=0; i<this.length; i++) { var h= this.charAt(i); if (b.indexOf(h)>=0) continue; break; }
	return !i? this: this.substr(i)
}
String.prototype.rtrim = function (conpuntuacion) {
	var b=" \t\r\n"; if (conpuntuacion) b+=".,:;";
	var j=this.length-1; for (var i=j; i>=0; i--) { var h= this.charAt(i); if (b.indexOf(h)>=0) continue; break; }
	return i==j? this: this.substr(0,i+1)
}
String.prototype.trim = function (conpuntuacion)	{ return this.ltrim (conpuntuacion).rtrim (conpuntuacion); }
String.prototype.ttrim = function () 			{ return this.split(" ").join(""); }
String.prototype.split2 = function (separador, pordetras) {
	var i= pordetras? this.lastIndexOf(separador): this.indexOf(separador); 
	if (i<0) return pordetras? ["", this]: [this, ""];
	return [this.substr(0,i), this.substr(i+separador.length)]
}
String.prototype.modificador = function (letra, defecto) {
	var i= this.indexOf(letra); if (i<0) return defecto;
	return parseInt(this.substr(i+1));
}
String.prototype.capitaliza = function () {
	return this.charAt(0).toUpperCase()+this.substr(1).toLowerCase();
}


function length2(obj) { var j=0; for (var i in obj) j++; return j; }




Number.prototype.round = function (decimales) {
	if (!arguments.length || decimales<0) return this;
	if (!decimales) return Math.round(this);
	var n= Math.pow(10,decimales)
	return Math.round(this*n)/n;
}
Number.prototype.format = function (decimales) {
	var n= (!arguments.length || decimales<0)? this: this.round(decimales); if (!n) return "";
	var al= n.toString().split(".");
	var e= al[0]; for (var i=e.length-3, j=this>0?0:1; i>j; i-=3) e= e.substr(0,i)+'.'+e.substr(i); 
	var d= al.length>1? al[1]: ""; if (arguments.length) while (decimales > d.length) d+="0";
	return !d? e: e+','+d;
}
Number.prototype.unformat = function () {
	var n= parseFloat (this.change(".","").change(",","."));
	return (isNaN(n) || n<10e-10)? 0: n;
}
Number.prototype.ceros = function (num) {
	var a= ""+this; while (num > a.length) a="0"+a;
	return a;
}



function azohc_opcion (i) 	{ return arguments.length<=i+1? null: arguments[i+1]; }
function azohc_aleatorio (n) 	{ return parseInt(Math.random()*(n+1))%n;  }


function azohc_str_map (a, que) 

{
	if (!que || que<1 || que>3) return a;

	var minmap= "aàáâãäåæbcçdðeèéêëfghiìíîïjklmnñoòóôõöpqrstuùúûüvwxyýz";
	var maymap= "AÀÁÂÃÄÅÆBCÇDÐEÈÉÊËFGHIÌÍÎÏJKLMNÑOÒÓÔÕÖPQRSTUÙÚÛÜVWXYÝZ";
	var sinmap= "AAAAAAAABCCDDEEEEEFGHIIIIIJKLMNÑOOOOOOPQRSTUUUUUVWXYYZ";

	var b="",c,j;
	for (var i=0; i<a.length; i++) {
		c= a.charAt(i); j=-1;
		if (que!=1 && j<0) j= minmap.indexOf(c); 
		if (que!=2 && j<0) j= maymap.indexOf(c);
		if (que!=3 && j<0) j= sinmap.indexOf(c);
		if (j<0) b+=c; 
		else if (que==1) b+= minmap.charAt(j);
		else if (que==2) b+= maymap.charAt(j);
		else if (que==3) b+= sinmap.charAt(j);
	}
	return b;
}
function azohc_str_min (a) { return azohc_str_map (a,1); } 
function azohc_str_may (a) { return azohc_str_map (a,2); } 
function azohc_str_sin (a) { return azohc_str_map (a,3); } 


function azohc_str_cmp (a, b, que) 

{
	if (que) a= azohc_str_lenmap (a,que);
	if (que) b= azohc_str_lenmap (b,que);
	if (a<b) return -1;
	if (a>b) return  1;
	return 0;
}
function azohc_str_mincmp (a,b) { return azohc_str_cmp (a,b,1); } 
function azohc_str_maycmp (a,b) { return azohc_str_cmp (a,b,2); } 
function azohc_str_sincmp (a,b) { return azohc_str_cmp (a,b,3); } 
function azohc_str_fec2str (fec, sep)
{
	if (typeof(fec)!="number") return "";
	var a= parseInt(fec/10000); fec -= a*10000; if (!fec) return(a+"");
	var m= parseInt(fec/100); fec -= m*100;
	var d= fec;
	if (arguments.length==1) sep="/";
	return d+sep+m+sep+a;
}
function azohc_str_fec2nom (fec, breve) 
{
	var meses= ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
	var mesesB=["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"];
	if (typeof(fec)!="number") return "";
	var a= parseInt(fec/10000); fec -= a*10000; if (!fec) return(a+"");
	var m= parseInt(fec/100); fec -= m*100;
	if (!m) m=""; else m= breve? mesesB[m-1]: meses[m-1];
	var d= fec?fec:"";
	return d+(d&&m?" ":"")+m+(m&&a?" ":"")+a;
}





var ingra_carrusel_tipo=1;			
var INGRA_CARRUSEL_TIPO=1;			
var INGRA_CARRUSEL_TIPO1_INTERVALO=50;	
var INGRA_CARRUSEL_TIPO1_PASO=2;		
var INGRA_CARRUSEL_TIPO2_INTERVALO=1000;	
var INGRA_CARRUSEL_TIPO2_TRANPARENCIA=0;	




var ingra_carrusel=0;			
function ingra_carrusel_inicia () 	{ if (!ingra_carrusel) ingra_carrusel= new Cingra_carrusel; }
function Cingra_carrusel () 
{
	this.o=0;		
	this.ol=[]; 	
	this.timer=0;	

	this.inicia= function () 
	{
		
		this.o= document.getElementById ("ingra_carrusel"); if (!this.o) return;
		this.o.title= "Botón izquierdo navega a la ficha\r\nBotón derecho cambia modo aleatorio dinámico a fijo";
		
		
		for (var i=0; i<(INGRA_CARRUSEL_TIPO==1?9:8); i++) {
			var o= this.ol[i]= document.createElement("img"); 
			o.c=""; o.g=""; o.i=i;
			
			
			o.style.cssText= "position:absolute; top:0; left:"+(i*95)+"px; width:95px; height:71px; cursor:pointer;"; 
			
			o.onclick = function () { if (this.c) navega_navega (this.c); }
			if (INGRA_CARRUSEL_TIPO==2 && INGRA_CARRUSEL_TIPO2_TRANPARENCIA) {
				o.onload = function () { 
					window.setTimeout ("javascript:azohc_htm_transparente(ingra_carrusel.ol["+this.i+"],0);" , 100);
					
				}
			}
			
			this.o.appendChild (o); 
		}
		
		azohc_htm_evento_agrega (this.o, "contextmenu", ingra_carrusel_oncontextmenu);
		for (var i=0; i<this.ol.length; i++) {
			var o= this.ol[i]; 
			var cg= ingra_carrusel_cgl[i]; 
			o.c=cg.c; o.g= cg.g; o.src= ingra_ima_camino (o.g,0); 
		}
		this.reinicia();
		
	}
	this.reinicia = function () { 
		if (INGRA_CARRUSEL_TIPO==1) { 
			if (!ingra_carrusel_tipo) { if (this.timer) { window.clearInterval (this.timer); this.timer=0; } }
			else { if (!this.timer) this.timer= window.setInterval (ingra_carrusel_oninterval, INGRA_CARRUSEL_TIPO1_INTERVALO); }
		}
		else if (INGRA_CARRUSEL_TIPO==2) { 
			if (!ingra_carrusel_tipo) { if (this.timer) { window.clearInterval (this.timer); this.timer=0; } }
			else { if (!this.timer) this.timer= window.setInterval (ingra_carrusel_oninterval, INGRA_CARRUSEL_TIPO2_INTERVALO); }
		}
	}
	this.oncontextmenu = function (e) { 
		var eve= azohc_htm_evento(e);		
		azohc_htm_evento_nopropaga(eve);	
		azohc_htm_evento_nodefecto(eve);	
		
		ingra_carrusel_tipo= ingra_carrusel_tipo? 0: INGRA_CARRUSEL_TIPO;
		this.reinicia();		
		
		
	}
	
	this.oninterval= function ()
	{
		if (INGRA_CARRUSEL_TIPO==1) { 
			for (var i=0; i<this.ol.length; i++) {
				var o= this.ol[i];
				var x= azohc_htm_left_ten(o); x+= INGRA_CARRUSEL_TIPO1_PASO;
				if (x > 95*(this.ol.length-1)) {
					x -= 95*this.ol.length;
					var cg= null;
					while (!cg) {
						var j= azohc_aleatorio (ingra_carrusel_cgl.length);
						cg= ingra_carrusel_cgl[j]; 
						for (var j=0; j<this.ol.length; j++) if (this.ol[j].g == cg.g) { cg=null; break; }
					}
					o.c=cg.c; o.g= cg.g; o.src= ingra_ima_camino (o.g,0); 
				}
				azohc_htm_left_pon(o,x);
			}
		}
		else if (INGRA_CARRUSEL_TIPO==2) { 
			var i= azohc_aleatorio (8);
			var o= this.ol[i];
			var cg= null;
			while (!cg) {
				var j= azohc_aleatorio (ingra_carrusel_cgl.length);
				cg= ingra_carrusel_cgl[j]; 
				for (var j=0; j<this.ol.length; j++) if (this.ol[j].g == cg.g) { cg=null; break; }
			}
			if (INGRA_CARRUSEL_TIPO2_TRANPARENCIA) azohc_htm_transparente (o, 50); 
			o.c=cg.c; o.g= cg.g; o.src= ingra_ima_camino (o.g,0); 
		}
		
	}
	this.inicia(); 
}
function azohc_opcion (i) 	{ return arguments.length<=i+1? null: arguments[i+1]; }
function azohc_aleatorio (n) 	{ return parseInt(Math.random()*(n+1))%n;  }




function ingra_carrusel_oninterval()	{ if (ingra_carrusel) ingra_carrusel.oninterval(); }
function ingra_carrusel_oncontextmenu(e)	{ if (ingra_carrusel) ingra_carrusel.oncontextmenu(e); }


function correo_manda (to, cc, bc, subject, body, priority)
{
	var url= to, n=0;
	if (cc)		url+= (n++?"&":"?")+ "cc="       + cc; 
	if (bc)		url+= (n++?"&":"?")+ "bc="       + bc; 
	if (subject)	url+= (n++?"&":"?")+ "subject="  + subject;
	if (body)		url+= (n++?"&":"?")+ "body="     + body; 
	if (priority)	url+= (n++?"&":"?")+ "priority=" + priority; 

	
	location= "mailto:" + url;
}


function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = (a.getAttribute("title") != title);
    }
  }
}
function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}


var INGRA_DEBUG=0;	
var INGRA_DEBUG_PILA=40;



function Cingra_debug ()
{
	this.ventana=0; this.odiv=0; this.pila=[]; this.repite=""; 
	
	
	this.abre = function ()
	{
		
		
		

		
		var a=""+


			"<title>Ventana de Depuración</title></head>"+
			"<link rel='stylesheet' type='text/css' href='var/index.css' />"+
			"<body>"+
			"<div id='ingra_debug_div' class='ingra_debug' >"+ 
			"</div></body></html>";
		this.ventana= window.open ("", "ingra_debug_ventana", "resizable,status=no,toolbar=no,menubar=no,location=no,width=512,height=256"); 
	      if (!this.ventana) return 1;
	      this.ventana.document.write (a);
		this.odiv= this.ventana.document.getElementById("ingra_debug_div"); 
		return 0;
	}
	this.abre();
	
	
	
	
		
		
	
	this.rotulo= function (rot)
	{
		if (!rot) return;
		

		var pila= this.pila;
		if (pila.length && pila[0] == rot) { if (this.repite.length<20) this.repite+="."; }
		else {
			if (this.repite) pila[0] += this.repite; this.repite="";
			var n= INGRA_DEBUG_PILA; if (n > pila.length) n= pila.length+1;
			for (var i= n-1; i>0; i--) pila[i]= pila[i-1]; pila[0]= rot;
		}
		var a="<nobr>"; for (var i=0; i<pila.length; i++) a+= pila[i]+(!i? this.repite: "")+"<br>"; a+="</nobr>";      
		
		this.odiv.innerHTML = a;
	}
	
}
var cingra_debug= null; 
function ingra_debug_cierra () { 
	if (!cingra_debug) return;
	delete cingra_debug; cingra_debug=0; INGRA_DEBUG=0;
	
}
function ingra_debug_abre () {
	if (cingra_debug) return;
	cingra_debug= new Cingra_debug; INGRA_DEBUG=1;
	
	
}
function ingra_debug_estado () { if (cingra_debug) ingra_debug_cierra(); else ingra_debug_abre(); }

function ingra_debug (rot) 
{ 
	if (!cingra_debug) return;
	if (cingra_debug.ventana.closed) return ingra_debug_cierra ();

	for (var i=1; i<arguments.length; i++) rot+=" "+arguments[i];
	cingra_debug.rotulo (rot); 
}
function ingra_debug_objeto (obj)
{
	if (!cingra_debug) return;
	for (var n in obj) {
		var va=obj[n];
		if (typeof(va) == "function") continue;
		if (typeof(va) == "Array") va= va.join(", ");
		ingra_debug ("o."+n+" "+va);
	}
}

function fcgi_contador (cod) 
{
	return
	

	if (!cod) return
	
	var url= "ingra_contador?"+encodeURI(cod); 
	url+= "&nocache=" + Math.random(); 
	ingra_debug_abre(); ingra_debug("url:"+url); return;

	var a= azohc_ajax_envia (url); if (!a) return; 
	var v= window.open ("ingra_contador", "ingra_contador_ventana", "resizable,status=no,toolbar=no,menubar=no,location=no,width=512,height=256"); 
	v.document.write (a);

	
}


var imagen_modo=1; 

function ingra_imagen_actual(o)
{
	if (!json) return;
	if (typeof json.imagen_actual == "undefined") json.imagen_actual=null;
	if (json.imagen_actual == o) return;
	if (json.imagen_actual) {
		json.navega_onkeydown2= json.navega_onkeydown20; 
		json.navega_onkeydown20= 0; 
		json.imagen_actual= null; 
	}
	if (o) {
		json.navega_onkeydown20= json.navega_onkeydown2; 
		json.navega_onkeydown2= ingra_imagen_onkeydown; 
		json.imagen_actual= o; 
	}
}
function ingra_imagen_modo(o,modo) 
{
	if (o.modo == modo) return;
	if (modo == 1) { 
		if (o.est > o.que) {  
			o.style.cursor= 'wait'; 
			o.parentNode.style.cursor= 'wait'; 
			o.style.visibility= 'hidden';
		}
		else { 
			
			o.style.visibility= 'visible';
		}
	}
	else if (modo == 2) { 
		o.style.cursor= 'move'; 
	}
	else { 
		o.parentNode.style.cursor= 'pointer'; 
		o.style.cursor= 'pointer'; 
		o.style.visibility= 'visible';
	}
	o.modo= modo;
}
function ingra_imagen_desplaza(o,xx,yy)
{


	if (xx && o.div_xx < o.img_xx) { 
		var x2= azohc_htm_left_ten(o)
		x2-=xx; if (x2>0) x2=0; if (x2<o.div_xx-o.img_xx) x2=o.div_xx-o.img_xx;
		azohc_htm_left_pon (o, x2);
		
	}
	if (yy && o.div_yy < o.img_yy) {
		var y2= azohc_htm_top_ten(o);
		y2-=yy; if (y2>0) y2=0; if (y2<o.div_yy-o.img_yy) y2=o.div_yy-o.img_yy;
		azohc_htm_top_pon (o, y2); 
		
	}
	
	
	

	
	
	
	
	
}
function ingra_imagen_onmousemove(eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	var boton= azohc_htm_evento_boton(e); 
	if (o.boton != 1) {
		
		return;
	}

	azohc_htm_evento_nopropaga(e); 
	azohc_htm_evento_nodefecto(e); 
	var punto= azohc_eve_pos (e, 0);

	
	
	if (o.est > o.que) {
		
		var xx= o.punto.x-punto.x;
		var yy= o.punto.y-punto.y;
		
		
		
		
		if (Math.abs(xx) < 10 && Math.abs(yy) < 10) return; 
		
		ingra_imagen_modo(o,2); 
		ingra_imagen_desplaza(o,xx,yy)
		
		
		
		

		
	}
}
function ingra_imagen_onmousedown (eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	var boton= azohc_htm_evento_boton(e); o.boton=0; if (boton != 1) return
	azohc_htm_evento_nopropaga(e); 
	azohc_htm_evento_nodefecto(e); 
	o.boton= boton; 
	o.punto= azohc_eve_pos(e,0);
	
	ingra_imagen_modo(o,0); 
	
	
}
function ingra_imagen_onmouseup(eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	if (typeof(o.est) == "undefined") return;
	var boton= azohc_htm_evento_boton(e); o.boton=0;
	azohc_htm_evento_nopropaga(e); 
	azohc_htm_evento_nodefecto(e); 
	

	if (o.modo==2 || boton != 1) { 
		ingra_imagen_modo(o,0); 
		
		return; 
	}
	if (e.ctrlKey || e.shiftKey) {
		window.open(ingra_ima_camino (o.cod,2)); 
		return;
	}
	o.est= (o.est == o.que)? o.que+1: o.que;
	ingra_imagen_modo(o,1); 
	o.src= ingra_ima_camino (o.cod,o.est)
}

function ingra_imagen_onkeydown(e)
{
	var eve=azohc_htm_evento(e), o= azohc_htm_evento_objeto(eve); 
    	var keycode= azohc_htm_evento_keyCode(eve), key = String.fromCharCode(keycode).toUpperCase();
	
	
	o= json.imagen_actual; if (!o) return;
	switch (keycode) {
	
	
	case 37: ingra_imagen_desplaza(o,-10,0); break;
	case 38: ingra_imagen_desplaza(o,0,-10); break; 
	case 39: ingra_imagen_desplaza(o,10,0); break;
	case 40: ingra_imagen_desplaza(o,0,10); break; 
	case 27: return;
	
	
	}
	azohc_htm_evento_nopropaga(e); 
	azohc_htm_evento_nodefecto(e); 
}
function ingra_imagen_onmouseover (eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	
	
	if (o.est>o.que) ingra_imagen_actual (o); 
	ingra_imagen_modo(o,0); 
}
function ingra_imagen_onmouseout (eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	
	ingra_imagen_actual(null); 
	ingra_imagen_modo(o,0); 
}
function ingra_imagen_onload(cod,que,eve)
{
	var e=azohc_htm_evento(eve), o= azohc_htm_evento_objeto(e); 
	
	if (typeof(o.est) == "undefined") {
		o.cod= cod;
		o.que= que;
		o.est= que;
		o.modo= 0;
		o.punto={x:0,y:0};
		o.boton=0
		
		var o1= o.parentNode; o1.imagen=o;
		o.div_xx= azohc_htm_width_ten (o1);
		o.div_yy= azohc_htm_height_ten (o1);
		if (!o.div_xx) azohc_htm_width_pon (o1, o.div_xx= o.width);
		if (!o.div_yy) azohc_htm_height_pon (o1, o.div_yy= o.height);
		o.div_xx0= o.div_xx; 
		o.div_yy0= o.div_yy; 

		
		
		
		
		
		

		azohc_htm_evento_agrega (o, "mousedown",		ingra_imagen_onmousedown); 
		azohc_htm_evento_agrega (o, "mouseup",		ingra_imagen_onmouseup); 
		azohc_htm_evento_agrega (o, "mousemove",		ingra_imagen_onmousemove);
		
		
		azohc_htm_evento_agrega (o, "mouseover",		ingra_imagen_onmouseover);
		azohc_htm_evento_agrega (o, "mouseout",		ingra_imagen_onmouseout);
	}
	o.boton=0
	
	
	var div_xx= o.div_xx0;
	var div_yy= o.div_yy0;
	if (!imagen_modo) {
		if (o.que) { if (o.est > o.que) { div_xx= Math.min(2*div_xx,o.width);  div_yy= Math.min(2*div_yy,o.height); } }
		else if (o.est) { div_xx= o.width; div_yy= o.height; } 
	}
	
	var img_xx= o.width; 	
	var img_yy= o.height;
	var img_x1= (div_xx-img_xx)/2;
	var img_y1= (div_yy-img_yy)/2;
	if (o.est > o.que) {
		var x1= o.punto.x-o.img_xx/2;		
		var y1= o.punto.y-o.img_yy/2;
		var x2= parseInt(x1*img_xx/o.img_xx);		
		var y2= parseInt(y1*img_yy/o.img_yy);
		img_x1 -= x2-x1;
		img_y1 -= y2-y1;

		
		
		
		ingra_imagen_actual(o)

		if (!imagen_modo) {
			if (div_xx > img_xx) img_x1= (div_xx-img_xx)/2; else if (img_x1>0) img_x1=0; else if (img_x1<div_xx-img_xx) img_x1=div_xx-img_xx;
			if (div_yy > img_yy) img_y1= (div_yy-img_yy)/2; else if (img_y1>0) img_y1=0; else if (img_y1<div_yy-img_yy) img_y1=div_yy-img_yy;
		}
	}
	if (!imagen_modo) {
		azohc_htm_width_pon (o.parentNode, div_xx);
		azohc_htm_height_pon (o.parentNode, div_yy);
		o.div_xx= div_xx; 	
		o.div_yy= div_yy;
	}
	azohc_htm_left_pon (o, img_x1);
	azohc_htm_top_pon  (o, img_y1);
	o.img_xx= img_xx; 	
	o.img_yy= img_yy;
	
	
	ingra_imagen_modo(o,0); 
}		
function ingra_imagen_monta_htm (cod, que, id, xx, yy) 
{
	
	if (!que) que=0;
	
	var a="<div class='ingra_imagen' style='"+  
			" position:relative;"+ 
			
			" cursor:pointer;"+
			" overflow:hidden;"+
			
			(xx? " width:"+xx+"px;": "")+ 
			(yy? " height:"+yy+"px;": "")+ 
			
			
		"'>"+
		"<img class='ingra_imagen' "+(id? "id='"+id+"' ": "")+
			" src='"+ ingra_ima_camino (cod,que)+"' alt=''"+
			" onload='return ingra_imagen_onload(\""+cod+"\","+que+",event);'"+ 
			
			" style='"+
			" position:absolute; left:0px; top:0px; "+ 
			
			" cursor:pointer;"+ 
			
			
			
	      "'/>"+
		
		"</div>"
	
	return a;
}
function ingra_imagen_busca (cod)
{
	
	
	var ol= document.getElementsByTagName("img");
	for (var i=0; i<ol.length; i++) {
		var o= ol[i];
		
		if (o.getAttribute("class") != 'ingra_imagen') continue; 
		
		if (o.cod == cod) return o;
	}
	return null;
}
function ingra_imagen_cambia (id, cod)
{
	
	var o= document.getElementById(id); if (!o) return;
	
	
	o.cod= cod; o.est=o.que; 
	
	o.src= ingra_ima_camino (o.cod, o.que);
}




var ingra_ima_diralt= "ima/alta";		
var ingra_ima_dirmed= "ima/media";		
var ingra_ima_dirbaj= "ima/baja";		

var ingra_ima_prefijo= 	0;	
var ingra_ima_media=	384;	
var ingra_ima_baja=	96;	
var ingra_ima_colnum= 	3;	
var ingra_ima_filnum= 	3;	
var ingra_ima_conborde= 1;	

function Cingra_imagenes ()
{
	this.objl=[]		
	this.monta_htm= function (imal, mod) 
	{
		if (arguments.length <= 1) mod="";
		else if (typeof(mod) != "string") mod="x"+mod;
		
		if (!navega_imagenes++) this.objl=[];
		var num= this.objl.length;
		this.objl[num]= new Cingra_imagenes_grupo (num, imal); 
		return this.objl[num].monta_htm (mod);
	}
	this.ima_navega1=  function (num, event)	{ if (num<this.objl.length) this.objl[num].ima_navega1(event); }
	this.ima_navega2=  function (num, pos)	{ if (num<this.objl.length) this.objl[num].ima_navega2(pos); }
	
	this.ima_onload=   function (num) { 
		
		if (num<this.objl.length) this.objl[num].ima_onload(); 
	}
}
var imagenes= new Cingra_imagenes;

function ingra_ima_camino (cod, que) 
{
	var a= que==0? ingra_ima_dirbaj: que==1? ingra_ima_dirmed: ingra_ima_diralt;
	if (ingra_ima_prefijo && cod.indexOf('/')<0) {
		var i= cod.lastIndexOf('.');
		a+='/'+cod.substr (0, ingra_ima_prefijo>i? i: ingra_ima_prefijo);
		
	}
	if 	  (que==2 || azohc_arc_extension(cod)=="png") a += '/'+cod;
	else if (azohc_arc_extension(cod)=="gif") a += '/'+azohc_arc_extension(cod,"png");
	else a += '/'+azohc_arc_extension(cod,"jpg");
	
	return a;
}

function Cingra_imagenes_grupo (num, imal)
{
	this.num= num;			
	this.imal=imal;			

	this.oimg= null;			
	this.otit= null;			
	this.cod="";			
	this.alta= 0;			

	this.zom=0;				
	this.pos=0;				
	
	this.colnum=3; this.filnum=3; this.titulo=0; this.rotado=0;

	this.inicia= function () 
	{
		if (this.oimg) return;
		
		
	}
	
	this.ima_navega2= function (pos) 
	{
		var ima= imal[pos];
		var a= ingra_imagen_cambia ("ingra_ima_imagen_"+this.num, ima.cod);
		
		
		
		
		var otd= document.getElementById("ingra_ima_titulo_"+this.num); 
		if (otd) otd.innerHTML= ima.res;
	}
	this.monta_htm1= function (pos, principal, tmx, tmy)
	{
		var ima= imal[pos];
		if (!ima.res) ima.res="";
		var tit= ""; if (!this.titulo && ima.res) tit= " title='"+ima.res+"'";  
		if (principal) {
			
			var a= ingra_imagen_monta_htm (ima.cod, 1, "ingra_ima_imagen_"+this.num, tmx, tmy) 
			if (this.titulo) a+= "<div id='ingra_ima_titulo_"+this.num+"' >"+ima.res+"</div>"; 
			return a;
		}
		else {
			var a= "<img src='"+ingra_ima_camino(ima.cod,0)+"' alt=''"+tit+" border=0 />"
			a= "<a href='javascript:imagenes.ima_navega2("+this.num+","+pos+");' "+util_status(ima.res)+">"+a+"</a>";
			if (this.titulo && ima.res) a+= "<div class='letra_minima'>"+ima.res+"</div>";
			return a;
		}
	
	}
	this.monta_htm= function (mod)
	{
		this.colnum= mod.modificador('x',ingra_ima_colnum);
		this.filnum= mod.modificador('y',ingra_ima_filnum);
		this.titulo= mod.modificador('t',0);
		this.rotado= mod.modificador('r',0);
		
		var imal= this.imal; if (!imal || !imal.length) return "";
		var tmx= tmy= ingra_ima_media;
		
		this.ima= imal[0];
		
		
		var tbx= ingra_ima_baja+4;
		var tby= ingra_ima_baja+4;	
		var fnm= this.filnum? this.filnum: parseInt(tmy / tby);
		

		
		

		var a;
		if (imal.length==1) {
			this.titulo=0; 
			a= this.monta_htm1(0,true,tmx,tmy); 
		}
		else {
			a= "<table class='ingra_imagenes' cellspacing=0><tr>"; 
			
			a+= "<td class='ingra_imagenes_media' id='ingra_ima_multiple_"+this.num+"' >"+ 
				this.monta_htm1(0,true,tmx,tmy)+"</td>"; 
		
			a+= "<td class='ingra_imagenes_separa' ></td>"; 



			var cn= this.colnum? this.colnum: (imal.length>2*fnm && ingra_ima_baja<80)? 3: imal.length>fnm? 2: 1;
			var fn= parseInt(imal.length/cn) + (imal.length%cn>0);
			if (cn>1 && (parseInt(imal.length/(cn-1)) + (imal.length%(cn-1)>0)) == fn) cn--;
			a+= "<td class='ingra_imagenes_minis' >"; 

			if (fn>fnm && fnm>0) a+="<div style='overflow:auto; height:"+(tby*fnm+(ingra_ima_conborde? fnm+1: 0))+"px;' >" 
			a+= "<table cellspacing=0>" 
			if (this.rotado) {
				for (var c=0; c<cn; c++) {
					a+= "<tr>";
					for (var f=0; f<fn; f++) {
						var i= cn*f+c; if (i>=imal.length) continue;
						if (!imal[i]) break;
						a+= "<td style='width:"+tbx+"px; height:"+tby+"px;' >"+this.monta_htm1(i,false)+"</td>"; 
					}
					a+="</tr>";
				}
			}
			else {
				for (var i=0,j=0; i<imal.length; i++) {
					if (!imal[i])  { if (j) a+= "</tr>"; j=0; continue; }
					if (!j++) a+= "<tr>";
					
					a+= "<td style='width:"+tbx+"px; height:"+tby+"px;' >"+this.monta_htm1(i,false)+"</td>"; 
					if (j == cn) { a+= "</tr>"; j=0; }
				}
				if (j) { 
					
					a+="</tr>"; }
			}	
			a+= "</table>";
			if (fn>fnm && fnm>0) a+="</div>"
			a+= "</td>";
		

			a+= "</tr></table>";
		}
		
		
		return a;
	}
}
var indice_indcam=  1;		
var indice_indcan=  0;		
var indice_indhij=  1; 		
var indice_conniv0= 0;		
var indice_conico=  0;		
var indice_concod=  0;		
var indice_maximo=  34;		
var indice_compacta=1;		
var indice_actual=  0;		
var indice_capitaliza=0;	

function capitaliza (a) { return indice_capitaliza? a.capitaliza(): a; }






















function indice_concodigo (tab) 
{
	return tab!="car" && tab!="sql" && tab!="xjs";
}
function indice_concodigo2 (cod) 
{ 
	var i= cod.indexOf('.'); if (i<0) return 0; 
	return indice_concodigo (cod.substr(0,i));
}
function indice_href1 (pos)
{
	var ind= indice[pos];
	var href= "javascript:"+(ind.pag? "indice_navega": "indice_actualiza")+"(\""+ind.cod+"\")";
	return href; 
}
function indice_url_inicio () { return indice[0].cod; } 


var indice_cache= { cod: "", pos: 1 } 

function indice_busca (cod1) 
{
	var cod= cod1.split("?")[0];
	if (arguments.length == 2) {
		cod= arguments[0]+"."+arguments[1];
	}
	if (indice_cache.cod != cod) {
		indice_cache.cod= "";
		indice_cache.pos= 0;
		for (var i=0; i<indice.length; i++) if (indice[i].cod==cod) {
			indice_cache.cod= cod;
			indice_cache.pos= i+1;
			break;
		}
	}
	return indice_cache.pos;
}
function indice_busca1 (pos)
{
	if (pos<0 || pos>=indice.length) return [];
	var nivl=[], n= indice[pos].niv;
	for (var i=pos; i>=0; i--) if (indice[i].niv == n) nivl[n--]= i;
	return nivl;
}




function indice_busca_padre (tab,cod) 
{
	var pos= indice_busca (tab,cod); if (!pos) return 0;
	var n= indice[pos-1].niv; for (var i=pos-2; i>=0; i--) if (n > indice[i].niv) return i+1;
	return 0;
}
function indice_busca_padres_i (tab,cod) 
{
	var pos= indice_busca (tab,cod); if (!pos) return []; return indice_busca1 (pos-1)
}
function indice_busca_padres (tab,cod) 
{
	var pos= indice_busca (tab+"."+cod); if (!pos) return []; 
	var indl=[]; 
	for (var i=pos-1, n=indice[i].niv; i>=0; i--) if (indice[i].niv == n) { n--; 
		var ind= indice[i]; 
		var o= new Object; o.res=ind.res; o.pag=1; 
		var al= ind.cod.split("."); o.tab=al[0]; o.cod=al[1];
		indl.push(o); 
	} 
	return indl;
}

function indice_hijos (pos)
{
	var niv= indice[pos].niv+1;
	var il=[];
	for (var i=pos+1; i<indice.length; i++) {
		if      (niv >  indice[i].niv) break; 
		else if (niv == indice[i].niv) il.push(i);
	}
	return il;
}


function indice_actualiza (cod, forzado)
{
	
	if (!ingra_indice) return; 
	
	
	
	
	var a= indice_monta (cod, forzado); if (!a) return; 
	ingra_indice.innerHTML= a; 
	
}
function indice_indice(cod)		{ return indice_monta(cod); }
function indice_indice1(pos)		{ return indice_monta1(pos); }
function indice_indice2(niv,nivl)	{ return indice_monta2(niv,nivl); }
function indice_linea(cod,res,pag,niv,clase) { return indice_monta_linea(cod,res,pag,niv,clase); }

function indice_monta (cod, forzado) 
{
	
	var i= indice_busca (cod); if (!i) { if (!forzado) return ""; i=1; }
	return indice_monta1 (i-1)
}
function indice_monta1 (pos)
{
	
	if (pos<0) pos=0;
	
	
		var ind= indice[pos]; 
		var o= new Object; o.res=ind.res; o.pag=1; 
		var al= ind.cod.split("."); o.tab=al[0]; o.cod=al[1]; o.pos=pos+1;
		indice_actual= pos+1; 
	
	var nivl= indice_busca1 (pos);
	return indice_monta2 (0, nivl);
}
function indice_monta2 (niv, nivl)
{
	if (niv >= nivl.length) return "";
	var hl= indice_hijos (nivl[niv]); if (!hl.length) return "";
	var u=  nivl[nivl.length-1]; 

	var b= (!indice_indhij && niv==nivl.length-2)? "": indice_indice2 (niv+1, nivl)
	var todos= !niv && !indice_conniv0 || niv>=nivl.length-1 || !b;

	var a=""; 
	
	var separador=0;
	for (var i=0; i<hl.length; i++) {
		var ind= indice[hl[i]];
		if (ind.cod=="car.-") { separador=1; continue; }
		
		var escam=0; for (var k=0; k<nivl.length; k++) if (hl[i]==nivl[k]) { escam=k+1; break; } 
		var esmar= escam && (!indice_indcam || u==hl[i]);	

		var cod= ind.cod; var cod2=cod, k=cod.lastIndexOf('.'); if (k>0) cod2= cod.substr(k+1);
		var res= capitaliza(ind.res) 
			if (indice_concodigo2(ind.cod)) res= cod2+" · "+res;
			if (indice_indcan && ind.hij)   res+= " ["+ind.hij+"]";

		var clase=""; 
		if (esmar) clase=" indice_seleccion"; 
		if (separador) { clase+= " indice_separador"; separador=0; }
		if (escam || todos || !indice_compacta) {  


			if (indice_compacta && !escam && todos && i >= indice_maximo) continue;
			a+= indice_linea (cod, res, ind.pag, niv+1, clase); 
		}
		if (escam) {
			a+= b;
			
			
		}
	}
	if (todos && hl.length > indice_maximo) {
		a+= indice_monta_linea ("", "...", 0, niv+1, "");
		
	}
	if (!niv && indice_conniv0) {
		var ind= indice[0];
		var b= indice_monta_linea (ind.cod, ind.res, ind.pag, niv, " indice_seleccion"); 
		return "<ul>"+b+"<ul>"+a+"</ul></ul>";
	}
	return "<ul>"+a+"</ul>";
}
function indice_monta_linea (cod, res, pag, niv, clase) 
{
	var a= res; if (a.length > indice_maximo+2) { var b= a.substr(0,indice_maximo)+"..."; a= "<acronym title='"+a+"'>"+b+"</acronym>"; }
	var href= "javascript:"+(pag? "indice_navega": "indice_actualiza")+"(\""+cod+"\")";
	return "<li><a href='"+href+"' class='indice"+niv+" "+clase+"' "+util_status(res)+">"+a+"</a></li>";
}
function indice_navega (cod)
{
	
	navega_navega (cod);
}

function indice_raiz () 
{ 
	return indice_href1(0); 
}

function indice_padres1 (cod, i1, i2, soloultimo) 
{
	var i= !cod? indice_actual: indice_busca(cod);
	var nivl= indice_busca1(i-1);
	var al=[]; 
	var j1=i1?i1:0; j2=nivl.length+(i2?i2:0); 
	if (j1>=j2 && i1) j1=0;
	if (soloultimo && j2>j1) j1=j2-1;
	for (var j=j1; j<j2; j++) {
		var pos= nivl[j];
		var ind= indice[pos];
		var href= indice_href1(j); 
		var res= ind.res; if (indice_concodigo2(ind.cod)) res= ind.cod.split2(".",1)[1]+" · "+res
		al.push ("<a href='"+indice_href1(pos)+"'>"+res+"</a>");
	}
	
	return al;
}
function indice_padres (cod, i1, i2, soloultimo) 
{
	var al= indice_padres1 (cod, i1, i2, soloultimo) ; if (!al.length) return "";
	return "<div class='indice_padres'>"+al.join(" / ")+"</div>"; 
}
function indice_padre (cod, i1, i2) 
{
	var al= indice_padres1 (cod, i1, i2) 
	return "<div class='indice_padre'>"+al.join(" / ")+"</div>"; 
}

function Cingra_map_leyenda (vista)
{
	this.vista= vista;
	this.oley=0;
	this.orot=0;
	this.oayu=0;
	this.rayu=	"<div style='padding:1px 5px 5px 5px;'>"+
			"<h3>Navegación descendente</h3>"+
			"Hacer clic sobre zonas no sensibles del mapa o "+
			"utilizar la rueda del ratón hacia delante, para bajar manteniendo la posición del cursor. "+
			"Utilizar la tecla [AvPág] para bajar manteniendo el centro.<br/><br/>"+

			"<h3>Navegación ascendente</h3>"+
			"Hacer clic con el botón derecho del ratón o "+
			"utilizar la rueda del ratón hacia atrás, para subir manteniendo la posición del cursor. "+
			"Utilizar la tecla [RePág] para subir manteniendo el centro.<br/><br/>"+

			"<h3>Navegación lateral</h3>"+
			"Arrastre con el botón izquierdo del ratón para desplazarse manteniendo la posición del cursor. "+
			"Utilice las teclas de dirección (flechas) para desplazarse un paso fijo.<br/><br/>"+

			"<h3>Sensibilidad de elementos</h3>"+
			"Cuando el título de capa tiene color azul, sus elementos presentarán descripción e imagen reducida "+
			"al posicionarse sobre ellos y navegaremos a la ficha al hacer clic sobre ellos. "+
			"Cuando tiene color gris, no se visualiza a la escala actual.<br/><br/>"+

			"<h3>Envío de avisos</h3>"+
			"Haciendo clic sobre cualquier zona del mapa mientras se mantine pulsada la tecla ALT, se envía por correo "+
			"electrónico un mensaje con las coordenadas del punto seleccionado"+
			"</div>";
	this.monta_htm= function () 
	{
		var b= "";
		b+= "<div class='ingra_map_leyenda'>";
		for (var i=0,j=0; i<this.vista.capas.length; i++) { 
			var cap= this.vista.capas[i]; if (cap.vis==-1 || cap.tip != 'F') continue;
			if (!j++) b+= "<h3>Fondo</h3>";
			var ia= "ima/var/check2_" + (cap.vis?"si":"no") + ".png";
			b+=	"<div id='ingra_map_ley_div_"+cap.cod+"' onclick='json.mapa.leyenda.onclick("+i+")'"+
					" style='cursor:pointer; margin:2px 0 2px 0;'>"+ 
				"<img id='ingra_map_ley_che_"+cap.cod+"' src='"+ia+"' />"+ 
				
				"<span style='margin-left:8px;'>"+cap.res+"</span></div>";
		}
		if (j) b+= "<br />";
		for (var i=0,j=0; i<this.vista.capas.length; i++) { 
			var cap= this.vista.capas[i]; if (cap.vis==-1 || cap.tip == 'F') continue;
			if (!j++) b+= "<h3>Capas</h3>";
			var ia= "ima/var/check_" + (cap.vis?"si":"no") + ".png";
			b+=	"<div id='ingra_map_ley_div_"+cap.cod+"' onclick='json.mapa.leyenda.onclick("+i+")'"+
					" style='cursor:pointer; margin:2px 0 2px 0;'>"+ 
				"<img id='ingra_map_ley_che_"+cap.cod+"' src='"+ia+"' />"+ 
				
				"<span style='margin-left:8px;'>"+cap.res+"</span></div>";
		}

		b+= "<br /><h3>Actual</h3>";
			b+=	"<div id='ingra_map_rot'>"+azohc_htm_htmesp+"</div>";

		
		b+= "</div>";
		return b;
	}
	this.cambia_escala = function () 
	{
		for (var i=0; i<this.vista.capas.length; i++) { 
			var cap= this.vista.capas[i]; if (cap.vis==-1) continue; 
		var v= ((!cap.vis1 || this.vista.esc >= cap.vis1) && (!cap.vis2 || this.vista.esc <= cap.vis2));
			var e= (( cap.edi1 && this.vista.esc >= cap.edi1) && (!cap.edi2 || this.vista.esc <= cap.edi2));
			
			var a= "class='ingra_mapa_editable' class='ingra_mapa_novisible'"; 
			if (cap.obj) cap.obj.className= (e? "ingra_mapa_editable": !v? "ingra_mapa_novisible": ""); 
		}
	}
	this.evento= function (e) { 
		var eve= azohc_htm_evento(e);				
		var obj= azohc_htm_evento_objeto(eve); 		
		var tag= obj? obj.tagName.toUpperCase(): "";	
		
		return eve;
	}
	this.inicia= function () 
	{
		this.oley= document.getElementById ("ingra_map_ley"); 
		this.oley.innerHTML= this.monta_htm ();	
		for (var i=0; i<this.vista.capas.length; i++) {
			var cap= this.vista.capas[i]; 
			cap.obj= cap.vis<0? 0: document.getElementById ("ingra_map_ley_div_"+cap.cod);	 
			
		}
		this.orot= document.getElementById ("ingra_map_rot"); 
		
		
		
		
		
		this.cambia_escala();
	}
	this.rotulo= function (rot) 
	{
		this.orot.innerHTML= rot;	
	}
	this.marca= function (cap, vis)
	{
		cap.vis= vis;
		var ele= "ingra_map_ley_che_"+cap.cod;
		var img= document.getElementById(ele); if (!img) return;
		img.src= "ima/var/check" + (cap.tip!='F'? "": "2") + "_" + (cap.vis?"si":"no") + ".png"
	}
	this.onclick= function (capi) 
	{
		var cap= this.vista.capas[capi]; if (!cap) return;
		var forzado=0;
		if (cap.tip != 'F') this.marca (cap, !cap.vis)
		else if (cap.vis) return;
		else {
			for (var cod1 in this.vista.capas) if (cod1 != cap.cod) {
				var cap1= this.vista.capas[cod1]; if (cap1.tip!='F' || !cap1.vis) continue; 
				this.marca (cap1, 0); forzado=1;
			}
			this.marca (cap, 1)
			if (typeof mapas_leyenda_onclick2 != "undefined") mapas_leyenda_onclick2(capi);
		}
		json.mapa.map_presenta ("leyenda", forzado);
	}
	
	this.ayuda_onmousemove = function (e) {
		var eve= this.evento(e);
		if (json.mapa.modo_d) json.mapa.evento (e); else
		ingra_pista.ayuda_onmousemove (eve, this.rayu);
	}
	this.ayuda_onmouseout= function (e) {
		var eve= this.evento(e);
		ingra_pista.onmouseout(); 
	}
}
function ingra_map_ayuda_onmousemove(e)	{ json.mapa.leyenda.ayuda_onmousemove(e); } 
function ingra_map_ayuda_onmouseout(e)	{ json.mapa.leyenda.ayuda_onmouseout(e); }



function correo_manda1 (to, cc, bc, subject, body, priority)
{
	var url= to, n=0;
	if (cc)		url+= (n++?"&":"?")+ "cc="       + escape(cc);
	if (bc)		url+= (n++?"&":"?")+ "bc="       + escape(bc);
	if (subject)	url+= (n++?"&":"?")+ "subject="  + escape(subject);
	if (body)		url+= (n++?"&":"?")+ "body="     + escape(body);
	if (priority)	url+= (n++?"&":"?")+ "priority=" + escape(priority);
	location= "mailto:" + url;
}


var INGRA_MAP_PASO=24;              
var mapa_correo_destino="ingra@ingra.es"; 
var mapa_correo_asunto=indice[0].res; 


function Cingra_mapa ()
{
	this.omap=0;
	this.mousedown=0;		
	this.punto={x:0,y:0}; 	

	
	this.eve=0; this.obj=0; this.tag=0; 
	this.pv={x:0,y:0}; this.po={x:0,y:0}; this.pu={x:0,y:0};
	this.actual=0;		
	this.modo_d=0;		
	this.esc=0;			

	this.inicia= function () {
		this.omap= document.getElementById ("ingra_map_img");	
		azohc_htm_evento_agrega (this.omap,	"contextmenu",	ingra_map_img_oncontextmenu);
		azohc_htm_evento_agrega (this.omap,	"mousemove",	ingra_map_img_onmousemove);
		azohc_htm_evento_agrega (this.omap,	"mousedown",	ingra_map_img_onmousedown);
		azohc_htm_evento_agrega (this.omap,	"mouseup",		ingra_map_img_onmouseup);
		azohc_htm_evento_agrega (this.omap,	"mouseout",		ingra_map_img_onmouseout);
		azohc_htm_evento_agrega (this.omap,	"mousewheel",	ingra_map_img_onmousewheel);
		azohc_htm_evento_agrega (this.omap,	"DOMMouseScroll",	ingra_map_img_DOMMouseScroll, false);
	}
	this.termina= function () {
		ingra_pista.onmouseout ();
	}
	this.imprime_actual= function () 
	{
		var a= this.actual; if (!a) return;
		var b= a.ima;
		
		
		
	}
	this.imprime_conceptos= function () 
	{
		
		
		for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i];
		for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j];
		for (var k=0; k< ima.conl.length; k++) { var con= ima.conl[k];
			var r=con.lim, s=[ima.pv.x+r.x1, ima.pv.y+r.y1, ima.pv.x+r.x2, ima.pv.y+r.y2];
			ingra_debug ("ima:"+ima.nom+" con:"+con.tab+"."+con.cod+" r:"+s.join(","));
		}}}
	}
	this.busca_actual= function (punto) 
	{
		if (this.mousedown >= 10) return 0; 
		
		
		
		var actual=null, n1=0, n2=0;
		for (var i=0; i<this.vista.capas.length; i++) { var cap= this.vista.capas[i];
		for (var j=cap.imal.length-1; j>=0; j--) { var ima= cap.imal[j];
		
			var p= { x:punto.x-ima.x, y:punto.y-ima.y };
			
			for (var k=ima.conl.length-1; k>=0; k--) { 
				var con= ima.conl[k];
				if (actual && con.area >= actual.area) continue; n1++;
				if (azohc_rec_dentro (con.lim, p)) { n2++;
					
					
					
					
					
					
					if (con.punl.length >= 3 && !azohc_punl_dentro (con.punl, p)) continue;
					actual=con; actual.ima=ima;
				}
			}
		}}
		
		if (this.actual && this.actual == actual) {
			
			ingra_pista.area_onmousemove (this.eve, this.actual, this.actual.ima);  
			return 2;
		}
		ingra_pista.onmouseout();
		this.actual= actual;
		if (this.actual) {
			ingra_pista.area_onmousemove (this.eve, this.actual, this.actual.ima);  
			return 1;
		}
	}
	this.evento= function (e, imprime) { 
		this.eve= azohc_htm_evento(e);					
		this.obj= azohc_htm_evento_objeto(this.eve); 			
		this.tag= this.obj? this.obj.tagName.toUpperCase(): "";	
		this.pv= azohc_eve_pos (this.eve, 0); 
		var p= azohc_obj_offset (this.obj);
		var q= azohc_obj_offset (this.omap);
		this.pv= azohc_pun_mas(this.pv, p); 
		this.pv= azohc_pun_menos(this.pv, q);
		if (!azohc_rec_dentro (this.vista.ven, this.pv)) ingra_pista.onmouseout();
		this.rotulo();
	}
	this.rotulo= function () { 
		this.po= this.vista.ven2ori (this.pv);   
		this.pu= this.vista.ori2utm (this.po);
		var e= this.vista.esc; if (ingra_map_esc_doble) e= parseInt(e/2)+e%2;
		var a= "<p>Escala "+e+(ingra_map_esc_doble?"D":"")+(this.vista.esc==this.vista.niveles-1?" MAXIMA":"")+": 1 / "+ 
			this.vista.escala().format()+"</p>"+
			"<p>UTM: "+this.pu.x.format(0)+"  "+this.pu.y.format(0)+"</p>";
			
		if (this.modo_d) {
			a+= "<br>botonn: "+azohc_htm_evento_boton(this.eve);
			a+= "<br>ven: "+this.pv.x+" "+this.pv.y;
			a+= ingra_pos_presenta (this.eve);
		}
		this.leyenda.rotulo(a);
	}
	this.nopropaga= function () {	
		azohc_htm_evento_nopropaga(this.eve);	
		azohc_htm_evento_nodefecto(this.eve);	
	}
	this.onkeydown= function (e) { 
		
		if (typeof ingra_mapa_onkeydown2 != "undefined") ingra_mapa_onkeydown2 (e);
		this.omap= document.getElementById ("ingra_map_img");	
		if (!this.omap) {
			
			return;
		}
		this.evento(e); if (this.eve.altKey) return;
		
		
		ingra_pista.onmouseout ();
    		var keycode= azohc_htm_evento_keyCode(this.eve), key = String.fromCharCode(keycode).toUpperCase();
		var ven= this.vista.ven, pv= { x:parseInt((ven.x2-ven.x1)/2), y:parseInt((ven.y2-ven.y1)/2) };
		

		switch (keycode) {
		case 33: case 109: this.vista.escala_menos (pv); this.nopropaga(); break; 
		case 34: case 107: this.vista.escala_mas (pv); this.nopropaga(); break; 
		case 37: this.vista.desplaza ({x:-INGRA_MAP_PASO, y:0}); this.nopropaga(); break;
		case 38: this.vista.desplaza ({x:0, y:-INGRA_MAP_PASO}); this.nopropaga(); break; 
		case 39: this.vista.desplaza ({x:INGRA_MAP_PASO, y:0}); this.nopropaga(); break;
		case 40: this.vista.desplaza ({x:0, y:INGRA_MAP_PASO}); this.nopropaga(); break; 
		case 27: this.pon_mousedown(0); this.par_elimina(); break;
		
		default:
			if (this.eve.shiftKey) switch (key) {
			case 'A': this.imprime_actual (); return;
			case 'D': ingra_map_esc_doble = !ingra_map_esc_doble; this.rotulo(); break; 
			case 'E': this.modo_d= !this.modo_d; this.nopropaga(); this.rotulo(); return; 
			case 'C': this.imprime_conceptos (); return;
			
			}
			return;
		}
		this.map_presenta ("onkeydown");	  
		this.rotulo();
	}
	this.pon_mousedown = function (mousedown) {
		if (this.mousedown == mousedown) return;
		this.mousedown= mousedown;
		if (this.mousedown >= 10) this.omap.style.cursor= "move"; 
		else this.omap.style.cursor= "pointer"; 
	}
	this.oncontextmenu = function (e) { 
		this.evento(e); 
		this.nopropaga(); 
		
		
		
	}
	
	
	
	
	
	
	
	this.onmouseup = function (e) {
		this.evento(e); 
		this.nopropaga();
		ingra_pista.onmouseout ();
		if (this.eve.altKey && this.manda_mail()) return; 
		if (this.mousedown==1) {
			if (this.actual && this.actual.url) {
				navega_navega (this.actual.url);
				this.actual=0;
				return;
			}
			this.vista.escala_mas (this.pv);
			this.map_presenta ("onmouseup1");	  
		}
		if (this.mousedown==2) {
			this.vista.escala_menos (this.pv,2);
			this.map_presenta ("onmouseup2");	  
		}
		this.pon_mousedown (0); 
	}
	this.onmousedown = function (e) {
		this.evento(e);
		this.nopropaga(); 
		this.pon_mousedown(0); 
		this.mousedown= azohc_htm_evento_boton(this.eve);
		ingra_pista.onmouseout();
		this.punto= azohc_pun_copia (this.pv); 
	}
	this.onmousemove = function (e) {
		this.evento(e);
		this.nopropaga();
		
		if (this.mousedown == 10) { 
			var b= azohc_htm_evento_boton(this.eve);
			
			if (b != 1) { this.pon_mousedown(0); return; }

			var d= azohc_pun_menos (this.punto, this.pv);
			
			this.punto= azohc_pun_copia (this.pv); 

			this.vista.desplaza (d);
			this.map_presenta ("onmousemove");
		}
		else if (this.mousedown == 1) { 
			var d= azohc_pun_menos (this.punto, this.pv);
			if (Math.abs(d.x) < 10 && Math.abs(d.y) < 10) return; 
			

			ingra_pista.onmouseout();  
			this.pon_mousedown(10);
		}
		else {
			if (azohc_htm_esie()) {
				var b= azohc_htm_evento_boton(this.eve);
				if (b==1) { this.mousedown=1; ingra_pista.onmouseout(); this.punto= azohc_pun_copia (this.pv); return; }
			}
			this.busca_actual (this.pv);
		}
	}
	this.onmouseout = function (e) {
		this.evento(e); 
		if (azohc_htm_esie()) {
			this.pon_mousedown(0);
		}
		ingra_pista.onmouseout();
		
	}
	this.onmousewheel = function (e) {
		this.evento(e);
		this.nopropaga();
		this.pon_mousedown(0); 
		ingra_pista.onmouseout();  
	  	var w= azohc_htm_evento_mousewheel (this.eve); if (!w) return;
		
		if (w>0) this.vista.escala_mas (this.pv); else this.vista.escala_menos (this.pv);
		this.map_presenta ("onmousewheel");
		this.rotulo();
	}
	this.eliminar_sin_uso = function (eliminar_redimensionadas) 
	{
		var n=0,n1=0;
		for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i];
			
		for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j]; if (ima.uso>0) continue;
			if (!eliminar_redimensionadas && ima.uso<0) { n1++; continue; }
			
			if (ima.oimg) { this.omap.removeChild(ima.oimg); ima.oimg=0; } n++;
			for (var jj=j; jj< cap.imal.length-1; jj++) cap.imal[jj]=cap.imal[jj+1]; 
			cap.imal.length--; j--; 
		}}
		if (n) ingra_debug("eliminar_sin_uso:"+n+" mantiene:"+n1+" eliminar_redimensionadas:"+eliminar_redimensionadas);
		return n;
	}
	this.map_presenta = function (donde, forzado) 
	{
		
		var redimensionados=0,trasladados=0,creados=0,eliminados=0;
		

		this.vista.imagenes(); 

		if (this.esc != this.vista.esc) {
			this.leyenda.cambia_escala (); 

			
			var n=0,n1=0;
			for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i]; if (!cap.vis || cap.tip=='R') continue;
			for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j]; if (ima.uso) n++; if (ima.uso || !ima.oimg) continue;
				
				if (!azohc_rec_intersecta (ima.ro, this.vista.zom)) continue;

				var rv= this.vista.ori2ven (ima.ro); var y=rv.y1; rv.y1=rv.y2; rv.y2=y; 
				if (!azohc_rec_intersecta (rv, this.vista.ven)) continue;

				
				azohc_htm_rec_pon (ima.oimg, rv); 
				ima.rv= rv; ima.uso=-1; redimensionados++; 
			}}
		}
		eliminados= this.eliminar_sin_uso (this.esc == this.vista.esc);

		
		ingra_debug("--------------------------------------------------------------------------");
		for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i]; 
		for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j]; ima.encarga=0; }}
		this.encarga=0;

		for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i];
		for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j]; 
			if (ima.uso<=0) continue; 
			if (ima.err) continue; 
			if (ima.oimg)  { 
				if (ima.x != ima.pv.x) { azohc_htm_left_pon (ima.oimg, ima.x= ima.pv.x); } 
				if (ima.y != ima.pv.y) { azohc_htm_top_pon  (ima.oimg, ima.y= ima.pv.y); } 
				
				trasladados++; 
				continue;
			}
			ima.x= ima.pv.x; ima.y= ima.pv.y; ima.i=i; ima.j=j;
			
			if (!ima.oimg) { 
				ima.oimg = document.createElement("img"); creados++; 
				ima.oimg.ima= ima; 
				ima.oimg.onload = function () { 
					var ima= this.ima; this.style.visibility='visible';  
					if (ima.encarga) {
						if (ima.uso>0) ima.uso=2; 
						ima.encarga=0; json.mapa.encarga--; ingra_debug("onload encarga:"+json.mapa.encarga);
						if (!json.mapa.encarga) json.mapa.eliminar_sin_uso(1);
					}
				}
				ima.oimg.onerror = function () { 
					var ima= this.ima;
					if (ima.encarga) { 
						ima.encarga=0; json.mapa.encarga--; ingra_debug("onerror encarga:"+json.mapa.encarga);
						if (!json.mapa.encarga) json.mapa.eliminar_sin_uso(1); 
					}
					this.parentNode.removeChild(this); ima.oimg=0; ima.err=1;
				}
				this.omap.appendChild (ima.oimg); 
			}
			ima.oimg.style.cssText= "position:absolute; border:0; "+ 
				" width:"+INGRA_MAP_IMG_X+"px; height:"+INGRA_MAP_IMG_Y+"px;"+
				" left:"+ima.x+"px; top:"+ima.y+"px;"+
				" z-index:"+(2+ima.i)+";"+ 
				" visibility:hidden;"+
				
				(cap.tra? html_transparente (cap.tra): "")+
				(INGRA_DEBUG? "border:1px solid blue;": ""); 
			this.encarga++; ima.encarga=1;
			ingra_debug ("src: "+ cap.url+'/'+ima.arc+" encarga:"+this.encarga);
			ima.src= cap.url+'/'+ima.arc; 
		}}

		
		
		this.esc= this.vista.esc; 

		
		for (var i=0; i< this.vista.capas.length; i++) { var cap= this.vista.capas[i];
		for (var j=0; j< cap.imal.length; j++) { var ima= cap.imal[j]; 
			if (ima.src) ima.oimg.src= ima.src; ima.src="";
		}}
		

		
		for (var p=0; p< this.vista.parl.length; p++) {
			var par= this.vista.parl[p]; 
			
			
			if (!azohc_rec_dentro (this.vista.zom, par.po)) {
				if (par.oimg) { this.omap.removeChild(par.oimg); par.oimg=0; }
			}
			else {
				var pv= this.vista.ori2ven (par.po);
				if (!par.oimg) {
					par.pv= pv; 
					par.oimg = document.createElement("img"); 
					par.oimg.className = 'ingra_mapa_marca'
					
					par.oimg.style.cssText= "position:absolute;"+
						"left:"+(pv.x-6)+"px; top:"+(pv.y-6)+"px; width:12px; height:12px;"+
						"z-index:50;"; 
					par.oimg.src = 'ima/var/marca.gif'
					this.omap.appendChild (par.oimg); 
				}
				else if (pv.x != par.pv.x || pv.y != par.pv.y) {
					par.pv= pv; 
					azohc_htm_left_pon (par.oimg, pv.x-6); 
					azohc_htm_top_pon (par.oimg, pv.y-6);
				}
			}	
		}
	}   
	this.par_elimina= function ()
	{
		for (var p=0; p< this.vista.parl.length; p++) {
			var par= this.vista.parl[p]; 
			if (par.oimg) { this.omap.removeChild(par.oimg); par.oimg=0; }
		}
		this.vista.parl=[];
	}
	this.manda_mail= function ()
	{
		var a= this.actual; 
		var b= 	escape("Coordenadas: "+this.pu.x.format()+", "+this.pu.y.format()+"\r\n");
		if (a) b+=	escape("Elemento: "+a.res+" ("+a.tab+"."+a.cod+")"+"\r\n");
		b+= 		escape("Observaciones:"+"\r\n");

		correo_manda (mapa_correo_destino, 0, 0, mapa_correo_asunto, b, 0);
		return 1;
		
	}
}

function ingra_map_document_onkeydown (e)	{ return json.mapa.onkeydown(e); } 
function ingra_map_img_oncontextmenu(e)	{ return json.mapa.oncontextmenu(e); } 
function ingra_map_img_onmousemove(e)	{ return json.mapa.onmousemove(e); } 
function ingra_map_img_onmouseout(e)	{ return json.mapa.onmouseout(e); }
function ingra_map_img_onmousedown (e)	{ return json.mapa.onmousedown(e); } 
function ingra_map_img_onmouseup(e)		{ return json.mapa.onmouseup(e); }
function ingra_map_img_onmousewheel(e)	{ return json.mapa.onmousewheel(e); }
function ingra_map_img_DOMMouseScroll(e)	{ return json.mapa.onmousewheel(e); }





function mapa_inicia (mapa_estatico, json, param) 
{
	json.mapa= new Cingra_mapa();



	json.mapa.inicia();
	json.mapa.vista= new Cingra_map_vista (mapa_estatico);
	json.mapa.vista.inicia (param);
	json.mapa.leyenda= new Cingra_map_leyenda (json.mapa.vista);
	json.mapa.leyenda.inicia (); 
	json.mapa.map_presenta("ingra_mapa_inicia");
	json.navega_onkeydown2 = ingra_map_document_onkeydown; 
} 
var INGRA_MAP_IMG_X=512;            
var INGRA_MAP_IMG_Y=512;            
var INGRA_MAP_DIR_MAX=8;            
var ingra_map_dir_uso=0;
var ingra_map_esc_doble=0;
function Cingra_map_dir (nom) { this.nom=nom; this.uso=0; this.arcl=[]; }


function Cingra_map_vista (mapa) 
{
	this.ven= azohc_rec_copia (mapa.ven);	
	this.ori= azohc_rec_copia (mapa.ori);	
	this.ref= azohc_pun_copia (mapa.ref);	
	this.fac= mapa.fac;			
	this.niveles= mapa.niveles;	
						
						
	this.capas= mapa.capas;		
	this.parl=[];			
	
	this.zom= azohc_rec_copia (this.ori); 
	this.esc=0;				
	
	for (var i=0; i<this.capas.length; i++) {
		var cap= this.capas[i];
		cap.dirl=[];
		cap.imal=[];
		if (!cap.url) cap.url="map/"+cap.cod
		if (!cap.tra) cap.tra=0; 
		if (!cap.ext) cap.ext="gif"
		if (!cap.prefijo) cap.prefijo= cap.cod
		if (!cap.ori) cap.ori= this.ori; else cap.ori= azohc_rec_copia (cap.ori);	
		if (!cap.ref) cap.ref= this.ref; else cap.ref= azohc_pun_copia (cap.ref);	
		if (!cap.fac) cap.fac= this.fac;								
		
	}
	this.inicia= function (param)
	{
		this.zom= azohc_rec_copia (this.ori); this.esc=0; 
		
	
	
	
		this.parl=[]; 
		if (!param) return;
		
		var parl= param.split("|"); 
		for (var i=0; i<parl.length; i++) {
			var pl= parl[i].split(";"); if (pl.length<3) continue; 
			var pu= { x:parseFloat(pl[2]), y:parseFloat(pl[3]) };
			var po= this.utm2ori(pu);	
			if (!i) {
				
				
				this.escala_centra (po, parseInt(pl[4]));	
			}
			
			this.parl.push ({ tab:pl[0], cod:pl[1], po:po, esc:pl[4], oimg:null });	
		}
		
	}

	
	
	
	this.imprime= function () {
		
		ingra_debug("ven: "+this.ven.ac(","));
		ingra_debug("ori: "+this.ori.ac(","));
		ingra_debug("ref: "+this.ref.ac(","));
		ingra_debug("zom: "+this.zom.ac(","));
	}
	this.escala= function () {
		
		
		var z=this.zom, v=this.ven, mpp= (z.x2-z.x1) / (v.x2-v.x1) / this.fac; 
		return parseInt(mpp*4000);
	}
	this.utm2ori= function (pu) { return { x:Math.round((pu.x-this.ref.x*1000)*this.fac), y:Math.round((pu.y-this.ref.y*1000)*this.fac) }; }
	this.ori2utm= function (po) { return { x:po.x/this.fac+this.ref.x*1000, y:po.y/this.fac+this.ref.y*1000 }; }
	this.ori2ven= function (po) { return azohc_rec_rectai (this.zom, this.ven, po); } 
	this.ven2ori= function (pv) { return azohc_rec_recta (this.ven, this.zom, pv); } 
	this.eve2ven= function (eve)
	{
		var obj= azohc_htm_evento_objeto(eve); 			
		var esimg= obj.tagName.toLowerCase() == "img";

		var x0= !esimg? 0: obj.offsetLeft;
		var y0= !esimg? 0: obj.offsetTop;
		var x= azohc_htm_evento_offsetX_ten(eve);
		var y= azohc_htm_evento_offsetY_ten(eve); 
		
		
		
		return { x:x0+x, y:y0+y };
	}
	this.e2ven= function (e) {
		var eve= azohc_htm_evento(e); 				
		return eve2ven (eve);
	} 
	this.escala_mas= function (pv)
	{
		if (this.esc >= this.niveles-1) return 1;
		var po= this.ven2ori (pv)
		var x= (this.zom.x1+po.x)/2;
		var y= (this.zom.y1+po.y)/2;
		this.esc++; 
		var zz=Math.pow(2,this.esc), o=this.ori; xx=(o.x2-o.x1)/zz, yy=(o.y2-o.y1)/zz;  
		this.zom= azohc_rec_copia (x, y, x+xx, y+yy); 
		if (ingra_map_esc_doble && this.esc%2) this.escala_mas(pv);
	}
	this.escala_menos= function (pv)
	{
		if (this.esc <= 0) return 1;
		this.esc--; 
		if (!this.esc) { this.zom= azohc_rec_copia (this.ori); return; }
		var po= this.ven2ori (pv)
		var x= 2*this.zom.x1-po.x;
		var y= 2*this.zom.y1-po.y;
		var zz=Math.pow(2,this.esc), o=this.ori; xx=(o.x2-o.x1)/zz, yy=(o.y2-o.y1)/zz; 
		this.zom= azohc_rec_copia (x, y, x+xx, y+yy); this.zom= azohc_rec_mete (this.zom, this.ori);
		if (ingra_map_esc_doble && this.esc%2) this.escala_menos(pv);
	}
	this.escala_igual= function (pv)
	{
		if (this.esc <= 0) return 1;
		var po= this.ven2ori (pv);
		var xx= this.zom.xx(), yy= this.zom.yy();
		var x= po.x-parseInt(xx/2);
		var y= po.y-parseInt(yy/2);
		this.zom= azohc_rec_copia (x, y, x+xx, y+yy); this.zom= azohc_rec_mete (this.zom, this.ori);
	}
	this.escala_centra= function (po, esc)
	{
		if (esc<0 || esc>=this.niveles) return;
		this.esc= esc;
		var zz=Math.pow(2,this.esc), o=this.ori; xx=(o.x2-o.x1)/zz, yy=(o.y2-o.y1)/zz; 
		var x= po.x-xx/2;
		var y= po.y-yy/2;
		this.zom= azohc_rec_copia (x, y, x+xx, y+yy); this.zom= azohc_rec_mete (this.zom, this.ori);
	}
	this.escala_ajusta= function (re)
	{
		var o=this.ori;
		var zz=Math.pow(2,this.esc), xx=o.xx()/zz, yy=o.yy()/zz; 
	}
	this.desplaza= function (dv)
	{
		var po= this.ven2ori ({ x:this.ven.x1+dv.x, y:this.ven.y2+dv.y }), z=this.zom;
		this.zom= azohc_rec_copia (po.x, po.y, po.x+(z.x2-z.x1), po.y+(z.y2-z.y1)); 
		this.zom= azohc_rec_mete (this.zom, this.ori);
	}
	
	this.mapind_existe= function (cap, arc)
	{	
		
		var al= arc.split('/'); if (al.length<2) return 1;  
		var i,j,a="",nl=[],dl=cap.dirl;
		for (i=0; i<al.length; i++) {
			if (i) { 
				j=nl[i-1];
				if (azohc_lis_busca (dl[j].arcl, al[i]) < 0) {
					
					return 0;
				}
				a+="/";
			}
			if (i >= al.length-1) return 1;
			a+=al[i];
			for (j=0; j<dl.length; j++) if (dl[j].nom == al[i]) { 
				dl[j].uso= ++ingra_map_dir_uso;
				nl[i]= j; break; 
			}
			if (j<dl.length) continue; 

			if (dl.length < INGRA_MAP_DIR_MAX) j= dl.length;
			else for (j=0,k=1; k<dl.length; k++) if (dl[j].uso > dl[k].uso) j=k;
			nl[i]= j; 

			var url= cap.url+'/'+a+"/ind.json"; 
			
			
			var ami= azohc_ajax_envia (url); if (!ami) return 0;
			var b= "azohc_map_indice=["; if (ami.substr(0,b.length) != b) ami= b+ami+"];";
			try { eval (ami); }
			catch (e) {
				var a= "ERROR: "+(e? e.description+" ("+(e.number>>16 & 0x1FFF)+"-"+(e.number & 0xFFFF)+"): ": "");
				
 				ingra_debug(a+ami);
			}

			
			dl[j]= { nom:al[i], uso:++ingra_map_dir_uso, arcl:azohc_map_indice };
		}
		return 1;
	}
	function l2e(n,d) { var a=""+n; while (a.length<d) a='0'+a; return a; }
	this.archivo= function (cap, escala, y, x) 
	{
		
		
		
		var prefijo= cap.prefijo? cap.prefijo: cap.cod;
		var de= escala>=10? 4: escala>=7? 3: escala>=4? 2: 1; 
		var a= prefijo+escala; if (!cap.desde5 || escala>=5) a+= '/'+prefijo+escala+'_'+l2e(y,de);
		return a+'/'+prefijo+escala+'_'+l2e(y,de)+'_'+l2e(x,de)+'.'+cap.ext
		
		
		
	}
	this.imagenes= function () 
	{
		var zom= this.zom, ven= this.ven, esc= this.esc;
		
		
		
		

		
		for (var i=0; i<this.capas.length; i++) {
			var cap= this.capas[i]; 
			for (var j=0; j<cap.imal.length; j++) cap.imal[j].uso=0; 
			if (!cap.vis) continue;
			var esvis= (!cap.vis1 || esc>=cap.vis1) && (!cap.vis2 || esc<=cap.vis2); if (!esvis) continue; 
			var esedi= (!cap.edi1 || esc>=cap.edi1) && (!cap.edi2 || esc<=cap.edi2) && (cap.edi1 || cap.edi2); 

			var ori= cap.ori? cap.ori: this.ori;
			
			var zz=Math.pow(2,esc), xx=(ori.x2-ori.x1)/zz, yy=(ori.y2-ori.y1)/zz; 
			var x1= parseInt((zom.x1-ori.x1)/xx), x2= parseInt((zom.x2-ori.x1+xx-1)/xx);	
			var y1= parseInt((zom.y1-ori.y1)/yy), y2= parseInt((zom.y2-ori.y1+yy-1)/yy);	
			

			for (var y=y1; y<y2; y++) for (var x=x1; x<x2; x++) {
				var arc= this.archivo (cap, esc, y, x); 
				if (!cap.todas && !this.mapind_existe (cap, arc)) {
					
					continue;
				}
				var po= { x:ori.x1+xx*x, y:ori.y1+yy*y };
				var pv= this.ori2ven (po); pv.y -= INGRA_MAP_IMG_Y; 
				var ro= { x1:po.x, y1:po.y, x2:po.x+xx, y2:po.y+yy };
				var rv= { x1:pv.x, y1:pv.y, x2:pv.x+INGRA_MAP_IMG_X, y2:pv.y+INGRA_MAP_IMG_Y };
				var j=0;
				for (; j<cap.imal.length; j++) {
					var ima= cap.imal[j]; if (ima.arc != arc) continue;
					ima.po=po; ima.pv=pv; ima.ro=ro; ima.rv=rv; ima.uso=2; break;
				}
				if (j < cap.imal.length) continue;

				
				var ima={ arc:arc, po:po, pv:pv, ro:ro, rv:rv, uso:1, conl:[], oimg:null, x:0, y:0, err:0 }; 
				cap.imal.push (ima);

				
				
				
				
				if (esedi) {
					var ajson= azohc_arc_extension (arc, "json"); 
					if (this.mapind_existe (cap, ajson)) {
						var a= azohc_ajax_envia (cap.url+'/'+ajson); if (!a) continue;
						var b= "azohc_map_conceptos=["; if (a.substr(0,b.length) != b) a= b+a+"];";
						eval (a);
						ima.conl= azohc_map_conceptos;
						
						
						
						
						
						
					
					}	
				}
				
				
			}
		}
		
	}
}	





window.onload = navega_inicia;
var navega_imagenes=0; 
var json=null;

function navega_inicia () 
{
	
	var a= document.location.href; 
	var b= "";
	var i= a.lastIndexOf("#"); if (i>=0) { b= a.substr(i+1); a= a.substr(0,i); }
	var i= a.lastIndexOf("/");
	azohc_htm_direc=a.substr(0,i); 
	azohc_htm_index=a.substr(i+1); 
	
	if (!azohc_htm_esie()) { 
		ingra_raiz=   document.getElementById("ingra_raiz"); 
		ingra_cuerpo= document.getElementById("ingra_cuerpo"); if (!ingra_cuerpo) return;
		ingra_indice= document.getElementById("ingra_indice"); if (!ingra_indice) return;
		ingra_ie6= null;
	}
	if (azohc_htm_esie()) {
		if (typeof ingra_ie6 == "undefined") ingra_ie6=null;
	}
	if (typeof window_onload2 != "undefined") window_onload2(); 
	var cod2= navega_historia_inicia ();
	if (!cod2) cod2= b;
	if (!cod2) cod2= "ingra:"+indice_url_inicio (); 
	var cod = cod2.replace(/ingra\:/, "");
	navega_actualiza (cod, 1);
	azohc_htm_evento_agrega  (document,	"keydown", navega_onkeydown); 
}
function navega_onkeydown (e)
{
	
	
	
	
	if (json && typeof json.navega_onkeydown2 != "undefined") json.navega_onkeydown2 (e); 
}
function navega_historia_inicia (hasp) 
{
	unFocus.History.addEventListener('historyChange', navega_historia_evento);
	
	return window.location.hasp; 
}
function navega_historia_agrega (hasp) 
{
	
	unFocus.History.addHistory (hasp);
	
}
function navega_historia_evento (cod2, dat) 
{
	
	

	if (!cod2) cod2 = "ingra:"+indice_url_inicio (); 
	var cod = cod2.replace(/ingra\:/, "").replace(/---/,"?");
	navega_actualiza (cod, 0);
}
function navega_historia_cambia (cod2) 
{
	
}
function navega_navega (cod, forzado) 
{
	
	if (	cod.substr(0,4) == "ftp:"  || 
		cod.substr(0,5) == "http:" || 
		cod.substr(0,7) == "mailto:" ) { navega_navega_externo (cod); return; }

	navega_historia_agrega ("ingra:"+cod.replace(/\?/,"---")); 
}
function navega_navega_externo (url, en_misma_ventana)
{
	try { 
		if (en_misma_ventana) document.location=url; else window.open(url); 
	} catch (e) {}
}



var navega_esiframe= 0;

function navega_actualiza (cod2, forzado) 
{	
	if (!cod2) return;
	
	
	indice_actualiza (cod2, forzado); 
	navega_actualiza_cuerpo (cod2);
	return 0;
}
function navega_actualiza_cuerpo (cod2) 
{
	
	
	
	
	var i= cod2.indexOf('?'); 
	var cod=   i<0? cod2: cod2.substr(0,i);
	var param= i<0? 0:    cod2.substr(i+1);

	navega_imagenes=0; 
	if (!ingra_cuerpo) return;
	var i= cod.indexOf('.'); 
	var tabcod= i<0? cod: cod.substr(0,i)+'/'+cod.substr(i+1); 
	var arc= azohc_htm_direc+"/tab/"+tabcod+".json"; 
	var dat= azohc_ajax_envia(arc); if (!dat) return;
	

	if (dat.length && dat.charAt(0)!='{') dat='{'+dat+'}';


	if (json && json.termina) json.termina();


	eval("json="+dat); 
	



	if (!json || !json.controlador) return; 
	eval("ingra_"+json.controlador+"_inicia(json, param)"); 	

	
	
	
	
	
}
function navega_scroll (id, arriba) 
{
	if (id) { 
		var o= document.getElementById(id); 
		
		if (o) { o.scrollIntoView(!!arriba); return; } 
	}
	
	

	if (window.pageYOffset) window.pageYOffset=0;
	else {
		ingra_cuerpo.scrollTop=0;
		document.body.scrollTop=0;
		document.documentElement.scrollTop=0;
	}
}



function navega_iframe_htm (arc, tam) 
{
	
	if (typeof(tam)=="undefined") tam=10000;
	navega_esiframe= 1;
	var scroll= "no"; 
	return 	"<iframe id='navega_refer_iframe' width=100% height="+tam+" frameborder=0 "+ 
			" src='"+arc+"' scrolling='"+scroll+"' allowtransparency='true'></iframe>"; 
	
	
}




function navega_actualiza_ind (cod)		{ indice_actualiza (cod); } 
function navega_actualiza_cue (cod, param)	{ navega_actualiza_cuerpo (cod+(param?"?"+param:"")); } 



function navega_refer_iframe_htm (arc)		{ return navega_iframe_htm (arc); } 
function CC(i) { 	
	if (i>=0  && i<26) return String.fromCharCode(97+i);	
	if (i>=26 && i<52) return String.fromCharCode(39+i);	
	if (i>=52 && i<62) return String(i-52);			
	return "?";
}
function ABS(f)  { return Math.abs(f); }
function FTOA(f) { return (Math.round(f*1e5)/1e5).toString(); }
function ATOF(a) { var n=parseFloat(a); return isNaN(n)?0:n; }
function ATOL(a) { var n=parseInt(a);   return isNaN(n)?0:n; }
function INT(f)  { var n=parseInt(f);   return isNaN(n)?0:n; }
function ROUND(f,d) { var n=1; for (var i=0; i<d; i++) n*=10; return Math.round(f*n+1e-12)/n; } 

function buscainvalidos (par) 
{
	var parl= par.parl, parn=parl.length, opcll= par.opcll, opcn=opcll[0].length;
	var vall= par.vall, valn=vall.length, valt= par.valt;
	var sell= par.sell;
	var i,j,k,n,m,v;

	var numl=[]; for (i=0; i<parn; i++) numl[i]=parl[i].length-1;

	for (i=0; i<parn; i++) for (j=0; j<numl[i]; j++) opcll[i][j].inv=0; 
	for (i=0; i<parn; i++) if (sell[i]<0) sell[i]=0; 
	var sl=[]; for (i=0; i<parn; i++) if (!sell[i]) sl.push(i); 

	function buscainvalidos1(p1) 
	{
		var nump1=numl[p1];
	
		var il=[]; for (var i=0; i<nump1; i++) il[i]=0;
		for (var v=0; v<valn; v+=parn) {
			var p=-1;
			for (var i=0; i<parn; i++) {
				var a= vall[v+i]; if (!a) continue;
				if (sell[i]<=0 || !(a>0 && sell[i]==a || a<0 && sell[i]!=-a)) {
					if (p>=0) { p=-1; break; } else p=i;
				}
			}
			if (p==p1) {
				var b= vall[v+p]; 
				if (b>0) il[b-1]=1; 
				else if (b<0) for (var j=0; j<il.length; j++) if (j!=-b-1) il[j]=1; 
			}
		}
		for (var i=0; i<il.length; i++) if (!il[i]) return 1;
		return 0;
	}
	if (valt==1) {  
		for (i=0; i<parn; i++) for (j=0; j<numl[i]; j++) opcll[i][j].inv=1; 
		for (v=0; v<valn; v+=parn) {
			for (i=0; i<parn; i++) { 
				for (j=0; j<parn; j++) if (j!=i && sell[j]>0 && (sell[j]-1)!=vall[v+j]) break;
				if (j==parn) opcll[i][vall[v+i]].inv=0; 
			}
		}
	}
	else if (valt==2) { 
		var o,on= valn / parn;
		for (i=0; i<parn; i++) {
			for (n=1,m=0; m<parn; m++) if (m!=i && sell[m]<=0) n*=numl[m];
			for (j=0; j<numl[i]; j++) {
				var nn=0;
				for (v=i,o=0; o<on; o++,v+=parn) if (vall[v]==j) {
					for (m=0; m<parn; m++) if (m!=i && sell[m]>0 && (sell[m]-1)!=vall[v-i+m]) break;
					if (m==parn) nn++;
				}
				opcll[i][j].inv= nn>=n;
			}
		}
	}
	else if (valt==3) { 
		for (v=0; v<valn; v+=parn) {
			var p=-1;
			for (i=0; i<parn; i++) {
				var a= vall[v+i]; if (!a) continue;
				if (sell[i]<=0 || !(a>0 && sell[i]==a || a<0 && sell[i]!=-a)) {
					if (p>=0) { p=-1; break; } else p=i;
				}
			}
			if (p>=0) { i=p;
				
				var b= vall[v+i]-1; 
				if (b>0) opcll[i][b-1]=1; 
				else if (b<0) for (j=0; j<numl[i]; j++) if (j!=-b-1) opcll[i][j].inv=1; 
			}
		}
		if (sl.length==1) {
			var p1=sl[0];
			for (i=0; i<parn; i++) {
				var s0=sell[i];
				for (j=0; j<numl[i]; j++) if (i!=p1 && !opcll[i][j].inv) {
					sell[i]=j+1;
					for (k=0; k<parn; k++) if (k!=i) {
						if (!buscainvalidos1(p1)) { 
							opcll[i][j].inv=1; break; 
						}
					}
				}
				sell[i]=s0;
			}
		}
		if (sl.length==2) {
			for (var k=0; k<2; k++) {
				var i=sl[k], p1=sl[k?0:1];
				
				var s0= sell[i];
				for (j=0; j<numl[i]; j++) {
					sell[i]=j+1;
					if (!opcll[i][j].inv && !buscainvalidos1(p1)) {
						opcll[i][j].inv=1;
					}
				}
				sell[i]=s0;
			}
		}
	}
	else { 
		
	}
	
	for (i=0; i<parn; i++) if (sell[i]>0) opcll[i][sell[i]-1].inv=0; 
	
	for (i=0; i<parn; i++) if (!sell[i]) {
		n=0; for (j=0; j<numl[i]; j++) if (!opcll[i][j].inv) { if (n) { n=0; break; } n=j+1; }
		if (n) sell[i]= -n; 
	}
}






function Cingra_pista ()
{
	this.cod=""; this.odiv=0; this.otex=0; this.oimg=0;

	
	this.inicia= function () {
		if (this.odiv) return;
		this.odiv= document.getElementById ("ingra_pista"); if (!this.odiv) return;
		var a="<div id='ingra_pista_tex'></div>"+ 
			"<img id='ingra_pista_img' src='' alt=''"+ 
				
				
			" />";
		
		this.odiv.innerHTML= a;
		this.otex= document.getElementById ("ingra_pista_tex"); 
		this.oimg= document.getElementById ("ingra_pista_img");
   		
		
	}
	
	this.ayuda_onmousemove= function (eve, ayuda) {
		this.inicia();
		var obj= azohc_htm_evento_objeto(eve); 
		var cod= obj.id;
		if (this.cod != cod) {
			this.cod= cod;
			this.div_muestra();
			this.otex.innerHTML= ayuda;
			azohc_htm_width_pon (this.otex, 320);
			this.img_oculta();
		}
		var p= azohc_eve_pos (eve, 1); p.x-=360; p.y-=0; 
		
		
		
		
		azohc_htm_pos_pon (this.odiv, p);
	}
	this.area_onmousemove= function (eve, con, ima) {
		
		
		this.inicia();
		if (this.cod != con.tab+"."+con.cod) {
			
			var a= con.cod, i= a.indexOf('.'); if (i>=0) a=a.substr(i+1);

			this.cod= con.tab+"."+con.cod;
			this.div_muestra();
			this.otex.innerHTML= con.res+"<br>(Ref.: "+a+")";
			azohc_htm_width_pon (this.otex, 160);
			

			this.img_oculta();
			if (con.img) {
				
				var a= con.img; 
				
				this.oimg.src= ingra_ima_camino (a, 0); 
				this.img_muestra();
			}
		}
		var p= azohc_eve_pos (eve, 1); p.x+=8; 
		var o= azohc_htm_evento_objeto(eve); 	
		var p0= azohc_eve_pos (eve, 0); 
		p0.x += o.offsetLeft; 
		p0.y += o.offsetTop 




		if (con.img && p0.y>350) p.y-= p0.y-350; 
		
		azohc_htm_pos_pon (this.odiv, p);
		
		
		return 0;
	}
	this.onmouseout=  function ()	 { 
		if (!this.cod) return; this.cod=""; this.div_oculta(); 
	}
	this.div_muestra= function ()	 { this.inicia(); 
		
		this.odiv.style.display= "block"; this.odiv.style.visibility= "visible"; 
		
	}
	this.div_oculta=  function ()	 { this.inicia(); this.odiv.style.display= "none";  this.img_oculta (); 
	}
	this.img_muestra= function ()  { this.inicia(); this.oimg.style.visibility= "visible"; }
	this.img_oculta=  function ()  { this.inicia(); this.oimg.style.visibility= "hidden"; }
	
	this.evento= function (e) { 
		var eve= azohc_htm_evento(e);			
		var obj= azohc_htm_evento_objeto(eve); 	
		
	}
	
	
}



var ingra_pista  = new Cingra_pista ();



function Pista_concepto ()
{
	this.tab=""; this.cod=""; this.odiv=null;
	this.presenta= function (eve, con) 
	{
		var o= azohc_htm_evento_objeto(eve); 
		var p= azohc_eve_pos (eve, 1); p.x+=8; 
		if (this.odiv && tab == con.tab && cod == con.cod) {
			azohc_htm_pos_pon (this.odiv, p);
			return;
		}
		this.tab= con.tab; this.cod= con.cod;
		var odiv= document.createElement("div"); 
		odiv.style= "position:absolute; border:0; left:"+p.x+"px; top:"+p.y+"px;";
		{ 
			var otex= document.createElement("div"); 
			otex.id= "ingra_pista_tex";
			var a= con.cod, i= a.indexOf('.'); if (i>=0) a=a.substr(i+1);
			otex.innerHTML= con.res+"<br>(Ref.: "+a+")";
			
			
			odiv.appendChild (otex); 
		}
		if (con.ima) {
			var oimg= document.createElement("img"); 
			oimg.id= "ingra_pista_img"; 
			oimg.src= ingra_ima_camino (con.ima, 0); 
			odiv.appendChild (oimg); 
		}
		ingra_raiz.appendChild (odiv); 
		this.odiv= odiv;
		o.onmouseout = function () { 
			if (!pista_concepto || !pista_concepto.odiv) return;
			ingra_raiz.removeChild (pista_concepto.odiv); pista_concepto.odiv=null;
		}
	}
}
var pista_concepto= null;
function pista_concepto_presenta (eve, con) 
{
	if (!pista_concepto) pista_concepto= Pista_concepto ();
	pista_concepto.presenta (eve, con);
}

function pista_ayuda_presenta (e, texto, dx, dy)
{
	
	var eve= azohc_htm_evento(e);			
	var obj= azohc_htm_evento_objeto(eve); 	

	var odiv= document.createElement("div"); 
	odiv.className= "pista_ayuda";
	odiv.style.cssText= "position:absolute; right:0px; top:-44px; z-index:100;"; 
	odiv.innerHTML= texto;
	ingra_cuerpo.appendChild (odiv); 

	obj.pista= odiv;
	obj.onmouseout = function () { if (this.pista) { ingra_cuerpo.removeChild (this.pista); this.pista=null; } }

	
}

function pista_ayuda_mapas (e)
{
	
	pista_ayuda_presenta (e, ""+
			"<h4>Navegación descendente</h4>"+
			"Hacer clic sobre zonas no sensibles del mapa o utilizar la<br />"+
			"rueda del ratón hacia delante, para bajar manteniendo la<br />"+
			"posición del cursor. Utilizar la tecla [AvPág] para bajar<br />"+
			"manteniendo el centro.<br /><br />"+

			"<h4>Navegación ascendente</h4>"+
			"Hacer clic con el botón derecho del ratón o utilizar la rueda<br />"+
			"del ratón hacia atrás, para subir manteniendo la posición<br />"+
			"del cursor. Utilizar la tecla [RePág] para subir manteniendo el<br />"+
			"centro.<br /><br />"+

			"<h4>Navegación lateral</h4>"+
			"Arrastre con el botón izquierdo del ratón para desplazarse<br />"+
			"manteniendo la posición del cursor. Utilice las teclas de<br />"+
			"dirección (flechas) para desplazarse un paso fijo.<br /><br />"+

			"<h4>Sensibilidad de elementos</h4>"+
			"Cuando el título de capa tiene color de vínculo, sus elementos<br />"+
			"presentarán descripción e imagen reducida al posicionarse<br />"+
			"sobre ellos y navegaremos a la ficha al hacer clic sobre ellos.<br />"+
			"Cuando tiene color gris, no se visualiza a la escala actual.<br /><br />"+

			"<h4>Envío de avisos</h4>"+
			"Haciendo clic sobre cualquier zona del mapa mientras se<br />"+
			"mantine pulsada la tecla ALT, se envía por correo electrónico<br />"+
			"un mensaje con las coordenadas del punto seleccionado");
}
function pista_ayuda_imagenes (e)
{
	pista_ayuda_presenta (e, "<h4>Uso de las imágenes:</h4>"+
		"<p>Sobre la media resolución con clic se hace zoom<br />"+
		"manteniendo el punto del clic.</p>"+
		"<p>Sobre el zoom podemos arrastrar con el ratón<br />"+
		
		"y con las flechas del teclado.</p>"+
		"<p>Sobre la media con clic+[Control] se carga la imagen<br/>"+
		"de alta resolución en ventana independiente.</p>"+
		"<p>Sobre cualquier imagen con el menú contextual<br />"+
		"(botón derecho) se puede pegar o copiar</p>");
}
function ingra_pista_ayuda_mapas (ingra_cuerpo, x, y) 
{
	var o= document.createElement("img"); 
	o.style.cssText= "position:absolute; border:0; width:12px; height:12px; right:0px; top:"+y+"px;";
	o.src= "ima/var/ayu12b.gif"; 
	ingra_cuerpo.appendChild (o); 
	o.onmouseover = pista_ayuda_mapas;
	
	
}

	
	

function ingra_pos_presenta (e)
{
	return azohc_eve_pos (e, 0, 1);

	var a="";
	var o= azohc_htm_evento_objeto(e); 			
	
	var pv= azohc_eve_pos (e, 0); 
	
	
	a+= "<br>ven: "+pv.x+" "+pv.y;
	a+= "<br><br>EVENTO: "+e.type
	
	a+= "<br>offset: "+e.offsetX+" "+e.offsetY;
	a+= "<br>client: "+e.clientX+" "+e.clientY;
	a+= "<br>screen: "+e.screenX+" "+e.screenY;

	a+= "<br><br>OBJETO: "+o.tagName+" id:"+o.id
	a+= "<br>client: "+o.clientLeft+" "+o.clientTop+" "+o.clientWidth+" "+o.clientHeight; 
	a+= "<br>scroll: "+o.scrollLeft+" "+o.scrollTop+" "+o.scrollWidth+" "+o.scrollHeight; 
	a+= "<br>offset: "+o.offsetLeft+" "+o.offsetTop+" "+o.offsetWidth+" "+o.offsetHeight;
	
	var p= azohc_obj_offset (o, 1);
	
	a+= "<br>offset obj: "+p.x+" "+p.y;
	
	return a;
}
function azohc_obj_offset (obj, deb) 
{
	var p={x:0,y:0}, o=obj;
	while (!!o) { 
		p.x += o.offsetLeft; p.y += o.offsetTop; 
		if (deb) ingra_debug ("offset x="+o.offsetLeft+" y="+o.offsetTop+" xx="+p.x+" yy="+p.y);
		o= o.offsetParent; 
	}
	if (deb) {
		o=obj;
		ingra_debug ("o.client "+o.clientLeft+" "+o.clientTop+" "+o.clientWidth+" "+o.clientHeight);
		ingra_debug ("o.scroll "+o.scrollLeft+" "+o.scrollTop+" "+o.scrollWidth+" "+o.scrollHeight);
		ingra_debug ("o.offset "+o.offsetLeft+" "+o.offsetTop+" "+o.offsetWidth+" "+o.offsetHeight);
		var p=azohc_htm_getPageScroll(); ingra_debug ("PageScroll "+p.x+" "+p.y);
		var p=azohc_htm_getPageSize();   ingra_debug ("PageSize "+p.x+" "+p.y);
		var o=ingra_cuerpo;
		ingra_debug ("ingra_cuerpo.offset "+o.offsetLeft+" "+o.offsetTop+" "+o.offsetWidth+" "+o.offsetHeight);
		ingra_debug ("------------------------------");
	}
	return p;
}
function azohc_eve_pos (eve, que, deb)  
{
	if (deb) {
		var a= "<br>------------------------------<br>EVENTO: "+eve.type
		var p= azohc_eve_pos (eve,0); a+= "<br>padre "+p.x+" "+p.y; 
		var o= azohc_htm_evento_objeto (eve);
		while (!!o) {
			if (o.style.position) { p.x += o.offsetLeft; p.y += o.offsetTop; }
			a+= "<br>"+o.tagName+" id:"+o.id+" "+o.offsetLeft+" "+o.offsetTop+" xt:"+p.x+" yt:"+p.y+" "+o.style.position;
			o= o.offsetParent;
		}
		a+= "<br>raiz "+p.x+" "+p.y; 
		var p= azohc_eve_pos(eve,0); a+= "<br>eve_pos0 "+p.x+" "+p.y; 
		var p= azohc_eve_pos(eve,1); a+= "<br>eve_pos1 "+p.x+" "+p.y; 
		var p= azohc_eve_pos(eve,2); a+= "<br>eve_pos2 "+p.x+" "+p.y; 
		
		
		var p= azohc_htm_getPageScroll(); a+= "<br>scroll "+p.x+" "+p.y;
		return a;
	}
	if (!que) {
		if (azohc_htm_esie()) return { x:eve.offsetX, y:eve.offsetY }; 
		return { x:eve.layerX, y:eve.layerY }; 
	}
	if (que==1) {
		var p= azohc_eve_pos (eve,0); 
		var o= azohc_htm_evento_objeto (eve);
		while (!!o) {
			if (o.style.position) { p.x += o.offsetLeft; p.y += o.offsetTop; }
			o= o.offsetParent; if (!o || o.id == "ingra_raiz") break;
		}
		return p;

		var p= azohc_eve_pos (eve, 2)  
		var s= azohc_htm_getPageScroll (); p.x+=s.x; p.y+=s.y;

		
		if (ingra_raiz) { 
			var x= ingra_raiz.offsetLeft, y= ingra_raiz.offsetTop; 
			if (x>0) p.x -= x; if (y>0) p.y -= y; 
		}

		
		return p;
	}
	if (que==2) return { x:eve.clientX, y:eve.clientY }; 
	return { x:eve.screenX, y:eve.screenY }; 
}
function desplaza_ascendente (o, ascendente) 
{
	var p= { x:0, y:0 }; 
	while (!!o) {
		if (o == ascendente) break;
		if (o.style.position) { p.x += o.offsetLeft; p.y += o.offsetTop; } 
		o= o.offsetParent; 
	}
	return p;
}
function posicion_ascendente (eve, ascendente) 
{
	var p= azohc_htm_esie() ? { x:eve.offsetX, y:eve.offsetY } : { x:eve.layerX, y:eve.layerY }; 
	var o= azohc_htm_evento_objeto (eve);
	while (!!o) {
		if (o == ascendente) break;
		if (o.style.position) { p.x += o.offsetLeft; p.y += o.offsetTop; } 
		o= o.offsetParent; 
	}
	return p;
}


function azohc_htm_evento_offsetX_ten(eve) { return azohc_htm_esie()? eve.offsetX: eve.layerX; }
function azohc_htm_evento_offsetY_ten(eve) { return azohc_htm_esie()? eve.offsetY: eve.layerY; }

function azohc_htm_pos (obj, que) { 
	var s= obj.style; return azohc_htm_esie()? { x:s.posLeft, y:s.posTop }: { x:parseInt(s.left,10), y:parseInt(s.top,10) }; 
}
function azohc_htm_tam (obj) {
	
	var s= obj.style; return azohc_htm_esie()? { x:s.posWidth, y:s.posHeight }: { x:parseInt(s.width,10), y:parseInt(s.height,10) }; 
}
function azohc_htm_rec (obj) {
	var s= obj.style; var rec= azohc_htm_esie()? 
		{ x1:s.posLeft, y1:s.posTop, x2:s.posWidth, y2:s.posHeight }: 
		{ x1:parseInt(s.left,10), y1:parseInt(s.top,10), x2:parseInt(s.width,10), y2:parseInt(s.height,10) }; 
	rec.x2+= rec.x1; rec.y2+=rec.y1;
	return rec;
}
function azohc_htm_pos_pon (obj, pos) {
	var s= obj.style; if (azohc_htm_esie()) { s.posLeft=pos.x; s.posTop=pos.y; } else { s.left=pos.x+"px"; s.top=pos.y+"px"; }
}
function azohc_htm_tam_pon (obj, tam) {
	var s= obj.style; if (azohc_htm_esie()) { s.posWidth=tam.x; s.posHeight=tam.y; } else { s.width=tam.x+"px"; s.height=tam.y+"px"; }
}
function azohc_htm_rec_pon (obj, rec) {
	var s= obj.style; if (azohc_htm_esie()) 
		{ s.posLeft=rec.x1; s.posTop=rec.y1; s.posWidth=(rec.x2-rec.x1); s.posHeight=(rec.y2-rec.y1); } else 
		{ s.left=rec.x1+"px"; s.top=rec.y1+"px"; s.width=(rec.x2-rec.x1)+"px"; s.height=(rec.y2-rec.y1)+"px"; }
}
function azohc_htm_left_ten   (obj)		{ return azohc_htm_esie()? obj.style.posLeft:		parseInt(obj.style.left,10); }
function azohc_htm_top_ten    (obj)		{ return azohc_htm_esie()? obj.style.posTop:		parseInt(obj.style.top,10); }
function azohc_htm_width_ten  (obj)		{ return azohc_htm_esie()? obj.style.posWidth:		parseInt(obj.style.width,10);}
function azohc_htm_height_ten (obj)		{ return azohc_htm_esie()? obj.style.posHeight:		parseInt(obj.style.height,10); }
function azohc_htm_left_pon   (obj, val)	{    if (azohc_htm_esie()) obj.style.posLeft=val;	    else obj.style.left=val+"px"; }
function azohc_htm_top_pon    (obj, val)	{    if (azohc_htm_esie()) obj.style.posTop=val;	    else obj.style.top=val+"px"; }
function azohc_htm_width_pon  (obj, val)	{    if (azohc_htm_esie()) obj.style.posWidth=val;	    else obj.style.width=val+"px"; }
function azohc_htm_height_pon (obj, val)	{    if (azohc_htm_esie()) obj.style.posHeight=val;	    else obj.style.height=val+"px"; }




function azohc_htm_pos_ten (eve, concuerpo)	{ 
	var x= azohc_htm_evento_offsetX_ten (eve);
	var y= azohc_htm_evento_offsetY_ten (eve);
	if (concuerpo) {
		x+= ingra_cuerpo.scrollTop - ingra_cuerpo.offsetTop;
		x+= ingra_cuerpo.scrollLeft - ingra_cuerpo.offsetLeft;
	}
	else {
		var o= azohc_htm_evento_objeto (eve); 
		while (!!o) { x+=o.offsetLeft; y+=o.offsetTop; o=o.offsetParent; }	
	}
	return { x:x, y:y };
}

function azohc_htm_getPageSize() 
{ 
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) 
		{ xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } 
	else if (document.body.scrollHeight > document.body.offsetHeight)
		{ xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } 
	else	{ xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; }

	var windowWidth, windowHeight;
	if (self.innerHeight) 
		{ windowWidth = self.innerWidth; windowHeight = self.innerHeight; } 
	else if (document.documentElement && document.documentElement.clientHeight) 
		{ windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } 
	else if (document.body) 
		{ windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; }
	 if (yScroll < windowHeight)	{ pageHeight = windowHeight; } else { pageHeight = yScroll;}
	 if (xScroll < windowWidth)	{ pageWidth = windowWidth; } else { pageWidth = xScroll;}

	 return { x:pageWidth, y:pageHeight, x2:windowWidth, y2:windowHeight };
}
function azohc_htm_getPageScroll (eve) 
{ 
	if (eve) {
		var x= azohc_htm_evento_offsetX_ten (eve);
		var y= azohc_htm_evento_offsetY_ten (eve);
		var o= azohc_htm_evento_objeto (eve); 
		while (!!o) { x+=o.offsetLeft; y+=o.offsetTop; o=o.offsetParent; }	
		
		return { x:x, y:y };
	}
	if (document.all) 
	
		return { x:document.documentElement.scrollLeft, y:document.documentElement.scrollTop };
	if (document.body) 
		return { x:document.body.scrollLeft, y:document.body.scrollTop };
	if (self.pageYOffset) 
		return { x:self.pageXOffset, y:self.pageYOffset };
	
	


}
function azohc_htm_setPageScroll (ps) 
{
	if (document.all) 
	
		{ document.documentElement.scrollLeft=ps.x; document.documentElement.scrollTop=ps.y; return; }
	if (document.body) 
		{ document.body.scrollLeft=ps.x; document.body.scrollTop=ps.y; return; }
	if (self.pageYOffset) 
		{ self.pageXOffset=ps.x; self.pageYOffset=ps.y; return; }
} 
var tesauro_iniciado=0;

var tesauro_terminos={};		
var tesauro_sinonimos={};		
var tesauro_reglas=[];			
var tesauro_conceptos={};		

var tesauro_termino_conceptos={};	

var tesauro_actual=0;			
var tesauro_log=[];
var tesauro_traza=0;			


function tesauro_inicia () 
{
	if (tesauro_iniciado) return; tesauro_iniciado=1;
	eval (azohc_ajax_envia ("var/tesauro.json")); 
	
	
	
	
}
function tesauro_compara_ide (cpn1,cpn2)
{
	if (cpn1.ide > cpn2.ide) return 1; if (cpn1.ide < cpn2.ide) return -1;
	return 0;
}
function tesauro_compara_num_pes (cpn1,cpn2)
{
	if (cpn1.num < cpn2.num) return 1; if (cpn1.num > cpn2.num) return -1;
	if (cpn1.pes < cpn2.pes) return 1; if (cpn1.pes > cpn2.pes) return -1;
	return 0;
}
function tesauro_concepto (coni)
{
	var al= tesauro_conceptos[coni]; if (!al) return { tab:"TAB", cod:"COD", res:"RES", res:"IMA", res:"FEC" }
	return { tab:al[0], cod:al[1], res:al[2], ima:al[3], fec:al[4] }
}
function tesauro_de_termino_a_conceptos (termino)
{
	
	var a= termino.charAt(0); 
	if (tesauro_actual != a) {
		tesauro_actual= a;
		eval (azohc_ajax_envia ("var/tesauro/"+a+".json"));
	}
	return tesauro_termino_conceptos[termino]; 
	
}
function tesauro_de_terminos_a_conceptos (terminos) 
{
	var conl=[]; 
	for (var i=0; i<terminos.length; i++) {
		var cpl= tesauro_de_termino_a_conceptos (terminos[i][0]); 
		if (tesauro_traza) tesauro_log.push(terminos[i][0]+" (conceptos): "+cpl.length)
		for (var j=0; j<cpl.length; j++) { 
			var n= azohc_lis_busca (conl, {ide:cpl[j][0],pes:1,num:0}, tesauro_compara_ide, 1); if (n<0) continue;
			var con=conl[n]; con.pes*=cpl[j][1]; con.num++; 
			if (tesauro_traza) tesauro_log.push(" cod:"+tesauro_conceptos[con.ide][1]+" pes:"+con.pes+" num:"+con.num)
		}
		
		
		
	}
	conl.sort (tesauro_compara_num_pes);
	for (var i=0; i<conl.length; i++) { 
		var con=conl[i]; if (con.num < terminos.length/2) { conl.length=i; break; }
	}
	
	return conl;
}
function tesauro_de_palabra_a_termino (palabra) 
{
	tesauro_inicia () 
	var a= azohc_str_sin (palabra); if (!a) return 0;
	{
		var ter= tesauro_terminos[a]; if (ter) { tesauro_log.push ("Encontrado término: "+palabra+(palabra!=ter[0]? " > "+ter[0]: "")); return [a,ter[0]]; }
		var c= tesauro_sinonimos[a]; 
		if (c) {
			tesauro_log.push("Encontrado sinónimo: "+c);
			ter= tesauro_terminos[c]; if (ter) { tesauro_log.push ("Encontrado término en sinónimo: "+palabra+" > "+ter[0]); return [c,ter[0]]; }
		}
	}
	var b= tesauro_palabra_en_reglas(a); 
	if (b) {
		tesauro_log.push("Encontrado regla: "+b);
		ter= tesauro_terminos[b]; if (ter) { tesauro_log.push ("Encontrado termino con regla: "+palabra+" > "+ter[0]); return [b,ter[0]]; }
		var c= tesauro_sinonimos[b]; 
		if (c) {
			tesauro_log.push("Encontrado sinónimo: "+c);
			ter= tesauro_terminos[c]; if (ter) { tesauro_log.push ("Encontrado término con regla en sinónimo: "+palabra+" > "+ter[0]); return [c,ter[0]]; }
		}
	}
	tesauro_log.push ("Término no encontrado: "+palabra+" ("+a+")");
	return 0;
}
function tesauro_de_texto_a_terminos (texto) 
{
	tesauro_log=[];
	var terl=[];
	var pall= texto.trim().split(' ');
	for (var i=0; i<pall.length; i++) {
		var pal= pall[i]; if (!pal.length) continue;
		var ter= tesauro_de_palabra_a_termino (pal); if (!ter) continue;
		for (var j=0; j<terl.length; j++) if (terl[j][0]==ter[0]) break; if (j<terl.length) continue;
		terl.push(ter);
		
	}	
	return terl;
}

function tesauro_palabra_en_reglas (palabra) 
{
	for (var j=0; j<tesauro_reglas.length; j++) {
		var b= tesauro_palabra_en_regla (tesauro_reglas[j][0], tesauro_reglas[j][1], palabra);
		if (b) { 
			k= tesauro_terminos[b]; if (k) return b; 
			k= tesauro_sinonimos[b]; if (k) return b; 
		}
	}	
	return 0;
}
function tesauro_palabra_en_regla (regori, regdes, palabra)
{
	var on= regori.length;
	var dn= regdes.length;
	var pn= palabra.length;
	if (on > pn || dn > pn) return 0;
	var as; 
	if (regori.charAt(0)=='*') {
		var o= regori.substr(1);
		var t= palabra.substr(pn-on+1); if (o != t) return 0;
		as= palabra.substr (0, pn-on+1);
	}
	else if (regori.charAt(on-1)=='*') {
		var o= regori.substr(0,on-1);
		var t= palabra.substr(0,on-1); if (o != t) return 0;
		as= palabra.substr (on-1);
	}
	else return 0;
	var te;
	if      (regdes.charAt(0)=='*') te= as+regdes.substr(1);
	else if (regdes.charAt(dn-1)=='*') te= regdes.substr(0,dn-1)+as;
	else return 0;
	return te; 
	
	
}


var util_pro_grande= 2700;  

function util_resumen (o, mod) 
{
	var res= o.res;
	if (indice_concodigo (o.tab)) {
		if (mod && mod.indexOf('r')>=0) res+= " (Ref.: "+o.cod+")"; else res= o.cod+" · "+res;
	}
	if (o.can && mod && mod.indexOf('c')>=0) { res+= " · "+o.can; if (o._uni) res+=" "+o._uni; }
	if (o.fec && mod && mod.indexOf('f')>=0) { res+= " · "+azohc_str_fec2str (parseInt(o.fec)); }
	if (o.tab && mod && mod.indexOf('t')>=0) { var tab= ingra_tablas[o.tab]; if (tab) res= tab.res+": "+res; }
	return res;
}
function util_imagen (o, defecto, width)  
{
	var ima= o; if (typeof(o)=="object") { ima= o.ima; if (o.cod=='-') return ""; } if (!ima && !defecto) return "";
	return "<img src='"+(ima? ingra_ima_camino (ima, 0): "ima/var/"+defecto)+"' alt='' border=0 "+(width?"width="+width+"px;":"")+"/>";
}

function util_status (rotulo) 
{
	
	if (!rotulo) return "";
	return " onMouseOver=\"window.status='"+rotulo.replace(/&#39;/g,"´")+"';return true;\" onMouseOut=\"window.status='';return true;\"";
}
function util_url (o, rot) 
{
	var url= (typeof(o)=="object")? (o.pag? o.tab+"."+o.cod: o.url): o;  
	if (!url) return rot? rot: { i:"", j:"" };
	var a= "href='javascript:navega_navega(\""+url+"\")'";
	var s= util_status(typeof(o)=="object"? util_resumen(o): o.url);

	if (rot=="*") rot= util_resumen (o);
	return rot? "<a "+a+s+">"+rot+"</a>": { i:"<a "+a+">", j:"</a>" };
}
function util_utm (o, rot) 
{
	if (!o || !o.utm) return rot? rot: { i:"", j:"" }; 
	var x= o.utm[0], y= o.utm[1]; if (!x || !y) return rot? rot: { i:"", j:"" };
	var a= "href='javascript:ingra_mapa_presenta (\""+o.tab+"\",\""+o.cod+"\","+x+","+y+")'";
	var s= util_status(util_resumen(o));
	if (rot=="*") rot= "UTM: "+x.format(2)+", "+y.format(2);
	return rot? "<a "+a+s+">"+rot+"</a>": { i:"<a "+a+">", j:"</a>" };
}
function util_amarca (o, rot)
{ 
	var mar= (typeof(o)=="object")? "marca_"+o.tab+"_"+o.cod: o; if (!mar) return rot? rot: { i:"", j:"" };
	
	var a= "href='#"+mar+"'"; 
	return rot? "<a "+a+">"+rot+"</a>": { i:"<a "+a+">", j:"</a>" };
}
function util_marca (o)
{ 
	var mar= (typeof(o)=="object")? "marca_"+o.tab+"_"+o.cod: o;  if (!mar) return "";
	
	return "<a name='"+mar+"' />";
}
function util_tr_linea (nom, val, tabla, conraya) 
{
	if (!val) return "";  
	
	var b= val; if (b.length > util_pro_grande) b= "<div class='grande'>"+b+"</div>"; 
	var a="<tr><td class='rotulo'>"+nom+"</td><td class='valor'>"+b+"</td></tr>"; 
	if (conraya) a+= "<tr><td class='raya' colspan='2'></td></tr>"; 
	if (tabla) a= "<table class='"+tabla+"' cellSpacing=0 >"+a+"</table>"; 
	return a;
}






function ingra_raiz_inicia (json, param) 
{ 
	if (!json.arc) ingra_carpetas_inicia (json, param); 		
	else {
		ingra_pestana(json);						
		ingra_cuerpo.innerHTML= navega_refer_iframe_htm (json.arc); 
	}
}




var indice_indcam=  0;		
var indice_indcan=  0;		
var indice_indhij=  1; 		
var indice_conniv0= 0;		
var indice_compacta= 0;		

var ingra_ima_prefijo= 0;	
var ingra_ima_conborde=	1;	
var ingra_ima_media=	384;	
var ingra_ima_baja=	96;	

function indice_concodigo (tab) { return 0; } 	
function indice_url_inicio ()	{ return "apl.ingrid"; } 
function ingra_pestana (json) 
{
	var tit= json.res; if (indice_concodigo (json.tab)) tit+= " (Ref.: "+json.cod+")"; 
	return !tit? "": "<h1>"+tit+"</h1>";
}
function indice_actualiza (cod, forzado)
{
	if (cod == "car.web_X1") window.open ('http://municipios.ingra.es');
	if (!ingra_indice) return; 
	var a= indice_monta (cod, forzado); if (!a) return; 
	ingra_indice.innerHTML= a;
}


var ingra_tablas= {
	car:{ res:'Carpeta', ide:1000, plu:'Carpetas', _uni:'', campos:{
		pie:{ res:'Texto secundario', uni:'', tip:12, t:'T' }}},
	sql:{ res:'Búsqueda SQL', ide:1001, pad:'car', plu:'Búsquedas SQL', _uni:'', campos:{
		pie:{ res:'Texto secundario', uni:'', tip:12, t:'T' }}},
	webext:{ res:'Publicación WEB', ide:2001, pad:'var', plu:'', _uni:'', campos:{}},
	ing:{ res:'BD Ingrid', ide:3001, pad:'ref', plu:'BBDD Ingrid', _uni:'', campos:{}},
	www:{ res:'Vínculos a Web', ide:3002, pad:'ref', plu:'WEBs Ingrid', _uni:'', campos:{}},
	ins:{ res:'Instalador propio', ide:3003, pad:'ref', plu:'Instaladores', _uni:'', campos:{}},
	dxi:{ res:'Archivo DXI', ide:3004, pad:'ref', plu:'Archivos DXI', _uni:'', campos:{}},
	rdp:{ res:'Aplicación remota', ide:3005, pad:'ref', plu:'Aplicaciones remotas', _uni:'', campos:{}},
	pdf:{ res:'Archivo PDF', ide:3011, pad:'ref', plu:'Archivos PDF', _uni:'', campos:{}},
	htm:{ res:'Archivo HTM', ide:3012, pad:'ref', plu:'Archivos HTM', _uni:'', campos:{}},
	swf:{ res:'Archivo SWF', ide:3013, pad:'ref', plu:'Archivos SWF', _uni:'', campos:{}},
	chm:{ res:'Archivo CHM', ide:3014, pad:'ref', plu:'Archivos CHM', _uni:'', campos:{}},
	lan:{ res:'Referencias internas', ide:3015, pad:'ref', plu:'', _uni:'', campos:{}},
	inf:{ res:'Informe o Procedimiento', ide:4000, plu:'Informes y Procedimientos', _uni:'', campos:{}},
	ent:{ res:'Entidad', ide:5000, plu:'Entidades', _uni:'', campos:{
		ftp:{ res:'Dirección FTP', uni:'', tip:12, t:'T' },
		googlemaps:{ res:'Localización en Google Maps', uni:'', tip:12, t:'T' }}},
	marven:{ res:'Ventanas', ide:10003, pad:'mar', plu:'', _uni:'', campos:{}},
	per:{ res:'Persona', ide:20000, plu:'Personas', _uni:'', campos:{
		cargo:{ res:'Cargo', uni:'', tip:12, t:'T' }}},
	map:{ res:'Mapa', ide:30000, plu:'Mapas', _uni:'', campos:{}},
	web:{ res:'Publicación WEB', ide:70000, plu:'Publicaciones WEB', _uni:'', campos:{}},
	apl:{ res:'Aplicación', ide:100001, pad:'org', plu:'Aplicaciones', _uni:'', campos:{}},
	pro:{ res:'Proyecto con página', ide:100002, pad:'org', plu:'Proyectos', _uni:'', campos:{}},
	pros:{ res:'Proyecto sin página', ide:100003, pad:'org', plu:'Proyectos', _uni:'', campos:{}},
	sec:{ res:'Sección', ide:100005, pad:'org', plu:'', _uni:'', campos:{}},
	loc:{ res:'Localización en Google Maps', ide:100006, pad:'org', plu:'', _uni:'', campos:{}},
	htmpag:{ res:'HTM con página', ide:100007, pad:'org', plu:'', _uni:'', campos:{}}
};

function ingra_texto_inicia (json, param) 
{ 
	var arc= "tab/"+json.tab+"/"+json.cod+".htm";
	ingra_pestana (json); 
	var a= azohc_ajax_envia (arc);
	a= a.split("<body>"); 
	if (a.length<2) a="datos incorrectos";
	else a= a[1].split("</body>")[0];

	ingra_cuerpo.innerHTML= a;
	navega_scroll (param);
}

function ingra_carpetasX_inicia (json, param) 
{ 
	


}
function ingra_carpetas_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_carpetas_monta_htm(json); 
	navega_scroll (param);
}



function ingra_carpetas_monta_htm (json)
{
	var a= ingra_pestana (json); 

	if (json.tex) a+= "<p>"+json.tex+" </p>"; 

	if (json.hijos && json.hijos.length) {
		
		
		for (var i=0; i<json.hijos.length; i++) { 
			var o= json.hijos[i]; 
			var tab= ingra_tablas[o.tab];
			var u= util_url(o);
			var t= o._tam/1024/1024;
			var tam= t>2? " ("+parseInt(t)+" MB)": "";	
			var fec= o.fec?" ("+azohc_str_fec2nom(o.fec,1)+")":"";
			var pro= o.prol
			if (o.tab=="lan") continue;
			
			else if (o.tab=="sec") {
				
				
				
				
				a+= "<h3>" + o.res + "</h3>"; 
				if (o.tex) a+= "<p>"+o.tex+"</p>";
				
				
				continue;
			}
			var uno="",dos=""; 
			if (o.tab=="car") {
				
				if (o.cod=="-") { a+= "<br />"; continue; }
				uno= u.i + util_imagen(o,o.tab+(o.tex?"32":"")+".png") + u.j;
				dos= u.i + o.res + u.j + fec;
				if (o.tex) dos+= "<p>"+o.tex+"</p>";
			}
			else if (o.tab=="ent") {
				uno= u.i+util_imagen(o,o.tab+"32.png")+u.j;
				dos= "<strong>"+o.res+" </strong>";
				if (o.tex) dos+= "<p>"+o.tex+"</p>";
				var b="";
				if (pro.tel) b+=(b?"<br />":"")+"Tel.: " + pro.tel;
				if (pro.fax) b+=(b?"<br />":"")+"Fax: " + pro.fax;
				
				if (pro.web) b+=(b?"<br />":"")+"Web: <a href='javascript:navega_navega_externo(\"http://"+pro.web+"\")'>http://" + pro.web +"</a>";
				if (pro.ftp) b+=(b?"<br />":"")+"Ftp: <a href='javascript:navega_navega_externo(\""+pro.ftp+"\")'>" + pro.ftp +"</a>";
				if (pro._dir) b+=(b?"<br />":"")+"Dirección: "+ pro._dir.replace(/<br \/>/,". ");
				if (b) dos+= "<p>"+b+"</p>";
				
			}
			
			
			else if (o.tab=="per") {
				uno= util_imagen(o);
				dos= o.res;
				if (pro.cargo) dos+= "<br >"+pro.cargo;
				if (pro.ele) dos+= "<br >"+"<a href='mailto:"+pro.ele+"'>"+ pro.ele +"</a>";
			}
			else if (o.tab=="loc") {
				var u1= "<a href='javascript:navega_navega_externo(\""+o.tex+"\")'>", u2= "</a>";
				uno= u1+util_imagen(o)+u2;
				dos= u1+o.res+"<br /><br />"+u2;
			}
			else { 
				var a1="";
				if (o.url) a1= "<a href='javascript:navega_navega(\""+o.url+"\")'>";
				
				else if (o.prol && o.prol.arc) a1= "<a href='"+o.prol.arc+"' target='_blank'>";
				var a2= a1?"</a>":"";
				if (!a1) { a1="<strong>"; a2="</strong>"; }
				
				var ima= util_imagen(o, (o.tab+(o.tex?"32":"")+".png"));
				

				uno= a1 + ima + a2;
				dos= a1 + o.res + tam + a2 + fec;
				if (o.tex) dos+= "<p>"+o.tex+"</p>"; 
			}
			if (uno || dos) {
				a+=	"<div class='capitulo'>"+ 
					"<div class='uno'>" + uno + "</div>"+
					"<div class='dos'>" + dos + "</div>"+
					"</div>";
				
				
				
				
				
			}
			
			
		}
		
		
		
	}		
	a+= "<br />"+imagenes.monta_htm(json.imal,"") + (json.imal?"<br /><br />":"");
	return a; 
}