
var ssTime = '9:15am';

function ss() {		
	document.write( ssTime );	
}

var study_table = new Array;

// xp | perl -ane ' BEGIN { $i = 1; } if ( /^\s*(\S+):\s*(.+)$/ ) { if ( $1 eq "Leader" ) { printf " ];\n study_table[ " . $i++ . " ] = ["; } printf( ", %c$2%c", 39, 39 ); } '

study_table[ 0 ] = [ 'Leader', 'Host', 'Location', 'Topic', 'Time' ];

study_table.push( [		'Kevin Binkley', 
						'David & Allie Timm', 
						'1340 22nd St NW', 
						'Basic Christian Living', 
						'Sundays @ 6pm' ] );
						
study_table.push( [		'David Murray', 
						'Dave & Marlene Murray', 
						'2580 North Ridge Ln NE', 
						'Basic Christian Living', 
						'Sundays @ 6pm' ] );
						
study_table.push( [		'Tom Hayden', 
						'Tom and Jan Hayden', 
						'2448 26th St NW', 
						'Philippians', 
						'Sundays @ 6pm' ] );
						
study_table.push( [		'Jeremy Luman', 
						'Josh and Amy Rhoades', 
						'1721 Northern Heights Dr NE', 
						'Basic Christian Living', 
						'Sundays @ 6pm' ] );
						
study_table.push( [		'Rocky Coleman', 
						'Brad and Stephanie Rawlins', 
						'2508 6th Ave NW', 
						'Basic Christian Living', 
						'Tuesdays @ 7pm ' ] );
						
study_table.push( [		'David Sundeen', 
						'MWBC Office', 
						'519 16th St SE', 
						'Your Life in Christ', 
						'Thursdays @ 6pm' ] );
						
/*

study_table.push( [		'Jeff Ubinger', 
						'Douglas Trail', 
						'VallyHigh Drive NW', 
						'Fellowship Ride (fellowship through bicycle riding)', 
						'Thursdays @ 6:45pm' ] );
						
study_table.push( [		'Stephanie Rawlins', 
						'Hy-Vee Barlow', 
						'1315 6th St NW', 
						'"A Morning Away" (breakfast and/or coffee, free childcare up to 2 hours)', 
						'Thursdays @ 9:30am' ] );
						
study_table.push( [		'Steve Melvin', 
						'Stuart & Pat Larson', 
						'1144 20th ST NE BYRON', 
						'"Defining Moments: When character matters most"', 
						'Sundays @ 6pm' ] );
						
study_table.push( [		'Kevin Binkley', 
						'Kevin & Heidi Binkley', 
						'5120 W River Road NW', 
						'"Defining Moments: When character matters most"', 
						'Sundays @ 6pm' ] );
						
*/

						
function buildHomeBibleStudyTable( makeForm ) {
	
	document.writeln( '<table class="sched">' );
	
	document.writeln( '	<tr>' );
	
	var studyLine = study_table[ 0 ];
	var count = studyLine.length;
	
	if ( makeForm ) {
		document.write( '<th> </th>' );
	}
	
	for ( var i = 0 ; i < count ; i++ ) {
	
		document.write( '<th> ' + studyLine[ i ] + ' </th>' );
	
	}
	
	document.writeln( '' );
	document.writeln( '	</tr>' );
	
	var rowCount = study_table.length;
	
	for ( var r = 1 ; r < rowCount ; r++ ) {
	
		document.writeln( '	<tr>' );
		
		var studyLine = study_table[ r ];
		var count = studyLine.length;
	
		if ( makeForm ) {
			document.write( '<td> ' + r + ' <input type="checkbox" id="BibleStudy' + r + '" name="BibleStudy' + r + '" value="Bible Study ' + r + ' interests me" /> </td>' );
		}
		
		for ( var i = 0 ; i < count ; i++ ) {
		
			document.write( '<td> ' + studyLine[ i ] + ' </td>' );
		
		}
		
		document.writeln( '' );
		document.writeln( '	</tr>' );
		
	}
	
	document.writeln( '	</tr>' );
	document.writeln( '</table>' );	

}


function confirmSubmit() {

	judc( 'confirmSubmit-' );
	
	var confirmationStringHeader = "Your Bible Study sign-up is nearly complete...\n\nCheck the data below and if it appears to be correct, press the \"OK\" button. If you have some corrections to make, press the \"Cancel\" button.\n\nDon't worry, if you need to make any changes, just sign-up again later and we'll note the second registration as a correction/update...\n\n";

	var confirmationString = '';
	
	// Personal Information
	
	confirmationString += "P E R S O N A L - I N F O R M A T I O N\n";
	confirmationString += "-- Name: " + $F( 'Name' ) + "\n";
	confirmationString += "-- Email: " + $F( 'Email' ) + "\n";
	confirmationString += "-- Phone: " + $F( 'Phone' ) + "\n\n";

	// Interests
	
	confirmationString += "B I B L E - S T U D Y - I N T E R E S T S\n";
	
	for ( var i = 1 ; i <= 3 ; i++ ) {
		if ( $F( 'Interests' + i ) ) {
			confirmationString += "-- Interests: " + $F( 'Interests' + i ) + "\n";
		}
	}
	
	confirmationString += "\n";

	// Social Interests
	
	confirmationString += "S O C I A L - P R E F E R E N C E S\n";
	
	for ( var i = 1 ; i <= 7 ; i++ ) {
		if ( $F( 'Social' + i ) ) {
			confirmationString += "-- Preferences: " + $F( 'Social' + i ) + "\n";
		}
	}
	
	confirmationString += "\n";

	// Schedule Availability
	
	confirmationString += "S C H E D U L E - A V A I L A B I L I T Y\n";
	
	var days = new Array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' );
	
	for ( var i = 0 ; i < days.length ; i++ ) {
		if ( $F( days[i] + 's' ) ) {
			confirmationString += "-- Available: " + $F( days[i] + 's' ) + '  ';
			var radioValue = juGetNodeValue( $( days[i] + 'Times' ) );
			if ( radioValue ) {
				confirmationString += radioValue;
			} else {
				confirmationString += '?';
			}
			confirmationString += "\n";
		}
	}
	
	confirmationString += "\n";

	// Current Study Interest
	
	confirmationString += "C U R R E N T - S T U D Y - I N T E R E S T\n";
	
	for ( var i = 1 ; i < study_table.length ; i++ ) {
		if ( $F( 'BibleStudy' + i ) ) {
			confirmationString += "-- Current Study: " + $F( 'BibleStudy' + i ) + "\n";
		}
	}
	
	confirmationString += "\n";

	// Comments
	
	if ( $F( 'Comments' ) ) {
		confirmationString += "C O M M E N T S\n";
		confirmationString += "-- Comments: " + $F( 'Comments' ) + "\n\n";
	}
	
	if ( confirm( confirmationStringHeader + confirmationString ) ) {
	
		var formElement = $('RegistrationPage');
		juSetNodeValue( formElement['verb'], 'verifyRegistrationPage' );
		juSetNodeValue( formElement['confirmationString'], confirmationString );
		formElement.submit();
		
	}
	
}



