/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','5201',jdecode('About+Karen'),jdecode(''),'/5201.html','true',[],'',''],
	['PAGE','5222',jdecode('Freelance+Writing+Services'),jdecode(''),'/5222.html','true',[],'',''],
	['PAGE','5243',jdecode('Articles+by+Karen'),jdecode(''),'/5243.html','true',[],'',''],
	['PAGE','5264',jdecode('Reviews'),jdecode(''),'/5264.html','true',[],'',''],
	['PAGE','7501',jdecode('Quick+Q%26A'),jdecode(''),'/7501.html','true',[],'',''],
	['PAGE','5285',jdecode('Contact+Karen'),jdecode(''),'/5285.html','true',[],'',''],
	['PAGE','17101',jdecode('Health+Highlights'),jdecode(''),'/17101.html','true',[],'',''],
	['PAGE','5306',jdecode('The+Wellness+Writer+blog'),jdecode(''),'/5306.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Intense';
theSitetree.paletteFamily='66956C';
theSitetree.keyvisualId='3496';
theSitetree.keyvisualName='kv_3496.jpg';
theSitetree.fontsetId='10439';
theSitetree.graphicsetId='10800';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='B3D0B7';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Intense',
				paletteFamily: 	'66956C',
				keyvisualId: 	'3496',
				keyvisualName: 	'kv_3496.jpg',
				fontsetId: 		'10439',
				graphicsetId: 	'10800',
				contentColor: 	'000000',
				contentBGColor: 'B3D0B7',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'AD401A',
				e_color: 		'727171',
				f_color: 		'3F3F3F',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20100821-214553'
};
webappMappings['7050']=webappMappings['7050-2350']={
webappId:    '7050',
documentId:  '5306',
internalId:  '2350',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100225-183420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5222',
internalId:  '',
customField: '20080921-201841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5243',
internalId:  '',
customField: '20100425-163132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5285',
internalId:  '',
customField: '20090826-211441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20100321-170808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5264',
internalId:  '',
customField: '20100718-123954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5306',
internalId:  '',
customField: '20080518-203445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17101',
internalId:  '',
customField: '20090613-110751'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN2U30';
var companyName   = 'Karen+Giles-Smith%2C+Freelance+Writer';
var htmlTitle	  = 'Karen+Giles-Smith.com+Freelance+Writer';
var metaKeywords  = 'Karen+Giles-Smith%2C+Karen+Giles+Smith%2C+freelance+writer%2C+writer%2C+freelance+writing%2C+nutrition+writer%2C+food+writer%2C+health+writer%2C+wellness+writer%2C+writing+for+magazines%2C+The+Wellness+Writer%2C+professional+writer%2C+business+communications%2C+registered+dietitian%2C+RD%2C+R.D.%2C+dietitian%2C+copywriter';
var metaContents  = 'Karen+Giles-Smith%2C+freelance+writer+and+registered+dietitian.';
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();
};
