/* Copyright 2011 Dennis Ridder http://www.dennisridder.com - I would appreciate it if you keep this line intact when you use the code below. Thanks! */

jQuery(document).ready(function($) {
	
	$(".wpcf7 .styled input:checkbox").each(function(){
		$(this).hide().wrap('<span class="checkbox"/>');
	});
	
	$(".wpcf7 label").live('hover', function(){
	
		if ($(this).find(".checkbox").size() == 0)
			return;
			
		if ($("input:checkbox", this).is(":checked"))
		{
			$(this).find(".checkbox").css({'backgroundPosition': '0 -75px'});
		}
		else
		{
			$(this).find(".checkbox").css({'backgroundPosition': '0 -25px'});
		}
	},
	function(){
		if ($("input:checkbox", this).is(":checked"))
		{
			$(this).find(".checkbox").css({'backgroundPosition': '0 -50px'});
		}
		else
		{
			$(this).find(".checkbox").css({'backgroundPosition': '0 0'});
		}
	});
	
	$(".wpcf7 label").live('click', function(){
	
		if ($(this).find(".checkbox").size() == 0)
			return;
			
		if ($("input:checkbox", this).is(":checked"))
		{
			$("input:checkbox", this).attr('checked', false);
			$(this).find(".checkbox").css({'backgroundPosition': '0 0'});
		}
		else
		{
			$("input:checkbox", this).attr('checked', true);
			$(this).find(".checkbox").css({'backgroundPosition': '0 -50px'});
		}		
	});
	
	// $(".wpcf7-submit").click(function(){
		// alert($(this).closest("form").serialize());
	// });
	
});
