/* [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('Inicio'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','25501',jdecode('La+Tienda'),jdecode(''),'/25501/index.html','true',[ 
		['PAGE','32501',jdecode('Plantaciones'),jdecode(''),'/25501/32501.html','true',[],'',''],
		['PAGE','28001',jdecode('Almendros'),jdecode(''),'/25501/28001.html','true',[],'',''],
		['PAGE','37001',jdecode('Micorrizas'),jdecode(''),'/25501/37001.html','true',[],'',''],
		['PAGE','23101',jdecode('Tutor+%22T%C3%BAtex%22'),jdecode(''),'/25501/23101.html','true',[],'',''],
		['PAGE','25522',jdecode('Tutor+Pino+Tratado'),jdecode(''),'/25501/25522.html','true',[],'',''],
		['PAGE','30001',jdecode('Protector+%22Envoltex%22'),jdecode(''),'/25501/30001.html','true',[],'',''],
		['PAGE','34601',jdecode('%22Anclatex%22'),jdecode(''),'/25501/34601.html','true',[],'',''],
		['PAGE','35522',jdecode('Fincas'),jdecode(''),'/25501/35522.html','true',[],'',''],
		['PAGE','35501',jdecode('Oportunidades'),jdecode(''),'/25501/35501.html','true',[],'','']
	],'',''],
	['PAGE','20401',jdecode('Documentos'),jdecode(''),'/20401.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='936251';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10450';
theSitetree.contentColor='2d1e19';
theSitetree.contentBGColor='936251';
var localeDef={
  language: 'es',
  country: 'ES'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Akropolis',
				paletteFamily: 	'936251',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10450',
				contentColor: 	'2d1e19',
				contentBGColor: '936251',
				a_color: 		'936251',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				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:  '501',
internalId:  '',
customField: '20090219-185035'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20081105-234808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23101',
internalId:  '',
customField: '20090309-093020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25501',
internalId:  '',
customField: '20091009-074631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25522',
internalId:  '',
customField: '20090219-183318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28001',
internalId:  '',
customField: '20091109-171733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30001',
internalId:  '',
customField: '20090309-090616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32501',
internalId:  '',
customField: '20100219-100014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20090417-101948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35501',
internalId:  '',
customField: '20091006-122859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35522',
internalId:  '',
customField: '20091009-080830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37001',
internalId:  '',
customField: '20090915-123627'
};
var canonHostname = 'llwd718.servidoresdns.net';
var accountId     = 'AARS20INVJ9I';
var companyName   = 'Todoalmendro';
var htmlTitle	  = 'www.todoalmendro.com';
var metaKeywords  = 'Plantaciones+de+almendros++Vivero+de+almendros++Viveros+de+almendro++Poda+de+formacion+almendros++Almendro+marta++Almendro+Anto%C3%B1eta++Almendro+Belona++Almendro+Soleta++Almendro+Guara++Almendro+Penta++Almendro+Tardona++Almendro+Ferragnes++Almendro+Ferraduel++Almendros+autocompatibles+y+de+floraci%C3%B3n+tardia++Precios+Almendra++Mercado+de+Reus+protectores+para+almendro+protectores+para+olivos++Tutores+para+almendro++Protectores+para+almendro+++Tutores+de+pino+tratado+';
var metaContents  = 'Tutores+de+pino+tratado++Almendros+de+floraci%C3%B3n+tardia++Anto%C3%B1eta++Marta+++Belona+++Soleta++Guara++Penta++Tardona++Vivero+de+almendros++Viveros+de+almendros+protectores+para+olivar+y+almendro';
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();
};
