/* [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','5001',jdecode('Home'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','5052',jdecode('About+us'),jdecode(''), jdecode('%2F5052.html'), 'true',[],'',''],
	['PAGE','5073',jdecode('Contact'),jdecode(''), jdecode('%2F5073.html'), 'true',[],'',''],
	['PAGE','57001',jdecode('SC+CWP+Classes'),jdecode(''), jdecode('%2F57001.html'), 'true',[],'',''],
	['PAGE','57022',jdecode('Adv.+Carry+%26+Conceal'),jdecode(''), jdecode('%2F57022.html'), 'true',[],'',''],
	['PAGE','57043',jdecode('Active+Shooter+Response'),jdecode(''), jdecode('%2F57043.html'), 'true',[],'',''],
	['PAGE','56201',jdecode('Ladies+Classes'),jdecode(''), jdecode('%2F56201.html'), 'true',[],'',''],
	['PAGE','5136',jdecode('Class+Calendar'),jdecode(''), jdecode('%2F5136.html'), 'true',[],'',''],
	['PAGE','23401',jdecode('Registration'),jdecode(''), jdecode('%2F23401.html'), 'true',[],'',''],
	['PAGE','56222',jdecode('Join+our+Email+List'),jdecode(''), jdecode('%2F56222.html'), 'true',[],'',''],
	['PAGE','5115',jdecode('Links%2FForms'),jdecode(''), jdecode('%2F5115.html'), 'true',[],'',''],
	['PAGE','17122',jdecode('Reciprocity'),jdecode(''), jdecode('%2F17122.html'), 'true',[],'',''],
	['PAGE','34301',jdecode('SC+CWP+Legislation'),jdecode(''), jdecode('%2F34301.html'), 'true',[],'',''],
	['PAGE','34322',jdecode('Join+NRA+%26+GOSC'),jdecode(''), jdecode('%2F34322.html'), 'true',[],'',''],
	['PAGE','34101',jdecode('FAQ%26%23x27%3Bs'),jdecode(''), jdecode('%2F34101.html'), 'true',[],'',''],
	['PAGE','34122',jdecode('Testimonials'),jdecode(''), jdecode('%2F34122.html'), 'true',[],'',''],
	['PAGE','12601',jdecode('Range+and+Class+Photos'),jdecode(''), jdecode('%2F12601.html'), 'true',[],'',''],
	['PAGE','48001',jdecode('Related+Videos'),jdecode(''), jdecode('%2F48001.html'), 'true',[],'','']];
var siteelementCount=18;
theSitetree.topTemplateName='Common';
theSitetree.paletteFamily='D40202';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='26633';
theSitetree.graphicsetId='13449';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Common',
				paletteFamily: 	'D40202',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'26633',
				graphicsetId: 	'13449',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				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['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20120201-202236'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12601',
internalId:  '',
customField: '20090108-111455'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20111031-093437'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20110228-210301'
};
webappMappings['7060']=webappMappings['7060-a7118161562dc5d602d9def886c415d8']={
webappId:    '7060',
documentId:  '12601',
internalId:  'a7118161562dc5d602d9def886c415d8',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5115',
internalId:  '',
customField: '20111107-121603'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5136',
internalId:  '',
customField: '20120201-203831'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17122',
internalId:  '',
customField: '20090914-113612'
};
webappMappings['1501']=webappMappings['1501-11391665']={
webappId:    '1501',
documentId:  '5001',
internalId:  '11391665',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-23626']={
webappId:    '7008',
documentId:  '23401',
internalId:  '23626',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23401',
internalId:  '',
customField: '20090428-215705'
};
webappMappings['7008']=webappMappings['7008-23631']={
webappId:    '7008',
documentId:  '5073',
internalId:  '23631',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-34122aendu0ine1pk']={
webappId:    '1002',
documentId:  '34122',
internalId:  '34122aendu0ine1pk',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20090517-221558'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34301',
internalId:  '',
customField: '20090517-211604'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34322',
internalId:  '',
customField: '20120111-090520'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34122',
internalId:  '',
customField: '20090223-210658'
};
webappMappings['7060']=webappMappings['7060-2dc58f2c51a7609ed2f667df09dec455']={
webappId:    '7060',
documentId:  '48001',
internalId:  '2dc58f2c51a7609ed2f667df09dec455',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48001',
internalId:  '',
customField: '20091026-113300'
};
webappMappings['7008']=webappMappings['7008-23629']={
webappId:    '7008',
documentId:  '56222',
internalId:  '23629',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56201',
internalId:  '',
customField: '20110502-142959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56222',
internalId:  '',
customField: '20100323-124622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57022',
internalId:  '',
customField: '20101130-110441'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57043',
internalId:  '',
customField: '20110523-094318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57001',
internalId:  '',
customField: '20111205-194117'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INE1PK';
var companyName   = 'B.E.L.T.++Training%2C+LLC';
var htmlTitle	  = 'BELT+Concealed+Weapons+Training';
var metaKeywords  = '';
var metaContents  = 'belt+training+cwp+south+carolina+concealed+weapons+training';
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();
};

