//ClASS VSubMenu //////////////////////////////////////////////////////////////////////////////
VSubMenu = function (parent_element_id, items, item_links, w, background_color, on_item_backcolor, font_color, font_size, border_color)
{
	var oTable =  document.createElement('table');
	var oParent = null;
	
	//..........................................................................
	var self = this;
	self.IsOpen = false;
	self.HOffset = 0;
	self.VOffset = 0;
	self.Padding = 3;
	
	//..........................................................................
	oTable.id = "VSubMenu" + Math.round(Math.random() * 10000);
	oTable.cellPadding = 4;
	oTable.cellSpacing = 1;
	oTable.style.position = 'absolute';
	oTable.style.display = 'none';
	oTable.style.zIndex = "125";
	oTable.style.width = w + "px";
	oTable.style.color = font_color + "";
	oTable.style.backgroundColor = border_color + "";
	oTable.style.fontFamily = "Geneva, Arial, Helvetica, sans-serif";
	oTable.style.fontSize = font_size + "";
	oTable.style.border = "3px solid "+ border_color;
	oTable.onmouseover = function() { self.Show() };
	oTable.onmouseout = function() { self.Hide() };
	
	//..........................................................................
	for (var i=0; i<items.length; i++) {
		var o_row = oTable.insertRow(i);
		var o_cell = o_row.insertCell(0);
		o_row.style.backgroundColor = background_color + "";
		with (o_cell) {
			if (item_links[i] != "") {
				onmouseover = function() { 
					this.style.backgroundColor = on_item_backcolor + "";
					this.style.cursor = "pointer"; 
				}
				onmouseout = function() { 
					this.style.backgroundColor = "";
					this.style.cursor = "";
				}
				onclick = function() { 
					window.location.href = item_links[this.id]; 
				}
			}
			else {
				style.fontWeight = 'bold';
			}
			innerHTML = items[i];
			id = i;
		}
	}
	
	//=========================================================================
	self.onLoad = function ()
	{
		oParent = document.getElementById(parent_element_id);
		oParent.onmouseover = function() { self.Show() };
		oParent.onmouseout = function() { self.Hide() };
		document.body.appendChild(oTable);
	}
	
	addListener(window, "load", function () { self.onLoad(); }, false);
	
	//=========================================================================
	self.Paint = function ()
	{
		var parent_size = getElementSize(oParent);
		var parent_coords = getElementCoords(oParent);
		oTable.cellPadding = self.Padding;
		oTable.style.top = (parent_coords.Y + self.VOffset) + "px";
		oTable.style.left = (parent_coords.X + parent_size.Width + self.HOffset) + "px";
	}
	
	//=========================================================================
	var show_wanted = false;
	
	//=========================================================================
	self.Show = function() 
	{ 
		show_wanted = true;
		
		if(self.IsOpen) { return; } 
		
		self.Paint();
		changeOpacity(0, oTable.id);
		oTable.style.display = "block";
		opacity(oTable.id, 0, 100, 500, "slow") ;
		self.IsOpen = true;
	}
	//=========================================================================
	self.Hide = function() 
	{
		show_wanted = false;
		
		setTimeout( function() { 
						 if(show_wanted || !self.IsOpen) { return; } 
						 oTable.style.display = "none"; 	
						 self.IsOpen = false; 
						 },
						 500
					);
	}
}