
//*** tamaño y tipo de letra. Variables modificables (exp)
var lletraDe = '10' // Tamaño de letra en el mapa
var tipoLetra = 'arial' // Tipo de letra en el mapa
var lletraDeEnlaces = '11' // Tamaño de letra en el listado de enlaces
var tipoLetraEnlaces = 'verdana' // Tipo de letra en el listado de enlaces
var listadoEnlaces = 'si' // si o no para no mostrar o no el listado de enlaces
var tituloEnlaces = 'Listado de enlaces del mapa' // título del listado de enlaces
var varTarget = '_top' // target para los enlaces

// ***************************** (exp)
// Funcions i variables compartides editar mapa i vicualitzar mapa (exp)

var dataArraymcn;
var modificacionsInstmcn;
var dadesMapaBrutesmcn;
var idMajormcn = 0;
var entratAlEditor = false;
var arrayValorsMapa = new Array();

function createArraymcn(){
	arrayDadesMapa = dadesMapaBrutesmcn.split('×');
	return(arrayDadesMapa);
}

// ***************************** (exp)
// Funcio per visualitzar mapa sese editar

function mostrarMapacn(nodeXMLDoc){
	if(document.all){
		dadesMapaBrutesmcn = generarCodiMapa(nodeXMLDoc);
		dataArraymcn = createArraymcn();
		arrel = dataArraymcn[1];
		nodeInicial = dataArraymcn[2];

		modificacionsInstmcn = new Object();
		modificacionsInstmcn.editarOMapaOCodi = '-';
	
		arrayValorsMapa = posaEnUnDobleArray(dataArraymcn[0]);
		arbreInst = new arbreObj(nodeInicial);

		document.write(arbreInst.pintaArbreEditable());
	}
}

// ********************* (exp)
// Visualitzar mapa

function arbreObj(nodeInicialId){
	this.nodeInicialId = nodeInicialId;

	this.idActiu;
	this.pareActiu;
	this.textActiu;
	this.tipusVerticalActiu;
	this.tipusHoritzontalActiu;
	this.tipusNodeActiu;
	this.arrayFillsActiu;
	this.tipusVerticalNodeAnterior;
	this.tipusHoritzontalNodeAnterior;		
	this.pintaArbreEditable = pintaArbreEditable;
	this.pintaNode = pintaNode;
	
	this.temp = '';
	
	this.pintaObrirNode = pintaObrirNode; 
	this.pintaTancarNode = pintaTancarNode;

	this.comptaFills = comptaFills;
	this.posaFillsALaPila = posaFillsALaPila;
	
	this.push2 = push2;
	this.pop2 = pop2;

	this.pilaId = new Array();
	this.pilaTipusHoritzontal = new Array();
	
	this.esUltim = esUltim;
	this.esPrimer = esPrimer;
	this.creaLlistatLinks = creaLlistatLinks;
	this.posaColor = posaColor;
	this.numeroDeColor = 0;
}

function push2(idNode, tipusH){
	this.pilaId.push(idNode);
	this.pilaTipusHoritzontal.push(tipusH);
}

function pop2(){
	var idNode = this.pilaId.pop();
	var tipusH = this.pilaTipusHoritzontal.pop();
	var arrayTopPila = new Array();
	arrayTopPila[0] = idNode;
	arrayTopPila[1] = tipusH;	
	return arrayTopPila;
}

function pintaArbreEditable(){
	this.temp = '';
	this.temp += '<table><tr><td>';
	this.temp += '<table border="1" cellspacing="0" cellpadding="8" bordercolor="#EEEEEE"><tr><td align="center">';

	this.push2(this.nodeInicialId, '0');
	while(this.pilaId.length>0){this.pintaNode()};

	this.temp += '</td></tr></table>';
	this.temp += '<div align="right"><font size=1 face=verdana><a href="http://www.mapasconceptuales.com" style="text-decoration: none; color: #CCCCCC" target="_blank">www.mapasconceptuales.com</a></font></div>';
	this.temp += '</td></tr></table>';

	return this.temp;
}

function pintaNode(){
	var arrayTopPila = this.pop2();
	if(arrayTopPila[0]==0){this.pintaTancarNode()}
	else {
		 this.idActiu = arrayTopPila[0];

		if (this.idActiu.indexOf('id')==0){
			numero = this.idActiu.substring(2,this.idActiu.length);
			if (isNaN(numero)) {}
			else {if (parseInt(numero) > idMajormcn) idMajormcn = numero;}
		}

		 this.pareActiu = arrayValorsMapa[this.idActiu][2];
		 this.textActiu = arrayValorsMapa[this.idActiu][3];
  	 this.tipusHoritzontalActiu = arrayTopPila[1];
		 this.tipusNodeActiu = arrayValorsMapa[this.idActiu][5];
		 this.arrayIdFillsActiu = arrayValorsMapa[this.idActiu].slice(6,16);
	 	 this.arrayIdFillsActiu.reverse();
		 if (this.idActiu == this.nodeInicialId){this.tipusVerticalActiu='1'}
		 else {
			 if (this.comptaFills()>0)this.tipusVerticalActiu='2';
			 if (this.comptaFills()==0)this.tipusVerticalActiu='3';
		 }
		 this.posicioEspecial = arrayValorsMapa[this.idActiu][36];	
		 this.pintaObrirNode();
	if (this.comptaFills()>0){this.posaFillsALaPila()}
	else{this.pintaTancarNode()};
	}
}

function esPrimer(){
	if (this.idActiu == this.nodeInicialId) {return true}
	else {return (arrayValorsMapa[this.pareActiu][6] == this.idActiu)}
}

function esUltim(){
	if (this.idActiu == this.nodeInicialId) {return true}
	else {
		 var arrayTemp = arrayValorsMapa[this.pareActiu].slice(6,16);
		 arrayTemp.reverse();
		 for (i=0; i<10; i++){if (arrayTemp[i] != '-')break};
		 return (arrayTemp[i] == this.idActiu);
		}
}

function comptaFills(){
	var comptador = 0;
	for (i=0; i<10 ; i++){if (this.arrayIdFillsActiu[i] != '-')comptador++};
	return comptador;
}

function posaFillsALaPila(){
	this.push2(0, '0');
	for (r=0; r<10 ; r++){
		if (this.arrayIdFillsActiu[r]!='-'){this.push2(this.arrayIdFillsActiu[r], '0')}	
	}
}

function pintaTancarNode(){	
	temp = '';
	temp += '</td>';
	temp += '</tr>';
	temp += '</table>';
	temp += '</td>';
	temp += '</tr>';
	temp += '</table>';
	this.temp += temp;
}

function posaColor(){
	var arrayDeColors = new Array();
	//**blau
	arrayDeColors[0] = 'CCCCFF';
	//**rosa fluix
	arrayDeColors[1] = 'FFCCCC';
	//**verd blau
	arrayDeColors[2] = 'CCFFFF';
	//**crema
	arrayDeColors[3] = 'FFFFCC';
	//**gris
	arrayDeColors[4] = 'EEEEEE';
	//**verd fuix
	arrayDeColors[5] = 'CCFFCC';
	//**merda oca
	arrayDeColors[6] = 'CCCC99';
	//**blau
	arrayDeColors[7] = '99CCFF';
	//**salmó
	arrayDeColors[8] = 'FFCC99';

	if (this.tipusNodeActiu=='concepto') this.numeroDeColor++;
	if (this.numeroDeColor>8) this.numeroDeColor = 0;
	return (arrayDeColors[this.numeroDeColor]);
}

//var compta = 0;

function pintaObrirNode(){ 
	//**primer fill
	var idPare = arrayValorsMapa[this.idActiu][2];
	var idPrimerFill = arrayValorsMapa[idPare][6];
	//**node inicial
	if (idPare == this.idActiu) arrayValorsMapa[idPrimerFill]['color'] = 'CCCCFF';
	if (!(arrayValorsMapa[idPrimerFill]['color'])){
		arrayValorsMapa[idPrimerFill]['color'] = this.posaColor();
	} else {arrayValorsMapa[this.idActiu]['color'] = arrayValorsMapa[idPrimerFill]['color']}

	temp = '';
	if (!this.esPrimer()){
		temp += (this.posicioEspecial == 'vertical')? '':'</td><td align=center>';
	}

	temp += '          <table border="0" cellspacing="0" cellpadding="0">';
	temp += '          <tr valign="top"> ';
	if(this.posicioEspecial == 'vertical'){
		temp += '<td colspan="2" width=1></td><td colspan="2" width=1></td>';
	} else {
		temp += (this.esPrimer() && this.esUltim())? '<td colspan="2" width=1></td><td colspan="2" width=1></td>':'';
		temp += (this.esPrimer() && !this.esUltim())? '<td colspan="2" width=1></td><td colspan="2" bgcolor="#333333" width=1></td>':'';
		temp += (!this.esPrimer() && this.esUltim())? '<td colspan="2" bgcolor="#333333" width=1></td><td colspan="2" width=1></td>':'';
		temp += (!this.esPrimer() && !this.esUltim())? '<td colspan="2" bgcolor="#333333" width=1></td><td colspan="2" bgcolor="#333333" width=1></td>':'';
	}
	temp += '          </tr>';
	temp += '          <tr valign="top"> ';
	temp += '            <td align="center" colspan="1" rowspan="4" width=2 height="3"></td>';
	temp += (this.tipusVerticalActiu == '1')? '<td align="center" colspan="2"></td>':'<td align="center" colspan="2">' + liniaVertical() + '</td>';
	temp += '            <td align="center" colspan="1" rowspan="4" width=2 height="3"></td>';
	temp += '          </tr>';
	temp += '          <tr valign="top"> ';
	temp += '            <td align="center" colspan="2" style="font-family: '+ tipoLetra +'; font-size: '+ lletraDe +'px; white-space: nowrap; word-spacing: 1px; text-decoration: none;"> ';
	temp += (this.tipusNodeActiu=='concepto')? '<table border="1" cellspacing="0" cellpadding="2" bordercolor="#BBBBBB">':'';
	temp += (this.tipusNodeActiu=='concepto')? '<tr valign="top">':'';
	temp += (this.tipusNodeActiu=='concepto')? '<td style="font-family: '+ tipoLetra +'; font-size: '+ lletraDe +'px; white-space: nowrap; word-spacing: 1px; text-decoration: none;" align="center" bgcolor="#'+ arrayValorsMapa[this.idActiu]['color'] +'">':''; 

	if ((this.tipusNodeActiu=='concepto')&&(arrayValorsMapa[this.idActiu][16]!='-')){
		temp += (modificacionsInstmcn.editarOMapaOCodi == 'editar')? '<a href="javascript:onpleCapaLinks(' :  '<a href="javascript:onpleCapaLinks('
		temp += '\'' + this.idActiu + '\')">' + trancarString(this.textActiu) + '</a>'
		} else {temp += '<font color="#000000">' + trancarString(this.textActiu) + '</font>'}

	if((this.tipusNodeActiu=='concepto')&&(modificacionsInstmcn.editarOMapaOCodi == 'editar')){	
  	temp += ' <br><a href="javascript:formulariMapaInst.idConcepte = \'' + this.idActiu + '\'; '
  	temp += ' modificacionsInstmcn.editarOMapaOCodi = \'editarUn\'; '
  //	temp += ' escriuCapamcn(creacioFormulariModificarmcn()); '
  //	temp += ' posaAlFormulariElsValorsDelsCampsmcn();
  	temp += 'canviAVeuremcn();'
  	temp += '"><img border="0" src="plum2.gif" width="15" height="15"></a>'
	}

	temp += (this.tipusNodeActiu=='concepto')? ' ':'';
	temp += (this.tipusNodeActiu=='concepto')? '</td>':'';
	temp += (this.tipusNodeActiu=='concepto')? '</tr>':'';
	temp += (this.tipusNodeActiu=='concepto')? '</table>':'';
	temp += '            </td>';
	temp += '          </tr>';
	temp += '          <tr valign="top"> ';

//	temp += ((this.comptaFills()>1)&&(true))? '<td align="center" colspan="2">' + liniaVertical() + '</td>':'<td align="center" colspan="2"></td>';

	if (this.comptaFills()>1){
			temp += (arrayValorsMapa[this.arrayIdFillsActiu[9]][36]!='vertical')? '<td align="center" colspan="2">' + liniaVertical() + '</td>' : ''
	} 
//else {temp += '<td align="center" colspan="2"></td>'};

	temp += '</tr>';
	temp += '<tr valign="top">';
	temp += '<td align="center" colspan="2">';
	temp += '<table border="0" cellspacing="0" cellpadding="0" bordercolor=red>';
	temp += '<tr valign="top" valign=top>';
	temp += '<td align="center">';
	this.temp += temp; 
}

function capesMapaEditor(){
	temp = '';
	temp += '<div id="capaLinks1" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks2" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks3" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks4" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks5" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks6" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks7" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks8" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks9" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	temp += '<div id="capaLinks10" style="position:absolute; left: 100; top: 100; z-index=2"></div>\n';
	if(!(document.all['capaLinks1'])) document.write(temp)
}

if(document.all)capesMapaEditor()

function empaquetarMapa(){
	var temp = '';
//	var itemActiu = arrel;
//	while(arrayValorsMapa[itemActiu]!=null)

	for(var indexPle in arrayValorsMapa){
		if(arrayValorsMapa[indexPle].length<37){arrayValorsMapa[indexPle][36] = 'normal'}
		if(arrayValorsMapa[indexPle][0]!='esborrat'){
			for (i=0; i<37 ; i++){
				temp += arrayValorsMapa[indexPle][i] + 'Ø';
			}
			temp = temp.substring(0, temp.length-1);
			temp += 'æ';
		}
	}
	temp = temp.substring(0, temp.length-1);
	return temp;
}

function posaEnUnDobleArray(temporal){
	var arrayFinal = new Array();
	arrayDeItems = temporal.split('æ');
	for (i=0; i<arrayDeItems.length; i++){
		arrayDeValorsItem = arrayDeItems[i].split('Ø');
		arrayFinal[arrayDeValorsItem[1]] = arrayDeValorsItem;
	}
	return arrayFinal
}

function trancarString(temp){
	if ((temp.length > 13) && (temp.indexOf(' ') != -1)){
		puntDeTrancamentInicial = parseInt(temp.length/2);
		fragmentInicial = temp.substring(0,puntDeTrancamentInicial);
		fragmentFinal = temp.substring(puntDeTrancamentInicial, temp.length);

		if (fragmentInicial.indexOf(' ')!=-1){
			ultimBlancFragmentInicial = fragmentInicial.lastIndexOf(' ')
			ultimBlancFragmentInicialContatPelFinal = fragmentInicial.length - ultimBlancFragmentInicial -1;
		} else {ultimBlancFragmentInicialContatPelFinal = 100}

		if (fragmentFinal.indexOf(' ')!=-1){
			primerBlancFragmentFinal = fragmentFinal.indexOf(' ')
		} else {primerBlancFragmentFinal = 100}

		puntDeTrancament = (ultimBlancFragmentInicialContatPelFinal <= primerBlancFragmentFinal)? ultimBlancFragmentInicial : fragmentInicial.length + primerBlancFragmentFinal;

		tempFinal = temp.substring(0, puntDeTrancament);
		tempFinal += '<br>';
		tempFinal += temp.substring(puntDeTrancament+1, temp.length);
		return tempFinal;
	} else return temp
}

function liniaVertical(){
	temp = '';
	temp += '<table border="0" cellspacing="0" cellpadding="0">'
	temp += '  <tr>'
	temp += '    <td width=5></td>'
	temp += '    <td width=1 height=10 bgcolor="#000000"></td>'
	temp += '    <td width=5></td>'
	temp += '  </tr>'
	temp += '</table>'
	return temp
}

function creuTancar(capaActivaId){
	var temp = ''
	temp = ''
	temp += '<table style="cursor: hand" border="0" cellspacing="0" cellpadding="0" onClick="buidaCapaLinks('+ capaActivaId +')">\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += ' <tr>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += '  <td width=1 height=1 bgcolor="#000000"></td>\n'
	temp += ' </tr>\n'
	temp += '</table>\n'
	return 	temp
}

// ****************************** (exp)
// ** Llistat de lligams

if(document.all){
	document.onclick = controladorClick;
	document.onkeydown = controladorPitjarTecla;
	document.onkeyup = controladorDesPitjarTecla;	

	var tope = 0;
	var lefte = 0;
	var capaActivaId = 1;
	var teclaControl = false;
}

function controladorPitjarTecla(){
	if (event.ctrlKey) teclaControl = true;
}

function controladorDesPitjarTecla(){
	teclaControl = false;
}

function controladorClick(){
		tope = event.clientY + document.body.scrollTop;
		lefte = event.clientX + document.body.scrollLeft;
		if(document.all && entratAlEditor){
				 var lligamForaEditor = false
 		 		 if (window.event.srcElement.tagName == "A"){
							 	lligamForaEditor = ((window.event.srcElement.href.indexOf('http://')!=-1)||
																		 (window.event.srcElement.href.indexOf('file:///')!=-1))
								if (lligamForaEditor){
									 var frase = ''
									 frase += "Si abandona el editor se borrará el mapa que haya realizado.\n"
									 frase += "¿Está seguro/a que desea activar el enlace y salir del editor?\n\n"	
									 frase += "Pulse en \"Cancelar\" para permanecer en el editor."							
									 if (!confirm(frase)) {
											event.returnValue = false
									 }
								}
					}
		}
}

function onpleCapaLinks(id){
	if (capaActivaId == 10){capaActivaId = 1}
	else {if(teclaControl){capaActivaId = capaActivaId+1}}
	eval('document.all.capaLinks' + capaActivaId + '.style.top = tope;');
	eval('document.all.capaLinks' + capaActivaId + '.style.left = lefte;');
	eval('document.all.capaLinks' + capaActivaId + '.style.border = "solid #555555 1px";');
	eval('document.all.capaLinks' + capaActivaId + '.style.backgroundColor = "#EEEEEE";');
	eval('document.all.capaLinks' + capaActivaId + '.style.fontFamily = "arial";');
	eval('document.all.capaLinks' + capaActivaId + '.style.fontSize = "7px";');
	eval('document.all.capaLinks' + capaActivaId + '.style.paddingBottom = "4px";');
	eval('document.all.capaLinks' + capaActivaId + '.style.paddingLeft = "2px";');
	eval('document.all.capaLinks' + capaActivaId + '.style.paddingRight = "2px";');
	eval('document.all.capaLinks' + capaActivaId + '.style.paddingTop = "2px";');
	eval('document.all.capaLinks' + capaActivaId + '.innerHTML = creaLlistatLinks(id, capaActivaId);');
}

