(function( $ ) {
	$.fn.customCheckbox = function(settings) {
		
		settings = $.extend({}, $.fn.customTextInput.defaults, settings);
		
		return this.each(function() {
			
			$(this).click(function() {
				if($(this).find("input").attr("checked") == true) {
					$(this).find("span").empty();
					$(this).find("input").attr("checked", false);
				} else {
					var img = document.createElement("img");
					$(img).attr("border", "0");
					$(img).attr("src", settings.iconSource);
					$(this).find("span").append($(img));
					$(this).find("input").attr("checked", true);
				}
			});
		});
		
	};
	
	$.fn.setChecked = function(iconSource) {
		var img = document.createElement("img");
		$(img).attr("border", "0");
		$(img).attr("src", iconSource);
		$(this).find("span").append($(img));
		$(this).find("input").attr("checked", true);
		return $(this);
	};

	
	$.fn.customCheckbox.defaults = {
			iconSource : ""
	};
	
})( jQuery );
