/* [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','118712',jdecode('Latest+News'),jdecode(''),'/118712/index.html','true',[ 
		['PAGE','1001',jdecode('News+Archive+'),jdecode(''),'/118712/1001.html','true',[],'','']
	],'',''],
	['PAGE','84712',jdecode('+Race+Blog'),jdecode(''),'/84712.html','true',[],'',''],
	['PAGE','47812',jdecode('About+Andy+Milner'),jdecode(''),'/47812.html','true',[],'',''],
	['PAGE','1052',jdecode('The+Route'),jdecode(''),'/1052/index.html','true',[ 
		['PAGE','1073',jdecode('Leg+1+Hull+to+Rio+de+Janeiro'),jdecode(''),'/1052/1073.html','true',[],'',''],
		['PAGE','1094',jdecode('Leg+2+Rio+de+Janeiro+to+Cape+Town'),jdecode(''),'/1052/1094.html','true',[],'',''],
		['PAGE','1115',jdecode('Leg+3+Cape+Town+To+W+Australia'),jdecode(''),'/1052/1115.html','true',[],'',''],
		['PAGE','1136',jdecode('Leg+4+W+Australia+to+Qingdao'),jdecode(''),'/1052/1136.html','true',[],'',''],
		['PAGE','1157',jdecode('Leg+5+Qingdao+to+California'),jdecode(''),'/1052/1157.html','true',[],'',''],
		['PAGE','1178',jdecode('Leg+6+California+to+Jamaica'),jdecode(''),'/1052/1178.html','true',[],'',''],
		['PAGE','1199',jdecode('Leg+7+Jamaica+to+Hull'),jdecode(''),'/1052/1199.html','true',[],'','']
	],'',''],
	['PAGE','157023',jdecode('The+Fleet'),jdecode(''),'/157023.html','true',[],'',''],
	['PAGE','80712',jdecode('+Schools+Section'),jdecode(''),'/80712/index.html','true',[ 
		['PAGE','81612',jdecode('Ask+Andy'),jdecode(''),'/80712/81612.html','true',[],'',''],
		['PAGE','82412',jdecode('Education+Videos'),jdecode(''),'/80712/82412.html','true',[],'','']
	],'',''],
	['PAGE','133423',jdecode('**Updated**++Published+Articles'),jdecode(''),'/133423.html','true',[],'',''],
	['PAGE','8401',jdecode('Pictures'),jdecode(''),'/8401.html','true',[],'',''],
	['PAGE','1451',jdecode('Diary'),jdecode(''),'/1451.html','true',[],'',''],
	['PAGE','17006',jdecode('Message+Board'),jdecode(''),'/17006/index.html','true',[ 
		['PAGE','17001',jdecode('Read+Guestbook'),jdecode(''),'/17006/17001.html','false',[],'','']
	],'',''],
	['PAGE','1472',jdecode('Corporate+Partnerships'),jdecode(''),'/1472.html','true',[],'',''],
	['PAGE','1493',jdecode('Charitable+Sponsorship'),jdecode(''),'/1493.html','true',[],'',''],
	['PAGE','1514',jdecode('Useful+Links'),jdecode(''),'/1514.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Global';
theSitetree.paletteFamily='333399';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='85';
theSitetree.graphicsetId='105';
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: 			'Global',
				paletteFamily: 	'333399',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'85',
				graphicsetId: 	'105',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'242E8A',
				b_color: 		'FF9900',
				c_color: 		'000000',
				d_color: 		'EAEAEA',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1001',
internalId:  '',
customField: '20090828-124158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '133423',
internalId:  '',
customField: '20100727-185826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1052',
internalId:  '',
customField: '20081210-213901'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1073',
internalId:  '',
customField: '20090715-095004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1094',
internalId:  '',
customField: '20090611-202445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1115',
internalId:  '',
customField: '20090715-095027'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1136',
internalId:  '',
customField: '20090422-165711'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1157',
internalId:  '',
customField: '20090422-165835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1178',
internalId:  '',
customField: '20090705-191217'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1199',
internalId:  '',
customField: '20090715-095101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84712',
internalId:  '',
customField: '20080817-223442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80712',
internalId:  '',
customField: '20100708-070349'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47812',
internalId:  '',
customField: '20080501-201632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '157023',
internalId:  '',
customField: '20091230-071353'
};
webappMappings['1003']=webappMappings['1003-anbt10in2j0h1184d153ae6']={
webappId:    '1003',
documentId:  '81612',
internalId:  'anbt10in2j0h1184d153ae6',
customField: 'en:GB:'
};
webappMappings['1002']=webappMappings['1002-17006anbt10in2j0h']={
webappId:    '1002',
documentId:  '17006',
internalId:  '17006anbt10in2j0h',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17006',
internalId:  '',
customField: '20080825-165020'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1451',
internalId:  '',
customField: '20090805-144243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1472',
internalId:  '',
customField: '20080321-083337'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1493',
internalId:  '',
customField: '20090605-103530'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1514',
internalId:  '',
customField: '20091118-151536'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '118712',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-64b9b81cf988ada59472cae4204f0c65']={
webappId:    '7060',
documentId:  '8401',
internalId:  '64b9b81cf988ada59472cae4204f0c65',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20090126-225454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81612',
internalId:  '',
customField: '20080716-211034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '82412',
internalId:  '',
customField: '20081211-103242'
};
webappMappings['7050']=webappMappings['7050-212']={
webappId:    '7050',
documentId:  '84712',
internalId:  '212',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17001',
internalId:  '',
customField: '20071015-221045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '118712',
internalId:  '',
customField: '20100808-001201'
};
webappMappings['1501']=webappMappings['1501-3430613']={
webappId:    '1501',
documentId:  '118712',
internalId:  '3430613',
customField: '1501'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT10IN2J0H';
var companyName   = 'Meridian360+-+Andy+Milner';
var htmlTitle	  = 'Meridian360';
var metaKeywords  = 'andy%2C+milner%2C+clipper%2C+round%2C+world%2C+meridian%2C+360%2C+yacht%2C+rainbow%2C+09-10%2C+sailing%2C+race%2C+';
var metaContents  = 'Clipper+Round+the+World+Race+09-10';
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();
};
