/* [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','501',jdecode('Home'),jdecode(''),'/501.html','true',[],'',''],
	['PAGE','552',jdecode('About+our+Club'),jdecode(''),'/552/index.html','true',[ 
		['PAGE','573',jdecode('Our+season'),jdecode(''),'/552/573.html','true',[],'',''],
		['PAGE','594',jdecode('Membership+Sections'),jdecode(''),'/552/594.html','true',[],'',''],
		['PAGE','615',jdecode('Playing+Times'),jdecode(''),'/552/615.html','true',[],'',''],
		['PAGE','636',jdecode('Subscription+Rates'),jdecode(''),'/552/636.html','true',[],'',''],
		['PAGE','678',jdecode('Social+Activities'),jdecode(''),'/552/678.html','true',[],'','']
	],'',''],
	['PAGE','5301',jdecode('What+we+offer+you'),jdecode(''),'/5301/index.html','true',[ 
		['PAGE','10001',jdecode('Membership+package'),jdecode(''),'/5301/10001.html','true',[],'',''],
		['PAGE','10022',jdecode('Playing+facilities'),jdecode(''),'/5301/10022.html','true',[],'','']
	],'',''],
	['PAGE','762',jdecode('Competitive+Tennis'),jdecode(''),'/762.html','true',[],'',''],
	['PAGE','657',jdecode('Tennis+Coaching'),jdecode(''),'/657/index.html','true',[ 
		['PAGE','18601',jdecode('Junior+Group'),jdecode(''),'/657/18601.html','true',[],'',''],
		['PAGE','18622',jdecode('Adult+Group'),jdecode(''),'/657/18622.html','true',[],'',''],
		['PAGE','18643',jdecode('Individual'),jdecode(''),'/657/18643.html','true',[],'',''],
		['PAGE','15601',jdecode('Coaching+enquiry+form'),jdecode(''),'/657/15601.html','true',[],'','']
	],'',''],
	['PAGE','8301',jdecode('How+to+find+us'),jdecode(''),'/8301.html','true',[],'',''],
	['PAGE','741',jdecode('How+to+join'),jdecode(''),'/741.html','true',[],'',''],
	['PAGE','25001',jdecode('News'),jdecode(''),'/25001/index.html','true',[ 
		['PAGE','29001',jdecode('Club+Competitions'),jdecode(''),'/25001/29001.html','true',[],'',''],
		['PAGE','804',jdecode('Our+new+Clubhouse'),jdecode(''),'/25001/804.html','true',[],'',''],
		['PAGE','783',jdecode('Fun+in+the+late+summer'),jdecode(''),'/25001/783.html','true',[],'','']
	],'',''],
	['PAGE','825',jdecode('Contacts'),jdecode(''),'/825.html','true',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Communication';
theSitetree.paletteFamily='669999';
theSitetree.keyvisualId='315';
theSitetree.keyvisualName='tennis.jpg';
theSitetree.fontsetId='33';
theSitetree.graphicsetId='36';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='507979';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Communication',
				paletteFamily: 	'669999',
				keyvisualId: 	'315',
				keyvisualName: 	'tennis.jpg',
				fontsetId: 		'33',
				graphicsetId: 	'36',
				contentColor: 	'FFFFFF',
				contentBGColor: '507979',
				a_color: 		'669999',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'003333',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '501',
internalId:  '',
customField: '20100620-093018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '552',
internalId:  '',
customField: '20080208-153353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '825',
internalId:  '',
customField: '20100415-125434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '573',
internalId:  '',
customField: '20080222-122216'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '594',
internalId:  '',
customField: '20080915-232920'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '636',
internalId:  '',
customField: '20100319-074759'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '657',
internalId:  '',
customField: '20100319-075408'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '615',
internalId:  '',
customField: '20080915-233020'
};
webappMappings['1501']=webappMappings['1501-4741267']={
webappId:    '1501',
documentId:  '501',
internalId:  '4741267',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '678',
internalId:  '',
customField: '20100319-080109'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20080208-162538'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '741',
internalId:  '',
customField: '20080210-105236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '762',
internalId:  '',
customField: '20090119-104359'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '783',
internalId:  '',
customField: '20090910-164255'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '804',
internalId:  '',
customField: '20090623-080131'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '8301',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:false;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20080209-120209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20080222-122909'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10022',
internalId:  '',
customField: '20080506-140840'
};
webappMappings['7008']=webappMappings['7008-919']={
webappId:    '7008',
documentId:  '825',
internalId:  '919',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-920']={
webappId:    '7008',
documentId:  '741',
internalId:  '920',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20080222-174212'
};
webappMappings['7008']=webappMappings['7008-921']={
webappId:    '7008',
documentId:  '15601',
internalId:  '921',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18601',
internalId:  '',
customField: '20091217-081629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18622',
internalId:  '',
customField: '20091217-083209'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18643',
internalId:  '',
customField: '20100415-125536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25001',
internalId:  '',
customField: '20100516-103315'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29001',
internalId:  '',
customField: '20100620-092431'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2OUP';
var companyName   = 'Banstead+Downs+Tennis+Club+-+The+Premier+Tennis+Club+in+Banstead';
var htmlTitle	  = 'Banstead+Downs+Tennis+Club';
var metaKeywords  = 'Tennis+Banstead+Surrey+Coaching+Children+Adults';
var metaContents  = 'Tennis+Club+Banstead+Surrey+offering+coaching%2C+social+tennis+and+competitive+match+tennis.';
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();
};
