/* [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','4456',jdecode('Home'),jdecode(''), jdecode('%2F4456.html'), 'true',[],'',''],
	['PAGE','63715',jdecode('mealus+'),jdecode(''), jdecode('%2F63715.html'), 'true',[],'',''],
	['PAGE','5994',jdecode('Aktuelles'),jdecode(''), jdecode('%2F5994.html'), 'true',[],'',''],
	['PAGE','61750',jdecode('Ihr+Beratungsteam'),jdecode(''), jdecode('%2F61750.html'), 'true',[],'',''],
	['PAGE','16784',jdecode('Referenzen'),jdecode(''), jdecode('%2F16784.html'), 'true',[],'',''],
	['PAGE','19849',jdecode('Fragen%2FAntworten'),jdecode(''), jdecode('%2F19849.html'), 'true',[],'',''],
	['PAGE','66375',jdecode('Darmsanierung'),jdecode(''), jdecode('%2F66375.html'), 'true',[],'',''],
	['PAGE','66384',jdecode('Entschlacken'),jdecode(''), jdecode('%2F66384.html'), 'true',[],'',''],
	['PAGE','66826',jdecode('S%C3%A4uren+und+Basen'),jdecode(''), jdecode('%2F66826.html'), 'true',[],'',''],
	['PAGE','66772',jdecode('Somatoline+-+f%C3%BCr+die+Figur'),jdecode(''), jdecode('%2F66772.html'), 'true',[],'',''],
	['PAGE','66781',jdecode('B%C3%BCcher'),jdecode(''), jdecode('%2F66781.html'), 'true',[],'',''],
	['PAGE','62247',jdecode('Kontakt'),jdecode(''), jdecode('%2F62247.html'), 'true',[],'',''],
	['PAGE','18301',jdecode('Online-Shop'),jdecode(''), jdecode('%2F18301.html'), 'true',[],'',''],
	['PAGE','63574',jdecode('Anfahrt'),jdecode(''), jdecode('%2F63574.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Fragment';
theSitetree.paletteFamily='B8B3D1';
theSitetree.keyvisualId='3453';
theSitetree.keyvisualName='kv_3453.jpg';
theSitetree.fontsetId='10646';
theSitetree.graphicsetId='10765';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Fragment',
				paletteFamily: 	'B8B3D1',
				keyvisualId: 	'3453',
				keyvisualName: 	'kv_3453.jpg',
				fontsetId: 		'10646',
				graphicsetId: 	'10765',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'B8B3D1',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'403A60',
				e_color: 		'403A60',
				f_color: 		'403A60',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4456',
internalId:  '1006',
customField: '1006'
};
webappMappings['4001']=webappMappings['4001-LuWY_o1fn_IGUI']={
webappId:    '4001',
documentId:  '18301',
internalId:  'LuWY_o1fn_IGUI',
customField: 'language:de;country:CH;'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '63574',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4456',
internalId:  '',
customField: '20080723-091202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63715',
internalId:  '',
customField: '20080722-172806'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5994',
internalId:  '',
customField: '20100723-113819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61750',
internalId:  '',
customField: '20080722-181029'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16784',
internalId:  '',
customField: '20080314-130223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19849',
internalId:  '',
customField: '20091003-111315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66826',
internalId:  '',
customField: '20100723-111442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66375',
internalId:  '',
customField: '20100513-122300'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66384',
internalId:  '',
customField: '20080723-115335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62247',
internalId:  '',
customField: '20091003-111641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18301',
internalId:  '',
customField: '20110713-121326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '63574',
internalId:  '',
customField: '20071112-120828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66781',
internalId:  '',
customField: '20100721-200055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66772',
internalId:  '',
customField: '20110713-122642'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INX35F';
var companyName   = 'mealus';
var htmlTitle	  = 'mealus';
var metaKeywords  = 'mealus%2C+Ern%C3%A4hrungs-Organizer%2C+Ern%C3%A4hrungs-Computer%2C+Kalorientabelle%2Celektronisches+Ern%C3%A4hrungstagebuch%2C+Ern%C3%A4hrungstagebuch%2C+Di%C3%A4t-und+Ern%C3%A4hrungsberatung%2C+Di%C3%A4ten%2C+Gewichtskontrolle%2C+Gewichtsverlust%2C+die+Schweiz+nimmts+leichter%2C+Lebensmittelkontrolle%2C+Fontolliet%2C+Drogerie+H%C3%B6ngger+Markt';
var metaContents  = 'mealus-einfach+schlauer+Essen%2C+Schluss+mit+Di%C3%A4ten%2C+Gewicht+kontrollieren%2C+Gewicht+reduzieren%2C+Kontrolle+%C3%BCber+4500+Lebensmittel%2C+Esslust+organisieren%2C+Essfrust+vermeiden%2C+elektronisches+Ern%C3%A4hrungstagebuch%2C+Ern%C3%A4hrungstagebuch';
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();
};

