/* [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','6401',jdecode('Home'),jdecode(''),'/6401.html','true',[],'',''],
	['PAGE','6901',jdecode('Contacts'),jdecode(''),'/6901.html','true',[],'',''],
	['PAGE','28201',jdecode('SW+Shop'),jdecode(''),'/28201.html','true',[],'',''],
	['PAGE','6927',jdecode('Member+Clubs'),jdecode(''),'/6927.html','true',[],'',''],
	['PAGE','8301',jdecode('Fixtures'),jdecode(''),'/8301/index.html','true',[ 
		['PAGE','8701',jdecode('Senior'),jdecode(''),'/8301/8701.html','true',[],'',''],
		['PAGE','8727',jdecode('U19'),jdecode(''),'/8301/8727.html','true',[],'',''],
		['PAGE','8753',jdecode('U17'),jdecode(''),'/8301/8753.html','true',[],'','']
	],'',''],
	['PAGE','18901',jdecode('Midweek+Rugby'),jdecode(''),'/18901.html','true',[],'',''],
	['PAGE','8779',jdecode('Club+Events'),jdecode(''),'/8779.html','true',[],'',''],
	['PAGE','13901',jdecode('Ladies+Rugby'),jdecode(''),'/13901.html','true',[],'',''],
	['PAGE','21401',jdecode('Merit+Tables'),jdecode(''),'/21401.html','true',[],'',''],
	['PAGE','39101',jdecode('Merit+Table+Principles'),jdecode(''),'/39101.html','true',[],'',''],
	['PAGE','11201',jdecode('Gallery'),jdecode(''),'/11201/index.html','true',[ 
		['PAGE','19101',jdecode('Under+19%26%23x27%3Bs'),jdecode(''),'/11201/19101.html','true',[],'',''],
		['PAGE','19127',jdecode('Under+17%26%23x27%3Bs'),jdecode(''),'/11201/19127.html','true',[],'',''],
		['PAGE','19401',jdecode('Senior'),jdecode(''),'/11201/19401.html','true',[],'',''],
		['PAGE','19427',jdecode('Harold+Stillwell'),jdecode(''),'/11201/19427.html','true',[],'',''],
		['PAGE','20801',jdecode('Double+Tops'),jdecode(''),'/11201/20801.html','true',[],'',''],
		['PAGE','24601',jdecode('Vet%26%23x27%3Bs+Tournament'),jdecode(''),'/11201/24601.html','true',[],'','']
	],'',''],
	['PAGE','28901',jdecode('Vice+Presidents'),jdecode(''),'/28901.html','true',[],'',''],
	['PAGE','7401',jdecode('Useful+Links'),jdecode(''),'/7401.html','true',[],'',''],
	['PAGE','14501',jdecode('History+of+SWRFU'),jdecode(''),'/14501.html','true',[],'',''],
	['PAGE','9401',jdecode('Email+Form'),jdecode(''),'/9401.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Fellow';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10638';
theSitetree.graphicsetId='10695';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Fellow',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10638',
				graphicsetId: 	'10695',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20081007-230644'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6901',
internalId:  '',
customField: '20090902-100733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6927',
internalId:  '',
customField: '20080928-153104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20081111-205759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20081004-002713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20100523-213403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8779',
internalId:  '',
customField: '20100523-220859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8727',
internalId:  '',
customField: '20091211-092720'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8753',
internalId:  '',
customField: '20100214-204406'
};
webappMappings['7008']=webappMappings['7008-2362']={
webappId:    '7008',
documentId:  '9401',
internalId:  '2362',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20080901-212444'
};
webappMappings['7060']=webappMappings['7060-c27019f7ccc332ee8f605d72c0923f69']={
webappId:    '7060',
documentId:  '11201',
internalId:  'c27019f7ccc332ee8f605d72c0923f69',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11201',
internalId:  '',
customField: '20090413-114502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24601',
internalId:  '',
customField: '20081026-204621'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28901',
internalId:  '',
customField: '20081120-173414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13901',
internalId:  '',
customField: '20090819-184052'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14501',
internalId:  '',
customField: '20090709-205510'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18901',
internalId:  '',
customField: '20090410-174343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20091129-215642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19127',
internalId:  '',
customField: '20081006-000359'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19427',
internalId:  '',
customField: '20081026-203642'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19401',
internalId:  '',
customField: '20100523-214815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28201',
internalId:  '',
customField: '20090126-140435'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20801',
internalId:  '',
customField: '20081026-203814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21401',
internalId:  '',
customField: '20100222-214905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39101',
internalId:  '',
customField: '20090809-095809'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INEK8J';
var companyName   = 'South+Warwickshire+RFU';
var htmlTitle	  = 'South+Warwickshire+RFU';
var metaKeywords  = 'South+Warwickshire+Rugby+RFU';
var metaContents  = 'SWRFU+South+Warwickshire+RFU';
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();
};
