/* [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','2001',jdecode('Home'),jdecode(''),'/2001/index.html','true',[ 
		['PAGE','33267',jdecode('News'),jdecode(''),'/2001/33267.html','true',[],'',''],
		['PAGE','30167',jdecode('Special+Offers'),jdecode(''),'/2001/30167.html','true',[],'',''],
		['PAGE','44667',jdecode('BM+Members'),jdecode(''),'/2001/44667.html','true',[],'',''],
		['PAGE','44567',jdecode('BM+Members+Photographs'),jdecode(''),'/2001/44567.html','true',[],'',''],
		['PAGE','44693',jdecode('Guest+Book'),jdecode(''),'/2001/44693.html','true',[],'','']
	],'',''],
	['PAGE','47609',jdecode('Renovations'),jdecode(''),'/47609.html','true',[],'',''],
	['PAGE','7641',jdecode('About+us'),jdecode(''),'/7641/index.html','true',[ 
		['PAGE','46609',jdecode('Our+team'),jdecode(''),'/7641/46609.html','true',[],'',''],
		['PAGE','46661',jdecode('How+to+find+us'),jdecode(''),'/7641/46661.html','true',[],'','']
	],'',''],
	['PAGE','46687',jdecode('Products'),jdecode(''),'/46687/index.html','true',[ 
		['PAGE','41567',jdecode('Custom+Rods'),jdecode(''),'/46687/41567.html','true',[],'',''],
		['PAGE','21441',jdecode('Europsec+Rods'),jdecode(''),'/46687/21441.html','true',[],'',''],
		['PAGE','22641',jdecode('Harrison+Rods'),jdecode(''),'/46687/22641.html','true',[],'',''],
		['PAGE','22667',jdecode('Century+Rods'),jdecode(''),'/46687/22667.html','true',[],'',''],
		['PAGE','46713',jdecode('Delkim+Bite+Indicators'),jdecode(''),'/46687/46713.html','true',[],'',''],
		['PAGE','20141',jdecode('Shop+Page'),jdecode(''),'/46687/20141.html','true',[],'',''],
		['PAGE','46739',jdecode('How+to+order'),jdecode(''),'/46687/46739.html','true',[],'','']
	],'',''],
	['PAGE','7693',jdecode('Contact'),jdecode(''),'/7693.html','true',[],'','']];
var siteelementCount=19;
theSitetree.topTemplateName='Lunch';
theSitetree.paletteFamily='77432E';
theSitetree.keyvisualId='3847';
theSitetree.keyvisualName='kv_3847.jpg';
theSitetree.fontsetId='10491';
theSitetree.graphicsetId='11066';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='91543C';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Lunch',
				paletteFamily: 	'77432E',
				keyvisualId: 	'3847',
				keyvisualName: 	'kv_3847.jpg',
				fontsetId: 		'10491',
				graphicsetId: 	'11066',
				contentColor: 	'FFFFFF',
				contentBGColor: '91543C',
				a_color: 		'77432E',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D2A390',
				e_color: 		'D2A390',
				f_color: 		'D2A390',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100628-151308'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-6283296']={
webappId:    '1501',
documentId:  '2001',
internalId:  '6283296',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7641',
internalId:  '',
customField: '20100329-140808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20141',
internalId:  '',
customField: '20100329-125047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7693',
internalId:  '',
customField: '20080920-141552'
};
webappMappings['7008']=webappMappings['7008-1739']={
webappId:    '7008',
documentId:  '7693',
internalId:  '1739',
customField: 'language:en;country:GB;'
};
webappMappings['4001']=webappMappings['4001-6368760']={
webappId:    '4001',
documentId:  '20141',
internalId:  '6368760',
customField: 'language:en;country:GB;'
};
webappMappings['1002']=webappMappings['1002-44693anbt20in23vi']={
webappId:    '1002',
documentId:  '44693',
internalId:  '44693anbt20in23vi',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41567',
internalId:  '',
customField: '20090213-165527'
};
webappMappings['7060']=webappMappings['7060-96d415371f223d5f0600241a04e2c835']={
webappId:    '7060',
documentId:  '44567',
internalId:  '96d415371f223d5f0600241a04e2c835',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-3537']={
webappId:    '7008',
documentId:  '41567',
internalId:  '3537',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21441',
internalId:  '',
customField: '20080920-141750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22641',
internalId:  '',
customField: '20080920-142008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22667',
internalId:  '',
customField: '20090112-183718'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46609',
internalId:  '',
customField: '20100628-141831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30167',
internalId:  '',
customField: '20090827-163343'
};
webappMappings['7050']=webappMappings['7050-1001']={
webappId:    '7050',
documentId:  '33267',
internalId:  '1001',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33267',
internalId:  '',
customField: '20090213-165753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44667',
internalId:  '',
customField: '20090213-173214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44567',
internalId:  '',
customField: '20090512-155745'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44693',
internalId:  '',
customField: '20090213-173811'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46687',
internalId:  '',
customField: '20100628-151020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47609',
internalId:  '',
customField: '20090715-143559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46661',
internalId:  '',
customField: '20100329-132122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46713',
internalId:  '',
customField: '20100329-125519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46739',
internalId:  '',
customField: '20100329-130052'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN23VI';
var companyName   = 'Bob+Morris+Custom+Rods';
var htmlTitle	  = 'Bob+Morris+Custom+Rod+Building';
var metaKeywords  = 'Fishing%0AAnglinig%0ARod%0AFishing+Rod%0ATackle%0AFishing+Tackle%0ACustom+Rod%0ACustom+Fishing+Rod%0ABob+Morris%0ARod+Repair%0ARod+Building%0ARod+Renovations%0AFishing+Rod+Repair%0AFishing+Rod+Renovations%0AEurospec%0AArmalite%0ACentury%0AHarrison%0AMedway+Man%0AFreshwater+Informer%0ADelkim%0ACarp+%0ABarbel%0APike%0ACourse%0ASea%0AGame%0A';
var metaContents  = 'Bob+Morris+Tackle%27s+new+up+and+running+website%2C+order+your+fishing+rods+and+other+tackle+here%21%0ACustom+orders+and+Renovations+also+welcome.%0A';
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();
};
