// Sets up the flyouts
/**
 * @author jheaven@acromediainc.com
 */
 
 var height=0;
 var width=0;
 function addLoadEvent(func){
	var oldOnLoad = window.onload;
	if(typeof window.onload != 'function'){ 
		window.onload = func;
	}
	else{ 
		window.onload = function(){ 
			oldOnLoad();
			func();
		}
	}
}

function setupFlyouts () {
	dropdowns = $$('li.flyout');
	dropdowns.each(function(dropdown, i) {
		dropdown.menu = dropdown.getElementsBySelector('ul')[0];
		dropdown.onmouseover = function () { 
		   width=dropdown.offsetWidth;
		   height=dropdown.offsetHeight;
			this.menu.style.display = 'block';
			
			height=-height;
		    this.menu.style.margin=''+height+'px 0px 0px '+(width)+'px';
		    
		  	    
		   
		    
		}
		dropdown.onmouseout = function () { 
			this.menu.style.display = 'none';
		}
		
	});
}


addLoadEvent(setupFlyouts);