jQuery.fn.confirm=function(a){a=jQuery.extend({msg:"Are you sure?",stopAfter:"never",wrapper:"<span></span>",eventType:"click",dialogShow:"show",dialogSpeed:"",timeout:0},a);a.stopAfter=a.stopAfter.toLowerCase();if(!a.stopAfter in["never","once","ok","cancel"])a.stopAfter="never";a.buttons=jQuery.extend({ok:"Yes",cancel:"No",wrapper:'<a href="#"></a>',separator:"/"},a.buttons);var d=a.eventType;return this.each(function(){var c=this,b=jQuery(c),h,j=jQuery(a.buttons.wrapper).append(a.buttons.ok).click(function(){a.timeout!=
0&&clearTimeout(h);b.unbind(d,e);b.show();f.hide();c._handlers!=undefined&&jQuery.each(c._handlers,function(){b.click(this.handler)});b.click();if(a.stopAfter!="ok"&&a.stopAfter!="once"){b.unbind(d);b.one(d,e)}return false}),i=jQuery(a.buttons.wrapper).append(a.buttons.cancel).click(function(){a.timeout!=0&&clearTimeout(h);a.stopAfter!="cancel"&&a.stopAfter!="once"&&b.one(d,e);b.show();f.hide();return false});if(a.buttons.cls){j.addClass(a.buttons.cls);i.addClass(a.buttons.cls)}var f=jQuery(a.wrapper).append(a.msg).append(j).append(a.buttons.separator).append(i),
e=function(){jQuery(this).hide();a.dialogShow!="show"&&f.hide();f.insertBefore(this);f[a.dialogShow](a.dialogSpeed);if(a.timeout!=0){clearTimeout(h);h=setTimeout(function(){i.click();b.one(d,e)},a.timeout)}return false};(function(){var g=jQuery.data(c,"events");if(!g&&c.href){b.bind("click",function(){document.location=c.href});g=jQuery.data(c,"events")}else if(!g)return;c._handlers=[];for(var k in g[d])c._handlers.push(g[d][k])})();b.unbind(d);c._confirm=e;c._confirmEvent=d;b.one(d,e)})};

