/* [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','5320',jdecode('WELCOME'),jdecode(''), jdecode('%2F5320%2Findex.html'), 'true',[ 
		['PAGE','19720',jdecode('Tapatoru'),jdecode(''), jdecode('%2F5320%2F19720.html'), 'true',[],'','']
	],'',''],
	['PAGE','26642',jdecode('PRESENT'),jdecode(''), jdecode('%2F26642%2Findex.html'), 'true',[ 
		['PAGE','19741',jdecode('Events'),jdecode(''), jdecode('%2F26642%2F19741.html'), 'true',[],'',''],
		['PAGE','28842',jdecode('Te+Pae+Arahi'),jdecode(''), jdecode('%2F26642%2F28842.html'), 'false',[],'',''],
		['PAGE','5434',jdecode('FTM+Aotearoa'),jdecode(''), jdecode('%2F26642%2F5434.html'), 'true',[],'',''],
		['PAGE','40942',jdecode('Reading+Blog'),jdecode(''), jdecode('%2F26642%2F40942.html'), 'true',[],'',''],
		['PAGE','44553',jdecode('Sacred+Animals'),jdecode(''), jdecode('%2F26642%2F44553.html'), 'true',[],'','']
	],'',''],
	['PAGE','47553',jdecode('TATOU'),jdecode(''), jdecode('%2F47553.html'), 'true',[],'',''],
	['PAGE','10221',jdecode('FUTURE'),jdecode(''), jdecode('%2F10221.html'), 'true',[],'',''],
	['PAGE','5476',jdecode('PAST'),jdecode(''), jdecode('%2F5476%2Findex.html'), 'true',[ 
		['PAGE','58353',jdecode('HRC+Conference+'),jdecode(''), jdecode('%2F5476%2F58353.html'), 'true',[],'',''],
		['PAGE','53353',jdecode('Hui+Takat%C4%81pui+'),jdecode(''), jdecode('%2F5476%2F53353.html'), 'true',[],'',''],
		['PAGE','30142',jdecode('Melbourne+2008'),jdecode(''), jdecode('%2F5476%2F30142.html'), 'true',[],'',''],
		['PAGE','56853',jdecode('Wgtn+Outgames+2011'),jdecode(''), jdecode('%2F5476%2F56853.html'), 'true',[],'',''],
		['PAGE','27942',jdecode('Our+People%3A+A-G'),jdecode(''), jdecode('%2F5476%2F27942.html'), 'true',[],'',''],
		['PAGE','27963',jdecode('Our+People%3A+H+-+N'),jdecode(''), jdecode('%2F5476%2F27963.html'), 'true',[],'',''],
		['PAGE','27984',jdecode('Our+People%3A+M+-+S'),jdecode(''), jdecode('%2F5476%2F27984.html'), 'true',[],'',''],
		['PAGE','28005',jdecode('Our+People%3A+T+-+Z'),jdecode(''), jdecode('%2F5476%2F28005.html'), 'true',[],'','']
	],'',''],
	['PAGE','37042',jdecode('CONTACT+US'),jdecode(''), jdecode('%2F37042.html'), 'true',[],'',''],
	['PAGE','35042',jdecode('LINKS'),jdecode(''), jdecode('%2F35042.html'), 'true',[],'',''],
	['PAGE','48853',jdecode('DISCLAIMER'),jdecode(''), jdecode('%2F48853.html'), 'true',[],'','']];
var siteelementCount=22;
theSitetree.topTemplateName='Vienna';
theSitetree.paletteFamily='D6D2C5';
theSitetree.keyvisualId='11878';
theSitetree.keyvisualName='kv_11878.jpg';
theSitetree.fontsetId='33180';
theSitetree.graphicsetId='14088';
theSitetree.contentColor='696146';
theSitetree.contentBGColor='ebe8df';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp32-tnz',
  product: 'WSCSYSSSSLYTC22A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Vienna',
				paletteFamily: 	'D6D2C5',
				keyvisualId: 	'11878',
				keyvisualName: 	'kv_11878.jpg',
				fontsetId: 		'33180',
				graphicsetId: 	'14088',
				contentColor: 	'696146',
				contentBGColor: 'ebe8df',
				a_color: 		'EBE8DF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5320',
internalId:  '',
customField: '20111130-010517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19720',
internalId:  '',
customField: '20100228-221350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19741',
internalId:  '',
customField: '20110124-052314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10221',
internalId:  '',
customField: '20100405-163942'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56853',
internalId:  '',
customField: '20110709-081300'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5320',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5434',
internalId:  '',
customField: '20100929-054746'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5476',
internalId:  '',
customField: '20100301-034739'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30142',
internalId:  '',
customField: '20100418-062734'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27984',
internalId:  '',
customField: '20120131-180919'
};
webappMappings['7008']=webappMappings['7008-16116']={
webappId:    '7008',
documentId:  '37042',
internalId:  '16116',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28842',
internalId:  '',
customField: '20110318-173649'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37042',
internalId:  '',
customField: '20100406-051350'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26642',
internalId:  '',
customField: '20100405-024330'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35042',
internalId:  '',
customField: '20111110-211049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27942',
internalId:  '',
customField: '20110808-043620'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28005',
internalId:  '',
customField: '20120202-143524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27963',
internalId:  '',
customField: '20100227-234506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53353',
internalId:  '',
customField: '20101205-052022'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44553',
internalId:  '',
customField: '20100420-043149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40942',
internalId:  '',
customField: '20100814-071441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58353',
internalId:  '',
customField: '20110709-083433'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47553',
internalId:  '',
customField: '20111216-235922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48853',
internalId:  '',
customField: '20100614-053711'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7C5M2';
var companyName   = '';
var htmlTitle	  = 'Tapatoru';
var metaKeywords  = 'trans%2Ctransgender%2Cftm%2Ctransman%2Cmaletofemale%2Cmtf%2Cfemaletomale%2Cmaori+trans%2Cmana+tane%2C+whakawahine%2Cfafafine%2Cfafa%2C%0Answ-dbmt0-2xhett57ecich-p7mputvlu-b4495299f-37o03anjguts6kfmj02isz09um-kpypbglzhkqivzpdzfeflonuvqbgva5adz6kmlyqys6adk2s30n33jr8moeab';
var metaContents  = 'Tapatoru+is+based+in+Wellington%2C+which+is+the+capital+city+of+New+Zealand.+Historically%2C+this+vibrant+and+close-knit+city+has+become+home+to+many+of+our+Maori+trans+people+and+today+we+celebrate+a+community+who+feel+somewhat+established+and+embraced+by+its+city.';
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();
};

