
function descodificar_entidades_html (cadea) {
  var aux = document.createElement ("div") ;
  aux.innerHTML = cadea.replace (/</g,"&lt;").replace (/>/g,"&gt;") ;
  return aux.firstChild.data;
}

function captura_xml_ini() {
	var aux = document.getElementsByTagName ('script') ;
	aux [aux.length - 1].parentNode.removeChild (aux [aux.length - 1]) ;
	document.write('<scr'+'ipt type = "dummy">');
}

function captura_xml_fin() {
	var aux = document.getElementsByTagName ('script') ;
	aux = aux [aux.length - 2] ;
	var doc = new DOMParser().parseFromString (aux.text.replace (/<script>$/, ''), 'text/xml') ;
	var aux2 = doc.documentElement.parentNode.removeChild (doc.documentElement) ;
	aux = aux.parentNode.replaceChild (aux2, aux) ;
}
function ajaxizar (cont) {
	if (typeof url != 'undefined') document.write (cont) ;
}
function apanhar_boia (onde) {
	var volta ;
	if ((volta = document.cookie.replace (new RegExp ("(^.+; *|^)"+onde+"=(.*?)(; *.+$|$)"), '$2')) == document.cookie) return undefined ;
        return decodeURIComponent (volta) ;
}
clonar = function (obx) {
//clonar en esquema prototipado significa empregar os atributos da base como valores por defecto : se se modifica un da derivada se desenlaza da base, se non está desenlazada, as modificacións na base, vense na derivada.
	var f = function f() {} ;
	f.prototype = obx ;
	return new f() ;
} ;
//Para que complicarse, se temos dojo.clone : recursivo (mais non cíclico) e incluso considerando listas de nodos DOM, arrays (non concat ou slice que so clonan primitivas, xa que manteñen referencias)
// Object.prototype.clonar = function() {
// 	function f() {} ;
// 	f.prototype = this ;
// 	return new f() ;
// } ;
function pila (func) {
	var volta = [] ;
	do {
		volta [volta.length] = func ;
		func = func.caller ;
	} while (func != null) ;
	return volta ;
}
function argumentar (base, args) {
	for (i in args) {
		if (typeof base [i] == 'undefined') {console.error ('Argumento non válido : '+i) ; console.error.apply (console, ['Pila : '].concat(pila (arguments.callee)))}
		else base [i] = args [i] ;
	}
}
function deixar_boia (onde, fardo) {
	var args = {duracion: 0, ruta: '/', dominio: location.hostname } ;
	if (arguments.length == 3)
		argumentar (args, arguments [2]) ;
	if (args.duracion) {
		var data = new Date();
        	data.setTime (data.getTime() + args.duracion);
        	var caducidade = "; expires=" + data.toGMTString();
	} else caducidade = '' ;
	document.cookie=onde+'='+encodeURIComponent (fardo)+caducidade+'; path='+args.ruta+'; domain='+args.dominio ;
}
function afundir_boia (onde) {
	deixar_boia (onde, '', {duracion:-10000}) ;
}
function compatible() {
	var aux ;
	if (typeof (aux = apanhar_boia ('PHPSESSID')) != 'string' || ! aux.length || apanhar_boia ('modo') == 'compatible')
		return 0 ;
	var compat_dojo = {
		isMoz: new Array ('Familia Mozilla (Gecko) : Firefox, Iceweasel, Kazehakase...', 5, 5),
		isWebKit: new Array ('Familia WebKit : Apple Safari, Google Chrome, Arora...', 528.15),
		//isKhtml: new Array ('Familia Khtml : KDE Konqueror, Apple Safari...', 5),
		isIE: new Array ('MS Internet Explorer', 8),
		isOpera: new Array ('Ópera', 9.64)
	}
//if (dojo.cookie.isSupported()) // navigator.cookieEnabled : comproba se necesario só unha vez e almacena.
// alert (dojo.isIE+'<ie8>'+dojo.isFF+'<x>'+dojo.isChrome+'<cr3>'+dojo.isKhtml+'<kq5>'+dojo.isMoz+'<mz5>'+dojo.isMozilla+'<mz5>'+dojo.isOpera+'<op9.64>'+dojo.isSafari+'<sf4>'+dojo.isWebKit+'<cr531+sf528.16>') ;
	for (i in compat_dojo) {
		if (typeof (aux = dojo [i]) == 'number' && aux > 0)
			break ;
		aux = undefined ;
	}
	if (typeof aux == 'undefined')
		var mens = 'Navegador non recoñecido' ;
	else if (compat_dojo [i] [0] > aux)
		var mens = 'Navegador detectado : '+compat_dojo [i] [1]+'.\nVersión : '+aux+'. Mínima versión testada : '+compat_dojo [i] [0] ;
	if (typeof mens != 'undefined')
		aux = confirm (mens+'\nQueres probar de tódolos xeitos o modo ajax?\nSe detectas algún problema tes un enlace para saltar ó modo compatible.\nAdemais se resultara inestable podes refresca-la páxina e se che voltaría a presentar esta pregunta.') ;
	deixar_boia ('navegador', i) ;
	if (! aux) {
		deixar_boia ('modo', 'compatible') ;
		return 0 ;
	}
	return 1 ;
}
//alert ('carga') ;
var inicio = '' ;
// alert (inicio) ;
var ajax=1 ;
var alert2 = alert ;
var alert1 = function() {}
function rexistrar_url (nivel, campo, cadea) {
//// 	if (nivel > 0) return ;
//	try {document.getElementById (campo).innerHTML = cadea ;} catch (e) {alert1 (campo +'='+cadea) ;}
}
var url=(function() {
	var __inst ;
	var re_virtualizar_ancora, re_virtualizar_orix, re_cortar ;
	var aux, aux2 ;
	var url_nova = {}, url_act = {}, url_solic = {}, equipo, conexion, conexion_obx, forzando_saida=0 ;
	var recarga_post, recarga_url ;
	var notificacions_carga = ['onload'/*, 'probas_url'*/] ;
	var __pub = {
		virtualizar: function (cadea) {
rexistrar_url (1, 'solicitude', cadea) ;
			if (cadea != (aux = cadea.replace (re_virtualizar_ancora [0], re_virtualizar_ancora [1]))) cadea = aux ;
			else cadea = cadea.replace (re_virtualizar_orix [0], re_virtualizar_orix [1]) ;
rexistrar_url (2, 'tmp1', cadea) ;
			return cadea ;
		},
		cortar: function (cadea) {
			var vector = cadea.replace(re_cortar [0], re_cortar [1]).split ('#@#') ;
			if (vector [0] == 'abs' && vector[1] == '/') {
				if (url_act.corte == null) vector [1] = inicio ;
				else vector [1] = url_act.corte [1] ;
			}
			vector [2] = vector [2].replace (/=(&|$)/g, '$1') ;
rexistrar_url (3, 'tmp2', vector.toString()) ;
			vector [1] = vector [1].replace (/\/{2,}/g, '/') ;
			return vector ;
		},
		redir: function (corte) {
			var redir = corte [1]+((corte [2].length)?'/!/'+corte [2]:'')+((corte [3].length)?'/$/'+corte [3]:'') ;
rexistrar_url (4, 'redireccion', redir) ;
			return redir ;
		},
		perma: function (corte) {
			var perma = corte [1]+((corte [2].length)?'?'+corte [2]:'')+((corte [3].length)?'#'+corte [3]:'') ;
rexistrar_url (5, 'permalink', perma) ;
			return perma ;
		},
		forzar_recarga: function (url) {
			//resulta quen en chrome, a carga da páxina ás veces sucede antes de chegar aquí, non espera, é como si defer="true", a maiores parece que webkit non soporta este atributo, pareceume que unn simple alert ó comezo deste script : carga.js.php conseguía evitar este problema...
			//PROBANDO window.stop
		if (equipo +'/#'+ url_nova.redir != location.href) {
			if (! dojo.isIE)
				window.stop() ;
			else
				window.document.execCommand('Stop');
		}
	//	alert ('qwer') ;
// 			alert ('/#'+url.redir) ;
// 			alert (apanhar_boia ('ajax_inicial')) ;
// 			return ;
			forzando_saida = 1 ;
			if (dojo.isKhtml/* || dojo.isWebKit//Parecía preciso sen r_ajax*/) {
				if (location.pathname == "/" && ! location.search.length)
					location.replace (url.perma) ;
				else
					location.replace ('/#'+url.redir) ;
			} else {
				//alert ('saindo :\n'+document.cookie) ;
				try {
				location.replace ('/#'+url.redir) ;
				} catch (e){
    //alert("An exception occurred in the script. Error name: " + e.name
//	    + ". Error message: " + e.message);
				}

// 				alert ('asdf'+'/#'+url.redir) ;
				/*No en WebKit, cando menos*/
				if (dojo.isIE && location.pathname == "/" && ! location.search.length)
					location.reload (true) ;
			}
		},
		saida: function() {
						if (! forzando_saida) {
				//afundir_boia ('ajax_inicial') ;
				//alert ('non forzando') ;
			}
		},
		pinchar: function (e) {
			aux = e.target ;
			while (aux.nodeName != 'BODY') {
				if (aux.nodeName == 'A') {
					var target = aux ;
					break ;
				}
				aux = aux.parentNode ;
			}
			if (typeof target == 'undefined')
				var target = e.target
			if (dojo.isIE && e.type == 'keypress') {
				if (e.keyCode != 13) return ;
				if (target.nodeName != 'INPUT' || target.type == 'file') return ;
			} else if (e.type == 'click' && target.nodeName == 'A') {
				if (e.shiftKey || target.target == '_blank') return ;
				if (! dojo.isIE)
					if (e.button && ! dojo.isKhtml|| e.button != 1 && dojo.isKhtml || e.ctrlKey) return ;
				var nodo = target ;
				var enlace = nodo.href ;
				if (enlace.match (/^javascript:.*/)) return ;
			} else if (e.type == 'click' && target.nodeName == 'INPUT' && target.type == 'submit') {
				if ((dojo.isSafari && e.ctrlKey) || dojo.isOpera && e.shiftKey) return ;
			} else return ;
			
			if (typeof nodo == 'undefined') {
				var nodo = target.form ;
				var enlace = nodo.action ;
				if (nodo.onsubmit && ! nodo.onsubmit()) {
					e.preventDefault() ;
					return ;
				}
				if (nodo.method != 'post') {
				//eliminar parte get para post??? split # pode petar porque podería haber varios...
					enlace = enlace.split ('#') ;
					enlace = enlace [0].replace (/^([^?]*)(\?.*)?$/, '$1')+'?'+dojo.formToQuery (nodo)+((enlace.length == 2)?'#'+enlace[1].length:'') ;
				} else url_solic.post = nodo ;
			}
			var aux = enlace.replace (/^(?:https?:\/\/([^/]*))?(.*)$/, '$1#@#$2').split ('#@#') ;
// 			alert (aux [1]+'xxx'+(aux [1].match (/^\/wordpress/))) ;
			if (aux [1] == '/ajx/#') {
				e.preventDefault() ;
				return ;
			}
			if (! aux [0].length && !aux [1].match (/(^\/descarregar|^\/wordpress|^\/\?ec3_ical|^\/\?version)|^.*\/feed\/?$/))
//Por culpa de IE, isto é impredecible : antes de 8 getAttribute non supón diferencia e action sempre relativa e href sempre absoluta coa excepción dos enlaces creados dinámicamente...
				enlace = location.protocol+'//'+location.host+((aux[1].match (/^\/.*/))?'':'/')+aux [1] ;
			else if (aux [0] != location.host || aux [1].match (/(^\/descarregar|^\/wordpress|^\/\?ec3_ical|^\/\?version)|^.*\/feed\/?$/)) {
				//clearInterval (disparador) ;
				url_solic = {} ;
				return ;
			}
			url_solic.enlace = enlace ;
// rexistrar_url (1, 'tmp3', enlace) ;
			e.preventDefault() ;
		},
		escoitar: function() {
			var solic, conexion_obx ;
			if ((equipo +'/#'+ url_act.redir != location.href && (solic = [1, location.href])) || (typeof url_solic.enlace != 'undefined' && (solic = [2, url_solic.enlace])) || (this.ie_ok && dojo.isIE && equipo + '/ie' +url_act.redir.replace (/\/$/,'') != ie_historial.location.href.replace (/\/$/,'') && (solic = [3, equipo +'/#'+ie_historial.location.pathname.substr (3)]))) {
				//console.log (equipo + '/ie' +url_act.redir.replace (/\/$/,'')+'x'+ie_historial.location.href.replace (/\/$/,'')) ;
				//console.log (solic) ;
				url_nova.virt = this.virtualizar (solic [1]) ;
				url_nova.corte = this.cortar (url_nova.virt) ;
				url_nova.redir = this.redir (url_nova.corte) ;
				url_nova.perma = this.perma (url_nova.corte) ;
				if (solic [0] != 2 || typeof url_solic.post != 'undefined' || url_act.redir != url_nova.redir) {
// 					alert (ie_historial.location.pathname.substr (3)) ;
					if (dojo.isIE && solic [0] != 3) {
// 						alert ('/ie'+url_nova.redir);
						this.ie_ok = 0 ;
						ie_historial.location.href = '/ie'+url_nova.redir ;
						//console.log ('iframe'+url_nova.redir+' x '+ie_historial.location.href) ;
// 						ie_historial.document.title = url_nova.perma ;
					}
					if (! dojo.isIE && solic [0] == 1) {
						if (equipo + '/#' + url_nova.redir != solic [1]) {
							history.back() ;
						}
					}
					location.href = equipo + '/#' + url_nova.redir ;
// 					document.title = url_nova.perma ;
					menu (url_nova.corte) ;
					if (url_nova.corte [1]+url_nova.corte [2] != url_act.corte [1]+url_act.corte [2] || typeof url_solic.post != 'undefined') {
						deixar_boia ('ajax_inicial', url_nova.perma) ;
						conexion = {
							url : '/ajax'+url_nova.perma
						}
						if (typeof url_solic.post != 'undefined')
							conexion.form = url_solic.post ;
						conexion_obx = new recarga (conexion) ;
// 						if (url_nova.corte [3].length)
							conexion_obx.carga_fin = [__inst, 'post_carga'] ;
						conexion_obx.iniciar() ;
					} else if (url_nova.corte [3].length) //Para áncora distinta, mais sería convinte aplica-la de tódolos xeitos...
						conexion_obx = 'ancora' ;
				}
				url_solic={}
// 				document.title = url_nova.perma ;
				url_act = dojo.clone (url_nova) ;
				//if (conexion_obx == 'ancora')
				if (typeof conexion_obx == 'undefined' || conexion_obx == 'ancora')
					this.post_carga() ;
					//this.ancora() ;
			}
			disparador = setTimeout (function() {__inst.escoitar() ;}, 500) ;
		},
		post_carga:function() {
			if (arguments.length)
				var args = arguments [0] ;
			else
				var args = {} ;
			if (typeof args ['titulo'] != 'undefined')
				var titulo = args ['titulo'] ;
			else
				var titulo = url_act.perma ;
			document.title = descodificar_entidades_html (titulo) ;
			this.ancora() ;
		},
		ancora: function() {
// 			alert (123) ;
			if (url_act.corte [3].length && (aux = document.getElementsByName (url_act.corte [3])).length) {
				//Bloqueo por asincronismos??????
				aux = aux [0] ;
				var aux2, aux3, aux4 ;
				if (dojo.isIE) {
					aux.parentNode.replaceChild ((aux2 = document.createElement ("<A NAME='"+url_nova.redir+"'></A>")), aux) ;
					aux2.innerHTML = aux.innerHTML ;
					location.href = location.href ;
					aux = document.getElementsByName (url_act.redir) [0] ;
					aux.parentNode.replaceChild ((aux2 = document.createElement ("<A NAME='"+url_act.corte [3]+"'></A>")), aux) ;
					aux2.innerHTML = aux.innerHTML ;
									} else {
					aux.name = url_act.redir ;
// 					aux.setAttribute ('name', url_act.redir) ;
					location.href = location.href ;
					
					setTimeout (function () {
						document.getElementsByName (url_act.redir) [0].name = url_act.corte [3] ;
										},0) ;
				}
			}
		},
		carga: function (notificacion) {
			notificacions_carga.splice (dojo.indexOf (notificacions_carga, notificacion), 1) ;
			if (notificacions_carga.length) return ;
			if (dojo.config.isDebug && dojo.isKhtml || dojo.isChrome) var retardo = 500 ; else var retardo = 0 ;
// 			document.title = url_nova.perma ;
		if (this.carga_inicial) {	
			conexion = {
							url : '/ajax'+url_act.perma
						}

						conexion_obx = new recarga (conexion) ;
// 						if (url_nova.corte [3].length)
							conexion_obx.carga_fin = [__inst, 'post_carga'] ;
						conexion_obx.iniciar() ;
			
		} else
			setTimeout (function() {__inst.ancora() ;},retardo) ;
			dojo.connect (document, 'click', __inst, 'pinchar') ;
			if (dojo.isIE)
				dojo.connect (document, 'keypress', __inst, 'pinchar') ;
			disparador = setTimeout (function() {__inst.escoitar() ;}, 500) ;
			arrincando() ;
		},
		ie_tit: function() {
			this.ie_ok = 1 ;
			
			//ie_historial.document.title=url_act.perma ;
		},
		modo: function() {
			deixar_boia ('modo', 'compatible') ;
			location.replace (url_act.perma) ;
		},
		url:function() {
			return url_act.corte ;
		}
	} ;
	function __constr() {
		if (! compatible()) return ;
		__inst = this ;
		dojo.addOnWindowUnload (function() {
			__inst.saida() ;
		}) ;
		//alert ('entrando :\n'+document.cookie) ;
		re_virtualizar_ancora = new Array (/^https?:\/\/[^/]+\/#(\/(?:[^!$])*?)?(?:\/?!\/?((?:[^$])*?))?(?:\/?\$\/?(.*))?$/, '#anc#$1/!/$2/$$/$3') ;
		re_virtualizar_orix = new Array (/^https?:\/\/[^/]+(\/(?:[^?#])*?)\/?(?:\?([^#]*))?(?:#\/?(.*))?$/, '#abs#$1/!/$2/$$/$3') ;
		re_cortar = new Array (/#(anc|abs)#(.*)\/!\/(.*)\/\$\/(.*)$/, '$1#@#$2#@#$3#@#$4') ;
		equipo = location.protocol+'//'+location.host ;
		url_nova.virt = this.virtualizar (location.href) ;
		url_nova.corte = this.cortar (url_nova.virt) ;
		url_nova.redir = this.redir (url_nova.corte) ;
		url_nova.perma = this.perma (url_nova.corte) ;
		//deixar_boia ('ajax_inicial', url_nova.perma) ;
		deixar_boia ('ajax_inicial', url_nova.perma.replace (/^(.*)#.*$/, '$1')) ;
		


		//alert (url_nova.perma) ;
		//alert (apanhar_boia ('ajax_inicial')) ;
		//alert (document.cookie) ;
		//return ;
		if (dojo.isIE)
			deixar_boia ('body_id', 'ie') ;
		else
			deixar_boia ('body_id', 'w3c') ;
				if (equipo +'/#'+ url_nova.redir != location.href) {
 			//alert (321) ;
// 			return ;
			this.forzar_recarga (url_nova) ;
			return ;
		} else {
 			//alert (url_nova.virt+'x'+url_nova.corte+'x'+url_nova.redir+'x'+url_nova.perma) ;
		}
		
		url_act = dojo.clone (url_nova) ;
		if (dojo.isIE) {
			document.write ('<iframe style="display:none" onload="url.ie_tit();" name="ie_historial" id="ie_historial" src="/ie'+url_act.redir+'"></iframe>') ;
		}// display:block ; height:40px ; position:absolute ; z-index:100
				//if (equipo +'/#'+ url_nova.redir == location.href) {
		//console.log (url_act) ;
		//Filtrar parte da ancora na comparacion : !!!!!!!!!!!!!!!!!!!!!
		if (url_nova.perma.replace (/#.*$/, '') != ''.replace (/#.*$/, '')) {
			//alert (url_nova.perma+'qq'+''+'qq'+'') ;	
			this.carga_inicial = 1 ;
		}
		//}
				dojo.addOnLoad (function() {
			__inst.carga ('onload') ;
		}) ;
	}
	__constr.prototype = __pub ;
	new __constr() ;
	return __inst ;
})() ;
var recarga = (function () {
	var cargando, animando, animando2 ;
	var __pub = {
		iniciar: function() {
			var __inst = this ;
			if (typeof cargando != 'undefined')
				cargando.deferred.cancel() ;
			cargando = this ;
			document.body.style.cursor = 'wait' ;
			document.body.style.cursor = 'progress' ;
			this.deferred = this.envio (this.datos).addCallback (__inst, 'cargado').addErrback (__inst, 'erro') ;
		},
		cargado: function (resposta) {
// 			alert (123) ;
			cargando = undefined ;
			this.resposta = resposta ;
			if (typeof animando != 'undefined') {
				animando2 = this ;
				return ;
			}
			animando = this ;
			__constr.animar() ;
		},
		animado: function() {
			if (typeof animando2 != 'undefined') {
				animando = animando2 ;
				animando2 = undefined ;
				__constr.animar() ;
			} else {
				var i ;
				for (i=0 ; i<(scripts = animando.resposta.getElementsByTagName ('script')).length ; i++) {
					var script = document.createElement ('script') ;
					script.text = scripts [i].firstChild.data ;
					try {
						document.body.appendChild (script) ;
					} catch (e) {/*alert (e.message) ;*/}
				}
				//alert (animando.resposta.getElementsByTagName ('titulo').length) ;
				var titulo = animando.resposta.getElementsByTagName ('titulo') ;
				//if ((titulo = animando.resposta.getElementsByTagName ('titulo')).length)
				if (titulo.length)
					var volta = {titulo : titulo [0].firstChild.data} ;
				else
					var volta = {} ;
				animando = undefined ;
				document.body.style.cursor = 'auto' ;
				if (this.carga_fin.length == 2)
					this.carga_fin [0][this.carga_fin [1]] (volta);
			}
		},
		erro: function (mensaxe) {
			if (mensaxe == 'Error: xhr cancelled') return ;
			cargando = undefined ;
//PUTO explorer !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// 			alert ('Erro ajax : '+mensaxe) ;
		},
		carga_fin:[]
	}
	function __constr (datos) {
		this.datos = datos ;
		datos.handleAs='xml' ;
		if (typeof datos.form != 'undefined')
			this.envio = dojo.xhrPost ;
		else
			this.envio = dojo.xhrGet ;
// 		this.carga_fin = carga_fin ;
	}
	//como volcar un obxecto de elementos públicos __pub_stat a constructor?
	__constr.animar = function() {
		var __inst = this ;
		var nodos = animando.resposta.getElementsByTagName ('html') ;
		//var cont = cont2 = nodos.length ;
		var consulta = [] ;
		var consulta2 ;
		for (i=0 ; i<nodos.length ; i++) {
			consulta.push (nodos [i].getAttribute ('id')) ;
		}
		if (consulta.length) {
			//consulta = '#'+consulta.join (', #') ;
			if (dojo.isIE)
			consulta = '#'+consulta.join (', #') ;//  +', .filigrana_barra, .filigrana-v, .base_filig, .filigrana-cd' ;//.filigrana
			else
			consulta = '#'+consulta.join (', #') ;//+', .filigrana_barra, .filigrana-v, .base_filig, .filigrana-cd' ;//.filigrana
		} else {
			animando.animado() ;
			return ;
		}
		consulta2 = dojo.query (consulta) ;
		var cont = cont2 = consulta2.length ;
// 		alert (dojo.query (consulta).length);

// 		this.anim_ondas = new dojo._Animation({
// //                         curve: this,
//                         duration:500/*,
//                         delay:1,
//                         rate:freq,
//                         repeat:-1*/
//                 }) ;
		var anim_1 = consulta2.fadeOut({
			duration:500,
			delay:300,
			onEnd: function(){
				cont -- ;
				if (! cont) {
					for (i=0 ; i<nodos.length ; i++) {
						try {
							document.getElementById (nodos [i].getAttribute ('id')).innerHTML = nodos [i].childNodes[0].nodeValue ;
						} catch (e) {
							alert (document.getElementById (nodos [i].getAttribute ('id')).nodeName) ;
							alert (nodos [i].childNodes[0].nodeValue) ;
						}
				}
					document.getElementById ('ajaxfiligranas').href = document.getElementById ('ajaxfiligranas').href.replace (/\?.*$/, '')+'?'+Math.random() ;
					anim_2.play() ;
				}
			}
		}) ;
		var anim_2 = consulta2.fadeIn({
			duration:500,
			delay:300,
			onEnd: function(){
				cont2 -- ;
				if (! cont2) {
					animando.animado() ;
				}
			}
		}) ;
		anim_1.play() ;
		return ;
		var nodo = animando.resposta.getElementsByTagName ('html') [0] ;
		var anim_1 = dojo.fadeOut({
			duration:500,
			node: document.getElementById (nodo.getAttribute ('id')),
			onEnd: function(){
				document.getElementById (nodo.getAttribute ('id')).innerHTML = nodo.childNodes[0].nodeValue ;
				anim_2.play() ;
			}
		}) ;
		var anim_2 = dojo.fadeIn({
			duration:500,
			node: document.getElementById (nodo.getAttribute ('id')),
			onEnd: function(){
				animando.animado() ;
			}
		}) ;
		anim_1.play() ;
	}
	__constr.prototype = __pub ; //posiblemente haxa que clonar __pub antes de prototipalo (non singleton)
	return __constr ;
})() ;
function menu (url_nova) {
// 	document.getElementById ('ajaxfiligranas').href = document.getElementById ('ajaxfiligranas').href.replace (/\?.*$/, '')+'?'+Math.random() ;
	
	if ('' != 'ver')
		return ;
	
	var menu = document.getElementById ('menu') ;
	var obx1 = obx2 = menu ;
	url_nova = url_nova [1].split('/') ;
	url_act = url.url()[1].split('/') ;
	/*if (document.getElementById (url_nova [0]) == null) {
		var historial = document.getElementById ('historial') ;
		historial.style.display = 'inherit' ;
		historial = historial.getElementsByTagName ('ul') [0] ;
		var aux = document.createElement ('li') ;
		var aux2 = document.createElement ('a') ;
		aux2.href=url_nova ;
		aux2.innerHTML = url_nova ;
		aux.appendChild (aux2) ;
		historial.appendChild (aux) ;
		
}*/
var hist=0 ;
	for (i=1 ; i<=3 ; i++) {
		if (i<url_act.length && url_act [i].length) {
			var obx1 = document.getElementById ('historial') ;
			if (obx1 != null && obx1.className.indexOf ('activo') >= 0)
				obx1.className = obx1.className.replace ('activo', '') ;
			if (i == 1) {
				var obx1 = document.getElementById ('historieando_'+url_act [1]) ;
				if (obx1 != null && obx1.className.indexOf ('activo') >= 0) {
					hist = 1 ;
					obx1.className = obx1.className.replace ('activo', '') ;
					var obx1 = document.getElementById (url_act [1]) ;
					if (obx1 != null && obx1.className.indexOf ('activo') >= 0)
						obx1.className = obx1.className.replace ('activo', '') ;
				}
			}
			if (! hist) {
				if (url_act [1] == 'procurar') {
					if (i==1)
						var obx1 = document.getElementById ('procurar') ;
					else if (i==2) {
						var obx1 = document.getElementById ('procurando_'+url_act [i]) ;
						obx1.className = obx1.className.replace ('activo', '') ;
						var obx1 = document.getElementById ('historial_procuras') ;
						obx1.className = obx1.className.replace ('activo', '') ;
					}
				} else
					var obx1 = document.getElementById (url_act [i]) ;
				obx1.className = obx1.className.replace ('activo', '') ;
				var aux ;
				if ((aux = obx1.parentNode.getAttribute ('menu_pos')) && aux.length) {
					obx1.getElementsByTagName ('a') [0].style.top=aux ;
					new menus ('menu').ultimo = 0 ;
				}
			}
		}
		/* else if (i<url_act.length + 1) { //Polo famoso listado!!!!!
			obx1 = obx1.getElementsByTagName ('li') [0] ;
			obx1.className = obx1.className.replace ('activo', '') ;
		}*/
		if (i<url_nova.length && url_nova [i].length) {
			/*if (i == 2  && url_nova [1] == 'procurar')
			var obx2 = document.getElementById ('procura_caixa') ;
			else*/
			if (url_nova [1] != 'procurar' || i == 1 ) {
				var obx2 = document.getElementById (url_nova [i]) ;
				//if (obx2 != null)
				if (obx2 == null) return ;//console.log (url_nova+'x'+url_nova [i]) ;
				obx2.className = obx2.className.replace (/(activo)?/, 'activo') ;
				obx2.getElementsByTagName ('a') [0].style.top=0 ;
			}
		}/* else if (i<url_nova.length + 1) {
			obx2 = obx2.getElementsByTagName ('li') [0] ;
			obx2.className = obx2.className.replace (/(activo)?/, 'activo') ;
		}*/
	}
// 	var punt = menu ;
// 	for (i=0 ; i<3 ; i++) {
// 		punt = punt.getElementsByTagName ('ul') [0]
// 		for (j in punt.childNodes) {
// 			if (punt.childNodes [i].nodeName == 'LI' && punt.childNodes [i].className.match ('activo')) {
// 				alert (123) 
// 			}
// 		}
// 	}
}

