$(document).ready( function()
{
	$('#book-form').corners("10px");
	$('.bf-lgroup').corners("10px");
	
	$('.toggled-off').each(	function() { hide_subject($(this).attr('name')); });
	$('.toggle-on').click( 	function() { show_subject($(this).attr('name')); });
	$('.toggle-off').click( function() { hide_subject($(this).attr('name')); });	
	
	$.alerts.overlayOpacity = 0.8;
	$.alerts.overlayColor = '#000000';
	
	$('.check-unchecked').bind( "click", function(e) 
								 { 
								
									if (check_unchecked() == false)
									{
									 	e.preventDefault();										
										jAlert('You must agree to all declarations before proceeding.', 'Problem');
										return false;
									}
									
									return true;
									
								 });
	
	$('.pop').bind("click", function(e)
							{
								e.preventDefault();
								window.open($(this).attr('href'),'tcwindow','scrollbars=yes,height=600,width=550');
								return false;
							});

	
});


function hide_subject(name)
{
	subject_id = name + "_details";
	$("label[for=" + subject_id + "]").addClass('hide');
	$("#" + subject_id).addClass('hide');
}

function show_subject(name)
{
	subject_id = name + "_details";
	$("label[for=" + subject_id + "]").removeClass('hide');
	$("#" + subject_id).removeClass('hide');
}

function check_unchecked()
{
	found_unchecked = false;	
	$('.must-check').each(	function()
							{
								if (!$(this).attr('checked')) found_unchecked = true;
							});
	
	if (found_unchecked == true) return false
	
	return true;
	
}

function show_partial_form()
{
	$('#full_form').hide();
	$('#partial_form').show();
}

function show_full_form()
{
	$('#partial_form').hide();
	$('#full_form').show();
}