/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','15801',jdecode('Services+Offered'),jdecode(''),'/15801/index.html','true',[ 
		['PAGE','22994',jdecode('Diabetes+Education'),jdecode(''),'/15801/22994.html','true',[],'',''],
		['PAGE','573',jdecode('Nutrition+Counseling'),jdecode(''),'/15801/573.html','true',[],'',''],
		['PAGE','23353',jdecode('Healthy+Weight+Management'),jdecode(''),'/15801/23353.html','true',[],'',''],
		['PAGE','13822',jdecode('Program+Consulting'),jdecode(''),'/15801/13822.html','true',[],'',''],
		['PAGE','13843',jdecode('Speaking'),jdecode(''),'/15801/13843.html','true',[],'','']
	],'',''],
	['PAGE','10601',jdecode('Group+Education'),jdecode(''),'/10601.html','true',[],'',''],
	['PAGE','14501',jdecode('NutritionHealth+Newsletter'),jdecode(''),'/14501.html','true',[],'',''],
	['PAGE','13801',jdecode('Payment+Information'),jdecode(''),'/13801.html','true',[],'',''],
	['PAGE','552',jdecode('About+NutritionHealth'),jdecode(''),'/552.html','true',[],'',''],
	['PAGE','678',jdecode('Contact%2FLocation'),jdecode(''),'/678/index.html','true',[ 
		['PAGE','699',jdecode('Address'),jdecode(''),'/678/699.html','true',[],'',''],
		['PAGE','720',jdecode('How+to+find+us'),jdecode(''),'/678/720.html','true',[],'','']
	],'',''],
	['PAGE','23312',jdecode('Recommended+Resources'),jdecode(''),'/23312.html','true',[],'',''],
	['PAGE','23321',jdecode('Good+for+You+Recipes'),jdecode(''),'/23321.html','true',[],'',''],
	['PAGE','23957',jdecode('Now+on+Facebook%2FTwitter'),jdecode(''),'/23957.html','true',[],'','']];
var siteelementCount=17;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='879ED6';
theSitetree.keyvisualId='6858';
theSitetree.keyvisualName='kv_6858.jpg';
theSitetree.fontsetId='11211';
theSitetree.graphicsetId='12030';
theSitetree.contentColor='354B86';
theSitetree.contentBGColor='94AAE1';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Angkor',
				paletteFamily: 	'879ED6',
				keyvisualId: 	'6858',
				keyvisualName: 	'kv_6858.jpg',
				fontsetId: 		'11211',
				graphicsetId: 	'12030',
				contentColor: 	'354B86',
				contentBGColor: '94AAE1',
				a_color: 		'94AAE1',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100217-062010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20090310-175329'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15801',
internalId:  '',
customField: '20100718-214628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20090309-212034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13822',
internalId:  '',
customField: '20100718-214702'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13843',
internalId:  '',
customField: '20100718-214737'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10601',
internalId:  '',
customField: '20100719-213248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20090309-212503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20100718-165745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20100217-062633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '699',
internalId:  '',
customField: '20080520-225736'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '720',
internalId:  '',
customField: '20080110-003408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22994',
internalId:  '',
customField: '20090309-205535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23321',
internalId:  '',
customField: '20090311-183334'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23312',
internalId:  '',
customField: '20100719-211656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23353',
internalId:  '',
customField: '20090519-144819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23957',
internalId:  '',
customField: '20100719-091300'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX39M';
var companyName   = 'NHC%2FChapel+Hill+Nutrition+Services';
var htmlTitle	  = 'NutritionHealth+Consultants%2C+LLC';
var metaKeywords  = 'Diabetes+Education%2C+diabetes+self+management+training%2C+nutrition+counseling%2C+healthy+eating%2C+wellness%2C+disease+prevention%2C+chronic+disease+management%2C+dietitian%2C+nutritionist.';
var metaContents  = 'Nutrition+Education+and+Dietary+Counseling+for+wellness+and+chronic+disease+management+by+registered+dietitian%2F+licensed+nutritionist%2F+certified+diabetes+educator.++';
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();
};
