/* [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','1801',jdecode('Mondtor'),jdecode(''),'/1801.html','true',[],'',''],
	['PAGE','1873',jdecode('Geographie'),jdecode(''),'/1873/index.html','true',[ 
		['PAGE','1894',jdecode('Reisesystem'),jdecode(''),'/1873/1894.html','true',[],'',''],
		['PAGE','6701',jdecode('Flora+und+Fauna'),jdecode(''),'/1873/6701.html','true',[],'',''],
		['PAGE','6722',jdecode('Wohn-+und+Werkst%C3%A4tte'),jdecode(''),'/1873/6722.html','true',[],'','']
	],'',''],
	['PAGE','2041',jdecode('Politik'),jdecode(''),'/2041/index.html','true',[ 
		['PAGE','2501',jdecode('Politische+F%C3%BChrung'),jdecode(''),'/2041/2501.html','true',[],'',''],
		['PAGE','3101',jdecode('Gesetze'),jdecode(''),'/2041/3101.html','true',[],'','']
	],'',''],
	['PAGE','1936',jdecode('Historik'),jdecode(''),'/1936/index.html','true',[ 
		['PAGE','1957',jdecode('Zeittafel'),jdecode(''),'/1936/1957.html','true',[],'',''],
		['PAGE','1978',jdecode('Denkm%C3%A4ler'),jdecode(''),'/1936/1978.html','true',[],'','']
	],'',''],
	['PAGE','6743',jdecode('Eindr%C3%BCcke'),jdecode(''),'/6743.html','true',[],'',''],
	['PAGE','6901',jdecode('Laden+%22In+Oni+Yim%22'),jdecode(''),'/6901.html','true',[],'',''],
	['PAGE','2062',jdecode('Kontakt'),jdecode(''),'/2062.html','true',[],'',''],
	['PAGE','2104',jdecode('Impressum'),jdecode(''),'/2104.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Kalkutta';
theSitetree.paletteFamily='5A5EB5';
theSitetree.keyvisualId='6205';
theSitetree.keyvisualName='kv_6205.jpg';
theSitetree.fontsetId='11143';
theSitetree.graphicsetId='11947';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='B2B4E6';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Kalkutta',
				paletteFamily: 	'5A5EB5',
				keyvisualId: 	'6205',
				keyvisualName: 	'kv_6205.jpg',
				fontsetId: 		'11143',
				graphicsetId: 	'11947',
				contentColor: 	'000000',
				contentBGColor: 'B2B4E6',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20101130-225352'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20101126-000913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2041',
internalId:  '',
customField: '20100420-222807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1936',
internalId:  '',
customField: '20100420-222807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2062',
internalId:  '',
customField: '20100420-222807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6701',
internalId:  '',
customField: '20101201-202553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2104',
internalId:  '',
customField: '20100420-222807'
};
webappMappings['1501']=webappMappings['1501-23388877']={
webappId:    '1501',
documentId:  '1801',
internalId:  '23388877',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20100830-225921'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20100830-232841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1957',
internalId:  '',
customField: '20100420-222807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1978',
internalId:  '',
customField: '20101201-221158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6722',
internalId:  '',
customField: '20100830-230040'
};
webappMappings['7060']=webappMappings['7060-49784fcea1e59524c9b32438d4755442']={
webappId:    '7060',
documentId:  '6743',
internalId:  '49784fcea1e59524c9b32438d4755442',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-2984']={
webappId:    '7008',
documentId:  '2062',
internalId:  '2984',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3101',
internalId:  '',
customField: '20100830-233232'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6743',
internalId:  '',
customField: '20100830-224315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20101130-232031'
};
var canonHostname = 'webomat01.hostpoint.ch';
var accountId     = 'AHP340INVRWU';
var companyName   = 'Moonglow+-+Insel+der+Arkanen';
var htmlTitle	  = 'Moonglow+-+Die+Insel+der+Arkanen';
var metaKeywords  = '';
var metaContents  = '';
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();
};

