/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','552',jdecode('%C3%9Cber+uns'),jdecode(''),'/552/index.html','true',[ 
		['PAGE','573',jdecode('Unser+Jodlerklub'),jdecode(''),'/552/573.html','true',[],'',''],
		['PAGE','594',jdecode('Der+Vorstand'),jdecode(''),'/552/594.html','true',[],'','']
	],'',''],
	['PAGE','109701',jdecode('Kontakte'),jdecode(''),'/109701.html','true',[],'',''],
	['PAGE','636',jdecode('Unsere+Anl%C3%A4sse'),jdecode(''),'/636.html','true',[],'',''],
	['PAGE','2301',jdecode('Unsere+CDs'),jdecode(''),'/2301.html','true',[],'',''],
	['PAGE','2343',jdecode('Foto+Galerie'),jdecode(''),'/2343.html','true',[],'',''],
	['PAGE','2201',jdecode('Eintr%C3%A4ge'),jdecode(''),'/2201.html','false',[],'',''],
	['PAGE','2206',jdecode('G%C3%A4stebuch'),jdecode(''),'/2206.html','true',[],'',''],
	['PAGE','23022',jdecode('Links'),jdecode(''),'/23022.html','true',[],'',''],
	['PAGE','23001',jdecode('Konzert+09+'),jdecode(''),'/23001.html','true',[],'',''],
	['PAGE','75801',jdecode('Weitere+Dateien'),jdecode(''),'/75801.html','true',[],'',''],
	['PAGE','88301',jdecode('Unsere+G%C3%B6nner+und+Sponsoren'),jdecode(''),'/88301.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Startup';
theSitetree.paletteFamily='990000';
theSitetree.keyvisualId='1399';
theSitetree.keyvisualName='astern.jpg';
theSitetree.fontsetId='233';
theSitetree.graphicsetId='278';
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: 			'Startup',
				paletteFamily: 	'990000',
				keyvisualId: 	'1399',
				keyvisualName: 	'astern.jpg',
				fontsetId: 		'233',
				graphicsetId: 	'278',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'990000',
				b_color: 		'333333',
				c_color: 		'000000',
				d_color: 		'FF0000',
				e_color: 		'FF0000',
				f_color: 		'FF0000',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-2206abw0x0in2yrg']={
webappId:    '1002',
documentId:  '2206',
internalId:  '2206abw0x0in2yrg',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20081110-211722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20070526-170552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20091125-011248'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20100308-202640'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '109701',
internalId:  '',
customField: '20100806-011628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20100206-131938'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2301',
internalId:  '',
customField: '20090221-133826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2343',
internalId:  '',
customField: '20100519-201541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20070303-203758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2206',
internalId:  '',
customField: '20070404-231823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23022',
internalId:  '',
customField: '20091013-223140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23001',
internalId:  '',
customField: '20100308-202857'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75801',
internalId:  '',
customField: '20080530-152823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '88301',
internalId:  '',
customField: '20090912-170455'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2YRG';
var companyName   = 'Aemmitaler-Ch%C3%B6rli++Burgdorf';
var htmlTitle	  = 'Jodlerklub+Aemmitaler-Ch%C3%B6rli+Burgdorf';
var metaKeywords  = 'Emmentaler+Jodlerklub+Aemmitaler-Ch%C3%B6rli+Burgdorf';
var metaContents  = 'Aemmitaler-Ch%C3%B6rli++Jodelklub+Burgdorf';
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();
};
