$(document).ready(function() {	//hide the delegate information by default	if ( $('#delegate2').val() == 'enter name of optional 2nd delegate…' | $('#delegate2').val() == '' ) {		$('#delegate_form2').hide();	}	if ( $('#delegate3').val() == 'enter name of optional 3rd delegate…'  | $('#delegate3').val() == '' ) {		$('#delegate_form3').hide();	}	//hide the substitute delegate info by default	$('tr.substitute_primary_info1, tr.substitute_primary_info2, tr.substitute_primary_info3, tr.substitute_secondary_info1, tr.substitute_secondary_info2, tr.substitute_secondary_info3').hide();	//disable the submit button by default	$('#submit').attr('disabled','disabled').css( {'cursor':'default','border-color':'#f0f0f0','color':'#ccc'} );	//create default values for text boxes	if ( $('#delegate1').val() == '' ) {		$('#delegate1').val('enter name of 1st delegate…');	}	else {		$('#delegate_name1').html( $('#delegate1').val() );		}	if ( $('#delegate2').val() == '' ) {		$('#delegate2').val('enter name of optional 2nd delegate…');	}	else {		$('#delegate_name2').html( $('#delegate2').val() );		}	if ( $('#delegate3').val() == '' ) {		$('#delegate3').val('enter name of optional 3rd delegate…');	}	else {		$('#delegate_name3').html( $('#delegate3').val() );		}	$('#submitter').val('enter your name here…');	//delete the default text box text	$('#delegate1').focus(function() {		if ( $(this).val() == 'enter name of 1st delegate…' ) {			//set the value to ''			$(this).val('');		}	});	$('#delegate2').focus(function() {		if ( $(this).val() == 'enter name of optional 2nd delegate…' ) {			//set the value to ''			$(this).val('');		}	});	$('#delegate3').focus(function() {		if ( $(this).val() == 'enter name of optional 3rd delegate…' ) {			//set the value to ''			$(this).val('');		}	});	$('#submitter').focus(function() {		if ( $(this).val() == 'enter your name here…' ) {			//set the value to ''			$(this).val('');		}	});	//recreate the default values for text boxes or display the form with name	$('#delegate1').blur(function() {		//if the value is ''		if ( $(this).val() == '' ) {			//set the value to ''			$(this).val('enter name of 1st delegate…');		}		//if the value is not ''		else {			$('#delegate_name1').html( $(this).val() );		}	});	$('#delegate2').blur(function() {		if ( $(this).val() == '' ) {			//set the value to ''			$(this).val('enter name of optional 2nd delegate…');			$('#delegate_form2').hide();		}		//if the value is not ''		else {			//change the name			$('#delegate_name2').html( $(this).val() );			//display the form			$('#delegate_form2').show();		}	});	$('#delegate3').blur(function() {		if ( $(this).val() == '' ) {			//set the value to ''			$(this).val('enter name of optional 3rd delegate…');			$('#delegate_form3').hide();		}		else {			//change the name			$('#delegate_name3').html( $(this).val() );			//display the form			$('#delegate_form3').show();		}	});	$('#submitter').blur(function() {		if ( $(this).val() == '' ) {			//set the value to ''			$(this).val('enter your name here…');		}	});	//add click handler for society list box	$('#society_list').change(function() {		//if the value of the drop down is not ''		if ( $(this).val() != '' ) {			//replace the contents of span.state with the drop down's value			$('.state').html( $(this).val() );		}	});	//reset the chosen state on page load	if ( $('#society_list').val() != '' ) {		$('.state').html( $('#society_list').val() );	}	//show the first primary substitute info	$('input[name="attending1"]').click(function() {		if ( $(this).val() == 'no' ) {			$('tr.substitute_primary_info1').fadeIn('fast'); 		}		else {			$('tr.substitute_primary_info1').fadeOut('fast'); 			$('tr.substitute_secondary_info1').fadeOut('fast'); 		}	});	//show the first secondary substitute info	$('input[name="substitute1"]').click(function() {		if ( $(this).val() == 'yes' ) {			$('tr.substitute_secondary_info1').fadeIn('fast'); 		}		else {			$('tr.substitute_secondary_info1').fadeOut('fast'); 		}	});								 	//show the second primary substitute info	$('input[name="attending2"]').click(function() {		if ( $(this).val() == 'no' ) {			$('tr.substitute_primary_info2').fadeIn('fast'); 		}		else {			$('tr.substitute_primary_info2').fadeOut('fast'); 		}	});	//show the second secondary substitute info	$('input[name="substitute2"]').click(function() {		if ( $(this).val() == 'yes' ) {			$('tr.substitute_secondary_info2').fadeIn('fast'); 		}		else {			$('tr.substitute_secondary_info2').fadeOut('fast'); 		}	});								 	//show the third primary substitute info	$('input[name="attending3"]').click(function() {		if ( $(this).val() == 'no' ) {			$('tr.substitute_primary_info3').fadeIn('fast'); 		}		else {			$('tr.substitute_primary_info3').fadeOut('fast'); 		}	});	//show the third secondary substitute info	$('input[name="substitute3"]').click(function() {		if ( $(this).val() == 'yes' ) {			$('tr.substitute_secondary_info3').fadeIn('fast'); 		}		else {			$('tr.substitute_secondary_info3').fadeOut('fast'); 		}	});	//enable the submit button	$('#submitter').keyup(function() {		if ( $(this).val() != '' ) {			$('#submit').attr('disabled',false).css( {'cursor':'pointer','border-color':'#ccc','color':'#666'} );		}		else {			//disable the submit button			$('#submit').attr('disabled','disabled').css( {'cursor':'default','border-color':'#f0f0f0','color':'#ccc'} );		}	});});
