
// find out where we are
var domain = /\w+:\/\/[\w.-]+/;
var URI = document.URL.replace(domain,'');
var directory = URI.substring(0, URI.lastIndexOf('/')+1);
var fileName = URI.substring(URI.lastIndexOf('/')+1, URI.length);
var siteSection;

if (directory == '/') {
		siteSection = 'home';
} else {
		siteSection = directory.replace(/\x2F/g,'');	// 2F = hex for '/'
		if (siteSection == 'company' && fileName == 'contact.html') {
			siteSection = 'contact';
		}
}

var home = new Array();

var products = new Array(
	new Array('PRODUCTS',								'index.html'),
	new Array('ARC FAULT CIRCUIT BREAKER TESTER',		'mtp.html'),
	new Array('9141 / RS-232 CONVERTER',				'9141-232.html'),
	new Array('14230 / RS-232 CONVERTER',				'14230-232.html'),
	new Array('LIN / RS-232 CONVERTER',					'lin-232.html'),
	new Array('LIN / USB CONVERTER',					'lin-usb.html'),
	new Array('68HC908 Q SERIES PROGRAMMING ADAPTERS',	'adapters.html'),
	new Array('NOHAU PRODUCTS',							'nohau.html'),
	new Array('COSMIC PRODUCTS',						'cosmic.html'),
	new Array('VECTOR PRODUCTS',						'vector.html'),
	new Array('PRODUCT INFORMATION REQUEST',			'inforeq.html')
);

var engineering = new Array(
	new Array('ENGINEERING',				'index.html'),
	new Array('HARDWARE',					'hardware.html'),
	new Array('SOFTWARE',					'software.html'),
	new Array('PC INTERFACES',				'interfaces.html'),
	new Array('PHILOSOPHY',					'philosophy.html'),
	new Array('PROCESSORS',					'processors.html'),
	new Array('ANALOG',						'analog.html'),
	new Array('PCB LAYOUT',					'pcb.html'),
	new Array('SAMPLE PROJECTS',			'sample.html'),
	new Array('WHY HIRE A CONSULTANT?',		'why.html'),
	new Array('MOTOROLA DESIGN ALLIANCE',	'motorola.html'),
	new Array('TI THIRD-PARTY PROGRAM',		'TI.html')
);
	
var services = new Array(
	new Array('SERVICES',					'index.html'),
	new Array('TECHNICAL MARKETING',		'technical.html'),
	new Array('INTELLECTUAL PROPERTY',		'ip.html'),
	new Array('MANUFACTURING',				'manufacturing.html'),
	new Array('TESTING',					'testing.html')
);

// dmr Mar 31 2008 - removed the contact us and map sub-menus from company section
// and made the contact us just a simple menu item off of the left side main menu 
var company = new Array(
	new Array('INTRODUCTION',	'index.html'),
	new Array('JOIN US',		'jobs.html')  //,
//	new Array('CONTACT US',		'contact.html'),
//	new Array('MAP',			'JavaScript:popUpMap(\'http://maps.yahoo.com/py/maps.py?&country=us&addr=3550+W+Salt+Creek+Lane&city=Arlington+Heights&state=IL&zip=60005-5022&mag=3\')')
);


// no sub-menu required for contact us 
var contact = new Array();

// initialize variables pertaining to left sub-nav
var targets = new Array('home','engineering','services','products','company','contact');
var alts = new Array('Home','Engineering &amp; Design','Services','Products','Company','Contact Us');
var links = new Array('/', '/engineering/index.html', '/services/index.html', '/products/index.html', '/company/index.html', '/contact/index.html');
var condition = new Array('_over','_off');

// preload rollover images
for (i=0; i<targets.length; i++) {
	for (j=0; j<condition.length; j++) {
	eval(targets[i]+condition[j]+'=new Image');
	eval(targets[i]+condition[j]+'.src=\"/images/'+targets[i]+condition[j]+'.gif\"');
	}
}

// rollover functions
function Over (which) {
    document.images[which].src=('/images/'+ which +'_over.gif');
}
function Off (which) {
  	document.images[which].src=('/images/'+ which +'_off.gif');
}

// write the sub-navigation
function writeSubNav() {
	for (i=0; i<targets.length; i++) {
		if (targets[i] != siteSection) {
			document.write('<A HREF="' + links[i] + '" ONMOUSEOVER="Over(\'' + targets[i] + '\')" ONMOUSEOUT="Off(\'' + targets[i] + '\')"><IMG SRC="/images/' + targets[i] + '_off.gif" ALT="' + alts[i] + '" WIDTH="113" HEIGHT="20" BORDER="0" NAME="' + targets[i] + '"></A><BR>');
		} else {
			document.write('<IMG SRC="/images/' + targets[i] + '_on.gif" ALT="' + alts[i] + '" WIDTH="113" HEIGHT="20" BORDER="0" NAME="' + targets[i] + '"><BR>');
		}
	}
}

// write the current section navigation
function writeSectLinks() {
//	if (siteSection == 'contact') {
//		siteSection = 'company';
//	}
	section = eval(siteSection);
	for (var i=0; i<section.length; i++) {
		if (section[i][1] == fileName) {
			document.write(section[i][0] + '<BR><IMG SRC="/images/gray_rule.gif" ALT="*" WIDTH="140" HEIGHT="21" BORDER="0"><BR>');
		}else {
			document.write('<A HREF="' + section[i][1] + '">' + section[i][0] + '</A>' + '<BR><IMG SRC="/images/gray_rule.gif" ALT="*" WIDTH="140" HEIGHT="21" BORDER="0"><BR>');
		}
	}
}

// pop up window for map
function popUpMap(url){
	mapWindow = window.open (url,"map","width=1000,height=800,left=25,top=25,screenX=25,screenY=25,scrollbars=yes,toolbar=no");
}

function newWin(url){
	newWindow = window.open (url,"newWin","width=640,height=480,left=25,top=25,screenX=25,screenY=25,scrollbars=yes,toolbar=yes,location=yes,menubar=yes,resizable=yes,status=yes");
}