/* [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','21122',jdecode('Home'),jdecode(''),'/21122.html','true',[],'',''],
	['PAGE','21101',jdecode('%C3%9Cber+uns'),jdecode(''),'/21101/index.html','true',[ 
		['PAGE','994',jdecode('Vorstand'),jdecode(''),'/21101/994.html','true',[],'','']
	],'',''],
	['PAGE','5501',jdecode('Aktuell'),jdecode(''),'/5501/index.html','true',[ 
		['PAGE','93801',jdecode('Anmeldung+Anlass'),jdecode(''),'/5501/93801.html','true',[],'','']
	],'',''],
	['PAGE','973',jdecode('Mitglieder'),jdecode(''),'/973.html','true',[],'',''],
	['PAGE','5564',jdecode('Jahresberichte'),jdecode(''),'/5564.html','true',[],'',''],
	['PAGE','123301',jdecode('Archiv'),jdecode(''),'/123301/index.html','true',[ 
		['PAGE','135601',jdecode('Veranstaltung+10'),jdecode(''),'/123301/135601.html','true',[],'',''],
		['PAGE','119601',jdecode('Veranstaltungen+09'),jdecode(''),'/123301/119601.html','true',[],'',''],
		['PAGE','114001',jdecode('Veranstaltungen+08'),jdecode(''),'/123301/114001.html','true',[],'',''],
		['PAGE','5522',jdecode('Veranstaltungen+07'),jdecode(''),'/123301/5522.html','true',[],'',''],
		['PAGE','107201',jdecode('Dokumente'),jdecode(''),'/123301/107201.html','true',[],'','']
	],'',''],
	['PAGE','5543',jdecode('Statuten'),jdecode(''),'/5543.html','true',[],'',''],
	['PAGE','5606',jdecode('Kontakt'),jdecode(''),'/5606.html','true',[],'',''],
	['PAGE','5627',jdecode('Mitglied+werden'),jdecode(''),'/5627.html','true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='CECEA9';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10571';
theSitetree.graphicsetId='10772';
theSitetree.contentColor='692643';
theSitetree.contentBGColor='F3F9FC';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Borders',
				paletteFamily: 	'CECEA9',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10571',
				graphicsetId: 	'10772',
				contentColor: 	'692643',
				contentBGColor: 'F3F9FC',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '21122',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-22']={
webappId:    '7008',
documentId:  '5627',
internalId:  '22',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-23']={
webappId:    '7008',
documentId:  '5606',
internalId:  '23',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-24']={
webappId:    '7008',
documentId:  '93801',
internalId:  '24',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21122',
internalId:  '',
customField: '20100601-114115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21101',
internalId:  '',
customField: '20080123-085108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '994',
internalId:  '',
customField: '20091127-150909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '973',
internalId:  '',
customField: '20100127-203206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20100601-114408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93801',
internalId:  '',
customField: '20071118-095607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '119601',
internalId:  '',
customField: '20091215-073009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '114001',
internalId:  '',
customField: '20080514-155743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5522',
internalId:  '',
customField: '20090129-084259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107201',
internalId:  '',
customField: '20091022-081819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5543',
internalId:  '',
customField: '20071016-073305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5564',
internalId:  '',
customField: '20091022-080951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5606',
internalId:  '',
customField: '20090922-141022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5627',
internalId:  '',
customField: '20071011-143934'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '135601',
internalId:  '',
customField: '20100601-114421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '123301',
internalId:  '',
customField: '20090318-153639'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2LFH';
var companyName   = 'IG+Gemeinn%C3%BCtzige+Institutionen+Basel-Stadt';
var htmlTitle	  = 'IGGBS';
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();
};
