/* [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','118',jdecode('Rebecca+Swift'),jdecode(''),'/118.html','true',[],'',''],
	['PAGE','124',jdecode('Work'),jdecode(''),'/124.html','true',[],'',''],
	['PAGE','129',jdecode('Contact'),jdecode(''),'/129/index.html','true',[ 
		['PAGE','4919',jdecode('Contact+%28follow+up+page%29'),jdecode(''),'/129/4919.html','false',[],'','']
	],'','']];
var siteelementCount=4;
theSitetree.topTemplateName='Reflectance';
theSitetree.paletteFamily='E6E07B';
theSitetree.keyvisualId='3602';
theSitetree.keyvisualName='kv_3602.jpg';
theSitetree.fontsetId='10739';
theSitetree.graphicsetId='10857';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Reflectance',
				paletteFamily: 	'E6E07B',
				keyvisualId: 	'3602',
				keyvisualName: 	'kv_3602.jpg',
				fontsetId: 		'10739',
				graphicsetId: 	'10857',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E6E07B',
				e_color: 		'797641',
				f_color: 		'A09D9D',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '124',
internalId:  '',
customField: '20100222-052014'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '118',
internalId:  '',
customField: '20100222-045653'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '118',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-3079']={
webappId:    '7008',
documentId:  '129',
internalId:  '3079',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '129',
internalId:  '',
customField: '20100203-070136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4919',
internalId:  '',
customField: '20050806-050538'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN010IN2K05';
var companyName   = 'Rebecca+Swift';
var htmlTitle	  = 'Rebecca+Swift';
var metaKeywords  = 'rebecca%2C+swift%2C+london%2C+entelechy%2C+arts%2C+ambient%2C+jam%2C+Creative%2C+director%2C+interdisciplinary%2C+artist%2C+movement%2C+visual%2C+theatre%2C+practitioner%2C+Human%2C+rights%2C+animateur%2C++local%2C+social%2C++community%2C+Associate%2C+Director%2C+Combined%2C+Arts%2C+Movement%2C+dance%2C++Middlesex%2C+University%2CDartington%2C+College%2C+of%2C+Arts%2C+York%2C+College%2C+of%2C+Art%2C+and%2C+Technology%2C+Fulbright%2C+Scholar%2C+Scholarship%2C+alumnus%2C+alumni%2C+program%2C+programme%2C+alumna%2C';
var metaContents  = 'Rebecca+Swift+-+Creative+director%2C+interdisciplinary+artist+and+movement%2Fvisual+theatre+practitioner.+Human+rights+animateur+working+in+local%2C+social+and+community+settings+with+adults%2C+children%2C+families+and+intergenerationally.+Associate+Director+of+Entelechy+Arts+%28previously+Combined+Arts+Director%3B+Movement+Director%29.+M.A.+Middlesex+University%3B+B.A.+%28Hons.%29+Dartington+College+of+Arts%3B+Dip.+York+College+of+Art+and+Technology.+Fulbright+Scholar.';
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();
};

