/* [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','801',jdecode('Inici'),jdecode(''), jdecode('%2F801.html'), 'true',[],'',''],
	['PAGE','852',jdecode('Carta'),jdecode(''), jdecode('%2F852.html'), 'true',[],'',''],
	['PAGE','18001',jdecode('Carta+de+vins'),jdecode(''), jdecode('%2F18001.html'), 'true',[],'',''],
	['PAGE','873',jdecode('Que+fem'),jdecode(''), jdecode('%2F873.html'), 'true',[],'',''],
	['PAGE','9522',jdecode('El+Nostre+Xeff'),jdecode(''), jdecode('%2F9522.html'), 'true',[],'',''],
	['PAGE','9543',jdecode('Un+dia+al+Quinoa'),jdecode(''), jdecode('%2F9543.html'), 'true',[],'',''],
	['PAGE','12601',jdecode('Imatges+Quinoa'),jdecode(''), jdecode('%2F12601.html'), 'true',[],'',''],
	['PAGE','18022',jdecode('Prensa'),jdecode(''), jdecode('%2F18022.html'), 'true',[],'',''],
	['PAGE','9122',jdecode('Situaci%C3%B3'),jdecode(''), jdecode('%2F9122.html'), 'true',[],'',''],
	['PAGE','25621',jdecode('Com+arribar'),jdecode(''), jdecode('%2F25621.html'), 'true',[],'',''],
	['PAGE','18043',jdecode('Blog'),jdecode(''), jdecode('%2F18043.html'), 'true',[],'',''],
	['PAGE','18064',jdecode('Llibre+de+visites'),jdecode(''), jdecode('%2F18064.html'), 'true',[],'',''],
	['PAGE','18601',jdecode('Links+d%26%23x27%3Binter%C3%A9s'),jdecode(''), jdecode('%2F18601.html'), 'true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Holz';
theSitetree.paletteFamily='FF7112';
theSitetree.keyvisualId='8820';
theSitetree.keyvisualName='KV_06.swf';
theSitetree.fontsetId='17181';
theSitetree.graphicsetId='12654';
theSitetree.contentColor='FF7112';
theSitetree.contentBGColor='262626';
var localeDef={
  language: 'es',
  country: 'ES'
};
var prodDef={
  wl_name: 'arsys',
  product: 'WSCSYSSSSLYTC2IR'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Holz',
				paletteFamily: 	'FF7112',
				keyvisualId: 	'8820',
				keyvisualName: 	'KV_06.swf',
				fontsetId: 		'17181',
				graphicsetId: 	'12654',
				contentColor: 	'FF7112',
				contentBGColor: '262626',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FF6600',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '801',
internalId:  '',
customField: '20110113-094638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '852',
internalId:  '',
customField: '20101112-112840'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '873',
internalId:  '',
customField: '20100419-202249'
};
webappMappings['1002']=webappMappings['1002-18064aars20inluga']={
webappId:    '1002',
documentId:  '18064',
internalId:  '18064aars20inluga',
customField: 'icq=false'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '25621',
internalId:  'routing',
customField: 'es_ES'
};
webappMappings['1501']=webappMappings['1501-11055819']={
webappId:    '1501',
documentId:  '801',
internalId:  '11055819',
customField: '1501'
};
webappMappings['7050']=webappMappings['7050-6183']={
webappId:    '7050',
documentId:  '18043',
internalId:  '6183',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9522',
internalId:  '',
customField: '20100420-002011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9122',
internalId:  '',
customField: '20100419-124650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9543',
internalId:  '',
customField: '20100419-124427'
};
webappMappings['7060']=webappMappings['7060-10421ebe06d503b09434810b45ecb5d9']={
webappId:    '7060',
documentId:  '12601',
internalId:  '10421ebe06d503b09434810b45ecb5d9',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12601',
internalId:  '',
customField: '20100419-124521'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '801',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-8068']={
webappId:    '7008',
documentId:  '873',
internalId:  '8068',
customField: 'language:es;country:ES;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18043',
internalId:  '',
customField: '20100419-124818'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18064',
internalId:  '',
customField: '20100419-125018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18001',
internalId:  '',
customField: '20100420-002033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18022',
internalId:  '',
customField: '20100419-124606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20101112-113932'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '9122',
internalId:  'location',
customField: 'language:es;country:ES;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25621',
internalId:  '',
customField: '20100419-124734'
};
var webAppHostname = 'wsc.webaporter.com:80';
var canonHostname = 'llwc535.servidoresdns.net';
var accountId     = 'AARS20INLUGA';
var companyName   = 'Restaurant+Quinoa';
var htmlTitle	  = '';
var metaKeywords  = 'Restaurant+Quinoa+Falset+Priorat+';
var metaContents  = 'Restaurant+Quinoa%2C+C%2F%3A+Miquel+Barcel%C3%B3+n%C2%BA+29%2C+Priorat%2C+Falset.+Tel%3A+977+830+431%2C+Priorat%2C+Falset+++';
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();
};

