/* [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','901',jdecode('Home'),jdecode(''),'/901.html','true',[],'',''],
	['PAGE','26001',jdecode('Winmax+Control'),jdecode(''),'/26001.html','true',[],'',''],
	['PAGE','973',jdecode('HURCO+3+%26+4+Axis'),jdecode(''),'/973.html','true',[],'',''],
	['PAGE','25127',jdecode('Hurco+5+Axis'),jdecode(''),'/25127.html','true',[],'',''],
	['PAGE','25146',jdecode('Hurco+VM+Series'),jdecode(''),'/25146.html','true',[],'',''],
	['PAGE','26901',jdecode('Accessories'),jdecode(''),'/26901.html','true',[],'',''],
	['PAGE','11101',jdecode('HURCO+LATHES'),jdecode(''),'/11101.html','true',[],'',''],
	['PAGE','1015',jdecode('ProtoTRAK'),jdecode(''),'/1015.html','true',[],'',''],
	['PAGE','19601',jdecode('ONA+Electro-Erosion'),jdecode(''),'/19601.html','true',[],'',''],
	['PAGE','9301',jdecode('HELMEL'),jdecode(''),'/9301.html','true',[],'',''],
	['PAGE','27301',jdecode('Order+a+brochure'),jdecode(''),'/27301.html','true',[],'',''],
	['PAGE','1078',jdecode('Contact'),jdecode(''),'/1078.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Metal';
theSitetree.paletteFamily='8D8C67';
theSitetree.keyvisualId='780';
theSitetree.keyvisualName='uhr.jpg';
theSitetree.fontsetId='146';
theSitetree.graphicsetId='153';
theSitetree.contentColor='F9FCD7';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Metal',
				paletteFamily: 	'8D8C67',
				keyvisualId: 	'780',
				keyvisualName: 	'uhr.jpg',
				fontsetId: 		'146',
				graphicsetId: 	'153',
				contentColor: 	'F9FCD7',
				contentBGColor: '000000',
				a_color: 		'8D8C67',
				b_color: 		'E4E2A7',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Times New Roman, Times, serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '901',
internalId:  '',
customField: '20100524-233822'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1078',
internalId:  '',
customField: '20100524-193310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '973',
internalId:  '',
customField: '20100524-233139'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1015',
internalId:  '',
customField: '20100524-210415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11101',
internalId:  '',
customField: '20100524-205548'
};
webappMappings['1501']=webappMappings['1501-7280549']={
webappId:    '1501',
documentId:  '901',
internalId:  '7280549',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25127',
internalId:  '',
customField: '20100524-205259'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25146',
internalId:  '',
customField: '20100524-204758'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19601',
internalId:  '',
customField: '20100524-210506'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9301',
internalId:  '',
customField: '20100524-210521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26001',
internalId:  '',
customField: '20100524-232600'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20100524-233227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27301',
internalId:  '',
customField: '20100524-234452'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INEDZQ';
var companyName   = 'D%26R+MACHINERY+EXCHANGE+L.L.C.';
var htmlTitle	  = 'DR+MACHINERY+EXCHANGE+L.L.C.';
var metaKeywords  = 'CNC%2C+Arizona%2C+Machine+Tools%2C+VMX%2C+VMC%2C+Turning%2C+lathe%2C+mill%2C+edm%2C+machining%2C+machinery%2C+DR+Machinery%2CHurco%2C+NTC%2C+Southwestern+Industries';
var metaContents  = 'Hurco%0D%0A%0D%0ASouthwestern+Industries%0D%0A%0D%0ATrak%0D%0A%0D%0AONA%0D%0A%0D%0AEDM%0D%0A%0D%0AConversatonal%0D%0A%0D%0ACNC%0D%0A%0D%0A';
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();
};
