/* [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 theSitetree=[ 
	['PAGE','32401',jdecode('home'),jdecode(''),'/32401.html','true',[],''],
	['PAGE','5201',jdecode('about'),jdecode(''),'/5201.html','true',[],''],
	['PAGE','2252',jdecode('services'),jdecode(''),'/2252.html','true',[],''],
	['PAGE','2273',jdecode('new+clients'),jdecode(''),'/2273.html','true',[],''],
	['PAGE','2294',jdecode('healthcare+items'),jdecode(''),'/2294.html','true',[],''],
	['PAGE','2315',jdecode('reading+room'),jdecode(''),'/2315.html','true',[],''],
	['PAGE','9001',jdecode('contact'),jdecode(''),'/9001.html','true',[],'']];
var siteelementCount=7;
theSitetree.topTemplateName='Vita02';
theSitetree.paletteFamily='88A6B5';
theSitetree.keyvisualId='11283';
theSitetree.keyvisualName='kv_11283.jpg';
theSitetree.fontsetId='32118';
theSitetree.graphicsetId='13936';
theSitetree.contentColor='5889A3';
theSitetree.contentBGColor='F6FBFE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Vita02',
				paletteFamily: 	'88A6B5',
				keyvisualId: 	'11283',
				keyvisualName: 	'kv_11283.jpg',
				fontsetId: 		'32118',
				graphicsetId: 	'13936',
				contentColor: 	'5889A3',
				contentBGColor: 'F6FBFE',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2252',
internalId:  '',
customField: '20100705-182008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2273',
internalId:  '',
customField: '20100704-152159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2294',
internalId:  '',
customField: '20100705-182743'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2315',
internalId:  '',
customField: '20100704-150041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100705-190010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9001',
internalId:  '',
customField: '20100704-145217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32401',
internalId:  '',
customField: '20100705-191734'
};
webappMappings['7008']=webappMappings['7008-14856']={
webappId:    '7008',
documentId:  '9001',
internalId:  '14856',
customField: 'language:en;country:US;'
};
webappMappings['7050']=webappMappings['7050-17193']={
webappId:    '7050',
documentId:  '2315',
internalId:  '17193',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INXPOR';
var companyName   = 'Nutritional+Wellness+Program';
var htmlTitle	  = 'Nutritional+Wellness+Program';
var metaKeywords  = 'nutrition%2C+environment%2C+physical%2C+emotional%2C+mental%2C+dietary%2C+nutritionist%2C+goals%2C+wellness%2C+well%2C+health%2C+eating%2C+styles%2C+intentions%2C+relationship%2C+family%2C+career%2C+dreams%2C+desires%2C+aspirations%2C+holistic%2C+lifestyle%2C+principles%2C+workplace%2C+community%2C+world%2C+food%2C+drink%2C+sunshine%2C+body%2C+diseases%2C+illness%2C+fruit%2C+vegetables%2C+meat%2C+diary%2C+eggs%2C+proteins%2C+carbohydrates%2C+fat%2C+free%2C+products%2C+supplements%2C+reiki%2C+massage%2C+eft%2C+blood%2C+lab%2C+appointment%2C+kathy%2C+kathryn%2C+m.kathryn%2C+mcmillan%2C+guidance%2C+support%2C+effort%2C+change%2C+energy';
var metaContents  = 'Dietary+choices+are+interrelated+not+only+with+the+condition+of+our+physical+body%2C+but+our+emotions+and+mental+capabilities%2C+as+well+as+interconnection+with+the+environment.';
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();
};
