﻿


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=1;
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_envia_POST (url, valores) 
{
	var req= azohc_ajax_XMLHttpRequest();  if (!req) return 0;
	req.open ('POST', url, false); 
	try { req.send (valores); } catch (e) {}
	return azohc_ajax_recibe (req, url); 
}


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 j= b.lastIndexOf("."); if (j>=0) { c= b.substr(j+1); b= b.substr(0,j); }
	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 j= arc.lastIndexOf("."); if (j<0) return a;
	return a.substring(0,j);
}


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 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 iCreateElement (padre, etiqueta, texto)
{
	var o= document.createElement(etiqueta); 
	if (texto) o.innerHTML= texto; 
	if (padre) padre.appendChild(o); 
	return o;
}
function idom_createElement (padre, etiqueta, css, tex, cla) 
{
	var o= document.createElement(etiqueta); 
	if (css) o.style.cssText=css;
	if (cla) o.className=cla;
	if (tex) { 
		if (etiqueta=="img") o.src= tex;
		
		else o.innerHTML= tex;
	}
	if (padre) padre.appendChild(o); 
	return o;
}
function iCreateImg (padre, src, title, mi_funcion, mi_param)
{
	var oi= document.createElement("img"); if (src) oi.src= src; if (title) oi.title= title;
	if (mi_funcion) oi.onclick= function() { mi_funcion(this,mi_param); }
	if (padre) padre.appendChild(oi); 
	return oi;
}
function iCreateText (padre, value, mi_funcion, mi_param)
{
	var oi= document.createElement("input"); oi.type= "text"; if (value) oi.value=value; 
	if (mi_funcion) {
		oi.onchange= function () { mi_funcion(this,mi_param); } 
		oi.onkeyup= function (e) {
			if (!e) e= window.event; var key= document.all ? e.keyCode : e.which; 
			if (key == 13) { this.blur(); this.focus(); } 
		}
	}
	if (padre) padre.appendChild(oi); 
	return oi;
}
function iCreateButton (padre, value, mi_funcion, mi_param)
{
	var oi= document.createElement("input"); oi.type= "button"; oi.value=value; 
 	if (mi_funcion) oi.onclick= function() { mi_funcion(this,mi_param); }
	if (padre) padre.appendChild(oi); 
	return oi;
}
function idom_createInput (padre, type, mi_funcion, mi_param) 

{
	var oi= document.createElement("input"); oi.type= type; 
	if (mi_funcion) oi.onclick= function() { mi_funcion(mi_param,this); }
	if (padre) padre.appendChild(oi); 
	return oi;
}
function idom_create_check (padre, texto, name, value, checked, mi_funcion, esradio)
{
	var oo= idom_createElement (0, "div");
	var oi= document.createElement("input"); oi.type=esradio?"radio":"checkbox"; oi.name=name; oi.value=value; 
	if (mi_funcion) oi.onclick= function() { mi_funcion(this); } 
	oo.appendChild(oi); 
	if (texto) oo.appendChild(document.createTextNode(texto)); 
	if (padre) padre.appendChild(oo); 
	return oi;
}
function idom_removeChild (o) { o.parentNode.removeChild(o); }
function iRemoveChild (o) { o.parentNode.removeChild(o); }
function iRemoveChildren (oo)	{ while (oo.firstChild) oo.removeChild(oo.firstChild); } 

function idom_ayuda (odiv, cssbot, csspis, texto_ayuda)
{
	var oi= idom_createElement (odiv, "img", "position:absolute; width:12px; height:12px; "+cssbot, "ima/var/ayu12b.gif" ); 
	oi.onmouseover=function(event) { 
		
		

		this.pista = idom_createElement(odiv, "div", "position:absolute; z-index:100; "+csspis, texto_ayuda, "pista_ayuda"); 
		
		this.onmouseout = function() { if (this.pista) { idom_removeChild  (this.pista); this.pista=0; } }
	}
	return oi;
}

function idom_check (odiv, texto, activo, mi_funcion, mi_param, esradio)
{
	var od= idom_createElement (0, "div", "cursor:pointer; margin:2px 0 2px 0;"); 
	

	od.oi= idom_createElement (od, "img", "", "ima/var/check"+(esradio?"2":"")+"_"+(activo?"si":"no")+".png"); 
	od.onclick= function() { mi_funcion(mi_param,this); }
	idom_createElement (od, "span", "margin-left:8px;", texto);
	if (odiv) odiv.appendChild(od);
	return od;
}

function idom_input (odiv, texto, mi_funcion, mi_param, espassword, img_src, img_title) 
{
	
	var od= idom_createElement (0, "div", "margin:2px 0 2px 0;"); 
	var oi= idom_createElement (od, "input"); 
	oi.type= espassword? "password": "text";  
	if (texto) idom_createElement (od, "span", "margin-left:8px;", texto);
	if (mi_funcion) oi.onkeyup= function (e) {
		if (!e) e = window.event;
		var key= document.all ? e.keyCode : e.which; 
		if (key == 13) mi_funcion(oi, mi_param); 
	}
	if (img_src) {
		var og= iCreateImg (od, img_src, img_title); 
		if (mi_funcion) og.onclick= function() { mi_funcion(oi, mi_param); } 
	}
	odiv.appendChild(od);
	return oi;
}




var ihttp_elen = 0, ihttp_elel = [];
function ihttp_json(url) { 
	var ele = document.createElement('script');
	ele.type = 'text/javascript';
	ele.ide = ++ihttp_elen;
	ele.src = url + (url.indexOf("?")>=0 ? "&" : "?") + "ide=" + ele.ide;
	document.getElementsByTagName('head')[0].appendChild(ele);
	ihttp_elel.push(ele) 
}
function ihttp_json_libera(ide) {
	var elel = ihttp_elel;
	for (var i = 0; i < elel.length; i++) if (elel[i].ide == ide) {
		var ele = elel[i]; ele.parentNode.removeChild(ele);  
		for (var j = i; j < elel.length - 1; j++) elel[j] = elel[j + 1]; elel.length = j;
		return ele;
	}
	return null;
}
	

var ihttp_request=null;
function ihttp_envia (method, url, parameters, callback) 

{
	if (ihttp_request) {} 
	else if (window.XMLHttpRequest) { 
		ihttp_request = new XMLHttpRequest(); 
		if (ihttp_request.overrideMimeType) { 
			 ihttp_request.overrideMimeType ('text/xml'); 
			
		}
	} else if (window.ActiveXObject) { 
		try { ihttp_request = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) { 
		try { ihttp_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}} 
	} 
	if (!ihttp_request) { alert('Cannot create XMLHttpRequest object'); return false; } 

	ihttp_request.onreadystatechange = function (req, url) { 
		
		if (ihttp_request.readyState == 4) { 
			if (ihttp_request.status == 200) { 
				google_analitycs (url);
				if (callback) callback (0, ihttp_request.responseText);
				
				
				
			}
			else { 
				if (callback) callback (1, ihttp_request.responseText);
			} 
		} 
	}
	if (method=='GET') { 
		ihttp_request.open(method, url+parameters, true);
		ihttp_request.setRequestHeader("Content-type", "text/xml"); 
		ihttp_request.setRequestHeader("Content-length", parameters.length); 
		ihttp_request.setRequestHeader("Connection", "close"); 
		ihttp_request.send(null); 
	} 
	if (method=='POST') {
		ihttp_request.open(method, url, true); 
		ihttp_request.setRequestHeader("Content-type", "text/xml"); 
		ihttp_request.setRequestHeader("Content-length", parameters.length);
		ihttp_request.setRequestHeader("Connection", "close"); 
		ihttp_request.send(parameters); 
	} 
	if (method=='PUT') { http_request.open(method, url, true); 
		ihttp_request.setRequestHeader("Content-type", "text/xml"); 
		ihttp_request.setRequestHeader("Content-length", parameters.length); 
		ihttp_request.setRequestHeader("Connection", "close"); 
		ihttp_request.send(parameters); 
	} 
	if (method=='DELETE') { 
		ihttp_request.open(method, url+parameters, true); 
		ihttp_request.setRequestHeader("Content-type", "text/xml"); 
		ihttp_request.setRequestHeader("Content-length", parameters.length); 
		ihttp_request.setRequestHeader("Connection", "close"); 
		ihttp_request.send(null); 
	} 
} 



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.copia = function (a) { this.splice(0,this.length); this.concat(a); }

Array.prototype.compara = function (i,j) { return (i>j)?1:(i<j)?-1:0; } 
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;
	}
}
Array.prototype.dentro = function (pun) 
{
	if (this.length == 4) { 
		var rec= this;
		return !(rec[0] > pun[0] || rec[2] < pun[0] || rec[1] > pun[1] || rec[3] < pun[1]);
	}
	else if (this.length >= 6) {
		var punl= this, punn= punl.length/2, px=pun[0],py=pun[1];
		var c=0;
		for (var i= 0, j= punn-1; i < punn; j= i++) {
			var x1=punl[2*i], y1=punl[2*i+1], x2=punl[2*j], y2=punl[2*j+1];
			if ( ((y1 > py) != (y2 > py)) && (px < (x2-x1) * (py-y1) / (y2-y1) + x1) ) c = !c;
			
		}
		return c;
	}
	return 0;
}
Array.prototype.margen_tpc = function (tpc) 
{
	if (this.length != 4) return this; 
	var r= this;
	var xx= (r[2]-r[0])*tpc/100;
	var yy= (r[3]-r[1])*tpc/100;
	return [r[0]-xx, r[1]-yy, r[2]+xx, r[3]+yy];
}


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;
}






function evento (e) 		{ return document.all? window.event : e; }
function evento_objeto (e)	{ return document.all? e.srcElement: e.target; } 
function evento_keycode (e)	{ return document.all? e.keyCode: e.which; } 
function evento_nopropaga (e) { if (document.all) e.cancelBubble= true; else e.stopPropagation(); } 
function evento_nodefecto (e) { if (document.all) e.returnValue= false; else e.preventDefault(); } 

function 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 evento_elimina (obj, event_name, fun, useCapture) {
	if (obj.removeEventListener)	{ obj.removeEventListener(event_name, fun, useCapture); return true; } 
	else if (obj.detachEvent)	{ return obj.detachEvent("on"+event_name, fun); }
	return -1; 
} 
function evento_mousewheel (e) { 
	var d=0;
	if (!e) e= window.event;
	if (e.wheelDelta) { d= e.wheelDelta/120; if (window.opera) d=-d; }
	else if (e.detail) d= -e.detail/3;
	return Math.round(d); 
}
function evento_boton (e) { 
	if (document.all) return e.button;		
	return e.button==0? 1: e.button==1? 4: 2;	
	
}

function azohc_htm_evento(e)				{ return evento(e); }
function azohc_htm_evento_objeto(e,r)		{ return evento_objeto(e,r); }
function azohc_htm_evento_agrega(o,e,f)		{ return evento_agrega(o,e,f); }
function azohc_htm_evento_elimina(o,e,f,u)	{ return evento_elimina(o,e,f,u); }
function azohc_htm_evento_nopropaga(e)		{ return evento_nopropaga(e); }
function azohc_htm_evento_nodefecto(e)		{ return evento_nodefecto(e); }
function azohc_htm_evento_mousewheel(e)		{ return evento_mousewheel(e); }
function azohc_htm_evento_esboton1(e)		{ return evento_boton(e)==1; }
function azohc_htm_evento_boton(e)			{ return evento_boton(e); } 
function azohc_htm_evento_keyCode(e)		{ return evento_keycode(e); } 

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 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 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 && 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 ingra_indice_no=0;		
var ingra_indice=0;		

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=  0; 
var indice_compacta=0;		
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)
{
	
	if (ingra_indice_no) return;
	var forzado= !ingra_indice;
	if (!ingra_indice) ingra_indice= document.getElementById("ingra_indice"); 
	if (!ingra_indice) return;
	
	
	
	
	
	var i= indice_busca (cod); if (!i) { if (!forzado) return; i=1; }
	var a= indice_monta1 (i-1);
	ingra_indice.innerHTML= a; 
	if (!indice[i-1].pag) navega_scroll();
	
}
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_monta_linea (cod, res, ind.pag, niv+1, clase); 
		}
		if (escam) {
			a+= b;
			
			
		}
	}
	if (todos && indice_maximo && 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 (indice_maximo && 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? i1: nivl.length+i1): 0;
	var j2= i2? (i2>0? i2: nivl.length+i2): nivl.length; 
	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 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_padre1 (cod) 
{
	return indice_padres1 (cod, 0, -1, 1);
}
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>"; 
}


window.onload = navega_inicia;
var navega_imagenes=0; 
var json=null;

function navega_inicia () 
{
	var a= document.location.href; 
	var cod= "";
	var i= a.lastIndexOf("#"); if (i>=0) { cod= a.substr(i+1); a= a.substr(0,i); } 
	var i= a.lastIndexOf("?"); if (i>=0) { cod= 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_ie6= null;
	}
	if (azohc_htm_esie()) {
		if (typeof ingra_ie6 == "undefined") ingra_ie6=null;
	}
	if (typeof window_onload2 != "undefined") window_onload2(); 

	navega_historia_inicia(); 

	navega_actualiza (cod);
	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 () 			{ unFocus.History.addEventListener('historyChange', navega_historia_evento); }
function navega_historia_agrega (cod)		{ unFocus.History.addHistory (cod); } 
function navega_historia_evento (cod, dat)	{ navega_actualiza (cod); }
function navega_historia_cambia (cod)		{}

function navega_navega (cod) 
{
	
	if (	cod.substr(0,4) == "ftp:"  || 
		cod.substr(0,5) == "http:" || 
		cod.substr(0,7) == "mailto:" ) { navega_navega_externo (cod); return; }

	navega_historia_agrega (cod); 
}
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) 
{
	

	if (!cod2) cod2= indice_url_inicio (); 
	var cod=cod2, param="";	
	var i= cod.indexOf('?'); if (i>=0) { param= cod.substr(i+1); cod= cod.substr(0,i); } 
	var i= cod.indexOf(';'); if (i>=0) { param= cod.substr(i+1); cod= cod.substr(0,i); }
	if (!cod) return;
	
	
	indice_actualiza (cod); 
	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 (json && json.termina) json.termina();
	if (dat.substr(0,5) != "json=") {
		if (dat.charAt(0)!='{') dat='{'+dat+'}';
		dat="json="+dat;
	}
	eval(dat); 

	if (!json || !json.controlador) return; 
	json.param= param;
	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 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.google_onmousemove= function (eve, tex, ima) { 
		this.inicia();
		if (this.cod != tex) {
			this.cod= tex;
			this.div_muestra();
			this.otex.innerHTML= tex;
			azohc_htm_width_pon (this.otex, 160);

			this.img_oculta();
			if (ima) {
				this.oimg.src= ingra_ima_camino (ima, 0); 
				this.img_muestra();
			}
		}
		var p= azohc_eve_pos (eve, 1); p.x+=8; 
		
		var p0= azohc_eve_pos (eve, 0); 
		
		
		if (ima && 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;
	
	
}

	
	
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 google2pun (latlng)	{ return [latlng.lng(), latlng.lat()]; }
function google2rec (bounds)	{ var sw=bounds.getSouthWest(), ne=bounds.getNorthEast(); return [sw.lng(),sw.lat(), ne.lng(),ne.lat()]; }
function rec2google (r)		{ return new google.maps.LatLngBounds (new google.maps.LatLng(r[1],r[0]), new google.maps.LatLng(r[3],r[2])); }
function pun2google (p)		{ return new google.maps.LatLng(p[1],p[0]); }
function punl2google (pl)	{ var path=[]; for (var k=0; k<pl.length; k+=2) path.push (new google.maps.LatLng(pl[k+1],pl[k])); return path; }



function mapa_onbounds_changed()
{
	
	var r= google2rec(mapa_map.getBounds()); 
	var xx= r[2]-r[0];
	var i;
	for (i=0; i<espacio_padres.length; i++) {
		var e= espacio_padres[i]; 
		var exx= e.rec[2]-e.rec[0]; if (xx > exx*1.2) continue;
		mapa_rot1.innerHTML= "bounds: "+r.join(", ")+ 
			"<br>"+xx+" > "+exx+" i:"+i;
		if (i) { 
			return mapa_monta_espacios (e.tab+"."+e.cod); 
		}
		break;
	}	
		mapa_rot1.innerHTML= "bounds: "+r.join(", ")+ 
			"<br>"+xx+" > "+exx+" i:"+i;
	if (!i && espacio_hijos.length) { 
		var e= espacio_padres[i]; 
		var exx= e.rec[2]-e.rec[0]; if (xx > exx/1.4) return;
		var c= [(r[0]+r[2])/2, (r[1]+r[3])/2], d2m,jm;
		for (var j=0; j<espacio_hijos.length; j++) {
			var e= espacio_hijos[j];
			var ec= [(e.rec[0]+e.rec[2])/2, (e.rec[1]+e.rec[3])/2];
			var d= [ec[0]-c[0], ec[1]-c[1]];
			var d2= d[0]*d[0]+d[1]*d[1];
			if (!j || d2m>d2) { jm=j; d2m=d2 }
		}
		var e= espacio_hijos[jm];
		return mapa_monta_espacios (e.tab+"."+e.cod); 
	}
}








function geolocation () 
{
    
    var loc= null;  
    
	if (navigator.geolocation) {
	    navigator.geolocation.getCurrentPosition(
	        function (position) { loc = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); },
	        null); 
    
    } else if (google.gears) {
        var geo = google.gears.factory.create ('beta.geolocation');
        geo.getCurrentPosition(
            function (position) { true; loc = new google.maps.LatLng(position.latitude, position.longitude); },
            null); 
    }
    if (loc) map.setCenter (loc);
    return loc;
}
function degreesToRadians (deg) { return deg * (Math.PI / 180); }
function radiansToDegrees (rad) { return rad / (Math.PI / 180); }
function bound (value, opt_min, opt_max) {
    if (opt_min != null) value = Math.max(value, opt_min);
    if (opt_max != null) value = Math.min(value, opt_max);
    return value;
}


var MERCATOR_RANGE = 256;

var pixelsPerLonDegree = MERCATOR_RANGE / 360;
var pixelsPerLonRadian = MERCATOR_RANGE / (2 * Math.PI);

function LatLng2world (latLng, opt_world) {
    var world = opt_world || new google.maps.Point(0, 0);

    var origin = new google.maps.Point(MERCATOR_RANGE / 2, MERCATOR_RANGE / 2); 
    world.x = origin.x + latLng.lng() * pixelsPerLonDegree;
    
    
    var siny = bound(Math.sin(degreesToRadians(latLng.lat())), -0.9999, 0.9999);
    world.y = origin.y + 0.5 * Math.log((1 + siny) / (1 - siny)) * -pixelsPerLonRadian;
    return world;
};
function world2LatLng (world) {
    var origin = new google.maps.Point(MERCATOR_RANGE / 2, MERCATOR_RANGE / 2); 
    var lng = (world.x - origin.x) / pixelsPerLonDegree;
    var latRadians = (world.y - origin.y) / -pixelsPerLonRadian;
    var lat = radiansToDegrees(2 * Math.atan(Math.exp(latRadians)) - Math.PI / 2);
    return new google.maps.LatLng(lat, lng);
};
function world2pixel (world, zoom) {
    return new google.maps.Point(
    parseInt(world.x * Math.pow(2, zoom)),
    parseInt(world.y * Math.pow(2, zoom)));
}
function pixel2tile (pixel) {
    return new google.maps.Point(
    parseInt(pixel.x / MERCATOR_RANGE), 
    parseInt(pixel.y / MERCATOR_RANGE));
}
function pixel2punto(pixel) {
    return new google.maps.Point(
   pixel.x % MERCATOR_RANGE,
   pixel.y % MERCATOR_RANGE);
}


function HomeControl() {
    var control = document.createElement('DIV');
    control.style.cssText = "background-color:white;" + 
            "border: solid 2px; cursor:pointer; text-align:center;" +
            "font-size:12px; font-family:Arial,sans-serif;" +
            "margin:5px; padding:0 4px;";
    control.title = 'Ir a Cronos sin cambiar de escala';
    control.innerHTML = 'Cronos';

    google.maps.event.addDomListener(control, 'click', function() {
        
        map.setCenter(cronos); 
        });
    control.index = 1;
    map.controls[google.maps.ControlPosition.TOP_RIGHT].push(control);
}

function placeInfoWindow (location) 
{
    var infowindow = new google.maps.InfoWindow({ size: new google.maps.Size(10, 10), position: location }); 
    
    var world = LatLng2world(location);
    var pixel = world2pixel(world,map.getZoom());
    var tile =  pixel2tile(pixel);
    var punto = pixel2punto(pixel);
    infowindow.setContent("Zoom: " + map.getZoom() + "<br>Location: " + location + "<br>world: " +
        world + "<br>pixel: " + pixel + "<br>tile: " + tile + "<br>punto: " + punto); 
    infowindow.open(map);
    
    
    
}



function pefcMapType() 
{
	pefcMapType.prototype.tileSize = new google.maps.Size(256, 256);
	pefcMapType.prototype.maxZoom = 19;
	pefcMapType.prototype.name = "Zonas PEFC";
	pefcMapType.prototype.alt = "Tile Coordinate Map Type";
	pefcMapType.prototype.getTile = function(coord, zoom, ownerDocument) 
	{
	    var div = ownerDocument.createElement('DIV');
	    div.innerHTML = map.getZoom()+" "+coord;
	    div.style.width = this.tileSize.width + 'px';
	    div.style.height = this.tileSize.height + 'px';
	    div.style.fontSize = '10';
	    div.style.borderStyle = 'solid';
	    div.style.borderWidth = '1px';
	    div.style.borderColor = '#AAAAAA';
	    return div;
	}
}
function PEFC_MapType() {
    var maptype = new pefcMapType();
    
    
    map.overlayMapTypes.insertAt(0, maptype);
}
function PEFC_ImageMapType() {
    var options = {
        getTileUrl: function(coord, zoom) { return "http://mt3.google.com/mapstt?" + "zoom=" + zoom + "&x=" + coord.x + "&y=" + coord.y + "&client=google"; },
        tileSize: new google.maps.Size(256, 256),
        isPng: true
    };
    var maptype= google.maps.ImageMapType (options);
    map.overlayMapTypes.insertAt (0, maptype); 
}

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=null; 


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? mapa_correo_asunto: indice[0].res, 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;
						
						
						
						
						
						
					
					}	
				}
				
				
			}
		}
		
	}
}	