function buidaCapaLinks(capaActivaId){
	eval('document.all.capaLinks' + capaActivaId + '.style.border = "";');
	eval('document.all.capaLinks' + capaActivaId + '.style.padding = "";');
	eval('document.all.capaLinks' + capaActivaId + '.innerHTML = "";');
}

function buidaTotesCapesLinks(){
	for(k=1; k<11; k++){buidaCapaLinks(k)}
}

function creaLlistatLinks(id, capaActivaId){
	temp = '';
	temp += '<table border=0 cellpadding="0" cellspacing="0">';

	for (var w=16; w<26 ; w++){
		if (arrayValorsMapa[id][w] != '-'){
			temp += '<tr>';
			temp += (w==16)? '<td>' : '<td colspan=3>';

			var arrayEnllac = posaEtiquetaIEnllac(id, w+10)
			temp += '<font face="verdana" size="1">&bull; <a href="' + arrayEnllac[1] + '" '+ arrayEnllac[3] +'>' + arrayEnllac[0] + '</a></td>';
			
			if(w==16){
				temp += '<td width=8 height="1"></td><td align="right">' + creuTancar(capaActivaId) + '</td>';
			}
			temp += '</tr>';
		}
	}

	temp += '</table>';
	return temp;
}

//***************************** (exp)
//** Ampliació dels metods de Array

if (Array.prototype.push && ([0].push(true)==true)) Array.prototype.push = null;

if(!Array.prototype.push) {
    function array_push() {
        for(i=0;i<arguments.length;i++){
            this[this.length] = arguments[i];
        }
        return this.length;
    }
    Array.prototype.push = array_push;
}

if(!Array.prototype.pop) {
    function array_pop(){
        lastElement = this[this.length-1];
        this.length = Math.max(this.length-1,0);
        return lastElement;
    }
    Array.prototype.pop = array_pop;
}

//***************************** (exp)
//** Métodes pel Netscape

function comentaInici(){if(!document.all)document.write('<!-- ')}
function comentaFinal(){if(!document.all)document.write(' -->')}

// ***************************** (exp)
// Obencio de les dades a la font topic map

var arrayIdOrdre = new Array();
var arrayIdOrdreFills = new Array();
var arrayIdOrdrePare = new Array();

var arrayIdIdFills = new Array();
var arrayIdIdPare = new Array();

var arrayIdText = new Array();
var arrayIdTipus = new Array();
var llistatOcurrencesTipus = new Array();
var llistatOcurrencesHrefoData = new Array();

var arrel_;
var nodeInicial_;

var nodeXMLDoc;
var nodeTopicMap;

function obtePare(nodeObjAss){
	for(var j=0;j<nodeObjAss.childNodes.length;j++){
		if (nodeObjAss.childNodes[j].tagName == 'member'){
			for(var k=0;k<nodeObjAss.childNodes[j].childNodes.length;k++){
				if (nodeObjAss.childNodes[j].childNodes[k].tagName == 'roleSpec'){
					if (nodeObjAss.childNodes[j].childNodes[k].firstChild.getAttribute("xlink:href") == '#father'){
						//** Ara cal anar al avi per trobar un tiet
						nodeRef = obtePrimerFillAmbEtiqueta(nodeObjAss.childNodes[j], 'topicRef');
						refPare = nodeRef.getAttribute("xlink:href");
						refPareNet = refPare.substring(1, refPare.length);
						return(refPareNet);
					}
				}	
			}
		}
	}
	return '';
}

function obteFills(nodeObjAss){
	llistatFills = new Array();
	for(var j=0;j<nodeObjAss.childNodes.length;j++){
		if (nodeObjAss.childNodes[j].tagName == 'member'){
			for(var k=0;k<nodeObjAss.childNodes[j].childNodes.length;k++){
				if (nodeObjAss.childNodes[j].childNodes[k].tagName == 'roleSpec'){
					if (nodeObjAss.childNodes[j].childNodes[k].firstChild.getAttribute("xlink:href") == '#child'){
						//** Ara cal anar al avi per trobar un tiet
						nodeRef = obtePrimerFillAmbEtiqueta(nodeObjAss.childNodes[j], 'topicRef');
						refFill = nodeRef.getAttribute("xlink:href");
						refFillNet = refFill.substring(1, refFill.length);
						llistatFills.push(refFillNet);
					}
				}	
			}
		}
	}
	return llistatFills;
}

function obteEtiquetaAssociacio(nodeObjAss){
	instanciaDeObj = obtePrimerFillAmbEtiqueta(nodeObjAss, 'instanceOf');
	topicRefObj = obtePrimerFillAmbEtiqueta(instanciaDeObj, 'topicRef');
	topicRef = topicRefObj.getAttribute("xlink:href");
	topicRefNet = topicRef.substring(1, topicRef.length);
	ordreClassObjAss= arrayIdOrdre[topicRefNet];
	classObjAss = nodeTopicMap.childNodes[ordreClassObjAss];
	return(obteText(classObjAss));
}

function obteText(nodeObj){
		baseNameObj = obtePrimerFillAmbEtiqueta(nodeObj, 'baseName');
		baseNameStringObj = obtePrimerFillAmbEtiqueta(baseNameObj, 'baseNameString');
		return (baseNameStringObj.firstChild.nodeValue);
}

function obtePrimerFillAmbEtiqueta(nodeObj, etiquetaFill){
	for(var j=0;j<nodeObj.childNodes.length;j++){
		if (nodeObj.childNodes[j].tagName == etiquetaFill){return nodeObj.childNodes[j]}
	}
	return '';
}

function obteInstanciaDe(nodeObjecte){
	varInstanciaDe = "";
	for(var i=0;i<nodeObjecte.childNodes.length;i++){
		if (nodeObjecte.childNodes[i].nodeName == "instanceOf"){
			varInstanciaDe = nodeObjecte.childNodes[i].firstChild.getAttribute("xlink:href");
			}
	}
	return (varInstanciaDe);
}

function obteResourceRef(nodeObjecte){
	varResourceRef = "";
	for(var i=0;i<nodeObjecte.childNodes.length;i++){
		if (nodeObjecte.childNodes[i].nodeName == "resourceRef"){
			varResourceRef = nodeObjecte.childNodes[i].getAttribute("xlink:href");
			}
	}
	return (varResourceRef)
}

function obteResourceData(nodeObjecte){
	resourceDataObj = obtePrimerFillAmbEtiqueta(nodeObjecte, 'resourceData');
	if (resourceDataObj) {return (resourceDataObj.firstChild.nodeValue)}
	else return '';
}

function afageixFill(idPare, idFill){
	ordreFill = arrayIdOrdre[idFill];
	cadenaFills = arrayIdOrdreFills[idPare];
	if(cadenaFills.indexOf('-')!=-1){
		novaCadenaFills = cadenaFills.substring(0,cadenaFills.indexOf('-'));
		novaCadenaFills	+= ordreFill;
		novaCadenaFills += cadenaFills.substring(cadenaFills.indexOf('-')+1,cadenaFills.length);
		arrayIdOrdreFills[idPare] = novaCadenaFills;
	}

	cadenaFills_ = arrayIdIdFills[idPare];
	if(cadenaFills_.indexOf('-')!=-1){
		novaCadenaFills_ = cadenaFills_.substring(0,cadenaFills_.indexOf('-'));
		novaCadenaFills_ += idFill;
		novaCadenaFills_ += cadenaFills_.substring(cadenaFills_.indexOf('-')+1,cadenaFills_.length);
		arrayIdIdFills[idPare] = novaCadenaFills_;
	}
}

function afageixPare(idFill, idPare){
	ordrePare = arrayIdOrdre[idPare];
	arrayIdOrdrePare[idFill] = ordrePare;
	arrayIdIdPare[idFill] = idPare;
}

function ompleArrayOccurrences(nodeObj, identificador){
	for(var j=0;j<nodeObj.childNodes.length;j++){
		if (nodeObj.childNodes[j].tagName == 'occurrence'){
			idTipusBrut = obteInstanciaDe(nodeObj.childNodes[j]);
			if(idTipusBrut!=""){
				IdTipusNet = idTipusBrut.substring(1, idTipusBrut.length);
				ordreTipus = arrayIdOrdre[IdTipusNet];
				tipusObj = nodeTopicMap.childNodes[ordreTipus];
				tipusText = obteText(tipusObj);
				llistatOcurrencesTipus[identificador].push(tipusText);
//				llistatOcurrencesTipus[identificador].push(IdTipusNet);
			}
			//** Muntatge per mantenir la compatibilitat cap enredera
			var varResourceRef = obteResourceRef(nodeObj.childNodes[j]);
			var varResourceData = obteResourceData(nodeObj.childNodes[j]);
			var varResource = (varResourceRef != '')? varResourceRef : varResourceData; 
			if ((varResourceRef != '')||(varResourceData != '')) llistatOcurrencesHrefoData[identificador].push(varResource);
		}
	}
}

function ompleArraysGenerals(){
	for(var i=0;i<nodeTopicMap.childNodes.length;i++){
		if(nodeTopicMap.childNodes[i].nodeTypeString != 'comment'){
			//** Inicialitza array de fills
			idObjecteActiu = nodeTopicMap.childNodes[i].getAttribute("id");
			arrayIdOrdreFills[idObjecteActiu] = "Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-";
			arrayIdIdFills[idObjecteActiu] = "Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-";
			//** Inicialitza array de pares
			arrayIdOrdrePare[idObjecteActiu] = '-';
			arrayIdIdPare[idObjecteActiu] = '-';
			//** Inicialitza array de links tipus y hrefs
			llistatOcurrencesTipus[idObjecteActiu] = new Array();
			llistatOcurrencesHrefoData[idObjecteActiu] = new Array();
			//** Inicialitza array general idOrdre;
			identificador = nodeTopicMap.childNodes[i].getAttribute("id");
			arrayIdOrdre[identificador] = i;
		}
	}
}

function ompleArraysPresIFills(){
	for(var i=0;i<nodeTopicMap.childNodes.length;i++){
		if(nodeTopicMap.childNodes[i].nodeTypeString != 'comment'){
			identificador = nodeTopicMap.childNodes[i].getAttribute("id");
			switch (nodeTopicMap.childNodes[i].nodeName){
				case "topic":
					arrayIdTipus[identificador] = 'concepto';
					arrayIdText[identificador] = obteText(nodeTopicMap.childNodes[i]);
					ompleArrayOccurrences(nodeTopicMap.childNodes[i], identificador);
					if(obteInstanciaDe(nodeTopicMap.childNodes[i]) == '#rootConcept'){
						afageixPare(identificador,identificador);
						arrel_ = arrayIdOrdre[identificador];
						arrel__ = identificador;
						nodeInicial_ = arrayIdOrdre[identificador];
						nodeInicial__ = identificador;
						}
					break
				case "association":
					arrayIdTipus[identificador] = 'conexión';
					arrayIdText[identificador] = obteEtiquetaAssociacio(nodeTopicMap.childNodes[i]);
					avi =  obtePare(nodeTopicMap.childNodes[i]);
					nets = new Array();
					nets = obteFills(nodeTopicMap.childNodes[i]);
					afageixFill(avi, identificador);
					afageixPare(identificador,avi);
					for(var t=0;t<nets.length;t++){
						afageixFill(identificador, nets[t]);
						afageixPare(nets[t],identificador);
					}
				break
			}
		}
	}
}

function generarCodiMapa(nodeXMLDoc){
	nodeTopicMap = nodeXMLDoc.getElementsByTagName("topicMap").item(0);
	ompleArraysGenerals();
	ompleArraysPresIFills();
	codiMapa = '';

	for(var i=0;i<nodeTopicMap.childNodes.length;i++){
		if(nodeTopicMap.childNodes[i].nodeTypeString != 'comment'){
			iden = nodeTopicMap.childNodes[i].getAttribute("id");

//			document.write('<p>*text ' + arrayIdText[iden] + '<br>');
//			document.write('*tipus ' + arrayIdTipus[iden] + '<br>');
//			document.write('*ordre ' + arrayIdOrdre[iden] + '<br>');
//			document.write('*fills ' + arrayIdOrdreFills[iden] + '<br>');
//			document.write('*pare ' + arrayIdOrdrePare[iden] + '<br>');
		
			codiMapa += '-Ø';

//			codiMapa += arrayIdOrdre[iden] + 'Ø';
			codiMapa += iden + 'Ø';

//			codiMapa += arrayIdOrdrePare[iden] + 'Ø';
			codiMapa += arrayIdIdPare[iden] + 'Ø';

			codiMapa += arrayIdText[iden] + 'Ø';
			codiMapa += '-Ø';
			codiMapa += arrayIdTipus[iden];

//			codiMapa += arrayIdOrdreFills[iden];
			codiMapa += arrayIdIdFills[iden];

			codiMapa += (llistatOcurrencesTipus[iden][0]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][0] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][1]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][1] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][2]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][2] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][3]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][3] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][4]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][4] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][5]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][5] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][6]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][6] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][7]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][7] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][8]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][8] : 'Ø-';
			codiMapa += (llistatOcurrencesTipus[iden][9]!=null) ? 'Ø'+llistatOcurrencesTipus[iden][9] : 'Ø-';

			codiMapa += (llistatOcurrencesHrefoData[iden][0]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][0] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][1]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][1] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][2]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][2] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][3]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][3] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][4]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][4] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][5]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][5] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][6]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][6] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][7]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][7] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][8]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][8] : 'Ø-';
			codiMapa += (llistatOcurrencesHrefoData[iden][9]!=null) ? 'Ø'+llistatOcurrencesHrefoData[iden][9] : 'Ø-';

			codiMapa += 'Ønormalæ';
		}
	}

	//** Cal trure l'últim æ
	codiMapa = codiMapa.substring(0,codiMapa.length-1) + '×' + arrel__ + '×' + nodeInicial__;
	return(codiMapa);
}

function generaLlistatDeLinks(){
		var idActiu = ''
		var idPare = ''
		var idAbuelo = ''
		var trobat = false
		var hiHalligams = false
		var arrayEtiquetaHttp = new Array()
    var temp = ''
		temp += '<table border=0 cellpadding="4" cellspacing="0" style="font-family:'+ tipoLetraEnlaces +'; font-size:'+ lletraDeEnlaces +'; color: #444444;">'
  	temp += '<tr><td style="font-size:14">'+ tituloEnlaces +'</td></tr>'
		
  	for(var indexString in arrayValorsMapa){
  		if((arrayValorsMapa[indexString][0]!='esborrat')&&(indexString!='pop')&&(indexString!='push')&&(arrayValorsMapa[indexString][16]!= '-')){
			  trobat = false
  			for (w=16; w<26 ; w++){					
      		if (arrayValorsMapa[indexString][w]!= '-'){
						 hiHalligams = true
  					 idActiu = arrayValorsMapa[indexString][1]
  					 idPare = arrayValorsMapa[indexString][2]
  					 idAbuelo = arrayValorsMapa[idPare][2]

 					 	 if(!trobat){
    					 temp += '<tr><td bgcolor="#EEEEEE">'
    					 
        			 temp += '<b>' + arrayValorsMapa[indexString][3] + '</b>'
     					 //temp += '<br>' 
     					 //temp += (idAbuelo!=idActiu)? '<font size=1>' : ''
     					 //temp += (idAbuelo!=idActiu)? arrayValorsMapa[idAbuelo][3] + ' ' : ''
    					 //temp += (idAbuelo!=idActiu)? arrayValorsMapa[idPare][3] + ' ' : ''
        			 //temp += (idAbuelo!=idActiu)? arrayValorsMapa[indexString][3].toLowerCase() : ''
     					 //temp += (idAbuelo!=idActiu)? '</font size=1>' : ''
							 
    					 temp += '</tr>'
  					 	}
					 
  					 temp += '<tr><td>'
						 arrayEtiquetaHttp = posaEtiquetaIEnllac(indexString, w+10)
						 
      			 temp += '&bull; ' + arrayValorsMapa[indexString][w] + ' : ' 
      			 temp += '<a href="'+ arrayEtiquetaHttp[1] +'" '+ arrayEtiquetaHttp[3] +'>' + arrayEtiquetaHttp[0] + '</a>'
      			 temp += (arrayEtiquetaHttp[1].indexOf(arrayEtiquetaHttp[0])==-1)? '<br>' + arrayEtiquetaHttp[1] : ''
  					 temp += '</td></tr>'
 					 	 trobat = true
      		 }
  			}
				temp += (trobat)? '<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>' : ''
  		}
  	}		
	 temp += '</table>'
	 temp = (hiHalligams)? temp : ''
   return temp
}

function posaEtiquetaIEnllac(indexString, w){
	 var arrayindexLink = new Array()
   arrayindexLink = arrayValorsMapa[indexString][w].split('http://')
	 arrayindexLink[3] = 'target="' + varTarget + '"'
   //** per assegurar la compatibilitat cap enredera en els lligams sense http:// amb només nom de fitxer						 
   if((arrayValorsMapa[indexString][w].indexOf('http://')==-1)&&(arrayValorsMapa[indexString][w].indexOf(' ')==-1)){
  		 arrayindexLink[0] = arrayValorsMapa[indexString][w]
  		 arrayindexLink[1] = arrayValorsMapa[indexString][w]
   } else{
   	 	 if(arrayValorsMapa[indexString][w].indexOf('http://')==-1){
  		 //** per posar lligams locals
  		 arrayindexLink[3] = ''
  		 var separacio = arrayValorsMapa[indexString][w].lastIndexOf(' ')
  		 var puntFinal = arrayValorsMapa[indexString][w].length
  		 arrayindexLink[0] = arrayValorsMapa[indexString][w].substring(0, separacio)
  		 arrayindexLink[1] = arrayValorsMapa[indexString][w].substring(separacio+1,puntFinal)
  		 } else {
						 //** per assegurar la compatibilitat cap enredera
						 arrayindexLink[0] = (arrayindexLink[0]=='')? arrayindexLink[1] : arrayindexLink[0]
  					 arrayindexLink[1] = 'http://' + arrayindexLink[1]
  		 }
   }
   arrayindexLink[0] = (arrayindexLink[0].charAt(arrayindexLink[0].length-1)==' ')? 
                        arrayindexLink[0].substring(0,(arrayindexLink[0].length-1)) :
  										  arrayindexLink[0]
	 return arrayindexLink
}


// *****************************
// *****************************
// Edició del mapa

//** Precarga de las imatges

var pluma = new Image();
pluma.src = "plum2.gif"

