/* [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','4607',jdecode('Home%2FNews'),jdecode(''),'/4607.html','true',[],'',''],
	['PAGE','30968',jdecode('Biografie'),jdecode(''),'/30968/index.html','true',[ 
		['PAGE','30995',jdecode('Dampf+-++Epoche'),jdecode(''),'/30968/30995.html','true',[],'',''],
		['PAGE','31022',jdecode('Elektro+-+Epoche'),jdecode(''),'/30968/31022.html','true',[],'',''],
		['PAGE','31049',jdecode('SBB++++-+++Epoche'),jdecode(''),'/30968/31049.html','true',[],'','']
	],'',''],
	['PAGE','31836',jdecode('Rollmaterial'),jdecode(''),'/31836.html','true',[],'',''],
	['PAGE','221301',jdecode('De+6%2F6+15301'),jdecode(''),'/221301.html','true',[],'',''],
	['PAGE','196401',jdecode('Art+of+Impression'),jdecode(''),'/196401.html','true',[],'',''],
	['PAGE','197501',jdecode('Streckenteil+1'),jdecode(''),'/197501.html','true',[],'',''],
	['PAGE','197522',jdecode('Streckenteil+2+'),jdecode(''),'/197522.html','true',[],'',''],
	['PAGE','197543',jdecode('Streckenteil+3'),jdecode(''),'/197543.html','true',[],'',''],
	['PAGE','197564',jdecode('Streckenteil+4'),jdecode(''),'/197564.html','true',[],'',''],
	['PAGE','24168',jdecode('Modellbau'),jdecode(''),'/24168.html','true',[],'',''],
	['PAGE','25068',jdecode('Pl%C3%A4ne%2FSkizzen'),jdecode(''),'/25068.html','true',[],'',''],
	['PAGE','23489',jdecode('Bild+des+Monats'),jdecode(''),'/23489.html','true',[],'',''],
	['PAGE','4772',jdecode('Events'),jdecode(''),'/4772.html','true',[],'',''],
	['PAGE','20068',jdecode('Links'),jdecode(''),'/20068.html','true',[],'',''],
	['PAGE','10220',jdecode('G%C3%A4stebuch'),jdecode(''),'/10220/index.html','true',[ 
		['PAGE','10221',jdecode('Eintr%C3%A4ge'),jdecode(''),'/10220/10221.html','false',[],'','']
	],'',''],
	['PAGE','4718',jdecode('Kontakt'),jdecode(''),'/4718.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Seifenblase';
theSitetree.paletteFamily='ADADAD';
theSitetree.keyvisualId='2345';
theSitetree.keyvisualName='aerzte3.jpg';
theSitetree.fontsetId='381';
theSitetree.graphicsetId='429';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Seifenblase',
				paletteFamily: 	'ADADAD',
				keyvisualId: 	'2345',
				keyvisualName: 	'aerzte3.jpg',
				fontsetId: 		'381',
				graphicsetId: 	'429',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'999999',
				e_color: 		'666666',
				f_color: 		'CCCCCC',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30968',
internalId:  '',
customField: '20100107-140119'
};
webappMappings['1002']=webappMappings['1002-10220ABW0X0INXS25']={
webappId:    '1002',
documentId:  '10220',
internalId:  '10220ABW0X0INXS25',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4607',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4607',
internalId:  '',
customField: '20100309-100153'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30995',
internalId:  '',
customField: '20091108-175110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31022',
internalId:  '',
customField: '20070812-124353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31049',
internalId:  '',
customField: '20081213-155647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31836',
internalId:  '',
customField: '20090105-195650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '221301',
internalId:  '',
customField: '20090926-190414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '196401',
internalId:  '',
customField: '20091116-112829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '197501',
internalId:  '',
customField: '20100220-155849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '197522',
internalId:  '',
customField: '20100301-141131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '197543',
internalId:  '',
customField: '20090721-153946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '197564',
internalId:  '',
customField: '20100217-112943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24168',
internalId:  '',
customField: '20100117-111713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25068',
internalId:  '',
customField: '20081213-162616'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23489',
internalId:  '',
customField: '20100228-140315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4772',
internalId:  '',
customField: '20100309-101742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20068',
internalId:  '',
customField: '20091212-155757'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10220',
internalId:  '',
customField: '20070301-201225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10221',
internalId:  '',
customField: '20060918-112653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4718',
internalId:  '',
customField: '20070822-101753'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXS25';
var companyName   = 'Die+Lake+Valley+Railway+++1883+-+Heute';
var htmlTitle	  = 'Seetalbahn';
var metaKeywords  = '';
var metaContents  = 'Seetalbahn';
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();
};
