/* [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','6401',jdecode('HOME'),jdecode(''),'/6401.html','true',[],'',''],
	['PAGE','6452',jdecode('ABOUT+US'),jdecode(''),'/6452.html','true',[],'',''],
	['PAGE','7501',jdecode('MEETINGS+%26+EVENTS'),jdecode(''),'/7501.html','true',[],'',''],
	['PAGE','8301',jdecode('NEWSLETTER'),jdecode(''),'/8301.html','true',[],'',''],
	['PAGE','6473',jdecode('MEMBERSHIP'),jdecode(''),'/6473/index.html','true',[ 
		['PAGE','6494',jdecode('Application+Form'),jdecode(''),'/6473/6494.html','true',[],'','']
	],'',''],
	['PAGE','6515',jdecode('PHOTOGRAPHS'),jdecode(''),'/6515.html','true',[],'',''],
	['PAGE','11601',jdecode('Glenn%26%23x27%3Bs+Photos'),jdecode(''),'/11601.html','true',[],'',''],
	['PAGE','11622',jdecode('Gus%26%23x27%3B+Photos'),jdecode(''),'/11622.html','true',[],'',''],
	['PAGE','29701',jdecode('Historic+Photos'),jdecode(''),'/29701.html','true',[],'',''],
	['PAGE','11643',jdecode('Lorraine%26%23x27%3Bs+Photos'),jdecode(''),'/11643.html','true',[],'',''],
	['PAGE','16301',jdecode('Neil%26%23x27%3Bs+Photos'),jdecode(''),'/16301.html','true',[],'',''],
	['PAGE','11664',jdecode('Robert%26%23x27%3Bs+Photos'),jdecode(''),'/11664.html','true',[],'',''],
	['PAGE','6536',jdecode('CONTACT+US'),jdecode(''),'/6536.html','true',[],'',''],
	['PAGE','23422',jdecode('ARCHIVES'),jdecode(''),'/23422.html','true',[],'',''],
	['PAGE','26801',jdecode('2009+Meeting+Notes'),jdecode(''),'/26801.html','true',[],'',''],
	['PAGE','26822',jdecode('2008+Meeting+Notes'),jdecode(''),'/26822.html','true',[],'',''],
	['PAGE','23401',jdecode('Meeting+Notes'),jdecode(''),'/23401.html','true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Borders';
theSitetree.paletteFamily='C9DFEE';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10432';
theSitetree.graphicsetId='10771';
theSitetree.contentColor='692643';
theSitetree.contentBGColor='F0F2F4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Borders',
				paletteFamily: 	'C9DFEE',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10432',
				graphicsetId: 	'10771',
				contentColor: 	'692643',
				contentBGColor: 'F0F2F4',
				a_color: 		'000000',
				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['7008']=webappMappings['7008-151']={
webappId:    '7008',
documentId:  '6536',
internalId:  '151',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20100523-182516'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6536',
internalId:  '',
customField: '20090904-163607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6452',
internalId:  '',
customField: '20100121-212633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6473',
internalId:  '',
customField: '20100101-211340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6515',
internalId:  '',
customField: '20091002-011841'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20100523-183456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6494',
internalId:  '',
customField: '20081102-022505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20100429-022611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11643',
internalId:  '',
customField: '20100121-024726'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20091001-173751'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11622',
internalId:  '',
customField: '20091102-004855'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11664',
internalId:  '',
customField: '20091005-120604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16301',
internalId:  '',
customField: '20100101-210156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20091116-232611'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23422',
internalId:  '',
customField: '20091116-050451'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26801',
internalId:  '',
customField: '20091227-093351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26822',
internalId:  '',
customField: '20091227-093351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29701',
internalId:  '',
customField: '20100125-160545'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INV13B';
var companyName   = 'World+Ship+Society+-+Vancouver+Branch';
var htmlTitle	  = 'The+World+Ship+Society+of+British+Columbia';
var metaKeywords  = '';
var metaContents  = '';
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();
};
