/* [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','251',jdecode('Home'),jdecode(''),'/251.html','true',[],''],
	['PAGE','272',jdecode('History'),jdecode(''),'/272/index.html','true',[ 
		['PAGE','5801',jdecode('CAB+PATTERNS'),jdecode(''),'/272/5801.html','true',[],'']
	],''],
	['PAGE','290',jdecode('Products'),jdecode(''),'/290/index.html','true',[ 
		['PAGE','299',jdecode('MACK+H61T'),jdecode(''),'/290/299.html','true',[],''],
		['PAGE','308',jdecode('MACK+H63T'),jdecode(''),'/290/308.html','true',[],''],
		['PAGE','10501',jdecode('MACK+H67T'),jdecode(''),'/290/10501.html','true',[],'']
	],''],
	['PAGE','17212',jdecode('Brockway+260'),jdecode(''),'/17212.html','true',[],''],
	['PAGE','12701',jdecode('GMC+H+9500'),jdecode(''),'/12701.html','true',[],''],
	['PAGE','13801',jdecode('Peterbuilt+COE'),jdecode(''),'/13801.html','true',[],''],
	['PAGE','14101',jdecode('Peterbuilt+281'),jdecode(''),'/14101.html','true',[],''],
	['PAGE','16312',jdecode('Peterbuilt+351'),jdecode(''),'/16312.html','true',[],''],
	['PAGE','12401',jdecode('Sterling+H'),jdecode(''),'/12401.html','true',[],''],
	['PAGE','13201',jdecode('ARCHIVE+%231'),jdecode(''),'/13201.html','true',[],''],
	['PAGE','326',jdecode('Contact'),jdecode(''),'/326.html','true',[],'']];
var siteelementCount=15;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='A4A4AC';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10553';
theSitetree.graphicsetId='10451';
theSitetree.contentColor='1d1d20';
theSitetree.contentBGColor='A4A4AC';
var theTemplate={
				name: 			'Akropolis',
				paletteFamily: 	'A4A4AC',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10553',
				graphicsetId: 	'10451',
				contentColor: 	'1d1d20',
				contentBGColor: 'A4A4AC',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'A4A4AC',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '251',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '251',
internalId:  '',
customField: '20090826-105906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '272',
internalId:  '',
customField: '20090725-122128'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20090724-210331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '290',
internalId:  '',
customField: '20091111-121706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '299',
internalId:  '',
customField: '20090728-094253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '308',
internalId:  '',
customField: '20090729-124415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10501',
internalId:  '',
customField: '20090729-181417'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '326',
internalId:  '',
customField: '20091111-120038'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12401',
internalId:  '',
customField: '20090730-143004'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12701',
internalId:  '',
customField: '20090730-144454'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13201',
internalId:  '',
customField: '20090801-132219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20090801-192647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14101',
internalId:  '',
customField: '20090805-202422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16312',
internalId:  '',
customField: '20090806-100744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17212',
internalId:  '',
customField: '20091205-195720'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050INVMF1';
var companyName   = '+DeHanes+Models+USA';
var htmlTitle	  = 'DeHanes+Models+USA';
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();
};

