/* [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','4480',jdecode('Home'),jdecode(''), jdecode('%2F4480%2Findex.html'), 'true',[ 
		['PAGE','100590',jdecode('Infoblatt'),jdecode(''), jdecode('%2F4480%2F100590.html'), 'true',[],'',''],
		['PAGE','100599',jdecode('Jobs'),jdecode(''), jdecode('%2F4480%2F100599.html'), 'true',[],'',''],
		['PAGE','103338',jdecode('Bau'),jdecode(''), jdecode('%2F4480%2F103338.html'), 'true',[],'','']
	],'',''],
	['PAGE','100653',jdecode('Daheim+im+Annaheim'),jdecode(''), jdecode('%2F100653%2Findex.html'), 'true',[ 
		['PAGE','100671',jdecode('Informationen'),jdecode(''), jdecode('%2F100653%2F100671.html'), 'true',[],'',''],
		['PAGE','102779',jdecode('Ferienbett'),jdecode(''), jdecode('%2F100653%2F102779.html'), 'true',[],'',''],
		['PAGE','101624',jdecode('Taxordnung'),jdecode(''), jdecode('%2F100653%2F101624.html'), 'true',[],'',''],
		['PAGE','101567',jdecode('Hausordnung'),jdecode(''), jdecode('%2F100653%2F101567.html'), 'true',[],'',''],
		['PAGE','103289',jdecode('Pflege'),jdecode(''), jdecode('%2F100653%2F103289.html'), 'true',[],'',''],
		['PAGE','101877',jdecode('Sterbebegleitung'),jdecode(''), jdecode('%2F100653%2F101877.html'), 'true',[],'','']
	],'',''],
	['PAGE','102788',jdecode('Organisation'),jdecode(''), jdecode('%2F102788%2Findex.html'), 'true',[ 
		['PAGE','100662',jdecode('Leitbild'),jdecode(''), jdecode('%2F102788%2F100662.html'), 'true',[],'',''],
		['PAGE','100680',jdecode('Organigramm'),jdecode(''), jdecode('%2F102788%2F100680.html'), 'true',[],'',''],
		['PAGE','100689',jdecode('Gesch%C3%A4ftsbericht'),jdecode(''), jdecode('%2F102788%2F100689.html'), 'true',[],'','']
	],'',''],
	['PAGE','100608',jdecode('Tr%C3%A4ffpunkt'),jdecode(''), jdecode('%2F100608%2Findex.html'), 'true',[ 
		['PAGE','100617',jdecode('Agenda'),jdecode(''), jdecode('%2F100608%2F100617.html'), 'true',[],'',''],
		['PAGE','100626',jdecode('Angebot'),jdecode(''), jdecode('%2F100608%2F100626.html'), 'true',[],'','']
	],'',''],
	['PAGE','100937',jdecode('Anfahrt'),jdecode(''), jdecode('%2F100937.html'), 'true',[],'',''],
	['PAGE','50453',jdecode('Anmeldung'),jdecode(''), jdecode('%2F50453%2Findex.html'), 'true',[ 
		['PAGE','52312',jdecode('Anmeldung+St.+Anna+%28Form+followup+page%29'),jdecode(''), jdecode('%2F50453%2F52312.html'), 'false',[],'','']
	],'',''],
	['PAGE','11871',jdecode('Kontakt'),jdecode(''), jdecode('%2F11871%2Findex.html'), 'true',[ 
		['PAGE','42210',jdecode('Kontakt+%28Form+followup+page%29'),jdecode(''), jdecode('%2F11871%2F42210.html'), 'false',[],'','']
	],'',''],
	['PAGE','100644',jdecode('Links'),jdecode(''), jdecode('%2F100644.html'), 'true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='FDBC3F';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10896';
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: 	'FDBC3F',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				graphicsetId: 	'10896',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FDBC3F',
				e_color: 		'FDBC3F',
				f_color: 		'FDBC3F',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4480',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4480',
internalId:  '',
customField: '20120110-100930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100590',
internalId:  '',
customField: '20120110-103920'
};
webappMappings['1009']=webappMappings['1009-6592585']={
webappId:    '1009',
documentId:  '52312',
internalId:  '6592585',
customField: 'isFollowupPage:true;documentId:50453;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102788',
internalId:  '',
customField: '20091105-104001'
};
webappMappings['1009']=webappMappings['1009-6582792']={
webappId:    '1009',
documentId:  '42210',
internalId:  '6582792',
customField: 'isFollowupPage:true;documentId:11871;'
};
webappMappings['7008']=webappMappings['7008-907']={
webappId:    '7008',
documentId:  '11871',
internalId:  '907',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-908']={
webappId:    '7008',
documentId:  '50453',
internalId:  '908',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '102779',
internalId:  '',
customField: '20091105-102651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100599',
internalId:  '',
customField: '20120124-104427'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100653',
internalId:  '',
customField: '20080704-164839'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100662',
internalId:  '',
customField: '20090608-094430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100671',
internalId:  '',
customField: '20110304-170043'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101624',
internalId:  '',
customField: '20100205-170735'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101567',
internalId:  '',
customField: '20110309-164716'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100680',
internalId:  '',
customField: '20110728-100625'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100689',
internalId:  '',
customField: '20110726-153132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100937',
internalId:  '',
customField: '20091002-145829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100608',
internalId:  '',
customField: '20120117-153630'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100617',
internalId:  '',
customField: '20110204-165941'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100626',
internalId:  '',
customField: '20111214-132927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50453',
internalId:  '',
customField: '20080704-152745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52312',
internalId:  '',
customField: '20060509-134132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11871',
internalId:  '',
customField: '20110721-113859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42210',
internalId:  '',
customField: '20060505-145720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '100644',
internalId:  '',
customField: '20080704-161916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '101877',
internalId:  '',
customField: '20110304-170200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '103289',
internalId:  '',
customField: '20110309-164021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '103338',
internalId:  '',
customField: '20111007-101605'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXXBV';
var companyName   = 'Alters-+und+Pflegeheim+St.Anna%2C+Steg';
var htmlTitle	  = 'Alter-+und+Pflegeheim+St.+Anna+Steg';
var metaKeywords  = 'Annaheim+steg';
var metaContents  = 'Altersheim+St.Anna+Steg';
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();
};

