/* [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','25585',jdecode('Karma+Mom%26%23x27%3Bs+Blog'),jdecode(''),'/25585.html','true',[],'',''],
	['PAGE','6843',jdecode('Karma+Pep+Talks'),jdecode(''),'/6843.html','true',[],'',''],
	['PAGE','6822',jdecode('Karma+Mom%26%23x27%3Bs+Theories'),jdecode(''),'/6822.html','true',[],'',''],
	['PAGE','3936',jdecode('Karma+%26+Mothering+Yourself'),jdecode(''),'/3936.html','true',[],'',''],
	['PAGE','3915',jdecode('Karma+Mom+Stories+February+2009'),jdecode(''),'/3915/index.html','false',[ 
		['PAGE','6801',jdecode('Who+is+Karma+Mom%3F'),jdecode(''),'/3915/6801.html','false',[],'','']
	],'',''],
	['PAGE','26385',jdecode('Who+is+Karma+Mom%3F'),jdecode(''),'/26385.html','true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Undulate';
theSitetree.paletteFamily='040404';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33118';
theSitetree.graphicsetId='14070';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='404040';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Undulate',
				paletteFamily: 	'040404',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33118',
				graphicsetId: 	'14070',
				contentColor: 	'FFFFFF',
				contentBGColor: '404040',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26385',
internalId:  '',
customField: '20100414-201929'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '25585',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25585',
internalId:  '',
customField: '20100326-140831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3915',
internalId:  '',
customField: '20090227-231333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3936',
internalId:  '',
customField: '20100221-074424'
};
webappMappings['7050']=webappMappings['7050-914']={
webappId:    '7050',
documentId:  '25585',
internalId:  '914',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20090708-201047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6822',
internalId:  '',
customField: '20100209-154245'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6843',
internalId:  '',
customField: '20100303-094227'
};
var canonHostname = 'diywk01.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INPEQX';
var companyName   = 'KarmaMom.com';
var htmlTitle	  = 'Karma+Mom+-+';
var metaKeywords  = 'Mom%2C+karma%2C+Mommy++Me%2C+Mommy%2C+law+of+cause+and+effect%2C+understanding+karma%2C+the+secret%2C+helping%2C+move+forward%2C+break+patterns%2C+south+beach%2C+miami%2C+date%2C+pinot+grigio%2C+love%2C+happy%2C+';
var metaContents  = 'motherhood%2C+Karma+theories%2C+self+expression%2C+self+love%2C+mothering+yourself%2C+loving+your+children%2C+healing+your+family%2C+healing+yourself%2C+working+with+karma+and+the+law+of+cause+and+effect%2C+';
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();
};
