/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.1
 */
(function($){$.fn.extend({copyEvents:function(from){$.event.copy(from,this);return this;},copyEventsTo:function(to){$.event.copy(this,to);return this;},cloneWithEvents:function(deep){var r=this.clone(deep).copyEvents(this);if(deep!==false){var $this=this.find('*');r.find('*').each(function(i){$.event.copy($this[i],this);});}return r;}});$.event.copy=function(from,to){from=(from.jquery)?from:$(from);to=(to.jquery)?to:$(to);var events;if(!from.size()||!(events=from[0].events||from[0].$events)||!to.size())return;to.each(function(){for(var type in events)for(var handler in events[type])$.event.add(this,type,events[type][handler],events[type][handler].data);});};})(jQuery);
