/* [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','1727',jdecode('Home+page'),jdecode(''),'/1727.html','true',[],'',''],
	['PAGE','13001',jdecode('Customer+Query'),jdecode(''),'/13001.html','true',[],'',''],
	['PAGE','2901',jdecode('Small+Business+Accounts'),jdecode(''),'/2901.html','true',[],'',''],
	['PAGE','3301',jdecode('PRINCE2'),jdecode(''),'/3301.html','true',[],'',''],
	['PAGE','3801',jdecode('QMS'),jdecode(''),'/3801.html','true',[],'',''],
	['PAGE','4301',jdecode('Requirements+Template'),jdecode(''),'/4301.html','true',[],'',''],
	['PAGE','4901',jdecode('Be+Happy'),jdecode(''),'/4901.html','true',[],'',''],
	['PAGE','8301',jdecode('Small+Biz+Accs+Course+'),jdecode(''),'/8301.html','true',[],'',''],
	['PAGE','9201',jdecode('References'),jdecode(''),'/9201.html','true',[],'',''],
	['PAGE','14001',jdecode('Social+Media+Tracking'),jdecode(''),'/14001.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Stars';
theSitetree.paletteFamily='3C5284';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10466';
theSitetree.graphicsetId='10913';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3C5284';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stars',
				paletteFamily: 	'3C5284',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10466',
				graphicsetId: 	'10913',
				contentColor: 	'FFFFFF',
				contentBGColor: '3C5284',
				a_color: 		'3C5284',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1727',
internalId:  '',
customField: '20091103-114349'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1727',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20100214-184611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14001',
internalId:  '',
customField: '20100317-155902'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3301',
internalId:  '',
customField: '20100214-185517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20100214-185843'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4301',
internalId:  '',
customField: '20100214-190122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20100214-190402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20091112-173730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20090823-142448'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13001',
internalId:  '',
customField: '20091112-175444'
};
webappMappings['7008']=webappMappings['7008-6053']={
webappId:    '7008',
documentId:  '13001',
internalId:  '6053',
customField: 'language:en;country:GB;'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20INE9HH';
var companyName   = 'Trog+Associates+Ltd';
var htmlTitle	  = '';
var metaKeywords  = 'META+name%3Dkeywords+content%3Dsmall+business+accounts%2Caccounting+small+business%2Cstarting+small+business%2Caccounts%2Caccount%2Caccounting%2Cprince2%2Cprince2+courses%2Cprince2+projectmanagement%2Cmanaging+successful+projects+with+prince2%2Crequirements+management%2Crequirements+engineering%2Csoftware+requirements%2Crequirements+template%2Cbook+publishing+uk%2Ceducational+book+publishers%2Cuk+book+publisher%2Cnon+fiction+book+publisher%2Cbritish+book+publishers%2Cbook+publishers+of+family+history%2Cprivate+book+publishing%2Cindependent+book+publishing+uk%2Ctechnical+authoring+services%2Ctechnical+authors+uk%2Ctechnical+authoring+company%2Ctechnical+author+service%2Cbritish+technical+writers%2Ctechnical+book+publishers%2Ccorporate+publishers%2Ctechnical+report+writing%2Ctechnical+documentation+writers%2Cpublish+business+book%2Ctechnical+writing+company%2Ctechnical+writing+services%2Ctechnical+publishers%2Cbusiness+documentation%2Cscript+publishers%2Ctechnical+editors%2C+www.trogassociatesltd.biz';
var metaContents  = 'meta+name%3Dverify-v1+content%3D%2F9FvYhfLWVDqvOXhVgJWfODEpgW0QHKU%2Fo3Y%2FxDUDHeY%3D+%2FAuthoring+and+Publishing+Services+covering+self-help+business%2C+technical%2C+fiction+and+non-fiction+books%2C+ebooks%2C+articles+and+abstracts.+Also+Ghost+Writing+books%2C+ebooks+and+Workbooks+for+others.+20%25+of+each+book+is+viewable+on+GoogleBooks+and+maybe+bought+on+Lulu.com.script+src%3Dhttp%3A%2F%2Fhosting.conduit.com%2F%2FBanners%2FMini%3Fctid%3DCT1808003%2Fscriptmeta+name%3Dverify-v1+content%3D9FvYhfLWVDqvOXhVgJWfODEpgW0QHKU%2Fo3Y%2FxDUDHeY%3D+%2F';
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();
};
