/* [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','601',jdecode('PRESENTACION'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','652',jdecode('QU%C3%89++HACEMOS'),jdecode(''),'/652.html','true',[],'',''],
	['PAGE','47201',jdecode('SERVICIOS'),jdecode(''),'/47201/index.html','true',[ 
		['PAGE','45801',jdecode('DESARROLLO'),jdecode(''),'/47201/45801.html','true',[],'',''],
		['PAGE','47222',jdecode('INTERNACIONAL'),jdecode(''),'/47201/47222.html','true',[],'',''],
		['PAGE','47243',jdecode('RESTRUCTURACION'),jdecode(''),'/47201/47243.html','true',[],'',''],
		['PAGE','47264',jdecode('OPTIMIZACION+'),jdecode(''),'/47201/47264.html','true',[],'',''],
		['PAGE','47285',jdecode('INTERIM'),jdecode(''),'/47201/47285.html','true',[],'','']
	],'',''],
	['PAGE','673',jdecode('CASOS+-+CONTACTO'),jdecode(''),'/673/index.html','true',[ 
		['PAGE','28001',jdecode('CASOS+%28follow+up+page%29'),jdecode(''),'/673/28001.html','false',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Commercial';
theSitetree.paletteFamily='C5E8FE';
theSitetree.keyvisualId='10206';
theSitetree.keyvisualName='blanco.swf';
theSitetree.fontsetId='21116';
theSitetree.graphicsetId='13215';
theSitetree.contentColor='232323';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Commercial',
				paletteFamily: 	'C5E8FE',
				keyvisualId: 	'10206',
				keyvisualName: 	'blanco.swf',
				fontsetId: 		'21116',
				graphicsetId: 	'13215',
				contentColor: 	'232323',
				contentBGColor: 'FFFFFF',
				a_color: 		'e6e6e6',
				b_color: 		'ffffff',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20100311-103616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20100208-204834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20091230-002914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28001',
internalId:  '',
customField: '20080214-140323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47201',
internalId:  '',
customField: '20091230-003013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47222',
internalId:  '',
customField: '20091229-231759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47243',
internalId:  '',
customField: '20091229-235006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47264',
internalId:  '',
customField: '20091229-233638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45801',
internalId:  '',
customField: '20091229-235507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47285',
internalId:  '',
customField: '20091230-002738'
};
webappMappings['7008']=webappMappings['7008-7044']={
webappId:    '7008',
documentId:  '673',
internalId:  '7044',
customField: 'language:es;country:ES;'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20IN31WQ';
var companyName   = 'Gesti%C3%B3n+de+Empresas';
var htmlTitle	  = 'OGLOBAL+-+Gesti%C3%B3n+de+Empresas.+Reestructuraci%C3%B3n+y+expansi%C3%B3n';
var metaKeywords  = 'Oglobal%2C+Organizaci%C3%B3n%2C+Coach%2C+Direcci%C3%B3n%2C+Empresa%2C+Organigrama%2C+Industrial%2C+Operaciones%2C+Ingenieria%2C+pyme%2C+problemas%2C+soluciones%2C+planificaci%C3%B3n%2C+clave%2C++barcelona%2C+eim%2C+icsa%2C+exeller%2C+turnaround%2C+riesgo%2C+capital%2C+gestion%2C+reestructuraci%C3%B3n%2C+expansi%C3%B3n%2C+reorganizaci%C3%B3n%2C+consultor%C3%ADa%2C+resultados%2C+crisis%2C+interim+management%2C+crecimiento%2C+valles%2C+Barcelona%2C+catalunya';
var metaContents  = 'gestion+de+empresas+en+situaciones+especiales%2C+consultoria+de+direcci%C3%B3n+en+organizaci%C3%B3n%2C+operaciones+e+industrial.+Direcci%C3%B3n+interina+de+%C3%A1reas+operacionales%2C+interim+management%2C+fusiones+y+adquisiciones%2C+direcci%C3%B3n+temporal%2C+reestructuaci%C3%B3n%2C+internacionalizaci%C3%B3n';
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();
};
