(function(){function i(i){var r=$("."+settings.cloneClassName),u=n;$(r).each(function(){if(i||n==null){settings.onClose($(this));n=null,r.remove(),t&&($(t).removeData("dropDownAttached"),t=null)}})}var n=null,t=null,r=0;jQuery.closeDropDowns=function(){i(!0)},jQuery.fn.isDroppedDown=function(){return t?!0:!1},jQuery.fn.dropDown=function(r){function f(n){u||($(document).mousedown(function(n){$(n.target).data("dropDownAttached")||$(n.target).parent("a").data("dropDownAttached")||$(n.target).parents().hasClass(settings.cloneClassName)||i(!1)}),u=!0),$(n).each(function(){i(!0),e.call($(this))})}function e(){var i=$(settings.templateSelector).slice(0,1).clone(),s=$(this).offset(),h=$(settings.prependToDomSelector).offset(),r={left:s.left-h.left,top:s.top-h.top},u=$(this).height(),f,e;if(r.left=r.left,r.top=u+r.top,$(i).css({zIndex:settings.zIndex}),$(i).addClass(settings.cloneClassName),f=!1,$(this).each(function(){settings.onShow.call(this,i)==!1&&(f=!0)}),!f){if($(settings.prependToDomSelector).prepend($(i)),$(i).mouseout(function(){n=null}),$(i).mouseover(function(){n=$(this)}),e=settings.openAnim,settings.allowDropUp){var c=!1,l=$(window).scrollTop(),v=$(window).height(),o=$(i).height(),a=$("img",this).height();a>u&&(u=a),l<r.top-(o+u)&&l+v<r.top+o&&(c=!0),c&&(e=settings.openAnimUp,r.top-=o+u)}$(i).css({position:"absolute",left:r.left,top:r.top}),settings.animDuration&&$(i).animate(e,settings.animDuration),$(i).css({display:"block"}),t=$(this),$(this).data("dropDownAttached",!0)}}settings=jQuery.extend({onClose:function(){},onShow:function(){},templateSelector:".dropDownContent",cloneClassName:"dropDownClone",prependToDomSelector:"body",openAnim:{opacity:"show",height:"show"},openAnimUp:{opacity:"show"},closeAnim:{height:"hide"},animDuration:500,allowDropUp:!0,zIndex:2e3},r);var u=!1;f($(this))}})()