function valor2formato (tip,tam,val) 
{
	if (tip=="B") {
		if (!val.toString().length) return "";
		return !parseInt(val)?"No":"Sí"
	}
	if (!val) return ""; 
	if (tip=="E") {
		return parseInt(val);
	}
	if (tip=="F") {
		var v= parseInt(val);
		var a= Math.floor(v/10000);   a+=""; while (a.length<4) a="0"+a; 
		var m= Math.floor(v/100)%100; m+=""; while (m.length<2) m="0"+m;
		var d= v%100;                 d+=""; while (d.length<2) d="0"+d;
		return d+"/"+m+"/"+a;
	}
	if (tip=="H") {
		var v= parseInt(val);
		var h= Math.floor(v/10000);   h+=""; while (h.length<2) h="0"+h; 
		var m= Math.floor(v/100)%100; m+=""; while (m.length<2) m="0"+m;
		return h+":"+m;
	}
	if (tip=="G") {
		var v= parseFloat(val);
		var fec= parseInt(Math.floor(v));
		var hor= parseInt((v-fec)*1000000);
		fec= val2htm("F",0,fec);
		hor= val2htm("H",0,hor);
		return fec+" "+hor;
	}
	if (tip=="R") {
		var v= parseFloat(val);
		var fac=Math.pow(10,tam);
		var v= (Math.round(v*fac)/fac)+"";
		v=v.replace(/\./g, ",");
		var l=0,k= v.lastIndexOf(","); if (k<0) { v+=","; l=tam; } else l=tam-(v.length-(k+1)); 
		while (l-->0) v+="0";
		return v;	
	}
	return val;
}	
function date2fec   ()  { var d=new Date; return d.getFullYear()*10000+ (d.getMonth()+1)*100+ d.getDate(); }
function date2fechor()  { var d=new Date; return d.getFullYear()*10000+ (d.getMonth()+1)*100+ d.getDate() + (d.getHours()*10000+ (d.getMinutes()+1)*100+ d.getSeconds())*10e-7; }
var ingra_mapa= {
tab:'map',cod:'WM',res:'Mapa interactivo',
ven:[0,0,512,512], 
capas:[
{ cod:'ROADMAP',	tip:'F',vis:0, res:'Mapa',				tid:google.maps.MapTypeId.ROADMAP },		
{ cod:'SATELLITE',tip:'F',vis:0, res:'Satélite',			tid:google.maps.MapTypeId.SATELLITE },		
{ cod:'HYBRID',	tip:'F',vis:0, res:'Híbrido',				tid:google.maps.MapTypeId.HYBRID },			
{ cod:'TERRAIN',	tip:'F',vis:1, res:'Relieve',				tid:google.maps.MapTypeId.TERRAIN },		
{ cod:'esplim',	tip:'P',vis:1, res:'Límites. Perímetro', 		poll:[],	sc:"#FD4A03", so:1, sw:2, fc:"#000000", fo:0 },   

{ cod:'espnuc',	tip:'P',vis:1, res:'Poblaciones', 			poll:[],	sc:"#FD4A03", so:1, sw:1, fc:"#FD4A03", fo:0.5 }, 

{ cod:'espare',	tip:'P',vis:1, res:'Montes certificados',		poll:[],	sc:"#00AA00", so:1, sw:2, fc:"#00AA00", fo:0.5 }, 
{ cod:'mfe',	tip:'O',vis:0, res:'Mapa Forestal. Estratos', 		ove:null },	
{ cod:'mfa',	tip:'O',vis:0, res:'Mapa Forestal. Especies', 		ove:null },	
{ cod:'mup',	tip:'O',vis:0, res:'Montes de Utilidad Pública', 	ove:null },	
{ cod:'enp',	tip:'O',vis:1, res:'Esp. Naturales Protegidos', 	ove:null },	
{ cod:'nat',	tip:'O',vis:0, res:'Red Natura 2000', 			ove:null }	

]};



var mapa= null; 

var espacio_padres=[], espacio_hijos=[], espacio_capas={}; 


function mapa_google_inicia (json)
{
	mapa= {};
	var ven= ingra_mapa.ven;
	var oo= document.getElementById("ingra_mapa");
	

	var oc= document.createElement("div"); oc.style.width=ven[2]+"px"; oc.style.height=ven[3]+"px"; 
	oo.appendChild(oc);

	oo.appendChild(mapa_leyenda_monta());
	idom_createElement(oo,"br");
	idom_createElement(oo,"br");

	var tid= google.maps.MapTypeId.ROADMAP; for (var i=0; i<ingra_mapa.capas.length; i++) { var cap= ingra_mapa.capas[i]; if (cap.tip == 'F' && cap.vis == 1) { tid= cap.tid; break; } }

	mapa.map= new google.maps.Map(oc, {
			zoom: 5, 
			center: new google.maps.LatLng(39.44397281, -1.93502918), 
			mapTypeId: tid, 
			disableDefaultUI: true 
		});
	google.maps.event.addListener (mapa.map, 'rightclick', mapa_onrightclick);
	google.maps.event.addListener (mapa.map, 'mousemove', mapa_onmousemove);
	
	
}

function espacio_hijos_busca(event,navega) 
{
	var p= event.latLng; 
	var pun=[p.lng(),p.lat()]; var a="";
	for (var i=0; i<espacio_hijos.length; i++) {
		var e=espacio_hijos[i];
		if (e.tab == json.tab) continue;

		if (navega && (e.tab=="espnuc" || e.tab=="espare" || e.tab=="espenp")) continue;
	
		if (!e.rec.dentro(pun)) continue;
		if (e.tip && e.tip=='C') {} 
		else if (!e.punl.dentro(pun)) continue;
		
		return i+1;
	}
	return 0;
}
function mapa_onmousemove(event) 
{
	var z=mapa.map.getZoom(), c=mapa.map.getCenter(); 
	var p= event.latLng; 
	var a= "Lon.: "+p.lng().round(4)+"<br>"+
		 "Lat.: "+p.lat().round(4)+"<br>"+
		 "zom: "+z; 
		

	var i= espacio_hijos_busca(event); 
	if (i) { 
		var e= espacio_hijos[i-1]; 
		var b= ingra_tablas[e.tab].res+":<br>"+e.cod+" · "+e.res; 
		if (e.tip && e.tip=='C') b+= "<br>"+(e.are/10000).format(0)+" Ha"; 
		a+= "<a href='#'><br><br>"+b+"</a>"; 
	}
	mapa.rot.innerHTML= a; 
}
function mapa_onrightclick (event) 
{
	if (espacio_padres.length>1) { 
		espacio_padres.splice(0,1);
		var e=espacio_padres[0]; 
		
		
		navega_navega (e.tab+"."+e.cod); 
	}
}
function mapa_onclick (event) 
{
	var i= espacio_hijos_busca(event,1); 
	if (i) { var e= espacio_hijos[i-1]; 
		if (e.tab == "espnuc") return;
		if (e.tab == "espare") return;
		navega_navega (e.tab+"."+e.cod); 
	}
}

function mapa_capa_libera (capa)
{
	if (capa.tip == 'P') { for (var j=0; j<capa.poll.length; j++) capa.poll[j].setMap(null); capa.poll=[]; }
	else if (capa.tip == 'O') { if (capa.ove) { capa.ove.setMap(null); capa.ove=null; } }
	
}
function mapa_libera1 () 
{
	espacio_padres=[]; espacio_hijos=[]; espacio_capas={}; 
	for (var i=0; i< ingra_mapa.capas.length; i++) mapa_capa_libera (ingra_mapa.capas[i]);
}
function mapa_capa_monta (capa) 
{
	if (capa.tip == 'F') return;
	mapa_capa_libera (capa);
	if (!capa.vis) return;
	if (capa.tip == 'P') {
		for (var i=0; i<espacio_hijos.length; i++) { 
			var e= espacio_hijos[i]; 
			var fc=capa.fc;
			var fo=capa.fo;
			if      (capa.cod == "espnuc") {  if (e.tab != capa.cod) continue; }
			else if (capa.cod == "espenp") continue; 
			else if (capa.cod == "espare") {  if (e.tab != capa.cod) continue; 
				if (json.tab == "espmun") {
					if (muestra_actual==12344321) { if (e.tip=='C') continue; }
					else                      	{ if (e.tip=='P') continue; }
				}
			}
			else  { 
				if (e.tab == "espnuc" || e.tab == "espare" || e.tab == "espenp") continue; 
					
					
			}

			var op= {
				map:mapa.map,
				strokeColor:	capa.sc,	
				strokeOpacity:	capa.so,	
				strokeWeight:	capa.sw,	
				fillColor:		fc, 	
				fillOpacity:	fo	
				
			};	
			var p;
			if (e.tip && e.tip=='C') { op.center= pun2google(e.cen); op.radius= e.rad; p= new google.maps.Circle (op); }	
			else 				 { op.path= punl2google(e.punl); p= new google.maps.Polygon (op); }
			google.maps.event.addListener (p, 'click', mapa_onclick); 
			capa.poll.push(p);
		}
	}
	else if (capa.tip == 'O') {
		var e= espacio_capas[capa.cod]; if (!e) return;
		capa.ove= new google.maps.GroundOverlay (e.url, rec2google(e.rec), { clickable:false, map:mapa.map });
		
	}
}

function mapa_google_cambia (json)
{
	if (!mapa) mapa_google_inicia (json)

	var tab=json.tab, cod=json.cod;
	var a= azohc_htm_direc+"/map/json/"+tab+"/"+(tab=="espmun"?cod.substr(0,2)+"/":"")+cod+".json"; 
	azohc_ajax_carga_js (a);

	

	var capas= ingra_mapa.capas; for (var i=0; i<capas.length; i++) mapa_capa_monta (capas[i]);

	
	

	var r= espacio_padres[0].rec.margen_tpc(-14);
	mapa.map.fitBounds (rec2google(r));
}

var capas_de_imagen_exclusivas=0



function mapa_leyenda_marca (cap, vis)
{
	cap.vis= vis;
	if (!cap.oimg) return;
	var esradio= cap.tip=='F' || cap.tip=='O' && capas_de_imagen_exclusivas;

	cap.oimg.src= "ima/var/check" + (esradio?"2":"") + "_" + (cap.vis?"si":"no") + ".png"
	if (vis) {
		if      (cap.cod == 'ROADMAP')	mapa.map.setMapTypeId (google.maps.MapTypeId.ROADMAP)
		else if (cap.cod == 'SATELLITE')	mapa.map.setMapTypeId (google.maps.MapTypeId.SATELLITE)
		else if (cap.cod == 'HYBRID' )	mapa.map.setMapTypeId (google.maps.MapTypeId.HYBRID)
		else if (cap.cod == 'TERRAIN')	mapa.map.setMapTypeId (google.maps.MapTypeId.TERRAIN)
		else mapa_capa_monta (cap);
	}
	else mapa_capa_libera (cap);
}
function mapa_leyenda_onclick (i)
{
	var capas= ingra_mapa.capas;
	var cap= capas[i]; 

	var esradio= cap.tip=='F' || cap.tip=='O' && capas_de_imagen_exclusivas;

	if (!esradio) return mapa_leyenda_marca (cap, !cap.vis)

	
	
	if (cap.tip == 'F' && cap.vis) return; 
	
		for (var cod1 in capas) if (cod1 != cap.cod) {
			var cap1= capas[cod1]; if (cap1.tip != cap.tip || !cap1.vis) continue; 
			mapa_leyenda_marca (cap1, 0); 
		}
		mapa_leyenda_marca (cap, 1)
		if (typeof mapas_leyenda_onclick2 != "undefined") mapas_leyenda_onclick2(capi);
	
} 

function mapa_leyenda_monta ()
{
	var ven= ingra_mapa.ven;
	var odiv= idom_createElement (0, "div", "position:absolute; left:"+(ven[2]+24)+"px; top:0; width:200px;"); 

	idom_ayuda (odiv, "right:28px; top:0px;", "right:40px; top:0px; width:280px;", mapa_ayuda)
	
	var capas= ingra_mapa.capas;
	for (var n=0; n<3; n++) {
		var k=0;
		for (var i=0; i<capas.length; i++) { 
			var cap= capas[i]; if (cap.vis == -1 || cap.tip != 'F' && n==0 || cap.tip != 'P' && n==1 || cap.tip != 'O' && n==2) continue;
			if (!k++) idom_createElement (odiv, "h3", "", n==0? "Fondo": n==1? "Capas vectoriales": n==2? "Capas de imagen": "");  

			
			var esradio= n==0 || n==2 && capas_de_imagen_exclusivas;

			var od= idom_check (odiv, cap.res, cap.vis, mapa_leyenda_onclick, i, esradio);
			cap.oimg= od.oi;
			
		}
		if (k) idom_createElement (odiv, "br");
	}
	idom_createElement (odiv, "h3", "", "Actual");
	mapa.rot= idom_createElement (odiv, "div", "overflow:visible;"); 
	
	
	return odiv;

}



var mapa_ayuda= ""+
	"<h4>CAPAS vectoriales</h4>"+
	"<b>Límites:</b> Imprescindible para navegación: clic con botón izquierdo muestra el nivel inferior, y con derecho vuelve al nivel superior.<br />"+
	"<b>Poblaciones:</b> sólo a nivel municipios.<br />"+
	"<b>Montes certificados:</b> área certificada en cada división administrativa, en el centroide del conjunto de parcelas reales (información restringida).<br />"+
	"<br /><h4>CAPAS de imagen</h4>"+
	"Se muestra información recortada al límite administrativo actual:<br />"+
	"<b>Esp. Naturales Protegidos:</b> a nivel municipio se ve el código europeo y nombre<br />"+
	"<b>Red Natura 2000 (LIC+ZEPA):</b> en color verde oscuro, la intersección de ambas<br />"+
	"<br /><h4>Navegación por el control de Google maps</h4>"+
	"Desplazarse arrastrando con botón izquierdo del ratón y zoom con la rueda<br />"

function ingra_pestana (json) 
{
	var oo= document.getElementById("ingra_mapa");
	if (json.tab.substr(0,3) == "esp") {
		if (oo) oo.style.display='block'; 
		mapa_google_cambia (json)
	}
	else {
		if (oo) oo.style.display='none';
	}
	var tit= seccion_resumen (json);
	var sec= seccion_padre (json);
	return (!sec? "": "<p>" + sec + "</p>") +  (!tit? "": "<h1>" + tit + "</h1>"); 
}
function seccion_resumen (json) 
{
	if (!json.tab) { var cl= json.cod.split2('.',1); return seccion_resumen ({tab:cl[0],cod:cl[1],res:json.res}); } 
	var tabla= ingra_tablas[json.tab];
	var a= (indice_concodigo(json.tab)? json.cod+" · ": "") + json.res;
	if (json.tab!="web" && json.tab!="esppai" && json.tab!="car" && json.tab!="varpag" && json.tab!="sql") a= tabla.res + ": " + a;
	return a;
}
function seccion_padre (json) 
{
	var i= indice_busca(json.tab+"."+json.cod); if (!i) return "";
	var nivl= indice_busca1(i-1); 
	var j= nivl.length-2; if (j<1) return ""; 
	var pos= nivl[j];
	var res= seccion_resumen (indice[pos]);
	return "<a href='"+indice_href1(pos)+"'>" + res + "</a>";
}


var servidor = "http://ingra.es:5432";
var base_cont = "PEFC";
function contador_onload(ide,acc,err,men) { } 
function ingra_manda_visita (pag) { contador_pon(base_cont, [{pag:pag}], 0) }
function contador_pon (base_cont, objeto, funcion_respuesta) {
	var j= object2json(objeto);
	var a= encodeURIComponent(base_cont)+"/"+encodeURIComponent(j);
	$.ajax({url:servidor+"/contador/pon/"+a+"?callback=?", dataType:"jsonp", success:funcion_respuesta }); 
}
function ingra_manda_formPEFC (cod, web)
{
	var nom = document.getElementById('nombre');  if (!nom.value.length){ alert("El campo NOMBRE en DATOS PERSONALES es obligatorio"); return;}
	var ok = nom.value=="anonimo" 
	var ape = document.getElementById('apellidos'); if (!ape.value.length && !ok){ alert("El campo APELLIDOS en DATOS PERSONALES es obligatorio"); return;}
	var nif = document.getElementById('nif');
	var loc = document.getElementById('localidad'); if (!loc.value.length && !ok){ alert("El campo LOCALIDAD en DATOS PERSONALES es obligatorio"); return;}
	var cpo = document.getElementById('cp'); 
	var tel = document.getElementById('telefono'); 
	var ema = document.getElementById('email'); if (!ema.value.length && !ok){ alert("El campo E-Mail en DATOS PERSONALES es obligatorio"); return;}
	var tra = document.getElementById('seltrab'); 
	var aut = document.getElementById('selauto'); 

	var nome = document.getElementById('nome'); if (!nome.value.length && !ok)	{ alert("El campo NOMBRE en DATOS DE EMPRESA es obligatorio"); return;}
	var dire = document.getElementById('dire'); if (!dire.value.length && !ok)	{ alert("El campo DIRECCIÓN en DATOS DE EMPRESA es obligatorio"); return;}
	var cpe = document.getElementById('cpe'); if (!cpe.value.length && !ok)		{ alert("El campo CODIGO POSTAL Y LOCALIDAD en DATOS DATOS DE EMPRESA es obligatorio"); return;}
	var proe = document.getElementById('provinciae'); if (!proe.value.length && !ok){ alert("El campo PROVINCIA en DATOS DE EMPRESA es obligatorio"); return;}
	var cife = document.getElementById('cife'); if (!cife.value.length && !ok){ alert("El campo CIF en DATOS DE EMPRESA es obligatorio"); return;}
	var tele = document.getElementById('telefonoe'); 
	var faxe = document.getElementById('faxe'); if (!faxe.value.length && !ok){ alert("El campo FAX en DATOS PERSONALES es obligatorio"); return;}

	var form = "observa";
    	var dir3 = caracterNvalidos(dire.value);

	var dato = [{form:form,nom:nom.value,ape:ape.value,nif:nif.value,loc:loc.value,cpo:cpo.value,tel:tel.value,ema:ema.value,tra:tra.value,aut:aut.value,nome:nome.value,dire:dir3,cpe:cpe.value,proe:proe.value,cife:cife.value,tele:tele.value,faxe:faxe.value}];

	contador_pon(base_cont , dato, 0);

      nom.value = ""; ape.value = ""; nif.value = ""; loc.value = ""; cpo.value = ""; tel.value = "";
      ema.value = ""; tra.value = ""; aut.value = ""; nome.value = ""; dire.value = ""; cpe.value = "";
      proe.value = ""; cife.value = ""; tele.value = ""; faxe.value = "";
}

