
function pickOptions(whichOne) {
	//hide the lettering box, update the photo to the police version and show the lighting box
	$('#lettering').css('display','none');
	$('#lighting').css('display','block');
	if (whichOne == 'i2police') { $('#version').attr("src", "/remote/images/patrol/i2patroller-police.png"); }
	else if (whichOne == 'i2security') { $('#version').attr("src", "/remote/images/patrol/i2patroller-security.png"); }
	else if (whichOne == 'x2police') { $('#version').attr("src", "/remote/images/patrol/x2patroller-police.png"); }
	else if (whichOne == 'x2security') { $('#version').attr("src", "/remote/images/patrol/x2patroller-security.png"); }
	return false;
}
		
function returnFromLighting() {
	$('#lettering').css('display','block');
	$('#lighting').css('display','none');
	return false;
}




// menu init
var inMenu = 0;
var curLayer = "";
var curMenu = "";
var menuTimeout = null;

// mouseover image functions for menu item images
function menuItemOn(layerName) {
    clearTimeout(menuTimeout);
    inMenu = 1;
}

function menuItemOff(layerName) {
    inMenu = 0;
    menuTimeout = setTimeout("hideMenu(curLayer)", 50);
}

// show menu
function showMenu(layerName,menuName) {
	if (menuTimeout != null) {
		clearTimeout(menuTimeout);
		hideMenu(curLayer);
	}
	curMenu = menuName;
	eval('document.getElementById("'+layerName+'").style.visibility = "visible"');
	curLayer = layerName;
}

// hide menu
function hideMenu(layerName) {
	if (inMenu == 0) { eval('document.getElementById("'+layerName+'").style.visibility = "hidden"'); }
}

// mouse out timer
function setTimer() {
    // time after mouse moves away from menu heading before menu is hidden
	menuTimeout = setTimeout("timeUp()",150);
}

// check menu status and see if we should hide the last menu
function timeUp(child) {
	//if (typeof child.firstChild.name != 'undefined') { imgOff(child.firstChild.name); }
    if (inMenu == 0) {
        hideMenu(curLayer);
    }
}

function initiateMenus(menuContainer) {
	var menu = document.getElementById(menuContainer);   
	var menuRows = menu.getElementsByTagName("li");   
	for(i = 0; i < menuRows.length; i++){           
		menuRows[i].onmouseover = function() { 
			this.className='on';
			menuItemOn(this.offsetParent.offsetParent);
		};
		menuRows[i].onmouseout = function() {
			this.className='off';
			menuItemOff(this.offsetParent.offsetParent);
		};
	}
}
