
$(document).ready(function () {
	
	$("#fancyradio li > a").click(function (event) {
		// First disable the normal link click
		event.preventDefault();
		
     	// Remove all list and links active class.
		$('#fancyradio > li, #fancyradio > li a').removeClass("active");
		
		// Grab the link clicks ID
		var id = this.id;
		
		// The id will now be something like "link1"
		// Now we need to replace link with option (this is the ID's of the checkbox)
		var newselect = id.replace('link', 'option');
		
		// Make newselect the option selected.
		$('#'+newselect).attr('checked', true);

		// Now add active state to the link and list item
		$(this).addClass("active");
		$(this).parent().addClass("active");

		return false;
    });
	
	// Toggle Form so you can see it working
	$("a.toggleform").click(function (event){
		event.preventDefault();
		$('#fancyradioform').toggle("slow");

    });
	
});