/* [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','56391',jdecode('UPRISING'),jdecode(''), jdecode('%2F56391.html'), 'true',[],'',''],
	['PAGE','56991',jdecode('BUTTER-Portfolio'),jdecode(''), jdecode('%2F56991.html'), 'true',[],'',''],
	['PAGE','54442',jdecode('BREAD-Commissioned+work+'),jdecode(''), jdecode('%2F54442.html'), 'true',[],'',''],
	['PAGE','68091',jdecode('THE+MOVEMENT-exhibitions'),jdecode(''), jdecode('%2F68091%2Findex.html'), 'true',[ 
		['PAGE','59912',jdecode('%E2%80%9CGae+Lebowa%E2%80%9D++Exhibition+text'),jdecode(''), jdecode('%2F68091%2F59912.html'), 'true',[],'','']
	],'',''],
	['PAGE','59891',jdecode('Biography%2FExhibitions+history++'),jdecode(''), jdecode('%2F59891.html'), 'true',[ 
		['ITEM','68691',jdecode('The+Visual+University'),jdecode(''), jdecode('http%3A%2F%2Fwww.arc.uct.ac.za%2Fpeople%2F%3Flid%3D196'), 'true',[],'','_blank'],
		['ITEM','70491',jdecode('+THE+ARCHIVE'),jdecode(''), jdecode('http%3A%2F%2Fwww.apc.uct.ac.za%2Fgazette%2Fcurrent%2F%3Fid%3D40%26t%3Dint'), 'true',[],'','_blank'],
		['ITEM','70492',jdecode('SILIVA+ZULU+EXHIBITION+REVIEW'),jdecode(''), jdecode('http%3A%2F%2Fwww.archivalplatform.org%2Fblog%2Fentry%2Fsiliva_zulu%2F'), 'true',[],'','_blank']
	],'',''],
	['PAGE','22001',jdecode('Contact'),jdecode(''), jdecode('%2F22001.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='2E2E2E';
theSitetree.keyvisualId='11075';
theSitetree.keyvisualName='kv_11075.jpg';
theSitetree.fontsetId='31958';
theSitetree.graphicsetId='13798';
theSitetree.contentColor='D8D8D5';
theSitetree.contentBGColor='2E2E2E';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hetzner',
  product: 'WSCSYSSSSLY0XKDS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'2E2E2E',
				keyvisualId: 	'11075',
				keyvisualName: 	'kv_11075.jpg',
				fontsetId: 		'31958',
				graphicsetId: 	'13798',
				contentColor: 	'D8D8D5',
				contentBGColor: '2E2E2E',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68091',
internalId:  '',
customField: '20110706-114830'
};
webappMappings['7060']=webappMappings['7060-e48bb56ef89e019e8c16f9ad704852c8']={
webappId:    '7060',
documentId:  '56991',
internalId:  'e48bb56ef89e019e8c16f9ad704852c8',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59891',
internalId:  '',
customField: '20110620-143812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22001',
internalId:  '',
customField: '20100312-104259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56991',
internalId:  '',
customField: '20100326-144950'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54442',
internalId:  '',
customField: '20110706-113923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56391',
internalId:  '',
customField: '20110706-113338'
};
webappMappings['7060']=webappMappings['7060-27aa36868248fba10cb80d623808a30f']={
webappId:    '7060',
documentId:  '68091',
internalId:  '27aa36868248fba10cb80d623808a30f',
customField: 'language:en;country:US;'
};
webappMappings['1003']=webappMappings['1003-ahtz10inxf3t11f7086aec4']={
webappId:    '1003',
documentId:  '32353',
internalId:  'ahtz10inxf3t11f7086aec4',
customField: 'en:US'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32311',
internalId:  '',
customField: '20090213-183037'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32353',
internalId:  '',
customField: '20090213-182948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59912',
internalId:  '',
customField: '20100510-134932'
};
webappMappings['7060']=webappMappings['7060-3a3414acba38efc53dfe1917d8f0bc7f']={
webappId:    '7060',
documentId:  '54442',
internalId:  '3a3414acba38efc53dfe1917d8f0bc7f',
customField: 'language:en;country:US;'
};
var webAppHostname = 'sitebuilder.host-h.net:80';
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10INXF3T';
var companyName   = 'visual+uprising+photography';
var htmlTitle	  = '';
var metaKeywords  = 'george+mahashe+fashion+photography+south+african+images+black+photographer+people+photography+';
var metaContents  = 'the+authentic+image+with+a+South+African+twist';
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();
};

