var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;


if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}



var menuTop = 45;
var menuLeft = 400;

var domSMenu = null;
var oldDomSMenu = null;
var oldDomON = null;
var t = 0;
var lDelay = 6;
var lCount = 0;
var pause = 100;

function popMenu(menuNum,menuName){
	if (isDHTML) {
///// Sets the previous menu's visibility to hidden
		t = 2;
		if (oldDomSMenu) {
			newON = menuName
			oldDomSMenu.visibility = 'hidden'; 
			oldDomSMenu.zIndex = '0'; 
		    //eval('document.' + oldDomON + '.src="/home/images/nav_' + oldDomON + '.gif";');
			t = 2; 
			lCount = 0;
		}

		var idSMenu = 'menu' + menuNum;
		var domSMenu = findDOM(idSMenu,1);


///// Positions and shows the menu
		if (oldDomSMenu != domSMenu) {	
			//eval('document.' + menuName + '.src="/home/images/nav_' + menuName + 'ON.gif";');
			domSMenu.visibility = 'visible';
			domSMenu.zIndex = '100';
			oldDomSMenu = domSMenu;
			oldDomON = menuName;
		}

///// Resets oldDom if it is the same as the current DOM
		else { oldDomSMenu = null; }
	}

////// Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}

function delayHide() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0

    if ((oldDomSMenu) && (t == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
		
		//eval('document.' + oldDomON + '.src="/home/images/nav_' + oldDomON + '.gif";');
        oldDomSMenu.visibility = 'hidden'; 
        oldDomSMenu.zIndex = '0';
        oldDomSMenu = null;
        lCount = 0; 
        return false;
    }

///// Interupts the function if another menu is opened
    if (t == 2) { lCount = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again

    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay <= lCount) { t = 0; }
        if (lDelay >= lCount) { setTimeout('delayHide(' + t + ')',pause); }
    }
}

//chache images for image swaping
function preload() {

	if (document.images) {

	for(var countR = 0; countR < preload.arguments.length; countR += 2)
	{
		eval(preload.arguments[countR]+' = new Image()')
		eval(preload.arguments[countR]+'.src = "'+preload.arguments[countR + 1]+'"')
		}
	}
}

	function swap(x, y)
	{
   		document.images[x].src=eval(y+'.src');
	}
	
// cache images for quick swapping
//main navigation
preload('compon','images/btn_company_ON.gif',
	'compoff','images/btn_company.gif',
	'servon','images/btn_service_ON.gif',
	'servoff','images/btn_service.gif',
	'conton','images/btn_contact_ON.gif',
	'contoff','images/btn_contact.gif',
	'emplon','images/btn_employ_ON.gif',
	'emploff','images/btn_employ.gif');

//company navigation pop-out
preload('teamon','images/comp_team_ON.gif',
	'teamoff','images/comp_team.gif',
	'histon','images/comp_history_ON.gif',
	'histoff','images/comp_history.gif');

//services navigation pop-out
preload('invon','images/serv_invest_ON.gif',
	'invoff','images/serv_invest.gif',
	'seron','images/serv_serve_ON.gif',
	'seroff','images/serv_serve.gif',
	'proon','images/serv_protect_ON.gif',
	'prooff','images/serv_protect.gif',
	'polon','images/serv_police_ON.gif',
	'poloff','images/serv_police.gif',
	'suron','images/serv_surveil_ON.gif',
	'suroff','images/serv_surveil.gif');
	
	
// COMPANY NAV
var one = '<div id="menu1">';
one += '<table width="160" cellpadding="0" cellspacing="0" border="0">';
one += '<tr>';
one += '<td align="left" valign="top"><img src="images/space_bar.gif" width="160" height="28"><br>';
one += '<a href="management.html" onMouseOut="swap(\'team\', \'teamoff\'); t = 1; delayHide()" onMouseOver="swap(\'team\', \'teamon\'); t = 2;"  onClick="t = 0; delayHide();"><img src="images/comp_team.gif" width="160" height="18" border="0" name="team"></a><br>';
one += '<a href="history.html" onMouseOut="swap(\'hist\', \'histoff\'); t = 1; delayHide()" onMouseOver="swap(\'hist\', \'histon\'); t = 2;"  onClick="t = 0; delayHide();"><img src="images/comp_history.gif" width="160" height="18" border="0" name="hist"></a><br>';
one += '<img src="images/space_bar1.gif" width="160" height="65"><br>';
one += '</td>';
one += '</tr>';
one += '</table></div>';

// SERVICE NAV
var two  = '<div id="menu2"><table width="160" cellpadding="0" cellspacing="0" border="0">';
two += ' <tr>';
two  += '<td align="left" valign="top"><img src="images/space_bar.gif" width="160" height="28"><br>';
two  += '<a href="investigation.html" onMouseOver="swap(\'inv\', \'invon\', \'servNav\');  t = 2;"  onClick="t = 0; delayHide();" onMouseOut="swap(\'inv\', \'invoff\', \'servNav\'); t = 1; delayHide()"><img src="images/serv_invest.gif" width="160" height="18" border="0" name="inv"></a><br>';
two  += '<a href="proservices.html" onMouseOver="swap(\'ser\', \'seron\', \'servNav\');  t = 2;"  onClick="t = 0; delayHide();" onMouseOut="swap(\'ser\', \'seroff\', \'servNav\'); t = 1; delayHide()"><img src="images/serv_serve.gif" width="160" height="18" border="0" name="ser"></a><br>';
two  += '<a href="execprotection.html" onMouseOver="swap(\'pro\', \'proon\', \'servNav\');  t = 2;"  onClick="t = 0; delayHide();" onMouseOut="swap(\'pro\', \'prooff\', \'servNav\'); t = 1; delayHide()"><img src="images/serv_protect.gif" width="160" height="18" border="0" name="pro"></a><br>';
two  += '<a href="police.html" onMouseOver="swap(\'pol\', \'polon\', \'servNav\');  t = 2;"  onClick="t = 0; delayHide();" onMouseOut="swap(\'pol\', \'poloff\'); t = 1; delayHide()"><img src="images/serv_police.gif" width="160" height="18" border="0" name="pol"></a><br>';
two  += '<a href="surveillance.html" onMouseOver="swap(\'sur\', \'suron\', \'servNav\');  t = 2;"  onClick="t = 0; delayHide();" onMouseOut="swap(\'sur\', \'suroff\'); t = 1; delayHide()"><img src="images/serv_surveil.gif" width="160" height="18" border="0" name="sur"></a><br>';
two  += '<img src="images/space_bar2.gif" width="160" height="11"><br>';
two  += '</td>';
two  += '</tr>';
two  += '</table></div>';	

var three = '<div id="menu3"><img src="images/spc.gif" width="160" height="28"><br>';
three += '</div>';
	

	







