/* [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','501',jdecode('Inici'),jdecode(''), jdecode('%2F501.html'), 'true',[],'',''],
	['PAGE','37422',jdecode('Serveis'),jdecode(''), jdecode('%2F37422%2Findex.html'), 'true',[ 
		['PAGE','5743',jdecode('Energia+solar+t%C3%A8rmica'),jdecode(''), jdecode('%2F37422%2F5743.html'), 'true',[],'',''],
		['PAGE','48401',jdecode('Energia+solar+fotovoltaica'),jdecode(''), jdecode('%2F37422%2F48401.html'), 'true',[],'',''],
		['PAGE','48422',jdecode('Biomassa'),jdecode(''), jdecode('%2F37422%2F48422.html'), 'true',[],'',''],
		['PAGE','48485',jdecode('Geot%C3%A8rmica'),jdecode(''), jdecode('%2F37422%2F48485.html'), 'true',[],'',''],
		['PAGE','48464',jdecode('Aerotermia'),jdecode(''), jdecode('%2F37422%2F48464.html'), 'true',[],'',''],
		['PAGE','48443',jdecode('Climatitzaci%C3%B3+radiant'),jdecode(''), jdecode('%2F37422%2F48443.html'), 'true',[],'',''],
		['PAGE','102612',jdecode('Tractament+d%26%23x27%3Baigua'),jdecode(''), jdecode('%2F37422%2F102612.html'), 'true',[],'',''],
		['PAGE','91012',jdecode('Formaci%C3%B3'),jdecode(''), jdecode('%2F37422%2F91012.html'), 'true',[],'','']
	],'',''],
	['PAGE','53301',jdecode('Instal%C2%B7lacions'),jdecode(''), jdecode('%2F53301.html'), 'true',[],'',''],
	['PAGE','93112',jdecode('Subvencions'),jdecode(''), jdecode('%2F93112.html'), 'true',[],'',''],
	['PAGE','54101',jdecode('Documents'),jdecode(''), jdecode('%2F54101%2Findex.html'), 'true',[ 
		['PAGE','18701',jdecode('Documents+t%C3%A8cnics'),jdecode(''), jdecode('%2F54101%2F18701.html'), 'true',[],'',''],
		['PAGE','5722',jdecode('Normativa'),jdecode(''), jdecode('%2F54101%2F5722.html'), 'true',[],'','']
	],'',''],
	['PAGE','59601',jdecode('Software'),jdecode(''), jdecode('%2F59601.html'), 'true',[],'',''],
	['PAGE','55201',jdecode('Enlla%C3%A7os'),jdecode(''), jdecode('%2F55201%2Findex.html'), 'true',[ 
		['PAGE','7722',jdecode('Organismes'),jdecode(''), jdecode('%2F55201%2F7722.html'), 'true',[],'',''],
		['PAGE','54143',jdecode('Associacions'),jdecode(''), jdecode('%2F55201%2F54143.html'), 'true',[],'',''],
		['PAGE','54164',jdecode('webs+d%26%23x27%3Binter%C3%A8s'),jdecode(''), jdecode('%2F55201%2F54164.html'), 'true',[],'','']
	],'',''],
	['PAGE','5701',jdecode('Contacte'),jdecode(''), jdecode('%2F5701.html'), 'true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='CC6600';
theSitetree.keyvisualId='1354';
theSitetree.keyvisualName='flacons.jpg';
theSitetree.fontsetId='236';
theSitetree.graphicsetId='286';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'arsys',
  product: 'WSCSYSSSSLYTC2IR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Startup',
				paletteFamily: 	'CC6600',
				keyvisualId: 	'1354',
				keyvisualName: 	'flacons.jpg',
				fontsetId: 		'236',
				graphicsetId: 	'286',
				contentColor: 	'666666',
				contentBGColor: 'FFFFFF',
				a_color: 		'CC6600',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20111029-032426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20110220-115414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5722',
internalId:  '',
customField: '20090611-132338'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5743',
internalId:  '',
customField: '20110220-130855'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37422',
internalId:  '',
customField: '20090905-180902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7722',
internalId:  '',
customField: '20090628-201539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18701',
internalId:  '',
customField: '20090611-132206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54101',
internalId:  '',
customField: '20090601-121746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48401',
internalId:  '',
customField: '20110220-121731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48422',
internalId:  '',
customField: '20110220-121832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48443',
internalId:  '',
customField: '20110220-122445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48464',
internalId:  '',
customField: '20110220-122225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48485',
internalId:  '',
customField: '20110220-122140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53301',
internalId:  '',
customField: '20110329-093726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93112',
internalId:  '',
customField: '20100327-233035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59601',
internalId:  '',
customField: '20091230-123422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54143',
internalId:  '',
customField: '20090611-003446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54164',
internalId:  '',
customField: '20100107-170031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55201',
internalId:  '',
customField: '20090531-114011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '91012',
internalId:  '',
customField: '20100327-232146'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102612',
internalId:  '',
customField: '20110220-144008'
};
webappMappings['7008']=webappMappings['7008-7100']={
webappId:    '7008',
documentId:  '5701',
internalId:  '7100',
customField: 'language:es;country:ES;'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20IN3H9Q';
var companyName   = 'energia+solar+t%C3%A8rmica+-+biomassa+-+geot%C3%A8rmica+-+efici%C3%A8ncia+energ%C3%A8tica+-+energies';
var htmlTitle	  = 'Desarrollo%2C+instalaci%C3%B3n+y+mantenimiento+de+proyectos+basados+en+energ%C3%ADas+renovables+y+ahorro+energ%C3%A9tico.';
var metaKeywords  = 'energ%C3%ADas+renovables%2C+solar+t%C3%A9rmica%2C+solar+fotovoltaica%2C+biomasa%2C+projectes%2C+instal%C2%B7lacions%2C+';
var metaContents  = 'energ%C3%ADas+renovables%2C+solar+t%C3%A9rmica%2C+solar+fotovoltaica%2C+biomasa%2C+projectes%2C+instal%C2%B7lacions%2C+';
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();
};

