/* [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','71101',jdecode('E-MAIL+LIST'),jdecode(''),'/71101.html','true',[],''],
	['PAGE','1101',jdecode('Ranger+Training'),jdecode(''),'/1101.html','true',[],''],
	['PAGE','25401',jdecode('Cmdr.+Training'),jdecode(''),'/25401/index.html','true',[ 
		['PAGE','25901',jdecode('Commanders'),jdecode(''),'/25401/25901.html','true',[],'']
	],''],
	['PAGE','28001',jdecode('Junior+Training'),jdecode(''),'/28001/index.html','true',[ 
		['PAGE','88201',jdecode('Boys%26%23x27%3B+Camps++%26%23x27%3B09'),jdecode(''),'/28001/88201.html','true',[],''],
		['PAGE','58201',jdecode('Equipment+Fund'),jdecode(''),'/28001/58201.html','true',[],'']
	],''],
	['PAGE','53801',jdecode('Shooting+Sports'),jdecode(''),'/53801.html','true',[],''],
	['PAGE','66001',jdecode('NRA+Classes'),jdecode(''),'/66001.html','true',[],''],
	['PAGE','25443',jdecode('Regional+RR'),jdecode(''),'/25443.html','true',[],''],
	['PAGE','44101',jdecode('National+RR'),jdecode(''),'/44101/index.html','true',[ 
		['PAGE','44122',jdecode('National+Training+Camp'),jdecode(''),'/44101/44122.html','true',[],''],
		['PAGE','17101',jdecode('World+Class+Outpost'),jdecode(''),'/44101/17101.html','true',[],'']
	],''],
	['PAGE','78201',jdecode('Tools+%26+Info'),jdecode(''),'/78201/index.html','true',[ 
		['PAGE','47901',jdecode('Map+LCRA-Cooper+Farms'),jdecode(''),'/78201/47901.html','true',[],''],
		['PAGE','61601',jdecode('Web+%26+eMail+Tools'),jdecode(''),'/78201/61601.html','true',[],'']
	],''],
	['PAGE','50006',jdecode('Guestbook'),jdecode(''),'/50006/index.html','true',[ 
		['PAGE','50001',jdecode('Read+Guestbook'),jdecode(''),'/50006/50001.html','false',[],'']
	],'']];
var siteelementCount=18;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='FC2323';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10381';
theSitetree.graphicsetId='10561';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Circulation',
				paletteFamily: 	'FC2323',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10381',
				graphicsetId: 	'10561',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1101',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-688']={
webappId:    '7008',
documentId:  '25401',
internalId:  '688',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-50006abri10inx2vq']={
webappId:    '1002',
documentId:  '50006',
internalId:  '50006abri10inx2vq',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-689']={
webappId:    '7008',
documentId:  '53801',
internalId:  '689',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '71101',
internalId:  '',
customField: '20060824-175410'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1101',
internalId:  '',
customField: '20090129-155900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25401',
internalId:  '',
customField: '20090301-164135'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25901',
internalId:  '',
customField: '20090301-164851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28001',
internalId:  '',
customField: '20090129-151436'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '88201',
internalId:  '',
customField: '20090626-162342'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58201',
internalId:  '',
customField: '20080218-134049'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '53801',
internalId:  '',
customField: '20090217-021012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66001',
internalId:  '',
customField: '20090904-154505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25443',
internalId:  '',
customField: '20090129-162502'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44101',
internalId:  '',
customField: '20090129-162539'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44122',
internalId:  '',
customField: '20061029-163943'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17101',
internalId:  '',
customField: '20080218-134727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '78201',
internalId:  '',
customField: '20070406-153324'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47901',
internalId:  '',
customField: '20060731-184312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61601',
internalId:  '',
customField: '20070807-160307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50006',
internalId:  '',
customField: '20060731-194012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50001',
internalId:  '',
customField: '20060731-194012'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INX2VQ';
var companyName   = 'Royal+Ranger+Training';
var htmlTitle	  = 'Royal+Ranger+Training';
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();
};
