/* [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','18601',jdecode('BIENVENIDO'),jdecode(''),'/18601.html','true',[],'',''],
	['PAGE','10327',jdecode('CONTACTAR'),jdecode(''),'/10327.html','true',[],'',''],
	['PAGE','163601',jdecode('Penal'),jdecode(''),'/163601.html','true',[],'',''],
	['PAGE','22601',jdecode('Civil'),jdecode(''),'/22601.html','true',[],'',''],
	['PAGE','23522',jdecode('Laboral'),jdecode(''),'/23522.html','true',[],'',''],
	['PAGE','166801',jdecode('Internacional'),jdecode(''),'/166801.html','true',[],'',''],
	['PAGE','153701',jdecode('Esquemas+y+escritos'),jdecode(''),'/153701.html','true',[],'',''],
	['PAGE','143801',jdecode('Enlaces'),jdecode(''),'/143801.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Moonflight';
theSitetree.paletteFamily='5B7A93';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='445';
theSitetree.graphicsetId='499';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Moonflight',
				paletteFamily: 	'5B7A93',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'445',
				graphicsetId: 	'499',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'2C5574',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '153701',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '23522',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20100310-142225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10327',
internalId:  '',
customField: '20100310-141404'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '18601',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '166801',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22601',
internalId:  '',
customField: '20100307-093548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '163601',
internalId:  '',
customField: '20100310-125221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23522',
internalId:  '',
customField: '20100308-143924'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '143801',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '143801',
internalId:  '',
customField: '20100310-103247'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '22601',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '166801',
internalId:  '',
customField: '20100307-190938'
};
webappMappings['7008']=webappMappings['7008-6700']={
webappId:    '7008',
documentId:  '10327',
internalId:  '6700',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10327',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '153701',
internalId:  '',
customField: '20100301-143316'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '163601',
internalId:  '',
customField: 'language:es;country:ES;'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20IN3CVC';
var companyName   = 'ABOGADOS+C%C3%A1novas+Del+Castillo+%26+Aguirre';
var htmlTitle	  = 'ABOGADOS+EN+MADRID';
var metaKeywords  = 'ABOGADOS%2C+ABOGADO%2C+ABOGADOS+en+Madrid%2C+abogado+en+Madrid%2C+despacho+de+abogados%2Cdespachos+abogados%2C+penal%2C+penalista%2C+penalistas%2C+Mara+Aguirre';
var metaContents  = '+ABOGADOS%2CABOGADO%2CAbogados+en+Madrid%2Cabogado+en+madrid%2C+si+necesita+abogado%2C++penalistas%2C+laboralistas+o+civilistas+para+divorcios%2C+reclamaciones+de+cantidad%2Cherencias%2C+contratos+o+cualquier+necesidad+jur%C3%ADdica+que+usted+tenga+somos+su+despacho.+Mara+Aguirre';
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();
};
