/* [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','3001',jdecode('Home'),jdecode(''),'/3001.html','true',[],'',''],
	['PAGE','3052',jdecode('About+Us'),jdecode(''),'/3052.html','true',[],'',''],
	['PAGE','3078',jdecode('History'),jdecode(''),'/3078/index.html','true',[ 
		['PAGE','3104',jdecode('Championship+Winners'),jdecode(''),'/3078/3104.html','true',[],'',''],
		['PAGE','3130',jdecode('International+Championships'),jdecode(''),'/3078/3130.html','true',[],'','']
	],'',''],
	['PAGE','3156',jdecode('Contacts'),jdecode(''),'/3156/index.html','true',[ 
		['PAGE','4501',jdecode('TOWA+Officers'),jdecode(''),'/3156/4501.html','true',[],'',''],
		['PAGE','3182',jdecode('Area+Representatives'),jdecode(''),'/3156/3182.html','true',[],'',''],
		['PAGE','4527',jdecode('TOWA+Officials'),jdecode(''),'/3156/4527.html','true',[],'','']
	],'',''],
	['PAGE','3208',jdecode('How+to+Join'),jdecode(''),'/3208.html','true',[],'',''],
	['PAGE','3234',jdecode('Club+Directory'),jdecode(''),'/3234.html','true',[],'',''],
	['PAGE','7001',jdecode('Getting+Started'),jdecode(''),'/7001.html','true',[],'',''],
	['PAGE','3260',jdecode('News'),jdecode(''),'/3260.html','true',[],'',''],
	['PAGE','7301',jdecode('National+League+2010'),jdecode(''),'/7301.html','true',[],'',''],
	['PAGE','7327',jdecode('National+Championships+'),jdecode(''),'/7327.html','true',[],'',''],
	['PAGE','3286',jdecode('Fixtures'),jdecode(''),'/3286.html','true',[],'',''],
	['PAGE','3312',jdecode('Rules'),jdecode(''),'/3312.html','true',[],'',''],
	['PAGE','3338',jdecode('Schools+Tug+of+War'),jdecode(''),'/3338.html','true',[],'',''],
	['PAGE','4553',jdecode('Press+%26+Media'),jdecode(''),'/4553/index.html','true',[ 
		['PAGE','6301',jdecode('Images+%26+Video'),jdecode(''),'/4553/6301.html','true',[],'','']
	],'',''],
	['PAGE','3364',jdecode('Links'),jdecode(''),'/3364.html','true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='D72B2B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10893';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Alpha',
				paletteFamily: 	'D72B2B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				graphicsetId: 	'10893',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D72B2B',
				e_color: 		'D72B2B',
				f_color: 		'D72B2B',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3001',
internalId:  '',
customField: '20100309-145200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3052',
internalId:  '',
customField: '20100204-090920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3078',
internalId:  '',
customField: '20100210-132005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3104',
internalId:  '',
customField: '20100408-140155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3130',
internalId:  '',
customField: '20100413-135315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3156',
internalId:  '',
customField: '20100201-174231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3182',
internalId:  '',
customField: '20100505-132513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3208',
internalId:  '',
customField: '20100201-172836'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3234',
internalId:  '',
customField: '20100330-134257'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3260',
internalId:  '',
customField: '20100726-132018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3286',
internalId:  '',
customField: '20100427-091929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3312',
internalId:  '',
customField: '20100202-094536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3338',
internalId:  '',
customField: '20100318-140050'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3364',
internalId:  '',
customField: '20100727-134913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20100222-135837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4527',
internalId:  '',
customField: '20100505-132631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4553',
internalId:  '',
customField: '20100204-090243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20100210-085547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7001',
internalId:  '',
customField: '20100217-164430'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20100525-091220'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7327',
internalId:  '',
customField: '20100514-140352'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '7327',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3NDF';
var companyName   = 'THE+TUG+OF+WAR+ASSOCIATION';
var htmlTitle	  = 'THE+TUG+OF+WAR+ASSOCIATION';
var metaKeywords  = 'Tug+of+war%2C+Tug+of+War+Association%2C+Tug+of+War+Federation%2C+Tug+of+War+Rope';
var metaContents  = 'The+Tug+of+War+Association.+The+governing+body+for+tug+of+war+in+England.';
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();
};
