﻿/*
* jQuery clickoutside event - v1.0 - 2/27/2010
* http://benalman.com/projects/jquery-clickoutside-plugin/
* 
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($) { var a = $([]), e = document, c = "clickoutside", b = "click." + c + "-special-event"; $.event.special[c] = { setup: function() { a = a.add(this); if (a.length === 1) { $(e).bind(b, d) } }, teardown: function() { a = a.not(this); if (a.length === 0) { $(e).unbind(b) } }, add: function(f) { var g = f.handler; f.handler = function(i, h) { i.target = h; g.apply(this, arguments) } } }; function d(f) { $(a).each(function() { var g = $(this); if (this !== f.target && !g.has(f.target).length) { g.triggerHandler(c, [f.target]) } }) } })(jQuery);