jQuery.fn.checkbox = function() {

	object = jQuery(this);
	object.addClass('jcheckbox');
	//removing checkboxes
	object.find("input[type=checkbox]").each(function(){
		$(this).hide();
	});
	//adding images true false
	object.each(function(){
		if($(this).find("input[type=checkbox]").size()>0){
			$(this).prepend('<span class="checkbox-state"></span>');
			if($(this).find("input[type=checkbox]").attr('checked')){
				$(this).addClass('checked');
			}
			else{
				$(this).addClass('unchecked');
			}
		}
	});
	//binding onClick function
	object.find("span.checkbox-state").click(function(e){
		e.preventDefault();

		checkbox = $(this).parent().find("input[type=checkbox]");
		if(checkbox.attr('checked')){
			checkbox.attr('checked',false);
			$(this).parent().removeClass('checked').addClass('unchecked');
		}
		else{
			checkbox.attr('checked',true);
			$(this).parent().removeClass('unchecked').addClass('checked');
		}
	});

	//mouse over / out
	object.bind('mouseover', function(e){
		$(this).addClass('checkbox-hover');
	});
	object.bind('mouseout', function(e){
		$(this).removeClass('checkbox-hover');
	});
}
