/* [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','4001',jdecode('Home'),jdecode(''), jdecode('%2F4001.html'), 'true',[],'',''],
	['PAGE','4052',jdecode('Firearms'),jdecode(''), jdecode('%2F4052.html'), 'true',[],'',''],
	['PAGE','7301',jdecode('Black+Powder+Camp'),jdecode(''), jdecode('%2F7301.html'), 'true',[],'',''],
	['PAGE','9801',jdecode('Ammunition'),jdecode(''), jdecode('%2F9801.html'), 'true',[],'',''],
	['PAGE','7501',jdecode('Classes+and+Seminars'),jdecode(''), jdecode('%2F7501.html'), 'true',[],'',''],
	['PAGE','7522',jdecode('Dutch+Oven+Cooking'),jdecode(''), jdecode('%2F7522.html'), 'true',[],'',''],
	['PAGE','10001',jdecode('Cookbooks+and+Recipe%26%23x27%3Bs'),jdecode(''), jdecode('%2F10001.html'), 'true',[],'',''],
	['PAGE','20401',jdecode('Archery'),jdecode(''), jdecode('%2F20401.html'), 'true',[],'',''],
	['PAGE','22901',jdecode('Possibles+Cache'),jdecode(''), jdecode('%2F22901.html'), 'true',[],'',''],
	['PAGE','26001',jdecode('Photography'),jdecode(''), jdecode('%2F26001.html'), 'true',[],'',''],
	['PAGE','38801',jdecode('Associates+Cave'),jdecode(''), jdecode('%2F38801.html'), 'true',[],'',''],
	['PAGE','58401',jdecode('Cook-off%26%23x27%3Bs'),jdecode(''), jdecode('%2F58401.html'), 'true',[],'',''],
	['PAGE','58422',jdecode('Ma+Kettle%26%23x27%3Bs+Site'),jdecode(''), jdecode('%2F58422.html'), 'true',[],'',''],
	['PAGE','60201',jdecode('BKS+Sportsmen%26%23x27%3Bs+Club'),jdecode(''), jdecode('%2F60201.html'), 'true',[],'',''],
	['PAGE','68001',jdecode('Gunsmith%2C+Firearm+Repairs%2C+Etc.++++'),jdecode(''), jdecode('%2F68001.html'), 'true',[],'',''],
	['PAGE','68301',jdecode('Oregon+Firearm+Transfer'),jdecode(''), jdecode('%2F68301.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Americanlife';
theSitetree.paletteFamily='706D44';
theSitetree.keyvisualId='4232';
theSitetree.keyvisualName='kv_4232.jpg';
theSitetree.fontsetId='10673';
theSitetree.graphicsetId='11189';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='858258';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hostway_generic',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Americanlife',
				paletteFamily: 	'706D44',
				keyvisualId: 	'4232',
				keyvisualName: 	'kv_4232.jpg',
				fontsetId: 		'10673',
				graphicsetId: 	'11189',
				contentColor: 	'FFFFFF',
				contentBGColor: '858258',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20110722-170303'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4052',
internalId:  '',
customField: '20120110-183104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7301',
internalId:  '',
customField: '20110423-170047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20110828-195633'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7522',
internalId:  '',
customField: '20110221-175946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9801',
internalId:  '',
customField: '20110723-175613'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20101204-185206'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20110725-171120'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22901',
internalId:  '',
customField: '20100731-183835'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20100814-192455'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38801',
internalId:  '',
customField: '20110105-121056'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58401',
internalId:  '',
customField: '20110316-151927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '58422',
internalId:  '',
customField: '20110316-150420'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '60201',
internalId:  '',
customField: '20120130-190155'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68001',
internalId:  '',
customField: '20110915-191140'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '68301',
internalId:  '',
customField: '20110915-191603'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INZ7DP';
var companyName   = 'CAST+%26+FIRE';
var htmlTitle	  = 'Cast+and+Fire';
var metaKeywords  = 'Firearms%2C+Dutch+Oven+Cooking+and+Cookbooks%2C+Black+Powder+Possibles+and+Outdoor+Photography.';
var metaContents  = 'Firearms%2C+Dutch+Oven+Cooking+and+Cookbooks%2C+Black+Powder+Possibles+and+Outdoor+Photography.+';
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();
};

