/* [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','2201',jdecode('Home'),jdecode(''),'/2201.html','true',[],'',''],
	['PAGE','2501',jdecode('About+ShootingSafely'),jdecode(''),'/2501.html','true',[],'',''],
	['PAGE','2801',jdecode('Class+Offerings'),jdecode(''),'/2801.html','true',[],'',''],
	['PAGE','7701',jdecode('Advanced+Class'),jdecode(''),'/7701.html','true',[],'',''],
	['PAGE','54901',jdecode('Become+an+NRA+Inst.'),jdecode(''),'/54901.html','true',[],'',''],
	['PAGE','6301',jdecode('Student+Comments'),jdecode(''),'/6301.html','true',[],'',''],
	['PAGE','2701',jdecode('Class+Schedule'),jdecode(''),'/2701/index.html','true',[ 
		['PAGE','28601',jdecode('More+IA+Info'),jdecode(''),'/2701/28601.html','true',[],'',''],
		['PAGE','28622',jdecode('More+IL+Info'),jdecode(''),'/2701/28622.html','true',[],'',''],
		['PAGE','27701',jdecode('More+MN+Info'),jdecode(''),'/2701/27701.html','true',[],'',''],
		['PAGE','27722',jdecode('More+ND+Info'),jdecode(''),'/2701/27722.html','true',[],'',''],
		['PAGE','27401',jdecode('More+NE+Info'),jdecode(''),'/2701/27401.html','true',[],'',''],
		['PAGE','27743',jdecode('More+UT+Info'),jdecode(''),'/2701/27743.html','true',[],'',''],
		['PAGE','47601',jdecode('More+WI+Info'),jdecode(''),'/2701/47601.html','true',[],'',''],
		['PAGE','42701',jdecode('Special+Info'),jdecode(''),'/2701/42701.html','true',[],'','']
	],'',''],
	['PAGE','2901',jdecode('Tip%3A+Point+Shooting'),jdecode(''),'/2901.html','true',[],'',''],
	['PAGE','3101',jdecode('Our+Location'),jdecode(''),'/3101.html','true',[],'',''],
	['PAGE','5301',jdecode('Permit+Reciprocity'),jdecode(''),'/5301.html','true',[],'',''],
	['PAGE','7201',jdecode('Recent+Class+Pictures'),jdecode(''),'/7201.html','true',[],'',''],
	['PAGE','5801',jdecode('Useful+Links'),jdecode(''),'/5801.html','true',[],'',''],
	['PAGE','8101',jdecode('For+Minnesota+Sheriffs'),jdecode(''),'/8101.html','true',[],'',''],
	['PAGE','8701',jdecode('Buy+The+Book%21'),jdecode(''),'/8701.html','true',[],'',''],
	['PAGE','3801',jdecode('Contact+Information'),jdecode(''),'/3801.html','true',[],'',''],
	['PAGE','9901',jdecode('E-mail+contact+form'),jdecode(''),'/9901.html','true',[],'','']];
var siteelementCount=24;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='A7A664';
theSitetree.keyvisualId='6312';
theSitetree.keyvisualName='kv_6312.jpg';
theSitetree.fontsetId='11151';
theSitetree.graphicsetId='12909';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E1E0C5';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Livinginamerica',
				paletteFamily: 	'A7A664',
				keyvisualId: 	'6312',
				keyvisualName: 	'kv_6312.jpg',
				fontsetId: 		'11151',
				graphicsetId: 	'12909',
				contentColor: 	'000000',
				contentBGColor: 'E1E0C5',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2201',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20100827-105121'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2501',
internalId:  '',
customField: '20090906-111449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2701',
internalId:  '',
customField: '20100905-210010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2801',
internalId:  '',
customField: '20100506-123111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2901',
internalId:  '',
customField: '20081026-155953'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '3101',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3101',
internalId:  '',
customField: '20081029-172907'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3801',
internalId:  '',
customField: '20081210-100834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5301',
internalId:  '',
customField: '20090806-164614'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20100608-223015'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20100118-223603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20100218-174542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7701',
internalId:  '',
customField: '20081119-062813'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8101',
internalId:  '',
customField: '20100719-215824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20090304-202517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27401',
internalId:  '',
customField: '20090831-234637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20090817-110111'
};
webappMappings['7008']=webappMappings['7008-9998']={
webappId:    '7008',
documentId:  '9901',
internalId:  '9998',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27701',
internalId:  '',
customField: '20090601-203816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27722',
internalId:  '',
customField: '20100416-145402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27743',
internalId:  '',
customField: '20100206-183320'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28601',
internalId:  '',
customField: '20100628-170208'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28622',
internalId:  '',
customField: '20090205-211010'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42701',
internalId:  '',
customField: '20090819-094104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47601',
internalId:  '',
customField: '20090911-133238'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54901',
internalId:  '',
customField: '20090907-081621'
};
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INE71A';
var companyName   = 'ShootingSafely.com';
var htmlTitle	  = '';
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();
};
