(function(g){var h=function(f){if(!f)f=window.event;f.cancelBubble=true;f.stopPropagation&&f.stopPropagation()};g.fn.checkbox=function(f){try{document.execCommand("BackgroundImageCache",false,true)}catch(j){}var e={cls:"jquery-checkbox",empty:"empty.png"};e=g.extend(e,f||{});var i=function(a){var c=a.checked,d=a.disabled,b=g(a);a.stateInterval&&clearInterval(a.stateInterval);a.stateInterval=setInterval(function(){if(a.disabled!=d)b.trigger((d=!!a.disabled)?"disable":"enable");if(a.checked!=c)b.trigger((c=
!!a.checked)?"check":"uncheck")},10);return b};return this.each(function(){var a=this,c=i(a);a.wrapper&&a.wrapper.remove();a.wrapper=g('<span class="'+e.cls+'"><span class="mark"><img src="'+e.empty+'" /></span></span>');a.wrapperInner=a.wrapper.children("span:eq(0)");a.wrapper.hover(function(b){a.wrapperInner.addClass(e.cls+"-hover");h(b)},function(b){a.wrapperInner.removeClass(e.cls+"-hover");h(b)});c.css({position:"absolute",zIndex:-1,visibility:"hidden"}).after(a.wrapper);var d=false;if(c.attr("id")){d=
g("label[for="+c.attr("id")+"]");d.length||(d=false)}if(!d){d=c.closest?c.closest("label"):c.parents("label:eq(0)");d.length||(d=false)}if(d){d.hover(function(b){a.wrapper.trigger("mouseover",[b])},function(b){a.wrapper.trigger("mouseout",[b])});d.click(function(b){c.trigger("click",[b]);h(b);return false})}a.wrapper.click(function(b){c.trigger("click",[b]);h(b);return false});c.click(function(b){h(b)});c.bind("disable",function(){a.wrapperInner.addClass(e.cls+"-disabled")}).bind("enable",function(){a.wrapperInner.removeClass(e.cls+
"-disabled")});c.bind("check",function(){a.wrapper.addClass(e.cls+"-checked")}).bind("uncheck",function(){a.wrapper.removeClass(e.cls+"-checked")});g("img",a.wrapper).bind("dragstart",function(){return false}).bind("mousedown",function(){return false});window.getSelection&&a.wrapper.css("MozUserSelect","none");a.checked&&a.wrapper.addClass(e.cls+"-checked");a.disabled&&a.wrapperInner.addClass(e.cls+"-disabled")})}})(jQuery);