jQuery(document).ready(function() {
	var $radios = jQuery('.ait-headerType-option[type=radio]'),
		$checked = jQuery('.ait-headerType-option[type=radio]:checked'),
		$sections = jQuery('.ait-custom-fields-section').filter(function(index){
			if(index != 0) return this;
		});

	$sections.css({'display': 'none'});

	function switchThat($checked, $that, i){
		if($checked.val() == $that.val()){
			$radios.parent().css('font-weight', 'normal');
			$sections.filter('#ait-custom-fields-' + i).css({'display': ''});
			$that.parent().css('font-weight', 'bold');
		}
	}

	$radios.each(function(i){
		console.log(i);
		i += 2;
		var $that = jQuery(this);
		switchThat($checked, $that, i);

		$that.click(function(){
			$sections.css({'display': 'none'});
			$checked = jQuery(this);
			switchThat($checked, $that, i);
		});
	});
});