I'm working on a script that replaces checkbox and radios in a form with images. It works well in Firefox, Chrome, and Safari, but it has a minor issue in IE and Opera. The issue is that focus, blur, keyup, and click events are triggering a function that evaluates the status of the form elements, and the focus needs to be indicated if the site visitor is using a keyboard, but not when the site visitor is clicking with a mouse. When I click with a mouse, the events are in a different order in Opera and IE, and this is why there is a difference. I have to make sure I have focus events because of the keyboard usage, but a click triggers the focus event. So, I'm searching for ideas. Here's some sample code:

Code JavaScript:
// Checkboxes
if( $('[type="checkbox"]').length ){
	$('[type="checkbox"]').each(function(){
		$(this).parent('label').removeClass('c_on c_on_focus c_off_focus');
		if( $(this).is(':checked') ){
			$(this).parent('label').addClass('c_on');
			var on = true;
		}else{
			var on = false;
		}
		if( $(this).is(':focus') && e.type != 'click' ){
			(on) ? $(this).parent('label').addClass('c_on_focus') 
			: $(this).parent('label').addClass('c_off_focus');
		}else if( $(this).is(':focus') && e.type == 'click' && e.clientX == 0 && e.clientY == 0 ){
			(on) ? $(this).parent('label').addClass('c_on_focus') 
			: $(this).parent('label').addClass('c_off_focus');
		}
	});
}