function ingra_manda_solCDC () 
{
	
 	var nom = document.getElementById('nombre');  if (!nom.value.length){ alert("El campo NOMBRE de la ENTIDAD CERTIFICADORA es obligatorio"); return;}
 	var dni = document.getElementById('dni');     if (!dni.value.length){ alert("El campo DNI de la ENTIDAD CERTIFICADORA es obligatorio"); return;}
 	var cal = document.getElementById('calidad');
	var rep = document.getElementById('representa'); var empr=rep.value;
	var cif = document.getElementById('cif');
	var dom = document.getElementById('domsoc');
	var pob = document.getElementById('pobla');
	var cpo = document.getElementById('cp');
	var prv = document.getElementById('provi');
	var caa = document.getElementById('ccaa');
	var tel = document.getElementById('telefono');
	var fax = document.getElementById('fax');
	var ema = document.getElementById('email');
	var web = document.getElementById('pweb');

	var nom1 = document.getElementById('nombre1');	 var carg = document.getElementById('cargo');
	var dire = document.getElementById('direc');	 var pob1 = document.getElementById('pobla1');
	var cpo1 = document.getElementById('cp1');	 var prv1 = document.getElementById('provi1');
	var tel1 = document.getElementById('telefono1'); var fax1 = document.getElementById('fax1');
	var ema1 = document.getElementById('email1');


	var nom2 = document.getElementById('nombre2');	var cif2 = document.getElementById('cif2');
	var dom2 = document.getElementById('domsoc2');	var pob2 = document.getElementById('pobla2');
	var cpo2 = document.getElementById('cp2');	var prv2 = document.getElementById('provi2');

	
	var nom3 = document.getElementById('nombre3');	 var car2 = document.getElementById('cargo2');
	var dir2 = document.getElementById('direc2');	 var pob3 = document.getElementById('pobla3');
	var cpo3 = document.getElementById('cp3');	 var prv3 = document.getElementById('provi3');
	var tel2 = document.getElementById('telefono2'); var fax2 = document.getElementById('fax2');
	var ema2 = document.getElementById('email2');

	
	var nom4 = document.getElementById('nombre4');	 var nom5 = document.getElementById('nombre5');  
	var desc = document.getElementById('descrip');	 var volu = document.getElementById('volumen');
	var acti = valorRadio(document.solCDC.actividad);var tice = valorRadio(document.solCDC.tipcer);
	var nom6 = document.getElementById('nombre6');	 var tili = valorRadio(document.solCDC.tiplic);
	var tive = valorRadio(document.solCDC.tipver);
	
	var tiam = valorRadio(document.solCDC.tipamb);	var ambi = document.getElementById('ambito');
	var time = valorRadio(document.solCDC.tipmed);	var medi = document.getElementById('medici');
	var peri = document.getElementById('periodo');	var mate = document.getElementById('materia');
	var ctot = document.getElementById('ctotal');	var feca = document.getElementById('fecacti');

	var acep = document.getElementById('acepto');
	if (!acep.checked){ alert("Para continuar el proceso de envío, tiene que marcar la opción de aceptación de la solicitud"); return;}

    var cmp1 = caracterNvalidos(dom.value);
    var cmp2 = caracterNvalidos(dire.value);
    var cmp3 = caracterNvalidos(dom2.value);
    var cmp4 = caracterNvalidos(dir2.value);
    var cmp5 = caracterNvalidos(desc.value);
    var cmp6 = caracterNvalidos(nom4.value);
    var cmp7 = caracterNvalidos(nom5.value);
    var cmp8 = caracterNvalidos(nom6.value);
    var cmp9 = caracterNvalidos(feca.value);
    var cmp10 = caracterNvalidos(web.value);
    var cmp11 = caracterNvalidos(ctot.value);

    	numPosibilidades = 5000 -  1000
    	aleat = Math.random() * numPosibilidades 
    	aleat = Math.floor(aleat) 
    	nume =  parseInt(1000) + aleat
 
	var form = "cdc1";
	var dato = [{form:form,nume:nume,nom:nom.value,dni:dni.value,cal:cal.value,rep:rep.value,cif:cif.value,dom:cmp1,pob:pob.value,cpo:cpo.value,prv:prv.value,caa:caa.value,tel:tel.value,fax:fax.value,ema:ema.value,web:cmp10,nom1:nom1.value,carg:carg.value,dire:cmp2,pob1:pob1.value,cpo1:cpo1.value,prv1:prv1.value,tel1:tel1.value,fax1:fax1.value,ema1:ema1.value,nom2:nom2.value,cif2:cif2.value,dom2:cmp3,pob2:pob2.value,cpo2:cpo2.value}];
	contador_pon(base_cont , dato, 0);

	var form = "cdc2";
	var dato = [{form:form,nume:nume,nom:nom.value,prv2:prv2.value,nom3:nom3.value,car2:car2.value,dir2:cmp4,pob3:pob3.value,cpo3:cpo3.value,prv3:prv3.value,tel2:tel2.value,fax2:fax2.value,ema2:ema2.value,nom4:cmp6,nom5:cmp7,desc:cmp5,volu:volu.value,acti:acti,tice:tice,nom6:cmp8,tili:tili,tive:tive,tiam:tiam,ambi:ambi.value,time:time,medi:medi.value,peri:peri.value,mate:mate.value,ctot:cmp11,feca:cmp9,acep:acep.value}];
	contador_pon(base_cont , dato, 0);

	nom.value=""; dni.value=""; cal.value=""; rep.value=""; cif.value=""; dom.value=""; pob.value="";
	cpo.value=""; prv.value=""; caa.value=""; tel.value=""; fax.value=""; ema.value=""; web.value=""; 

	nom1.value=""; carg.value=""; dire.value=""; pob1.value=""; cpo1.value=""; prv1.value="";
	tel1.value=""; fax1.value=""; ema1.value="";

	nom2.value=""; cif2.value=""; dom2.value=""; pob2.value=""; cpo2.value=""; prv2.value="";

	nom3.value=""; car2.value=""; dir2.value=""; pob3.value=""; cpo3.value=""; prv3.value="";
	tel2.value=""; fax2.value=""; ema2.value="";

	nom4.value=""; nom5.value=""; desc.value=""; volu.value=""; 
	nom6.value=""; 

	ambi.value=""; medi.value=""; peri.value=""; mate.value="";
	ctot.value=""; feca.value="";

	acep.checked= false;

	if(tice==2 || tice==3){
		alert("Su solicitud se ha enviado correctamente, Introduzca a continuación los datos de las instalaciones integradas en su certificado multisite");
		navega_navega("varpag.webM7");
		document.getElementById("repre").value = empr;
	}else{
		//alert("PEFC España le confirma la correcta recepción de su Solicitud de Licencia de Uso de la Marca PEFC vinculado a la posesión de un certificado de Cadena de Custodia. Le rogamos comunique a su Entidad Certificadora que ya han efectuado el envío de esta Solicitud de Licencia de Uso de la Marca.")
       		showDialog('PEFC España - Registro','PEFC España le confirma la correcta recepción de su Solicitud de Licencia de Uso de la Marca PEFC vinculado a la posesión de un certificado de Cadena de Custodia. Le rogamos comunique a su Entidad Certificadora que ya han efectuado el envío de esta Solicitud de Licencia de Uso de la Marca.','success')
	}
}
function ingra_manda_insCDC ()
{
	var nom = document.getElementById('nombre');  	if (!nom.value.length){ alert("El campo NOMBRE es obligatorio"); return;}
	var dir = document.getElementById('dir'); 	if (!dir.value.length){ alert("El campo DIRECCIÓN es obligatorio"); return;}
	var loc = document.getElementById('localidad'); if (!loc.value.length){ alert("El campo LOCALIDAD es obligatorio"); return;}
	var cpo = document.getElementById('cp'); 		if (!cpo.value.length){ alert("El campo CP es obligatorio"); return;}
	var pro = document.getElementById('prv'); 	if (!pro.value.length){ alert("El campo PROVINCIA es obligatorio"); return;}
	var caa = document.getElementById('ccaa'); 	if (!caa.value.length){ alert("El campo COMUNIDAD AUTÓNOMA es obligatorio"); return;}
	var act = document.getElementById('act');
	var rep =  document.getElementById('repre');

    	var cmp0 = caracterNvalidos(dir.value);

	var form = "icdc";
	var dato = [{form:form,rep:rep.value,nom:nom.value,dir:cmp0,loc:loc.value,cpo:cpo.value,pro:pro.value,caa:caa.value,act:act.value}];
	contador_pon(base_cont , dato, 0);

	nom.value = ""; dir.value = ""; loc.value = ""; cpo.value = ""; pro.value = "";
	caa.value = ""; act.value = ""; 
}

function ingra_manda_solGFS () 
{
	
 	var nom = document.getElementById('nombre');  if (!nom.value.length){ alert("El campo NOMBRE de la ENTIDAD CERTIFICADORA es obligatorio"); return;}
 	var dni = document.getElementById('dni');     if (!dni.value.length){ alert("El campo DNI de la ENTIDAD CERTIFICADORA es obligatorio"); return;}
 	var cal = document.getElementById('calidad');
	var rep = document.getElementById('representa');
	var cif = document.getElementById('cif');
	var dom = document.getElementById('domsoc');
	var pob = document.getElementById('pobla');
	var cpo = document.getElementById('cp');
	var prv = document.getElementById('provi');
	var caa = document.getElementById('ccaa');
	var tel = document.getElementById('telefono');
	var fax = document.getElementById('fax');
	var ema = document.getElementById('email');
	var web = document.getElementById('pweb');

	
	var nom1 = document.getElementById('nombre1');	 var carg = document.getElementById('cargo');
	var dire = document.getElementById('direc');	 var pob1 = document.getElementById('pobla1');
	var cpo1 = document.getElementById('cp1');	 var prv1 = document.getElementById('provi1');
	var tel1 = document.getElementById('telefono1'); var fax1 = document.getElementById('fax1');
	var ema1 = document.getElementById('email1');

	
	var nom2 = document.getElementById('nombre2');	var cif2 = document.getElementById('cif2');
	var dom2 = document.getElementById('domsoc2');	var pob2 = document.getElementById('pobla2');
	var cpo2 = document.getElementById('cp2');	var prv2 = document.getElementById('provi2');

	
	var nom3 = document.getElementById('nombre3');	 var car2 = document.getElementById('cargo2');
	var dir2 = document.getElementById('direc2');	 var pob3 = document.getElementById('pobla3');
	var cpo3 = document.getElementById('cp3');	 var prv3 = document.getElementById('provi3');
	var tel2 = document.getElementById('telefono2'); var fax2 = document.getElementById('fax2');
	var ema2 = document.getElementById('email2');

	
	var supt = document.getElementById('suptot');	 var nomc = document.getElementById('nomcer');  
	var tiso = valorRadio(document.solGFS.tipsol);   var noso = document.getElementById('nomsol');
	var tire = valorRadio(document.solGFS.tirepr);	 var numa = document.getElementById('numads');
	var feca = document.getElementById('fecacti');	

	
	var acep = document.getElementById('acepto');
	if (!acep.checked){ alert("Para continuar el proceso de envío, tiene que marcar la opción de aceptación de la solicitud"); return;}

    var cmp1 = caracterNvalidos(dom.value);
    var cmp2 = caracterNvalidos(dire.value);
    var cmp3 = caracterNvalidos(dom2.value);
    var cmp4 = caracterNvalidos(dir2.value);
    var cmp5 = caracterNvalidos(feca.value);

    var form = "gfs";
	var dato = [{form:form,nom:nom.value,dni:dni.value,cal:cal.value,rep:rep.value,cif:cif.value,dom:cmp1,pob:pob.value,cpo:cpo.value,prv:prv.value,caa:caa.value,tel:tel.value,fax:fax.value,ema:ema.value,web:web.value,nom1:nom1.value,carg:carg.value,dire:cmp2,pob1:pob1.value,cpo1:cpo1.value,prv1:prv1.value,tel1:tel1.value,fax1:fax1.value,ema1:ema1.value,nom2:nom2.value,cif2:cif2.value,dom2:cmp3,pob2:pob2.value,cpo2:cpo2.value,prv2:prv2.value,nom3:nom3.value,car2:car2.value,dir2:cmp4,pob3:pob3.value,cpo3:cpo3.value,prv3:prv3.value,tel2:tel2.value,fax2:fax2.value,ema2:ema2.value,supt:supt.value,nomc:nomc.value,tiso:tiso,noso:noso.value,tire:tire,numa:numa.value,feca:cmp5,acep:acep.value}];
	contador_pon(base_cont , dato, 0);

	nom.value=""; dni.value=""; cal.value=""; rep.value=""; cif.value=""; dom.value=""; pob.value="";
	cpo.value=""; prv.value=""; caa.value=""; tel.value=""; fax.value=""; ema.value=""; web.value=""; 

	nom1.value=""; carg.value=""; dire.value=""; pob1.value=""; cpo1.value=""; prv1.value="";
	tel1.value=""; fax1.value=""; ema1.value="";

	nom2.value=""; cif2.value=""; dom2.value=""; pob2.value=""; cpo2.value=""; prv2.value="";

	nom3.value=""; car2.value=""; dir2.value=""; pob3.value=""; cpo3.value=""; prv3.value="";
	tel2.value=""; fax2.value=""; ema2.value="";

	supt.value=""; nomc.value=""; noso.value=""; numa.value=""; feca.value="";

	acep.checked= false;

	//alert("PEFC España le confirma la correcta recepción de su Solicitud de Licencia de Uso de la Marca PEFC vinculado a la posesión de un certificado de Gestión Forestal Sostenible. Le rogamos comunique a su Entidad Certificadora que ya han efectuado el envío de esta Solicitud de Licencia de Uso de la Marca.")
       	showDialog('PEFC España - Registro','PEFC España le confirma la correcta recepción de su Solicitud de Licencia de Uso de la Marca PEFC vinculado a la posesión de un certificado de Gestión Forestal Sostenible. Le rogamos comunique a su Entidad Certificadora que ya han efectuado el envío de esta Solicitud de Licencia de Uso de la Marca.','success')

}