function mapacn(nodeXMLDoc, pantalla){	
	//** Inicialització

	dadesMapaBrutesmcn = generarCodiMapa(nodeXMLDoc);
	dataArraymcn = createArraymcn();
	arrel = dataArraymcn[1];
	nodeInicial = dataArraymcn[2];
	modificacionsInstmcn = new constructorObjecteModificacionsmcn();
	modificacionsInstmcn.editarOMapaOCodi = pantalla;

	arrayValorsMapa = posaEnUnDobleArray(dataArraymcn[0]);
	arbreInst = new arbreObj(nodeInicial);
	formulariMapaInst = new formulariMapaObjecte(nodeInicial);

	if (modificacionsInstmcn.editarOMapaOCodi == 'noEditar') document.write(arbreInst.pintaArbreEditable())
	else activaLaModificaciomcn()
}

function tornarAIniciarDesDeCodi(codi, pantalla){	
	var nodeXMLDoc = new ActiveXObject("microsoft.XMLDOM");
	nodeXMLDoc.loadXML(codi);
	dadesMapaBrutesmcn = generarCodiMapa(nodeXMLDoc);
	dataArraymcn = createArraymcn();
	arrel = dataArraymcn[1];
	nodeInicial = dataArraymcn[2];
	modificacionsInstmcn = new constructorObjecteModificacionsmcn();
	modificacionsInstmcn.editarOMapaOCodi = pantalla;

	arrayValorsMapa = posaEnUnDobleArray(dataArraymcn[0]);
	arbreInst = new arbreObj(nodeInicial);
	formulariMapaInst = new formulariMapaObjecte(nodeInicial);
}

function activaLaModificaciomcn(){
	document.write('<DIV ID="capaSubFinestra" STYLE="position:absolute; left:10; top:8; visibility:visible"></div>');
	modificacionsInstmcn.editarOMapaOCodi = 'mostrarMapa';
	escriuCapamcn(creacioFormulariModificarmcn()); 
	posaAlFormulariElsValorsDelsCampsmcn();
}

function constructorObjecteModificacionsmcn(){
	this.parametres = new Array(0);
	this.parametres = this.parametres.concat(dataArraymcn);
	this.parametresInicial = new Array(0);
	this.parametresInicial = this.parametresInicial.concat(dataArraymcn);
}


function menuContextual(){
	var argArray = menuContextual.arguments
	var argNombre = menuContextual.arguments.length
	var inici = (argNombre > 0) ? argArray[0] : '';
	var separacio = (argNombre > 1) ? argArray[1] : '';
	var finalitzacio = (argNombre > 2) ? argArray[2] : '';

	var temp = inici;
	var i = 3;
	while (i<argNombre) {
		if (i+1<argNombre){
			temp += (document.location.href.indexOf(argArray[i+1])!=-1)? argArray[i] : '<a href="' + argArray[i+1] + '">' + argArray[i] + '</a>';
			if (i+2<argNombre){temp += separacio};
		}
		i = i+2;
	}
	temp += finalitzacio;
	return temp;
}

function abansMapa(){
	temp = '';
	temp += '<table border=0 width=100% cellpadding="0" cellspacing="0">'
	temp += '<tr><td colspan="5" bgcolor="#009900" height="1"></td></tr>'
	temp += '<tr><td width="1" bgcolor="#009900"><td colspan="3" height="4"></td><td width="1" bgcolor="#009900"></td></tr>'
	temp += '<tr><td width="1" bgcolor="#009900"></td><td width="4"></td><td>'

	temp += '<table border=0 width=100% cellpadding="5" cellspacing="0">';
	temp += '<tr><td valign="top" align="center" bgcolor="#e3f5ce">'
	temp += (parent.frames[0]&&parent.frames.entorn)? '<font face=verdana size=4>' : '<font face=verdana size=4>'
	temp += '<img src="ic.gif" width="30" height="25"> '
	temp += 'Mapas conceptuales de navegación'
	temp += (document.location.href == 'http://www.hipertext.net/mapas/')? ' > Editor<br>' : ''
	temp += (document.location.href.indexOf('index.htm')!=-1)? ' > Editor<br>' : ''
	temp += (document.location.href.indexOf('origenes.htm')!=-1)? ' > Orígenes<br>' : ''
	temp += (document.location.href.indexOf('versus.htm')!=-1)? ' > Versus<br>' : ''
	temp += (document.location.href.indexOf('creacion.htm')!=-1)? ' > Creación<br>' : ''
	temp += (document.location.href.indexOf('guia.htm')!=-1)? ' > Guía<br>' : ''

//	temp += '<font face=verdana size=2 color="#888888">este editor es un servicio de la comunidad '
//	temp += (parent.frames[0]&&parent.frames.entorn)? '<a href="http://www.hipertext.net/pag100.htm">hipertext.net</a>' : '<a href="http://www.hipertext.net" target="_top">hipertext.net</a><br><br>'
	temp += menuContextual('<img src=11.gif height=18 width=1><font size=1>', ' | ', '', 'editor', 'index.htm', 'orígenes', 'origenes.htm', 'versus mapa de navegación', 'versus.htm', 'creación heurística', 'creacion.htm', 'guía de estilo', 'guia.htm')

	temp += '<br><br><br></td></tr></table>'
	return temp
}

function despresMapa(){
	temp = ''
	temp += '<center><font face=verdana size=2 color="#888888">'
	temp += '<hr size=1 width="90%" style="color:#EEEEEE">'
	temp += 'es un servicio de la comunidad <b>'
	temp += (parent.frames[0])? '<a href="http://www.hipertext.net/web/pag100.htm" ' : '<a href="http://www.hipertext.net" '
	temp += 'style="text-decoration: none; color: #000000">'
	temp += 'hipertext.net</a></b><br>'
	temp += '<font size=1>Sección Científica de Ciencias de la Documentación del<br><a href="http://www.upf.es" target="_blank" style="text-decoration: none; color: #000000">Departamento de Ciencias Políticas y Sociales</a><br>de la <a href="http://www.upf.es" target="_blank" style="text-decoration: none; color:#000000">Universidad Pompeu Fabra</a><br>'
	temp += 'C/ Ramon Trias Fargas, 25-27, 08005 Barcelona<br>'
	temp += 'tel. 93 542 22 64 · webmaster@documentaciondigital.org<br>'
	temp += 'editor realizado por &copy;Cristòfol Rovira<br>www.mapasconceptuales.com<p>'

	ultimcanvi = new Date(document.lastModified);
	mes = ultimcanvi.getMonth() + 1;
	dia = ultimcanvi.getDate();
	dia = (dia<10)? '0' + dia : dia;
	mes = (mes<10)? '0' + mes : mes;
	any = (document.all)? ultimcanvi.getYear() : ultimcanvi.getYear()+2000;

	temp += 'creación: 29/09/2002 · última modificación: ' + dia + '/' + mes + '/' + any
	temp += '<p>';
	temp += '<td width="4"></td><td width="1" bgcolor="#009900"></td></tr>'
	temp += '<tr><td colspan="5" bgcolor="#009900" height="1"></td></tr>'
	temp += '<tr><td colspan="5" height="14"></td></tr></table>'
	return temp
}



function creacioFormulariModificarmcn(){
	temp = ''
	temp += abansMapa()
	temp += '<table border=0 cellpadding="5" cellspacing="0">';

	temp += '<tr><td align="center" colspan="2"><font face=verdana size=1>';
	temp += 'El editor de mapas conceptuales de navegación es un servicio exclusivo de hipertext.net creado por Cristòfol Rovira y disponible en<br>www.mapasconceptuales.com Con esta herramienta se pueden crear mapas conceptuales de navegación para luego instalarlos en cualquier<br>página Web. Los datos se almacenan con el lenguaje XML Topic Maps y el mapa puede visualizarse con Internet Explorer 5.0 ó superior.';
	temp += '</td></tr>';

	temp += '<tr><td align="center" width="50%" height="3"></td>';
	temp += '<td align="center" width="50%" height="3"></td></tr>';

	temp += '<tr><td width="50%" valign="top" align="center"><font face=verdana size=2>Crear un mapa</td>';
	temp += '<td width="50%" valign="top" align="center"><font face=verdana size=2>Modificar un mapa</td></tr>';

	temp += '<tr><td valign="top"><font face=verdana size=2>';
	temp += '<ol type="1">';
	temp += '	<li> <b>Edición</b>. Pulsar en los enlaces "Editar el mapa" y "Ver el mapa" las veces que sea necesario hasta conseguir el mapa que se desee a partir del mapa genérico que aparece por defecto.';
	temp += '	<li> <b>Obtener el código</b>. Cuando se ha obtenido un mapa definitivo, pulsar en el enlace "Instalación" y copiar el código que aparece en el formulario.';
	temp += '	<li> <b>Pegar el código</b>. Finalmente abrir con un editor una página HTML y pegar el código copiado en el lugar donde se desee qua aparezca el <i>mapa conceptual de navegación</i>.';
	temp += '</ol>';
	temp += '</td><td valign="top"><font face=verdana size=2>';
	temp += '<ol type="1">';
	temp += '	<li> <b>Copiar el código</b>. Seleccionar y copiar el <i>código de instalación</i> del <i>mapa conceptual de navegación</i> de la página HTML donde fue instalado.';
	temp += '	<li> <b>Pegar el código</b>. Pulsar en el enlace "Instalación", borrar el código que aparece por defecto y pegar en el formulario el código a modificar.';
	temp += '	<li> <b>Edición</b>. Pulsar en los enlaces "Editar el mapa" y "Ver el mapa" las veces que sea necesario hasta conseguir el mapa que se desee.';
	temp += '	<li> <b>Obtener el código</b>. Cuando se ha obtenido un mapa definitivo, pulsar en el enlace "Instalación" y copiar el código que aparece en el formulario.';
	temp += '	<li> <b>Pegar el código</b>. Finalmente abrir con un editor una página HTML y pegar el código copiado en el lugar donde se desee colocar el <i>mapa conceptual de navegación</i>.';
	temp += '</ol>';
	temp += '</td></tr>';

	temp += '</table>';

	temp += '<table border=0 width="100%" cellpadding="14" cellspacing="0">';
	temp += '<tr><td bgcolor="#e3f5ce"><center><font face=verdana size=3>';
	temp += '<form name="formulariModificarDeSubfinestra" method="post">';
	temp +=	'<center><font size=2>';

	switch (modificacionsInstmcn.editarOMapaOCodi){
		case "editarUn":
			temp += '<table border=0>'
			temp += '<tr>'
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarMapa\'; canviAVeuremcn();"><img src="ok.gif" width="30" height="30" border=0></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'editar\'; canviAVeuremcn();"><img src="espiral.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();"><img src="marcas.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();"><img src="cercle.gif" width="30" height="30" border="0"></a></td>'
			temp += '</tr>'
			temp += '<tr style="font-family:Verdana; font-size:7pt;">'
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarMapa\'; canviAVeuremcn();">ver mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>'; 
			temp +=	'<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'editar\'; canviAVeuremcn();">editar mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();">XML</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:eliminaElsItemsVuits(); modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();">código de<br>instalación</a></td>'
			temp += '</table>'
			break
		case "mostrarMapa":
			temp += '<table border=0>'
			temp += '<tr>'
			temp += '<td align="center"><img src="ok_i.gif" width="30" height="30"></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'editar\'; canviAVeuremcn();"><img src="espiral.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();"><img src="marcas.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();"><img src="cercle.gif" width="30" height="30" border="0"></a></td>'
			temp += '</tr>'
			temp += '<tr style="font-family:Verdana; font-size:7pt;">'
			temp += '<td align="center">ver mapa</td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>'; 
			temp +=	'<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'editar\'; canviAVeuremcn();">editar mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();">XML</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();">código de<br>instalación</a></td>'
			temp += '</table>'
			break
		case "editar":
			temp += '<table border=0>'
			temp += '<tr>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarMapa\'; canviAVeuremcn();"><img src="ok.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><img src="espiral_i.gif" width="30" height="30"></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();"><img src="marcas.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();"><img src="cercle.gif" width="30" height="30" border="0"></a></td>'
			temp += '</tr>'
			temp += '<tr style="font-family:Verdana; font-size:7pt;">'
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarMapa\'; canviAVeuremcn();">ver mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>'; 
			temp +=	'<td align="center">editar mapa</td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiXML\'; canviAVeuremcn();">XML</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:modificacionsInstmcn.editarOMapaOCodi = \'mostrarCodiJavascript\'; canviAVeuremcn();">código de<br>instalación</a></td>'
			temp += '</table>'
			break
		case "mostrarCodiXML":
			temp += '<table border=0>'
			temp += '<tr>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'mostrarMapa\'); canviAVeuremcn();"><img src="ok.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'editar\'); canviAVeuremcn();"><img src="espiral.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><img src="marcas_i.gif" width="30" height="30"></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'mostrarCodiJavascript\'); canviAVeuremcn();"><img src="cercle.gif" width="30" height="30" border="0"></a></td>'
			temp += '</tr>'
			temp += '<tr style="font-family:Verdana; font-size:7pt;">'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'mostrarMapa\'); canviAVeuremcn();">ver mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>'; 
			temp +=	'<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'editar\'); canviAVeuremcn();">editar mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center">XML</td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(formulariModificarDeSubfinestra.codiTopicMap.value, \'mostrarCodiJavascript\'); canviAVeuremcn();">código de<br>instalación</a></td>'
			temp += '</tr>'
			temp += '</table>'
			break
		case "mostrarCodiJavascript":
			temp += '<table border=0>'
			temp += '<tr>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'mostrarMapa\'); canviAVeuremcn();"><img src="ok.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'editar\'); canviAVeuremcn();"><img src="espiral.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'mostrarCodiXML\'); canviAVeuremcn();"><img src="marcas.gif" width="30" height="30" border="0"></a></td>'
			temp += '<td align="center"></td>'
			temp += '<td align="center"><img src="cercle_i.gif" width="30" height="30"></td>'
			temp += '</tr>'
			temp += '<tr style="font-family:Verdana; font-size:7pt;">'
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'mostrarMapa\'); canviAVeuremcn();">ver mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>'; 
			temp +=	'<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'editar\'); canviAVeuremcn();">editar mapa</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center"><a href="javascript:tornarAIniciarDesDeCodi(agafarXMLdelCodiJavascript(formulariModificarDeSubfinestra.codiJavascript.value), \'mostrarCodiXML\'); canviAVeuremcn();">XML</a></td>'
			temp +=	'<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>';
			temp += '<td align="center">código de<br>instalación</td>'
			temp += '</tr>'
			temp += '</table>'
			break
		}

//	temp +=	(modificacionsInstmcn.editarOMapaOCodi == 'editar')? '<input type="button" value="Ver el mapa" onClick="canviAVeuremcn()">' : ''
//	temp +=	(modificacionsInstmcn.editarOMapaOCodi == 'mostrarMapa')? '<input type="button" value="Editar el mapa" onClick="canviAVeuremcn()">' : ''
//	temp +=	(modificacionsInstmcn.editarOMapaOCodi == 'mostrarCodiXML')? '<input type="button" value="Editar el mapa" onClick="canviAVeuremcn()">' : ''

	temp +=	'</font size></center>'
	temp +=	'</td></tr></table><br><br>'

	switch (modificacionsInstmcn.editarOMapaOCodi){
		case "editarUn":
			temp += '<center>' + formulariMapaInst.pinta() + '</center><p>'
			break
		case "mostrarMapa":
			temp += '<center>' + arbreInst.pintaArbreEditable() + '</center><p>'
			temp += '<center><p><font size=2 face=verdana>'
//			temp += '<p><br><p><br><p><br>'
			temp += '<b>Ver mapa</b>. Este aspecto tendrá el <i>mapa conceptual de navegación</i> cuando se instale<br>' 
			temp += 'en su página Web. A continuación del mapa se generará un listado completo de los enlaces.<br>' 
			temp += 'Pulse en los conceptos del mapa para ver el listado de enlaces asociado a cada concepto.<p>'
 			temp += generaLlistatDeLinks()
			break
		case "editar":
			temp += '<center>' + arbreInst.pintaArbreEditable() + '</center>'
			temp += '<center><p><font size=2 face=verdana>'
			temp += '<b>Edición</b>. Para modificar el mapa pulse en cualquiera de los iconos del lápiz'
			temp += '</center>'
			break
		case "mostrarCodiXML":
			temp += '<center>'
			temp += '<textarea name="codiTopicMap" rows="18" cols="100" style="font-family:Verdana; font-size:10pt; color:blue;">'
			temp += generaTopicMap(empaquetarMapa())
			temp += '</textarea>'
			temp += '</center>'
			temp += '<p><font size=2 face=verdana>'
			temp += '<b>Opciones avanzadas</b>. El código XML de los mapas conceptuales de navegación está construido de acuerdo con la normativa Topic Maps. La edición del mapa también puede realizarse modificando directamente este código de acuerdo con las siguientes indicaciones (no modifique este código si no está seguro de lo que desea hacer):'
			temp += '<ol type="1">'
			temp += '	<li> Los siguientes tópicos son estructurales y deberán estar presentes en cualquier mapa: concept, rootConcept, webPage, child, father'
			temp += '	<li> Siempre deberá existir un concepto de tipo rootConcept a partir del cual se construirá el mapa'
			temp += '	<li> Un mapa siempre deberá contener un mínimo de dos tópicos y una asociación'
			temp += '</ol>'
			break
		case "mostrarCodiJavascript":
			temp += '<center><font size=1>'
			temp += '<textarea name="codiJavascript" rows="18" cols="100" style="font-family:Verdana; font-size:10pt; color:blue;">'
			temp += generaJavascript(generaTopicMap(empaquetarMapa()))
			temp += '</textarea>'
			temp += '</center>'

			temp += '<p><font size=2 face=verdana>'
			temp += '<b>Instalación</b>. Para instalar este <i>mapa conceptual de navegación</i> en cualquier página Web deberá copiar el código que aparece en este formulario y pegarlo en la página '
			temp += 'HTML donde desee colocar el mapa. Será visible con el Internet Explorer 5.0 ó superior. '
			temp += 'En el código encontrará las siguientes variables que son modificables:<p>'
      temp += 'var lletraDe = \'10\' // Tamaño de letra en el mapa<br>\n'
      temp += 'var tipoLetra = \'arial\' // Tipo de letra en el mapa<br>\n'
      temp += 'var lletraDeEnlaces = \'11\' // Tamaño de letra en el listado de enlaces<br>\n'
      temp += 'var tipoLetraEnlaces = \'verdana\' // Tipo de letra en el listado de enlaces<br>\n'
      temp += 'var listadoEnlaces = \'si\' // si o no para no mostrar o no el listado de enlaces<br>\n'		
      temp += 'var tituloEnlaces = \'Listado de enlaces del mapa\' // título del listado de enlaces<p>\n'		
			
//			temp += 'Para facilitar las tareas de seleccionar y copiar se puede utilizar las siguientes combinaciones de teclas:<br>'
//			temp += '1. Situar el cursor en el formulario<br>'
//			temp += '2. Pulsar la tecla control al mismo tiempo que letra "e" para seleccionar todo<br>'
//			temp += '3. Pulsar la tecla control al mismo tiempo que la letra "c" para copiar<br>'


			break
		}

	temp += '<input type="hidden" name="xparametre0">';
	temp += '<input type="hidden" name="xparametre1">';
	temp += '<input type="hidden" name="xparametre2">';
	temp += '</form>'

	temp += despresMapa()
	return temp
}

