/* [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','1701',jdecode('Home'),jdecode(''),'/1701.html','true',[],''],
	['PAGE','1752',jdecode('Nutrition+and+Fitness'),jdecode(''),'/1752.html','true',[],''],
	['PAGE','1773',jdecode('Programs+and+Rates'),jdecode(''),'/1773.html','true',[],''],
	['PAGE','1794',jdecode('About+Me'),jdecode(''),'/1794.html','true',[],''],
	['PAGE','1836',jdecode('Contact'),jdecode(''),'/1836.html','true',[],''],
	['PAGE','8601',jdecode('Nutritional+Supplements'),jdecode(''),'/8601.html','true',[],'']];
var siteelementCount=6;
theSitetree.topTemplateName='Education';
theSitetree.paletteFamily='766B4B';
theSitetree.keyvisualId='7309';
theSitetree.keyvisualName='kv_7309.jpg';
theSitetree.fontsetId='16465';
theSitetree.graphicsetId='12158';
theSitetree.contentColor='333333';
theSitetree.contentBGColor='867C5F';
var theTemplate={
				name: 			'Education',
				paletteFamily: 	'766B4B',
				keyvisualId: 	'7309',
				keyvisualName: 	'kv_7309.jpg',
				fontsetId: 		'16465',
				graphicsetId: 	'12158',
				contentColor: 	'333333',
				contentBGColor: '867C5F',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1701',
internalId:  '',
customField: '20081119-185318'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1701',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-3154143']={
webappId:    '1501',
documentId:  '1701',
internalId:  '3154143',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1752',
internalId:  '',
customField: '20081120-212010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1773',
internalId:  '',
customField: '20090104-185322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1794',
internalId:  '',
customField: '20081122-151223'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8601',
internalId:  '',
customField: '20090113-181729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1836',
internalId:  '',
customField: '20081124-180630'
};
webappMappings['7060']=webappMappings['7060-e35c7a534875253652a1eac30e19a32d']={
webappId:    '7060',
documentId:  '1794',
internalId:  'e35c7a534875253652a1eac30e19a32d',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-601']={
webappId:    '7008',
documentId:  '1836',
internalId:  '601',
customField: 'language:en;country:US;'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INVSOB';
var companyName   = 'Pro-Nutrition';
var htmlTitle	  = 'Personal+Tainer+and+Sports+Nutritionist+in+Morris+county+area+and+Hoboken';
var metaKeywords  = 'Personal+Trainer%2C+Nutritionist%2C+morris+county%2C+hoboken%2C+fitness%2C+1+on+1%2C+group+training%2C+gym%2C+nutrition%2C+muscle%2C+personal+trainer+in+rockaway%2C+personal+trainer+in+denville%2C+personal+trainer+in+parsippany%2C+personal+trainer+in+morristown%2C+personal+trainer+in+wayne%2C+weight+loss%2C+diet+analysrt%2C+diet%2C+dietician%2C+weight+loss+diet';
var metaContents  = 'Personal+Trainer+and+Sports+Nutritionist+in+Hoboken+and+Morris+County+for+1-on-1+or+group+training+at+home+or+gym.++Programs+include+Pre+and+Post-natal%2C+Bootcamp%2C+Summer+Body%2C+Over-all+Health+and+well+being%2C+Pre-wedding+and+event+among+others.';
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();
};
