/* [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','2001',jdecode('Home'),jdecode(''),'/2001.html','true',[],''],
	['PAGE','2501',jdecode('New+Babies'),jdecode(''),'/2501.html','true',[],''],
	['PAGE','2585',jdecode('What+is+a+doula%3F+%26+other+FAQ%26%23x27%3Bs'),jdecode(''),'/2585.html','true',[],''],
	['PAGE','2627',jdecode('Childbirth+Ed.+%26+Bellycasting'),jdecode(''),'/2627.html','true',[],''],
	['PAGE','2543',jdecode('Birth+Doula+Package'),jdecode(''),'/2543.html','true',[],''],
	['PAGE','2564',jdecode('Postpartum+Doula+Package'),jdecode(''),'/2564.html','true',[],''],
	['PAGE','2801',jdecode('Feedback'),jdecode(''),'/2801.html','true',[],''],
	['PAGE','2522',jdecode('About+Me'),jdecode(''),'/2522.html','true',[],''],
	['PAGE','2606',jdecode('Favorite+Resources'),jdecode(''),'/2606.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Blossom';
theSitetree.paletteFamily='A4681A';
theSitetree.keyvisualId='7108';
theSitetree.keyvisualName='kv_7108.jpg';
theSitetree.fontsetId='16397';
theSitetree.graphicsetId='12131';
theSitetree.contentColor='A4681A';
theSitetree.contentBGColor='E5E2E2';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Blossom',
				paletteFamily: 	'A4681A',
				keyvisualId: 	'7108',
				keyvisualName: 	'kv_7108.jpg',
				fontsetId: 		'16397',
				graphicsetId: 	'12131',
				contentColor: 	'A4681A',
				contentBGColor: 'E5E2E2',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100217-140623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2522',
internalId:  '',
customField: '20100226-171830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20100615-141800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2585',
internalId:  '',
customField: '20100217-153156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2627',
internalId:  '',
customField: '20091101-144233'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2543',
internalId:  '',
customField: '20100217-152222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2564',
internalId:  '',
customField: '20100217-145835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2606',
internalId:  '',
customField: '20100426-204649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20100426-201806'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0INVOAC';
var companyName   = 'Mama+Beginnings%3A+Birth+and+Postpartum+Doula+Services';
var htmlTitle	  = 'Mama+Beginnings%3A+Birth+and+Postpartum+Doula+Services';
var metaKeywords  = 'doula%2C+birth%2C+labor%2C+vbac%2C+coach%2C+childbirth%2C+natural%2C+mothering%2C+breastfeeding%2C+nursing%2C+postpartum%2C+childbirth+education%2C+fargo%2C+moorhead%2C+homebirth%2C+midwife%2C+lactation%2C+optimal+fetal+positioning';
var metaContents  = 'I+provide+birth+%28professional+labor+coach%29++and+postpartum+%28professional+mothers+helper%29+doula+services+for+the+Fargo-Moorhead+and+surrounding+communities.++I+offer+a+sliding+fee+scale+and%2For+payment+plans.++I+have+served+dozens+of+women+and+families+as+a+doula+and+lactation+educator+since+2005.';
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();
};
