/* [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','1347',jdecode('Home'),jdecode(''),'/1347.html','true',[],''],
	['PAGE','12701',jdecode('About+Us'),jdecode(''),'/12701/index.html','true',[ 
		['PAGE','15501',jdecode('Club+Organisation'),jdecode(''),'/12701/15501.html','true',[],''],
		['PAGE','15527',jdecode('Who%26%23x27%3Bs+Who%3F'),jdecode(''),'/12701/15527.html','true',[],''],
		['PAGE','15553',jdecode('Club+Rules'),jdecode(''),'/12701/15553.html','true',[],'']
	],''],
	['PAGE','5083',jdecode('Lessons'),jdecode(''),'/5083/index.html','true',[ 
		['PAGE','5109',jdecode('Lesson+Timetable'),jdecode(''),'/5083/5109.html','true',[],''],
		['PAGE','5135',jdecode('Lesson+Fees'),jdecode(''),'/5083/5135.html','true',[],''],
		['PAGE','5161',jdecode('Groups+and+Objectives'),jdecode(''),'/5083/5161.html','true',[],'']
	],''],
	['PAGE','4979',jdecode('Membership'),jdecode(''),'/4979/index.html','true',[ 
		['PAGE','5005',jdecode('Application+Form'),jdecode(''),'/4979/5005.html','true',[],''],
		['PAGE','5031',jdecode('Fee+Structure'),jdecode(''),'/4979/5031.html','true',[],''],
		['PAGE','5057',jdecode('Members+Duties'),jdecode(''),'/4979/5057.html','true',[],'']
	],''],
	['PAGE','4901',jdecode('Calendars'),jdecode(''),'/4901/index.html','true',[ 
		['PAGE','4927',jdecode('2009-10+Calendar'),jdecode(''),'/4901/4927.html','true',[],''],
		['PAGE','4953',jdecode('Door+Duty+Rota'),jdecode(''),'/4901/4953.html','true',[],'']
	],''],
	['PAGE','5187',jdecode('News+and+Events'),jdecode(''),'/5187/index.html','true',[ 
		['PAGE','21901',jdecode('Newsletters'),jdecode(''),'/5187/21901.html','true',[],''],
		['PAGE','5239',jdecode('2009+Gala+Information'),jdecode(''),'/5187/5239.html','true',[],''],
		['PAGE','5265',jdecode('2009+Gala+Results'),jdecode(''),'/5187/5265.html','true',[],'']
	],''],
	['PAGE','5343',jdecode('Contact+Us'),jdecode(''),'/5343/index.html','true',[ 
		['PAGE','5317',jdecode('Directions'),jdecode(''),'/5343/5317.html','true',[],'']
	],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Sportfan2';
theSitetree.paletteFamily='D4E8AB';
theSitetree.keyvisualId='10105';
theSitetree.keyvisualName='kv_10105.jpg';
theSitetree.fontsetId='21087';
theSitetree.graphicsetId='13184';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				name: 			'Sportfan2',
				paletteFamily: 	'D4E8AB',
				keyvisualId: 	'10105',
				keyvisualName: 	'kv_10105.jpg',
				fontsetId: 		'21087',
				graphicsetId: 	'13184',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4953',
internalId:  '',
customField: '20100115-104633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5005',
internalId:  '',
customField: '20090908-213734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5083',
internalId:  '',
customField: '20090422-213033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1347',
internalId:  '',
customField: '20090920-134409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5031',
internalId:  '',
customField: '20100115-100001'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4927',
internalId:  '',
customField: '20090802-113836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20100115-104114'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4979',
internalId:  '',
customField: '20090920-133045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5057',
internalId:  '',
customField: '20090415-215258'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5109',
internalId:  '',
customField: '20090417-142215'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5135',
internalId:  '',
customField: '20090920-134113'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5161',
internalId:  '',
customField: '20090417-142241'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5187',
internalId:  '',
customField: '20100115-103751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21901',
internalId:  '',
customField: '20090706-231505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5239',
internalId:  '',
customField: '20090417-150017'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5265',
internalId:  '',
customField: '20090627-003217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15501',
internalId:  '',
customField: '20090417-150355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5317',
internalId:  '',
customField: '20090422-212505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5343',
internalId:  '',
customField: '20091218-121556'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '5317',
internalId:  'routing',
customField: 'en_GB'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12701',
internalId:  '',
customField: '20090417-000405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15527',
internalId:  '',
customField: '20090417-150355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15553',
internalId:  '',
customField: '20090417-150355'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEH5E';
var companyName   = '++++Welcome+to+RSC+online%21';
var htmlTitle	  = 'Rushcliffe+Swimming+Club';
var metaKeywords  = 'West+Bridgford%2C+Nottingham%2C+Swimming+Club%2C+Amateur%2C+ASA';
var metaContents  = 'Rushcliffe+Swimming+Club';
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();
};
