/* [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(''), jdecode('%2F9201.html'), 'true',[],'',''],
	['PAGE','9252',jdecode('Custom+Rifles'),jdecode(''), jdecode('%2F9252%2Findex.html'), 'true',[ 
		['PAGE','9601',jdecode('Hunter'),jdecode(''), jdecode('%2F9252%2F9601.html'), 'true',[],'',''],
		['PAGE','9622',jdecode('Warrior'),jdecode(''), jdecode('%2F9252%2F9622.html'), 'true',[],'',''],
		['PAGE','9643',jdecode('Prairie'),jdecode(''), jdecode('%2F9252%2F9643.html'), 'true',[],'',''],
		['PAGE','9664',jdecode('Owyhee'),jdecode(''), jdecode('%2F9252%2F9664.html'), 'true',[],'',''],
		['PAGE','9685',jdecode('Denali'),jdecode(''), jdecode('%2F9252%2F9685.html'), 'true',[],'',''],
		['PAGE','9706',jdecode('Kalahari'),jdecode(''), jdecode('%2F9252%2F9706.html'), 'true',[],'',''],
		['PAGE','33067',jdecode('Tatanka'),jdecode(''), jdecode('%2F9252%2F33067.html'), 'true',[],'',''],
		['PAGE','33088',jdecode('Mato'),jdecode(''), jdecode('%2F9252%2F33088.html'), 'true',[],'','']
	],'',''],
	['PAGE','9273',jdecode('Custom+Bullets'),jdecode(''), jdecode('%2F9273.html'), 'true',[],'',''],
	['PAGE','9294',jdecode('Gunsimthing'),jdecode(''), jdecode('%2F9294.html'), 'true',[],'',''],
	['PAGE','29367',jdecode('Photo+Album'),jdecode(''), jdecode('%2F29367%2Findex.html'), 'true',[ 
		['PAGE','31367',jdecode('Aminations'),jdecode(''), jdecode('%2F29367%2F31367.html'), 'false',[],'','']
	],'',''],
	['PAGE','39567',jdecode('Hunting'),jdecode(''), jdecode('%2F39567.html'), 'true',[],'',''],
	['PAGE','9315',jdecode('Contact+Info'),jdecode(''), jdecode('%2F9315%2Findex.html'), 'true',[ 
		['PAGE','13939',jdecode('Email'),jdecode(''), jdecode('%2F9315%2F13939.html'), 'true',[],'',''],
		['PAGE','9399',jdecode('Find+us+map'),jdecode(''), jdecode('%2F9315%2F9399.html'), 'true',[],'','']
	],'',''],
	['PAGE','9357',jdecode('About+us'),jdecode(''), jdecode('%2F9357%2Findex.html'), 'true',[ 
		['PAGE','9378',jdecode('Our+team'),jdecode(''), jdecode('%2F9357%2F9378.html'), 'true',[],'','']
	],'',''],
	['PAGE','9420',jdecode('News+%26+Comments'),jdecode(''), jdecode('%2F9420.html'), 'true',[],'','']];
var siteelementCount=21;
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 prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRN4'
};
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: '20110331-122527'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9273',
internalId:  '',
customField: '20110409-010722'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20110506-171834'
};
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: '20110331-122742'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9622',
internalId:  '',
customField: '20110409-010243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9643',
internalId:  '',
customField: '20110409-010318'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9664',
internalId:  '',
customField: '20110331-122846'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9685',
internalId:  '',
customField: '20110331-122916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9706',
internalId:  '',
customField: '20110331-122958'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9294',
internalId:  '',
customField: '20110409-012118'
};
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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9201',
internalId:  '1006',
customField: '1006'
};
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: '20110409-010515'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33088',
internalId:  '',
customField: '20110331-123112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39567',
internalId:  '',
customField: '20110830-211137'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
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();
};

