var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

function cuaad_open()
{	cuaad_canceltimer();
	cuaad_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function cuaad_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function cuaad_timer()
{	closetimer = window.setTimeout(cuaad_close, timeout);}

function cuaad_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}

$(document).ready(function()
{	$('#cuaad > li').bind('mouseover', cuaad_open);
	$('#cuaad > li').bind('mouseout',  cuaad_timer);});

document.onclick = cuaad_close;

/* JQuery Plugin: "EqualHeights" & "EqualWidths"*/
jQuery.fn.equalHeights=function() {
	var maxHeight=0;

	this.each(function(){
		if (this.offsetHeight>maxHeight) {
			maxHeight=this.offsetHeight;
		}
	});

	this.each(function(){
		//$(this).height(maxHeight + "px");
		$(this).css("min-height", maxHeight + "px");
		if (this.offsetHeight>maxHeight) {
			//$(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
			$(this).css("min-height", (maxHeight-(this.offsetHeight-maxHeight))+"px");
		}
	});
};