function canviAVeuremcn(){
	posaAlObjecteElsValorsDelsCampsmcn()
	escriuCapamcn(creacioFormulariModificarmcn());
	posaAlFormulariElsValorsDelsCampsmcn()
	buidaTotesCapesLinks()
}

function posaAlObjecteElsValorsDelsCampsmcn(){
	formulari = document.forms.formulariModificarDeSubfinestra
	if(formulari.xparametre0) modificacionsInstmcn.parametres[0] = formulari.xparametre0.value;
	if(formulari.xparametre1) modificacionsInstmcn.parametres[1] = formulari.xparametre1.value;
	if(formulari.xparametre2) modificacionsInstmcn.parametres[2] = formulari.xparametre2.value;						
}

function posaAlFormulariElsValorsDelsCampsmcn(){
//** Posar el valor del requadre de text un cop s'ha creat
//** Posar el text a modificar despres de la creació del frormulari per 
//** evitar problemes amb etiquetes HTML mal tancades

	formulari = document.forms.formulariModificarDeSubfinestra
	if(formulari.xparametre0) formulari.xparametre0.value = (modificacionsInstmcn.parametres.length>0)?empaquetarMapa():''
	if(formulari.xparametre1) formulari.xparametre1.value = (modificacionsInstmcn.parametres.length>1)?modificacionsInstmcn.parametres[1]:''
	if(formulari.xparametre2) formulari.xparametre2.value = (modificacionsInstmcn.parametres.length>2)?modificacionsInstmcn.parametres[2]:''
}

