
// Cuttlefish Dropdown Menu Plugin for jQuery
// Copyright: (c) 2010 Rasbora Media
// Created By: Rasbora Media
// Created On: 22 Jun 2010
// Updated On: 08 Jun 2011
// Version: 0.5.6 beta
// Requirments: jQuery

(function(jQuery){jQuery.fn.dropdown=function(options){var defaults={invert:false,fade:false};var options=jQuery.extend(defaults,options);return this.each(function(){var $object=jQuery(this);$object.children("li:has(ul)").children("a").addClass("hasdrop").append("<span class='hasdrop'></span>");jQuery("li",$object).each(function(index){var $li=jQuery(this);var $ul=$li.children("ul").first();if($ul.length>0){$li.mouseenter(function(){jQuery("a",this).first().addClass("hover");if(options.fade==true)$ul.fadeIn("fast");else $ul.show();var id=$ul.parents("ul").first().attr("id");if(id!=$object.attr("id")&&id!=undefined){if(options.invert==false)$ul.css("left",$ul.parent().width());else $ul.css("left","-"+$ul.width()+"px");}if(jQuery.browser.msie){var w=$ul.width();$ul.children("li").children("a").each(function(){var $a=jQuery(this);var p=($a.outerWidth()- $a.innerWidth())+parseInt($a.css("padding-left"),10)+parseInt($a.css("padding-right"),10);$a.width(w - p);});}});$li.mouseleave(function(){jQuery("a",this).first().removeClass("hover");if(options.fade==true)$ul.fadeOut("fast");else $ul.hide();});}});});};})(jQuery);
