/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','452',jdecode('news'),jdecode(''),'/452.html','true',[],'',''],
	['PAGE','473',jdecode('tips+and+tricks'),jdecode(''),'/473/index.html','true',[ 
		['PAGE','515',jdecode('Dictionary'),jdecode(''),'/473/515.html','true',[],'','']
	],'',''],
	['PAGE','536',jdecode('Symptoms'),jdecode(''),'/536/index.html','true',[ 
		['PAGE','557',jdecode('Causes'),jdecode(''),'/536/557.html','true',[],'',''],
		['PAGE','578',jdecode('Treatment'),jdecode(''),'/536/578.html','true',[],'','']
	],'',''],
	['PAGE','620',jdecode('contact'),jdecode(''),'/620.html','true',[],'',''],
	['PAGE','641',jdecode('Imprint'),jdecode(''),'/641.html','true',[],'',''],
	['PAGE','6301',jdecode('Shop'),jdecode(''),'/6301.html','true',[],'',''],
	['PAGE','6401',jdecode('How+to+find+us'),jdecode(''),'/6401.html','true',[],'',''],
	['PAGE','6801',jdecode('Directions'),jdecode(''),'/6801.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Proton';
theSitetree.paletteFamily='DCEAAA';
theSitetree.keyvisualId='3532';
theSitetree.keyvisualName='kv_3532.jpg';
theSitetree.fontsetId='10446';
theSitetree.graphicsetId='10830';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='DCEAAA';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Proton',
				paletteFamily: 	'DCEAAA',
				keyvisualId: 	'3532',
				keyvisualName: 	'kv_3532.jpg',
				fontsetId: 		'10446',
				graphicsetId: 	'10830',
				contentColor: 	'000000',
				contentBGColor: 'DCEAAA',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'747474',
				e_color: 		'864242',
				f_color: 		'A9A9A9',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20081021-123136'
};
webappMappings['1501']=webappMappings['1501-3804701']={
webappId:    '1501',
documentId:  '401',
internalId:  '3804701',
customField: '1501'
};
webappMappings['4001']=webappMappings['4001-3805115']={
webappId:    '4001',
documentId:  '6301',
internalId:  '3805115',
customField: 'language:en;country:GB;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '6401',
internalId:  'routing',
customField: 'en_GB'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '6801',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20080820-174824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20081021-123541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20080820-175457'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20081021-123819'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20081021-124059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20080820-180021'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20071129-154424'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '641',
internalId:  '',
customField: '20071129-154157'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20090422-103004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20071114-144718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20071115-165355'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2DXD';
var companyName   = 'Kristian+Wentzel+%26+Partners';
var htmlTitle	  = 'greenmind.info';
var metaKeywords  = 'herbal+tea+online%2Cherbal+tea+uk%2C+herbal+tea+set%2Cnatural+herbal+tea%2C+green+tea+health%2Cherbal+tea+suppliers%2C+buy+herbal+tea%2C+buy+herbal+tea+online%2C+herbal+tea+shop%2C+herbal+tea+infusion%2C+herbal+tea+mixture%2C+tea+for+health%2C+tea+health+effects%2C+calming+tea%2C+herbs+for+stomach%2C+intestinal+tea%2C+tea+for+colds%2Ctea+for+stomach%2C+bladder+tea%2C+sore+throat+tea%2C+kidney+tea%2C+tea+for+kidney%2C+cough+treatment%2C+calming+herbal+tea%2C+healing+tea%2C+kidney+herbs%2C+gall+bladder+tea%2C+liver+tea%2C+stomach+medicine%2C+calming+herbs%2C+herb+shops+in+london%2C+natural+healing+herbs%2C+buy+herbs+online';
var metaContents  = 'UKs+first+and+only+Herbal+Health+Tea+online+shop+selling+only+selcted+proven+German+Herbal+Health+Teas';
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();
};
