/**
 * Flight Centre Mega Menu
 *
 * @author          Richard Gustin
 * @modifiedby      $LastChangedBy$
 * @copyright       Copyright Flight Centre Ltd. All rights reserved.
 * @version         $Revision$
 * @lastmodified    $Date$
 * @requires        jQuery, jQuery.hoverIntent, jQuery.bgIframe 
 */

;FC.MEGAMENU =
{   
    name: 'FC.MEGAMENU',
    
    options: { },
    
    init: function( options )
    {
    	options = options || {};
    	defaultOptions = {
			sensitivity: 7,
	        interval: 30,
	        over: this.hoverOverMenu,
	        timeout: 100,
	        out: this.hoverOutMenu		
    	}
    	
        this.options = $.extend(defaultOptions, options);
        
        if ($('#megamenu'))
        {
            $('#megamenu li').hoverIntent( this.options );
            this.bgIframe();
        }
    },
    
    hoverOverMenu: function(e) {
        $(this).removeClass('closed');
    },
    
    hoverOutMenu: function(e) {
        $(this).addClass('closed');
    },
    
    bgIframe: function() 
    {
        $.each($('#megamenu .sub-menu'), function() 
        {
            $(this).bgIframe({ opacity:false, src: '' });
        });
    }
};
