/* [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','3801',jdecode('Home'),jdecode(''),'/3801.html','true',[],'',''],
	['PAGE','3915',jdecode('Skills+Development'),jdecode(''),'/3915.html','true',[],'',''],
	['PAGE','3894',jdecode('Employment+Equity'),jdecode(''),'/3894.html','true',[],'',''],
	['PAGE','5401',jdecode('BEE'),jdecode(''),'/5401/index.html','true',[ 
		['PAGE','3852',jdecode('Ownership'),jdecode(''),'/5401/3852.html','true',[],'',''],
		['PAGE','3873',jdecode('Management'),jdecode(''),'/5401/3873.html','true',[],'',''],
		['PAGE','3936',jdecode('Procurement'),jdecode(''),'/5401/3936.html','true',[],'',''],
		['PAGE','3957',jdecode('Enterprise+Dev'),jdecode(''),'/5401/3957.html','true',[],'',''],
		['PAGE','3978',jdecode('Socio+Economic'),jdecode(''),'/5401/3978.html','true',[],'','']
	],'',''],
	['PAGE','9101',jdecode('Contact'),jdecode(''),'/9101.html','true',[],'',''],
	['PAGE','3999',jdecode('Quote+Me'),jdecode(''),'/3999.html','true',[],'',''],
	['PAGE','4020',jdecode('Latest+News'),jdecode(''),'/4020.html','true',[],'',''],
	['PAGE','4041',jdecode('Associates'),jdecode(''),'/4041.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Bow';
theSitetree.paletteFamily='0086C2';
theSitetree.keyvisualId='12019';
theSitetree.keyvisualName='kv_12019.jpg';
theSitetree.fontsetId='33250';
theSitetree.graphicsetId='14115';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Bow',
				paletteFamily: 	'0086C2',
				keyvisualId: 	'12019',
				keyvisualName: 	'kv_12019.jpg',
				fontsetId: 		'33250',
				graphicsetId: 	'14115',
				contentColor: 	'666666',
				contentBGColor: 'FFFFFF',
				a_color: 		'F2F5F8',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-3214']={
webappId:    '7008',
documentId:  '3999',
internalId:  '3214',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20100325-124046'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4041',
internalId:  '',
customField: '20100323-103206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3852',
internalId:  '',
customField: '20100323-084130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3873',
internalId:  '',
customField: '20100323-085732'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20100316-190725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3915',
internalId:  '',
customField: '20100323-091148'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3894',
internalId:  '',
customField: '20100323-085952'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3936',
internalId:  '',
customField: '20100323-091849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3957',
internalId:  '',
customField: '20100323-092923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3978',
internalId:  '',
customField: '20100323-093259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3999',
internalId:  '',
customField: '20100323-100221'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4020',
internalId:  '',
customField: '20100325-074356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20100401-151400'
};
var canonHostname = 'sitebuilder1.jnb2.host-h.net';
var accountId     = 'AHTZ10IN2AOA';
var companyName   = 'Du+Toit+and+Associates';
var htmlTitle	  = '';
var metaKeywords  = '';
var metaContents  = 'Du+Toit+and+Associates+assist+organisations+in+obtaining+the+maximum+BEE+rating+sore+using+their+current+infrastructure.';
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();
};
