/* [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 theSitetree=[ 
	['PAGE','4478',jdecode('Home'),jdecode(''),'/4478.html','true',[],''],
	['PAGE','4535',jdecode('About+us'),jdecode(''),'/4535.html','true',[],''],
	['PAGE','5110',jdecode('Community+Voices'),jdecode(''),'/5110.html','true',[],''],
	['PAGE','5083',jdecode('Words+for+Life'),jdecode(''),'/5083.html','true',[],''],
	['PAGE','5137',jdecode('Words+at+Work'),jdecode(''),'/5137.html','true',[],''],
	['PAGE','6448',jdecode('Personal+Wordsmith'),jdecode(''),'/6448.html','true',[],''],
	['PAGE','6475',jdecode('Business+Wordsmith'),jdecode(''),'/6475.html','true',[],''],
	['PAGE','4724',jdecode('Contact'),jdecode(''),'/4724.html','true',[],''],
	['PAGE','5535',jdecode('Guestbook'),jdecode(''),'/5535/index.html','true',[ 
		['PAGE','5536',jdecode('Read+Guestbook'),jdecode(''),'/5535/5536.html','false',[],'']
	],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Architekt';
theSitetree.paletteFamily='FFCC66';
theSitetree.keyvisualId='1690';
theSitetree.keyvisualName='beratung.jpg';
theSitetree.fontsetId='306';
theSitetree.graphicsetId='343';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFCC66';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Architekt',
				paletteFamily: 	'FFCC66',
				keyvisualId: 	'1690',
				keyvisualName: 	'beratung.jpg',
				fontsetId: 		'306',
				graphicsetId: 	'343',
				contentColor: 	'000000',
				contentBGColor: 'FFCC66',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFCC66',
				b_color: 		'CC6600',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4478',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4535',
internalId:  '',
customField: '20070528-224739'
};
webappMappings['1002']=webappMappings['1002-5535AVEC10IN2GVE']={
webappId:    '1002',
documentId:  '5535',
internalId:  '5535AVEC10IN2GVE',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4478',
internalId:  '',
customField: '20061108-164931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5110',
internalId:  '',
customField: '20090618-225822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5083',
internalId:  '',
customField: '20090430-003838'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5137',
internalId:  '',
customField: '20090430-004809'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6448',
internalId:  '',
customField: '20060512-195905'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6475',
internalId:  '',
customField: '20060512-195650'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4724',
internalId:  '',
customField: '20090430-004912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5535',
internalId:  '',
customField: '20060719-091335'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5536',
internalId:  '',
customField: '20060511-183644'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVEC10IN2GVE';
var companyName   = 'Wordsmith+%28NZ%29+Limited';
var htmlTitle	  = 'wordsmithnz.net.nz';
var metaKeywords  = 'stories%3B+poems%3B+denial%3B+margins%3B+footprints%3B+grieving%3B+reflections%3B+words%3B+work%3B+wordsmith%3B+Waitakere%3B+auckland%3B+advisor%3B+life%3B+prosperity%3B+future%3B+hope%3B+new%3B+wilderness%3B+goal%3B+dream%3BGoethe%3B+Oliver+Wendell+Holmes%3B+Eleanor+Roosevelt%3B+future%3B+stretched%3B+ideas%3B+Benjamin+Franklin%3B+learn%3B+biography%3B+humour%3B+skill+building%3B+letters%3B+claims%3B++complaints%3B+genealogy%3B+apologies%3B+documentation%3B+press+release%3B+business+plan%3B+quality+policiy%3B+health+and+safety%3B+operating+procedure%3B+annual+plan';
var metaContents  = 'Words+for+LifeWords+for+FunWords+at+WorkStories+and+PoemsPersonal+Word+helpBusiness+documentationQuality+policiesBusiness+plansTraining+and+Development';
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();
};
