
var DropDownMenu = Class.create();

DropDownMenu.prototype = {

 initialize: function(menuElement) {
	menuElement.childElements().each(function(node){
		// if there is a submenu 
		var submenu = $A(node.getElementsByTagName("ul")).first();
		if(submenu != null){
			// make sub-menu invisible
			Element.extend(submenu).setStyle({display: 'none'});
			// toggle the visibility of the submenu
			node.onmouseover = function(){
				Element.toggle(submenu);
			}
			node.onmouseout = function(event){
				Element.toggle(submenu);
			}
		}
		var image = $A(node.getElementsByTagName("img")).first();
		Event.observe(image, "mouseover", function() {
			this.doHover();
		})
		Event.observe(image, "mouseout", function() {
			this.doDefault();
		})
	}); 
}

};