/* [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','1801',jdecode('Welcome'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','59601',jdecode('Holiday+Specials'),jdecode(''), jdecode('%2F59601.html'), 'false',[],'',''],
	['PAGE','1901',jdecode('Animal+Communication'),jdecode(''), jdecode('%2F1901.html'), 'true',[],'',''],
	['PAGE','30701',jdecode('Equine+Massage+Therapy'),jdecode(''), jdecode('%2F30701.html'), 'true',[],'',''],
	['PAGE','5801',jdecode('Reiki'),jdecode(''), jdecode('%2F5801.html'), 'true',[],'',''],
	['PAGE','4701',jdecode('Young+Living+Essential+Oils'),jdecode(''), jdecode('%2F4701.html'), 'true',[],'',''],
	['PAGE','1922',jdecode('Reference+Materials'),jdecode(''), jdecode('%2F1922.html'), 'true',[],'',''],
	['PAGE','4785',jdecode('Promotions+%26+Events'),jdecode(''), jdecode('%2F4785.html'), 'true',[],'',''],
	['PAGE','4806',jdecode('Friends+%26+Partners'),jdecode(''), jdecode('%2F4806.html'), 'true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Sommelier';
theSitetree.paletteFamily='D6CF75';
theSitetree.keyvisualId='12089';
theSitetree.keyvisualName='kv_12089.jpg';
theSitetree.fontsetId='33294';
theSitetree.graphicsetId='14168';
theSitetree.contentColor='512C00';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRNC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Sommelier',
				paletteFamily: 	'D6CF75',
				keyvisualId: 	'12089',
				keyvisualName: 	'kv_12089.jpg',
				fontsetId: 		'33294',
				graphicsetId: 	'14168',
				contentColor: 	'512C00',
				contentBGColor: 'FFFFFF',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20120115-165554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20120112-172946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1922',
internalId:  '',
customField: '20111102-161220'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4806',
internalId:  '',
customField: '20120119-115753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20111107-130152'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30701',
internalId:  '',
customField: '20120202-225916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20110828-140733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4785',
internalId:  '',
customField: '20120202-233611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59601',
internalId:  '',
customField: '20101119-162642'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INV349';
var companyName   = 'Peace+of+Mind%2C+Body+%26+Soul';
var htmlTitle	  = 'Peace+of+Mind%2C+Body+and+Soul.++Helping+animals+and+people+naturally';
var metaKeywords  = 'animal+communication%2C+animal+communicator%2C+animal+communication+mn%2C+young+living+essential+oils%2C+herbal+therapy%2C+holistic+wellness%2C+young+living+nutritional+supplements%2C+nutritional+supplements%2C+young+living+body+care%2C+ART+body+care%2C+A.R.T.+body+care%2C+energy+work%2C+reiki%2C+pet+services%2C+meditiation%2C+young+living%2C+young+living+mn%2C+holistic+animal+care%2C+horse+whisperer%2C+dog+whisperer%2C+cat+whisperer%2C+animal+psychic%2C+equine+communicator%2C+theraputic+grade+essential+oils%2C+pet+psychic%2C+horse+whisperer%2C+dog+whisperer%2C+cat+whisperer%2C+organic+supplments%2C+animal+care+products%2C+';
var metaContents  = 'Peace+of+Mind%2C+Body++Soul%3A+Helping+animals+and+people+naturally.+Products+and+services+to+help+maintain+health+and+wellness+through+natural+methods%3A+animal+communication%2C+Reiki%2C+equine+massage+therapy%2C+Raindrop+Technique%2C+acupressure%2C+and+aromatherapy+services.+Young+Living+Distributor+for+therapeutic-grade+essential+oils%2C+body+care+items+and+nutritional+supplements.';
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();
};

