/* [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','4078',jdecode('About+us'),jdecode(''),'/4078.html','true',[],''],
	['PAGE','4036',jdecode('News'),jdecode(''),'/4036.html','true',[],''],
	['PAGE','3994',jdecode('Peptides'),jdecode(''),'/3994.html','true',[],''],
	['PAGE','4015',jdecode('Powders'),jdecode(''),'/4015.html','true',[],''],
	['PAGE','7401',jdecode('Article'),jdecode(''),'/7401.html','true',[],''],
	['PAGE','5801',jdecode('FAQ%26%23x27%3Bs'),jdecode(''),'/5801.html','true',[],''],
	['PAGE','3952',jdecode('Catalogue%2Fdownload'),jdecode(''),'/3952.html','true',[],''],
	['PAGE','4057',jdecode('Contact'),jdecode(''),'/4057.html','true',[],''],
	['PAGE','3973',jdecode('Search'),jdecode(''),'/3973.html','true',[],'']];
var siteelementCount=9;
theSitetree.topTemplateName='Antigua';
theSitetree.paletteFamily='68638F';
theSitetree.keyvisualId='6902';
theSitetree.keyvisualName='kv_6902.jpg';
theSitetree.fontsetId='11216';
theSitetree.graphicsetId='12038';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='8782AC';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Antigua',
				paletteFamily: 	'68638F',
				keyvisualId: 	'6902',
				keyvisualName: 	'kv_6902.jpg',
				fontsetId: 		'11216',
				graphicsetId: 	'12038',
				contentColor: 	'FFFFFF',
				contentBGColor: '8782AC',
				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: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-14829']={
webappId:    '7008',
documentId:  '4057',
internalId:  '14829',
customField: 'language:en;country:US;'
};
webappMappings['8002']=webappMappings['8002-search']={
webappId:    '8002',
documentId:  '3973',
internalId:  'search',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4057',
internalId:  '',
customField: '20090319-231657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3973',
internalId:  '',
customField: '20090319-231657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3952',
internalId:  '',
customField: '20090319-231657'
};
webappMappings['7050']=webappMappings['7050-8595']={
webappId:    '7050',
documentId:  '4036',
internalId:  '8595',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4036',
internalId:  '',
customField: '20090406-034302'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4078',
internalId:  '',
customField: '20090406-034117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4015',
internalId:  '',
customField: '20090319-235244'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3994',
internalId:  '',
customField: '20090319-231657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20090402-223917'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20090405-230636'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN350C';
var companyName   = 'BELIFE+PEPTIDES';
var htmlTitle	  = 'Belife+Peptides+-----+Best+Source+to+Buy+Peptides+Online.+';
var metaKeywords  = 'peptide%3Bbuy+peptides%3Bbuy+cjc+1295%3Bsermorelin%3Bbuy+sermorelin%3BMelanotan+II%3Bbuy+Melanotan+II%3B';
var metaContents  = 'BELIFE+PEPTIDES-----Best+Source+to+Buy+Peptides+Online.';
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();
};
