/* [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','2401',jdecode('Home'),jdecode(''),'/2401.html','true',[],'',''],
	['PAGE','2452',jdecode('Contacts'),jdecode(''),'/2452.html','true',[],'',''],
	['PAGE','20301',jdecode('Coxswains'),jdecode(''),'/20301.html','true',[],'',''],
	['PAGE','4101',jdecode('Rowing+Times'),jdecode(''),'/4101/index.html','true',[ 
		['PAGE','2478',jdecode('Sunday+Row+Times'),jdecode(''),'/4101/2478.html','true',[],'',''],
		['PAGE','11701',jdecode('Thursday+Row+times'),jdecode(''),'/4101/11701.html','true',[],'','']
	],'',''],
	['PAGE','2504',jdecode('Membership'),jdecode(''),'/2504.html','true',[],'',''],
	['PAGE','8001',jdecode('Club+Kit'),jdecode(''),'/8001.html','true',[],'',''],
	['PAGE','2530',jdecode('Notice+Board'),jdecode(''),'/2530.html','true',[],'',''],
	['PAGE','9501',jdecode('Fixtures+2010'),jdecode(''),'/9501.html','true',[],'',''],
	['PAGE','2556',jdecode('Gallery'),jdecode(''),'/2556/index.html','true',[ 
		['PAGE','19901',jdecode('Isles+of+Scilly+2010'),jdecode(''),'/2556/19901.html','true',[],'',''],
		['PAGE','28801',jdecode('London+River+Race'),jdecode(''),'/2556/28801.html','true',[],'',''],
		['PAGE','19301',jdecode('Water+Festival+2010'),jdecode(''),'/2556/19301.html','true',[],'',''],
		['PAGE','30601',jdecode('Caradon+Vets%2Fmixed+Championships+2010'),jdecode(''),'/2556/30601.html','true',[],'',''],
		['PAGE','32201',jdecode('Hayle+U14+Championships'),jdecode(''),'/2556/32201.html','true',[],'',''],
		['PAGE','33401',jdecode('Swanage+2010'),jdecode(''),'/2556/33401.html','true',[],'',''],
		['PAGE','34101',jdecode('Ilfracombe+2010'),jdecode(''),'/2556/34101.html','true',[],'',''],
		['PAGE','34127',jdecode('Lundy+Row'),jdecode(''),'/2556/34127.html','true',[],'',''],
		['PAGE','34153',jdecode('Appledore+2010'),jdecode(''),'/2556/34153.html','true',[],'',''],
		['PAGE','34179',jdecode('Weymouth++2010'),jdecode(''),'/2556/34179.html','true',[],'','']
	],'',''],
	['PAGE','7401',jdecode('TPGC+Forum'),jdecode(''),'/7401.html','true',[],'',''],
	['PAGE','10801',jdecode('Sponsors'),jdecode(''),'/10801.html','true',[],'',''],
	['PAGE','13801',jdecode('Policies'),jdecode(''),'/13801.html','true',[],'',''],
	['PAGE','23501',jdecode('Committee+Members'),jdecode(''),'/23501.html','true',[],'','']];
var siteelementCount=25;
theSitetree.topTemplateName='Capri';
theSitetree.paletteFamily='385CA9';
theSitetree.keyvisualId='7245';
theSitetree.keyvisualName='kv_7245.jpg';
theSitetree.fontsetId='16412';
theSitetree.graphicsetId='12134';
theSitetree.contentColor='17336F';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Capri',
				paletteFamily: 	'385CA9',
				keyvisualId: 	'7245',
				keyvisualName: 	'kv_7245.jpg',
				fontsetId: 		'16412',
				graphicsetId: 	'12134',
				contentColor: 	'17336F',
				contentBGColor: 'FFFFFF',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34179',
internalId:  '',
customField: '20100828-130044'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20100428-094724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2452',
internalId:  '',
customField: '20100820-151646'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2478',
internalId:  '',
customField: '20100814-162433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2504',
internalId:  '',
customField: '20100705-202951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4101',
internalId:  '',
customField: '20100815-135510'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2530',
internalId:  '',
customField: '20100820-151147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2556',
internalId:  '',
customField: '20100816-211452'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34127',
internalId:  '',
customField: '20100828-141334'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2401',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-11463621']={
webappId:    '1501',
documentId:  '2401',
internalId:  '11463621',
customField: '1501'
};
webappMappings['1003']=webappMappings['1003-anbt30in3gqy12806a12528']={
webappId:    '1003',
documentId:  '7401',
internalId:  'anbt30in3gqy12806a12528',
customField: 'en:GB'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7401',
internalId:  '',
customField: '20100416-134420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20100816-212339'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20100820-151411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10801',
internalId:  '',
customField: '20100520-205609'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11701',
internalId:  '',
customField: '20100814-162937'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20100717-103422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19301',
internalId:  '',
customField: '20100813-174316'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19901',
internalId:  '',
customField: '20100819-165320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20301',
internalId:  '',
customField: '20100813-183943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23501',
internalId:  '',
customField: '20100814-162508'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28801',
internalId:  '',
customField: '20100816-222521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20100831-081521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30601',
internalId:  '',
customField: '20100816-225305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34153',
internalId:  '',
customField: '20100828-131325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32201',
internalId:  '',
customField: '20100820-151047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33401',
internalId:  '',
customField: '20100828-133258'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT30IN3GQY';
var companyName   = 'Torridge+Pilot+Gig+Club';
var htmlTitle	  = '';
var metaKeywords  = 'Torridge+pilot+gig+club%2C+gig+rowing%2C+bideford%2C+appledore%2C+pilot+gigs%2C+rowing%2C+Will-to-Win%2C+Kerens';
var metaContents  = 'Torridge+Pilot+Gig+Club%2C+rowing+on+the+Taw+and+Torridge+estuary%2C';
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();
};
