
/*****************************************************************************************
*
*      _                                                    _____________     __
*    /\ \                                                  /\_____   ____\   /\ \
*    \ \ \                                                 \/____/\  \___/   \ \ \
*     \ \ \                                                      \ \  \      _\_\ \___
*    __\_\ \    __    __    __  __      ___      __  _   __       \ \  \    /\___   ___\
*   /  __   \  /\ \  /\ \  /\ `'   \   / __'\   /\ `'  `'  \       \ \  \   \/___/\ \__/
*  /\  \L\   \ \ \ \_\_\ \ \ \ \/'\ \ /\ \L\ \_ \ \ \'\ \'\ \   ____\_\  \____   \ \ \
*  \ \_____,__\ \ \______ \ \ \_\\ \_\\ \____,_\ \ \_\ \_\ \_\ /\_____________\   \ \_\
*   \/____ /__/	\/_____/\ \ \/_/ \/_/ \/____/_/  \/_/\/_/\/_/ \/_____________/    \/_/
*                       \ \ \
*                      __\_\ \
*                    /\______/
*                    \/_____/
*
* Copyright 2009 dynamIt Technologies, LLC.
*
* The following code is for the exclusive use of dynamIt Technologies, LLC.
* Any use of this code with written permission from dynamIt is prohibited.
*
* Report an abuse of this copyright to
*	dynamIt Technologies, LLC
*	300 Marconi Boulevard, Suite 203
*	Columbus, Ohio 43215 USA
*	+1.614.538.0095
*
*****************************************************************************************/
/*****************************************************************************************
*
* author: 	Bobby Whitman
* date: 		March 25, 2009
* verson: 	1.0
*
* The following jQuery plugin will turn any nested unordered list into JavaScript
* drop-down menus. Simply include this js file in the <head> of your page and run with it.
*
* Example:
*
* XHTML:
* <ul id="nav">
*	<li><a href="#">About Us</a>
*	<ul>
*		<li><a href="/about-us/about">About</a></li>
*		<li><a href="/about-us/our-history">Our History</a></li>
*		<li><a href="/about-us/our-process">Our Process</a></li>
*	</ul></li>
* 	...
* </ul>
*
* JavaScript:
* $(document).ready(function() {
*	$("#nav").dynamItDrop();
* });
*
*****************************************************************************************/

(function($) {

	$.fn.dynamItDrop = function() {

		return this.each(function() {

			$(this).find('ul').addClass('opened');

			var to;
			var $shutDown = null;
			$(this).children('li').children('a').mouseover(function() {

				clearTimeout(to);
				$('ul.opened').hide();

				$shutDown = $(this).siblings('ul').show();
			}).mouseout(function() {
				$shutDown = $(this).siblings('ul');
				to = setTimeout(function() {
					closeme($shutDown);
				}, 1000);
			});

			$('ul.opened').mouseover(function() {
				clearTimeout(to);
			}).mouseout(function() {
				$shutDown = $(this);
				to = setTimeout(function() {
					closeme($shutDown);
				}, 1000);
			});

		});

	};

	function closeme(o) {
		o.hide();
	}

})(jQuery);