function VMenu(target,prop_list){
	this.intervalID = new Number();
	this.props = prop_list;
	this.elem = document.getElementById(target);
	this.addMenu();
}

VMenu.prototype.menu_list = new Object();

VMenu.prototype.addMenu = function(){
	for(i in this.menu_list){
		if(i == this.elem.id){
			alert("Unable to create:\nObject already exist with name \""+i+"\".");
			return this.menu_list;
		}
	}
	this.menu_list[this.elem.id] = this;
	
	this.createMenu();
	return this.menu_list;
}

VMenu.prototype.createMenu = function(){
	this.container = document.createElement("div");
	this.container.className = "vMenu_main_container"
	this.container.style.display = "none";
	this.container.id = this.elem.id+"_m_cont";
	
	this.m_cont = document.createElement("div");	
	this.m_cont.className = "vMenu_cont";
	
	this.addMenuStart();
	this.addSubMenus();
	//this.addMenuEnd();
	
	this.container.appendChild(this.m_cont);
	this.elem.parentNode.insertBefore(this.container,this.elem);
	
	this.elem.elem_obj_ref = this;
	this.container.elem_obj_ref = this;
	this.m_cont.elem_obj_ref = this;	
	
	if(navigator.userAgent.indexOf("MSIE") != -1){
		var height 	= this.elem.getElementsByTagName("img")[0].height;
		this.container.style.top = height;
	}

	this.setFunctions();
}

VMenu.prototype.addSubMenus =function(){
	for(i=0;i<this.props.length;i++){
		var temp_div_elem = document.createElement("div");
		temp_div_elem.className = "vMenu_item";
		
		var temp_a_elem = document.createElement("a");
		temp_a_elem.innerHTML = "&nbsp;"+this.props[i];
		temp_a_elem.href = this.props[++i];
		temp_a_elem.target = this.props[++i];
		temp_a_elem.className = "vMenu_item_link";
		
		temp_div_elem.appendChild(temp_a_elem);
		this.m_cont.appendChild(temp_div_elem);
	}
	return this.m_cont;
}

VMenu.prototype.addMenuStart =function(){
	var temp_div_elem = document.createElement("div");
	temp_div_elem.className = "vMenu_start";

	this.m_cont.appendChild(temp_div_elem);
	return this.m_cont;
}

VMenu.prototype.addMenuEnd =function(){
	var temp_div_elem = document.createElement("div");
	temp_div_elem.className = "vMenu_end";

	this.m_cont.appendChild(temp_div_elem);
	return this.m_cont;
}

VMenu.prototype.setFunctions = function(){
	this.elem.onmouseover 		= this.showMenu;
	this.container.onmouseover = this.showMenu;
	this.container.onmouseout 	= this.hideMenu;
	this.elem.onmouseout 		= this.hideMenu;
}

VMenu.prototype.showMenu = function(e){
	var evt = e || window.event;
	evt.cancelBubble=true;
	this.elem_obj_ref.container.style.display = "inline";
}

VMenu.prototype.hideMenu = function(e){
	var evt = e || window.event;
	evt.cancelBubble = true;
	this.elem_obj_ref.container.style.display = "none";
	//document.VMenu_target = this.elem_obj_ref.container;
	//this.elem_obj_ref.intervalID = setTimeout(function(){ document.VMenu_target.style.display = "none";},100);
}