/* [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','1501',jdecode('Home'),jdecode(''),'/1501.html','true',[],'',''],
	['PAGE','12903',jdecode('M1919++History'),jdecode(''),'/12903.html','true',[],'',''],
	['PAGE','22913',jdecode('Markings'),jdecode(''),'/22913.html','true',[],'',''],
	['PAGE','22934',jdecode('Barrels+and+Jackets'),jdecode(''),'/22934.html','true',[],'',''],
	['PAGE','22955',jdecode('Bottom+Plates'),jdecode(''),'/22955.html','true',[],'',''],
	['PAGE','22976',jdecode('Trunnions'),jdecode(''),'/22976.html','true',[],'',''],
	['PAGE','22997',jdecode('Top+Covers'),jdecode(''),'/22997.html','true',[],'',''],
	['PAGE','23018',jdecode('Bolt+Latch'),jdecode(''),'/23018.html','true',[],'',''],
	['PAGE','23039',jdecode('Top+Plates+and+Latches'),jdecode(''),'/23039.html','true',[],'',''],
	['PAGE','23213',jdecode('Back+Plates%2FBuffers'),jdecode(''),'/23213.html','true',[],'',''],
	['PAGE','23234',jdecode('Casings'),jdecode(''),'/23234.html','true',[],'',''],
	['PAGE','23276',jdecode('Front+%26+Rear+Sights'),jdecode(''),'/23276.html','true',[],'',''],
	['PAGE','23513',jdecode('Bolt'),jdecode(''),'/23513.html','true',[],'',''],
	['PAGE','23534',jdecode('Barrel+Extension'),jdecode(''),'/23534.html','true',[],'',''],
	['PAGE','23555',jdecode('Lock+Frame'),jdecode(''),'/23555.html','true',[],'',''],
	['PAGE','23255',jdecode('Boosters+and+Flashhiders'),jdecode(''),'/23255.html','true',[],'',''],
	['PAGE','26513',jdecode('Belts+and+Links'),jdecode(''),'/26513.html','true',[],'',''],
	['PAGE','26534',jdecode('Tools+and+Accessories'),jdecode(''),'/26534.html','true',[],'',''],
	['PAGE','23297',jdecode('Resources'),jdecode(''),'/23297.html','true',[],'',''],
	['PAGE','23576',jdecode('Publications+for+Sale'),jdecode(''),'/23576.html','true',[],'',''],
	['PAGE','23913',jdecode('M1919A5'),jdecode(''),'/23913.html','true',[],'',''],
	['PAGE','23934',jdecode('M1919A6'),jdecode(''),'/23934.html','true',[],'',''],
	['PAGE','23955',jdecode('M1919A4E1'),jdecode(''),'/23955.html','true',[],'','']];
var siteelementCount=23;
theSitetree.topTemplateName='Welcome';
theSitetree.paletteFamily='336633';
theSitetree.keyvisualId='9178';
theSitetree.keyvisualName='kv_9178.jpg';
theSitetree.fontsetId='10364';
theSitetree.graphicsetId='10526';
theSitetree.contentColor='F9FE6F';
theSitetree.contentBGColor='336633';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Welcome',
				paletteFamily: 	'336633',
				keyvisualId: 	'9178',
				keyvisualName: 	'kv_9178.jpg',
				fontsetId: 		'10364',
				graphicsetId: 	'10526',
				contentColor: 	'F9FE6F',
				contentBGColor: '336633',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'7AA27A',
				e_color: 		'83D8B3',
				f_color: 		'66CC66',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1501',
internalId:  '',
customField: '20100429-085636'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22955',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12903',
internalId:  '',
customField: '20100514-151414'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22997',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22976',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22934',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22913',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23018',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23039',
internalId:  '',
customField: '20100429-175733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23213',
internalId:  '',
customField: '20100429-180154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23234',
internalId:  '',
customField: '20100429-180154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23255',
internalId:  '',
customField: '20100429-180154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23276',
internalId:  '',
customField: '20100429-180154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23297',
internalId:  '',
customField: '20100429-180154'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23513',
internalId:  '',
customField: '20100429-180940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23534',
internalId:  '',
customField: '20100429-180940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23555',
internalId:  '',
customField: '20100429-180940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23576',
internalId:  '',
customField: '20100429-180940'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23913',
internalId:  '',
customField: '20100501-101134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23934',
internalId:  '',
customField: '20100501-101134'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23955',
internalId:  '',
customField: '20100501-101134'
};
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7CU6T';
var companyName   = 'm1919tech.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();
};

