//	
	var oDropDownMenu = new function () {
		var menus = {};
		
		this.show = function (el, menu, arrow, cls, grp, lvl, evt) {
			StopEvent(evt);
			addDocEvent();
			this.hide(grp, lvl, false);
			
			el._prevClass = el.className;
			el.className += ' on';
			el.parentNode._on = true;
			
			menu.style.marginLeft = '-1000px'; //Fix para el ancho automatico
			menu.style.width = menu.scrollWidth + 'px';
			menu.style.marginLeft = '0px';
			
			if (lvl > 0) {
				opaque(grp, lvl - 1, true);
				
				arrow.style.display = 'block';
				arrow.style.marginTop = ((el.offsetHeight - arrow.offsetHeight) / 2) + 'px';
				arrow.style.marginLeft = (el.offsetWidth - (arrow.offsetWidth / 2)) + 'px';
				
				menu.style.marginTop = '-' + (el.offsetHeight) + 'px';
				menu.style.marginLeft = (el.offsetWidth + 5) + 'px';
				
				if (!!arrow._src) {
					arrow.src = arrow._src;
					try { delete arrow._src; } catch(e){ ; }
				}
				
				if (outOfScreen(menu, grp, lvl)) {
					arrow.style.marginLeft = '-' + (arrow.offsetWidth / 2) + 'px';
					arrow._src = arrow.src;
					arrow.src = arrow.src.substr(0, arrow.src.lastIndexOf('.')) + 'I' + arrow.src.substr(arrow.src.lastIndexOf('.'));
					
					menu.style.marginLeft = '-' + (menu.offsetWidth + 5) + 'px';
				}
			}
			else {
				if (outOfScreen(menu, grp, lvl)) {
					if (Nav.esIE7 || Nav.esIE6) { menu.style.marginLeft = '-' + (menu.offsetWidth + 5) + 'px'; }
					else { menu.style.marginLeft = '-' + (menu.offsetWidth - el.offsetWidth) + 'px'; }
				}
				else if (Nav.esIE7 || Nav.esIE6) { menu.style.marginLeft = '-' + (el.offsetWidth + 5) + 'px'; }
			}
			
			var from = 0, to = menu.scrollHeight, opa = 0;
			var anim = new Tween(menu.style, 'height', Tween.strongEaseOut, from, to, 0.5, 'px');
			anim.onMotionChanged = function (args) {
				if (from == 0) { opa = (args.target._pos / to * 100).toFixed(0); }
				else { opa = (args.target._pos / from * 100).toFixed(0); }
				setOpacity(opa, menu);
			}
			anim.onMotionFinished = function () {
				if (from == 0) {
					menu.style.overflow = 'visible';
					
					if (!window.innerWidth) { menu.style.filter = ''; }
					
					cls.style.display = 'block';
					w = (cls.offsetWidth / 2);
					cls.style.marginTop = '-' + (cls.offsetHeight / 2) + 'px';
					cls.style.marginLeft = ((!arrow._src)? (menu.offsetWidth - w) : '-' + w) + 'px';
				}
			}
			anim.start();
			
			if (!menus[grp]) { menus[grp] = []; }
			menus[grp][lvl] = {el: el, menu: menu, arrow: arrow, cls:cls, anim: anim};
		}
		
		this.hide = function (grp, lvl, evt) {
			if (evt) {
				StopEvent(evt);
				addDocEvent();
			}
			
			for(var x in menus) {
				var to = (x == grp)? lvl : 0;
				for(var i = menus[x].length - 1; i >= lvl; i--) {
					menus[x][i].anim.stop();
					menus[x][i].menu.style.overflow = 'hidden';
					menus[x][i].menu.style.height = '0px';
					menus[x][i].el.className = menus[x][i].el._prevClass;
					menus[x][i].arrow.style.display = 'none';
					menus[x][i].cls.style.display = 'none';
					
					if (i > 0) { opaque(x, i - 1, false); }
				}
			}
		}
		
		var opaque = function (grp, lvl, doIt) {
			if (!menus[grp] || !menus[grp][lvl]) { return false; }
			var els = menus[grp][lvl].menu.childNodes;
			for (var i = 0; i < els.length; i++) {
				if (!!els[i].tagName && !els[i]._on) {
					if (doIt) { setOpacity(40, els[i]); }
					else {
						if (!window.innerWidth) { els[i].style.filter = ''; }
						else { els[i].style.opacity = ''; }
					}
				}
			}
		}
		
		var outOfScreen = function (menu, grp, lvl) {
			var left = menu.offsetLeft + menu.offsetWidth;
			for (var i = lvl - 1; i >= 0; i--) { left += menus[grp][i].menu.offsetLeft; }
			return (left > document.documentElement.offsetWidth);
		}
		
		var docEvent = false, docTime = false;
		var addDocEvent = function () {
			if (!docEvent) {
				AddEvent(document, 'click', docEvent = function () {
					docTime = window.setTimeout(function(){
						oDropDownMenu.hide(0, 0, false);
						if (docEvent) { RemEvent(document, 'click', docEvent); }
						docEvent = false;
					}, 10);
				});
			}
			if (docTime) {
				window.clearTimeout(docTime);
				docTime = false;
			}
		}
		
		//
		
		var interval = false;
		
		this.showOver = function (el, menu, arrow, grp, lvl, evt, lateral) {
			StopEvent(evt);
			if (!!interval) {
				window.clearInterval(interval);
				interval = false;
			}
			
			hideOver(grp, lvl + 1);
			if (!!menus[grp] && !!menus[grp][lvl] && menus[grp][lvl].el.parentNode._on) {
				return false;
			}
			
			el.parentNode._on = true;
			
			menu.style.marginLeft = '-1000px'; //Fix para el ancho automatico
			menu.style.width = menu.scrollWidth + 'px';
			menu.style.marginLeft = '0px';
			
			if (lvl > 0 || lateral) {
				
				if(lvl > 0){
					opaque(grp, lvl - 1, true);
				}					
				arrow.style.display = 'block';

				arrow.style.marginTop = (((el.offsetHeight - arrow.offsetHeight) / 2)) + 'px';
				arrow.style.marginLeft = (el.offsetWidth - (arrow.offsetWidth / 2)) + 'px';

				menu.style.marginTop = '-' + (el.offsetHeight) + 'px';
				//menu.style.marginLeft = (el.offsetWidth) + 'px';
				
				if (!!arrow._src) {
					arrow.src = arrow._src;
					try { delete arrow._src; } catch(e){ ; }
				}
				
				if (outOfScreen(menu, grp, lvl)) {
					arrow.style.marginLeft = '-' + (arrow.offsetWidth / 2) + 'px';
					arrow._src = arrow.src;
					arrow.src = arrow.src.substr(0, arrow.src.lastIndexOf('.')) + 'I' + arrow.src.substr(arrow.src.lastIndexOf('.'));
					
					menu.style.marginLeft = '-' + (menu.offsetWidth) + 'px';
				}
		
			}
			else {
				//menu.style.marginTop = (el.offsetHeight) + 'px';
				if (outOfScreen(menu, grp, lvl)) {
					
					if (Nav.esIE7 || Nav.esIE6) { menu.style.marginLeft = '-' + (menu.offsetWidth + 5) + 'px'; }
					else { menu.style.marginLeft = '-' + (menu.offsetWidth - el.offsetWidth) + 'px'; }
				}
				else if (Nav.esIE7 || Nav.esIE6) {
					menu.style.marginLeft = '-' + (el.offsetWidth + 5) + 'px'; 
				}
			}
			
			
			var from = 0, to = menu.scrollHeight, opa = 0;
			var anim = new Tween(menu.style, 'height', Tween.strongEaseOut, from, to, 1, 'px');
			anim.onMotionChanged = function (args) {
				if (from == 0) { opa = (args.target._pos / to * 100).toFixed(0); }
				else { opa = (args.target._pos / from * 100).toFixed(0); }
				setOpacity(opa, menu);
			}
			anim.onMotionFinished = function () {
				if (from == 0) {
					menu.style.overflow = 'visible';
					
					if (!window.innerWidth) { menu.style.filter = ''; }
				}
			}
			anim.start();
			
			if (!menus[grp]) { menus[grp] = []; }
			menus[grp][lvl] = {el: el, menu: menu, arrow: arrow, anim: anim};
		}
		
		this.hideOver = function (grp, lvl, evt) {
			if (evt) { StopEvent(evt); }
			interval = window.setTimeout(function () { hideOver(grp, 0); }, 500);
		}
		
		var hideOver = function (grp, lvl) {
			for(var x in menus) {
				var to = (x == grp)? lvl : 0;
				for(var i = menus[x].length - 1; i >= to; i--) {
					if (!menus[x][i]) { continue; }
					
					menus[x][i].el.parentNode._on = false;
					menus[x][i].anim.stop();
					menus[x][i].menu.style.overflow = 'hidden';
					menus[x][i].menu.style.height = '0px';
					menus[x][i].arrow.style.display = 'none';
					
					if (i > 0) { opaque(x, i - 1, false); }
					
					delete menus[x][i];
				}
			}
			interval = false;
		}
		
		//
		
		this.showOver2 = function (el, menu, arrow, grp, lvl, evt, lateral, trigger) {
			StopEvent(evt);
			if (!!interval) {
				window.clearInterval(interval);
				interval = false;
			}
			
			hideOver2(grp, lvl + 1);
			if (!!menus[grp] && !!menus[grp][lvl] && menus[grp][lvl].el.parentNode._on) {
				if (menus[grp][lvl].el.id == el.id) {
					return false;
				}
				else {
					restore(grp, lvl);
					opaque(grp, lvl - 1, false);
				}
			}
			
			el.parentNode._on = true;
			
			menu.style.marginLeft = '-1000px'; //Fix para el ancho automatico
			
			if (!lateral) {
				var w = el.offsetWidth + ((trigger == 'arrow')? arrow.offsetWidth : 0);
				if (menu.scrollWidth > w) {
					menu.style.width = menu.scrollWidth + 'px';
					menu.style.marginLeft = '-' + ((menu.scrollWidth - w) / 2) + 'px';
				}
				else {
					menu.style.width = w + 'px';
					menu.style.marginLeft = '0px';
				}
			}
			
			if (!el._className) { el._className = el.className; }
			if (el.className != (el._className + ' on')) { el.className += ' on'; }
			
			if (!arrow._className) { arrow._className = arrow.className; }
			if (trigger == 'arrow' && arrow.className != (arrow._className + ' on')) { arrow.className += ' on'; }
			
			//
			var marginTop = el.parentNode.parentNode.firstChild.offsetTop;
			var marginLeft = el.offsetLeft;
			
			if (lateral) {
				
				if (lvl > 0) { opaque(grp, lvl - 1, true); }
				menu.style.marginTop = '-' + (el.offsetHeight) + 'px';
				menu.style.marginLeft = (el.offsetWidth) + 'px';
				
				if (outOfScreen(menu, grp, lvl)) {
					menu.style.marginLeft = '-' + (menu.offsetWidth) + 'px';
				}
			}
			else if (lvl > 0) {
				
				if (lvl > 0) { opaque(grp, lvl - 1, true); }
				
				menu.style.marginTop = '-' + (el.offsetHeight + marginTop) + 'px';
				menu.style.marginLeft = (el.offsetWidth + marginTop) + 'px';
				
				if (outOfScreen(menu, grp, lvl)) {
					menu.style.marginLeft = '-' + (menu.offsetWidth - marginLeft) + 'px';
				}
			}
			else {
			
				if (trigger == 'arrow') {
					try {
						var defConf = CufonMenuTop;
						defConf.color = defConf.colorOn;
						Cufon.replace(el, defConf);
					}
					catch(e) {}
				}
				
				menu.style.marginTop = (el.offsetHeight) + 'px';
				if (outOfScreen(menu, grp, lvl)) {
					
					if (Nav.esIE7 || Nav.esIE6) { menu.style.marginLeft = '-' + (menu.offsetWidth + (marginLeft * 2)) + 'px'; }
					else { menu.style.marginLeft = '-' + (menu.offsetWidth - el.offsetWidth) + 'px'; }
				}
				else if (Nav.esIE7 || Nav.esIE6) {
					menu.style.marginLeft = '-' + (menu.offsetWidth - (menu.offsetWidth - (el.offsetWidth + arrow.offsetWidth + (marginLeft * 2))) / 2) + 'px';
				}
			}
			
			
			var from = 0, to = menu.scrollHeight, opa = 0;
			var anim = new Tween(menu.style, 'height', Tween.strongEaseOut, from, to, 1, 'px');
			anim.onMotionChanged = function (args) {
				if (from == 0) { opa = (args.target._pos / to * 100).toFixed(0); }
				else { opa = (args.target._pos / from * 100).toFixed(0); }
				setOpacity(opa, menu);
			}
			anim.onMotionFinished = function () {
				if (from == 0) {
					menu.style.overflow = 'visible';
					
					if (!window.innerWidth) { menu.style.filter = ''; }
				}
			}
			anim.start();
			
			if (!menus[grp]) { menus[grp] = []; }
			menus[grp][lvl] = {el: el, menu: menu, arrow: arrow, anim: anim, trigger: trigger};
		}
		
		this.hideOver2 = function (grp, lvl, evt) {
			if (evt) { StopEvent(evt); }
			interval = window.setTimeout(function () { hideOver2(grp, 0); }, 500);
		}
		
		var hideOver2 = function (grp, lvl) {
			for(var x in menus) {
				var to = (x == grp)? lvl : 0;
				for(var i = menus[x].length - 1; i >= to; i--) {
					if (!menus[x][i]) { continue; }
					restore(x, i);
					if (i > 0) { opaque(x, i - 1, false); }
					
					delete menus[x][i];
				}
			}
			interval = false;
		}
		
		var restore = function (grp, lvl) {
			menus[grp][lvl].el.parentNode._on = false;
			menus[grp][lvl].el.className = menus[grp][lvl].el._className;
			menus[grp][lvl].anim.stop();
			menus[grp][lvl].menu.style.overflow = 'hidden';
			menus[grp][lvl].menu.style.height = '0px';
			menus[grp][lvl].menu.style.width = '';
			menus[grp][lvl].arrow.className = menus[grp][lvl].arrow._className;
			if (lvl == 0) {
				if (menus[grp][lvl].trigger == 'arrow') {
					try {
						var defConf = CufonMenuTop;
						defConf.color = defConf.colorOff;
						Cufon.replace(menus[grp][lvl].el, defConf);
					}
					catch(e) {}
				}
			}
		}
		
		this.stopHideOver2 = function (el, grp, lvl, evt) {
			if (!!menus[grp] && !!menus[grp][lvl] && menus[grp][lvl].el.parentNode._on && menus[grp][lvl].el.id == el.id) {
				StopEvent(evt);
				if (!!interval) {
					window.clearInterval(interval);
					interval = false;
				}
			}
		}
	};
	