/* [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','9201',jdecode('Home'),jdecode(''),'/9201.html','true',[],'',''],
	['PAGE','9252',jdecode('Custom+Rifles'),jdecode(''),'/9252/index.html','true',[ 
		['PAGE','9601',jdecode('Hunter'),jdecode(''),'/9252/9601.html','true',[],'',''],
		['PAGE','9622',jdecode('Warrior'),jdecode(''),'/9252/9622.html','true',[],'',''],
		['PAGE','9643',jdecode('Praire'),jdecode(''),'/9252/9643.html','true',[],'',''],
		['PAGE','9664',jdecode('Owyhee'),jdecode(''),'/9252/9664.html','true',[],'',''],
		['PAGE','9685',jdecode('Denali'),jdecode(''),'/9252/9685.html','true',[],'',''],
		['PAGE','9706',jdecode('Kalahari'),jdecode(''),'/9252/9706.html','true',[],'',''],
		['PAGE','33067',jdecode('Tatanka'),jdecode(''),'/9252/33067.html','true',[],'',''],
		['PAGE','33088',jdecode('Mato'),jdecode(''),'/9252/33088.html','true',[],'','']
	],'',''],
	['PAGE','9273',jdecode('Custom+Bullets'),jdecode(''),'/9273.html','true',[],'',''],
	['PAGE','9294',jdecode('Gunsimthing'),jdecode(''),'/9294.html','true',[],'',''],
	['PAGE','29367',jdecode('Photo+Album'),jdecode(''),'/29367/index.html','true',[ 
		['PAGE','31367',jdecode('Aminations'),jdecode(''),'/29367/31367.html','false',[],'','']
	],'',''],
	['PAGE','9315',jdecode('Contact+Info'),jdecode(''),'/9315/index.html','true',[ 
		['PAGE','13939',jdecode('Email'),jdecode(''),'/9315/13939.html','true',[],'',''],
		['PAGE','9399',jdecode('Find+us+map'),jdecode(''),'/9315/9399.html','true',[],'','']
	],'',''],
	['PAGE','9357',jdecode('About+us'),jdecode(''),'/9357/index.html','true',[ 
		['PAGE','9378',jdecode('Our+team'),jdecode(''),'/9357/9378.html','true',[],'','']
	],'',''],
	['PAGE','9420',jdecode('News+%26+Comments'),jdecode(''),'/9420.html','true',[],'','']];
var siteelementCount=20;
theSitetree.topTemplateName='Livinginamerica';
theSitetree.paletteFamily='A7A664';
theSitetree.keyvisualId='6306';
theSitetree.keyvisualName='kv_6306.jpg';
theSitetree.fontsetId='11152';
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: 	'6306',
				keyvisualName: 	'kv_6306.jpg',
				fontsetId: 		'11152',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['7050']=webappMappings['7050-1360']={
webappId:    '7050',
documentId:  '9420',
internalId:  '1360',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9252',
internalId:  '',
customField: '20100529-124758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9273',
internalId:  '',
customField: '20100529-130834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20100529-124912'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9420',
internalId:  '',
customField: '20080517-094331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29367',
internalId:  '',
customField: '20080901-124531'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9315',
internalId:  '',
customField: '20080414-190606'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31367',
internalId:  '',
customField: '20080517-095121'
};
webappMappings['7008']=webappMappings['7008-2492']={
webappId:    '7008',
documentId:  '13939',
internalId:  '2492',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20100529-125248'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9622',
internalId:  '',
customField: '20100529-125414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9643',
internalId:  '',
customField: '20100529-125555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9664',
internalId:  '',
customField: '20100529-125816'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9685',
internalId:  '',
customField: '20100529-125931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9706',
internalId:  '',
customField: '20100529-130402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9294',
internalId:  '',
customField: '20100529-111346'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9357',
internalId:  '',
customField: '20080514-113934'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '9399',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9378',
internalId:  '',
customField: '20100529-124557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13939',
internalId:  '',
customField: '20080513-131409'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9399',
internalId:  '',
customField: '20080513-132943'
};
webappMappings['7060']=webappMappings['7060-44584cf8704978cced1d55241d8891d4']={
webappId:    '7060',
documentId:  '29367',
internalId:  '44584cf8704978cced1d55241d8891d4',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33067',
internalId:  '',
customField: '20100529-130453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33088',
internalId:  '',
customField: '20100529-130527'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2OJ0';
var companyName   = 'Alkali+International+Corp.+%28AIC%29++775-625-2413';
var htmlTitle	  = 'Alkali+International+Corp+%28AIC%29+Custom+rifles%2C+firearms+and+bullets.';
var metaKeywords  = 'Custom+Rifle%2C+Gunsmithing%2C+Gunsmith%2C+Firearms%2C+Rifles%2C+Shotguns%2C+Handguns%2C+Pistols%2C+Bullets%2C+AR15';
var metaContents  = 'Custom+firearms%2C+bullets+and+ammunition+made+to+such+exacting+specifications+they+defy+logic.+Also+you+can+chose+from+thousands+of+firearms+in+one+of+our+online+gun+stores%2C+or+send+your+firearm+in+for+service+to+our+gunsmiths.+If+you+have+an+idea+for+a+rifle+or+bullet+you+want+built+give+us+a+call.+';
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();
};
