/* [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','6001',jdecode('Home'),jdecode(''), jdecode('%2F6001.html'), 'true',[],'',''],
	['PAGE','6052',jdecode('News'),jdecode(''), jdecode('%2F6052.html'), 'true',[],'',''],
	['PAGE','6073',jdecode('Leitbild'),jdecode(''), jdecode('%2F6073.html'), 'true',[],'',''],
	['PAGE','6115',jdecode('Der+Waldkindergarten'),jdecode(''), jdecode('%2F6115.html'), 'true',[],'',''],
	['PAGE','6136',jdecode('Spielgruppe'),jdecode(''), jdecode('%2F6136.html'), 'true',[],'',''],
	['PAGE','41001',jdecode('Eltern+Kind+Waldgruppe'),jdecode(''), jdecode('%2F41001.html'), 'true',[],'',''],
	['PAGE','6157',jdecode('Waldnachmittag'),jdecode(''), jdecode('%2F6157.html'), 'true',[],'',''],
	['PAGE','6178',jdecode('Waldmittagstisch'),jdecode(''), jdecode('%2F6178.html'), 'true',[],'',''],
	['PAGE','6199',jdecode('Geburtstag+im+Wald'),jdecode(''), jdecode('%2F6199.html'), 'true',[],'',''],
	['PAGE','6220',jdecode('Fotoalbum'),jdecode(''), jdecode('%2F6220.html'), 'true',[],'',''],
	['PAGE','29201',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F29201.html'), 'true',[],'',''],
	['PAGE','6241',jdecode('Wir+suchen...'),jdecode(''), jdecode('%2F6241.html'), 'true',[],'',''],
	['PAGE','21701',jdecode('Presse'),jdecode(''), jdecode('%2F21701.html'), 'true',[],'',''],
	['PAGE','25201',jdecode('Mitglieder+und+G%C3%B6nner'),jdecode(''), jdecode('%2F25201.html'), 'true',[],'',''],
	['PAGE','6262',jdecode('Jobs'),jdecode(''), jdecode('%2F6262.html'), 'true',[],'',''],
	['PAGE','6283',jdecode('Links'),jdecode(''), jdecode('%2F6283.html'), 'true',[],'',''],
	['PAGE','6304',jdecode('Kontakt'),jdecode(''), jdecode('%2F6304.html'), 'true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='479949';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10895';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'479949',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10895',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'479949',
				e_color: 		'479949',
				f_color: 		'479949',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-d490d095455a748925c3bee015dbaae8']={
webappId:    '7060',
documentId:  '6220',
internalId:  'd490d095455a748925c3bee015dbaae8',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20111010-142926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6136',
internalId:  '',
customField: '20110519-153649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6052',
internalId:  '',
customField: '20111121-145953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6073',
internalId:  '',
customField: '20111010-143543'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6115',
internalId:  '',
customField: '20110519-153556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6157',
internalId:  '',
customField: '20110519-153824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6178',
internalId:  '',
customField: '20110519-153910'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6199',
internalId:  '',
customField: '20110519-153952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6220',
internalId:  '',
customField: '20110519-154031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6241',
internalId:  '',
customField: '20110519-154254'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6262',
internalId:  '',
customField: '20111121-144204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6283',
internalId:  '',
customField: '20110519-155737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6304',
internalId:  '',
customField: '20111121-143615'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21701',
internalId:  '',
customField: '20111121-150630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25201',
internalId:  '',
customField: '20110519-154914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29201',
internalId:  '',
customField: '20111013-145412'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41001',
internalId:  '',
customField: '20111003-133239'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INEE3J';
var companyName   = '3852+Ringgenberg';
var htmlTitle	  = 'Waldkindergarten+TATATUCK+++3852+Ringgenberg+BE';
var metaKeywords  = 'Waldkindergarten++Tatatuck+-+Spielgruppe+Waldm%C3%BCsli+-+Waldmittagstisch+-+Waldnachmittag+-%0D%0AMarianne+Tschan+-+Geburtstag+-+Wald+-+spielen+-+feuern+-+Geschichte+h%C3%B6ren+-+Kuchen+essen+-+Schatzsuche+-+Freunde+-+Elternteil+-+Kuchen+-+Fest+-+Betreuung+durch+Lehrperson+-+Waldgetr%C3%A4nk+-Geschichte+-+Waldgeschenk+-+Spiele+-+Betreuung+-+Kinder+-+Waldzvieri+-+Pizza+backen+im+Feuer+-+Schlangenbrot+-+Popcorn';
var metaContents  = 'Waldkindergarten++Tatatuck++-++CH-3852+Ringgenberg++-++033+821+13+84+-+der+Platz%2C+wo+Kinder+noch+Kinder+sein+d%C3%BCrfen+-+lebendig%2C+wissbegierig+und+voller+Ideen.+Komm+doch+auch%21';
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();
};

