/* [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','2801',jdecode('Home'),jdecode(''),'/2801.html','true',[],'',''],
	['PAGE','2878',jdecode('About+Us'),jdecode(''),'/2878/index.html','true',[ 
		['PAGE','2904',jdecode('History'),jdecode(''),'/2878/2904.html','true',[],'',''],
		['PAGE','15601',jdecode('Gauge+One+Section'),jdecode(''),'/2878/15601.html','true',[],'',''],
		['PAGE','2930',jdecode('Officials'),jdecode(''),'/2878/2930.html','true',[],'',''],
		['PAGE','2956',jdecode('Society+Rules'),jdecode(''),'/2878/2956.html','true',[],'',''],
		['PAGE','2982',jdecode('Becoming+a+Member'),jdecode(''),'/2878/2982.html','true',[],'',''],
		['PAGE','3008',jdecode('Location'),jdecode(''),'/2878/3008.html','true',[],'','']
	],'',''],
	['PAGE','22813',jdecode('Archive+pre+2009'),jdecode(''),'/22813.html','true',[],'',''],
	['PAGE','3112',jdecode('Archive+from+2009'),jdecode(''),'/3112.html','true',[],'',''],
	['PAGE','3164',jdecode('Blog'),jdecode(''),'/3164.html','true',[],'',''],
	['PAGE','3034',jdecode('Society+newsletter'),jdecode(''),'/3034.html','true',[],'',''],
	['PAGE','14601',jdecode('Birthday+Parties'),jdecode(''),'/14601.html','true',[],'',''],
	['PAGE','35355',jdecode('Members+Page'),jdecode(''),'/35355.html','true',[],'',''],
	['PAGE','3060',jdecode('News'),jdecode(''),'/3060.html','true',[],'',''],
	['PAGE','34855',jdecode('Diary'),jdecode(''),'/34855/index.html','true',[ 
		['PAGE','3086',jdecode('Events'),jdecode(''),'/34855/3086.html','true',[],'',''],
		['PAGE','3138',jdecode('Gauge+One+Events'),jdecode(''),'/34855/3138.html','true',[],'','']
	],'',''],
	['PAGE','52481',jdecode('Album'),jdecode(''),'/52481.html','true',[],'',''],
	['PAGE','20101',jdecode('Videos'),jdecode(''),'/20101.html','true',[],'',''],
	['PAGE','3216',jdecode('Contact'),jdecode(''),'/3216/index.html','true',[ 
		['PAGE','3242',jdecode('Guestbook'),jdecode(''),'/3216/3242.html','true',[],'',''],
		['PAGE','3268',jdecode('Email+Form'),jdecode(''),'/3216/3268.html','true',[],'','']
	],'',''],
	['PAGE','3294',jdecode('Interesting+links'),jdecode(''),'/3294.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Stone';
theSitetree.paletteFamily='368254';
theSitetree.keyvisualId='4396';
theSitetree.keyvisualName='kv_4396.jpg';
theSitetree.fontsetId='10806';
theSitetree.graphicsetId='11240';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='9C9B9B';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stone',
				paletteFamily: 	'368254',
				keyvisualId: 	'4396',
				keyvisualName: 	'kv_4396.jpg',
				fontsetId: 		'10806',
				graphicsetId: 	'11240',
				contentColor: 	'000000',
				contentBGColor: '9C9B9B',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '3008',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['7050']=webappMappings['7050-318']={
webappId:    '7050',
documentId:  '3164',
internalId:  '318',
customField: 'language:en;country:GB;'
};
webappMappings['1002']=webappMappings['1002-3242anbt20in2tab']={
webappId:    '1002',
documentId:  '3242',
internalId:  '3242anbt20in2tab',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-736']={
webappId:    '7008',
documentId:  '3268',
internalId:  '736',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20100323-144115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2878',
internalId:  '',
customField: '20080422-101556'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2904',
internalId:  '',
customField: '20091129-104804'
};
webappMappings['7060']=webappMappings['7060-0eb8afdcb1680938e94bb785f133b198']={
webappId:    '7060',
documentId:  '52481',
internalId:  '0eb8afdcb1680938e94bb785f133b198',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3216',
internalId:  '',
customField: '20080524-113557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3060',
internalId:  '',
customField: '20100429-150515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3164',
internalId:  '',
customField: '20080412-114225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3294',
internalId:  '',
customField: '20081128-133709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52481',
internalId:  '',
customField: '20081109-083705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2930',
internalId:  '',
customField: '20080411-112438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2956',
internalId:  '',
customField: '20080411-113446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2982',
internalId:  '',
customField: '20080421-145100'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3008',
internalId:  '',
customField: '20080421-145215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3034',
internalId:  '',
customField: '20100327-065003'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14601',
internalId:  '',
customField: '20090514-131721'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3086',
internalId:  '',
customField: '20100428-122131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3112',
internalId:  '',
customField: '20100326-113054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3138',
internalId:  '',
customField: '20100326-115201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20081109-083955'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3242',
internalId:  '',
customField: '20080412-115435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3268',
internalId:  '',
customField: '20080412-115329'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2801',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-5477068']={
webappId:    '1501',
documentId:  '2801',
internalId:  '5477068',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20101',
internalId:  '',
customField: '20090917-113026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22813',
internalId:  '',
customField: '20100323-152041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34855',
internalId:  '',
customField: '20080519-111750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35355',
internalId:  '',
customField: '20080714-181442'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2TAB';
var companyName   = 'Rotherham+%26+District+Model+Engineers+Society';
var htmlTitle	  = 'Official+Website+of+Rotherham+and+District+Model+Engineers+Society';
var metaKeywords  = 'RDMES%2CRotherham%2CModels%2CEngineers%2CModel+Engineers%2CRawmarsh%2CRosehill+Park%2CVictoria+Park%2C+Rotherham+and+District+Model+Engineers+Society%2C7.25+gauge%2C5+gauge%2C3.5+gauge%2Cportable+track%2CElsecar+Heritage+Centre%2Cworkshops%2Craised+track%2Cground+level+track%2Cgauge+one%2Cgauge+1';
var metaContents  = 'Official+Website+of+Rotherham+and+District+Model+Engineers+Society';
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();
};
