/* [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','1801',jdecode('Home'),jdecode(''),'/1801.html','true',[],''],
	['PAGE','2401',jdecode('Anti-Aging'),jdecode(''),'/2401/index.html','false',[ 
		['PAGE','5601',jdecode('Step+1'),jdecode(''),'/2401/5601.html','true',[],''],
		['PAGE','5622',jdecode('Step+2'),jdecode(''),'/2401/5622.html','true',[],''],
		['PAGE','5643',jdecode('Step+3'),jdecode(''),'/2401/5643.html','true',[],''],
		['PAGE','6501',jdecode('Step+4'),jdecode(''),'/2401/6501.html','true',[],'']
	],''],
	['PAGE','4101',jdecode('Mineral+Waters'),jdecode(''),'/4101/index.html','false',[ 
		['PAGE','4122',jdecode('Gold'),jdecode(''),'/4101/4122.html','true',[],''],
		['PAGE','4143',jdecode('Sliver'),jdecode(''),'/4101/4143.html','true',[],''],
		['PAGE','4164',jdecode('Copper'),jdecode(''),'/4101/4164.html','true',[],''],
		['PAGE','4185',jdecode('Platinum'),jdecode(''),'/4101/4185.html','true',[],''],
		['PAGE','5201',jdecode('Iridium'),jdecode(''),'/4101/5201.html','true',[],''],
		['PAGE','5222',jdecode('Palladium'),jdecode(''),'/4101/5222.html','true',[],''],
		['PAGE','5243',jdecode('Rhodium'),jdecode(''),'/4101/5243.html','true',[],''],
		['PAGE','5264',jdecode('Magnesium'),jdecode(''),'/4101/5264.html','true',[],''],
		['PAGE','5285',jdecode('Ruthenium'),jdecode(''),'/4101/5285.html','true',[],'']
	],''],
	['PAGE','2443',jdecode('Skin+Products'),jdecode(''),'/2443.html','false',[],''],
	['PAGE','6301',jdecode('Sprout+Water'),jdecode(''),'/6301.html','false',[],''],
	['PAGE','2464',jdecode('Green+Cleaners'),jdecode(''),'/2464.html','false',[],''],
	['PAGE','2422',jdecode('Purchase+Products'),jdecode(''),'/2422.html','true',[],''],
	['PAGE','3801',jdecode('Links'),jdecode(''),'/3801.html','true',[],''],
	['PAGE','17501',jdecode('Contact'),jdecode(''),'/17501.html','true',[],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='CECDD0';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32053';
theSitetree.graphicsetId='13873';
theSitetree.contentColor='353535';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Grace',
				paletteFamily: 	'CECDD0',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32053',
				graphicsetId: 	'13873',
				contentColor: 	'353535',
				contentBGColor: 'FFFFFF',
				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:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20091007-020805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20090615-155213'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2422',
internalId:  '',
customField: '20091007-014830'
};
webappMappings['4001']=webappMappings['4001-18355064']={
webappId:    '4001',
documentId:  '2422',
internalId:  '18355064',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-20570']={
webappId:    '7008',
documentId:  '17501',
internalId:  '20570',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20090903-130139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4122',
internalId:  '',
customField: '20090903-134652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2464',
internalId:  '',
customField: '20090610-172943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5601',
internalId:  '',
customField: '20090615-190511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5622',
internalId:  '',
customField: '20090615-191235'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5643',
internalId:  '',
customField: '20090615-192451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2443',
internalId:  '',
customField: '20090610-172419'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4185',
internalId:  '',
customField: '20090902-152112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20090615-152102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20090615-194749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17501',
internalId:  '',
customField: '20090904-164652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20090903-130921'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4143',
internalId:  '',
customField: '20090903-134731'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4164',
internalId:  '',
customField: '20090903-134816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20090903-134849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5222',
internalId:  '',
customField: '20090903-134920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5243',
internalId:  '',
customField: '20090903-134950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5264',
internalId:  '',
customField: '20090902-151942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5285',
internalId:  '',
customField: '20090902-151916'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3T71';
var companyName   = 'Life+Supply';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = '';
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();
};
