/* [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','1312',jdecode('Home'),jdecode(''), jdecode('%2F1312.html'), 'true',[],'',''],
	['PAGE','45601',jdecode('Club+News+2012'),jdecode(''), jdecode('%2F45601.html'), 'true',[],'',''],
	['PAGE','35301',jdecode('Fixtures+2011'),jdecode(''), jdecode('%2F35301.html'), 'true',[],'',''],
	['PAGE','46601',jdecode('Champions+2011'),jdecode(''), jdecode('%2F46601.html'), 'true',[],'',''],
	['PAGE','29401',jdecode('Archived+News+'),jdecode(''), jdecode('%2F29401%2Findex.html'), 'true',[ 
		['PAGE','45801',jdecode('Champions'),jdecode(''), jdecode('%2F29401%2F45801.html'), 'true',[],'','']
	],'',''],
	['PAGE','1386',jdecode('Club+History'),jdecode(''), jdecode('%2F1386.html'), 'true',[],'',''],
	['PAGE','1354',jdecode('Bowling+Gallery'),jdecode(''), jdecode('%2F1354.html'), 'true',[],'',''],
	['PAGE','16601',jdecode('150th+Anniversary+Dinner'),jdecode(''), jdecode('%2F16601.html'), 'true',[],'',''],
	['PAGE','14601',jdecode('Club+Sponsors'),jdecode(''), jdecode('%2F14601.html'), 'true',[],'',''],
	['PAGE','7404',jdecode('Guestbook'),jdecode(''), jdecode('%2F7404.html'), 'true',[],'',''],
	['PAGE','1407',jdecode('Office+Bearers+2011'),jdecode(''), jdecode('%2F1407.html'), 'true',[],'',''],
	['PAGE','36101',jdecode('Membership+Application'),jdecode(''), jdecode('%2F36101.html'), 'true',[],'',''],
	['PAGE','7430',jdecode('Contact'),jdecode(''), jdecode('%2F7430.html'), 'true',[],'',''],
	['PAGE','20201',jdecode('Find+Us'),jdecode(''), jdecode('%2F20201.html'), 'true',[],'',''],
	['PAGE','28501',jdecode('Online+Bowling+Game'),jdecode(''), jdecode('%2F28501.html'), 'true',[],'',''],
	['PAGE','25301',jdecode('League+Reports+2010'),jdecode(''), jdecode('%2F25301.html'), 'false',[],'',''],
	['PAGE','1333',jdecode('Club+News+2009'),jdecode(''), jdecode('%2F1333.html'), 'false',[],'',''],
	['PAGE','19101',jdecode('Club+News+2010'),jdecode(''), jdecode('%2F19101.html'), 'false',[],'',''],
	['PAGE','25327',jdecode('Club+Competitions+2010'),jdecode(''), jdecode('%2F25327.html'), 'false',[],'',''],
	['PAGE','30301',jdecode('Club+News+2011'),jdecode(''), jdecode('%2F30301.html'), 'false',[],'',''],
	['PAGE','16301',jdecode('Club+Champions+2010'),jdecode(''), jdecode('%2F16301.html'), 'false',[],'',''],
	['PAGE','40601',jdecode('League+reports+2011'),jdecode(''), jdecode('%2F40601.html'), 'false',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Sportfan2';
theSitetree.paletteFamily='D8D5FD';
theSitetree.keyvisualId='10135';
theSitetree.keyvisualName='kv_10135.jpg';
theSitetree.fontsetId='21089';
theSitetree.graphicsetId='13185';
theSitetree.contentColor='291EBB';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var prodDef={
  wl_name: 'easily_co_uk_ce',
  product: 'WSCSYSSSSLY0XKQS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Sportfan2',
				paletteFamily: 	'D8D5FD',
				keyvisualId: 	'10135',
				keyvisualName: 	'kv_10135.jpg',
				fontsetId: 		'21089',
				graphicsetId: 	'13185',
				contentColor: 	'291EBB',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-8e5277a4bf857abafe6677ab1d18335f']={
webappId:    '7060',
documentId:  '1354',
internalId:  '8e5277a4bf857abafe6677ab1d18335f',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7404',
internalId:  '',
customField: '20090623-231201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40601',
internalId:  '',
customField: '20110811-201858'
};
webappMappings['7002']=webappMappings['7002-2274']={
webappId:    '7002',
documentId:  '7404',
internalId:  '2274',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1312',
internalId:  '',
customField: '20120107-090204'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1333',
internalId:  '',
customField: '20090917-123705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1354',
internalId:  '',
customField: '20090623-231340'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1312',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1386',
internalId:  '',
customField: '20110218-203426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1407',
internalId:  '',
customField: '20110401-172037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7430',
internalId:  '',
customField: '20110411-173118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14601',
internalId:  '',
customField: '20100615-231656'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16301',
internalId:  '',
customField: '20101201-151023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16601',
internalId:  '',
customField: '20090917-133848'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20100615-230538'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '20201',
internalId:  'location',
customField: 'language:en;country:GB;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20201',
internalId:  '',
customField: '20100402-211601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25301',
internalId:  '',
customField: '20101130-164227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25327',
internalId:  '',
customField: '20101201-150709'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28501',
internalId:  '',
customField: '20110218-172541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29401',
internalId:  '',
customField: '20120105-145203'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30301',
internalId:  '',
customField: '20120105-150510'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35301',
internalId:  '',
customField: '20110401-170537'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36101',
internalId:  '',
customField: '20110401-173020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45601',
internalId:  '',
customField: '20120105-144719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45801',
internalId:  '',
customField: '20120105-144532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46601',
internalId:  '',
customField: '20120107-083708'
};
webappMappings['1501']=webappMappings['1501-13494985']={
webappId:    '1501',
documentId:  '1312',
internalId:  '13494985',
customField: '1501'
};
var webAppHostname = 'cgi.easily.co.uk:80';
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN3KGC';
var companyName   = 'Welcome+To+The+Jedburgh+Bowling+Club+Website%21';
var htmlTitle	  = 'The+Jedburgh+Bowling+Club+Website%21';
var metaKeywords  = '';
var metaContents  = '';
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();
};

