/* [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','1717',jdecode('Try+PERFECT+SLEEP'),jdecode(''),'/1717.html','true',[],'',''],
	['PAGE','12301',jdecode('Request+a+Sample'),jdecode(''),'/12301.html','true',[],'',''],
	['PAGE','8401',jdecode('Try+GREEN+IMMUNE'),jdecode(''),'/8401.html','true',[],'',''],
	['PAGE','32',jdecode('Home'),jdecode(''),'/32.html','true',[],'',''],
	['PAGE','71',jdecode('About+PERFECT+SLEEP'),jdecode(''),'/71/index.html','true',[ 
		['PAGE','1428',jdecode('No+Chinese+Ingredients'),jdecode(''),'/71/1428.html','true',[],'',''],
		['PAGE','62',jdecode('Perfect+Sleep+Ingredients'),jdecode(''),'/71/62.html','true',[],'',''],
		['PAGE','1830',jdecode('Perfect+Sleep+FAQs'),jdecode(''),'/71/1830.html','true',[],'',''],
		['PAGE','1270',jdecode('15+Sleep+Enhancing+Tips'),jdecode(''),'/71/1270.html','true',[],'','']
	],'',''],
	['PAGE','8422',jdecode('About+GREEN+IMMUNE'),jdecode(''),'/8422/index.html','true',[ 
		['PAGE','9901',jdecode('Green+Immune+Ingredients'),jdecode(''),'/8422/9901.html','true',[],'',''],
		['PAGE','9922',jdecode('Green+Immune+FAQs'),jdecode(''),'/8422/9922.html','true',[],'',''],
		['PAGE','12901',jdecode('About+the+Mushroom+Matrix'),jdecode(''),'/8422/12901.html','true',[],'','']
	],'',''],
	['PAGE','1261',jdecode('Our+110%25+Guarantee'),jdecode(''),'/1261.html','true',[],'',''],
	['PAGE','1419',jdecode('Quality+Assured'),jdecode(''),'/1419.html','true',[],'',''],
	['PAGE','1279',jdecode('Policies'),jdecode(''),'/1279.html','true',[],'',''],
	['PAGE','53',jdecode('About+Us'),jdecode(''),'/53.html','true',[],'',''],
	['PAGE','1297',jdecode('Contact+Us'),jdecode(''),'/1297/index.html','true',[ 
		['PAGE','2141',jdecode('Contact+Us+%28follow+up+page%29'),jdecode(''),'/1297/2141.html','false',[],'','']
	],'',''],
	['PAGE','3472',jdecode('Wholesale+Inquiries'),jdecode(''),'/3472/index.html','true',[ 
		['PAGE','3528',jdecode('Wholesale+Inquiries+%28follow+up+page%29'),jdecode(''),'/3472/3528.html','false',[],'','']
	],'',''],
	['PAGE','1352',jdecode('Order+Today%21'),jdecode(''),'/1352/index.html','true',[ 
		['PAGE','3723',jdecode('Perfect+Sleep'),jdecode(''),'/1352/3723.html','true',[],'',''],
		['PAGE','3732',jdecode('No+Chinese+Ingredients'),jdecode(''),'/1352/3732.html','true',[],'','']
	],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Aeskulap';
theSitetree.paletteFamily='012253';
theSitetree.keyvisualId='2496';
theSitetree.keyvisualName='labor.jpg';
theSitetree.fontsetId='438';
theSitetree.graphicsetId='484';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Aeskulap',
				paletteFamily: 	'012253',
				keyvisualId: 	'2496',
				keyvisualName: 	'labor.jpg',
				fontsetId: 		'438',
				graphicsetId: 	'484',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-8845']={
webappId:    '7008',
documentId:  '3472',
internalId:  '8845',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20081208-003216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20091111-221803'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71',
internalId:  '',
customField: '20090321-181742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1717',
internalId:  '',
customField: '20081108-103440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20081125-001714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8422',
internalId:  '',
customField: '20091111-230531'
};
webappMappings['7008']=webappMappings['7008-8844']={
webappId:    '7008',
documentId:  '1297',
internalId:  '8844',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12301',
internalId:  '',
customField: '20100713-061655'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1428',
internalId:  '',
customField: '20080129-063532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62',
internalId:  '',
customField: '20091111-233313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1830',
internalId:  '',
customField: '20080129-064157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1270',
internalId:  '',
customField: '20080129-064317'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1261',
internalId:  '',
customField: '20081129-153610'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1419',
internalId:  '',
customField: '20081129-153932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1279',
internalId:  '',
customField: '20081129-154155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53',
internalId:  '',
customField: '20080120-070855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1297',
internalId:  '',
customField: '20081129-154318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2141',
internalId:  '',
customField: '20080120-065656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3472',
internalId:  '',
customField: '20080526-153441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3528',
internalId:  '',
customField: '20080526-153635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1352',
internalId:  '',
customField: '20100720-022004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3723',
internalId:  '',
customField: '20081129-155107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3732',
internalId:  '',
customField: '20081129-155107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20081208-000710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9922',
internalId:  '',
customField: '20081129-125303'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INX37F';
var companyName   = '24%2F7+Order+Hotline+866.723.3101';
var htmlTitle	  = 'Perfect+Sleep+-+Safe+Natural+Sleep+Aid+with+No+Chinese+Ingredients';
var metaKeywords  = 'Over+the+counter+sleep+aids%2C+sleep+pill%2C+natural+sleeping+aid%2C+natural+sleep+pill%2C+natural+sleep+aid%2C+natural+sleep%2C+supplements+calcium%2C+help+for+non+rem+sleep%2C+natural+sleep+supplement%2C+sleep+supplement%2C+sleep+enhancer';
var metaContents  = 'Perfect+Sleep+is+a+safe%2C+natural+nonprescription%2C+over+the+counter+sleep+aid%2C+made+in+the+USA+with+no+Chinese+ingredients.+It+helps+relax+the+muscles%2C+calm+the+mind%2C+and+encourage+deep+sleep.+';
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();
};
