"use strict";(function(b){var a=b.fn.customFormElements=function(d){var c=b(this);d=b.extend({checkboxHeight:25,radioHeight:25,selectWidth:190},d);c.each(function(){a.init(b(this),d)})};b.extend(a,{init:function(d,c){var e=d.attr("type");if(e=="checkbox"||e=="radio"){var f=d.hide().before("<span></span>").prev();f.addClass(e);if(d.attr("checked")){if(e=="checkbox"){f.css("backgroundPosition","0 -"+(c.checkboxHeight*2)+"px")}else{f.css("backgroundPosition","0 -"+(c.radioHeight*2)+"px")}}c=b.extend({},c,{element:d,styledElement:f});d.change(c,a.clear);if(!d.attr("disabled")){f.mousedown(c,a.pushed);f.mouseup(c,a.check);f.mouseout(c,a.clear)}else{f.addClass("disabled")}}else{}},pushed:function(e){var c=e.data.element.attr("type");var d=e.data.element.attr("checked");if(d){if(c=="checkbox"){e.data.styledElement.css("backgroundPosition","0 -"+(e.data.checkboxHeight*3)+"px")}else{e.data.styledElement.css("backgroundPosition","0 -"+(e.data.radioHeight*3)+"px")}}else{if(c=="checkbox"){e.data.styledElement.css("backgroundPosition","0 -"+(e.data.checkboxHeight)+"px")}else{e.data.styledElement.css("backgroundPosition","0 -"+(e.data.radioHeight)+"px")}}},check:function(e){var c=e.data.element.attr("type");var d=e.data.element.attr("checked");e.data.element.attr("checked",!d);if(c=="radio"){var f=e.data.element.attr("name");b("input[name="+f+"]").each(function(){b(this).prev().css("backgroundPosition","0 0")})}e.data.element.change()},clear:function(e){var c=e.data.element.attr("type");var d=e.data.element.attr("checked");if(d){if(c=="checkbox"){e.data.styledElement.css("backgroundPosition","0 -"+(e.data.checkboxHeight*2)+"px")}else{e.data.styledElement.css("backgroundPosition","0 -"+(e.data.radioHeight*2)+"px")}}else{if(c=="checkbox"){e.data.styledElement.css("backgroundPosition","0 0")}else{e.data.styledElement.css("backgroundPosition","0 0")}}}})})(jQuery);
