/* [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','1674',jdecode('Home'),jdecode(''),'/1674.html','true',[],'',''],
	['PAGE','1695',jdecode('My+Memoirs'),jdecode(''),'/1695.html','true',[],'',''],
	['PAGE','6401',jdecode('Document+Archive'),jdecode(''),'/6401.html','true',[],'',''],
	['PAGE','1716',jdecode('My+Photos'),jdecode(''),'/1716.html','true',[],'',''],
	['PAGE','10201',jdecode('POW+Research'),jdecode(''),'/10201.html','true',[],'',''],
	['PAGE','1737',jdecode('Cliff%26%23x27%3Bs+Blog'),jdecode(''),'/1737.html','true',[],'',''],
	['PAGE','1748',jdecode('Guestbook'),jdecode(''),'/1748.html','true',[],'',''],
	['PAGE','1769',jdecode('Contact'),jdecode(''),'/1769.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Verve';
theSitetree.paletteFamily='78D949';
theSitetree.keyvisualId='8400';
theSitetree.keyvisualName='kv_8400.jpg';
theSitetree.fontsetId='17071';
theSitetree.graphicsetId='12441';
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: 			'Verve',
				paletteFamily: 	'78D949',
				keyvisualId: 	'8400',
				keyvisualName: 	'kv_8400.jpg',
				fontsetId: 		'17071',
				graphicsetId: 	'12441',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7060']=webappMappings['7060-a6be4435dc26a06604e14c29e369ee5a']={
webappId:    '7060',
documentId:  '1716',
internalId:  'a6be4435dc26a06604e14c29e369ee5a',
customField: 'language:en;country:GB;'
};
webappMappings['7050']=webappMappings['7050-1590']={
webappId:    '7050',
documentId:  '1737',
internalId:  '1590',
customField: 'language:en;country:GB;'
};
webappMappings['7002']=webappMappings['7002-1408']={
webappId:    '7002',
documentId:  '1748',
internalId:  '1408',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-3406']={
webappId:    '7008',
documentId:  '1769',
internalId:  '3406',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1674',
internalId:  '',
customField: '20100807-130954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1695',
internalId:  '',
customField: '20090226-180641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1716',
internalId:  '',
customField: '20100807-131707'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1737',
internalId:  '',
customField: '20081222-083206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1748',
internalId:  '',
customField: '20081222-083206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1769',
internalId:  '',
customField: '20081222-083206'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1674',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20090614-125645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20100405-084740'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE7HE';
var companyName   = 'CLIFF+REDDISH';
var htmlTitle	  = 'CLIFF+REDDISH+JAPANESE+Prisoner+Of+War';
var metaKeywords  = 'World+War+II%2C+Second+World+War%2C+Cliff+Reddish%2C+Japanese+Prisoner+of+War%2C+Royal+Corps+of+Signals%2C+pow%2C+family+history%2C+JAPAN%2C+FAR+EAST%2C+ARMY%2C+MALAYA%2C+Cliff%27s+Blog%2C+';
var metaContents  = 'The+War+Memoirs+of+Clifford+Reddish+former+Japanese+Prisoner+of+War+during+the+Second+World+War+plus+information+on+researching+pow+family+history';
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();
};

