/* [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','33',jdecode('Home'),jdecode(''),'/33.html','true',[],''],
	['PAGE','45801',jdecode('Services'),jdecode(''),'/45801.html','true',[],''],
	['PAGE','81',jdecode('CAD'),jdecode(''),'/81/index.html','true',[ 
		['PAGE','50001',jdecode('Files+Supported'),jdecode(''),'/81/50001.html','true',[],'']
	],''],
	['PAGE','26301',jdecode('CAM'),jdecode(''),'/26301.html','true',[],''],
	['PAGE','117',jdecode('CNC+Verification'),jdecode(''),'/117.html','true',[],''],
	['PAGE','31601',jdecode('Workstation+PC%26%23x27%3Bs'),jdecode(''),'/31601.html','true',[],''],
	['PAGE','19501',jdecode('Gallery'),jdecode(''),'/19501.html','true',[],''],
	['PAGE','38201',jdecode('Contract+Machining'),jdecode(''),'/38201.html','false',[],''],
	['PAGE','33201',jdecode('FTP'),jdecode(''),'/33201.html','false',[],''],
	['PAGE','47301',jdecode('RFQ'),jdecode(''),'/47301.html','true',[],''],
	['PAGE','32101',jdecode('Contact+Us'),jdecode(''),'/32101.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2D50A1';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10399';
theSitetree.graphicsetId='10611';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2D50A1';
var theTemplate={
				name: 			'Draft',
				paletteFamily: 	'2D50A1',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10399',
				graphicsetId: 	'10611',
				contentColor: 	'FFFFFF',
				contentBGColor: '2D50A1',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'D09868',
				e_color: 		'9E9E9F',
				f_color: 		'051E56',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33',
internalId:  '',
customField: '20090426-001426'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '81',
internalId:  '',
customField: '20090426-004859'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26301',
internalId:  '',
customField: '20090426-005224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19501',
internalId:  '',
customField: '20090602-222619'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117',
internalId:  '',
customField: '20090914-103252'
};
webappMappings['7008']=webappMappings['7008-2868']={
webappId:    '7008',
documentId:  '47301',
internalId:  '2868',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38201',
internalId:  '',
customField: '20090406-205016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '33201',
internalId:  '',
customField: '20090407-230827'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50001',
internalId:  '',
customField: '20090425-214918'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47301',
internalId:  '',
customField: '20090518-154416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45801',
internalId:  '',
customField: '20090426-005047'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31601',
internalId:  '',
customField: '20090426-013214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32101',
internalId:  '',
customField: '20090518-154319'
};
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX3VO';
var companyName   = 'Vortec+Design';
var htmlTitle	  = 'Vortec+Design';
var metaKeywords  = 'Alibre%2C+Alibre+Design%2C+Parametric+Design%2C+CAD%2C+CAM%2C+CAD%2FCAM%2C+CAD%2FCAM+Trainer%2CCNC%2C+Contract+CNC+Programming%2C+CNC+Machinist%2C+Machine+Shop%2C+Predator%2C+Predator+Virtual+CNC%2C+Predator+CNC+Editor%2C+CAD%2FCAM+Consulting%2C+CAD%2FCAM+Training%2C+Mastercam%2C+Catia%2C+Pro%2FE%2C+Solidworks%2C+SolidEdge%2C+AutoCAD%2C+Inventor%2C+Predator%2C+Machining%2C+Milling%2C+Turning%2C+Swiss%2C+CNC+Zone.Com%2C+Engineering%2C+Reverse+Engineering%2C+HAAS%2C+Mazak%2C+Hardinge%2C+Bridgeport%2C+Screw+Machine%2C+Solid+Modeling%2C+Enshu%2C+Ikegai%2C+Dainichi%2C+Matsuura%2C+Fanuc%2C+Yasnac%2C+3D%2C+Solids%2C+3D+Solids%2C+3D+Assemblies';
var metaContents  = 'Vortec+Design+is+a+Contract+CAD%2FCAM+Service+specializing+in+3D+Parametric+Parts%2C+Assembly+Designs%2C+and+CNC+Programming.+We+work+with+popular+CAD+Formats+such+as+AutoCAD%2C+Catia%2C+Inventor%2C+Parasolid%2C+Pro+Engineer%2C+Rhino%2C+SolidEdge%2C+Solidworks%2C+DWG%2C+DXF%2C+IGES%2C+and+Step.';
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();
};
