/* [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(''),'/56391.html','true',[],'',''],
	['PAGE','56991',jdecode('BUTTER-Portfolio'),jdecode(''),'/56991.html','true',[],'',''],
	['PAGE','54442',jdecode('BREAD-Commisioned+work+'),jdecode(''),'/54442.html','true',[],'',''],
	['PAGE','60191',jdecode('THE+MOVEMENT-exhibitions'),jdecode(''),'/60191/index.html','true',[ 
		['PAGE','59491',jdecode('Exhibition+calender'),jdecode(''),'/60191/59491.html','true',[],'',''],
		['PAGE','59891',jdecode('Biography%2Fpast+exhibitions+++'),jdecode(''),'/60191/59891.html','true',[],'',''],
		['PAGE','59912',jdecode('Exhibition+details'),jdecode(''),'/60191/59912.html','true',[],'','']
	],'',''],
	['PAGE','57891',jdecode('OFF+THE+CUFF'),jdecode(''),'/57891/index.html','true',[ 
		['PAGE','54505',jdecode('Diary+of+a+gun'),jdecode(''),'/57891/54505.html','true',[],'',''],
		['ITEM','54526',jdecode('Expression+highway'),jdecode(''),'http://visualuprising.wordpress.com/','true',[],'','_blank']
	],'',''],
	['PAGE','22001',jdecode('Contact'),jdecode(''),'/22001.html','true',[],'','']];
var siteelementCount=11;
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 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:  '57891',
internalId:  '',
customField: '20100326-164159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60191',
internalId:  '',
customField: '20100510-140055'
};
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: '20100510-134530'
};
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: '20100326-164859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59491',
internalId:  '',
customField: '20100510-133148'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56391',
internalId:  '',
customField: '20100510-135105'
};
webappMappings['1501']=webappMappings['1501-4920581']={
webappId:    '1501',
documentId:  '56391',
internalId:  '4920581',
customField: '1501'
};
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['7060']=webappMappings['7060-378e127cd05cde8051d4aaad53ed4beb']={
webappId:    '7060',
documentId:  '60191',
internalId:  '378e127cd05cde8051d4aaad53ed4beb',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '59912',
internalId:  '',
customField: '20100510-134932'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54505',
internalId:  '',
customField: '20100326-154653'
};
webappMappings['7060']=webappMappings['7060-3a3414acba38efc53dfe1917d8f0bc7f']={
webappId:    '7060',
documentId:  '54442',
internalId:  '3a3414acba38efc53dfe1917d8f0bc7f',
customField: 'language:en;country:US;'
};
webappMappings['1003']=webappMappings['1003-ahtz10inxf3t1279a2b10c1']={
webappId:    '1003',
documentId:  '54505',
internalId:  'ahtz10inxf3t1279a2b10c1',
customField: 'en:US'
};
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();
};
