/* [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','8701',jdecode('Ensemble%2C+c%26%23x27%3Best+plus+facile+%21'),jdecode(''),'/8701/index.html','true',[ 
		['PAGE','18201',jdecode('Notre+%C3%A9quipe'),jdecode(''),'/8701/18201.html','true',[],'','']
	],'',''],
	['PAGE','2415',jdecode('Nos+produits'),jdecode(''),'/2415/index.html','true',[ 
		['PAGE','15201',jdecode('Di%C3%A8te+prot%C3%A9in%C3%A9e'),jdecode(''),'/2415/15201.html','true',[],'',''],
		['PAGE','15243',jdecode('Compl%C3%A9ments'),jdecode(''),'/2415/15243.html','true',[],'',''],
		['PAGE','15222',jdecode('En-cas+'),jdecode(''),'/2415/15222.html','true',[],'','']
	],'',''],
	['PAGE','8857',jdecode('Conf%C3%A9rences'),jdecode(''),'/8857.html','true',[],'',''],
	['PAGE','17701',jdecode('Conseils+%26+Recettes'),jdecode(''),'/17701.html','true',[],'',''],
	['PAGE','14201',jdecode('Shop+en+ligne'),jdecode(''),'/14201.html','true',[],'',''],
	['PAGE','2352',jdecode('Contact'),jdecode(''),'/2352.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='D72B2B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10555';
theSitetree.graphicsetId='10893';
theSitetree.contentColor='0000A0';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'fr',
  country: 'FR'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'D72B2B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10555',
				graphicsetId: 	'10893',
				contentColor: 	'0000A0',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D72B2B',
				e_color: 		'D72B2B',
				f_color: 		'D72B2B',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8701',
internalId:  '1006',
customField: '1006'
};
webappMappings['4001']=webappMappings['4001-24911121']={
webappId:    '4001',
documentId:  '14201',
internalId:  '24911121',
customField: 'language:fr;country:FR;'
};
webappMappings['7008']=webappMappings['7008-328']={
webappId:    '7008',
documentId:  '8857',
internalId:  '328',
customField: 'language:fr;country:FR;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20100720-111804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18201',
internalId:  '',
customField: '20090513-231301'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2415',
internalId:  '',
customField: '20090514-064904'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15201',
internalId:  '',
customField: '20081212-200019'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15222',
internalId:  '',
customField: '20090514-065042'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15243',
internalId:  '',
customField: '20090514-065104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8857',
internalId:  '',
customField: '20090514-065145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17701',
internalId:  '',
customField: '20090514-065252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14201',
internalId:  '',
customField: '20090202-023534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2352',
internalId:  '',
customField: '20100720-111826'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW1X0INE5OR';
var companyName   = 'Cette+fois%2C+c%27est+la+bonne+%21';
var htmlTitle	  = 'swissdietetic';
var metaKeywords  = 'r%C3%A9gime%2C+amincissement%2C+di%C3%A8te%2C+maigrir%2C+ligne+id%C3%A9ale%2C+retrouver+la+ligne%2C+conserver+la+ligne%2C+silhouette%2C+%C3%A9quilibre+ponderal%2C+trouble+de+lalimentation%2C+fit%2C+';
var metaContents  = 'di%C3%A8te+assist%C3%A9e+et+contr%C3%B4l%C3%A9e%2C+di%C3%A8te+prot%C3%A9in%C3%A9e%2C+retrouver+la+ligne+facilement%2C+conserver+la+ligne%2C+ob%C3%A9sit%C3%A9%2C+trouble+de+lalimentation%2C+di%C3%A9t%C3%A9tique';
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();
};

