var closetimer = 0;


function showDropdown(type)
	{
	cancelHide();
	obj = document.getElementById(type);
	var top = 0;
	var left = 6;
	if (obj.offsetParent)
		{
		do
			{
			left += obj.offsetLeft;
			top += obj.offsetTop;
			}
		while (obj = obj.offsetParent);
		}
	top = parseInt(top + 11);
	var sbw = 0;
	if (type == 'inventory')
		{
		var titles = ['Inventory','Cars','Pickups','Vans','Suvs','Other'];
		var fnames = ['inventory','cars','pickups','vans','suvs','other'];
		}
	else if (type == 'directions')
		{
		var titles = ['Main Lot - Luray','Lot #2 - Luray'];
		var fnames = ['lot1','lot2'];
		}
	else if (type == 'service')
		{
		var titles = ['Service Department','Schedule Appointment','Service Specials'];
		var fnames = ['service_department','service_request','service_specials'];
		}
	else if (type == 'rental')
		{
		var titles = ['Rental Vehicles','Request Reservation'];
		var fnames = ['rental_vehicles','rental_request'];
		}
	var len = titles.length;
	if (len > 0)
		{
		var menu = '';
		for (var x=0; x<len; x++)
			{
			if (type == 'inventory')
				{
				menu += '<li><a href=/cat_pages/' + fnames[x] + '_1.shtml>' + titles[x] + '</a></li>';
				}
			if (type == 'directions')
				{
				menu += '<li><a href=/docs/directions.shtml#' + fnames[x] + '>' + titles[x] + '</a></li>';
				}
			if (type == 'contacts')
				{
				menu += '<li><a href="mailto:' + titles[x] + '<' + fnames[x] + '>">Email &gt; ' + titles[x] + '</a></li>';
				}
			if ((type == 'service') || (type == 'rental'))
				{
				menu += '<li><a href=/docs/' + fnames[x] + '.shtml>' + titles[x] + '</a></li>';
				}
			}
		var height = document.getElementById(type).offsetHeight;
		top = top + (height / 2);
		document.getElementById('dropdown_items').innerHTML = menu;
		document.getElementById('dropdown').style.top =  top + 'px';
		document.getElementById('dropdown').style.left = left + 'px';
		document.getElementById('dropdown').style.display = 'block';
		}
	}

function hideMenu()
	{
	closetimer = window.setTimeout('hide()', 500);
	}

function hide()
	{
	document.getElementById('dropdown').style.display = 'none';
	}

function cancelHide()
	{
	if (closetimer)
		{
		window.clearTimeout(closetimer);
		closetimer = null;
		}
	}
