/* [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','601',jdecode('HOME'),jdecode(''),'/601.html','true',[],''],
	['PAGE','5701',jdecode('ABOUT+US'),jdecode(''),'/5701.html','true',[],''],
	['PAGE','5722',jdecode('CCCBA+OFFICERS'),jdecode(''),'/5722.html','true',[],''],
	['PAGE','5827',jdecode('EVENTS+CALENDAR'),jdecode(''),'/5827.html','true',[],''],
	['PAGE','24601',jdecode('Bike+Show+Pics'),jdecode(''),'/24601.html','true',[],''],
	['PAGE','26501',jdecode('RAT+DADDY+RUN+INFO'),jdecode(''),'/26501.html','true',[],''],
	['PAGE','29101',jdecode('SCHOLARSHIP+INFO'),jdecode(''),'/29101.html','true',[],''],
	['PAGE','14401',jdecode('JOIN+US'),jdecode(''),'/14401.html','true',[],''],
	['PAGE','14422',jdecode('LEGISLATIVE'),jdecode(''),'/14422/index.html','true',[ 
		['PAGE','19101',jdecode('Beaver%26%23x27%3Bs+Page'),jdecode(''),'/14422/19101.html','true',[],''],
		['PAGE','18101',jdecode('Helmet+Laws'),jdecode(''),'/14422/18101.html','true',[],'']
	],''],
	['PAGE','19901',jdecode('MSAP'),jdecode(''),'/19901/index.html','true',[ 
		['PAGE','22201',jdecode('Max%26%23x27%3Bs+Page'),jdecode(''),'/19901/22201.html','true',[],''],
		['PAGE','13701',jdecode('Class+Schedule'),jdecode(''),'/19901/13701.html','true',[],'']
	],''],
	['PAGE','14901',jdecode('NEWSLETTER'),jdecode(''),'/14901.html','true',[],''],
	['PAGE','5869',jdecode('OUR+HISTORY'),jdecode(''),'/5869/index.html','true',[ 
		['PAGE','5890',jdecode('MEMBERS'),jdecode(''),'/5869/5890.html','true',[],'']
	],''],
	['PAGE','14443',jdecode('MEMORIAL+PAGE'),jdecode(''),'/14443.html','true',[],''],
	['PAGE','5785',jdecode('CONTACT+US'),jdecode(''),'/5785.html','true',[],''],
	['PAGE','5911',jdecode('LINKS'),jdecode(''),'/5911.html','true',[],''],
	['PAGE','10206',jdecode('GUESTBOOK'),jdecode(''),'/10206/index.html','true',[ 
		['PAGE','10201',jdecode('READ+GUESTBOOK'),jdecode(''),'/10206/10201.html','false',[],'']
	],'']];
var siteelementCount=22;
theSitetree.topTemplateName='Orbit';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='173';
theSitetree.graphicsetId='206';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var theTemplate={
				name: 			'Orbit',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'173',
				graphicsetId: 	'206',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'666666',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-10206aendu0in290n']={
webappId:    '1002',
documentId:  '10206',
internalId:  '10206aendu0in290n',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20080701-102718'
};
webappMappings['1501']=webappMappings['1501-3792201']={
webappId:    '1501',
documentId:  '601',
internalId:  '3792201',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20080701-102817'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5722',
internalId:  '',
customField: '20080508-132443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5827',
internalId:  '',
customField: '20080701-105828'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24601',
internalId:  '',
customField: '20080703-153842'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26501',
internalId:  '',
customField: '20080408-154311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14401',
internalId:  '',
customField: '20080219-204928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14422',
internalId:  '',
customField: '20080701-103453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19101',
internalId:  '',
customField: '20080311-204028'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '18101',
internalId:  '',
customField: '20080214-213420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19901',
internalId:  '',
customField: '20080508-131039'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22201',
internalId:  '',
customField: '20080701-103601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13701',
internalId:  '',
customField: '20080701-103710'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14901',
internalId:  '',
customField: '20080209-163733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5869',
internalId:  '',
customField: '20080219-205145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5890',
internalId:  '',
customField: '20080208-233122'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14443',
internalId:  '',
customField: '20080209-162755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5785',
internalId:  '',
customField: '20080219-205906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5911',
internalId:  '',
customField: '20080304-110607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10206',
internalId:  '',
customField: '20080208-233849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20080208-233849'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29101',
internalId:  '',
customField: '20080331-121220'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN290N';
var companyName   = 'Carteret-Craven+CBA+of+NC';
var htmlTitle	  = 'Carteret-Craven+CBA';
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();
};
