/* [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 theSitetree=[ 
	['PAGE','72',jdecode('Home'),jdecode(''),'/72.html','true',[],''],
	['PAGE','27158',jdecode('Company+History'),jdecode(''),'/27158.html','true',[],''],
	['PAGE','6999',jdecode('President%26%23x27%3Bs+Message'),jdecode(''),'/6999.html','true',[],''],
	['PAGE','23877',jdecode('Capabilities'),jdecode(''),'/23877.html','true',[],''],
	['PAGE','6792',jdecode('Products'),jdecode(''),'/6792/index.html','true',[ 
		['PAGE','6801',jdecode('SM+Items'),jdecode(''),'/6792/6801.html','true',[],''],
		['PAGE','6810',jdecode('Medium+Sized+Parts'),jdecode(''),'/6792/6810.html','true',[],''],
		['PAGE','6819',jdecode('Larger+Parts'),jdecode(''),'/6792/6819.html','true',[],'']
	],''],
	['PAGE','7017',jdecode('Our+team'),jdecode(''),'/7017.html','true',[],''],
	['PAGE','67501',jdecode('Need+a+Brochure%3F'),jdecode(''),'/67501.html','false',[],''],
	['PAGE','27217',jdecode('Have+Other+Request%3F'),jdecode(''),'/27217/index.html','true',[ 
		['PAGE','27293',jdecode('Request+%28follow+up+page%29'),jdecode(''),'/27217/27293.html','false',[],'']
	],''],
	['PAGE','30344',jdecode('How+to+find+us'),jdecode(''),'/30344.html','true',[],''],
	['PAGE','27302',jdecode('Directions'),jdecode(''),'/27302.html','true',[],'']];
var siteelementCount=14;
theSitetree.topTemplateName='Stylus';
theSitetree.paletteFamily='FFD375';
theSitetree.keyvisualId='1991';
theSitetree.keyvisualName='tastatur.jpg';
theSitetree.fontsetId='329';
theSitetree.graphicsetId='385';
theSitetree.contentColor='';
theSitetree.contentBGColor='';
var theTemplate={
				name: 			'Stylus',
				paletteFamily: 	'FFD375',
				keyvisualId: 	'1991',
				keyvisualName: 	'tastatur.jpg',
				fontsetId: 		'329',
				graphicsetId: 	'385',
				contentColor: 	'',
				contentBGColor: '',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'FFD375',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1001']=webappMappings['1001-ahw050in3rpf6855aa375cea3615']={
webappId:    '1001',
documentId:  '27217',
internalId:  'ahw050in3rpf6855aa375cea3615',
customField: ''
};
webappMappings['1001']=webappMappings['1001-ahw050in3rpf6855aa375cea3615']={
webappId:    '1001',
documentId:  '27293',
internalId:  'ahw050in3rpf6855aa375cea3615',
customField: 'followUp'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '27302',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '30344',
internalId:  'routing',
customField: 'en_US'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '72',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '72',
internalId:  '',
customField: '20080421-173431'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7017',
internalId:  '',
customField: '20090513-173850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6999',
internalId:  '',
customField: '20080421-190747'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6792',
internalId:  '',
customField: '20080421-190827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20080421-192936'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6810',
internalId:  '',
customField: '20090114-181104'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27158',
internalId:  '',
customField: '20080421-190658'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '23877',
internalId:  '',
customField: '20080421-192827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6819',
internalId:  '',
customField: '20080421-184542'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30344',
internalId:  '',
customField: '20061031-002923'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27302',
internalId:  '',
customField: '20061030-233629'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27217',
internalId:  '',
customField: '20080425-033249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27293',
internalId:  '',
customField: '20061030-233055'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '67501',
internalId:  '',
customField: '20090114-184214'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3RPF';
var companyName   = 'Oxnard+Precision+Fabrication';
var htmlTitle	  = 'Oxnard+Precision+Fabrication';
var metaKeywords  = 'metal+sheet+metal+fabrication+oxnard';
var metaContents  = 'Metal+ProductsSheet+Metal+Oxnard';
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();
};
