/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','1406',jdecode('%C3%81rea+de+actuaci%C3%B3n'),jdecode(''),'/1406.html','true',[],'',''],
	['PAGE','19901',jdecode('Proyectos+de+instalaciones'),jdecode(''),'/19901.html','true',[],'',''],
	['PAGE','19922',jdecode('Licencias+de+actividades'),jdecode(''),'/19922.html','true',[],'',''],
	['PAGE','1697',jdecode('Consultor%C3%ADa+energ%C3%A9tica'),jdecode(''),'/1697.html','true',[],'',''],
	['PAGE','19943',jdecode('Peritajes+y+Dict%C3%A1menes'),jdecode(''),'/19943.html','true',[],'',''],
	['PAGE','14943',jdecode('Consultor%C3%ADa+ambiental'),jdecode(''),'/14943.html','true',[],'',''],
	['PAGE','14901',jdecode('Docencia'),jdecode(''),'/14901.html','true',[],'',''],
	['PAGE','14922',jdecode('Colaboraciones'),jdecode(''),'/14922.html','true',[],'',''],
	['PAGE','1670',jdecode('Trabajos+realizados'),jdecode(''),'/1670.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Eatdrink';
theSitetree.paletteFamily='7575CE';
theSitetree.keyvisualId='3362';
theSitetree.keyvisualName='kv_3362.jpg';
theSitetree.fontsetId='10621';
theSitetree.graphicsetId='10738';
theSitetree.contentColor='5757DA';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Eatdrink',
				paletteFamily: 	'7575CE',
				keyvisualId: 	'3362',
				keyvisualName: 	'kv_3362.jpg',
				fontsetId: 		'10621',
				graphicsetId: 	'10738',
				contentColor: 	'5757DA',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'1B1B6F',
				e_color: 		'1B1B6F',
				f_color: 		'1B1B6F',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1406',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1406',
internalId:  '',
customField: '20100328-175150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1670',
internalId:  '',
customField: '20100328-175959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1697',
internalId:  '',
customField: '20100518-184543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19901',
internalId:  '',
customField: '20100328-175220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19922',
internalId:  '',
customField: '20100328-175254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19943',
internalId:  '',
customField: '20100328-175402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14943',
internalId:  '',
customField: '20100328-175430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20100328-175523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14922',
internalId:  '',
customField: '20100328-175630'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1406',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '19901',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '19922',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1697',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '19943',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14943',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14901',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '14922',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1670',
internalId:  '',
customField: 'language:es;country:ES;'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'Aas010INEA24';
var companyName   = 'Pere+Rams+-+Ingenier%C3%ADa+y+Proyectos';
var htmlTitle	  = '';
var metaKeywords  = 'pere+rams+creixenti%2C+ingeniero+industrial%2C+barcelona%2C+terres+de+lebre%2C+ebre%2C+batea%2C+proyectos+de+electricidad%2C+proyectos+de+climatizacion%2C+proyectos+de+actividades%2C+consultoria+energ%C3%A9tica%2C+auditoria+energ%C3%A9tica%2C+barcelona%2C+ingenieria%2C+consultoria%2C+electricidad%2C+el%C3%A9ctricas%2C+ambiental%2C+mediomabiente%2C+licencias%2C+legalizaciones%2C+legalizacion%2C+licencia%2C+direccion+de+obras%2C+manteniminetos%2C+proyectos+electricos%2C+proyectos+t%C3%A9rmicos%2C+proyectos+aire+acondicionado%2C+proyectos+ambientales%2C+licencias+ambientales%2C+evaluaciones+ambientales%2C+proyectos+de+gas+y+petroleo%2C+auditoria+energ%C3%A9tica%2C+estudio+energetico%2C+eficiencia+energ%C3%A9tica%2C+consultor%C3%ADa+t%C3%A9cnica%2C+poryecto+solar%2C+proyecto+fotovoltaica';
var metaContents  = 'proyectos%2C+legalizaciones%2C+actividades%2C+consultoria%2C+auditoria+energetica%2C+medioambiental%2C+ingenieria%2C+enginyeria%2C+electricidad%2C+solar%2C+climatizaci%C3%B3n%2C+t%C3%A9rmicas%2C+barcelona%2C+legalizaci%C3%B3n%2C+pere+rams%2C+mantenimientos%2C+gas%2C+petroligeras%2C+memoria%2C++proyecto+el%C3%A9ctrico%2C+proyecto+t%C3%A9rmico%2C+proyecto+solar%2C+proyecto+actividades%2C+proyecto+ambiental%2C+evaluacion+ambiental%2C+consultoria+energ%C3%A9tica%2C+ahorro+energ%C3%A9tico%2C+eficiencia+energ%C3%A9tica%2C+projectes+electrics';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
