/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],''],
	['PAGE','72468',jdecode('Caldrea+Cleansers'),jdecode(''),'/72468.html','true',[],''],
	['PAGE','70844',jdecode('MonaVie'),jdecode(''),'/70844.html','true',[],''],
	['PAGE','55901',jdecode('Storefront%2Fshopping'),jdecode(''),'/55901.html','true',[],''],
	['PAGE','43001',jdecode('Monthly+specials'),jdecode(''),'/43001.html','true',[],''],
	['PAGE','478',jdecode('News+You+Can+Use.......'),jdecode(''),'/478.html','true',[],''],
	['PAGE','499',jdecode('Contact%2FNewsletter'),jdecode(''),'/499.html','true',[],''],
	['PAGE','60001',jdecode('Links'),jdecode(''),'/60001.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Angkor';
theSitetree.paletteFamily='C5A858';
theSitetree.keyvisualId='6853';
theSitetree.keyvisualName='kv_6853.jpg';
theSitetree.fontsetId='11213';
theSitetree.graphicsetId='12034';
theSitetree.contentColor='64511A';
theSitetree.contentBGColor='DABB67';
var theTemplate={
				name: 			'Angkor',
				paletteFamily: 	'C5A858',
				keyvisualId: 	'6853',
				keyvisualName: 	'kv_6853.jpg',
				fontsetId: 		'11213',
				graphicsetId: 	'12034',
				contentColor: 	'64511A',
				contentBGColor: 'DABB67',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'DABB67',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20090729-210333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '70844',
internalId:  '',
customField: '20081019-145135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '55901',
internalId:  '',
customField: '20080817-231149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43001',
internalId:  '',
customField: '20090623-200034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '478',
internalId:  '',
customField: '20090623-211829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '499',
internalId:  '',
customField: '20090623-200117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60001',
internalId:  '',
customField: '20090623-200139'
};
webappMappings['1501']=webappMappings['1501-4929010']={
webappId:    '1501',
documentId:  '301',
internalId:  '4929010',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72468',
internalId:  '',
customField: '20090623-211658'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INE40T';
var companyName   = 'Welcome+to+e-botanicals.biz';
var htmlTitle	  = 'e-botanicals.biz+earth+friendly+home+care+products';
var metaKeywords  = 'essential+oils%2C+caldrea%2C+kaldrea%2C+caldria%2C+kaldria%2C+soaps%2C+natural%2C+organic%2C+botanical%2C+degreasers%2C+cleaners%2C+earth%2C+friendly%2C+eco%2C+eco-green%2C+home+decor%2C+high+quality%2C+plant+derived%2C+cleansers%2C+ginger+pomelo%2C+basil+blue+sage%2C+lavender+pine%2C+safe%2C+marble%2C+tile%2C+granite%2C+floors%2C+wood%2C+countertop%2C+stainless+steel%2C+remove+stains%2C+odors%2C+porcelain%2C+tile%2C+free%2C+monthly+specials%2C+botanicals%2C+MonaVie%2C+Mona+Vee%2C+Mona+Vie%2C+Acai%2C+Fruit+Blends%2C+antioxidants';
var metaContents  = 'High+quality%2C+earth+friendly+botanical+cleaners+for+your+home.++Luxurious%2C+exclusive+fragrances+for+cleaning+your+entire+home.++Created+from+the+finest+plant-derived+ingredients+and+essential+oils.';
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();
};
