(function(A){A.fn.j3ssw=function(C){var B=this;var D=jQuery.extend({index:0,status:false,def:"j3sswdef",off:"j3sswoff",on:"j3sswon",mode:2,callback:function(G,E,H,F){}},C||{});return this.each(function(){var E=A(this);var G=D.def;var F;var I;var H;E.find(":radio").click(function(){var K=(I==A(this).val());var L=(H.attr("checked"));switch(D.mode){case 1:break;case 2:if(K){H.click()}break;case 3:if(K){if(!L){H.click()}else{A(this).removeAttr("checked");H.removeAttr("checked")}}else{A(this).attr("checked",true);H.removeAttr("checked")}break}F=E.find(":radio").filter(":checked");I=F.val();J(A(this))});B.getStatus=function(){return H.attr("checked")};B.getSelection=function(){return I};function J(L){var N=L.attr("id");var K=(I==L.val());var M=(H.attr("checked"));switch(D.mode){case 1:G=K?D.on:G;break;case 2:G=K?(M?D.off:D.on):G;break;case 3:G=K?(M?D.off:D.on):D.def;break}E.find("label").removeClass(D.on).removeClass(D.off).removeClass(D.def);E.find("label[for!='"+N+"']").addClass(D.def);E.find("label[for='"+N+"']").addClass(G);D.callback(I,H.attr("checked"),E.attr("id"),B)}E.prepend('<input type="checkbox">');E.find("input").css({position:"absolute",top:"-99999px",left:"-99999px"});E.find("label").addClass(D.def);E.find("label").hover(function(){A(this).css("cursor","pointer")},function(){A(this).css("cursor","default")});H=E.find(":checkbox").attr("checked",D.status);F=E.find(":radio").eq(D.index).attr("checked",true);I=F.val();J(F)})}})(jQuery);
