/* [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','4558',jdecode('Willkommen'),jdecode(''),'/4558.html','true',[],'',''],
	['PAGE','4615',jdecode('Allgemein'),jdecode(''),'/4615/index.html','true',[ 
		['PAGE','4669',jdecode('Camping'),jdecode(''),'/4615/4669.html','true',[],'',''],
		['PAGE','4696',jdecode('Mietcaravan'),jdecode(''),'/4615/4696.html','true',[],'',''],
		['PAGE','7801',jdecode('Jahrespl%C3%A4tze'),jdecode(''),'/4615/7801.html','true',[],'','']
	],'',''],
	['PAGE','4723',jdecode('Preise'),jdecode(''),'/4723.html','true',[],'',''],
	['PAGE','7559',jdecode('Ausflugsziele+%2F+Links'),jdecode(''),'/7559.html','true',[],'',''],
	['PAGE','4750',jdecode('Lage'),jdecode(''),'/4750.html','true',[],'',''],
	['PAGE','5329',jdecode('Wir+%C3%BCber+uns'),jdecode(''),'/5329.html','true',[],'',''],
	['PAGE','5302',jdecode('Kontakt'),jdecode(''),'/5302/index.html','true',[ 
		['PAGE','9401',jdecode('Kontakt+%28Form+followup+page%29'),jdecode(''),'/5302/9401.html','false',[],'','']
	],'',''],
	['PAGE','13302',jdecode('Ihr+Weg+zu+uns'),jdecode(''),'/13302.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Natural';
theSitetree.paletteFamily='136F83';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='155';
theSitetree.graphicsetId='170';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FCFCF4';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Natural',
				paletteFamily: 	'136F83',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'155',
				graphicsetId: 	'170',
				contentColor: 	'000000',
				contentBGColor: 'FCFCF4',
				a_color: 		'136F83',
				b_color: 		'66CCFF',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '13302',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['1009']=webappMappings['1009-6222799']={
webappId:    '1009',
documentId:  '9401',
internalId:  '6222799',
customField: 'isFollowupPage:true;documentId:5302;'
};
webappMappings['7008']=webappMappings['7008-1228']={
webappId:    '7008',
documentId:  '5302',
internalId:  '1228',
customField: 'language:de;country:CH;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4558',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4558',
internalId:  '',
customField: '20060808-220832'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4615',
internalId:  '',
customField: '20100523-204322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4696',
internalId:  '',
customField: '20100519-113656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7801',
internalId:  '',
customField: '20060105-162204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4723',
internalId:  '',
customField: '20100523-204149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4669',
internalId:  '',
customField: '20060808-220503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7559',
internalId:  '',
customField: '20080101-171848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4750',
internalId:  '',
customField: '20060126-060038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5329',
internalId:  '',
customField: '20091231-164400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5302',
internalId:  '',
customField: '20091231-164519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20060120-214935'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13302',
internalId:  '',
customField: '20060206-155442'
};
webappMappings['1501']=webappMappings['1501-3117084']={
webappId:    '1501',
documentId:  '4558',
internalId:  '3117084',
customField: '1501'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXHZO';
var companyName   = 'Camping+Aareschlucht';
var htmlTitle	  = 'Unvergessliche+Ferien+auf+dem+Camping+Aareschlucht+in+Innertkirchen';
var metaKeywords  = 'Camping+Aareschlucht+Ruth+Abplanalp+Mietcaravan+-+Andreas+und+Jacqueline+Abplanalp+-+Ausf%C3%BCge+';
var metaContents  = 'Camping+Aareschlucht+Innertkirchen+Berner+Oberland+Alpenregion+Grimsel+Susten+Nufenen+Furka+Oberalp+Lukmanier+Gotthard+Gental+Engstlenalp+Reichenbach+Sherlock+Holmes+Haslital';
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();
};
