/********************************************
*This js file is a set of function to extend*
*the jQuery as need for Emory University. It*
*is under copyright and may not be utilized *
*without written permission.                *
********************************************/

//Function for making Emory Utility Nav -- replaces YUI mousein/mouseout calls
/*********GENERAL SYNTAX***********
* <script type="text/javascript"> *
* $(document).ready(function() {  *
* $('#utilityNav').emoryMenu();   *
* });                             *
* </script>                       *
**********************************/
(function($){
	$.fn.extend({
	//plugin name - emoryMenu
		emoryMenu: function(options) {
			return this.each(function() {
				//Assign current element to variable, in this case is UL element
				var obj = $(this);
 
				$("li", obj).each(function(i) {
					$(this).css('position', 'absolution');
							})
				$("li", obj).hover(
					function () { 
							$(this).addClass('active');
							$(this).find("a.utilLink").addClass('active');
							$(this).find("div.flyOut").slideDown('fast').show();
						    }
						    ,
					function () { 
							$(this).removeClass('active');
							$(this).find("a.utilLink").removeClass('active');
							$(this).find("div.flyOut").hide(); 
						    }
						);
 
			});
		}
	});
})(jQuery);

//Function for inserting a passed variable as the first child of an element
(function($){
	$.fn.extend({
	//plugin name - emoryMenuInsert
		emoryMenuInsert: function(options) {
			return this.each(function() {
				//Assign current element to variable, in this case is UL element
				var obj = $(this);
				var html = options;
				obj.children(':first-child').before(html); 
			});
		}
	});
})(jQuery);
