/* [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','4506',jdecode('EMPRESA'),jdecode(''), jdecode('%2F4506.html'), 'true',[],'',''],
	['PAGE','25021',jdecode('PRODUCTES'),jdecode(''), jdecode('%2F25021%2Findex.html'), 'true',[ 
		['PAGE','115001',jdecode('RISOTTOS%2C+FIDEU%C3%80S+I+ESCUDELLA'),jdecode(''), jdecode('%2F25021%2F115001.html'), 'true',[],'',''],
		['PAGE','115022',jdecode('BOLETS+DESHIDRATATS'),jdecode(''), jdecode('%2F25021%2F115022.html'), 'true',[],'','']
	],'',''],
	['PAGE','135012',jdecode('NOTICIES'),jdecode(''), jdecode('%2F135012.html'), 'false',[],'',''],
	['PAGE','94501',jdecode('CONTACTAR'),jdecode(''), jdecode('%2F94501%2Findex.html'), 'true',[ 
		['PAGE','94201',jdecode('FORMULARI+CONTACTE+%2F+FORMULARIO+CONTACTO'),jdecode(''), jdecode('%2F94501%2F94201.html'), 'true',[],'','']
	],'',''],
	['PAGE','128201',jdecode('CASTELLANO'),jdecode(''), jdecode('%2F128201.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Blast';
theSitetree.paletteFamily='87C82A';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33266';
theSitetree.graphicsetId='14145';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'arsys',
  product: 'WSCSYSSSSLYTC2IK'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blast',
				paletteFamily: 	'87C82A',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33266',
				graphicsetId: 	'14145',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'089D04',
				b_color: 		'84D66E',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '25021',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4506',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4506',
internalId:  '',
customField: '20110822-212206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25021',
internalId:  '',
customField: '20110405-185153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115022',
internalId:  '',
customField: '20110405-185842'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '94501',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '94201',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '94501',
internalId:  '',
customField: '20111003-141037'
};
webappMappings['7008']=webappMappings['7008-10770']={
webappId:    '7008',
documentId:  '94201',
internalId:  '10770',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '94201',
internalId:  '',
customField: '20100921-122317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '115001',
internalId:  '',
customField: '20110824-163822'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4506',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '128201',
internalId:  '',
customField: '20110822-211513'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '115001',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '115022',
internalId:  '',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135012',
internalId:  '',
customField: '20111003-141521'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '128201',
internalId:  '',
customField: 'language:es;country:ES;'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'Aas010IN2OGJ';
var companyName   = 'MONBOLET+...de+tot+en+bolets%21++++++++BERGA+%28Bergued%C3%A0%29';
var htmlTitle	  = 'MONBOLET';
var metaKeywords  = 'risotto%2C+risotto+bolets%2C+fideu%C3%A0%2C+fideu%C3%A0+bolets%2C+escudella+bolets%2C+bolet%2C+bolets%2C+setas%2C+trufa%2C+trufas%2C+t%C3%B2fona%2C+t%EF%BF%BDfones%2C+bolets+bergued%EF%BF%BD%2C+parada+bolets%2C+bolets+pirineus%2C+de+tot+en+bolets%2C+especialistes+en+bolets%2C+monbolet%2C+compra-venda+bolets%2C+bolets+i+t%EF%BF%BDfones+de+temporada%2C+rovello%2C+cep%2C+camagroc%2C+centre+bolets%2C+olis+i+vinagres+de+bolets%2C+fires+bolets%2C+risotto+cep%2C+risotto+trompetes%2C+risotto+ou+de+reig%2C+fideu%C3%A0+ceps%2C+fideu%C3%A0+trompetes.';
var metaContents  = 'monbolet%2C+especialistes+en+bolets%2C+bolets%2C+risotto%2C+risotto+de+ceps%2C+risottos+de+bolets%2C+arros+bolets%2Cfideu%C3%A0%2C+fideu%C3%A0+de+bolets%2C+escudella+bolets%2C+especialitats+en+t%C3%B2fona%2C+fresc%2C+sec%2C+t%EF%BF%BDfona%2C++bolets+bergued%EF%BF%BD%2C+pirineus%2C+de+tot+en+bolets%2C+bolets+frescos%2C+t%EF%BF%BDfones%2C+bolets+deshidratats%2C+bolets+secs%2C+pols+de+bolet%2C+bolets+en+pols%2C+bolet+fresc+de+temporada%2C+oli+de+bolets%2C+olis+i+vinagres+de+bolets.';
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();
};

