define(["jquery"],function(d){var f=d.event.trigger;var e=Element.fire;var a=function(g){return g&&g.substr(0,6)==="xwiki:"};var b=function(g,i,j,o){var q=f(g,i,j,o);var p,k;if(g&&typeof(g)==="object"&&g.type){p=g;k=g.type}else{if(typeof(g)==="string"){k=g}}var h=p&&typeof(p.isPropagationStopped)==="function"&&p.isPropagationStopped();if(!h&&j&&a(k)){var n=d.isArray(i)?i[0]:i;var l=!o;var m=e(j,k,n,l);if(m.stopped&&p&&typeof(p.preventDefault)==="function"){p.preventDefault()}}return q};var c=function(l,j,i,h){var k=e(l,j,i,h);if(!k.stopped&&a(j)){var g=d.Event(j);var n=i?[i]:null;var m=h===undefined?false:!h;f(g,n,l,m);if(g.isDefaultPrevented()){k.stop()}}return k};d.event.trigger=b;Element.addMethods({fire:c});Object.extend(Event,{fire:c});Object.extend(document,{fire:c.methodize()})});