/* [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','401',jdecode('Home'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','41701',jdecode('Aktivit%C3%A4ten'),jdecode(''), jdecode('%2F41701%2Findex.html'), 'true',[ 
		['PAGE','494',jdecode('Termine'),jdecode(''), jdecode('%2F41701%2F494.html'), 'true',[],'','']
	],'',''],
	['PAGE','41601',jdecode('%C3%9Cber+uns'),jdecode(''), jdecode('%2F41601%2Findex.html'), 'true',[ 
		['PAGE','32901',jdecode('Unsere+Familie'),jdecode(''), jdecode('%2F41601%2F32901.html'), 'true',[],'',''],
		['PAGE','473',jdecode('Impressionen'),jdecode(''), jdecode('%2F41601%2F473.html'), 'true',[],'',''],
		['PAGE','452',jdecode('Geschichte'),jdecode(''), jdecode('%2F41601%2F452.html'), 'true',[],'','']
	],'',''],
	['PAGE','42201',jdecode('Angebote'),jdecode(''), jdecode('%2F42201%2Findex.html'), 'true',[ 
		['PAGE','515',jdecode('Men%C3%BCvorschl%C3%A4ge'),jdecode(''), jdecode('%2F42201%2F515.html'), 'true',[],'','']
	],'',''],
	['PAGE','557',jdecode('Kontakt'),jdecode(''), jdecode('%2F557%2Findex.html'), 'true',[ 
		['PAGE','31301',jdecode('Anreise+mit+Auto'),jdecode(''), jdecode('%2F557%2F31301.html'), 'true',[],'',''],
		['PAGE','9922',jdecode('Die+Schilder+zur+Alp'),jdecode(''), jdecode('%2F557%2F9922.html'), 'true',[],'','']
	],'',''],
	['PAGE','11101',jdecode('Links'),jdecode(''), jdecode('%2F11101.html'), 'true',[],'',''],
	['PAGE','42601',jdecode('Bildgalerie'),jdecode(''), jdecode('%2F42601.html'), 'true',[],'',''],
	['PAGE','29201',jdecode('Online-Bestellung'),jdecode(''), jdecode('%2F29201.html'), 'true',[],'',''],
	['PAGE','10197',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F10197%2Findex.html'), 'true',[ 
		['PAGE','10192',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F10197%2F10192.html'), 'false',[],'','']
	],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='cutout';
theSitetree.paletteFamily='F0F1D8';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10350';
theSitetree.graphicsetId='10473';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'cutout',
				paletteFamily: 	'F0F1D8',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10350',
				graphicsetId: 	'10473',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				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['1002']=webappMappings['1002-10197abw1x0ine5ss']={
webappId:    '1002',
documentId:  '10197',
internalId:  '10197abw1x0ine5ss',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20110327-153456'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20080418-162035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20090405-184947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20110426-193147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20110718-182623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20080706-183807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9922',
internalId:  '',
customField: '20080417-174444'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20100317-074614'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10197',
internalId:  '',
customField: '20080417-174224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10192',
internalId:  '',
customField: '20080417-174224'
};
webappMappings['4001']=webappMappings['4001-31174378']={
webappId:    '4001',
documentId:  '29201',
internalId:  '31174378',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29201',
internalId:  '',
customField: '20110718-183220'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '31301',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31301',
internalId:  '',
customField: '20100316-191358'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32901',
internalId:  '',
customField: '20110327-144703'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '41601',
internalId:  '-',
customField: '20120204-135639'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '41701',
internalId:  '-',
customField: '20120204-140331'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '42201',
internalId:  '-',
customField: '20120204-141353'
};
webappMappings['7060']=webappMappings['7060-20d116b39de94a3489fce65f072172f7']={
webappId:    '7060',
documentId:  '42601',
internalId:  '20d116b39de94a3489fce65f072172f7',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '42601',
internalId:  '-',
customField: '20120204-145111'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW1X0INE5SS';
var companyName   = 'Alpk%C3%A4serei+Lipplisb%C3%BCel';
var htmlTitle	  = 'Alpk%C3%A4serei+Lipplisb%C3%BCel';
var metaKeywords  = 'Alp%3B+Muotathal%3B+Lipplisb%C3%BCel%3B+Betschart%3B+Alpwirtschaft%3B+Alpk%C3%A4se%3B+';
var metaContents  = 'Alpk%C3%A4serei%3B+Lipplisb%C3%BCel%3B+Peter+Betschart%3B+Alp+Lipplisb%C3%BCel%3B+Alpk%C3%A4se%3B';
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();
};

