/* [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','4599',jdecode('Home'),jdecode(''), jdecode('%2F4599.html'), 'true',[],'',''],
	['PAGE','135901',jdecode('Brunch'),jdecode(''), jdecode('%2F135901.html'), 'true',[],'',''],
	['PAGE','38324',jdecode('Apero-Buffet'),jdecode(''), jdecode('%2F38324.html'), 'true',[],'',''],
	['PAGE','33503',jdecode('Warmespeisen'),jdecode(''), jdecode('%2F33503.html'), 'true',[],'',''],
	['PAGE','33770',jdecode('Angebote'),jdecode(''), jdecode('%2F33770.html'), 'true',[],'',''],
	['PAGE','132101',jdecode('Einfache+Gerichte'),jdecode(''), jdecode('%2F132101.html'), 'true',[],'',''],
	['PAGE','149501',jdecode('Getr%C3%A4nke'),jdecode(''), jdecode('%2F149501.html'), 'true',[],'',''],
	['PAGE','33797',jdecode('Fleischwaren'),jdecode(''), jdecode('%2F33797.html'), 'true',[],'',''],
	['PAGE','33824',jdecode('Bilder'),jdecode(''), jdecode('%2F33824.html'), 'true',[],'',''],
	['PAGE','52759',jdecode('Neuigkeiten+%2CUnterhaltung'),jdecode(''), jdecode('%2F52759.html'), 'true',[],'',''],
	['PAGE','168201',jdecode('++++++++Partyraum++Bilder'),jdecode(''), jdecode('%2F168201.html'), 'true',[],'',''],
	['PAGE','54569',jdecode('Partyr%C3%A4ume'),jdecode(''), jdecode('%2F54569.html'), 'true',[],'',''],
	['PAGE','117901',jdecode('Anfahrt'),jdecode(''), jdecode('%2F117901.html'), 'true',[],'',''],
	['PAGE','52749',jdecode('Ihr+Weg+zu+uns'),jdecode(''), jdecode('%2F52749.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Retail';
theSitetree.paletteFamily='F0C266';
theSitetree.keyvisualId='11782';
theSitetree.keyvisualName='kv_11782.jpg';
theSitetree.fontsetId='33054';
theSitetree.graphicsetId='14047';
theSitetree.contentColor='67490d';
theSitetree.contentBGColor='F0C266';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Retail',
				paletteFamily: 	'F0C266',
				keyvisualId: 	'11782',
				keyvisualName: 	'kv_11782.jpg',
				fontsetId: 		'33054',
				graphicsetId: 	'14047',
				contentColor: 	'67490d',
				contentBGColor: 'F0C266',
				a_color: 		'000000',
				b_color: 		'000000',
				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['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '117901',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '52749',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['7008']=webappMappings['7008-367']={
webappId:    '7008',
documentId:  '33797',
internalId:  '367',
customField: 'language:de;country:CH;'
};
webappMappings['1501']=webappMappings['1501-1054628']={
webappId:    '1501',
documentId:  '4599',
internalId:  '1054628',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4599',
internalId:  '',
customField: '20111126-081646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33503',
internalId:  '',
customField: '20120207-110801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33770',
internalId:  '',
customField: '20120104-115916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38324',
internalId:  '',
customField: '20120207-105206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33797',
internalId:  '',
customField: '20111001-164224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33824',
internalId:  '',
customField: '20110724-173036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52759',
internalId:  '',
customField: '20110804-121819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52749',
internalId:  '',
customField: '20060823-201716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54569',
internalId:  '',
customField: '20110812-102216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117901',
internalId:  '',
customField: '20080916-201712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '132101',
internalId:  '',
customField: '20110413-084930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135901',
internalId:  '',
customField: '20110812-102518'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '149501',
internalId:  '',
customField: '20110413-091908'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4599',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '168201',
internalId:  '',
customField: '20111016-205852'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INX2WJ';
var companyName   = 'M.%2BM.Liechti+GmbH+Partyservice%2CFleischhandel';
var htmlTitle	  = 'Partyservice%2CFleischhandel++liechtigmbhpartyservice.ch++Liechti%60s+Partyraum';
var metaKeywords  = '+Partyservice+%2C+Metzgerei+%2CFleischhandel%2CPartyraum%2CLokal';
var metaContents  = 'Partyservice+%2B+Fleischhandel+Albligen+M.%2B+M.Liechti+GmbH+Partyraum';
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();
};