function codificaCaractersmcn(codi){
		 codi = codi.replace(/à/g, "&amp;#224;")
		 codi = codi.replace(/á/g, "&amp;#225;")
		 codi = codi.replace(/è/g, "&amp;#232;")
		 codi = codi.replace(/é/g, "&amp;#233;")
		 codi = codi.replace(/ì/g, "&amp;#236;")
		 codi = codi.replace(/í/g, "&amp;#237;")
		 codi = codi.replace(/ò/g, "&amp;#242;")
		 codi = codi.replace(/ó/g, "&amp;#243;")
		 codi = codi.replace(/ù/g, "&amp;#249;")		 
		 codi = codi.replace(/ú/g, "&amp;#250;")		 

		 codi = codi.replace(/ä/g, "&amp;#228;")
		 codi = codi.replace(/ë/g, "&amp;#235;")
		 codi = codi.replace(/ï/g, "&amp;#239;")
		 codi = codi.replace(/ö/g, "&amp;#246;")
		 codi = codi.replace(/ü/g, "&amp;#252;")

		 codi = codi.replace(/À/g, "&amp;#192;")
		 codi = codi.replace(/Á/g, "&amp;#193;") 
		 codi = codi.replace(/È/g, "&amp;#200;")
		 codi = codi.replace(/É/g, "&amp;#201;")
		 codi = codi.replace(/Ì/g, "&amp;#204;")
		 codi = codi.replace(/Í/g, "&amp;#205;")
		 codi = codi.replace(/Ò/g, "&amp;#210;")
		 codi = codi.replace(/Ó/g, "&amp;#211;")
		 codi = codi.replace(/Ù/g, "&amp;#217;")
		 codi = codi.replace(/Ú/g, "&amp;#218;")

		 codi = codi.replace(/Ä/g, "&amp;#196;")
		 codi = codi.replace(/Ë/g, "&amp;#203;")
		 codi = codi.replace(/Ï/g, "&amp;#207;")
		 codi = codi.replace(/Ö/g, "&amp;#214;")
		 codi = codi.replace(/Ü/g, "&amp;#220;")

		 codi = codi.replace(/ñ/g, "&amp;#241;")
		 codi = codi.replace(/Ñ/g, "&amp;#209;")
		 codi = codi.replace(/ç/g, "&amp;#231;")
		 codi = codi.replace(/Ç/g, "&amp;#199;")

		 codi = codi.replace(/ª/g, "&amp;#170;")
		 codi = codi.replace(/º/g, "&amp;#186;")
		 codi = codi.replace(/·/g, "&amp;#183;")
		 codi = codi.replace(/¿/g, "&amp;#191;")
		 codi = codi.replace(/¡/g, "&amp;#161;")		 
		 //* alt+158
 		 codi = codi.replace(/×/g, "&amp;#215;")
		 //* alt+157
 		 codi = codi.replace(/Ø/g, "&amp;#216;")
		 //* alt+657
 		 codi = codi.replace(/æ/g, "&amp;#230;")
 		 codi = codi.replace(/"/g, "\"")
 		 codi = codi.replace(/"/g, "\"")
		 codi = codi.replace(/'/g, "&amp;#39;")
		 codi = codi.replace(/'/g, "&amp;#39;")
		 codi = codi.replace(/¼/g, "...")
		 codi = codi.replace(/¦/g, "")
		 codi = codi.replace(/…/g, "...")		 
		 codi = codi.replace(/-/g, "-")		 

		 codi = codi.replace(/'/g, "&amp;#39;")
		 codi = codi.replace(/"/g, "&amp;#34;")
		 codi = codi.replace(/</g, "&amp;#60;")
		 codi = codi.replace(/>/g, "&amp;#62;")
	 	 codi = codi.replace(/\r\n/g, " ")
		 return(codi)
}

function escriuCapamcn(temp){	
	window.document.all['capaSubFinestra'].innerHTML = temp
}


// *****************************
// Editar mapa

var formulariMapaInst;
var arbreInst;
var arrel;
var nodeInicial;

function formulariMapaObjecte(idConcepte){
//	idConcepteArrel = idConcepte;
	this.idConcepte = idConcepte;
	this.pinta = pinta;
	this.color = false;
	this.posaColor = posaColor;
	this.conexions = conexions;
	this.lligams = lligams;
	this.creaFill = creaFill;
	this.eliminaFill = eliminaFill;
	this.afageixFillAlPare = afageixFillAlPare;
	this.eliminaFillDelPare = eliminaFillDelPare;
}

function boto(text, adreca){
	temp = '';
	temp += '<table border="1" cellspacing="0" cellpadding="2" bordercolor="#999999"><tr>';
	temp += '<td bgcolor="#DDDDDD" align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">';
	temp += '<a href="' + adreca + '" style="text-decoration: none; color: #000000">' + text + '</a></font>';
	temp += '</td>';
	temp += '</tr></table>';
	return temp;
}

function pinta(){
	entratAlEditor = true
	var avi = (arrayValorsMapa[this.idConcepte][1] != arrayValorsMapa[this.idConcepte][2])? arrayValorsMapa[arrayValorsMapa[this.idConcepte][2]][2] : arrel

	temp = '';
	temp += '  <table width="100%" border="3" cellspacing="0" cellpadding="5" bordercolor="#FFFFFF">';

	temp += '    <tr valign="top" bgcolor="#e3f5ce"> ';
	temp += '      <td width="120" align="center" rowspan="3"><center>';
	temp += '        <font face="Arial, Helvetica, sans-serif" size="4">';
	temp += '          Concepto </font><br>';

	temp += '        <font face="Arial, Helvetica, sans-serif" size="1"> ';
	//temp += '		añadir | <a href="javascript:eliminaFill(\'' + this.idConcepte + '\', \'' + avi + '\')" style="text-decoration: none">borrar</a><br>';

	temp += '        <input type="text" name="concepte" size="16" maxlength="40" value="' + arrayValorsMapa[this.idConcepte][3] + '"'
	temp += '         onChange="modificaItem(\''+ this.idConcepte + '\', this.form.concepte.value, \'' + avi + '\')"> ';
	temp += '        </font></td>';

	temp += '      <td align="right"> ';
	temp += '        <font face="Arial, Helvetica, sans-serif" size="2">Concepto "padre": ';
	temp += '       </font>';
	temp += '      </td>';
	
	temp += '      <td><font size="2" face="Arial, Helvetica, sans-serif"> ';
	
	if (arrayValorsMapa[this.idConcepte][1] != arrayValorsMapa[this.idConcepte][2]){
		temp += '<a href="javascript:formulariMapaInst.idConcepte = \'' + arrayValorsMapa[arrayValorsMapa[this.idConcepte][2]][2] + '\'; '
		temp += 'escriuCapamcn(creacioFormulariModificarmcn()); '
		temp += 'posaAlFormulariElsValorsDelsCampsmcn()">' + arrayValorsMapa[arrayValorsMapa[arrayValorsMapa[this.idConcepte][2]][2]][3] + '</a> '
		}
		else{temp += 'No hay porque es el concepto inicial'}
	
	temp += '        </font></td>';
	temp += '    </tr>';
		
	temp += '    <tr bgcolor="#e3f5ce"> ';
	temp += '      <td> ';
	temp += '        <div align="right"><font face="Arial, Helvetica, sans-serif" size="2">';
	temp += '          Frase de conexión ';
	temp += '          con el concepto "padre": </font></div>';
	temp += '      </td>';
	temp += '      <td><font size="2" face="Arial, Helvetica, sans-serif"> ';
	temp += (arrayValorsMapa[this.idConcepte][1] != arrayValorsMapa[this.idConcepte][2])? '<input type="text" name="connexioPare" maxlength="40" value="' : ''; 
	temp += (arrayValorsMapa[this.idConcepte][1] != arrayValorsMapa[this.idConcepte][2])?  arrayValorsMapa[arrayValorsMapa[this.idConcepte][2]][3] + '" onChange="modificaItem(\'' + arrayValorsMapa[this.idConcepte][2] + '\', this.form.connexioPare.value, \''+ avi +'\')">' : 'No hay porque es el concepto inicial';
	temp += '        </font></td>';
	temp += '    </tr>';
	
	//temp += '    <tr valign="top" bgcolor="#FFFFDD"> ';
	//temp += '      <td> ';
	//temp += '        <div align="right"><font face="Arial, Helvetica, sans-serif" size="1">';
	//temp += '          	Situación especial en el mapa: </font></div>';
	//temp += '      </td>';
	//temp += '      <td> <font face="Arial, Helvetica, sans-serif" size="1"> ';
	//temp += '	    <select name="posicioEspecial" onChange="actualitzaPosicioEspecial('+ this.idConcepte +')">'
	//temp += '		<option value="normal" '
	//if(arrayValorsMapa[this.idConcepte].length==37){
	//	if (arrayValorsMapa[this.idConcepte][36] == 'normal'){temp += 'selected'}}
	//temp += '		>Normal</option>'
	//temp += '		<option value="vertical" '
	//if(arrayValorsMapa[this.idConcepte].length==37){
	//	if (arrayValorsMapa[this.idConcepte][36] == 'vertical'){temp += 'selected'}}
	//temp += '		>Forzar vertical</option></select>'
	//if(arrayValorsMapa[this.idConcepte].length==37){
	//	if (arrayValorsMapa[this.idConcepte][36] == 'vertical')
	//{temp += ' <font size=1>Rcuerde en sitar en posición "Forzar vertical" a todos los hermanos jerárquicos'}}
	//temp += '       </font></td>';
	//temp += '    </tr>';

	temp += '    <tr valign="top" bgcolor="#DDDDDD"> ';
	//e3f5ce	
	temp += '      <td colspan="2"> ';
	temp += this.lligams()
	temp += '    </tr>';	

	temp += this.conexions();
	temp += '  </table>';
	
	return temp;
}

function actualitzaPosicioEspecial(id){
	posaAlObjecteElsValorsDelsCampsmcn()
	arrayValorsMapa[id][36] = document.forms.formulariModificarDeSubfinestra.posicioEspecial.value
	escriuCapamcn(creacioFormulariModificarmcn());
	posaAlFormulariElsValorsDelsCampsmcn();
}

function lligams(){
	var temp = ''; 
  	temp += '     <table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolor="#CCCCCC">';

	temp += '    <tr bgcolor="#FFFFFF">'
	temp += '    <td colspan=6 align="center">';
	temp += '      <font size="2" face="Arial, Helvetica, sans-serif">Enlaces a recursos relacionados con el concepto: "' + arrayValorsMapa[this.idConcepte][3] + '"' ;
	temp += '    </td>';
	temp += '    </tr>';

	temp += '      <tr bgcolor="#CCCCCC">'
	temp += '      <td align="right" width="5%"  bgcolor="#FFFFFF">&nbsp;</td>'
	for (i=1; i<6 ; i++){
		temp += '      <td align="center" width="19%"><font face="Arial, Helvetica, sans-serif" size="1">Enlace ' + i
		temp += '<br>'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? 'añadir | <a href="javascript:eliminaLligam(\''+ this.idConcepte + '\', '+ (i+15) +')" style="text-decoration: none">borrar</a>' : '<a href="javascript:creaLligamTipus(\'' + this.idConcepte + '\', '+ i +');" style="text-decoration: none">añadir</a> | borrar'
		temp += '      </td>'
	}
//	temp += '      <td rowspan="6" bgcolor="#FFFFFF"></td>'
	temp += '      </tr>'
	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Tipo&nbsp;de&nbsp;<br>recurso&nbsp;</td>'
	for (i=1; i<6 ; i++){
		var indexText = i+15
		temp += '<td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '>'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){

			temp += '<select name="textLligam' + i  + '" onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+15) + '] = this.form.textLligam' + i + '.value">'
			temp += '<option value="Sitio">-----------------'
			temp += '<option value="Sitio" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Sitio')||(arrayValorsMapa[this.idConcepte][indexText] == 'Web site'))? 'selected' : ''
			temp += '>Sitio'
			temp += '<option value="Página" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Página')||(arrayValorsMapa[this.idConcepte][indexText] == 'Web page'))? 'selected' : ''
			temp += '>Página'
			temp += '<option value="Imagen" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Imagen')||(arrayValorsMapa[this.idConcepte][indexText] == 'Grafico'))? 'selected' : ''
			temp += '>Imagen'
			temp += '<option value="Sonido" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Sonido')? 'selected' : ''
			temp += '>Sonido'
			temp += '<option value="Video" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Video')? 'selected' : ''
			temp += '>Video'
			temp += '<option value="Mapa" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Mapa')? 'selected' : ''
			temp += '>Mapa'
			temp += '</select>'
		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'

	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Nombre&nbsp;</td>'
	for (i=1; i<6 ; i++){
		var indexLink = i+25
		var arrayindexLink = posaEtiquetaIEnllac(this.idConcepte, indexLink)
		temp += '      <td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '      >'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += '<input type="text" name="nomHttp' + i + '" size="11" maxlength="60" '
			temp += (arrayValorsMapa[this.idConcepte][indexLink] != '-')? ' value="'+ arrayindexLink[0] +'"': ''
			temp += '	   onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+25) + '] = this.form.nomHttp' + i + '.value + \' \' + this.form.linkHttp' + i + '.value">'

		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'

	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Dirección&nbsp;</td>'
	for (i=1; i<6 ; i++){
		var indexLink = i+25
		var arrayindexLink = posaEtiquetaIEnllac(this.idConcepte, indexLink)	
		temp += '      <td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '      >'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += '<input type="text" name="linkHttp' + i + '" size="11" '
			temp += (arrayValorsMapa[this.idConcepte][indexLink] != '-')? ' value="'+ arrayindexLink[1] +'" ': ' value=""'
			temp += '	   onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+25) + '] = this.form.nomHttp' + i + '.value + \' \' + this.form.linkHttp' + i + '.value">'

		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'

	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Tipo de&nbsp;<br>Dirección&nbsp;</td>'
	for (i=1; i<6 ; i++){
		var indexLink = i+25
		temp += '<td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '>'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += '<select name="tipusLligam' + i  + '" onChange="arreglaDireccio('+ i +', this.form)">'
			temp += '<option value="Remota">-----------------'
			temp += '<option value="Remota" '
			temp += ((arrayValorsMapa[this.idConcepte][indexLink].indexOf('http://')!=-1)&&
				  (arrayValorsMapa[this.idConcepte][i+15] != ''))? 'selected' : ''
			temp += '>Remota'
			temp += '<option value="Local" '
			temp += ((arrayValorsMapa[this.idConcepte][indexLink].indexOf('http://')==-1)&&
				  (arrayValorsMapa[this.idConcepte][i+15] != ''))? 'selected' : ''
			temp += '>Local'
			temp += '</select>'
		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'


//*****

	temp += '      <tr bgcolor="#CCCCCC">'
	temp += '      <td align="center" bgcolor="#FFFFFF"><font face="Arial, Helvetica, sans-serif" size="1">&nbsp;</td>'
	for (i=6; i<11 ; i++){
//		temp += '      <td align="center" bgcolor="#EEEEDD"><font face="Arial, Helvetica, sans-serif" size="1">Enlace '+ i
//		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' <a href="javascript:eliminaLligam(\''+ this.idConcepte + '\', '+ (i+15) +')">x</a>' : ''
//		temp += '      </td>'
		temp += '      <td align="center"><font face="Arial, Helvetica, sans-serif" size="1">Enlace ' + i
		temp += '<br>'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? 'añadir | <a href="javascript:eliminaLligam(\''+ this.idConcepte + '\', '+ (i+15) +')" style="text-decoration: none">borrar</a>' : '<a href="javascript:creaLligamTipus(\'' + this.idConcepte + '\', '+ i +');" style="text-decoration: none">añadir</a> | borrar'
		temp += '      </td>'

	}
	temp += '      </tr>'
	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Tipo de&nbsp;<br>recurso&nbsp;</td>'
	for (i=6; i<11 ; i++){
		var indexText = i+15
		temp += '<td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '>'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){

			temp += '<select name="textLligam' + i + '" onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+15) + '] = this.form.textLligam' + i + '.value">'
			temp += '<option value="Sitio">-----------------'
			temp += '<option value="Sitio" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Sitio')||(arrayValorsMapa[this.idConcepte][indexText] == 'Web page'))? 'selected' : ''
			temp += '>Sitio'
			temp += '<option value="Página" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Página')||(arrayValorsMapa[this.idConcepte][indexText] == 'Web page'))? 'selected' : ''
			temp += '>Página'
			temp += '<option value="Imagen" '
			temp += ((arrayValorsMapa[this.idConcepte][indexText] == 'Imagen')||(arrayValorsMapa[this.idConcepte][indexText] == 'Grafico'))? 'selected' : ''
			temp += '>Imagen'
			temp += '<option value="Sonido" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Sonido')? 'selected' : ''
			temp += '>Sonido'
			temp += '<option value="Video" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Video')? 'selected' : ''
			temp += '>Video'
			temp += '<option value="Mapa" '
			temp += (arrayValorsMapa[this.idConcepte][indexText] == 'Mapa')? 'selected' : ''
			temp += '>Mapa'
			temp += '</select>'
		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'
	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Nombre&nbsp;</td>'
	for (i=6; i<11 ; i++){
		var indexLink = i+25
		var arrayindexLink = posaEtiquetaIEnllac(this.idConcepte, indexLink)
		temp += '      <td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '      >'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += ' <input type="text" name="nomHttp' + i + '" size="11" maxlength="60" '
			temp += (arrayValorsMapa[this.idConcepte][indexLink] != '-')?' value="'+ arrayindexLink[0] +'" ': ''
			temp += '	   onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+25) + '] = this.form.nomHttp' + i + '.value + \' \' + this.form.linkHttp' + i + '.value">'

		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'
	
	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Dirección&nbsp;</td>'

	for (i=6; i<11 ; i++){
		var indexLink = i+25
		var arrayindexLink = posaEtiquetaIEnllac(this.idConcepte, indexLink)
		temp += '      <td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '      >'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += ' <input type="text" name="linkHttp' + i + '" size="11" '
			temp += (arrayValorsMapa[this.idConcepte][indexLink] != '-')?' value="'+ arrayindexLink[1] +'" ': ' value="http://"'
			temp += '	   onChange="arrayValorsMapa[\'' + this.idConcepte + '\'][' + (i+25) + '] = this.form.nomHttp' + i + '.value + \' \' + this.form.linkHttp' + i + '.value">'

		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'


	temp += '      <tr bgcolor="#FFFFFF">'
	temp += '      <td align="right"><font face="Arial, Helvetica, sans-serif" size="1">Tipo de&nbsp;<br>Dirección&nbsp;</td>'
	for (i=6; i<11 ; i++){
		var indexLink = i+25
		temp += '<td align="center"'
		temp += ((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-'))? ' bgcolor="#EEEEEE"' : ''
		temp += '>'
		if((arrayValorsMapa[this.idConcepte][i+15] != '-')||(arrayValorsMapa[this.idConcepte][i+25] != '-')){
			temp += '<select name="tipusLligam' + i  + '" onChange="arreglaDireccio('+ i +', this.form)">'
			temp += '<option value="Remota">-----------------'
			temp += '<option value="Remota" '
			temp += ((arrayValorsMapa[this.idConcepte][indexLink].indexOf('http://')!=-1)&&
				  (arrayValorsMapa[this.idConcepte][i+15] != ''))? 'selected' : ''
			temp += '>Remota'
			temp += '<option value="Local" '
			temp += ((arrayValorsMapa[this.idConcepte][indexLink].indexOf('http://')==-1)&&
				  (arrayValorsMapa[this.idConcepte][i+15] != ''))? 'selected' : ''
			temp += '>Local'
			temp += '</select>'
		} else {temp += '&nbsp;'}
		temp += '</td>'
	}
	temp += '      </tr>'

		
	temp += '</table>'
	return temp;
}

function arreglaDireccio(i, formulari){
	direccioObj = eval("formulari.linkHttp"+i)
	tipusDireccioObj = eval("formulari.tipusLligam"+i)
	
	if ((tipusDireccioObj.selectedIndex==0)||(tipusDireccioObj.selectedIndex==1)){
		if (direccioObj.value.indexOf("http://")!=-1){}
		else{direccioObj.value = "http://" + direccioObj.value}
	} else {
		if (direccioObj.value.indexOf("http://")!=-1){direccioObj.value = direccioObj.value.replace(/http:\/\//g, "")}
		else{}
	}
}

function conexions(){
	var temp = '';

	for (j=1; j<11 ; j++){
	var idConexio = arrayValorsMapa[this.idConcepte][j+5]
	
	temp += '    <tr  bgcolor="#e3f5ce">'  
	temp += '      <td align="center" valign="top"> ';
	temp += '        <font face="Arial, Helvetica, sans-serif" size="2">';
	temp += '          Frase de conexión ' + j
	temp += '      <br>';
	temp += '        <font face="Arial, Helvetica, sans-serif" size="1">';
	temp += 		(idConexio!='-')? 'añadir | <a href="javascript:eliminaFill(\'' + idConexio + '\',\'' + this.idConcepte + '\')" style="text-decoration: none">borrar</a>':'<a href="javascript:creaFill(\'' + this.idConcepte + '\', \'conexión\', '+ j +')" style="text-decoration: none">añadir</a> | borrar';
	temp += '      <br>';
	temp += 		(idConexio!='-')? '<input type="text" name="textFrase' + j + '" size="16" maxlength="80" value="' : ''
	temp +=         (idConexio!='-')? arrayValorsMapa[idConexio][3] + '" onChange="modificaItem(\''+ idConexio +'\', this.form.textFrase' + j + '.value, \'' + this.idConcepte + '\')">' : ''; 

	//temp += 		(idConexio=='-')? '<input type="button" name="modfrase' + j + '" value="Añadir la frase número '+ j +'"' : '';
	//temp +=         (idConexio=='-')? '<a href="javascript:creaFill(\'' + this.idConcepte + '\', \'conexión\', '+ j +')" style="text-decoration:none">añadir</a> | borrar' : '';

	temp += '      </td>';
	
	if(idConexio!='-'){
		temp += '      <td align="center" colspan="6"> ';
	
	  	temp += '      <table width="100%" border="1" cellspacing="0" cellpadding="1" bordercolor="#e3f5ce">';
		temp += '     <tr valign="top" bgcolor="#FFFFFF"> ';
		temp += '     <td align="center" colspan="5"> ';	
		temp += '        <font face="Arial, Helvetica, sans-serif" size="2">';
		temp += '          Conceptos "hijo" relacionados con la frase de conexión ' + j;
		temp +=         ((idConexio!='-')&&(arrayValorsMapa[idConexio][3]!=''))? ': "' + arrayValorsMapa[idConexio][3] + '"': ''; 


		temp += '      </font>';
		temp += '     </td>'
		temp += '     </tr> ';
	
	
		temp += '      <tr bgcolor="#e3f5ce">'
//		temp += '      <td rowspan="4" bgcolor="#FFFFFF"></td>'
		for (k=6; k<11 ; k++){
			temp += '<td align="center" width="20%"><font face="Arial, Helvetica, sans-serif" size="1">'
			
			if((arrayValorsMapa[idConexio][k]!='-')&& (idConexio!='-')){
				temp += '<a href="javascript:formulariMapaInst.idConcepte = \'' + arrayValorsMapa[idConexio][k] + '\'; '
				temp += 'escriuCapamcn(creacioFormulariModificarmcn()); '
				temp += 'posaAlFormulariElsValorsDelsCampsmcn()">'
			}
	
			temp +=  'Concepto '+ (k-5)
			temp +=  ((arrayValorsMapa[idConexio][k]!='-') && (idConexio!='-'))? '</a>':'' 
			temp +=  '<br>'
			temp +=  ((arrayValorsMapa[idConexio][k]!='-') && (idConexio!='-'))? 'añadir | <a href="javascript:eliminaFill(\'' + arrayValorsMapa[idConexio][k] + '\', \'' + this.idConcepte + '\')" style="text-decoration: none">borrar</a>' : '' 
			temp +=  (arrayValorsMapa[idConexio][k]=='-')? ' <a href="javascript:creaFill(\'' + arrayValorsMapa[idConexio][1] + '\', \'concepto\', '+ (k-5) +', this.form)" style="text-decoration: none">añadir</a> | borrar':'' 
	
			temp +=  '</td>'
			}
//		temp += '      <td rowspan="4" bgcolor="#FFFFFF"></td>'
		temp += '      </tr>'
		temp += '      <tr bgcolor="#FFFFFF" align="center">'
		for (k=6; k<11 ; k++){
			var idexConcepteFill = arrayValorsMapa[idConexio][k]
			temp += '<td align="center"'
			temp += (idexConcepteFill!='-')? ' bgcolor="#e3f5ce"' : ''
			temp += '>'
			temp += (idexConcepteFill!='-')? '<input type="text" name="fillConcepte' + k + j +'" size="13" ' : '&nbsp;'
			temp += (idexConcepteFill!='-')? ' value="' + arrayValorsMapa[idexConcepteFill][3] + '" ' : ''
			temp += (idexConcepteFill!='-')? ' onChange="modificaItem( \'' + idexConcepteFill + '\', this.form.fillConcepte' + k + j +'.value,\'' + this.idConcepte + '\')">' : ''
	
	//		temp += '>'
			temp += '</td>'
			}
		temp += '      </tr>'
	
		temp += '      <tr bgcolor="#e3f5ce">'
		for (k=11; k<16 ; k++){
			temp += '<td align="center"><font face="Arial, Helvetica, sans-serif" size="1">'
	
			if((arrayValorsMapa[idConexio][k]!='-')&& (idConexio!='-')){
				temp += '<a href="javascript:formulariMapaInst.idConcepte = \'' + arrayValorsMapa[idConexio][k] + '\'; '
				temp += 'escriuCapamcn(creacioFormulariModificarmcn()); '
				temp += 'posaAlFormulariElsValorsDelsCampsmcn()">'
			}
	
			temp +=  'Concepto '+ (k-5)
			temp +=  ((arrayValorsMapa[idConexio][k]!='-')&& (idConexio!='-'))? '</a>':'' 
			temp +=  '<br>'
			temp +=  ((arrayValorsMapa[idConexio][k]!='-')&& (idConexio!='-'))? 'añadir | <a href="javascript:eliminaFill(\'' + arrayValorsMapa[idConexio][k] + '\', \'' + this.idConcepte + '\')" style="text-decoration: none">borrar</a>':'' 
			temp +=  (arrayValorsMapa[idConexio][k]=='-')? ' <a href="javascript:creaFill(\'' + arrayValorsMapa[idConexio][1] + '\', \'concepto\', '+ (k-5) +', this.form)" style="text-decoration: none">añadir</a> | borrar':'' 
	
			temp +=  '</td>'
			}
		temp += '      </tr>'
	
		temp += '      <tr bgcolor="#FFFFFF">'
		for (k=11; k<16 ; k++){
			var idexConcepteFill = arrayValorsMapa[idConexio][k]
			temp += '<td align="center"'
			temp += (idexConcepteFill!='-')? ' bgcolor="#e3f5ce"' : ''
			temp += '>'
	
			temp += (idexConcepteFill!='-')? '<input type="text" name="fillConcepte' + k + j +'" size="13" ' : '&nbsp;'
			temp += (idexConcepteFill!='-')? ' value="' + arrayValorsMapa[idexConcepteFill][3] + '" ' : '' 
			temp += (idexConcepteFill!='-')? ' onChange="modificaItem(\'' + idexConcepteFill + '\', this.form.fillConcepte' + k + j +'.value,\'' + this.idConcepte + '\')"' : ''
	
	
	//		temp += '>'
			temp += '</td>'
		} 
		temp += '      </tr>'
		temp += '      </table>';
	
	temp += '      </td>';
	temp += '    </tr>';
	
	}
	else
			{
			temp += '<td colspan=6 bgcolor="#e3f5ce">&nbsp;</td></tr>'
			}
	
	this.color = !this.color; 
	}
	return temp;
}

function modificaItem(id, formInputValue, idVisualitzar){
//	formInputValue = codificaCaractersmcn(formInputValue)
	var valorAntic = arrayValorsMapa[id][3]
	arrayValorsMapa[id][3] = formInputValue
	if(arrayValorsMapa[id][5]=='conexión'){
		 var idNumeroText = id.substring(2,id.length)
		 var IdNumeroEnter = parseInt(idNumeroText)
		 var nouId = 'id' + (IdNumeroEnter-1)
		 //** per assegurar la compatibilitat cap enredera
		 if (arrayValorsMapa[nouId]){arrayValorsMapa[nouId][3] = formInputValue}
		 else {arrayValorsMapa['id0'][3]=formInputValue}
	}
}

function eliminaElsItemsVuits(){
	for (var y in arrayValorsMapa){
		for (i=16; i<36 ; i++){
			arrayValorsMapa[y][i] = (arrayValorsMapa[y][i] == '')? '-' : arrayValorsMapa[y][i]
		}
		if ((arrayValorsMapa[y][3] == '')||(arrayValorsMapa[y][3] == '*')){
			arrayValorsMapa[y][0] = 'esborrat'
			eliminaFillDelPare(arrayValorsMapa[y][1],arrayValorsMapa[y][2])
		}
	}
}

function creaLligamTipus(id, i){
	posaAlObjecteElsValorsDelsCampsmcn()
	var t = i+15
//	if (arrayValorsMapa[id][t]=='-'){
		for (t=16; t<26 ; t++){
			if (arrayValorsMapa[id][t]=='-')break
			}
//		}
	if(t!=i+15){alert('Por favor, edite el primer espacio disponible')}
	arrayValorsMapa[id][t] = ''
	//** fara un split a http:// i el treura, despres el torno a posar
	arrayValorsMapa[id][t+10] = 'http://'
	escriuCapamcn(creacioFormulariModificarmcn());
	posaAlFormulariElsValorsDelsCampsmcn();
}

function creaLligamHttp(id, i){
	posaAlObjecteElsValorsDelsCampsmcn()
//	var t = i+25
//	if (arrayValorsMapa[id][t]=='-'){
//		for (t=26; t<36 ; t++){
//			if (arrayValorsMapa[id][t]=='-')break
//			}
//	}
//	if(t!=i+25){alert('Por favor, edite el primer espacio disponible')}
	arrayValorsMapa[id][t] = ''
	escriuCapamcn(creacioFormulariModificarmcn());
	posaAlFormulariElsValorsDelsCampsmcn();
}


function eliminaLligam(id, idLligam){
	posaAlObjecteElsValorsDelsCampsmcn()
	if (window.confirm('¿Esta seguro/a que desea eliminar este enlace?')){
		var indexActiu = idLligam
		var indexSeguent=idLligam+1;
		while(arrayValorsMapa[id][indexSeguent]!='-'){
			arrayValorsMapa[id][indexActiu] = arrayValorsMapa[id][indexSeguent]
			arrayValorsMapa[id][indexActiu+10] = arrayValorsMapa[id][indexSeguent+10]
			indexActiu++
			indexSeguent++
			}
		arrayValorsMapa[id][indexActiu] = '-'	
		arrayValorsMapa[id][indexActiu+10] = '-'	
		escriuCapamcn(creacioFormulariModificarmcn());
		posaAlFormulariElsValorsDelsCampsmcn();
	} else {
		escriuCapamcn(creacioFormulariModificarmcn());
		posaAlFormulariElsValorsDelsCampsmcn();
		}
}

function creaFill(pare, tipus, ordre){
	var conceptePresent = false
	posaAlObjecteElsValorsDelsCampsmcn()
	if(tipus == 'conexión'){
		idMajormcn = parseInt(idMajormcn) + 1;
		var arrayValorsMapaNewC = new Array();
		arrayValorsMapaNewC[0] = '-';
		arrayValorsMapaNewC[1] = 'id' + idMajormcn;
		arrayValorsMapaNewC[2] = '-';
		arrayValorsMapaNewC[3] = '*';
		arrayValorsMapaNewC[4] = '-';
		arrayValorsMapaNewC[5] = 'concepto';
		arrayValorsMapaNewC[6] = '-';
		arrayValorsMapaNewC[7] = '-';
		arrayValorsMapaNewC[8] = '-';
		arrayValorsMapaNewC[9] = '-';
		arrayValorsMapaNewC[10] = '-';
		arrayValorsMapaNewC[11] = '-';
		arrayValorsMapaNewC[12] = '-';
		arrayValorsMapaNewC[13] = '-';
		arrayValorsMapaNewC[14] = '-';
		arrayValorsMapaNewC[15] = '-';
		arrayValorsMapaNewC[16] = '-';
		arrayValorsMapaNewC[17] = '-';
		arrayValorsMapaNewC[18] = '-';
		arrayValorsMapaNewC[19] = '-';
		arrayValorsMapaNewC[20] = '-';
		arrayValorsMapaNewC[21] = '-';
		arrayValorsMapaNewC[22] = '-';
		arrayValorsMapaNewC[23] = '-';
		arrayValorsMapaNewC[24] = '-';
		arrayValorsMapaNewC[25] = '-';
		arrayValorsMapaNewC[26] = '-';
		arrayValorsMapaNewC[27] = '-';
		arrayValorsMapaNewC[28] = '-';
		arrayValorsMapaNewC[29] = '-';
		arrayValorsMapaNewC[30] = '-';
		arrayValorsMapaNewC[31] = '-';
		arrayValorsMapaNewC[32] = '-';
		arrayValorsMapaNewC[33] = '-';
		arrayValorsMapaNewC[34] = '-';
		arrayValorsMapaNewC[35] = '-';
		arrayValorsMapaNewC[36] = 'normal';
		arrayValorsMapa['id' + idMajormcn] = arrayValorsMapaNewC;
	}
	idMajormcn = parseInt(idMajormcn) + 1;
	var arrayValorsMapaNew = new Array();
	arrayValorsMapaNew[0] = '-';
	arrayValorsMapaNew[1] = 'id' + idMajormcn;
	arrayValorsMapaNew[2] = pare;
	arrayValorsMapaNew[3] = '';
	arrayValorsMapaNew[4] = '-';
	arrayValorsMapaNew[5] = tipus;
	arrayValorsMapaNew[6] = '-';
	arrayValorsMapaNew[7] = '-';
	arrayValorsMapaNew[8] = '-';
	arrayValorsMapaNew[9] = '-';
	arrayValorsMapaNew[10] = '-';
	arrayValorsMapaNew[11] = '-';
	arrayValorsMapaNew[12] = '-';
	arrayValorsMapaNew[13] = '-';
	arrayValorsMapaNew[14] = '-';
	arrayValorsMapaNew[15] = '-';
	arrayValorsMapaNew[16] = '-';
	arrayValorsMapaNew[17] = '-';
	arrayValorsMapaNew[18] = '-';
	arrayValorsMapaNew[19] = '-';
	arrayValorsMapaNew[20] = '-';
	arrayValorsMapaNew[21] = '-';
	arrayValorsMapaNew[22] = '-';
	arrayValorsMapaNew[23] = '-';
	arrayValorsMapaNew[24] = '-';
	arrayValorsMapaNew[25] = '-';
	arrayValorsMapaNew[26] = '-';
	arrayValorsMapaNew[27] = '-';
	arrayValorsMapaNew[28] = '-';
	arrayValorsMapaNew[29] = '-';
	arrayValorsMapaNew[30] = '-';
	arrayValorsMapaNew[31] = '-';
	arrayValorsMapaNew[32] = '-';
	arrayValorsMapaNew[33] = '-';
	arrayValorsMapaNew[34] = '-';
	arrayValorsMapaNew[35] = '-';
	arrayValorsMapaNew[36] = 'normal';

	arrayValorsMapa['id' + idMajormcn] = arrayValorsMapaNew;

	formulariMapaInst.afageixFillAlPare(pare, ordre);
	escriuCapamcn(creacioFormulariModificarmcn());
	posaAlFormulariElsValorsDelsCampsmcn();
}

function eliminaFill(idAEliminar, idVisualitzar){
	//**arrel o últim fill
	if (
		(idAEliminar== arrel__)||
		((idAEliminar==arrayValorsMapa[arrel__][6])&&(arrayValorsMapa[arrel__][7]=='-'))

		){
			alert('El concepto raiz y la primera asociación no se pueden\neliminar. En cambio si se puede modificar su contenido')
			escriuCapamcn(creacioFormulariModificarmcn());
			posaAlFormulariElsValorsDelsCampsmcn();

	} else{
			if(arrayValorsMapa[idAEliminar][6]=='-'){
				if (window.confirm('¿Esta seguro/a que desea eliminar "'+ arrayValorsMapa[idAEliminar][3] +'"?')){
					arrayValorsMapa[idAEliminar][0] = 'esborrat'
					formulariMapaInst.eliminaFillDelPare(idAEliminar, arrayValorsMapa[idAEliminar][2])
					formulariMapaInst.idConcepte = idVisualitzar;
					escriuCapamcn(creacioFormulariModificarmcn());
					posaAlFormulariElsValorsDelsCampsmcn();
				} else {
						escriuCapamcn(creacioFormulariModificarmcn());
						posaAlFormulariElsValorsDelsCampsmcn();
						}
			} else {
					alert('Antes de eliminar "'+ arrayValorsMapa[idAEliminar][3] +'" debería eliminar los\nconceptos y/o frases de conexión que dependen de él')
					escriuCapamcn(creacioFormulariModificarmcn());
					posaAlFormulariElsValorsDelsCampsmcn();
					}
			}

}

function afageixFillAlPare(pare, ordre){
	for (i=5; i<16 ; i++){if(arrayValorsMapa[pare][i] == '-')break}
	if(i!=ordre+5){alert('Por favor, edite el primer espacio disponible')}
	arrayValorsMapa[pare][i] = 'id' + idMajormcn;
}

function eliminaFillDelPare(idFill,idPare){
	if(idPare!='-'){
		var indexAEsborrar = 0;
		for (i=6; i<16 ; i++){	
			if (arrayValorsMapa[idPare][i] == idFill){
				indexAEsborrar = i
				}
		}
		if(indexAEsborrar!=0){
			var indexActiu = indexAEsborrar
			var indexSeguent=indexAEsborrar+1;
			while(arrayValorsMapa[idPare][indexSeguent]!='-'){
				arrayValorsMapa[idPare][indexActiu] = arrayValorsMapa[idPare][indexSeguent]
				indexActiu++
				indexSeguent++
				}
			arrayValorsMapa[idPare][indexActiu] = '-'	
		}
	}
}

// *****************************
// Generar el codi topic map a partir del codi empaquetat

function generaTopicMap(codi){
	arrayDeArrayDeItems = new Array();
	arrayConceptesTextId = new Array();
	arrayComplertCodiMapa = codi.split('×')

	arrayDeItems = arrayComplertCodiMapa[0].split('æ')
	for (i=0; i<arrayDeItems.length; i++){
		arrayDeValorsDeUnItem = arrayDeItems[i].split('Ø')
		arrayDeArrayDeItems[i]  = arrayDeValorsDeUnItem
		if(arrayDeValorsDeUnItem[5]=='concepto')arrayConceptesTextId[arrayDeValorsDeUnItem[3]] = arrayDeValorsDeUnItem[1]
	}

	tmp = ''
//	tmp += '<?xml version="1.0" encoding="iso-8859-1"?> \n'
	tmp += '<topicMap id="proves" xmlns="http://www.topicmaps.org/xtm/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink">\n\n'
	for (k=0; k<arrayDeArrayDeItems.length; k++){
		
	switch (arrayDeArrayDeItems[k][5]){
		case "concepto":
			tmp += '<topic id="' + arrayDeArrayDeItems[k][1] + '">\n'

			if (arrayDeArrayDeItems[k][2]!='-'){
				tmp += '<instanceOf>\n'
				tmp += '<topicRef xlink:href="'
				tmp += (arrayDeArrayDeItems[k][1]==arrayDeArrayDeItems[k][2])? '#rootConcept' : '#concept' 
				tmp += '"/>\n'
				tmp += '</instanceOf>\n'
			}

			tmp += '<baseName>\n'

			tmp += '<baseNameString>' + arrayDeArrayDeItems[k][3] + '</baseNameString>'
			tmp += '</baseName>\n'

			for (s=16; s<26; s++){
				if(arrayDeArrayDeItems[k][s]!='-'){
					tmp += '<occurrence>\n'
//					tmp += '<instanceOf><topicRef xlink:href="#' + arrayDeArrayDeItems[k][s] + '"/></instanceOf>\n'

					tmp += '<instanceOf><topicRef xlink:href="#' + arrayConceptesTextId[arrayDeArrayDeItems[k][s]] + '"/></instanceOf>\n'
//					tmp += '<resourceRef xlink:href="' + arrayDeArrayDeItems[k][s+10] + '" />\n'
					tmp += '<resourceData>' + arrayDeArrayDeItems[k][s+10] + '</resourceData>\n'

					tmp += '</occurrence>\n'
				}
			}

			tmp += '</topic>\n\n'
			break
		case "conexión":

//			if(arrayConceptesTextId[arrayDeArrayDeItems[k][3]]){
//				alert(arrayConceptesTextId[arrayDeArrayDeItems[k][3]])
//			} else {

//				alert('no')
//			}

			tmp += '<association id="' + arrayDeArrayDeItems[k][1] + '">\n' 
			tmp += '<instanceOf>\n'
			tmp += '<topicRef xlink:href="#' + arrayConceptesTextId[arrayDeArrayDeItems[k][3]] + '"/>\n'
			tmp += '</instanceOf>\n'

			tmp += '<member>\n'
			tmp += '<roleSpec>\n'
			tmp += '<topicRef xlink:href="#father"/>\n'
			tmp += '</roleSpec>\n' 
			tmp += '<topicRef xlink:href="#' + arrayDeArrayDeItems[k][2] + '"/>\n'
			tmp += '</member>\n'

			for (t=6; t<16 ; t++){
				if (arrayDeArrayDeItems[k][t] != '-'){
					tmp += '<member>\n'
					tmp += '<roleSpec>\n'
					tmp += '<topicRef xlink:href="#child"/>\n'
					tmp += '</roleSpec>\n' 
					tmp += '<topicRef xlink:href="#' + arrayDeArrayDeItems[k][t] + '"/>\n'
					tmp += '</member>\n'
				}
			}

			tmp += '</association>\n\n' 
			break
		}
	}
	tmp += '</topicMap>'
	return (tmp)
}

// *****************************

// Generar el codi javascript a partir del codi empaquetat

function generaJavascript(codiXML){
var temp = ''
temp += '<!-- inicio del código javascript del mapa conceptual de navegación -->\n\n'
temp += '<!-- Este mapa conceptual de navegación ha sido creado en www.mapasconceptuales.com-->\n'
temp += '<!-- Está permitido el uso sin fines comerciales de este código JavaScript  -->\n'
temp += '<!-- siempre y cuando se cite su autor y la dirección donde fue creado. -->\n'
temp += '<!-- Los mapas conceptuales de navegación son un servicio gratuito de la -->\n'
temp += '<!-- comunidad profesional hipertext.net desarrollado por ©Cristòfol Rovira-->\n'
temp += '<!-- cristofol@rovira.name  -->\n'
temp += '<!-- http://www.mapasconceptuales.com  -->\n'
temp += '<!-- http://www.hipertext.net  -->\n'
temp += '<!-- Versión 1.3 02/01/2003 13:51 para Internet Explorer 5.0 ó superior -->\n'


temp += '\n<SCRIPT LANGUAGE="JavaScript">\n'

//inici codi que ve de posartemp

temp += 'var lletraDe = \'10\' // Tamaño de letra en el mapa\n'
temp += 'var tipoLetra = \'arial\' // Tipo de letra en el mapa\n'
temp += 'var lletraDeEnlaces = \'11\' // Tamaño de letra en el listado de enlaces\n'
temp += 'var tipoLetraEnlaces = \'verdana\' // Tipo de letra en el listado de enlaces\n'
temp += 'var listadoEnlaces = \'si\' // si o no para no mostrar o no el listado de enlaces\n'
temp += 'var tituloEnlaces = \'Listado de enlaces del mapa\' // título del listado de enlaces\n'
temp += 'var varTarget = \'_top\' // target para los enlaces\n'
temp += 'var dataArraymcn;\n'
temp += 'var modificacionsInstmcn;\n'
temp += 'var dadesMapaBrutesmcn;\n'
temp += 'var idMajormcn = 0;\n'
temp += 'var entratAlEditor = false;\n'
temp += 'var arrayValorsMapa = new Array();\n'
temp += 'function createArraymcn(){\n'
temp += ' arrayDadesMapa = dadesMapaBrutesmcn.split(\'×\');\n'
temp += ' return(arrayDadesMapa);\n'
temp += '}\n'
temp += 'function mostrarMapacn(nodeXMLDoc){\n'
temp += ' if(document.all){\n'
temp += '  dadesMapaBrutesmcn = generarCodiMapa(nodeXMLDoc);\n'
temp += '  dataArraymcn = createArraymcn();\n'
temp += '  arrel = dataArraymcn[1];\n'
temp += '  nodeInicial = dataArraymcn[2];\n'
temp += '  modificacionsInstmcn = new Object();\n'
temp += '  modificacionsInstmcn.editarOMapaOCodi = \'-\';\n'
temp += ' \n'
temp += '  arrayValorsMapa = posaEnUnDobleArray(dataArraymcn[0]);\n'
temp += '  arbreInst = new arbreObj(nodeInicial);\n'
temp += '  document.write(arbreInst.pintaArbreEditable());\n'
temp += ' }\n'
temp += '}\n'
temp += 'function arbreObj(nodeInicialId){\n'
temp += ' this.nodeInicialId = nodeInicialId;\n'
temp += ' this.idActiu;\n'
temp += ' this.pareActiu;\n'
temp += ' this.textActiu;\n'
temp += ' this.tipusVerticalActiu;\n'
temp += ' this.tipusHoritzontalActiu;\n'
temp += ' this.tipusNodeActiu;\n'
temp += ' this.arrayFillsActiu;\n'
temp += ' this.tipusVerticalNodeAnterior;\n'
temp += ' this.tipusHoritzontalNodeAnterior;  \n'
temp += ' this.pintaArbreEditable = pintaArbreEditable;\n'
temp += ' this.pintaNode = pintaNode;\n'
temp += ' \n'
temp += ' this.temp = \'\';\n'
temp += ' \n'
temp += ' this.pintaObrirNode = pintaObrirNode; \n'
temp += ' this.pintaTancarNode = pintaTancarNode;\n'
temp += ' this.comptaFills = comptaFills;\n'
temp += ' this.posaFillsALaPila = posaFillsALaPila;\n'
temp += ' \n'
temp += ' this.push2 = push2;\n'
temp += ' this.pop2 = pop2;\n'
temp += ' this.pilaId = new Array();\n'
temp += ' this.pilaTipusHoritzontal = new Array();\n'
temp += ' \n'
temp += ' this.esUltim = esUltim;\n'
temp += ' this.esPrimer = esPrimer;\n'
temp += ' this.creaLlistatLinks = creaLlistatLinks;\n'
temp += ' this.posaColor = posaColor;\n'
temp += ' this.numeroDeColor = 0;\n'
temp += '}\n'
temp += 'function push2(idNode, tipusH){\n'
temp += ' this.pilaId.push(idNode);\n'
temp += ' this.pilaTipusHoritzontal.push(tipusH);\n'
temp += '}\n'
temp += 'function pop2(){\n'
temp += ' var idNode = this.pilaId.pop();\n'
temp += ' var tipusH = this.pilaTipusHoritzontal.pop();\n'
temp += ' var arrayTopPila = new Array();\n'
temp += ' arrayTopPila[0] = idNode;\n'
temp += ' arrayTopPila[1] = tipusH; \n'
temp += ' return arrayTopPila;\n'
temp += '}\n'
temp += 'function pintaArbreEditable(){\n'
temp += ' this.temp = \'\';\n'
temp += ' this.temp += \'<table><tr><td>\';\n'
temp += ' this.temp += \'<table border="1" cellspacing="0" cellpadding="8" bordercolor="#EEEEEE"><tr><td align="center">\';\n'
temp += ' this.push2(this.nodeInicialId, \'0\');\n'
temp += ' while(this.pilaId.length>0){this.pintaNode()};\n'
temp += ' this.temp += \'</td></tr></table>\';\n'
temp += ' this.temp += \'<div align="right"><font size=1 face=verdana><a href="http://www.mapasconceptuales.com" style="text-decoration: none; color: #CCCCCC" target="_blank">www.mapasconceptuales.com</a></font></div>\';\n'
temp += ' this.temp += \'</td></tr></table>\';\n'
temp += ' return this.temp;\n'
temp += '}\n'
temp += 'function pintaNode(){\n'
temp += ' var arrayTopPila = this.pop2();\n'
temp += ' if(arrayTopPila[0]==0){this.pintaTancarNode()}\n'
temp += ' else {\n'
temp += '   this.idActiu = arrayTopPila[0];\n'
temp += '  if (this.idActiu.indexOf(\'id\')==0){\n'
temp += '   numero = this.idActiu.substring(2,this.idActiu.length);\n'
temp += '   if (isNaN(numero)) {}\n'
temp += '   else {if (parseInt(numero) > idMajormcn) idMajormcn = numero;}\n'
temp += '  }\n'
temp += '   this.pareActiu = arrayValorsMapa[this.idActiu][2];\n'
temp += '   this.textActiu = arrayValorsMapa[this.idActiu][3];\n'
temp += '    this.tipusHoritzontalActiu = arrayTopPila[1];\n'
temp += '   this.tipusNodeActiu = arrayValorsMapa[this.idActiu][5];\n'
temp += '   this.arrayIdFillsActiu = arrayValorsMapa[this.idActiu].slice(6,16);\n'
temp += '    this.arrayIdFillsActiu.reverse();\n'
temp += '   if (this.idActiu == this.nodeInicialId){this.tipusVerticalActiu=\'1\'}\n'
temp += '   else {\n'
temp += '    if (this.comptaFills()>0)this.tipusVerticalActiu=\'2\';\n'
temp += '    if (this.comptaFills()==0)this.tipusVerticalActiu=\'3\';\n'
temp += '   }\n'
temp += '   this.posicioEspecial = arrayValorsMapa[this.idActiu][36]; \n'
temp += '   this.pintaObrirNode();\n'
temp += ' if (this.comptaFills()>0){this.posaFillsALaPila()}\n'
temp += ' else{this.pintaTancarNode()};\n'
temp += ' }\n'
temp += '}\n'
temp += 'function esPrimer(){\n'
temp += ' if (this.idActiu == this.nodeInicialId) {return true}\n'
temp += ' else {return (arrayValorsMapa[this.pareActiu][6] == this.idActiu)}\n'
temp += '}\n'
temp += 'function esUltim(){\n'
temp += ' if (this.idActiu == this.nodeInicialId) {return true}\n'
temp += ' else {\n'
temp += '   var arrayTemp = arrayValorsMapa[this.pareActiu].slice(6,16);\n'
temp += '   arrayTemp.reverse();\n'
temp += '   for (i=0; i<10; i++){if (arrayTemp[i] != \'-\')break};\n'
temp += '   return (arrayTemp[i] == this.idActiu);\n'
temp += '  }\n'
temp += '}\n'
temp += 'function comptaFills(){\n'
temp += ' var comptador = 0;\n'
temp += ' for (i=0; i<10 ; i++){if (this.arrayIdFillsActiu[i] != \'-\')comptador++};\n'
temp += ' return comptador;\n'
temp += '}\n'
temp += 'function posaFillsALaPila(){\n'
temp += ' this.push2(0, \'0\');\n'
temp += ' for (r=0; r<10 ; r++){\n'
temp += '  if (this.arrayIdFillsActiu[r]!=\'-\'){this.push2(this.arrayIdFillsActiu[r], \'0\')} \n'
temp += ' }\n'
temp += '}\n'
temp += 'function pintaTancarNode(){ \n'
temp += ' temp = \'\';\n'
temp += ' temp += \'</td>\';\n'
temp += ' temp += \'</tr>\';\n'
temp += ' temp += \'</table>\';\n'
temp += ' temp += \'</td>\';\n'
temp += ' temp += \'</tr>\';\n'
temp += ' temp += \'</table>\';\n'
temp += ' this.temp += temp;\n'
temp += '}\n'
temp += 'function posaColor(){\n'
temp += ' var arrayDeColors = new Array();\n'
temp += ' arrayDeColors[0] = \'CCCCFF\';\n'
temp += ' arrayDeColors[1] = \'FFCCCC\';\n'
temp += ' arrayDeColors[2] = \'CCFFFF\';\n'
temp += ' arrayDeColors[3] = \'FFFFCC\';\n'
temp += ' arrayDeColors[4] = \'EEEEEE\';\n'
temp += ' arrayDeColors[5] = \'CCFFCC\';\n'
temp += ' arrayDeColors[6] = \'CCCC99\';\n'
temp += ' arrayDeColors[7] = \'99CCFF\';\n'
temp += ' arrayDeColors[8] = \'FFCC99\';\n'
temp += ' if (this.tipusNodeActiu==\'concepto\') this.numeroDeColor++;\n'
temp += ' if (this.numeroDeColor>8) this.numeroDeColor = 0;\n'
temp += ' return (arrayDeColors[this.numeroDeColor]);\n'
temp += '}\n'
temp += 'function pintaObrirNode(){ \n'
temp += ' var idPare = arrayValorsMapa[this.idActiu][2];\n'
temp += ' var idPrimerFill = arrayValorsMapa[idPare][6];\n'
temp += ' if (idPare == this.idActiu) arrayValorsMapa[idPrimerFill][\'color\'] = \'CCCCFF\';\n'
temp += ' if (!(arrayValorsMapa[idPrimerFill][\'color\'])){\n'
temp += '  arrayValorsMapa[idPrimerFill][\'color\'] = this.posaColor();\n'
temp += ' } else {arrayValorsMapa[this.idActiu][\'color\'] = arrayValorsMapa[idPrimerFill][\'color\']}\n'
temp += ' temp = \'\';\n'
temp += ' if (!this.esPrimer()){\n'
temp += '  temp += (this.posicioEspecial == \'vertical\')? \'\':\'</td><td align=center>\';\n'
temp += ' }\n'
temp += ' temp += \'          <table border="0" cellspacing="0" cellpadding="0">\';\n'
temp += ' temp += \'          <tr valign="top"> \';\n'
temp += ' if(this.posicioEspecial == \'vertical\'){\n'
temp += '  temp += \'<td colspan="2" width=1></td><td colspan="2" width=1></td>\';\n'
temp += ' } else {\n'
temp += '  temp += (this.esPrimer() && this.esUltim())? \'<td colspan="2" width=1></td><td colspan="2" width=1></td>\':\'\';\n'
temp += '  temp += (this.esPrimer() && !this.esUltim())? \'<td colspan="2" width=1></td><td colspan="2" bgcolor="#333333" width=1></td>\':\'\';\n'
temp += '  temp += (!this.esPrimer() && this.esUltim())? \'<td colspan="2" bgcolor="#333333" width=1></td><td colspan="2" width=1></td>\':\'\';\n'
temp += '  temp += (!this.esPrimer() && !this.esUltim())? \'<td colspan="2" bgcolor="#333333" width=1></td><td colspan="2" bgcolor="#333333" width=1></td>\':\'\';\n'
temp += ' }\n'
temp += ' temp += \'          </tr>\';\n'
temp += ' temp += \'          <tr valign="top"> \';\n'
temp += ' temp += \'            <td align="center" colspan="1" rowspan="4" width=2 height="3"></td>\';\n'
temp += ' temp += (this.tipusVerticalActiu == \'1\')? \'<td align="center" colspan="2"></td>\':\'<td align="center" colspan="2">\' + liniaVertical() + \'</td>\';\n'
temp += ' temp += \'            <td align="center" colspan="1" rowspan="4" width=2 height="3"></td>\';\n'
temp += ' temp += \'          </tr>\';\n'
temp += ' temp += \'          <tr valign="top"> \';\n'
temp += ' temp += \'            <td align="center" colspan="2" style="font-family: \'+ tipoLetra +\'; font-size: \'+ lletraDe +\'px; white-space: nowrap; word-spacing: 1px; text-decoration: none;"> \';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'<table border="1" cellspacing="0" cellpadding="2" bordercolor="#BBBBBB">\':\'\';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'<tr valign="top">\':\'\';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'<td style="font-family: \'+ tipoLetra +\'; font-size: \'+ lletraDe +\'px; white-space: nowrap; word-spacing: 1px; text-decoration: none;" align="center" bgcolor="#\'+ arrayValorsMapa[this.idActiu][\'color\'] +\'">\':\'\'; \n'
temp += ' if ((this.tipusNodeActiu==\'concepto\')&&(arrayValorsMapa[this.idActiu][16]!=\'-\')){\n'
temp += '  temp += (modificacionsInstmcn.editarOMapaOCodi == \'editar\')? \'<a href="javascript:onpleCapaLinks(\' :  \'<a href="javascript:onpleCapaLinks(\'\n'
temp += '  temp += \'\\\'\' + this.idActiu + \'\\\')">\' + trancarString(this.textActiu) + \'</a>\'\n'
temp += '  } else {temp += \'<font color="#000000">\' + trancarString(this.textActiu) + \'</font>\'}\n'
temp += ' if((this.tipusNodeActiu==\'concepto\')&&(modificacionsInstmcn.editarOMapaOCodi == \'editar\')){ \n'
temp += '   temp += \' <br><a href="javascript:formulariMapaInst.idConcepte = \\\'\' + this.idActiu + \'\\\'; \'\n'
temp += '   temp += \' modificacionsInstmcn.editarOMapaOCodi = \\\'editarUn\\\'; \'\n'
temp += '  // temp += \' escriuCapamcn(creacioFormulariModificarmcn()); \'\n'
temp += '  // temp += \' posaAlFormulariElsValorsDelsCampsmcn();\n'
temp += '   temp += \'canviAVeuremcn();\'\n'
temp += '   temp += \'"><img border="0" src="plum2.gif" width="15" height="15"></a>\'\n'
temp += ' }\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \' \':\'\';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'</td>\':\'\';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'</tr>\':\'\';\n'
temp += ' temp += (this.tipusNodeActiu==\'concepto\')? \'</table>\':\'\';\n'
temp += ' temp += \'            </td>\';\n'
temp += ' temp += \'          </tr>\';\n'
temp += ' temp += \'          <tr valign="top"> \';\n'
temp += ' if (this.comptaFills()>1){\n'
temp += '   temp += (arrayValorsMapa[this.arrayIdFillsActiu[9]][36]!=\'vertical\')? \'<td align="center" colspan="2">\' + liniaVertical() + \'</td>\' : \'\'\n'
temp += ' } \n'
temp += ' temp += \'</tr>\';\n'
temp += ' temp += \'<tr valign="top">\';\n'
temp += ' temp += \'<td align="center" colspan="2">\';\n'
temp += ' temp += \'<table border="0" cellspacing="0" cellpadding="0" bordercolor=red>\';\n'
temp += ' temp += \'<tr valign="top" valign=top>\';\n'
temp += ' temp += \'<td align="center">\';\n'
temp += ' this.temp += temp; \n'
temp += '}\n'
temp += 'function capesMapaEditor(){\n'
temp += ' temp = \'\';\n'
temp += ' temp += \'<div id="capaLinks1" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks2" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks3" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks4" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks5" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks6" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks7" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks8" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks9" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' temp += \'<div id="capaLinks10" style="position:absolute; left: 100; top: 100; z-index=2"></div>\\n\';\n'
temp += ' if(!(document.all[\'capaLinks1\'])) document.write(temp)\n'
temp += '}\n'
temp += 'if(document.all)capesMapaEditor()\n'
temp += 'function empaquetarMapa(){\n'
temp += ' var temp = \'\';\n'
temp += ' for(var indexPle in arrayValorsMapa){\n'
temp += '  if(arrayValorsMapa[indexPle].length<37){arrayValorsMapa[indexPle][36] = \'normal\'}\n'
temp += '  if(arrayValorsMapa[indexPle][0]!=\'esborrat\'){\n'
temp += '   for (i=0; i<37 ; i++){\n'
temp += '    temp += arrayValorsMapa[indexPle][i] + \'Ø\';\n'
temp += '   }\n'
temp += '   temp = temp.substring(0, temp.length-1);\n'
temp += '   temp += \'æ\';\n'
temp += '  }\n'
temp += ' }\n'
temp += ' temp = temp.substring(0, temp.length-1);\n'
temp += ' return temp;\n'
temp += '}\n'
temp += 'function posaEnUnDobleArray(temporal){\n'
temp += ' var arrayFinal = new Array();\n'
temp += ' arrayDeItems = temporal.split(\'æ\');\n'
temp += ' for (i=0; i<arrayDeItems.length; i++){\n'
temp += '  arrayDeValorsItem = arrayDeItems[i].split(\'Ø\');\n'
temp += '  arrayFinal[arrayDeValorsItem[1]] = arrayDeValorsItem;\n'
temp += ' }\n'
temp += ' return arrayFinal\n'
temp += '}\n'
temp += 'function trancarString(temp){\n'
temp += ' if ((temp.length > 13) && (temp.indexOf(\' \') != -1)){\n'
temp += '  puntDeTrancamentInicial = parseInt(temp.length/2);\n'
temp += '  fragmentInicial = temp.substring(0,puntDeTrancamentInicial);\n'
temp += '  fragmentFinal = temp.substring(puntDeTrancamentInicial, temp.length);\n'
temp += '  if (fragmentInicial.indexOf(\' \')!=-1){\n'
temp += '   ultimBlancFragmentInicial = fragmentInicial.lastIndexOf(\' \')\n'
temp += '   ultimBlancFragmentInicialContatPelFinal = fragmentInicial.length - ultimBlancFragmentInicial -1;\n'
temp += '  } else {ultimBlancFragmentInicialContatPelFinal = 100}\n'
temp += '  if (fragmentFinal.indexOf(\' \')!=-1){\n'
temp += '   primerBlancFragmentFinal = fragmentFinal.indexOf(\' \')\n'
temp += '  } else {primerBlancFragmentFinal = 100}\n'
temp += '  puntDeTrancament = (ultimBlancFragmentInicialContatPelFinal <= primerBlancFragmentFinal)? ultimBlancFragmentInicial : fragmentInicial.length + primerBlancFragmentFinal;\n'
temp += '  tempFinal = temp.substring(0, puntDeTrancament);\n'
temp += '  tempFinal += \'<br>\';\n'
temp += '  tempFinal += temp.substring(puntDeTrancament+1, temp.length);\n'
temp += '  return tempFinal;\n'
temp += ' } else return temp\n'
temp += '}\n'
temp += 'function liniaVertical(){\n'
temp += ' temp = \'\';\n'
temp += ' temp += \'<table border="0" cellspacing="0" cellpadding="0">\'\n'
temp += ' temp += \'  <tr>\'\n'
temp += ' temp += \'    <td width=5></td>\'\n'
temp += ' temp += \'    <td width=1 height=10 bgcolor="#000000"></td>\'\n'
temp += ' temp += \'    <td width=5></td>\'\n'
temp += ' temp += \'  </tr>\'\n'
temp += ' temp += \'</table>\'\n'
temp += ' return temp\n'
temp += '}\n'
temp += 'function creuTancar(capaActivaId){\n'
temp += ' var temp = \'\'\n'
temp += ' temp = \'\'\n'
temp += ' temp += \'<table style="cursor: hand" border="0" cellspacing="0" cellpadding="0" onClick="buidaCapaLinks(\'+ capaActivaId +\')">\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \' <tr>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \'  <td width=1 height=1 bgcolor="#000000"></td>\\n\'\n'
temp += ' temp += \' </tr>\\n\'\n'
temp += ' temp += \'</table>\\n\'\n'
temp += ' return  temp\n'
temp += '}\n'
temp += 'if(document.all){\n'
temp += ' document.onclick = controladorClick;\n'
temp += ' document.onkeydown = controladorPitjarTecla;\n'
temp += ' document.onkeyup = controladorDesPitjarTecla; \n'
temp += ' var tope = 0;\n'
temp += ' var lefte = 0;\n'
temp += ' var capaActivaId = 1;\n'
temp += ' var teclaControl = false;\n'
temp += '}\n'
temp += 'function controladorPitjarTecla(){\n'
temp += ' if (event.ctrlKey) teclaControl = true;\n'
temp += '}\n'
temp += 'function controladorDesPitjarTecla(){\n'
temp += ' teclaControl = false;\n'
temp += '}\n'
temp += 'function controladorClick(){\n'
temp += '  tope = event.clientY + document.body.scrollTop;\n'
temp += '  lefte = event.clientX + document.body.scrollLeft;\n'
temp += '  if(document.all && entratAlEditor){\n'
temp += '     var lligamForaEditor = false\n'
temp += '       if (window.event.srcElement.tagName == "A"){\n'
temp += '         lligamForaEditor = ((window.event.srcElement.href.indexOf(\'http://\')!=-1)||\n'
temp += '                   (window.event.srcElement.href.indexOf(\'file:///\')!=-1))\n'
temp += '        if (lligamForaEditor){\n'
temp += '          var frase = \'\'\n'
temp += '          frase += "Si abandona el editor se borrará el mapa que haya realizado.\\n"\n'
temp += '          frase += "¿Está seguro/a que desea activar el enlace y salir del editor?\\n\\n" \n'
temp += '          frase += "Pulse en \\"Cancelar\\" para permanecer en el editor."       \n'
temp += '          if (!confirm(frase)) {\n'
temp += '           event.returnValue = false\n'
temp += '          }\n'
temp += '        }\n'
temp += '     }\n'
temp += '  }\n'
temp += '}\n'
temp += 'function onpleCapaLinks(id){\n'
temp += ' if (capaActivaId == 10){capaActivaId = 1}\n'
temp += ' else {if(teclaControl){capaActivaId = capaActivaId+1}}\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.top = tope;\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.left = lefte;\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.border = "solid #555555 1px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.backgroundColor = "#EEEEEE";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.fontFamily = "arial";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.fontSize = "7px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.paddingBottom = "4px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.paddingLeft = "2px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.paddingRight = "2px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.paddingTop = "2px";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.innerHTML = creaLlistatLinks(id, capaActivaId);\');\n'
temp += '}\n'
temp += 'function buidaCapaLinks(capaActivaId){\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.border = "";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.style.padding = "";\');\n'
temp += ' eval(\'document.all.capaLinks\' + capaActivaId + \'.innerHTML = "";\');\n'
temp += '}\n'
temp += 'function buidaTotesCapesLinks(){\n'
temp += ' for(k=1; k<11; k++){buidaCapaLinks(k)}\n'
temp += '}\n'
temp += 'function creaLlistatLinks(id, capaActivaId){\n'
temp += ' temp = \'\';\n'
temp += ' temp += \'<table border=0 cellpadding="0" cellspacing="0">\';\n'
temp += ' for (var w=16; w<26 ; w++){\n'
temp += '  if (arrayValorsMapa[id][w] != \'-\'){\n'
temp += '   temp += \'<tr>\';\n'
temp += '   temp += (w==16)? \'<td>\' : \'<td colspan=3>\';\n'
temp += '   var arrayEnllac = posaEtiquetaIEnllac(id, w+10)\n'
temp += '   temp += \'<font face="verdana" size="1"><a href="\' + arrayEnllac[1] + \'" \'+ arrayEnllac[3] +\'>\' + arrayEnllac[0] + \'</a></td>\';\n'
temp += '   \n'
temp += '   if(w==16){\n'
temp += '    temp += \'<td width=8 height="1"></td><td align="right">\' + creuTancar(capaActivaId) + \'</td>\';\n'
temp += '   }\n'
temp += '   temp += \'</tr>\';\n'
temp += '  }\n'
temp += ' }\n'
temp += ' temp += \'</table>\';\n'
temp += ' return temp;\n'
temp += '}\n'
temp += 'if (Array.prototype.push && ([0].push(true)==true)) Array.prototype.push = null;\n'
temp += 'if(!Array.prototype.push) {\n'
temp += '    function array_push() {\n'
temp += '        for(i=0;i<arguments.length;i++){\n'
temp += '            this[this.length] = arguments[i];\n'
temp += '        }\n'
temp += '        return this.length;\n'
temp += '    }\n'
temp += '    Array.prototype.push = array_push;\n'
temp += '}\n'
temp += 'if(!Array.prototype.pop) {\n'
temp += '    function array_pop(){\n'
temp += '        lastElement = this[this.length-1];\n'
temp += '        this.length = Math.max(this.length-1,0);\n'
temp += '        return lastElement;\n'
temp += '    }\n'
temp += '    Array.prototype.pop = array_pop;\n'
temp += '}\n'
temp += 'function comentaInici(){if(!document.all)document.write(\'<!-- \')}\n'
temp += 'function comentaFinal(){if(!document.all)document.write(\' -->\')}\n'
temp += 'var arrayIdOrdre = new Array();\n'
temp += 'var arrayIdOrdreFills = new Array();\n'
temp += 'var arrayIdOrdrePare = new Array();\n'
temp += 'var arrayIdIdFills = new Array();\n'
temp += 'var arrayIdIdPare = new Array();\n'
temp += 'var arrayIdText = new Array();\n'
temp += 'var arrayIdTipus = new Array();\n'
temp += 'var llistatOcurrencesTipus = new Array();\n'
temp += 'var llistatOcurrencesHrefoData = new Array();\n'
temp += 'var arrel_;\n'
temp += 'var nodeInicial_;\n'
temp += 'var nodeXMLDoc;\n'
temp += 'var nodeTopicMap;\n'
temp += 'function obtePare(nodeObjAss){\n'
temp += ' for(var j=0;j<nodeObjAss.childNodes.length;j++){\n'
temp += '  if (nodeObjAss.childNodes[j].tagName == \'member\'){\n'
temp += '   for(var k=0;k<nodeObjAss.childNodes[j].childNodes.length;k++){\n'
temp += '    if (nodeObjAss.childNodes[j].childNodes[k].tagName == \'roleSpec\'){\n'
temp += '     if (nodeObjAss.childNodes[j].childNodes[k].firstChild.getAttribute("xlink:href") == \'#father\'){\n'
temp += '      nodeRef = obtePrimerFillAmbEtiqueta(nodeObjAss.childNodes[j], \'topicRef\');\n'
temp += '      refPare = nodeRef.getAttribute("xlink:href");\n'
temp += '      refPareNet = refPare.substring(1, refPare.length);\n'
temp += '      return(refPareNet);\n'
temp += '     }\n'
temp += '    } \n'
temp += '   }\n'
temp += '  }\n'
temp += ' }\n'
temp += ' return \'\';\n'
temp += '}\n'
temp += 'function obteFills(nodeObjAss){\n'
temp += ' llistatFills = new Array();\n'
temp += ' for(var j=0;j<nodeObjAss.childNodes.length;j++){\n'
temp += '  if (nodeObjAss.childNodes[j].tagName == \'member\'){\n'
temp += '   for(var k=0;k<nodeObjAss.childNodes[j].childNodes.length;k++){\n'
temp += '    if (nodeObjAss.childNodes[j].childNodes[k].tagName == \'roleSpec\'){\n'
temp += '     if (nodeObjAss.childNodes[j].childNodes[k].firstChild.getAttribute("xlink:href") == \'#child\'){\n'
temp += '      nodeRef = obtePrimerFillAmbEtiqueta(nodeObjAss.childNodes[j], \'topicRef\');\n'
temp += '      refFill = nodeRef.getAttribute("xlink:href");\n'
temp += '      refFillNet = refFill.substring(1, refFill.length);\n'
temp += '      llistatFills.push(refFillNet);\n'
temp += '     }\n'
temp += '    } \n'
temp += '   }\n'
temp += '  }\n'
temp += ' }\n'
temp += ' return llistatFills;\n'
temp += '}\n'
temp += 'function obteEtiquetaAssociacio(nodeObjAss){\n'
temp += ' instanciaDeObj = obtePrimerFillAmbEtiqueta(nodeObjAss, \'instanceOf\');\n'
temp += ' topicRefObj = obtePrimerFillAmbEtiqueta(instanciaDeObj, \'topicRef\');\n'
temp += ' topicRef = topicRefObj.getAttribute("xlink:href");\n'
temp += ' topicRefNet = topicRef.substring(1, topicRef.length);\n'
temp += ' ordreClassObjAss= arrayIdOrdre[topicRefNet];\n'
temp += ' classObjAss = nodeTopicMap.childNodes[ordreClassObjAss];\n'
temp += ' return(obteText(classObjAss));\n'
temp += '}\n'
temp += 'function obteText(nodeObj){\n'
temp += '  baseNameObj = obtePrimerFillAmbEtiqueta(nodeObj, \'baseName\');\n'
temp += '  baseNameStringObj = obtePrimerFillAmbEtiqueta(baseNameObj, \'baseNameString\');\n'
temp += '  return (baseNameStringObj.firstChild.nodeValue);\n'
temp += '}\n'
temp += 'function obtePrimerFillAmbEtiqueta(nodeObj, etiquetaFill){\n'
temp += ' for(var j=0;j<nodeObj.childNodes.length;j++){\n'
temp += '  if (nodeObj.childNodes[j].tagName == etiquetaFill){return nodeObj.childNodes[j]}\n'
temp += ' }\n'
temp += ' return \'\';\n'
temp += '}\n'
temp += 'function obteInstanciaDe(nodeObjecte){\n'
temp += ' varInstanciaDe = "";\n'
temp += ' for(var i=0;i<nodeObjecte.childNodes.length;i++){\n'
temp += '  if (nodeObjecte.childNodes[i].nodeName == "instanceOf"){\n'
temp += '   varInstanciaDe = nodeObjecte.childNodes[i].firstChild.getAttribute("xlink:href");\n'
temp += '   }\n'
temp += ' }\n'
temp += ' return (varInstanciaDe);\n'
temp += '}\n'
temp += 'function obteResourceRef(nodeObjecte){\n'
temp += ' varResourceRef = "";\n'
temp += ' for(var i=0;i<nodeObjecte.childNodes.length;i++){\n'
temp += '  if (nodeObjecte.childNodes[i].nodeName == "resourceRef"){\n'
temp += '   varResourceRef = nodeObjecte.childNodes[i].getAttribute("xlink:href");\n'
temp += '   }\n'
temp += ' }\n'
temp += ' return (varResourceRef)\n'
temp += '}\n'
temp += 'function obteResourceData(nodeObjecte){\n'
temp += ' resourceDataObj = obtePrimerFillAmbEtiqueta(nodeObjecte, \'resourceData\');\n'
temp += ' if (resourceDataObj) {return (resourceDataObj.firstChild.nodeValue)}\n'
temp += ' else return \'\';\n'
temp += '}\n'
temp += 'function afageixFill(idPare, idFill){\n'
temp += ' ordreFill = arrayIdOrdre[idFill];\n'
temp += ' cadenaFills = arrayIdOrdreFills[idPare];\n'
temp += ' if(cadenaFills.indexOf(\'-\')!=-1){\n'
temp += '  novaCadenaFills = cadenaFills.substring(0,cadenaFills.indexOf(\'-\'));\n'
temp += '  novaCadenaFills += ordreFill;\n'
temp += '  novaCadenaFills += cadenaFills.substring(cadenaFills.indexOf(\'-\')+1,cadenaFills.length);\n'
temp += '  arrayIdOrdreFills[idPare] = novaCadenaFills;\n'
temp += ' }\n'
temp += ' cadenaFills_ = arrayIdIdFills[idPare];\n'
temp += ' if(cadenaFills_.indexOf(\'-\')!=-1){\n'
temp += '  novaCadenaFills_ = cadenaFills_.substring(0,cadenaFills_.indexOf(\'-\'));\n'
temp += '  novaCadenaFills_ += idFill;\n'
temp += '  novaCadenaFills_ += cadenaFills_.substring(cadenaFills_.indexOf(\'-\')+1,cadenaFills_.length);\n'
temp += '  arrayIdIdFills[idPare] = novaCadenaFills_;\n'
temp += ' }\n'
temp += '}\n'
temp += 'function afageixPare(idFill, idPare){\n'
temp += ' ordrePare = arrayIdOrdre[idPare];\n'
temp += ' arrayIdOrdrePare[idFill] = ordrePare;\n'
temp += ' arrayIdIdPare[idFill] = idPare;\n'
temp += '}\n'
temp += 'function ompleArrayOccurrences(nodeObj, identificador){\n'
temp += ' for(var j=0;j<nodeObj.childNodes.length;j++){\n'
temp += '  if (nodeObj.childNodes[j].tagName == \'occurrence\'){\n'
temp += '   idTipusBrut = obteInstanciaDe(nodeObj.childNodes[j]);\n'
temp += '   if(idTipusBrut!=""){\n'
temp += '    IdTipusNet = idTipusBrut.substring(1, idTipusBrut.length);\n'
temp += '    ordreTipus = arrayIdOrdre[IdTipusNet];\n'
temp += '    tipusObj = nodeTopicMap.childNodes[ordreTipus];\n'
temp += '    tipusText = obteText(tipusObj);\n'
temp += '    llistatOcurrencesTipus[identificador].push(IdTipusNet);\n'
temp += '   }\n'
temp += '   var varResourceRef = obteResourceRef(nodeObj.childNodes[j]);\n'
temp += '   var varResourceData = obteResourceData(nodeObj.childNodes[j]);\n'
temp += '   var varResource = (varResourceRef != \'\')? varResourceRef : varResourceData; \n'
temp += '   if ((varResourceRef != \'\')||(varResourceData != \'\')) llistatOcurrencesHrefoData[identificador].push(varResource);\n'
temp += '  }\n'
temp += ' }\n'
temp += '}\n'
temp += 'function ompleArraysGenerals(){\n'
temp += ' for(var i=0;i<nodeTopicMap.childNodes.length;i++){\n'
temp += '  if(nodeTopicMap.childNodes[i].nodeTypeString != \'comment\'){\n'
temp += '   idObjecteActiu = nodeTopicMap.childNodes[i].getAttribute("id");\n'
temp += '   arrayIdOrdreFills[idObjecteActiu] = "Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-";\n'
temp += '   arrayIdIdFills[idObjecteActiu] = "Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-Ø-";\n'
temp += '   arrayIdOrdrePare[idObjecteActiu] = \'-\';\n'
temp += '   arrayIdIdPare[idObjecteActiu] = \'-\';\n'
temp += '   llistatOcurrencesTipus[idObjecteActiu] = new Array();\n'
temp += '   llistatOcurrencesHrefoData[idObjecteActiu] = new Array();\n'
temp += '   identificador = nodeTopicMap.childNodes[i].getAttribute("id");\n'
temp += '   arrayIdOrdre[identificador] = i;\n'
temp += '  }\n'
temp += ' }\n'
temp += '}\n'
temp += 'function ompleArraysPresIFills(){\n'
temp += ' for(var i=0;i<nodeTopicMap.childNodes.length;i++){\n'
temp += '  if(nodeTopicMap.childNodes[i].nodeTypeString != \'comment\'){\n'
temp += '   identificador = nodeTopicMap.childNodes[i].getAttribute("id");\n'
temp += '   switch (nodeTopicMap.childNodes[i].nodeName){\n'
temp += '    case "topic":\n'
temp += '     arrayIdTipus[identificador] = \'concepto\';\n'
temp += '     arrayIdText[identificador] = obteText(nodeTopicMap.childNodes[i]);\n'
temp += '     ompleArrayOccurrences(nodeTopicMap.childNodes[i], identificador);\n'
temp += '     if(obteInstanciaDe(nodeTopicMap.childNodes[i]) == \'#rootConcept\'){\n'
temp += '      afageixPare(identificador,identificador);\n'
temp += '      arrel_ = arrayIdOrdre[identificador];\n'
temp += '      arrel__ = identificador;\n'
temp += '      nodeInicial_ = arrayIdOrdre[identificador];\n'
temp += '      nodeInicial__ = identificador;\n'
temp += '      }\n'
temp += '     break\n'
temp += '    case "association":\n'
temp += '     arrayIdTipus[identificador] = \'conexión\';\n'
temp += '     arrayIdText[identificador] = obteEtiquetaAssociacio(nodeTopicMap.childNodes[i]);\n'
temp += '     avi =  obtePare(nodeTopicMap.childNodes[i]);\n'
temp += '     nets = new Array();\n'
temp += '     nets = obteFills(nodeTopicMap.childNodes[i]);\n'
temp += '     afageixFill(avi, identificador);\n'
temp += '     afageixPare(identificador,avi);\n'
temp += '     for(var t=0;t<nets.length;t++){\n'
temp += '      afageixFill(identificador, nets[t]);\n'
temp += '      afageixPare(nets[t],identificador);\n'
temp += '     }\n'
temp += '    break\n'
temp += '   }\n'
temp += '  }\n'
temp += ' }\n'
temp += '}\n'
temp += 'function generarCodiMapa(nodeXMLDoc){\n'
temp += ' nodeTopicMap = nodeXMLDoc.getElementsByTagName("topicMap").item(0);\n'
temp += ' ompleArraysGenerals();\n'
temp += ' ompleArraysPresIFills();\n'
temp += ' codiMapa = \'\';\n'
temp += ' for(var i=0;i<nodeTopicMap.childNodes.length;i++){\n'
temp += '  if(nodeTopicMap.childNodes[i].nodeTypeString != \'comment\'){\n'
temp += '   iden = nodeTopicMap.childNodes[i].getAttribute("id");\n'
temp += '  \n'
temp += '   codiMapa += \'-Ø\';\n'
temp += '   codiMapa += iden + \'Ø\';\n'
temp += '   codiMapa += arrayIdIdPare[iden] + \'Ø\';\n'
temp += '   codiMapa += arrayIdText[iden] + \'Ø\';\n'
temp += '   codiMapa += \'-Ø\';\n'
temp += '   codiMapa += arrayIdTipus[iden];\n'
temp += '   codiMapa += arrayIdIdFills[iden];\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][0]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][0] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][1]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][1] : \'Ø-\';\n'

temp += '   codiMapa += (llistatOcurrencesTipus[iden][2]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][2] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][3]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][3] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][4]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][4] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][5]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][5] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][6]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][6] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][7]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][7] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][8]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][8] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesTipus[iden][9]!=null) ? \'Ø\'+llistatOcurrencesTipus[iden][9] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][0]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][0] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][1]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][1] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][2]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][2] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][3]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][3] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][4]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][4] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][5]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][5] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][6]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][6] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][7]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][7] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][8]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][8] : \'Ø-\';\n'
temp += '   codiMapa += (llistatOcurrencesHrefoData[iden][9]!=null) ? \'Ø\'+llistatOcurrencesHrefoData[iden][9] : \'Ø-\';\n'
temp += '   codiMapa += \'Ønormalæ\';\n'
temp += '  }\n'
temp += ' }\n'
temp += ' codiMapa = codiMapa.substring(0,codiMapa.length-1) + \'×\' + arrel__ + \'×\' + nodeInicial__;\n'
temp += ' return(codiMapa);\n'
temp += '}\n'
temp += 'function generaLlistatDeLinks(){\n'
temp += '  var idActiu = \'\'\n'
temp += '  var idPare = \'\'\n'
temp += '  var idAbuelo = \'\'\n'
temp += '  var trobat = false\n'
temp += '  var hiHalligams = false\n'
temp += '  var arrayEtiquetaHttp = new Array()\n'
temp += '    var temp = \'\'\n'
temp += '  temp += \'<table border=0 cellpadding="4" cellspacing="0" style="font-family:\'+ tipoLetraEnlaces +\'; font-size:\'+ lletraDeEnlaces +\'; color: #444444;">\'\n'
temp += '   temp += \'<tr><td style="font-size:14">\'+ tituloEnlaces + \'</td></tr>\'\n'
temp += '  \n'
temp += '   for(var indexString in arrayValorsMapa){\n'
temp += '    if((arrayValorsMapa[indexString][0]!=\'esborrat\')&&(indexString!=\'pop\')&&(indexString!=\'push\')&&(arrayValorsMapa[indexString][16]!= \'-\')){\n'
temp += '     trobat = false\n'
temp += '     for (w=16; w<26 ; w++){     \n'
temp += '        if (arrayValorsMapa[indexString][w]!= \'-\'){\n'
temp += '       hiHalligams = true\n'
temp += '        idActiu = arrayValorsMapa[indexString][1]\n'
temp += '        idPare = arrayValorsMapa[indexString][2]\n'
temp += '        idAbuelo = arrayValorsMapa[idPare][2]\n'
temp += '         if(!trobat){\n'
temp += '          temp += \'<tr><td bgcolor="#EEEEEE">\'\n'
temp += '          \n'
temp += '            temp += \'<b>\' + arrayValorsMapa[indexString][3] + \'</b>\'\n'
temp += '           //temp += \'<br>\' \n'
temp += '           //temp += (idAbuelo!=idActiu)? \'<font size=1>\' : \'\'\n'
temp += '           //temp += (idAbuelo!=idActiu)? arrayValorsMapa[idAbuelo][3] + \' \' : \'\'\n'
temp += '          //temp += (idAbuelo!=idActiu)? arrayValorsMapa[idPare][3] + \' \' : \'\'\n'
temp += '            //temp += (idAbuelo!=idActiu)? arrayValorsMapa[indexString][3].toLowerCase() : \'\'\n'
temp += '           //temp += (idAbuelo!=idActiu)? \'</font size=1>\' : \'\'\n'
temp += '        \n'
temp += '          temp += \'</tr>\'\n'
temp += '         }\n'
temp += '      \n'
temp += '        temp += \'<tr><td>\'\n'
temp += '       arrayEtiquetaHttp = posaEtiquetaIEnllac(indexString, w+10)\n'
temp += '       \n'
temp += '          temp += \'&bull; \' + arrayValorsMapa[indexString][w] + \' : \' \n'
temp += '          temp += \'<a href="\'+ arrayEtiquetaHttp[1] +\'" \'+ arrayEtiquetaHttp[3] +\'>\' + arrayEtiquetaHttp[0] + \'</a>\'\n'
temp += '          temp += (arrayEtiquetaHttp[1].indexOf(arrayEtiquetaHttp[0])==-1)? \'<br>\' + arrayEtiquetaHttp[1] : \'\'\n'
temp += '        temp += \'</td></tr>\'\n'
temp += '         trobat = true\n'
temp += '         }\n'
temp += '     }\n'
temp += '    temp += (trobat)? \'<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>\' : \'\'\n'
temp += '    }\n'
temp += '   }  \n'
temp += '  temp += \'</table>\'\n'
temp += '  temp = (hiHalligams)? temp : \'\'\n'
temp += '   return temp\n'
temp += '}\n'
temp += 'function posaEtiquetaIEnllac(indexString, w){\n'
temp += '  var arrayindexLink = new Array()\n'
temp += '   arrayindexLink = arrayValorsMapa[indexString][w].split(\'http://\')\n'
temp += '  arrayindexLink[3] = \'target="\'+ varTarget + \'"\'\n'
temp += '   if((arrayValorsMapa[indexString][w].indexOf(\'http://\')==-1)&&(arrayValorsMapa[indexString][w].indexOf(\' \')==-1)){\n'
temp += '     arrayindexLink[0] = arrayValorsMapa[indexString][w]\n'
temp += '     arrayindexLink[1] = arrayValorsMapa[indexString][w]\n'
temp += '   } else{\n'
temp += '       if(arrayValorsMapa[indexString][w].indexOf(\'http://\')==-1){\n'
temp += '     arrayindexLink[3] = \'\'\n'
temp += '     var separacio = arrayValorsMapa[indexString][w].lastIndexOf(\' \')\n'
temp += '     var puntFinal = arrayValorsMapa[indexString][w].length\n'
temp += '     arrayindexLink[0] = arrayValorsMapa[indexString][w].substring(0, separacio)\n'
temp += '     arrayindexLink[1] = arrayValorsMapa[indexString][w].substring(separacio+1,puntFinal)\n'
temp += '     } else {\n'
temp += '       arrayindexLink[0] = (arrayindexLink[0]==\'\')? arrayindexLink[1] : arrayindexLink[0]\n'
temp += '        arrayindexLink[1] = \'http://\' + arrayindexLink[1]\n'
temp += '     }\n'
temp += '   }\n'
temp += '   arrayindexLink[0] = (arrayindexLink[0].charAt(arrayindexLink[0].length-1)==\' \')? \n'
temp += '                        arrayindexLink[0].substring(0,(arrayindexLink[0].length-1)) :\n'
temp += '              arrayindexLink[0]\n'
temp += '  return arrayindexLink\n'
temp += '}\n'

//final codi que ve de posartemp

temp += '</SCRIPT>\n'
temp += '\n<SCRIPT LANGUAGE="JavaScript">comentaInici()</SCRIPT>\n'
temp += '<XML ID="mapa">\n'
temp += codiXML
temp += '\n</XML>\n'
temp += '\n<SCRIPT LANGUAGE="JavaScript">comentaFinal()</SCRIPT>\n'
temp += '\n<SCRIPT LANGUAGE="JavaScript">\n'
temp += 'nodeXMLDoc = (document.all)? document.all("mapa").XMLDocument : ""\n'
temp += 'mostrarMapacn(nodeXMLDoc)\n'
temp += 'if(listadoEnlaces==\'si\')document.write(generaLlistatDeLinks());\n'
temp += '</SCRIPT>\n'
temp += '\n<!-- final del código javascript del mapa conceptual de navegación -->\n'
return temp
}

function agafarXMLdelCodiJavascript(codi){
	var codiXML = ''
	var obert= false
	arrayCodi = codi.split('\r\n')
	for (r=0; r<arrayCodi.length; r++){
		if (arrayCodi[r].indexOf('<XML ID="mapa">')!=-1) obert=true
		if (obert) codiXML += arrayCodi[r]
		if (arrayCodi[r].indexOf('</XML>')!=-1) obert=false
	}
	return codiXML
}
