var delay = 100;
function find_pos_x(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	{
		curleft += obj.x;
	}
	return curleft;
}

function find_pos_y(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	{
		curtop += obj.y;
	}
	return curtop;
}

function menu_element(title, url)
{
	this.title = title;
	this.url = url;
}
function elements_container()
{
	this.elements = new Array();
	this.add = function(title, url)
	{
		this.elements.push(new menu_element(title, url));
	}
	this.output = function()
	{
		var output = '<div id="inventoryMenuContainer">';
		for(var i=0; i < this.elements.length; i++)
		{
			var onClick = ' onClick="document.location=\'' + this.elements[i].url + '\'"';
			var mouseOver = ' onMouseOver="this.style.background=\'#528BCC\'; this.style.color=\'#FFFFFF\';"';
			var mouseOut = ' onMouseOut="this.style.background=\'#DCDCDC\'; this.style.color=\'#0066CC\';"';
			
			output += '<div class="inventoryMenuItem"' + onClick + mouseOver + mouseOut + '><nobr>' + this.elements[i].title + '<img src="/images/blk_arrow.gif" alt="" /></nobr></div>';
		}
		output += '</div>';
		return output;
	}
}
function set_inventory_menu()
{
	var ne = new elements_container();
	ne.add('Farm Tractors', 'inventory.php?cid=1');
	ne.add('New Implements', 'inventory.php?cid=2');
	ne.add('Used Implements', 'inventory.php?cid=3');
	ne.add('Construction Equipment', 'inventory.php?cid=4');
	ne.add('Miscellaneous', 'inventory.php?cid=5');
	
	document.getElementById("inventoryMenu").innerHTML = ne.output();
}