/* [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','1301',jdecode('NUESTRA+EMPRESA'),jdecode(''), jdecode('%2F1301.html'), 'true',[],'',''],
	['PAGE','6901',jdecode('CON%C3%93CENOS'),jdecode(''), jdecode('%2F6901%2Findex.html'), 'true',[ 
		['PAGE','10001',jdecode('C%C3%B3mo+encontrarnos'),jdecode(''), jdecode('%2F6901%2F10001.html'), 'true',[],'',''],
		['PAGE','6943',jdecode('Contactar'),jdecode(''), jdecode('%2F6901%2F6943%2Findex.html'), 'true',[ 
			['PAGE','13301',jdecode('Contactar+%28follow+up+page%29'),jdecode(''), jdecode('%2F6901%2F6943%2F13301.html'), 'false',[],'','']
		],'',''],
		['PAGE','24701',jdecode('Enlaces+de+inter%C3%A9s'),jdecode(''), jdecode('%2F6901%2F24701.html'), 'true',[],'',''],
		['PAGE','34801',jdecode('Publicidad+y+noticias+de+inter%C3%A9s'),jdecode(''), jdecode('%2F6901%2F34801.html'), 'true',[],'',''],
		['PAGE','11001',jdecode('Aviso+legal'),jdecode(''), jdecode('%2F6901%2F11001.html'), 'true',[],'','']
	],'',''],
	['PAGE','5501',jdecode('SERVICIOS'),jdecode(''), jdecode('%2F5501.html'), 'true',[],'',''],
	['PAGE','5522',jdecode('PERFIL+CONTRATANTE'),jdecode(''), jdecode('%2F5522.html'), 'true',[],'',''],
	['PAGE','23506',jdecode('Libro+de+visitas'),jdecode(''), jdecode('%2F23506%2Findex.html'), 'true',[ 
		['PAGE','23501',jdecode('Leer+el+libro+de+Visitas'),jdecode(''), jdecode('%2F23506%2F23501.html'), 'false',[],'','']
	],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Lunch';
theSitetree.paletteFamily='616E30';
theSitetree.keyvisualId='3858';
theSitetree.keyvisualName='kv_3858.jpg';
theSitetree.fontsetId='10697';
theSitetree.graphicsetId='11065';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='748928';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'piensa',
  product: 'WSCSYSSSSLYTC2IR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Lunch',
				paletteFamily: 	'616E30',
				keyvisualId: 	'3858',
				keyvisualName: 	'kv_3858.jpg',
				fontsetId: 		'10697',
				graphicsetId: 	'11065',
				contentColor: 	'FFFFFF',
				contentBGColor: '748928',
				a_color: 		'616E30',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'C9D894',
				e_color: 		'C9D894',
				f_color: 		'C9D894',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1301',
internalId:  '',
customField: '20091026-162912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20100518-144825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5522',
internalId:  '',
customField: '20081126-143014'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-6200693']={
webappId:    '1501',
documentId:  '1301',
internalId:  '6200693',
customField: '1501'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '10001',
internalId:  'routing',
customField: 'es_ES'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20081126-142458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20110915-121933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6943',
internalId:  '',
customField: '20081113-191158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20081113-191111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34801',
internalId:  '',
customField: '20110504-132136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20081126-140309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13301',
internalId:  '',
customField: '20081110-142756'
};
webappMappings['1002']=webappMappings['1002-23506aars20invapz']={
webappId:    '1002',
documentId:  '23506',
internalId:  '23506aars20invapz',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23506',
internalId:  '',
customField: '20081126-140309'
};
webappMappings['7008']=webappMappings['7008-7691']={
webappId:    '7008',
documentId:  '6943',
internalId:  '7691',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24701',
internalId:  '',
customField: '20110915-112643'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INVAPZ';
var companyName   = 'MERCADOS+CENTRALES+DE+ABASTECIMIENTO+DE+BADAJOZ%2C+S.A.';
var htmlTitle	  = 'MERCABADAJOZ%2C+S.A.';
var metaKeywords  = 'MERCADOS+CENTRALES+DE+ABASTECIMIENTO+DE+BADAJOZ+ALIMENTACION+FRUTAS+VERDURAS+HORTALIZAS+PESCADOS+MARISCOS+CARNES+COMERCIO+MAYORISTA+DISTRIBUCION+MAYORISTA+AGRICULTORES+PRODUCTORES+MINORISTAS+DETALLISTAS+FRIO+INDUSTRIAL+C%C3%81MARAS+CONGELACI%C3%93N+CASH+ALIMENTACI%C3%93N+NO+PERECEDEROS+COMERCIO+AGROALIMENTARIO';
var metaContents  = 'MERCADOS+CENTRALES+DE+ABASTECIMIENTO+DE+BADAJOZ+ALIMENTACION+FRUTAS+VERDURAS+HORTALIZAS+PESCADOS+MARISCOS+CARNES+COMERCIO+MAYORISTA+DISTRIBUCION+MAYORISTA+AGRICULTORES+PRODUCTORES+MINORISTAS+DETALLISTAS+FRIO+INDUSTRIAL+C%C3%81MARAS+CONGELACI%C3%93N+CASH+ALIMENTACI%C3%93N+NO+PERECEDEROS+COMERCIO+AGROALIMENTARIO';
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();
};

