/* [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','1346',jdecode('HOME'),jdecode(''),'/1346.html','true',[],'',''],
	['PAGE','1387',jdecode('ABOUT+ME'),jdecode(''),'/1387.html','true',[],'',''],
	['PAGE','22312',jdecode('CURRICULUM+VITAE'),jdecode(''),'/22312.html','true',[],'',''],
	['PAGE','4301',jdecode('LX+DESIGNER'),jdecode(''),'/4301.html','true',[],'',''],
	['PAGE','6201',jdecode('RECENT+REVIEWS'),jdecode(''),'/6201.html','true',[],'',''],
	['PAGE','4327',jdecode('DRAMA+TUTOR'),jdecode(''),'/4327.html','true',[],'',''],
	['PAGE','4353',jdecode('IMAGES'),jdecode(''),'/4353.html','false',[],'',''],
	['PAGE','4379',jdecode('MY+FRIENDS'),jdecode(''),'/4379.html','true',[],'',''],
	['PAGE','1449',jdecode('EMAIL+ME'),jdecode(''),'/1449.html','true',[],'',''],
	['PAGE','4405',jdecode('CONTACT+ME'),jdecode(''),'/4405.html','true',[],'',''],
	['PAGE','1428',jdecode('GUESTBOOK'),jdecode(''),'/1428.html','false',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Rivet';
theSitetree.paletteFamily='5C512E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='17272';
theSitetree.graphicsetId='12687';
theSitetree.contentColor='D3A62A';
theSitetree.contentBGColor='484132';
var localeDef={
  language: 'en',
  country: 'GB'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Rivet',
				paletteFamily: 	'5C512E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'17272',
				graphicsetId: 	'12687',
				contentColor: 	'D3A62A',
				contentBGColor: '484132',
				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['7002']=webappMappings['7002-453']={
webappId:    '7002',
documentId:  '1428',
internalId:  '453',
customField: 'language:en;country:GB;'
};
webappMappings['7008']=webappMappings['7008-1146']={
webappId:    '7008',
documentId:  '1449',
internalId:  '1146',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1346',
internalId:  '',
customField: '20100816-183231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1387',
internalId:  '',
customField: '20100816-184006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1428',
internalId:  '',
customField: '20080428-084328'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1449',
internalId:  '',
customField: '20091119-231627'
};
webappMappings['7060']=webappMappings['7060-506281c20a92ec5ff8c587d342be45fc']={
webappId:    '7060',
documentId:  '4353',
internalId:  '506281c20a92ec5ff8c587d342be45fc',
customField: 'language:en;country:GB;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4301',
internalId:  '',
customField: '20091119-230325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4327',
internalId:  '',
customField: '20091119-231419'
};
webappMappings['1501']=webappMappings['1501-5749672']={
webappId:    '1501',
documentId:  '1346',
internalId:  '5749672',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1346',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4353',
internalId:  '',
customField: '20090629-115109'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4379',
internalId:  '',
customField: '20100610-181936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20091119-230913'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4405',
internalId:  '',
customField: '20100610-181705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22312',
internalId:  '',
customField: '20100816-183842'
};
var canonHostname = 'coucm4all01.netbenefit.co.uk';
var accountId     = 'ANBT20IN2UQ6';
var companyName   = 'ADAM%C2%A0BURNS+';
var htmlTitle	  = 'STAGE+AND+PRODUCTION+MANAGER';
var metaKeywords  = 'drama.+stage+manager.+production+manager.+lighting+designer.++drama+tutor.+london+Theatre.+childrens+theatre.+Specialist+in+site+specific+theatre.Freelance.Technical+manager.London.';
var metaContents  = 'Adam+Burns%2C+Freelance+Stage+and+Production+Manager%2C+lighting+designer+and+drama+tutor+based+in+East+London';
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();
};
