/* [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','1347',jdecode('Home'),jdecode(''),'/1347.html','true',[],'',''],
	['PAGE','1378',jdecode('About+the+Club'),jdecode(''),'/1378.html','true',[],'',''],
	['PAGE','16601',jdecode('Playing+for+South+Hetton'),jdecode(''),'/16601.html','true',[],'',''],
	['PAGE','14001',jdecode('Player+Profiles'),jdecode(''),'/14001.html','true',[],'',''],
	['PAGE','33001',jdecode('Performance+Club'),jdecode(''),'/33001.html','true',[],'',''],
	['PAGE','16301',jdecode('Committee'),jdecode(''),'/16301.html','true',[],'',''],
	['PAGE','18001',jdecode('Selections'),jdecode(''),'/18001.html','true',[],'',''],
	['PAGE','1901',jdecode('Fixtures+2010'),jdecode(''),'/1901.html','true',[],'',''],
	['PAGE','14027',jdecode('Results+2010'),jdecode(''),'/14027.html','true',[],'',''],
	['PAGE','25501',jdecode('League+Tables+2009'),jdecode(''),'/25501.html','true',[],'',''],
	['PAGE','34601',jdecode('League+Tables+2010'),jdecode(''),'/34601.html','true',[],'',''],
	['PAGE','33801',jdecode('Third+Team'),jdecode(''),'/33801.html','true',[],'',''],
	['PAGE','1399',jdecode('Cricket+Development'),jdecode(''),'/1399.html','true',[],'',''],
	['PAGE','15101',jdecode('Merchandise'),jdecode(''),'/15101.html','true',[],'',''],
	['PAGE','21801',jdecode('Junior+Cricket'),jdecode(''),'/21801.html','true',[],'',''],
	['PAGE','1922',jdecode('Social+Events'),jdecode(''),'/1922.html','true',[],'',''],
	['PAGE','15601',jdecode('Sponsorship+Package'),jdecode(''),'/15601.html','true',[],'',''],
	['PAGE','14053',jdecode('Sponsors'),jdecode(''),'/14053.html','true',[],'',''],
	['PAGE','1452',jdecode('Contact+Us'),jdecode(''),'/1452.html','true',[],'',''],
	['PAGE','20901',jdecode('Greatest+Cricketer+Ever%3F'),jdecode(''),'/20901.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Sportfan1';
theSitetree.paletteFamily='CBCBC4';
theSitetree.keyvisualId='10069';
theSitetree.keyvisualName='kv_10069.jpg';
theSitetree.fontsetId='21079';
theSitetree.graphicsetId='13172';
theSitetree.contentColor='4C4C4C';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Sportfan1',
				paletteFamily: 	'CBCBC4',
				keyvisualId: 	'10069',
				keyvisualName: 	'kv_10069.jpg',
				fontsetId: 		'21079',
				graphicsetId: 	'13172',
				contentColor: 	'4C4C4C',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-dd4460bcd3723c367c27e92936c88da8']={
webappId:    '7060',
documentId:  '1399',
internalId:  'dd4460bcd3723c367c27e92936c88da8',
customField: 'language:en;country:GB;'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1347',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14001',
internalId:  '',
customField: '20100704-115624'
};
webappMappings['7008']=webappMappings['7008-195']={
webappId:    '7008',
documentId:  '1452',
internalId:  '195',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1347',
internalId:  '',
customField: '20100225-160313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1378',
internalId:  '',
customField: '20100225-160515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1399',
internalId:  '',
customField: '20090206-224540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20100227-162348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1922',
internalId:  '',
customField: '20100516-152115'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1452',
internalId:  '',
customField: '20100309-123353'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14027',
internalId:  '',
customField: '20100727-174440'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14053',
internalId:  '',
customField: '20100120-130521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15101',
internalId:  '',
customField: '20100502-122059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15601',
internalId:  '',
customField: '20090206-221018'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16301',
internalId:  '',
customField: '20090324-212132'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16601',
internalId:  '',
customField: '20100613-123741'
};
webappMappings['1501']=webappMappings['1501-5108929']={
webappId:    '1501',
documentId:  '1347',
internalId:  '5108929',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18001',
internalId:  '',
customField: '20100727-174635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25501',
internalId:  '',
customField: '20100516-151732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21801',
internalId:  '',
customField: '20090309-165954'
};
webappMappings['7005']=webappMappings['7005-119']={
webappId:    '7005',
documentId:  '20901',
internalId:  '119',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20901',
internalId:  '',
customField: '20090210-221202'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33001',
internalId:  '',
customField: '20100822-114631'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33801',
internalId:  '',
customField: '20100513-125222'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34601',
internalId:  '',
customField: '20100727-174150'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN28HO';
var companyName   = 'SOUTH+HETTON+CRICKET+CLUB';
var htmlTitle	  = 'South+Hetton+Cricket+Club';
var metaKeywords  = 'south%2Chetton%2Ccricket%2Cclub%2Cdurham%2Csenior%2Cleague+';
var metaContents  = 'Welcome+to+South+Hetton+Cricket+Club%2C+members+of+the+Warmseal+Durham+Senior+League.';
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();
};

