/* [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','401',jdecode('P%C3%A0gina+inici'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','30723',jdecode('Fotos'),jdecode(''),'/30723/index.html','true',[ 
		['PAGE','10701',jdecode('Fotos+Desembre+2009'),jdecode(''),'/30723/10701.html','true',[],'',''],
		['PAGE','26912',jdecode('Un+diumenge+al+mat%C3%AD'),jdecode(''),'/30723/26912.html','true',[],'',''],
		['PAGE','36223',jdecode('Fotos+diverses'),jdecode(''),'/30723/36223.html','true',[],'','']
	],'',''],
	['PAGE','25912',jdecode('Videos'),jdecode(''),'/25912.html','true',[],'',''],
	['PAGE','44023',jdecode('Informaci%C3%B3+i+participaci%C3%B3'),jdecode(''),'/44023.html','true',[],'',''],
	['PAGE','32423',jdecode('Sol%C2%B7licitud+contacte+'),jdecode(''),'/32423.html','true',[],'',''],
	['PAGE','49023',jdecode('Registre+Ajuntament'),jdecode(''),'/49023.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='NewYork';
theSitetree.paletteFamily='FFCC33';
theSitetree.keyvisualId='4';
theSitetree.keyvisualName='buero.jpg';
theSitetree.fontsetId='169';
theSitetree.graphicsetId='199';
theSitetree.contentColor='000066';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'NewYork',
				paletteFamily: 	'FFCC33',
				keyvisualId: 	'4',
				keyvisualName: 	'buero.jpg',
				fontsetId: 		'169',
				graphicsetId: 	'199',
				contentColor: 	'000066',
				contentBGColor: 'FFFFFF',
				a_color: 		'000066',
				b_color: 		'FFCC33',
				c_color: 		'000000',
				d_color: 		'406BC0',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100711-184530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10701',
internalId:  '',
customField: '20100303-112010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26912',
internalId:  '',
customField: '20100303-111859'
};
webappMappings['7060']=webappMappings['7060-8314df733d0ccc692cd64a5baad7b01e']={
webappId:    '7060',
documentId:  '25912',
internalId:  '8314df733d0ccc692cd64a5baad7b01e',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32423',
internalId:  '',
customField: '20100304-090740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25912',
internalId:  '',
customField: '20100225-133424'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '401',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '10701',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '26912',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '25912',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['7008']=webappMappings['7008-7707']={
webappId:    '7008',
documentId:  '32423',
internalId:  '7707',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30723',
internalId:  '',
customField: '20100511-161831'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '30723',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '49023',
internalId:  '',
customField: '20100722-173659'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '32423',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36223',
internalId:  '',
customField: '20100318-083623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44023',
internalId:  '',
customField: '20100616-093300'
};
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INLX8I';
var companyName   = 'ASSOCIACI%C3%93+VE%C3%8FNS%2FVE%C3%8FNES+PLA%C3%87A+FARGA';
var htmlTitle	  = 'PLA%C3%87A+DE+LA+FARGA+ASSOCIACI%C3%93+DE+VE%C3%8FNS+I+VE%C3%8FNES';
var metaKeywords  = 'sants++barcelona++pla%C3%A7a+++plaza++farga++jardineria++placa++associacio++incivisme+bruticia+pipica%0D%0A%0D%0A%0D%0A%0D%0ASants%0D%0A%0D%0A%0D%0A%0D%0Abarcelona%0D%0A%0D%0A%0D%0A%0D%0Apla%C3%A7a%0D%0A%0D%0A%0D%0A%0D%0Apla%C3%A7a+farga%0D%0A%0D%0A%0D%0A%0D%0Aplaza+farga%0D%0A%0D%0A%0D%0A%0D%0Afarga%0D%0A%0D%0A%0D%0A%0D%0Amanteniment%0D%0A%0D%0A%0D%0A%0D%0Ajardineria%0D%0A%0D%0A%0D%0A%0D%0Aassociacio%0D%0A%0D%0A%0D%0A%0D%0Aasociacion%0D%0A%0D%0A%0D%0A%0D%0Aincivisme%0D%0A%0D%0A%0D%0A%0D%0Aincivismo%0D%0A%0D%0A%0D%0A%0D%0Abretol%0D%0A%0D%0A%0D%0A%0D%0Abretols%0D%0A%0D%0A%0D%0A%0D%0Agamberro%0D%0A%0D%0A%0D%0A%0D%0Agamberros%0D%0A%0D%0A%0D%0A%0D%0Apintadas%0D%0A%0D%0A%0D%0A%0D%0Asuciedad%0D%0A%0D%0A%0D%0A%0D%0Abruticia%0D%0A%0D%0A%0D%0A%0D%0Apipica%0D%0A%0D%0A%0D%0A%0D%0Apipican%0D%0A%0D%0A%0D%0A%0D%0Apetanca%0D%0A%0D%0A%0D%0A%0D%0Abotxes%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0ASants%0D%0Abarcelona%0D%0Apla%C3%A7a%0D%0Apla%C3%A7a+farga%0D%0Aplaza+farga%0D%0Afarga%0D%0Amanteniment%0D%0Ajardineria%0D%0Aassociacio%0D%0Aasociacion%0D%0Aincivisme%0D%0Aincivismo%0D%0Abretol%0D%0Abretols%0D%0Agamberro%0D%0Agamberros%0D%0Apintadas%0D%0Asuciedad%0D%0Abruticia%0D%0Apipica%0D%0Apipican%0D%0Apetanca%0D%0Abotxes%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A';
var metaContents  = 'PLA%C3%87A+DE+LA+FARGA+ASSOCIACI%C3%93+DE+VE%C3%8FNS+I+VE%C3%8FNES%0D%0A%0D%0Apla%C3%A7a+farga%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0APLA%C3%87A+FARGA';
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();
};
