/* [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','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('Aims+of+the+club'),jdecode(''),'/452.html','true',[],''],
	['PAGE','10801',jdecode('News+%26+Gossip'),jdecode(''),'/10801.html','true',[],''],
	['PAGE','473',jdecode('Event+Calender'),jdecode(''),'/473.html','true',[],''],
	['PAGE','557',jdecode('Contact+us'),jdecode(''),'/557.html','true',[],''],
	['PAGE','662',jdecode('Membership+Info.'),jdecode(''),'/662/index.html','true',[ 
		['PAGE','13101',jdecode('Apply+here'),jdecode(''),'/662/13101.html','true',[],''],
		['PAGE','15801',jdecode('Club+Rules'),jdecode(''),'/662/15801.html','true',[],''],
		['PAGE','641',jdecode('Rally+Regulations'),jdecode(''),'/662/641.html','true',[],''],
		['PAGE','15822',jdecode('Consitution'),jdecode(''),'/662/15822.html','true',[],''],
		['PAGE','19501',jdecode('CCBN+Offer'),jdecode(''),'/662/19501.html','false',[],'']
	],''],
	['PAGE','15301',jdecode('Codes+of+Conduct'),jdecode(''),'/15301/index.html','true',[ 
		['PAGE','15322',jdecode('Naturist+Code'),jdecode(''),'/15301/15322.html','true',[],''],
		['PAGE','15343',jdecode('Caravan+Code'),jdecode(''),'/15301/15343.html','true',[],''],
		['PAGE','15364',jdecode('Camping+Code'),jdecode(''),'/15301/15364.html','true',[],''],
		['PAGE','15385',jdecode('Country+Code'),jdecode(''),'/15301/15385.html','true',[],''],
		['PAGE','15406',jdecode('Seashore+Code'),jdecode(''),'/15301/15406.html','true',[],'']
	],''],
	['PAGE','578',jdecode('About+us'),jdecode(''),'/578/index.html','true',[ 
		['PAGE','599',jdecode('History'),jdecode(''),'/578/599.html','true',[],''],
		['PAGE','620',jdecode('Club+Structure'),jdecode(''),'/578/620.html','true',[],'']
	],''],
	['PAGE','23501',jdecode('Run+a+site'),jdecode(''),'/23501.html','true',[],''],
	['PAGE','536',jdecode('Interesting+links'),jdecode(''),'/536.html','true',[],''],
	['PAGE','10001',jdecode('Photo+Album'),jdecode(''),'/10001.html','true',[],'']];
var siteelementCount=23;
theSitetree.topTemplateName='Enjoy';
theSitetree.paletteFamily='BB9C60';
theSitetree.keyvisualId='2251';
theSitetree.keyvisualName='reise1.jpg';
theSitetree.fontsetId='366';
theSitetree.graphicsetId='417';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='BB9C60';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Enjoy',
				paletteFamily: 	'BB9C60',
				keyvisualId: 	'2251',
				keyvisualName: 	'reise1.jpg',
				fontsetId: 		'366',
				graphicsetId: 	'417',
				contentColor: 	'000000',
				contentBGColor: 'BB9C60',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'BB9C60',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20100121-085038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20090608-112258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10801',
internalId:  '',
customField: '20091019-091835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20080213-154035'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '536',
internalId:  '',
customField: '20090410-112908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '557',
internalId:  '',
customField: '20100121-091632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '578',
internalId:  '',
customField: '20100121-091258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '662',
internalId:  '',
customField: '20090608-112629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '641',
internalId:  '',
customField: '20080213-153729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15322',
internalId:  '',
customField: '20080213-083134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '473',
internalId:  '',
customField: '20100121-091038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '599',
internalId:  '',
customField: '20090701-204013'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '620',
internalId:  '',
customField: '20090701-203251'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20100121-091810'
};
webappMappings['1501']=webappMappings['1501-4682360']={
webappId:    '1501',
documentId:  '401',
internalId:  '4682360',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-9fca78332324dfa76a73aa31b350a725']={
webappId:    '7060',
documentId:  '10001',
internalId:  '9fca78332324dfa76a73aa31b350a725',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20080203-172634'
};
webappMappings['7008']=webappMappings['7008-289']={
webappId:    '7008',
documentId:  '13101',
internalId:  '289',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15343',
internalId:  '',
customField: '20080213-083342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15364',
internalId:  '',
customField: '20080213-154121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15385',
internalId:  '',
customField: '20080213-082441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15406',
internalId:  '',
customField: '20080213-082816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15801',
internalId:  '',
customField: '20080213-204645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15822',
internalId:  '',
customField: '20090608-114037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19501',
internalId:  '',
customField: '20080216-184553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20100121-091446'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2RDF';
var companyName   = 'Three+Rivers+Outdoor+Club';
var htmlTitle	  = 'Three+Rivers+Outdoor+Club+%28TROC%29';
var metaKeywords  = 'Naturist.+Camping+Caravan+Rally%2C++ACCEO%2C+British+Naturism%2C+BN%2C+Certified+Sites%2C+Caravan+sites%2C+Swimming%2C+Sauna%2C+Hot+tub%2C+5+van+certificated+sites%2C+CLs%2C+SCs';
var metaContents  = 'Three+Rivers+Outdoor+Club+is+a+small+exempted+Caravan+and+Camping+Club+based+in+the+North+East+of+England.+Established+in+1982.+We+have+all+of+the+recreational+caravan+exemptions+%28paragraph+4%2C+5+and+6%29+granted+under+the+Caravan+Sites+and+Control+of+Development+Act+%281960%29+for+England%2C+Scotland+and+WalesWe+also+have+recreational+camping+exemptions+granted+under+the+and+the+Public+Health+Act+%281936%29+for+England%2C+Scotland+and+Wales.';
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();
};
