/* [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','4437',jdecode('Frontseite'),jdecode(''),'/4437.html','true',[],'',''],
	['PAGE','9269',jdecode('Festbahnen'),jdecode(''),'/9269.html','true',[],'',''],
	['PAGE','102127',jdecode('Fotos'),jdecode(''),'/102127.html','true',[],'',''],
	['PAGE','35409',jdecode('Projekte'),jdecode(''),'/35409.html','true',[],'',''],
	['PAGE','9323',jdecode('Aktuelles'),jdecode(''),'/9323/index.html','true',[ 
		['PAGE','9350',jdecode('Dies+ist+zu+tun'),jdecode(''),'/9323/9350.html','true',[],'','']
	],'',''],
	['PAGE','9161',jdecode('Unser+Verein'),jdecode(''),'/9161/index.html','true',[ 
		['PAGE','9242',jdecode('Aktivit%C3%A4ten'),jdecode(''),'/9161/9242.html','true',[],'','']
	],'',''],
	['PAGE','11201',jdecode('Fanartikel'),jdecode(''),'/11201.html','true',[],'',''],
	['PAGE','9377',jdecode('News'),jdecode(''),'/9377.html','true',[],'',''],
	['PAGE','9404',jdecode('Kontakt'),jdecode(''),'/9404/index.html','true',[ 
		['PAGE','9431',jdecode('Vorstand'),jdecode(''),'/9404/9431/index.html','true',[ 
			['PAGE','13675',jdecode('Adresse%2C+Telefon+%28Folgeseite%29'),jdecode(''),'/9404/9431/13675.html','false',[],'','']
		],'',''],
		['PAGE','13602',jdecode('G%C3%A4stebuch'),jdecode(''),'/9404/13602.html','true',[],'',''],
		['PAGE','13603',jdecode('Eintr%C3%A4ge'),jdecode(''),'/9404/13603.html','false',[],'','']
	],'',''],
	['PAGE','25014',jdecode('Links'),jdecode(''),'/25014.html','true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='A4A4AC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10451';
theSitetree.contentColor='1d1d20';
theSitetree.contentBGColor='A4A4AC';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Akropolis',
				paletteFamily: 	'A4A4AC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10451',
				contentColor: 	'1d1d20',
				contentBGColor: 'A4A4AC',
				a_color: 		'A4A4AC',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4437',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9323',
internalId:  '',
customField: '20100808-225659'
};
webappMappings['1002']=webappMappings['1002-13602ABW0X0INXSX4']={
webappId:    '1002',
documentId:  '13602',
internalId:  '13602ABW0X0INXSX4',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4437',
internalId:  '',
customField: '20100808-225719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9269',
internalId:  '',
customField: '20090109-121119'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102127',
internalId:  '',
customField: '20090109-120932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35409',
internalId:  '',
customField: '20091107-003202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9350',
internalId:  '',
customField: '20080407-001910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9161',
internalId:  '',
customField: '20070802-220404'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9242',
internalId:  '',
customField: '20100808-225632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20090810-235026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9377',
internalId:  '',
customField: '20100501-001344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9404',
internalId:  '',
customField: '20080120-185121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9431',
internalId:  '',
customField: '20100506-144316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13675',
internalId:  '',
customField: '20040925-102330'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13602',
internalId:  '',
customField: '20040306-131948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13603',
internalId:  '',
customField: '20040306-105256'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25014',
internalId:  '',
customField: '20100105-082524'
};
webappMappings['7008']=webappMappings['7008-4302']={
webappId:    '7008',
documentId:  '9431',
internalId:  '4302',
customField: 'language:de;country:CH;'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXSX4';
var companyName   = 'Schweiz.+Verein+der+Feld-+und+Werkbahn+Freunde';
var htmlTitle	  = 'Feld-+und+Werkbahnfreunde';
var metaKeywords  = 'Spurweite+600+mm%2C+Feld-+und+Werkbahn%2C+Feldbahn%2C+Werkbahn%2C+Waldbahn%2C+Feldbahnsammlung%2C+Feldbahnlok%2C+Feldbahnwagen%2C+Feldbahngeleise%2C+Feldbahnmaterial%2C+Grubenbahn%2C+Stollenbahn%2C+Festbahn%2C+';
var metaContents  = 'Sammlung+von+Feldbahnfahrzeugen+und+Werkbahnmaterial%2C+Restaurierung+von+Feldbahnmaterial%2C+aktives+Vereinsleben';
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();
};