function valorRadio(radio){ 
	var i;
   	for (i=0;i<radio.length;i++){ 
      	  if (radio[i].checked){ return radio[i].value}
   	} 
   	return 0;
}
function pista_ayuda_solicitud (e, txt, top, dy)
{
	if(txt==1)
	{
		texto = "<h4>(Anexo Punto 1)</h4>El inicio del proceso implica por parte de la entidad solicitante, ponerse en contacto con una entidad certificadora acreditada"
	}else if(txt==2){
		texto = "<h4>(Anexo Punto 2)</h4>Este campo sólo debe ser rellenado por aquellas empresas que soliciten un certificado multisite"
	}else if(txt==3){
		texto = "<h4>(Anexo Punto 3) Métodos de verificación de la cadena de custodia</h4>"+
			"<h4>1 - Separación física</h4>"+
			"La organización que aplique el método de separación física debera garantizar que la materia prima certificada esté separada o sea claramente<br />"+
			"identificable en todas las etapas del proceso de fabricación o comercialización. La  organización,  cuya  materia prima certificada no esté<br />"+
			"mezclada con otra materia prima y/ó cuando la materia prima certificada pueda ser identificada durante todo el proceso,  debería  utilizar<br />"+
			"preferentemente la opción de la separación física.<br /><br />"+
			"<h4>2 - Método Porcentual</h4>"+
			"Se aplica a las organizaciones en que la materia prima certificada está mezclada dentro de sus procesos de fabricación y comercialización<br />"+
			"con otro tipo de materia prima de manera que no se pueda identificar claramente la materia prima certificada en los productos finales.<br />"+
			"<br />A) Porcentaje Medio:<br />"+
			"Método en el que la entidad solicitante utiliza el porcentaje de certificación obtenido, para todos los productos cubiertos por el lote para<br />"+
			"el cual se ha realizado el cálculo<br />"+
			"<br />B) Concentración de volumen:<br />"+
			"Método en el que la entidad solicitante traslada el porcentaje de certificación obtenido, a una cantidad de producto de forma que incluya un <br />"+
			"porcentaje prefijado de materia prima certificada.<br />"+
			"<br />El Logotipo PEFC puede utilizarse sobre el producto si, a través de la cadena de custodia, se verifica que el contenido de la materia <br />"+
			"prima certificada por PEFC y la materia prima PEFC reciclada, que contiene ese producto supera el umbral mínimo del 70% <br />"
	}else if(txt==4){
		texto = "<h4>(Anexo Punto 4)</h4>"+
			"La unidad de medida de las cantidades y los porcentajes será establecida por la entidad solicitante. PEFC España propone como <br />"+
			"alternativas peso seco o volumen. Se puede justificar el uso de una medida diferente en base a necesidades de la producción o <br />"+
			"del cliente, que se podrá usar una vez se encuentre bien definida."
	}else if(txt==5){
		texto = "<h4>(Anexo Punto 5)</h4>"+
			"Lote de producción: Concepto asociado a un solo producto o productos derivados de una materia prima idéntica o similar, según, <br />"+
			"por ejemplo, especie, clase, etc. El periodo máximo para la definición del lote de producción es de tres meses.<br />"
	}else if(txt==6){
		texto = "<h4>ANEXO A LA SOLICITUD DE USO DE LA MARCA PEFC PARA CADENA DE CUSTODIA DE LOS PRODUCTOS FORESTALES</h4>"+
			"PEFC España, como licenciatario de la marca comunitaria 'PEFC' puede otorgar el derecho de Licencia de Uso de esta marca vinculado <br />"+
			"a la posesión de un certificado de cadena de custodia de los productos forestales.<br /><br />"+
			"Esta marca proporciona información sobre la procedencia de la materia prima de origen forestal utilizada en los productos y promueve la<br />"+
			"Gestión Forestal Sostenible.<br /><br />"+
			"Este Anexo amplia la información de la presente solicitud para facilitar su cumplimiento <br />"
	}

	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= "border: 1px solid #4e4e43; margin: 20px 0px 0px 0px; background-color: #ffffe1; font-size: 7pt; padding: 8px; position:absolute; right:0px; z-index:1000; top:"+top+"px;"; 
	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 validaTecla(elEvento, permitidos) {
   var numeros = "0123456789,%";
   var caracteres = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.´:-@()?=¡!¿";
   var numeros_caracteres = numeros + caracteres;
   var teclas_especiales = [34, 36, 47, 91, 92, 93, 123, 125];
   
   switch(permitidos) {
      case "num":
         permitidos = numeros;
         break;
      case "car":
         permitidos = caracteres;
         break;
      case "num_car":
         permitidos = numeros_caracteres;
         break;
   }
   
   var evento = elEvento || window.event;
   var codigoCaracter = evento.charCode || evento.keyCode;
   var caracter = String.fromCharCode(codigoCaracter);
   
   var tecla_especial = true;
   for(var i in teclas_especiales) {
      if(codigoCaracter == teclas_especiales[i]) {
         tecla_especial = false;
         break;
      }
   }

   if(permitidos.indexOf(caracter) != -1 && tecla_especial) return true;
   else return false;
}

function caracterNvalidos(cmp)
{
    return cmp.replace(/:|[@/\\*=_%#()!¡?¿]/gi," ");
}

var muestra_actual=0;
function ingra_muestra_inicia()
{
	var oo= document.getElementById ("ingra_muestra"); if (!oo) return;
	

	
	idom_createElement(oo, "p", 0, "Área privada");

	idom_input (oo, "", ingra_muestra_procesa ,"", 0, "ima/var/candado.png", "Introduzca clave de acceso a información para usuarios registrados")
	
}
function ingra_muestra_procesa (oi) 
{
	var texto= oi.value.ttrim(); if (!texto) return;
	var al= azohc_ajax_envia ("var/muestra.gif").split("\r\n");
	muestra_actual=0;
	for (var i=0; i<al.length; i++) {
		var bl= al[i].split("\t"); if (bl.length != 2) continue;
		if (texto == bl[1]) { muestra_actual=parseInt(texto); break; }
	}
	if (muestra_actual) {
		var oo= document.getElementById ("ingra_muestra"); if (!oo) return;
		oo.innerHTML= "<p>REGISTRADO</p>";
		indice_actualiza (json.tab+"."+json.cod); 
		navega_actualiza (json.tab+"."+json.cod) 
		
	}
	else {
		oi.value="";
	}
}

function ingra_raiz_inicia (json, param) 
{
	if (!json.arc) ingra_carpeta_inicia (json, param); 		
	else		   ingra_texto_inicia (json, param); 
}


var mapa_correo_destino= "pefc@pefc.es"; 
var mapa_correo_asunto= "Contactar con PEFC en Madrid"; 






var indice_maximo=  		0; 

var ingra_ima_prefijo= 	0;	
var ingra_ima_conborde=	0;	




function indice_url_inicio () { ingra_manda_visita ("principal"); return "esppai.0"; } 
function indice_concodigo (tab) {
	var tabla= ingra_tablas[tab]; if (tabla) return tabla.pad == "esp" && tab != "esppai" || tabla.cod.substr(0,3)=="cer" && tab != "cergfsA"; 
	return 0; 
}
function indice_monta_linea (cod, res, pag, niv, clase) 
{
	var a= res; if (indice_maximo && a.length > indice_maximo+2) { var b= a.substr(0,indice_maximo)+"..."; a= "<acronym title='"+a+"'>"+b+"</acronym>"; }
	if (!muestra_actual && res.indexOf("®")>=0) {
		return "<li><p class='indice"+niv+" "+clase+"'>"+a+"</p></li>";
	}
	var href= "javascript:"+(pag? "indice_navega": "indice_actualiza")+"(\""+cod+"\")";
	return "<li><a href='"+href+"' class='indice"+niv+" "+clase+"' "+util_status(res)+">"+a+"</a></li>";
}


var ingra_tablas= {
	car:{ cod:'car', res:'Carpeta', ide:1000, plu:'Carpetas', _uni:'', campos:{}},
	sql:{ cod:'sql', res:'Búsqueda SQL', ide:1001, pad:'car', plu:'Búsquedas SQL', _uni:'', campos:{}},
	xjs:{ cod:'xjs', res:'Búsqueda JavaScript', ide:1002, pad:'car', plu:'Búsquedas JS', _uni:'', campos:{}},
	pre:{ cod:'pre', res:'Presupuesto', ide:1004, pad:'car', plu:'', _uni:'', campos:{}},
	prec:{ cod:'prec', res:'Capítulo presupuesto', ide:1005, pad:'car', plu:'', _uni:'', campos:{}},
	varpag:{ cod:'varpag', res:'Página externa web', ide:2001, pad:'var', plu:'', _uni:'', campos:{}},
	varsec:{ cod:'varsec', res:'Sección', ide:2005, pad:'var', plu:'', _uni:'', campos:{}},
	varins:{ cod:'varins', res:'Inscripción web', ide:2006, pad:'var', plu:'', _uni:'', campos:{
		fecrec:{ res:'Fecha de incorporación', uni:'', tip:1000, t:'F' },
		_0:{ res:'Datos personales', uni:'', tip:0, t:'' },
		nom:{ res:'Nombre', uni:'', tip:12, t:'T' },
		ape:{ res:'Apellidos', uni:'', tip:12, t:'T' },
		nif:{ res:'NIF', uni:'', tip:12, t:'T' },
		loc:{ res:'Localidad', uni:'', tip:12, t:'T' },
		cpres:{ res:'CP Residencia', uni:'', tip:12, t:'T' },
		tel:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		ema:{ res:'E-mail', uni:'', tip:12, t:'T' },
		seltra:{ res:'Trabajador o directivo de PYME', uni:'', tip:1006, t:'b' },
		selaut:{ res:'Autónomo', uni:'', tip:1006, t:'b' },
		_1:{ res:'Datos Empresa', uni:'', tip:0, t:'' },
		nome:{ res:'Nombre', uni:'', tip:12, t:'T' },
		dire:{ res:'Dirección', uni:'', tip:12, t:'T' },
		cpoloc:{ res:'Código postal y localidad', uni:'', tip:12, t:'T' },
		prve:{ res:'Provincia', uni:'', tip:12, t:'T' },
		cif:{ res:'CIF', uni:'', tip:12, t:'T' },
		tele:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax:{ res:'FAX', uni:'', tip:12, t:'T' }}},
	varvis:{ cod:'varvis', res:'Inscripción web', ide:2007, pad:'var', plu:'', _uni:'', campos:{}},
	varcdc:{ cod:'varcdc', res:'Solicitud. Cadena de Custodia (CDC)', ide:2008, pad:'var', plu:'', _uni:'', campos:{
		cdci:{ res:'Certificado CDC asociado', uni:'', tip:4, t:'>' },
		__1:{ res:'DATOS GENERALES DE LA ENTIDAD CERTIFICADA SOLICITANTE DE LA MARCA', uni:'', tip:0, t:'' },
		don:{ res:'Persona', uni:'', tip:12, t:'T' },
		dni:{ res:'Dni', uni:'', tip:12, t:'T' },
		cal:{ res:'En calidad', uni:'', tip:12, t:'T' },
		rep:{ res:'En representación de la entidad solicitante', uni:'', tip:12, t:'T' },
		cif:{ res:'Cif', uni:'', tip:12, t:'T' },
		dom:{ res:'Domicilio social', uni:'', tip:12, t:'T' },
		pob:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo:{ res:'CP', uni:'', tip:12, t:'T' },
		prv:{ res:'Provincia', uni:'', tip:12, t:'T' },
		caa:{ res:'Comunidad autónoma', uni:'', tip:12, t:'T' },
		tel:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema:{ res:'E-mail', uni:'', tip:12, t:'T' },
		web:{ res:'Página web', uni:'', tip:12, t:'T' },
		_1:{ res:'Persona de contacto para la comunicación y envío de correspondencia con PEFC', uni:'', tip:0, t:'' },
		nom1:{ res:'Nombre', uni:'', tip:12, t:'T' },
		carg:{ res:'Cargo', uni:'', tip:12, t:'T' },
		dire:{ res:'Dirección', uni:'', tip:12, t:'T' },
		pob1:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo1:{ res:'CP', uni:'', tip:12, t:'T' },
		prv1:{ res:'Provincia', uni:'', tip:12, t:'T' },
		tel1:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax1:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema1:{ res:'E-mail', uni:'', tip:12, t:'T' },
		__2:{ res:'DATOS PARA LA FACTURACIÓN', uni:'', tip:0, t:'' },
		nom2:{ res:'Entidad', uni:'', tip:12, t:'T' },
		cif2:{ res:'Cif', uni:'', tip:12, t:'T' },
		dom2:{ res:'Domicilio social', uni:'', tip:12, t:'T' },
		pob2:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo2:{ res:'CP', uni:'', tip:12, t:'T' },
		prv2:{ res:'Provincia', uni:'', tip:12, t:'T' },
		_2:{ res:'Persona de contacto para la facturación', uni:'', tip:0, t:'' },
		nom3:{ res:'Nombre', uni:'', tip:12, t:'T' },
		car2:{ res:'Cargo', uni:'', tip:12, t:'T' },
		dir2:{ res:'Dirección envío de la factura', uni:'', tip:12, t:'T' },
		pob3:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo3:{ res:'CP', uni:'', tip:12, t:'T' },
		prv3:{ res:'Provincia', uni:'', tip:12, t:'T' },
		tel2:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax2:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema2:{ res:'E-mail', uni:'', tip:12, t:'T' },
		__3:{ res:'DATOS GENERALES DE LA SOLICITUD', uni:'', tip:0, t:'' },
		nom4:{ res:'Nombre de la entidad certificadora', uni:'', tip:12, t:'T' },
		nom5:{ res:'Número de las instalaciones a certificar', uni:'', tip:12, t:'T' },
		descr:{ res:'Descripción breve de la actividad principal de la entidad solicitante', uni:'', tip:12, t:'T' },
		volu:{ res:'Volumen de negocio', uni:'', tip:12, t:'T' },
		acti:{ res:'Actividad principal', uni:'', tip:4, t:'L' },
		_3:{ res:'Tipología de la certificación', uni:'', tip:0, t:'' },
		tice:{ res:'Tipología', uni:'', tip:4, t:'L' },
		nom6:{ res:'En el caso de ser agrupada participante, indicar entidad o nº de CdC agrupada', uni:'', tip:12, t:'T' },
		_4:{ res:'Tipologia de licencia de marca PEFC', uni:'', tip:0, t:'' },
		tili:{ res:'Tipología', uni:'', tip:4, t:'L' },
		_5:{ res:'Planteamiento elegido para la verificación de la cadena de custodia', uni:'', tip:0, t:'' },
		tive:{ res:'Tipo', uni:'', tip:4, t:'L' },
		__4:{ res:'DATOS CON CARÁCTER ESTADÍSTICO', uni:'', tip:0, t:'' },
		_6:{ res:'Ámbito de la aplicación de la certificación', uni:'', tip:0, t:'' },
		tiam:{ res:'Ámbito', uni:'', tip:4, t:'L' },
		ambi:{ res:'En caso de productos determinados, definir cuales', uni:'', tip:12, t:'T' },
		_7:{ res:'Unidad de medición de la producción', uni:'', tip:0, t:'' },
		time:{ res:'Tipo', uni:'', tip:4, t:'L' },
		medi:{ res:'Otras, indicar cuales', uni:'', tip:12, t:'T' },
		_8:{ res:'Otros datos', uni:'', tip:0, t:'' },
		peri:{ res:'Periodo de lote - máximo 3 meses', uni:'', tip:12, t:'T' },
		mate:{ res:'Porcentaje estimado de materia prima', uni:'', tip:12, t:'T' },
		ctot:{ res:'Cantidad total de producción anual certificada', uni:'', tip:12, t:'T' },
		feca:{ res:'Fechas de la certificación, otras circunstancias', uni:'', tip:12, t:'T' }}},
	vargfs:{ cod:'vargfs', res:'Solicitud. Gestión forestal sostenible (GFS)', ide:2009, pad:'var', plu:'', _uni:'', campos:{
		gfsi:{ res:'Certificado GFS asociado', uni:'', tip:4, t:'>' },
		__1:{ res:'DATOS GENERALES DE LA ENTIDAD CERTIFICADA SOLICITANTE DE LA MARCA', uni:'', tip:0, t:'' },
		don:{ res:'Persona', uni:'', tip:12, t:'T' },
		dni:{ res:'Dni', uni:'', tip:12, t:'T' },
		cal:{ res:'En calidad', uni:'', tip:12, t:'T' },
		rep:{ res:'En representación de la entidad solicitante', uni:'', tip:12, t:'T' },
		cif:{ res:'Cif', uni:'', tip:12, t:'T' },
		dom:{ res:'Domicilio social', uni:'', tip:12, t:'T' },
		pob:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo:{ res:'CP', uni:'', tip:12, t:'T' },
		prv:{ res:'Provincia', uni:'', tip:12, t:'T' },
		caa:{ res:'Comunidad autónoma', uni:'', tip:12, t:'T' },
		tel:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema:{ res:'E-mail', uni:'', tip:12, t:'T' },
		web:{ res:'Página web', uni:'', tip:12, t:'T' },
		_1:{ res:'Persona de contacto para la comunicación y envío de correspondencia con PEFC', uni:'', tip:0, t:'' },
		nom1:{ res:'Nombre', uni:'', tip:12, t:'T' },
		carg:{ res:'Cargo', uni:'', tip:12, t:'T' },
		dire:{ res:'Dirección', uni:'', tip:12, t:'T' },
		pob1:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo1:{ res:'CP', uni:'', tip:12, t:'T' },
		prv1:{ res:'Provincia', uni:'', tip:12, t:'T' },
		tel1:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax1:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema1:{ res:'E-mail', uni:'', tip:12, t:'T' },
		__2:{ res:'DATOS PARA LA FACTURACIÓN', uni:'', tip:0, t:'' },
		nom2:{ res:'Entidad', uni:'', tip:12, t:'T' },
		cif2:{ res:'Cif', uni:'', tip:12, t:'T' },
		dom2:{ res:'Domicilio social', uni:'', tip:12, t:'T' },
		pob2:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo2:{ res:'CP', uni:'', tip:12, t:'T' },
		prv2:{ res:'Provincia', uni:'', tip:12, t:'T' },
		_2:{ res:'Persona de contacto para la facturación', uni:'', tip:0, t:'' },
		nom3:{ res:'Nombre', uni:'', tip:12, t:'T' },
		car2:{ res:'Cargo', uni:'', tip:12, t:'T' },
		dir2:{ res:'Dirección envío de la factura', uni:'', tip:12, t:'T' },
		pob3:{ res:'Población', uni:'', tip:12, t:'T' },
		cpo3:{ res:'CP', uni:'', tip:12, t:'T' },
		prv3:{ res:'Provincia', uni:'', tip:12, t:'T' },
		tel2:{ res:'Teléfono', uni:'', tip:12, t:'T' },
		fax2:{ res:'Fax', uni:'', tip:12, t:'T' },
		ema2:{ res:'E-mail', uni:'', tip:12, t:'T' },
		__3:{ res:'DATOS GENERALES DE LA SOLICITUD', uni:'', tip:0, t:'' },
		supt:{ res:'Superficie total a certificar en hectáreas', uni:'', tip:12, t:'T' },
		nomc:{ res:'Nombre de la entidad certificadora', uni:'', tip:12, t:'T' },
		_0:{ res:'DATOS COMPLEMENTARIOS DE LA ENTIDAD', uni:'', tip:0, t:'' },
		_3:{ res:'Tipo de entidad Solicitante', uni:'', tip:0, t:'' },
		tiso:{ res:'Tipo', uni:'', tip:4, t:'L' },
		noso:{ res:'En caso de participante, indicar solicitante o nº certificado', uni:'', tip:12, t:'T' },
		_4:{ res:'Varios', uni:'', tip:0, t:'' },
		tire:{ res:'Tiene acreditada la representación', uni:'', tip:4, t:'L' },
		numa:{ res:'Nº adscritos a la entidad solicitante', uni:'', tip:12, t:'T' },
		feca:{ res:'Fechas de la certificación, otras circunstancias', uni:'', tip:12, t:'T' }}},
	ref:{ cod:'ref', res:'Documento de Certificado', ide:3000, plu:'Referencias', _uni:'', campos:{
		tpo:{ res:'Tipo', uni:'', tip:4, t:'L' },
		idi:{ res:'Idioma', uni:'', tip:4, t:'L' }}},
	inf:{ cod:'inf', res:'Informe o Procedimiento', ide:4000, plu:'Informes', _uni:'', campos:{}},
	ent:{ cod:'ent', res:'Entidad', ide:5000, plu:'Entidades', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' }}},
	entaso:{ cod:'entaso', res:'Asociado', ide:5002, pad:'ent', plu:'Asosaciones', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' }}},
	entcli:{ cod:'entcli', res:'Empresa certificada', ide:5003, pad:'ent', plu:'', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' },
		ok:{ res:'Comprobado catálogo productos', uni:'', tip:1006, t:'b' },
		ubi:{ res:'Ubicación municipio CLA', uni:'', tip:4, t:'>' },
		pyme:{ res:'PYME', uni:'', tip:4, t:'L' },
		actpri:{ res:'Actividad principal', uni:'', tip:4, t:'L' },
		actdesH:{ res:'Descripción ALCANCE', uni:'', tip:4, t:'L' },
		actdes:{ res:'Descripción ALCANCE', uni:'', tip:12, t:'T' },
		_2:{ res:'A eliminar, datos de certificado', uni:'', tip:0, t:'' },
		certpo:{ res:'[Tipo Certificado]', uni:'', tip:4, t:'L' },
		feccer:{ res:'[Fecha certificación]', uni:'', tip:1000, t:'F' },
		cerent:{ res:'[Empresa certificadora]', uni:'', tip:4, t:'L' },
		codcer:{ res:'[Código certificado]', uni:'', tip:12, t:'T' },
		_1:{ res:'A eliminar', uni:'', tip:0, t:'' },
		cerpro:{ res:'[Procedencia]', uni:'', tip:4, t:'L' },
		cif2:{ res:'[CIF con duplicados]', uni:'', tip:12, t:'T' },
		ca:{ res:'CCAA', uni:'', tip:4, t:'L' }}},
	entprv:{ cod:'entprv', res:'Proveedor', ide:5005, pad:'ent', plu:'', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' },
		cod2:{ res:'Código interno para facuras', uni:'', tip:12, t:'T' }}},
	entcer:{ cod:'entcer', res:'Certificadora', ide:5007, pad:'ent', plu:'', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' },
		tpo:{ res:'Tipo', uni:'', tip:4, t:'L' },
		acre:{ res:'Acreditadora', uni:'', tip:4, t:'L' }}},
	entcon:{ cod:'entcon', res:'Consultora', ide:5009, pad:'ent', plu:'', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' },
		tpo:{ res:'Tipo', uni:'', tip:4, t:'L' },
		geo:{ res:'Ámbito geográfico', uni:'', tip:4, t:'L' },
		ano:{ res:'Año inicio consultoría', uni:'', tip:4, t:'E' },
		per:{ res:'Consultores', uni:'', tip:12, t:'T' },
		obs:{ res:'Experiencia', uni:'', tip:12, t:'T' },
		empc:{ res:'Empresas a las que se ha realizado consultoría CDC', uni:'', tip:12, t:'T' },
		empg:{ res:'Empresas a las que se ha realizado consultoría GFS', uni:'', tip:12, t:'T' }}},
	entins:{ cod:'entins', res:'Sub-Cliente', ide:5020, pad:'ent', plu:'', _uni:'', campos:{
		cpo:{ res:'[Código postal, corrección localidades]', uni:'', tip:12, t:'T' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		dirloci:{ res:'Localidad (espacio) TIP', uni:'', tip:4, t:'>' },
		bol:{ res:'Boletín papel', uni:'', tip:1006, t:'b' },
		baj:{ res:'Baja', uni:'', tip:4, t:'L' },
		codcer:{ res:'Código certificado', uni:'', tip:12, t:'T' },
		codlic:{ res:'Código licencia', uni:'', tip:12, t:'T' },
		feccer:{ res:'Fecha certificado', uni:'', tip:1000, t:'F' },
		fecalt:{ res:'Fecha Alta', uni:'', tip:1000, t:'F' },
		fecbaj:{ res:'Fecha Baja', uni:'', tip:1000, t:'F' },
		rel:{ res:'Relación', uni:'', tip:4, t:'L' },
		nota:{ res:'Notas', uni:'', tip:12, t:'T' },
		actpri:{ res:'Sector', uni:'', tip:4, t:'L' },
		actdes:{ res:'Actividad descripción', uni:'', tip:4, t:'L' },
		padi_tmp:{ res:'[EntidadNombre=padi]', uni:'', tip:12, t:'T' },
		ca:{ res:'CCAA', uni:'', tip:4, t:'L' },
		soli:{ res:'Solicitud asociada', uni:'', tip:4, t:'>' }}},
	mdo:{ cod:'mdo', res:'Especialidad', ide:7001, pad:'rec', plu:'Especialidades', _uni:'', campos:{}},
	recfac:{ cod:'recfac', res:'Concepto factura recibida', ide:7010, pad:'rec', plu:'', _uni:'', campos:{
		codant:{ res:'Código antíguo', uni:'', tip:12, t:'T' }}},
	recfacv:{ cod:'recfacv', res:'Concepto factura emitida', ide:7011, pad:'rec', plu:'', _uni:'', campos:{}},
	recpro:{ cod:'recpro', res:'Producto', ide:7015, pad:'rec', plu:'', _uni:'', campos:{
		espcon:{ res:'Conífera', uni:'', tip:1006, t:'b' },
		espftr:{ res:'Frondosa tropical', uni:'', tip:1006, t:'b' },
		espfnt:{ res:'Frondosa no tropical', uni:'', tip:1006, t:'b' }}},
	fac:{ cod:'fac', res:'Factura recibida', ide:9005, pad:'doc', plu:'Facturas', _uni:'', campos:{
		fecvec:{ res:'Fecha de vencimiento', uni:'', tip:1000, t:'F' },
		_2:{ res:'Comunes', uni:'', tip:0, t:'' },
		_3:{ res:'Emitidas', uni:'', tip:0, t:'' },
		texges:{ res:'Comentarios gestoría', uni:'', tip:12, t:'T' },
		entnom:{ res:'[Nombre cliente]', uni:'', tip:4, t:'L' },
		_1:{ res:'Recibidas', uni:'', tip:0, t:'' },
		_4:{ res:'Contratos', uni:'', tip:0, t:'' }}},
	facv:{ cod:'facv', res:'Factura emitida', ide:9015, pad:'doc', plu:'Facturas de venta', _uni:'', campos:{
		fecvec:{ res:'Fecha de vencimiento', uni:'', tip:1000, t:'F' },
		_2:{ res:'Comunes', uni:'', tip:0, t:'' },
		_3:{ res:'Emitidas', uni:'', tip:0, t:'' },
		texges:{ res:'Comentarios gestoría', uni:'', tip:12, t:'T' },
		entnom:{ res:'[Nombre cliente]', uni:'', tip:4, t:'L' },
		_1:{ res:'Recibidas', uni:'', tip:0, t:'' },
		_4:{ res:'Contratos', uni:'', tip:0, t:'' }}},
	margeo:{ cod:'margeo', res:'Geográfico', ide:10002, pad:'mar', plu:'', _uni:'', campos:{}},
	marven:{ cod:'marven', res:'Ventanas', ide:10003, pad:'mar', plu:'Ventanas', _uni:'', campos:{}},
	peraso:{ cod:'peraso', res:'De asociado', ide:20001, pad:'per', plu:'Personas de asociación', _uni:'', campos:{
		_2:{ res:'Tipo', uni:'', tip:0, t:'' },
		tpo:{ res:'[Tipo]', uni:'', tip:4, t:'L' },
		tpoR:{ res:'Responsable', uni:'', tip:1006, t:'b' },
		tpoF:{ res:'Facturación', uni:'', tip:1006, t:'b' },
		tpoC:{ res:'Contacto', uni:'', tip:1006, t:'b' },
		_1:{ res:'Otros datos', uni:'', tip:0, t:'' },
		car:{ res:'Cargo', uni:'', tip:4, t:'L' },
		sex:{ res:'Sexo', uni:'', tip:4, t:'L' },
		pro:{ res:'Procedencia', uni:'', tip:4, t:'L' },
		procnt:{ res:'Procedencia contacto', uni:'', tip:4, t:'L' },
		fax:{ res:'[Fax -> empresa]', uni:'', tip:12, t:'T' },
		sec:{ res:'[Sector empresa -> empresa]', uni:'', tip:4, t:'L' },
		codcer:{ res:'[Código empresa]', uni:'', tip:12, t:'T' },
		ent_tmp:{ res:'[Empresa textual]', uni:'', tip:12, t:'T' },
		bol:{ res:'Boletín sobre', uni:'', tip:1006, t:'b' },
		bolp:{ res:'Boletín paquete', uni:'', tip:1006, t:'b' },
		nbolp:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		bolm:{ res:'Memoria de actividades', uni:'', tip:1006, t:'b' },
		nbolm:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' }}},
	percli:{ cod:'percli', res:'De cliente', ide:20003, pad:'per', plu:'', _uni:'', campos:{
		_2:{ res:'Tipo', uni:'', tip:0, t:'' },
		tpo:{ res:'[Tipo]', uni:'', tip:4, t:'L' },
		tpoR:{ res:'Responsable', uni:'', tip:1006, t:'b' },
		tpoF:{ res:'Facturación', uni:'', tip:1006, t:'b' },
		tpoC:{ res:'Contacto', uni:'', tip:1006, t:'b' },
		_1:{ res:'Otros datos', uni:'', tip:0, t:'' },
		car:{ res:'Cargo', uni:'', tip:4, t:'L' },
		sex:{ res:'Sexo', uni:'', tip:4, t:'L' },
		pro:{ res:'Procedencia', uni:'', tip:4, t:'L' },
		procnt:{ res:'Procedencia contacto', uni:'', tip:4, t:'L' },
		fax:{ res:'[Fax -> empresa]', uni:'', tip:12, t:'T' },
		sec:{ res:'[Sector empresa -> empresa]', uni:'', tip:4, t:'L' },
		codcer:{ res:'[Código empresa]', uni:'', tip:12, t:'T' },
		ent_tmp:{ res:'[Empresa textual]', uni:'', tip:12, t:'T' },
		bol:{ res:'Boletín sobre', uni:'', tip:1006, t:'b' },
		bolp:{ res:'Boletín paquete', uni:'', tip:1006, t:'b' },
		nbolp:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		bolm:{ res:'Memoria de actividades', uni:'', tip:1006, t:'b' },
		nbolm:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' }}},
	percnt:{ cod:'percnt', res:'Contacto', ide:20005, pad:'per', plu:'', _uni:'', campos:{
		_2:{ res:'Tipo', uni:'', tip:0, t:'' },
		tpo:{ res:'[Tipo]', uni:'', tip:4, t:'L' },
		tpoR:{ res:'Responsable', uni:'', tip:1006, t:'b' },
		tpoF:{ res:'Facturación', uni:'', tip:1006, t:'b' },
		tpoC:{ res:'Contacto', uni:'', tip:1006, t:'b' },
		_1:{ res:'Otros datos', uni:'', tip:0, t:'' },
		car:{ res:'Cargo', uni:'', tip:4, t:'L' },
		sex:{ res:'Sexo', uni:'', tip:4, t:'L' },
		pro:{ res:'Procedencia', uni:'', tip:4, t:'L' },
		procnt:{ res:'Procedencia contacto', uni:'', tip:4, t:'L' },
		fax:{ res:'[Fax -> empresa]', uni:'', tip:12, t:'T' },
		sec:{ res:'[Sector empresa -> empresa]', uni:'', tip:4, t:'L' },
		codcer:{ res:'[Código empresa]', uni:'', tip:12, t:'T' },
		ent_tmp:{ res:'[Empresa textual]', uni:'', tip:12, t:'T' },
		bol:{ res:'Boletín sobre', uni:'', tip:1006, t:'b' },
		bolp:{ res:'Boletín paquete', uni:'', tip:1006, t:'b' },
		nbolp:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		bolm:{ res:'Memoria de actividades', uni:'', tip:1006, t:'b' },
		nbolm:{ res:'Nº Ejemplares', uni:'', tip:4, t:'E' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' }}},
	map:{ cod:'map', res:'Mapa', ide:30000, plu:'Mapas', _uni:'', campos:{}},
	esp:{ cod:'esp', res:'Espacio', ide:31000, plu:'Espacios', _uni:'', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' }}},
	esppai:{ cod:'esppai', res:'País', ide:31001, pad:'esp', plu:'Países', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		mfe:{ res:'MFE Estratos', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos Certificado', uni:'m2', tip:12, t:'T' },
		mfa:{ res:'MFE Especies arbóreas', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mup:{ res:'MUP Montes de Utilidad Pública', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enp:{ res:'ENP Espacios Naturales Protegidos', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		nat:{ res:'Red Natura 2000. LIC y ZEPA', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	espcom:{ cod:'espcom', res:'Comunidad', ide:31002, pad:'esp', plu:'Comunidades', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		NUT:{ res:'Código NUTS', uni:'', tip:4, t:'E' },
		mfe:{ res:'MFE Estratos', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos Certificado', uni:'m2', tip:12, t:'T' },
		mfa:{ res:'MFE Especies arbóreas', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mup:{ res:'MUP Montes de Utilidad Pública', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enp:{ res:'ENP Espacios Naturales Protegidos', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		nat:{ res:'Red Natura 2000. LIC y ZEPA', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	esppro:{ cod:'esppro', res:'Provincia', ide:31003, pad:'esp', plu:'Provincias', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		NUT:{ res:'Código NUTS', uni:'', tip:4, t:'E' },
		mfe:{ res:'MFE Estratos', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos Certificado', uni:'m2', tip:12, t:'T' },
		mfa:{ res:'MFE Especies arbóreas', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mup:{ res:'MUP Montes de Utilidad Pública', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enp:{ res:'ENP Espacios Naturales Protegidos', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		nat:{ res:'Red Natura 2000. LIC y ZEPA', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	espreg:{ cod:'espreg', res:'Comarca', ide:31004, pad:'esp', plu:'Comarcas', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		mfe:{ res:'MFE Estratos', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos Certificado', uni:'m2', tip:12, t:'T' },
		mfa:{ res:'MFE Especies arbóreas', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mup:{ res:'MUP Montes de Utilidad Pública', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enp:{ res:'ENP Espacios Naturales Protegidos', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		nat:{ res:'Red Natura 2000. LIC y ZEPA', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	espmun:{ cod:'espmun', res:'Municipio', ide:31005, pad:'esp', plu:'Municipios', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		mfe:{ res:'MFE Estratos', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos en certificados', uni:'m2', tip:12, t:'T' },
		mfa:{ res:'MFE Especies arbóreas', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mup:{ res:'MUP Montes de Utilidad Pública', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enp:{ res:'ENP Espacios Naturales Protegidos', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		nat:{ res:'Red Natura 2000. LIC y ZEPA', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' },
		_1:{ res:'Incendios', uni:'', tip:0, t:'' },
		inc_con:{ res:'Nº conatos (<1 ha) 1998-2008', uni:'u', tip:4, t:'E' },
		inc_inc:{ res:'Nº incendios 1998-2008', uni:'u', tip:4, t:'E' },
		inc_sup:{ res:'Superficie forestal afectada', uni:'', tip:7, t:'R' }}},
	espare:{ cod:'espare', res:'Área certificada', ide:31006, pad:'esp', plu:'Áreas certificadas', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		mfec:{ res:'MFE Estratos en certificados', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	espnuc:{ cod:'espnuc', res:'Población', ide:31007, pad:'esp', plu:'Núcleos de población', _uni:'m2', campos:{
		cerc:{ res:'Superficie de las áreas certificadas', uni:'m2', tip:1005, t:'C' },
		cerx:{ res:'Centroide x de las áreas certificadas', uni:'m', tip:1005, t:'C' },
		cery:{ res:'Centroide y de las áreas certificadas', uni:'m', tip:1005, t:'C' }}},
	catproA:{ cod:'catproA', res:'Categoría A', ide:32001, pad:'fam', plu:'Categorías A', _uni:'', campos:{}},
	catproB:{ cod:'catproB', res:'Categoría B', ide:32003, pad:'fam', plu:'Categorías B', _uni:'', campos:{}},
	catproC:{ cod:'catproC', res:'Categoría C', ide:32004, pad:'fam', plu:'Categorías C', _uni:'', campos:{}},
	catpro:{ cod:'catpro', res:'Categoría D', ide:32005, pad:'fam', plu:'Categorías D', _uni:'', campos:{}},
	cergfsA:{ cod:'cergfsA', res:'Tipología GFS', ide:32010, pad:'fam', plu:'Tipologías GFS', _uni:'m2', campos:{
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mfec:{ res:'MFE Estratos Certiticado', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	cergfsB:{ cod:'cergfsB', res:'Clasificación GFS', ide:32011, pad:'fam', plu:'Clasificaciones GFS', _uni:'m2', campos:{
		mfec:{ res:'MFE Estratos Certiticado', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' }}},
	cergfs:{ cod:'cergfs', res:'Certificado GFS', ide:32012, pad:'fam', plu:'Certificados GFS', _uni:'m2', campos:{
		_1:{ res:'Estado', uni:'', tip:0, t:'' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		cancer:{ res:'Cantidad certificada', uni:'ha', tip:7, t:'R' },
		cangis:{ res:'Cantidad GIS', uni:'ha', tip:7, t:'R' },
		_3:{ res:'Certificación', uni:'', tip:0, t:'' },
		entcli:{ res:'Empresa cliente', uni:'', tip:4, t:'>' },
		entcer:{ res:'Empresa certificadora', uni:'', tip:4, t:'>' },
		feccer:{ res:'Fecha certificación', uni:'', tip:1000, t:'F' },
		fecrev:{ res:'Fecha datos GIS', uni:'', tip:1000, t:'F' },
		fecfin:{ res:'Fecha fin certificación', uni:'', tip:1000, t:'F' },
		nota:{ res:'Notas', uni:'', tip:12, t:'T' },
		_2:{ res:'A eliminar', uni:'', tip:0, t:'' },
		ord:{ res:'Orden ¿id interno?', uni:'', tip:4, t:'E' },
		_C:{ res:'Calculados', uni:'', tip:0, t:'' },
		mfec:{ res:'MFE Estratos Certiticado', uni:'m2', tip:12, t:'T' },
		mfac:{ res:'MFE Especies arbóreas en certificados', uni:'m2', tip:12, t:'T' },
		mupc:{ res:'MUP Montes de Utilidad Pública en certificados', uni:'m2', tip:12, t:'T' },
		enpc:{ res:'ENP Espacios Naturales Protegidos en certificados', uni:'m2', tip:12, t:'T' },
		natc:{ res:'Red Natura 2000. LIC y ZEPA en certificados', uni:'m2', tip:12, t:'T' },
		_4:{ res:'Solicitud web', uni:'', tip:0, t:'' },
		repr:{ res:'Representación regional ante la JD', uni:'', tip:1006, t:'b' },
		numg:{ res:'Número de gestores', uni:'', tip:12, t:'T' },
		c01:{ res:'Andalucía', uni:'ha', tip:7, t:'R' },
		c02:{ res:'Aragón', uni:'ha', tip:7, t:'R' },
		C03:{ res:'Principado de Asturias', uni:'ha', tip:7, t:'R' },
		c04:{ res:'Islas Baleares', uni:'ha', tip:7, t:'R' },
		c05:{ res:'Canarias', uni:'ha', tip:7, t:'R' },
		c06:{ res:'Cantabria', uni:'ha', tip:7, t:'R' },
		c07:{ res:'Castilla La Mancha', uni:'ha', tip:7, t:'R' },
		c08:{ res:'Castilla y León', uni:'ha', tip:7, t:'R' },
		c09:{ res:'Cataluña', uni:'ha', tip:7, t:'R' },
		c10:{ res:'Extremadura', uni:'ha', tip:7, t:'R' },
		c11:{ res:'Galicia', uni:'ha', tip:7, t:'R' },
		c12:{ res:'Comunidad de Madrid', uni:'ha', tip:7, t:'R' },
		c13:{ res:'Región de Murcia', uni:'ha', tip:7, t:'R' },
		c14:{ res:'Comunidad Foral de Navarra', uni:'ha', tip:7, t:'R' },
		c15:{ res:'Comunidad Valenciana', uni:'ha', tip:7, t:'R' },
		c16:{ res:'País Vasco', uni:'ha', tip:7, t:'R' },
		c17:{ res:'La Rioja', uni:'ha', tip:7, t:'R' },
		c18:{ res:'Ciudad Autónoma de Ceuta', uni:'ha', tip:7, t:'R' },
		c19:{ res:'Ciudad de Melilla', uni:'ha', tip:7, t:'R' },
		cc01:{ res:'S.F.A.  Andalucía', uni:'ha', tip:7, t:'R' },
		CC02:{ res:'S.F.A. Aragón', uni:'ha', tip:7, t:'R' },
		CC03:{ res:'S.F.A. Principado de Asturias', uni:'ha', tip:7, t:'R' },
		CC04:{ res:'S.F.A. Islas Baleares', uni:'ha', tip:7, t:'R' },
		CC05:{ res:'S.F.A. Canarias', uni:'ha', tip:7, t:'R' },
		CC06:{ res:'S.F.A. Cantabria', uni:'ha', tip:7, t:'R' },
		CC07:{ res:'S.F.A. Castilla La Mancha', uni:'ha', tip:7, t:'R' },
		CC08:{ res:'S.F.A. Castilla y León', uni:'ha', tip:7, t:'R' },
		CC09:{ res:'S.F.A. Cataluña', uni:'ha', tip:7, t:'R' },
		CC10:{ res:'S.F.A. Extremadura', uni:'ha', tip:7, t:'R' },
		CC11:{ res:'S.F.A. Galicia', uni:'ha', tip:7, t:'R' },
		CC12:{ res:'S.F.A. Comunidad de Madrid', uni:'ha', tip:7, t:'R' },
		CC13:{ res:'S.F.A. Región de Murcia', uni:'ha', tip:7, t:'R' },
		CC14:{ res:'S.F.A. Comunidad Foral de Navarra', uni:'ha', tip:7, t:'R' },
		CC15:{ res:'S.F.A. Comunidad Valenciana', uni:'ha', tip:7, t:'R' },
		CC16:{ res:'S.F.A. País Vasco', uni:'ha', tip:7, t:'R' },
		CC17:{ res:'S.F.A. La Rioja', uni:'ha', tip:7, t:'R' },
		CC18:{ res:'S.F.A. Ciudad Autónoma de Ceuta', uni:'ha', tip:7, t:'R' },
		CC19:{ res:'S.F.A. Ciudad de Melilla', uni:'ha', tip:7, t:'R' }}},
	cergfsX:{ cod:'cergfsX', res:'Certificado GFS (baja)', ide:32013, pad:'fam', plu:'Certificados GFS (baja)', _uni:'m2', campos:{
		_1:{ res:'Estado', uni:'', tip:0, t:'' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		cancer:{ res:'Cantidad certificada', uni:'ha', tip:7, t:'R' },
		cangis:{ res:'Cantidad GIS', uni:'ha', tip:7, t:'R' },
		_3:{ res:'Certificación', uni:'', tip:0, t:'' },
		entcli:{ res:'Empresa cliente', uni:'', tip:4, t:'>' },
		entcer:{ res:'Empresa certificadora', uni:'', tip:4, t:'>' },
		feccer:{ res:'Fecha certificación', uni:'', tip:1000, t:'F' },
		fecrev:{ res:'Fecha datos GIS', uni:'', tip:1000, t:'F' },
		fecfin:{ res:'Fecha fin certificación', uni:'', tip:1000, t:'F' },
		nota:{ res:'Notas', uni:'', tip:12, t:'T' },
		_2:{ res:'A eliminar', uni:'', tip:0, t:'' },
		ord:{ res:'Orden ¿id interno?', uni:'', tip:4, t:'E' }}},
	mfa:{ cod:'mfa', res:'MFE. Especie arbórea', ide:34002, pad:'mf', plu:'MFE. Especies arbóreas', _uni:'', campos:{
		comun:{ res:'Nombre común', uni:'', tip:12, t:'T' },
		cientifico:{ res:'Nombre científico', uni:'', tip:12, t:'T' },
		sinonimias:{ res:'Sinonímias', uni:'', tip:12, t:'T' },
		confro:{ res:'Conífera / Frondosa', uni:'', tip:4, t:'L' },
		posicion:{ res:'Posición en listas y web', uni:'', tip:4, t:'E' }}},
	web:{ cod:'web', res:'Publicación WEB', ide:70000, plu:'Publicaciones WEB', _uni:'', campos:{}},
	fieado:{ cod:'fieado', res:'Entrada-Salida ADO', ide:71000, plu:'Entradas-Salidas ASO', _uni:'', campos:{}},
	cercdc:{ cod:'cercdc', res:'CDC', ide:100002, pad:'cer', plu:'', _uni:'u', campos:{
		_2:{ res:'Estado', uni:'', tip:0, t:'' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		mul:{ res:'Multisite', uni:'', tip:1006, t:'b' },
		tpo0:{ res:'Tipo [GLOBAL]', uni:'', tip:4, t:'L' },
		nota:{ res:'Notas', uni:'', tip:12, t:'T' },
		_3:{ res:'Certificación', uni:'', tip:0, t:'' },
		entcer:{ res:'Empresa certificadora', uni:'', tip:4, t:'>' },
		feccer:{ res:'Fecha certificación', uni:'', tip:1000, t:'F' },
		fecfin:{ res:'Fecha fin certificación', uni:'', tip:1000, t:'F' },
		_1:{ res:'A eliminar', uni:'', tip:0, t:'' },
		codcer:{ res:'Código licencia', uni:'', tip:12, t:'T' },
		padi_tmp:{ res:'[Empresa, comprobar con padi]', uni:'', tip:12, t:'T' },
		site:{ res:'[nº sites, comprobar]', uni:'', tip:12, t:'T' },
		ord:{ res:'Orden ¿id interno?', uni:'', tip:4, t:'E' },
		vn:{ res:'Venta neta', uni:'', tip:4, t:'E' },
		pro:{ res:'Form Producto ?', uni:'', tip:1006, t:'b' },
		tpo:{ res:'Tipo', uni:'', tip:4, t:'L' },
		ca:{ res:'CCAA', uni:'', tip:4, t:'L' },
		sec:{ res:'Sector', uni:'', tip:4, t:'L' },
		meti:{ res:'Método de aplicación CDC', uni:'', tip:4, t:'L' },
		ambi:{ res:'Ámbito de aplicación de la certificación', uni:'', tip:4, t:'L' },
		cual:{ res:'Productos determinados', uni:'', tip:12, t:'T' },
		unim:{ res:'Unidad de medida de la producción', uni:'', tip:4, t:'L' },
		cual1:{ res:'Otra unidad de medida', uni:'', tip:12, t:'T' },
		pelo:{ res:'Período de lote', uni:'', tip:12, t:'T' },
		porc:{ res:'% materia prima en productos forestales certificados PEFC', uni:'', tip:12, t:'T' },
		canp:{ res:'Cantidad total de producción anual certificada', uni:'', tip:12, t:'T' }}},
	cerdiv:{ cod:'cerdiv', res:'Divulgativo', ide:100003, pad:'cer', plu:'', _uni:'', campos:{
		_2:{ res:'Estado', uni:'', tip:0, t:'' },
		baj:{ res:'Baja', uni:'', tip:1006, t:'b' },
		mul:{ res:'Multisite', uni:'', tip:1006, t:'b' },
		tpo0:{ res:'Tipo [GLOBAL]', uni:'', tip:4, t:'L' },
		nota:{ res:'Notas', uni:'', tip:12, t:'T' },
		_3:{ res:'Certificación', uni:'', tip:0, t:'' },
		entcer:{ res:'Empresa certificadora', uni:'', tip:4, t:'>' },
		feccer:{ res:'Fecha certificación', uni:'', tip:1000, t:'F' },
		fecfin:{ res:'Fecha fin certificación', uni:'', tip:1000, t:'F' },
		_1:{ res:'A eliminar', uni:'', tip:0, t:'' },
		codcer:{ res:'Código licencia', uni:'', tip:12, t:'T' },
		padi_tmp:{ res:'[Empresa, comprobar con padi]', uni:'', tip:12, t:'T' },
		site:{ res:'[nº sites, comprobar]', uni:'', tip:12, t:'T' },
		ord:{ res:'Orden ¿id interno?', uni:'', tip:4, t:'E' },
		vn:{ res:'Venta neta', uni:'', tip:4, t:'E' },
		pro:{ res:'Form Producto ?', uni:'', tip:1006, t:'b' },
		tpo:{ res:'Tipo', uni:'', tip:4, t:'L' }}},
	regent:{ cod:'regent', res:'Entrada', ide:105001, pad:'reg', plu:'', _uni:'', campos:{
		ent:{ res:'Entidad', uni:'', tip:4, t:'L' },
		tpo:{ res:'Tipo documento', uni:'', tip:4, t:'L' },
		pry:{ res:'Proyecto', uni:'', tip:4, t:'L' }}},
	regsal:{ cod:'regsal', res:'Salida', ide:105002, pad:'reg', plu:'', _uni:'', campos:{
		ent:{ res:'Entidad', uni:'', tip:4, t:'L' },
		tpo:{ res:'Tipo documento', uni:'', tip:4, t:'L' },
		pry:{ res:'Proyecto', uni:'', tip:4, t:'L' }}},
	estgr:{ cod:'estgr', res:'Gráfica. Concepto principal', ide:106001, pad:'est', plu:'', _uni:'', campos:{
		rot1:{ res:'Descripción valor 1', uni:'', tip:12, t:'T' },
		rot2:{ res:'Descripción valor 2', uni:'', tip:12, t:'T' },
		rot3:{ res:'Descripción valor 3', uni:'', tip:12, t:'T' },
		rot4:{ res:'Descripción valor 4', uni:'', tip:12, t:'T' },
		tipg:{ res:'Tipo de gráfica', uni:'', tip:4, t:'L' },
		serc:{ res:'Serie colores', uni:'', tip:12, t:'T' }}},
	estva:{ cod:'estva', res:'Gráfica. Valores', ide:106002, pad:'est', plu:'', _uni:'', campos:{
		grafi:{ res:'Concepto gráfico asociado', uni:'', tip:4, t:'>' },
		val1:{ res:'Valor 1', uni:'', tip:12, t:'T' },
		val2:{ res:'Valor 2', uni:'', tip:12, t:'T' },
		val3:{ res:'Valor 3', uni:'', tip:12, t:'T' },
		val4:{ res:'Valor 4', uni:'', tip:12, t:'T' }}}
};

var NAT_Natura= [
	{col:'FFFFFF',res:'-',abr:'-'},	
	{col:'B8E75B',res:'LIC. Lugares de Importancia Comunitaria',abr:'LIC'},	
	{col:'316187',res:'ZEPA. Zonas de Especial Protección de Aves',abr:'ZEPA'}	
];
var ENP_Protegidos= [
	{col:'FFFFFF',res:'-',abr:'-'},	
	{col:'0E5B00',res:'Parque Nacional',abr:'Parque Nac'},	
	{col:'3FE600',res:'Parque Natural',abr:'Parque Nat'},	
	{col:'BDE7A8',res:'Parque Regional',abr:'Parque Reg'},	
	{col:'BDE7A8',res:'Parque Rural',abr:'Parque Rur'},	
	{col:'BDE7A8',res:'Parque Periurbano de Conservación y Ocio',abr:'Parque O'},	
	{col:'BDE7A8',res:'Parque Periurbano',abr:'Parque P'},	
	{col:'E59300',res:'Reserva Natural',abr:'Reserva Nat'},	
	{col:'E7E700',res:'Reserva de Fauna',abr:'Reserva Fau'},	
	{col:'E7E700',res:'Reserva de la Biosfera',abr:'Reserva Bio'},	
	{col:'E7E700',res:'Reserva Fluvial',abr:'Reserva Flu'},	
	{col:'E7E700',res:'Reserva Integral',abr:'Reserva Int'},	
	{col:'E7E700',res:'Reserva Natural Concertada',abr:'Reserva NC'},	
	{col:'E7E700',res:'Reserva Natural Dirigida',abr:'Reserva ND'},	
	{col:'E7E700',res:'Reserva Natural de Fauna Salvaje',abr:'Reserva FS'},	
	{col:'E7E700',res:'Reserva Natural Integral',abr:'Reserva NI'},	
	{col:'E7E700',res:'Reserva Natural Marina',abr:'Reserva M'},	
	{col:'E7E700',res:'Reserva Natural Parcial',abr:'Reserva P'},	
	{col:'E7E700',res:'Reserva Natural Especial',abr:'Reserva E'},	
	{col:'B1C087',res:'Paraje Natural',abr:'Paraje N'},	
	{col:'B1C087',res:'Paraje Natural de Interes Nacional',abr:'Paraje IN'},	
	{col:'B1C087',res:'Paraje Natural Municipal',abr:'Paraje M'},	
	{col:'B1C087',res:'Paraje Pintoresco',abr:'Paraje Pi'},	
	{col:'E7A6D0',res:'Paisaje Protegido',abr:'Paisaje Pr'},	
	{col:'CF0000',res:'Monumento Natural',abr:'Monumento N'},	
	{col:'CF0000',res:'Monumento Natural de Interés Nacional',abr:'Monumento IN'},	
	{col:'000F57',res:'Biotopo Protegido',abr:'Biotopo'},	
	{col:'511423',res:'Arbol Singular',abr:'Arbol'},	
	{col:'D3D2DA',res:'Plan Especial de Protección (PEIN)',abr:'PEIN'},	
	{col:'776E37',res:'Espacio Natural Protegido',abr:'Espacio Nat'},	
	{col:'776E37',res:'Zona de la Red Ecologica Europea Natura 2000',abr:'Zona Nat'},	
	{col:'776E37',res:'Zona de Especial Proteccion de los Valores Naturales',abr:'Zona VN'},	
	{col:'776E37',res:'Zona de Interés Regional',abr:'Zona IR'},	
	{col:'776E37',res:'Area Natural Recreativa',abr:'Area R'},	
	{col:'776E37',res:'Area Natural Singular',abr:'Area S'},	
	{col:'776E37',res:'Corredor Ecológico y de Biodiversidad',abr:'Corredor'},	
	{col:'776E37',res:'Cuevas',abr:'Cuevas'},	
	{col:'776E37',res:'Enclave Natural',abr:'Enclave'},	
	{col:'776E37',res:'Humedal Protegido',abr:'Humedal'},	
	{col:'776E37',res:'Lugar de Interés Científico',abr:'Lugar IC'},	
	{col:'776E37',res:'Microrreserva',abr:'Microrreserva'},	
	{col:'776E37',res:'Refugio de Fauna',abr:'Refugio'},	
	{col:'776E37',res:'Sitio de Interés Científico',abr:'Sitio IC'},	
	{col:'776E37',res:'Sitio Natural de Interés Nacional',abr:'Sitio NIC'},	
	{col:'776E37',res:'Zonas Especiales de Conservación de Importancia Comunitaria',abr:'Zonas LIC'},	
	{col:'776E37',res:'Zonas Húmedas',abr:'Zonas Hum'},	
	{col:'000000',res:'Enclavados y huecos',abr:'Enclavados'}	
];
var MUP_Montes= [
	{col:'FFFFFF',res:'-',abr:'-'},	
	{col:'937E00',res:'Monte público. UP',abr:'Monte'},	
	{col:'BDC643',res:'Monte público. Sin UP. Consorc /Conv',abr:'Monte C'},	
	{col:'937E00',res:'Monte público (Estado o CCAA). UP',abr:'Monte(E)'},	
	{col:'937E00',res:'Monte público (Estado o CCAA). UP. Consorc /Conv',abr:'Monte(E)C'},	
	{col:'937E00',res:'Monte público (Estado o CCAA). UP. No Consorc /Conv',abr:'Monte(E)noC'},	
	{col:'BDC643',res:'Monte público (Estado o CCAA). Sin UP',abr:'Monte(E)'},	
	{col:'BDC643',res:'Monte público (Estado o CCAA). Sin UP. Consorc /Conv',abr:'Monte(E)C'},	
	{col:'BDC643',res:'Monte público (Estado o CCAA). Sin UP. No Consorc /Conv',abr:'Monte(E)noC'},	
	{col:'937E00',res:'Monte público (EELL). UP',abr:'Monte(L)'},	
	{col:'937E00',res:'Monte público (EELL). UP. Consorc /Conv',abr:'Monte(L)C'},	
	{col:'937E00',res:'Monte público (EELL). UP. No Consorc /Conv',abr:'Monte(L)noC'},	
	{col:'BDC643',res:'Monte público (EELL). Sin UP',abr:'Monte(L)'},	
	{col:'BDC643',res:'Monte público (EELL). Sin UP. Consorc /Conv',abr:'Monte(L)C'},	
	{col:'BDC643',res:'Monte público (EELL). Sin UP. No Consorc /Conv',abr:'Monte(L)noC'},	
	{col:'937E00',res:'Montes singulares. UP',abr:'MonteS'},	
	{col:'BDC643',res:'Montes singulares. Sin UP',abr:'MonteS'},	
	{col:'BDC643',res:'Montes Vecinales en Mano Común. Sin UP',abr:'MonteV'},	
	{col:'BDC643',res:'Montes Vecinales en Mano Común. Sin UP. Consorc /Conv',abr:'MonteVC'},	
	{col:'BDC643',res:'Montes Vecinales en Mano Común. Sin UP. No Consorc /Conv',abr:'MonteVnoC'}	
];
var MFE_Estratos= [
	{col:'FFFFFF',res:'-',									abr:'-'},			
	{col:'808000',res:'Bosque',								abr:'Bosque'},		
	{col:'C0C000',res:'Bosque de Plantación',						abr:'Bosque P'},		
	{col:'808030',res:'Bosque Adehesado',						abr:'Bosque A'},		
	{col:'8080FF',res:'Complementos Bosque',						abr:'Complem B'},		
	{col:'C0C030',res:'Temporalmente Desarbolado (Talas)',			abr:'Desarb talas'},	
	{col:'C0C050',res:'Temporalmente Desarbolado (Incendio)',			abr:'Desarb incend'},	
	{col:'C0C070',res:'Temporalmente Desarbolado (Fenómenos Naturales)',	abr:'Desarb nat'},	
	{col:'FF8000',res:'Matorral',								abr:'Matorral'},		
	{col:'FFD740',res:'Herbazal',								abr:'Herbazal'},		
	{col:'C0C0C0',res:'Monte sin Vegetación Superior',				abr:'Monte'},		
	{col:'408080',res:'Árboles Fuera del Monte (Bosquetes)',			abr:'Bosquetes'},		
	{col:'408090',res:'Árboles Fuera del Monte (Alineaciones)',			abr:'Alineaciones'},	
	{col:'8000FF',res:'Árboles Fuera del Monte (Riberas)',			abr:'Riberas'},		
	{col:'FFFF00',res:'Árboles Fuera del Monte (Árboles Sueltos)',		abr:'Arb sueltos'},	
	{col:'FFFFB4',res:'Otros',								abr:'Otros'},		
	{col:'808080',res:'Artificial',							abr:'Artificial'},	
	{col:'0000FF',res:'Humedal',								abr:'Humedal'},		
	{col:'00FFFF',res:'Agua',								abr:'Agua'},		
	{col:'00FFFF',res:'Mar',								abr:'Mar'},			
	{col:'FFFFFF',res:'Fuera de límites',						abr:'Fuera'},		
	{col:'FF0000',res:'Autopistas y autovías',					abr:'Autopista'},		
	{col:'FF8080',res:'Infraestructuras de conducción',				abr:'Conducción'},	
	{col:'FF0080',res:'Minería, escombreras, vertederos',				abr:'Minería'},		
	{col:'FFFFB4',res:'Prado con setos',						abr:'Prado'},		
	{col:'808010',res:'Mosaico arbolado sobre cultivo y/o prado',		abr:'Árb s/cultivo'},	
	{col:'808020',res:'Mosaico arbolado sobre forestal desarbolado',		abr:'Árb s/desarb'},	
	{col:'FF8010',res:'Mosaico desarbolado sobre cultivo y/o prado',		abr:'Desarb s/cultivo'},
	{col:'FFF9BD',res:'Cultivo con arbolado disperso',				abr:'Cultivo arb disp'},
	{col:'008080',res:'Parque periurbano',						abr:'Parque'},		
	{col:'800040',res:'Área recreativa',						abr:'Área rec'},		
	{col:'0000FF',res:'Laguna de alta montaña',					abr:'Laguna'},		
	{col:'000000',res:'-',									abr:'-'},			
	{col:'000000',res:'-',									abr:'-'},			
	{col:'D3F9BC',res:'Prado',								abr:'Prado'},		
	{col:'D3F9CD',res:'Pastizal-matorral',						abr:'Pastizal'}		
];
var MFA_Especies= [
	{col:'FFFFFF',res:'-',				abr:'-'},			
	{col:'DF055C',res:'Heberdenia bahamensis',abr:'Heberdenia'},	
	{col:'DF055C',res:'Amelanchier ovalis',abr:'Amelanchier'},	
	{col:'DF055C',res:'Frangula alnus',abr:'Frangula'},	
	{col:'DF055C',res:'Rhamnus alaternus',abr:'Rhamnus'},	
	{col:'DF055C',res:'Myrtus communis',abr:'Myrtus'},	
	{col:'DF055C',res:'Acacia spp.',abr:'Acacia'},	
	{col:'DF055C',res:'Phillyrea latifolia',abr:'Phillyrea'},	
	{col:'DF055C',res:'Cornus sanguinea',abr:'Cornus'},	
	{col:'DF055C',res:'Ailanthus altissima',abr:'Ailanthus'},	
	{col:'DF055C',res:'Malus sylvestris',abr:'Malus'},	
	{col:'DF055C',res:'Celtis australis',abr:'Celtis'},	
	{col:'DF055C',res:'Taxus baccata',abr:'Taxus'},	
	{col:'DF055C',res:'Crataegus spp.',abr:'Crataegus'},	
	{col:'DF055C',res:'Pyrus spp.',abr:'Pyrus'},	
	{col:'DF055C',res:'Cedrus atlantica',abr:'Cedrus'},	
	{col:'DF055C',res:'Chamaecyparis lawsoniana',abr:'Chamaecyparis'},	
	{col:'DF055C',res:'Otras coníferas',abr:'Otras conif'},	
	{col:'82AF24',res:'Pinus sylvestris',abr:'Pinus syl'},	
	{col:'DF055C',res:'Pinus uncinata',abr:'Pinus unc'},	
	{col:'007798',res:'Pinus pinea',abr:'Pinus pine'},	
	{col:'4A8A4A',res:'Pinus halepensis',abr:'Pinus hal'},	
	{col:'7DE77D',res:'Pinus nigra',abr:'Pinus nig'},	
	{col:'A0B152',res:'Pinus pinaster',abr:'Pinus pina'},	
	{col:'DF055C',res:'Pinus canariensis',abr:'Pinus can'},	
	{col:'DFCD5A',res:'Pinus radiata',abr:'Pinus rad'},	
	{col:'DF055C',res:'Otros pinos',abr:'Otros pinos'},	
	{col:'DF055C',res:'Mezcla de coníferas',abr:'Mezcla conif'},	
	{col:'DF055C',res:'Abies alba',abr:'Abies a'},	
	{col:'DF055C',res:'Abies pinsapo',abr:'Abies p'},	
	{col:'DF055C',res:'Picea abies',abr:'Picea'},	
	{col:'DF055C',res:'Pseudotsuga menziesii',abr:'Pseudotsuga'},	
	{col:'DF055C',res:'Larix spp.',abr:'Larix'},	
	{col:'DF055C',res:'Cupressus sempervirens',abr:'Cupressus'},	
	{col:'DC96B3',res:'Juniperus communis',abr:'Juniperus c'},	
	{col:'DC96B3',res:'Juniperus thurifera',abr:'Juniperus t'},	
	{col:'DC96B3',res:'Juniperus phoenicea',abr:'Juniperus p'},	
	{col:'E4B573',res:'Quercus',abr:'Quercus'},	
	{col:'A680B3',res:'Quercus robur',abr:'Quercus ro'},	
	{col:'A680B3',res:'Quercus petraea',abr:'Quercus pe'},	
	{col:'A5D1AB',res:'Quercus pyrenaica',abr:'Quercus py'},	
	{col:'A680B3',res:'Quercus faginea',abr:'Quercus fa'},	
	{col:'006F2E',res:'Quercus ilex ',abr:'Quercus il'},	
	{col:'819D31',res:'Quercus suber',abr:'Quercus su'},	
	{col:'DF055C',res:'Quercus canariensis',abr:'Quercus ca'},	
	{col:'DF055C',res:'Quercus rubra',abr:'Quercus ru'},	
	{col:'DF055C',res:'Otros quercus',abr:'Otros Quercus'},	
	{col:'DF055C',res:'Mezcla de árboles de ribera',abr:'Mezcla arb rib'},	
	{col:'A02469',res:'Populus alba',abr:'Populus a'},	
	{col:'A02469',res:'Populus tremula',abr:'Populus t'},	
	{col:'A02469',res:'Tamarix spp.',abr:'Tamarix'},	
	{col:'9E236A',res:'Alnus glutinosa',abr:'Alnus'},	
	{col:'A02469',res:'Fraxinus angustifolia',abr:'Fraxinus'},	
	{col:'00E7A7',res:'Ulmus minor',abr:'Ulmus m'},	
	{col:'A02469',res:'Salix spp.',abr:'Salix'},	
	{col:'A02469',res:'Populus nigra',abr:'Populus n'},	
	{col:'DF055C',res:'Otros árboles ripícolas',abr:'Otros rip'},	
	{col:'DF055C',res:'Mezcla de eucaliptos',abr:'Mezcla eucal'},	
	{col:'00B481',res:'Eucalyptus globulus',abr:'Eucalyptus g'},	
	{col:'009D4F',res:'Eucalyptus camaldulensis',abr:'Eucalyptus c'},	
	{col:'DF055C',res:'Otros eucaliptos',abr:'Otros eucal'},	
	{col:'DF055C',res:'Eucalyptus nitens',abr:'Eucalyptus n'},	
	{col:'005F00',res:'Ilex aquifolium',abr:'Ilex a'},	
	{col:'4E6900',res:'Olea europaea',abr:'Olea'},	
	{col:'DF055C',res:'Ceratonia siliqua',abr:'Ceratonia'},	
	{col:'DF055C',res:'Arbutus unedo ',abr:'Arbutus'},	
	{col:'DF055C',res:'Phoenix spp.',abr:'Phoenix'},	
	{col:'DF055C',res:'Mezcla de frondosas de gran porte',abr:'Mezcla'},	
	{col:'5C480B',res:'Fagus sylvatica',abr:'Fagus'},	
	{col:'815A00',res:'Castanea sativa',abr:'Castanea'},	
	{col:'DF055C',res:'Betula spp.',abr:'Betula'},	
	{col:'606D41',res:'Corylus avellana',abr:'Corylus'},	
	{col:'DF055C',res:'Juglans regia',abr:'Juglans'},	
	{col:'DF055C',res:'Acer campestre',abr:'Acer'},	
	{col:'DF055C',res:'Tilia spp.',abr:'Tilia'},	
	{col:'DF055C',res:'Sorbus spp.',abr:'Sorbus'},	
	{col:'3F7E00',res:'Platanus hispanica',abr:'Platanus'},	
	{col:'DF055C',res:'Laurisilva',abr:'Laurisilva'},	
	{col:'DF055C',res:'Myrica faya',abr:'Myrica'},	
	{col:'DF055C',res:'Ilex canariensis',abr:'Ilex'},	
	{col:'DF055C',res:'Erica arborea',abr:'Erica'},	
	{col:'DF055C',res:'Persea indica',abr:'Persea'},	
	{col:'DF055C',res:'Picconia excelsa',abr:'Picconia'},	
	{col:'DF055C',res:'Ocotea phoetens',abr:'Ocotea'},	
	{col:'DF055C',res:'Mezcla de pequeñas frondosas',abr:'Mezcla fron'},	
	{col:'006942',res:'Buxus sempervirens',abr:'Buxus'},	
	{col:'DF055C',res:'Robinia pseudacacia',abr:'Robinia'},	
	{col:'DF055C',res:'Pistacia terebinthus',abr:'Pistacia'},	
	{col:'DF055C',res:'Laurus nobilis',abr:'Laurus'},	
	{col:'DF055C',res:'Prunus spp.',abr:'Prunus'},	
	{col:'DF055C',res:'Rhus coriaria',abr:'Rhus'},	
	{col:'DF055C',res:'Sambucus nigra',abr:'Sambucus'},	
	{col:'DF055C',res:'Carpinus betulus',abr:'Carpinus'},	
	{col:'DF055C',res:'Otras frondosas',abr:'Otras fron'},	
	{col:'DF055C',res:'Acacia melanoxylon',abr:'Acacia m'},	
	{col:'DF055C',res:'Crataegus monogyna',abr:'Crataegus'},	
	{col:'DF055C',res:'Cedrus deodara',abr:'Cedrus'},	
	{col:'DF055C',res:'Tetraclinis articulata',abr:'Tetraclinis'},	
	{col:'DF055C',res:'Larix decidua',abr:'Larix'},	
	{col:'DF055C',res:'Cupressus arizonica',abr:'Cupressus a'},	
	{col:'DC96B3',res:'Juniperus oxycedrus',abr:'Juniperus o'},	
	{col:'DF055C',res:'Juniperus turbinata',abr:'Juniperus t'},	
	{col:'A680B3',res:'Quercus pubescens (Q. humilis)',abr:'Quercus pu'},	
	{col:'DF055C',res:'Quercus lusitanica',abr:'Quercus lu'},	
	{col:'DF055C',res:'Tamarix canariensis',abr:'Tamarix'},	
	{col:'DF055C',res:'Fraxinus excelsior',abr:'Fraxinus'},	
	{col:'DF055C',res:'Ulmus glabra',abr:'Ulmus g'},	
	{col:'DF055C',res:'Salix alba',abr:'Salix'},	
	{col:'9D2068',res:'Populus x canadensis',abr:'Populus x'},	
	{col:'DF055C',res:'Eucalyptus viminalis',abr:'Eucalyptus v'},	
	{col:'ACB4BF',res:'Betula alba',abr:'Betula'},	
	{col:'DF055C',res:'Juglans nigra',abr:'Juglans'},	
	{col:'DF055C',res:'Acer monspessulanum',abr:'Acer'},	
	{col:'DF055C',res:'Tilia cordata',abr:'Tilia'},	
	{col:'DF055C',res:'Sorbus aria',abr:'Sorbus'},	
	{col:'DF055C',res:'Erica escoparia',abr:'Erica'},	
	{col:'DF055C',res:'Buxus balearica',abr:'Buxus'},	
	{col:'DF055C',res:'Pistacia atlantica',abr:'Pistacia'},	
	{col:'DF055C',res:'Laurus azorica',abr:'Laurus'},	
	{col:'DF055C',res:'Prunus spinosa',abr:'Prunus'},	
	{col:'DF055C',res:'Ficus carica',abr:'Ficus'},	
	{col:'DF055C',res:'Acacia dealbata',abr:'Acacia'},	
	{col:'DF055C',res:'Crataegus laevigata',abr:'Crataegus'},	
	{col:'DF055C',res:'Thuja spp.',abr:'Thuja s'},	
	{col:'DF055C',res:'Fraxinus ornus',abr:'Fraxinus'},	
	{col:'DF055C',res:'Ulmus pumila',abr:'Ulmus p'},	
	{col:'DF055C',res:'Salix atrocinerea',abr:'Salix'},	
	{col:'DF055C',res:'Eucalyptus gomphocephalus',abr:'Eucalyptus'},	
	{col:'DF055C',res:'Chamaerops humilis',abr:'Chamaerops'},	
	{col:'DF055C',res:'Betula pendula',abr:'Betula'},	
	{col:'DF055C',res:'Tilia platyphyllos',abr:'Tilia'},	
	{col:'DF055C',res:'Sorbus aucuparia',abr:'Sorbus'},	
	{col:'DF055C',res:'Prunus avium',abr:'Prunus'},	
	{col:'DF055C',res:'Crataegus lacinata',abr:'Crataegus'},	
	{col:'DF055C',res:'Cupressus macrocarpa',abr:'Cupressus'},	
	{col:'DF055C',res:'Salix babylonica',abr:'Salix b'},	
	{col:'DF055C',res:'Acer opalus',abr:'Acer o'},	
	{col:'DF055C',res:'Sorbus domestica',abr:'Sorbus'},	
	{col:'DF055C',res:'Prunus lusitanica',abr:'Prunus'},	
	{col:'DF055C',res:'Morus alba',abr:'Morus'},	
	{col:'DF055C',res:'Acer pseudoplatanus',abr:'Acer'},	
	{col:'DF055C',res:'Sorbus torminalis',abr:'Sorbus'},	
	{col:'DF055C',res:'Salix caprea',abr:'Salix'},	
	{col:'DF055C',res:'Acer platanoides',abr:'Acer p'},	
	{col:'DF055C',res:'Salix elaeagnos',abr:'Salix e'},	
	{col:'DF055C',res:'Salix fragilis',abr:'Salix f'},	
	{col:'DF055C',res:'Salix canariensis',abr:'Salix c'},	
	{col:'DF055C',res:'Salix purpurea',abr:'Salix p'}	
];

function campo_esnum (cam) 
{
	switch (cam.t) {
	case 'E': case 'R': case '1': case '2': case '3': case 'F': case 'H': case 'G': case 'I': return 1;
	default: return 0;
	}
}
function ingra_ima_camino (cod, que) 
{
	var a= que==0? ingra_ima_dirbaj: que==1? ingra_ima_dirmed: ingra_ima_diralt;
	return a+'/'+cod;
}
var espacio_familias_connumero=0;
var espacio_familias_abiertas=32;
var espacio_cantidad_unidad="Ha";
var color_resto="E0FBE8" 
function espacio_cantidad_forma (can, conunidad)
{
	if (!can) return "";
	var FACTOR=10000, DECIMALES=0;
	return (can/FACTOR).format(DECIMALES)+(conunidad?" "+espacio_cantidad_unidad:"");
}

var elimina_campos_vacios=1;
var ingra_espacio_conpdf=0; 		


function ingra_espacio_inicia (json, param) 
{
	espacio_familias_inicia (json);
	ingra_cuerpo.innerHTML= ingra_espacio_monta (json); 
	navega_scroll (json.param, false);
}
function ingra_espacio_monta (json)
{
	var a= ingra_pestana(json) +"<br />";


	if (ingra_espacio_conpdf) { 
		a+=	"<div width=100% style='vertical-align:center; text-align:right;'>"+
			"<a href='pdf/"+json.tab+"/"+json.cod+".pdf' target='_blank'>"+
			"Ficha para imprimir "+
			"<img src='ima/var/pdf2.gif' alt='Formato PDF' border=0 />"+
			"</a></div>";
	}
	a+= espacio_familias_monta(json,0);

	
	a+= espacio_datos_capa (MFE_Estratos, 	"Estratos del Mapa Forestal", 		"Estrato", 			"Estratos certificados", 		"Estratos", 		json.mfe, json.mfec)
	a+= espacio_datos_capa (MFA_Especies, 	"Especies arbóreas del Mapa Forestal", 	"Especie", 			"Especies certificadas", 		"Especies", 		json.mfa, json.mfac)
	a+= espacio_datos_capa (MUP_Montes, 	"Montes Utilidad Pública", 			"Categoría", 		"Montes certificados", 			"Montes", 			json.mup, json.mupc)
	a+= espacio_datos_capa (ENP_Protegidos, 	"Espacios Naturales Protegidos", 		"Figura protección", 	"Espacios Naturales certificados", 	"Espacios Naturales", 	json.enp, json.enpc)
	a+= espacio_datos_capa_solapada (NAT_Natura,"Red Natura 2000", 				"Figura protección", 	"Natura 2000 certificado", 		"Natura 2000",		json.nat, json.natc)

	if (json.tab=="espmun" && muestra_actual==12344321) {
	var ic= json.inc_con, ii= json.inc_inc;
	a+=	"<h3>Historial de incendios 1998-2008 en el Término Municipal</h3>"+
		"<table class='decampos' cellspacing=0>"+
		"<tr><td>Superficie forestal afectada (Ha)</td>	<td class='derecha'>"+(json.inc_sup.format(2))+"</td></tr>"+
		"<tr><td>Nº Incendios</td>				<td class='derecha'>"+(ii.format(0))+"</td></tr>"+
		"<tr><td>Nº Conatos (< 1 Ha)</td>			<td class='derecha'>"+(ic.format(0))+"</td></tr>"+
		"<tr class='negrita'><td class='sinborde'></td>	<td class='derecha'>"+((ii+ic).format(0))+"</td></tr>"+
		"</table><br/>";
	}

	
	if (json.cdcl && json.cdcl.length) { 
		a+=	"<h3>Empresas certificadas CDC en el municipio</h3>"+
			"<table class='capitulo' cellspacing=0>";
		for (var i=0; i<json.cdcl.length; i++) { 
			var o= json.cdcl[i]; 
			var u= util_url(o);
			
			var ima= "<img src='ima/var/"+o.tab+".png' alt='' border=0 />"
			var b= "<td>"  +u.i + ima + u.j + "</td>"; 
			b+= "<td>" + u.i + util_resumen(o) + u.j + ". " + o.ent_dirloci.res + ". (Ref: PEFC/14-" + o.cod + ")</td>";
			a+="<tr>"+b+"</tr>";
		}
		a+= "</table><br/><br/><br/>";
	}

	
	if (json.espl && json.espl.length) { 
		var o= json.espl[0]; 
		var tab= ingra_tablas[o.tab];
		a+=	"<h3>"+(tab?tab.plu:"Subespacios")+"</h3>"+
			"<table class='capitulo' cellspacing=0>";
		var mc= !!o.can;
		var mp= !!o.padi_res;
		for (var i=0; i<json.espl.length; i++) { 
			var o= json.espl[i]; 
			var u= util_url(o);
			if (!o.pag) continue; 
			var b="";
			if (json.espl.length < 50) {
				
				
				var ima= !o.ima? "": "<img src='ima/baja/"+o.ima+"' alt='' border=0 />"	
				
				b+= "<td class='imagen'>"+ima+"</td>"; 
				b+= "<td>"+u.i+util_resumen(o)+u.j+"<br>";  
				if (o.can) b+= "<br />"+espacio_cantidad_forma(o.can,1);
				
				b+= "</td>";
			}
			else {
				b+= "<td>"+u.i+util_resumen(o,"r")+u.j+"</td>";
				if (mp) b+= "<td>"+o.padi_res+"</td>";
				b+= "<td class='derecha'>"+espacio_cantidad_forma(o.can,1)+"</td>";
			}
			a+="<tr>"+b+"</tr>";
		}
		a+= "</table><br/><br/>";
	}

	if (json.imal && json.imal.length) { a+=	"<h3>Imágenes</h3>"+ imagenes.monta_htm(json.imal,"x4y-1r1"); } 
	return a;
}

function espacio_familias_inicia (json, enFamilia)
{ 
	var orgl= enFamilia? json.espl: json.faml;
	
	var niv=2,num=0; for (var i=0; i<orgl.length; i++) { var o= orgl[i]; if (o.niv) { o.abi= o.niv>=niv?1:0; num++; } }
	while (num > espacio_familias_abiertas) {
		for (var i=0; i<orgl.length; i++) { var o= orgl[i]; if (o.niv == niv) o.abi=0; else if (o.niv == niv-1) num--; }
		niv++;
	}
	if (json.param) {
		
		for (var i=0; i<orgl.length; i++) {
			var o= orgl[i]; if (json.param != o.tab+"."+o.cod) continue;
			var niv=o.niv; if (o.niv) o.abi=1;
			for (i--; i>=0; i--) {
				var o= orgl[i]; if (!o.niv) continue; 
				if (o.niv > niv) { o.abi=1; niv=o.niv; }
			}
			break;
		}
	}
}
function espacio_familias_cambia (pos, enFamilia)
{
	var orgl= enFamilia? json.espl: json.faml;
	orgl[pos].abi= !orgl[pos].abi;
	var e= document.getElementById("espacio_familias");
	if (e) e.innerHTML= espacio_familias_monta1 (json, enFamilia);
	
}
function espacio_familias_monta (json, enFamilia) { return "<div id='espacio_familias'>"+espacio_familias_monta1(json,enFamilia)+"</div>"; }
function espacio_familias_monta1 (json, enFamilia)


{
	var orgl= enFamilia? json.espl: json.faml;
	var titulo= enFamilia? "Espacios": "Certificados";
	var cabeza= enFamilia? "Espacios": "Certificados";
	var al=[];
	if (orgl && orgl.length) {
		al.push (	"<h3>"+titulo+"</h3>");
		al.push (	"<table class='decampos' cellspacing=0 cellpadding=4>"); 
		a= espacio_familias_connumero? "<th>NºPol.</th>": "";
		al.push (	"<tr>"+
				"<th>"+cabeza+"</th>"+ 
				"<th>En actual ("+espacio_cantidad_unidad+")</th>"+a+
				"<th>Total ("+espacio_cantidad_unidad+")</th>"+a+
				"<th>%</th>"+
				"</tr>"); 

		
		var o0= orgl[0];
		var cerrado=0;
		for (var i=0; i<orgl.length; i++) {
			var o= orgl[i]; if (cerrado > o.niv) continue; if (o.niv) cerrado= o.abi? 0: o.niv; 
			if (!o.niv) {
				var hijos=[]; 
				for (; i<orgl.length; i++) { var o= orgl[i]; if (!o.niv) hijos.push(o); else break; } i--;
				al.push("<tr><td class='debins' colspan=6>"+espacio_familias_bins_monta (json, hijos)+"</td></tr>");
				continue;
			}
			var mas= "<a href='javascript:espacio_familias_cambia("+i+","+enFamilia+")'>"+
					"<img border=0 src='ima/var/"+(o.abi? "check_menos.png": "check_mas.png")+
						"' style='padding-left:"+(10*(o0.niv-o.niv))+"px; padding-right:10px;'/></a>";

			var url= o.tab+'.'+o.cod+'?'+json.tab+'.'+json.cod; 
			var mar= o.tab+'.'+o.cod
			var sel= ""; if (json.param && json.param==mar) sel=" seleccion";

			al.push(	"<tr id='"+mar+"' class='nivel"+o.niv+" abierto"+(o.abi?1:0)+sel+"' style='font-size:"+(8+o.niv/2)+"pt;' >"+ 
					"<td nowrap>"+mas+util_url(url,util_resumen(o))+"</td>"); 
			if (espacio_familias_connumero)
			al.push(	"<td class='derecha'>"+((o.rcan && o.rcan!=o.rnum)?espacio_cantidad_forma(o.rcan):"")+"</td>"+
					"<td class='derecha'>"+(o.rnum?o.rnum.format():"")+"</td>"+
					
					"<td class='derecha letra_minima difuso'>"+((o.can && o.can!=o.num)?espacio_cantidad_forma(o.can):"")+"</td>"+
					"<td class='derecha letra_minima difuso'>"+(o.num?o.num.format():"")+"</td>"+
					"<td class='derecha letra_minima difuso'>"+(!o.num?" ":(o.rnum*100/o.num).format(0))+"</td>");
			else 
			al.push(	"<td class='derecha'>"                    +espacio_cantidad_forma(o.rcan)+"</td>"+
					"<td class='derecha letra_minima difuso'>"+espacio_cantidad_forma(o.can)+"</td>"+
					"<td class='derecha letra_minima difuso'>"+(!o.can?" ":(o.rcan*100/o.can).format(0))+"</td>");
			al.push(	"<tr>");
		}
		al.push ("</table><br/><br/>");
	}
	return al.join("");
}
function espacio_familias_bins_monta (json, hijos)	
{
	if (!hijos.length) return "";
	var o= hijos[0];
	var mi= (!!o.ima);
	var mr= true;
	var mc= (o._uni!="u");

	
	var al=[];
	al.push (	"<table class='decampos debins' cellspacing=0 ><tr>"+ 
		(mi?	"<th>Imagen</th>": "")+
			"<th>Código</th>"+
		(mr?	"<th>Descripción</th>": "")+ 
		(mc?	"<th>Cantidad ("+espacio_cantidad_unidad+")</th>": ""));

	var tabla= ingra_tablas[o.tab]
	var campos=[];
	for (c in tabla.campos) {
		var cam= tabla.campos[c]; cam.cod=c; if (!cam.t) continue; if (cam.cod.substr(0,4)=="MFE_") continue;			
		
		if (elimina_campos_vacios) {
			var vacio=1;
			for (var i=0; i<hijos.length; i++)  {
				var o= hijos[i]; if (o.niv) break; 
				if (o.prol && o.prol[c]) { vacio=0; break; }
			}
			if (vacio) continue;
		}
		al.push ("<th>"+cam.res+"</th>"); campos.push(cam); 
	}
	al.push ("</tr>");

	
	for (var i=0; i<hijos.length; i++) {
		var o= hijos[i]; if (!o.can) o.can=0;
		var mar= o.tab+"."+o.cod;
		var sel=""; if (json.param && json.param==mar) sel=" class='seleccion'";
		var u= util_utm (o);
		var v= util_url (o);
		
	
		var b="<tr "+sel+">"+ 
		(mi?	"<td style='width:100px;' >"+ u.i+ util_imagen(o,"ico32.gif")+ u.j+ "</td>": "")+
			"<td id='"+mar+"' nowrap>" + "<a href='javascript:navega_navega(\""+("espmun."+o.cod.split("_")[1])+"\")'>"+o.cod+"</a>" + "</td>"+		

		(mr?	"<td nowrap>"+ v.i+ o.res+ v.j+ "</td>": "")+
		(mc?	"<td class='derecha' nowrap>"+espacio_cantidad_forma(o.can)+"</td>": "");
			

		for (var j=0; j<campos.length; j++) {
			var cam=campos[j];
			var c= o.prol? o.prol[cam.cod]: ""; 
			if (!c) 				b+= "<td>&nbsp;</td>";
			else if (cam.t=="B")		b+= "<td>"+(c?"Sí":"")+"</td>";
			else if (cam.t==">") {
		 		var u= util_url (c); b+= "<td>" + u.i + c.res + u.j + "</td>";
			}
			else if (!campo_esnum(cam))	b+= "<td nowrap>"+c+"&nbsp;</td>";
			else					b+= "<td class='derecha'>"+c.format()+"&nbsp;</td>"; 
		}
		al.push (b+"</tr>");
	}

	al.push ("</table></ br></ br>");
	return al.join("");
}

function espacio_datos_capa (LEYENDA, tit, nom, tit2, tit3, cap, capc) 
{
	var a=""
	var color_UP="937E00";
	var lin_cap=0, Tup=Tnup=Tupc=Tnupc=Tup_por=Tnup_por=Tupc_por=Tnupc_por=0;
	if (typeof(cap)!="undefined" && cap.length) { 
		var tot=0; for (var i=0; i<cap.length; i++) if (cap[i]) tot+=cap[i];
		var totc=0; for (var i=0; i<capc.length; i++) if (capc[i]) totc+=capc[i];

		var tabla= ingra_tablas[json.tab]
		var al=bl=[];
		al.push ("<h3>"+tit+"</h3>");
		al.push ("<table class='decampos' cellspacing=0 cellpadding=4>");
		al.push ("<tr><th>"+nom+"</th>"+
			(capc.length? "<th>Certificado ("+espacio_cantidad_unidad+")</th><th>%</th>": "")+
			(cap.length? "<th>En actual ("+espacio_cantidad_unidad+")</th><th>%</th>": "")+
			"</tr>"); 
		var restoc=0,resto=0;
		for (var i=0; i<cap.length; i++) {
			var can= cap[i], canc= capc[i]; if (!can && !canc) continue; var cod=i.ceros(2);
			var porcen=  (!can || !tot)? 0: can*100/tot; 
			var porcenc= (!canc || !totc)? 0: canc*100/totc;
			if (!canc) canc=0;
			var res= LEYENDA[i].res;
			var col= LEYENDA[i].col;
			if (tit3=="Montes") {
				if (col==color_UP) 	{ Tupc+= canc;  Tupc_por+= porcenc;  Tup+=can;  Tup_por+= porcen; lin_cap++; }
				else 				{ Tnupc+= canc; Tnupc_por+= porcenc; Tnup+=can; Tnup_por+= porcen; lin_cap++; }
			}
			if (porcen<1 && porcenc<1) { if (can) resto+=can; if (canc) restoc+=canc; continue; }
			al.push ("<tr><td><div class='leyenda' style='float:left; background-color:#"+col+";'></div><div style='float:left;'>&nbsp;&nbsp;"+cod+" · "+res+"</div></td>"+
				(capc.length? "<td class='derecha'>"+espacio_cantidad_forma(canc)+"</td>"+	"<td class='derecha'>"+porcenc.format(0)+"</td>": "")+
				(cap.length? "<td class='derecha'>"+espacio_cantidad_forma(can)+"</td>"+	"<td class='derecha'>"+porcen.format(0)+"</td>": "")+
				"</tr>"); 
		}
		


		if (espacio_cantidad_forma(resto) || espacio_cantidad_forma(restoc)) 	
		al.push ("<tr><td><div class='leyenda' style='float:left; background-color:#"+color_resto+";'></div><div style='float:left;'>&nbsp;&nbsp;Resto</div></td>"+
			(restoc? "<td class='derecha'>"+espacio_cantidad_forma(restoc)+"</td><td class='derecha'>"+(restoc*100/totc).format(0)+"</td>": canc? "<td></td><td></td>": "")+
			"<td class='derecha'>"+espacio_cantidad_forma(resto)+"</td> <td class='derecha'>"+(resto*100/tot).format(0)+"</td>"+
			"</tr>"); 

		
		if (lin_cap>2 && tit3=="Montes" && espacio_cantidad_forma(Tup) && espacio_cantidad_forma(Tnup)) { 	
			al.push ("<tr class='cabecera'>"+
			"<td class='sinborde derecha'>Utilidad Pública Total</td>"+
			(Tupc? "<td class='derecha'>"+espacio_cantidad_forma(Tupc)+"</td><td class='derecha'>"+Tupc_por.format(0)+"</td>": canc? "<td></td><td></td>": "")+
			(Tup?  "<td class='derecha'>"+espacio_cantidad_forma(Tup)+"</td> <td class='derecha'>"+Tup_por.format(0)+"</td>": "")+
			"</tr>"); 
			al.push ("<tr class='cabecera'>"+
			"<td class='sinborde derecha'>Sin Utilidad Pública Total</td>"+
			(Tnupc? "<td class='derecha'>"+espacio_cantidad_forma(Tnupc)+"</td><td class='derecha'>"+Tnupc_por.format(0)+"</td>": canc? "<td></td><td></td>": "")+
			(Tnup?  "<td class='derecha'>"+espacio_cantidad_forma(Tnup)+"</td> <td class='derecha'>"+Tnup_por.format(0)+"</td>": "")+
			"</tr>"); 
		}
		
		al.push ("<tr class='negrita'>"+
			(capc.length? "<td class='sinborde'></td> <td class='derecha'>"+espacio_cantidad_forma(totc)+"</td><td class='derecha'>100</td>": "")+
			(cap.length? (!totc?"<td class='sinborde'></td>":"")+"<td class='derecha'>"+espacio_cantidad_forma(tot)+"</td> <td class='derecha'>100</td>": "")+
			"</tr>"); 
		
		if (cap.length && capc.length && espacio_cantidad_forma(totc) && espacio_cantidad_forma(tot))
			al.push ("<tr class='negrita'>"+
				"<td class='sinborde'></td>"+
				"<td class='sinborde'></td>"+
				"<td class='derecha'>"+(100*totc/tot).format(0)+"</td></tr>");
		a+= al.join("\r\n")+"</table><br /><br />"
	}


	
	a+= "<div class='centro'>"	
	a+= capc && capc.length>1? grafica_google (capc, 2, totc, tit2, LEYENDA):""; 
	a+= cap  && cap.length>1?  grafica_google (cap,  2,  tot, tit3, LEYENDA):"";
	a+="</div>"
	return a;
}
function grafica_google (datl, umbral, tot, tit, serie)	
{
	var ancho= 350, alto= 275;
	var est_val = est_col = est_nom = "", resto = j = 0;
	var a= "";
	for (var i=0; i<datl.length; i++) {
		if (!datl[i]) continue;
		
		var porc = datl[i] * 100 / tot;
		if (porc > umbral) {				
			est_val += (j ? "," : "") + porc;
			est_col += (j ? "|" : "") + serie[i].col; 
			est_nom += (j ? "|" : "") + serie[i].abr; 
			j++;
		}
		else resto+= porc;
	}
	if (!est_val || est_val=="100") return "";	
	est_val+= ","+resto; est_col+= "|"+color_resto; est_nom+="|Resto"; 
	a+= "<img src='http://chart.apis.google.com/chart?chs=" + ancho + "x" + alto + "&cht=p3" +
	"&chco=" + est_col + 					
	
	"&chd=t:" + est_val + 					
	"&chl=" + est_nom + 					
	"&chma=60,60,0,80" +					
	"&chtt=" + tit.replace(/ /g, "+") +
	"&chts=008000,12" +
	"' width='" + ancho + "' height='" + alto + "' alt='" + tit + "' />"
    return (a)
}

function espacio_datos_capa_solapada (LEYENDA, tit, nom, tit2, tit3, cap, capc) 
{
	var a=""
	if (typeof(cap)!="undefined" && cap.length) { 
		var tabla= ingra_tablas[json.tab]
		var al=[];
		al.push ("<h3>"+tit+"</h3>");
		al.push ("<table class='decampos' cellspacing=0 cellpadding=4>");
		al.push ("<tr><th>"+nom+"</th>"+
			(capc.length? "<th>Certificado ("+espacio_cantidad_unidad+")</th><th>%certif./protegido</th>": "")+
			(cap.length? "<th>Protegido ("+espacio_cantidad_unidad+")</th><th>% / actual</th>": "")+
			"</tr>"); 
		for (var i=0; i<cap.length || i<capc.length; i++) {
			var can= cap[i], canc= capc[i]; if (!can && !canc) continue; var cod=i.ceros(2);
			var porcen=  !can? 0: can*100/json.can;
			var porcenc= !canc? 0: canc*100/can;
			var res= LEYENDA[i].res
			var col= LEYENDA[i].col
			al.push ("<tr><td><div class='leyenda' style='float:left; background-color:#"+col+";'></div><div style='float:left;'>&nbsp;&nbsp;"+cod+" · "+res+"</div></td>"+
				(capc.length? "<td class='derecha'>"+espacio_cantidad_forma(canc)+"</td>"+	"<td class='derecha'>"+porcenc.format(0)+"</td>": "")+
				(cap.length? "<td class='derecha'>"+espacio_cantidad_forma(can)+"</td>"+	"<td class='derecha'>"+porcen.format(0)+"</td>": "")+
				"</tr>"); 
		}
		a+= al.join("\r\n")+"</table><br /><br />"
	}

	
	a+= "<div class='centro'>"	
	for (var i=1; i<3; i++) a+= grafica_google_solapada (json.can, cap[i], capc[i], LEYENDA[i].res, LEYENDA[i].col);
	a+="</div>"
	return a;
}
function grafica_google_solapada (tot, val, valc, tit, col)	
{
	var ancho= alto= 200;
	var a= "";
	tit= tit.split(".")[0];
	val= val?parseInt(val*100/tot):0; valc= valc?parseInt(valc*100/tot):0;
	if (!val) return "";

	var gr="http://chart.apis.google.com/chart?chs=" + ancho + "x" + alto + "&cht=v" +		
	"&chco=" + color_resto + "," + col + ",00AA00" + 							
	"&chd=t:100," + val + "," + valc + "," + val + "," + valc + "," + valc + ",0" +		
	"&chdl=Actual total|"+tit+"|Certificado" + 								
	
	
	
	""
	a+= "<img src='" + gr + "' width='" + ancho + "' height='" + alto + "' alt='" + tit + "' />"
	
	return (a)
}

function ingra_familia_inicia (json, param)
{ 
	espacio_familias_inicia (json, 1);
	ingra_cuerpo.innerHTML= ingra_familia_monta (json) 
	navega_scroll(json.param, false);
}

function ingra_familia_monta (json) 
{
	var a= ingra_pestana(json); 
	if (json.fecrev)a+= "<p>Fecha de revisión de datos GIS: "+azohc_str_fec2str(json.fecrev)+"</p>"
	a+= "<br />"
	if (json.entcli) {
		var up= util_url(json.entcli);
		a+= "<p>Entidad certificada:<br />" + up.i + json.entcli.res + up.j + "</p><br />";
	} 

	a+= espacio_familias_monta (json, 1);
	
	a+= familia_datos_capa (MFE_Estratos, 	"Estratos del Mapa Forestal", 		"Estrato", 			"Estratos certificados", 		json.mfec)
	a+= familia_datos_capa (MFA_Especies, 	"Especies arbóreas del Mapa Forestal", 	"Especie", 			"Especies certificadas", 		json.mfac)
	a+= familia_datos_capa (ENP_Protegidos, 	"Espacios Naturales Protegidos", 		"Figura de protección", "Espacios Naturales certificados", 	json.enpc)
	a+= familia_datos_capa (MUP_Montes, 	"Montes Utilidad Pública", 			"Categoría", 		"Montes certificados", 			json.mupc)
	if (typeof(json.natc)!="undefined") a+= familia_datos_capa (NAT_Natura, 	"Red Natura 2000", 				"Figura", 			"Natura 2000", 				json.natc)

	if (json.faml.length) { 
		var o= json.faml[0]; 
		var tab= ingra_tablas[o.tab];
		a+=	"<h3>"+(tab?tab.plu:"Subfamilias")+"</h3>"+
			"<table class='capitulo' cellspacing=0>";
		for (var i=0; i<json.faml.length; i++) { 
			var o= json.faml[i]; 
			var u= util_url(o);
			var b="";

			b+= "<td style='text-align:center; width:96px;' >"+u.i+util_imagen(o,"ico32.gif")+u.j+"</td>";
			b+= "<td>"+u.i+util_resumen(o,"r")+u.j;
			if (o.can) b+= "<br />"+espacio_cantidad_forma(o.can,1); 
			if (o.num && o.num != o.can) b+= "<br />"+o.num+" u";
			b+= "</td>";
			a+="<tr>"+b+"</tr>";
		}
		a+= "</table><br/><br/>";
	}

	if (json.imal && json.imal.length) { a+=	"<h3>Imágenes</h3>"+ imagenes.monta_htm(json.imal,"x4y-1t0r1")+"<br/><br/>"; }
	return a;
}

function familia_datos_capa (LEYENDA, tit, nom, tit2, capc) 
{
	var a="";
	if (typeof(capc)!="undefined" && capc.length) { 
		var totc=0; for (var i=0; i<capc.length; i++) if (capc[i]) totc+=capc[i];
		var tabla= ingra_tablas[json.tab]
		var al=[];
		al.push ("<h3>"+tit+"</h3>");
		al.push ("<table class='decampos' cellspacing=0 cellpadding=4>");
		al.push ("<tr><th>"+nom+"</th>"+
				(capc.length? "<th>Certificado ("+espacio_cantidad_unidad+")</th><th>%</th>": "")+
				"</tr>");
		var restoc=0 
		for (var i=0; i<capc.length; i++) {
			var canc= capc[i]; if (!canc) continue; var cod=i.ceros(2);
			var porcenc= (!canc || !totc)? 0: canc*100/totc;	
			if (porcenc<1) { if (canc) restoc+=canc; continue; }	

			var res= LEYENDA[i].res
			var col= LEYENDA[i].col
			al.push ("<tr><td><div class='leyenda' style='float:left; background-color:#"+col+";'></div><div style='float:left;'>&nbsp;&nbsp;"+cod+" · "+res+"</div></td>"+
					(capc.length? "<td class='derecha'>"+espacio_cantidad_forma(canc)+"</td>"+	"<td class='derecha'>"+porcenc.format(0)+"</td>": "")+
					"<tr>");
		}
		if (espacio_cantidad_forma(restoc)) 	
			al.push ("<tr><td><div class='leyenda' style='float:left; background-color:#"+color_resto+";'></div><div style='float:left;'>&nbsp;&nbsp;Resto</div></td>"+
			"<td class='derecha'>"+espacio_cantidad_forma(restoc)+"</td><td class='derecha'>"+(restoc*100/totc).format(0)+"</td>"+
			"</tr>"); 
		al.push ("<tr class='negrita'>"+
			(capc.length? "<td class='sinborde'></td> <td class='derecha'>"+espacio_cantidad_forma(totc)+"</td><td class='derecha'>100</td>": "")+
			"</tr>"); 
		a+= al.join("\r\n")+"</table><br /><br />"
	}
	
	a+= "<div class='centro'>"
	a+= grafica_google (capc, 2, totc, tit2, LEYENDA);
	a+="</div>"
	return a; 
}
function ingra_carpeta_inicia (json, param) 
{
	ingra_cuerpo.innerHTML= ingra_carpeta_monta(json); 
	navega_scroll (json.param, false);
}

function ingra_carpeta_monta (json)
{
	if (json.cod=="web3") ingra_manda_visita ("productos");
	var a="";
	a+= ingra_pestana (json);	 
	if (json.tex) a+= "<p class='justifica'>"+ json.tex + "</p><br />";
	a+= "<table class='capitulo' cellspacing=0 cellpadding=6>";
	var esref=0;
	for (var j=0; j<json.hijos.length; j++) if (json.hijos[j].tab=="ref") { esref++; break; }
	if (!esref) {
		for (var i=0; i<json.hijos.length; i++) {
			var h= json.hijos[i];
			if(h.tab=="recpro"){
				if(h.padi_baj){
					var baja = h.padi_baj;
					if(baja.substr(0,3)=='tip') baja = baja.split(":")[2];
					if(baja==1 || baja=='RETIRADO') continue;;
				}else continue;
			}
			var u= util_url(h);
			a+= 	"<tr>"+
				"<td class='imagen'>" + u.i + util_imagen(h, "ico16.gif") + u.j + "</td>"+
				"<td class='justifica'>" + u.i + h.res + u.j + (h.tab=="entcli"?" (Ref.: PEFC/14-"+h.cod+")":"") + "</td>"+
				"</tr>"
				
		}
	}
	else { 
		for (var i=0; i<json.hijos.length; i++) {
			var h= json.hijos[i];
			var tab= ingra_tablas[h.tab];
			var u= {i:"<a href='pdf/"+h.prol.arc+"' target='_blank'>",j:"</a>"};		
			var t= h._tam/1024/1024;
			var tam= t>2? " ("+parseInt(t)+" MB)": "";				
			var fec= h.fec?" ("+azohc_str_fec2nom(o.fec,1)+")":"";
			
			
			var leg=0			
			if (json.cod.substr(0,5)=="web_5") leg=1;
			if (h.cod=="-") { a+= "<tr><td colspan=2> </td></tr>"; continue; }
			if (h.tab=="varsec") {
				a+= 			"<tr class='sinborde'><td colspan=2 class='sinborde'><h3>" 	+ h.res + "</h3></td></tr>"; 
				if (h.tex) a+= 	"<tr class='sinborde'><td colspan=2 class='sinborde'>"	+ h.tex + "</td></tr>";
				continue;
			}
			a+= 	"<tr>"+
				"<td class='imagen'>" + u.i + util_imagen(h, "ico16.gif") + u.j + "</td>"

 			if (leg) 	a+="<td>" + u.i + (h.tex?h.tex:h.res) + u.j + tam + "</td></tr>";
			else 		a+="<td>" + u.i + h.res + u.j + tam + (h.tex?"<br /><span class='pie'>"+h.tex+"</span>":"") + "</td></tr>";
		}
	}
	a+= "</table><br />"
	a+= imagenes.monta_htm(json.imal,3);
	return a;
}
function ingra_entcli_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_entcli_monta (json);
	navega_scroll (param);
}
function ingra_entcli_monta (json)
{
	var a= ingra_pestana (json);	


	if (json.tex) a+="<p>"+json.tex+"</p>";

	
	var pro= json.prol, b="";
	b+= "Certificado: PEFC/14-"+json.cod;
	if (pro.actpri) 	b+=(b?"<br />":"")+ 	"Actividad principal: " + pro.actpri;
	if (pro.actdes) 	b+=(b?"<br />":"")+ 	"Descripción: " + pro.actdes + "<br />";

	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.split(":")[2])+"\")'>http://" + pro.web.split(":")[2] +"</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 \/>/,". ");
	
	
	
	

	a+= 	"<h3>Datos de empresa</h3>"+
		"<p>" + b + "</p><br />";




	
	var b=""
	for (var i=0; i< json.hijos.length; i++) {
		var h= json.hijos[i]; 
		if (h.tab!="recpro") continue;
		if (!h.fami || h.fami.cod>="15000") continue;	

		var pu= util_url(h); 
		var fu= util_url(h.fami); 
		b+= 	"<tr>"+
			"<td class='imagen derecha'>" + pu.i + util_imagen(h,"ico16.gif") + pu.j + "</td>"+
 			"<td>" + pu.i + h.cod + pu.j + "</td>"+
 			"<td>" + fu.i + h.fami.cod+" · "+h.fami.res + fu.j + "</td>"+
 			"<td>" + (h.espcon?"Sí":"&nbsp") + "</td>"+
 			"<td>" + (h.espftr?"Sí":"&nbsp") + "</td>"+
 			"<td>" + (h.espfnt?"Sí":"&nbsp") + "</td>"+
			"</tr>"; 
	}
	if (b) {
	a+= 	"<h3>Productos en catálogo</h3>"+
		"<table class='decampos' cellspacing=0>"+
		"<th>&nbsp</th><th>Código</th><th>Categoría</th><th>Conífera</th><th>Frondosa tropical</th><th>Frondosa no tropical</th>"+
		b+

		"</table>";
	}


	a+= "<br />"+imagenes.monta_htm(json.imal,"") + (json.imal?"<br /><br />":"");
	return a;
}
function ingra_entcon_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_entcon_monta (json);
	navega_scroll (json.param, false);
}
function ingra_entcon_monta (json)
{
	var a= ingra_pestana(json);
	var pro= json.prol, b="";
	if (pro.tpo) 	b+=(b?"<br />":"")+	"Tipo: " + pro.tpo;
	if (pro.geo) 	b+=(b?"<br />":"")+	"Ámbito geográfico: " + pro.geo;
	if (pro.ano) 	b+=(b?"<br />":"")+	"Año inicio consultoría: " + pro.ano;
	if (pro.per) 	b+=(b?"<br />":"")+	"Consultores: " + pro.per;
	b+= "<br />CIF: " + json.cod;
	if (json.padl) {
		b+= "<br />Áreas de consultoría: " 
		for (var i=0; i<json.padl.length; i++) { b+= (i?" / ":"") + json.padl[i].res; }
	}
	a+= "<p>" + b + "</p><br />";


	
	var pro= json.prol, 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.split(":")[2])+"\")'>http://" + pro.web.split(":")[2] +"</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 (pro.per) 	b+=(b?"<br />":"")+	"Contacto: "+ pro.per;
	a+= 	"<br /><h3>Contacto</h3>" + "<p>" + b + "</p><br />";

	a+= json.imal.length? "<br /><img src='"+ingra_ima_camino (json.imal[0].cod, 1)+"' alt='' border=0 />": "";

	return a;
}
function ingra_entcer_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_entcer_monta (json);
	navega_scroll (json.param, false);
}
function ingra_entcer_monta (json)
{
	var a= ingra_pestana(json);
	var pro= json.prol, b="";

	b+= 							"Código: " + json.cod.replace(/#/,"/");
	if (pro.tpo) 	b+=(b?"<br />":"")+	"Tipo: " + pro.tpo;
	if (pro.acre) 	b+=(b?"<br />":"")+	"Acreditadora: " + pro.acre;
	a+= "<p>" + b + "</p><br />";

	
	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.split(":")[2])+"\")'>http://" + pro.web.split(":")[2] +"</a>";
	if (pro.ftp) 	b+=(b?"<br />":"")+	"Ftp: <a href='javascript:navega_externo(\""+pro.ftp+"\")'>" + pro.ftp +"</a>";
	if (pro._dir) 	b+=(b?"<br />":"")+	"Dirección: "+ pro._dir.replace(/<br \/>/,". ");
	if (pro.per) 	b+=(b?"<br />":"")+	"Contacto: "+ pro.per;
	a+= 	"<br /><h3>Contacto</h3>" + "<p>" + b + "</p><br />";

	a+= json.imal.length? "<br /><img src='"+ingra_ima_camino (json.imal[0].cod, 1)+"' alt='' border=0 />": "";

	return a;
}
function ingra_producto_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_producto_monta(json); 
	navega_scroll (json.param, false);
}
function ingra_producto_monta (json)
{
	var a= ingra_pestana (json);	
	if (json.tex) a+="<p>"+json.tex+"</p>";

	
	var pro= json.prol, b="";
	var t= ingra_tablas.recpro.campos;
	if (pro.espcon) b+=t.espcon.res; 
	if (pro.espftr) b+=(b?" / ":"")+t.espftr.res;
	if (pro.espfnt) b+=(b?" / ":"")+t.espfnt.res; 

	var p= json.padi, f= json.fami;
	var ac = json.padi_actdes;
	var up= util_url(p), uf= util_url(f)
	a+= 	"<h2>Características del producto</h2>"+
		"<p>Tipo de maderas: " + b + "</p>"+
		"<p>Categoría: " + uf.i + f.res + uf.j + "</p>"+
		"<p>Proveedor: " + up.i + p.res + up.j + "</p>"+
		"<p>Alcance: " + ac  + "</p>";
	a+= "<br />"+imagenes.monta_htm(json.imal,"") + (json.imal?"<br /><br />":"");
	return a;
}


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];

	if (json.cod=="webM4") ingra_manda_visita ("formulario");
	ingra_cuerpo.innerHTML= a;
	navega_scroll (json.param, false);
}
function window_onload2()
{
	ingra_busqueda_portada_inicia();
	ingra_muestra_inicia();
}
var ingra_busqueda=0, ingra_busqueda_tex="", ingra_busqueda_tl=[], ingra_busqueda_cl=[]; 

function ingra_busqueda_inicia (json, param) 
{ 
	ingra_cuerpo.innerHTML= ingra_busqueda_monta (json, param); 
	navega_scroll (json.param, false);
}
function ingra_busqueda_monta (json, param) 
{
	var a= ingra_pestana (json)+"<br /><br />";
	
	

	if (ingra_busqueda_tex) a+= "<p>Términos : "+ingra_busqueda_tex+" > "+ingra_busqueda_tl.join(" + ")+"</p><br>";
	if (tesauro_traza && tesauro_log) a+= "<p>"+tesauro_log.join("<br>")+"</p><br>";
	var incompletos=0;

	if (!ingra_busqueda_cl.length) {
		a+= "<p class='enfatizado'>No se han encontrado resultados</p>";
		return a; 
	}
	a+= "<table class='capitulo' cellspacing=0>";
	for (var i=0; i<ingra_busqueda_cl.length; i++) {
		var con= ingra_busqueda_cl[i];
		var o= tesauro_concepto(con.ide); if (!o) continue; 		
		if (!incompletos && ingra_busqueda_tl.length > con.num) {
			incompletos=1;
			a+= "<tr><td colspan='2' class='enfatizado'><br />Resultados con búsqueda incompleta de términos<br /><br /></td></tr>";
		}
		o.pag=1;
		var b="<td>" + util_url(o, util_resumen(o,"t")) + "</td>"
		a+=	"<tr>" + b + "</tr>"
		if (i+1 >= 10 && ingra_busqueda_tl.length > con.num) { i=ingra_busqueda_cl.length; break; }
		if (i+1 >= 20 && ingra_busqueda_tl.length == 1) break;
		if (i+1 >= 50 && ingra_busqueda_tl.length > 1) break;
	}
	a+= "</table><br />";
	if (i < ingra_busqueda_cl.length) a+= "<p>Sólo aparecen las "+(i+1)+" primeras referencias</p><br />"
	return a;
}

function ingra_busqueda_portada_inicia()
{
	var ingra_busca= document.getElementById ("ingra_busca"); if (!ingra_busca) return;

	idom_input (ingra_busca, "", ingra_busqueda_portada_procesa,"", 0, "ima/var/lupa.png","Introduza términos de búsqueda, puede introducir sinónimos o términos relacionadas, por ejemplo ciudades")
	

	
	
	


}
function ingra_busqueda_portada_procesa (oinput) 
{
	var texto= oinput.value;
	document.body.style.cursor = "wait";
	
	var tl= tesauro_de_texto_a_terminos (texto); 
	var cl= tesauro_de_terminos_a_conceptos (tl); 
	document.body.style.cursor = "default";

	if (cl.length == 1) {
		var con= cl[0];
		var o= tesauro_concepto(con.ide); 
		return navega_navega (o.tab+"."+o.cod);
	}

	for (var i=0; i<tl.length; i++) tl[i]= tl[i][1];
	ingra_busqueda_tex= texto;
	ingra_busqueda_tl= tl;
	ingra_busqueda_cl= cl;
	navega_actualiza("varpag.webM_busca"); 
}
