/* [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','601',jdecode('%C3%9Cber+mich'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','652',jdecode('Kursangebot'),jdecode(''),'/652.html','true',[],'',''],
	['PAGE','17401',jdecode('H%C3%BClsenfr%C3%BCchte+%2F+A+-+Z'),jdecode(''),'/17401.html','true',[],'',''],
	['PAGE','694',jdecode('Brotbackkurs+%2F+K%C3%BCrbis'),jdecode(''),'/694.html','true',[],'',''],
	['PAGE','22301',jdecode('Weihnachtsgeb%C3%A4ck+%2F+S%C3%BCsses++'),jdecode(''),'/22301.html','true',[],'',''],
	['PAGE','736',jdecode('Wohlf%C3%BChlgewicht+%2F+Glutenfrei+'),jdecode(''),'/736.html','true',[],'',''],
	['PAGE','673',jdecode('Grundkurs+%2F+Grillieren+%28vegetarisch%29'),jdecode(''),'/673.html','true',[],'',''],
	['PAGE','757',jdecode('Kontakt%2FAnmeldungen'),jdecode(''),'/757.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Antigua';
theSitetree.paletteFamily='617F92';
theSitetree.keyvisualId='6917';
theSitetree.keyvisualName='kv_6917.jpg';
theSitetree.fontsetId='11214';
theSitetree.graphicsetId='12036';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='809DAF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Antigua',
				paletteFamily: 	'617F92',
				keyvisualId: 	'6917',
				keyvisualName: 	'kv_6917.jpg',
				fontsetId: 		'11214',
				graphicsetId: 	'12036',
				contentColor: 	'000000',
				contentBGColor: '809DAF',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20081208-185608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '652',
internalId:  '',
customField: '20091028-211340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '673',
internalId:  '',
customField: '20091028-212259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '694',
internalId:  '',
customField: '20091028-204041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22301',
internalId:  '',
customField: '20091028-195550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '736',
internalId:  '',
customField: '20091028-211701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '757',
internalId:  '',
customField: '20081018-205531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20091028-211551'
};
var canonHostname = 'wsc.genotec.ch';
var accountId     = 'AGT010IN2MZ1';
var companyName   = 'Ruth+Mandik';
var htmlTitle	  = 'Vollwertk%C3%BCche';
var metaKeywords  = 'Vollwert%2C+K%C3%BCche%2C+Ern%C3%A4hrung%2C+Essen%2C+Kochen%2C+Gesundheit%2C+vollwertig%2C+Vollkorn%2C+Genuss%2C+vegetarisch%2C+Lebensmittel%2C+Vitalstoffe%2C+nat%C3%BCrlich%2C+Natur%2C+Prophylaxe%2C+Mangelern%C3%A4hrung%2C+S%C3%A4ure-Basen-Gleichgewicht%2C+Vortr%C3%A4ge%2C+Seminare%2C+Kochkurse';
var metaContents  = 'Vortr%C3%A4ge+und+Seminare+%C3%BCber+vollwertige+Ern%C3%A4hrung+mit+passenden+Kochkursen%3A+Vollwertk%C3%BCche%2C+Brotbackkurs%2C+S%C3%BCsses+f%C3%BCr+Naschkatzen%2C+S%C3%A4ure-Basen-Gleichgewicht%2C+Sport+und+Ern%C3%A4hrung%2C+Abnehmen+ohne+Kalorienz%C3%A4hlen%2C+Ern%C3%A4hrung+f%C3%BCr+Babies.++';
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();
};
