-
Notifications
You must be signed in to change notification settings - Fork 0
/
ham_simple.js
2394 lines (2182 loc) · 93.4 KB
/
ham_simple.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
var test_help;
var test_type = 'T';
var nz_header = 'New Zealand Amateur Radio Examination Practice (Question pool published March, 2010)';
var t_header = 'Technician Class Amateur Radio Practice Exam (Question pool published 3/7/2022)';
var g_header = 'General Class Amateur Radio Practice Exam (Question pool published 2/23/2007)';
var gn_header = 'General Class Amateur Radio Practice Exam (Question pool effective 7/1/2011 - 6/30/2015)';
var c1_header = 'Commercial License Element 1 Question pool';
var c2_header = 'Commercial License Element 3 Question pool';
var c5_header = 'Commercial License Element 5 Question pool';
var c7_header = 'Commercial License Element 7 Question pool';
var e_header = 'Extra Class Amateur Radio Practice Exam (Question pool published 7/1/2012)';
var cb_header = 'Canada Basic Amateur Radio Practice Exam (Question pool published April, 2007)';
var ca_header = 'Canada Advanced Amateur Radio Practice Exam (Question pool published April, 2007)';
//login panel location
element = 'login_top';
login_msg = 'Login to save scores and track your progress';
//Properties of the question set that don't change after init
var group_count = 0;
var group_offsets = [];
var subel_offsets = [];
var group_q_count = [];
var questions = [];
var total_questions = 0;
var element_count = 10;
//Array to randomly select groups
//Used to randomly select the group number
var groups_sel = [];
var question_sel = [];
//Fields of the current question
var q_sel_fields = [];
//Indicates that the passedseen data has come in for the user and has
//been added to the local copy
var psprocessed = 0;
var passedseen = [];
var ld_libs = '{% for lib in libs %}{{lib}}{% endfor %}';
function clearps(){
passedseen = new Array(total_questions);
for(var i = 0; i < total_questions; i += 1){
passedseen[i] = 0;
}
//alert('clearps: total_questions = ' + total_questions + ' passedseen.length = ' + passedseen.length);
}
function logout(){
//Landed in the outer logout
//alert('Landed in the outer logout');
//Clear things that belonged to the current user
psprocessed = 0;
clearps();
norm_logout();
document.getElementById('tabContent2').innerHTML =
'Login to see saved test scores'
}
function hideHelp(){
document.getElementById('help').style.zIndex=-1;
document.getElementById('help_inside').style.zIndex=-1;
}
function showHelp(){
document.getElementById('help').style.zIndex=2;
document.getElementById('help_inside').style.zIndex=3;
}
var splitter = '!';
//init_groups();
function new_test2( new_test_type ){
if(new_test_type == test_type){
return;
}
subel_study_enable = false;
new_test_b = true;
//If there are scores to be saved, then save them.
if(questions_answered > 0 && !scores_saved){
log_scores();
}
if(new_test_type == 'T'){
//Make the tech test highlighted, clear the others
$('Tsel').style.backgroundColor = "#888888"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
//Add the subelement buttons
add_subel_buttons();
}
else if(new_test_type == 'G'){
//Make the general test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#888888"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
add_subel_buttons();
}
else if(new_test_type == 'GN'){
//Make the general test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#888888"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
add_subel_buttons();
}
else if(new_test_type == 'E'){
//Make the extra test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#888888"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
add_subel_buttons();
}
else if(new_test_type == 'C1'){
//Make the extra test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#888888"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
else if(new_test_type == 'C2'){
//Make the extra test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#888888"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
else if(new_test_type == 'C5'){
//Make the extra test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#888888"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
else if(new_test_type == 'C7'){
//Make the extra test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#888888"
clear_subel_buttons();
}
else if(new_test_type == 'NZ'){
//Make the New Zealand test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#888888"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
else if(new_test_type == 'CB'){
//Make the New Zealand test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#888888"
$('CAsel').style.backgroundColor = "#333333"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
else if(new_test_type == 'CA'){
//Make the New Zealand test highlighted, clear the others
$('Tsel').style.backgroundColor = "#333333"
$('Gsel').style.backgroundColor = "#333333"
$('GNsel').style.backgroundColor = "#333333"
$('Esel').style.backgroundColor = "#333333"
$('NZsel').style.backgroundColor = "#333333"
$('CBsel').style.backgroundColor = "#333333"
$('CAsel').style.backgroundColor = "#888888"
$('C1sel').style.backgroundColor = "#333333"
$('C2sel').style.backgroundColor = "#333333"
$('C5sel').style.backgroundColor = "#333333"
$('C7sel').style.backgroundColor = "#333333"
clear_subel_buttons();
}
test_type = new_test_type;
test_initialize();
}
function test_click(){
alert('Clicked');
}
function new_group( qf2, qf3, sbel, subelg){
if(test_type == 'NZ')
{
return (qf3 != subelg);
}
else{
return (qf2 != sbel || qf3 != subelg);
}
}
function init_groups(){
//login_user = '{{ uid }}';
questions = test_qs.split(splitter);
//alert(questions.length + ' questions');
//Walk the question set and record it's propertys
var group_index = -1;
var subel_index = 0;
var q_count = 0;
var subel = '';
var subelgroup = '';
qftest = questions[0].split('|');
//alert('ql ' + questions.length + ' two ' + qftest[2] + ' three ' + qftest[3]);
for(var j = 0; j < questions.length - 1; j += 1){
q_fields = questions[j].split('|');
//if(q_fields[3] != subelgroup){
if(new_group(q_fields[2], q_fields[3], subel, subelgroup)){
//alert(questions.length + ' ' + q_fields[2] + ' ' + q_fields[3] + ' ' + group_count);
group_index += 1;
//Record the offset
group_offsets[group_index] = j;
//Initialize the question count
group_q_count[group_index] = 1;
//Increment the group count
//alert('Last group was ' + subelgroup);
group_count += 1;
//Track subelement offsets as well
if(q_fields[2] != subel){
subel_index += 1;
subel_offsets[subel_index] = j;
}
//Update placeholders to look for next subelement and group
subel = q_fields[2];
subelgroup = q_fields[3];
total_questions += 1;
}
else{
//another question in the group
group_q_count[group_index] += 1;
total_questions += 1;
}
}//Closes questions for loop
//alert('total_q ' + total_questions);
//alert('group_c ' + group_count);
//Initilize the passedseen structure
//alert('tq = ' + total_questions + ' ql ' + questions.length);
//alert('question count before clearps is ' + total_questions);
clearps();
//alert('Found ' + group_count + ' groups with ' +
// group_q_count[0] + ' ' + group_q_count[1] +
// ' ' + group_q_count[5] + '...');
}
function init_test_structs(){
//Setup the random group choser
groups_sel = new Array(group_count);
question_sel = new Array(group_count);
for(var i = 0; i < group_count; i += 1){
groups_sel[i] = i;
//Setup the random question choosers
question_sel[i] = new Array(group_q_count[i]);
//one entry per question in the group
for(var k = 0; k < group_q_count[i]; k += 1){
question_sel[i][k] = k;
}
}
}
var new_test_b = false;
var r_chosen = [];
var question_structure;
var questions_done = 0;
var subelement;
var group;
var qnum;
var rqnum;
var q2test = 0;
var correct = 'A';
var first_answer = 1;
var questions_answered = 0;
var raw_test_score = 0;
var questions_asked = 0;
var s_test_score = 0.0;
var s_test_accuracy = 0.0;
var sing_test = false;
var subel = [];
var subel_count = [];
var stQuery = 'http://spreadsheets.google.com/pub?key=pvFXGB-79Kl338aI6gFPzJQ&gid=0&pub=1';
var stAction = 'http://spreadsheets.google.com/formResponse?key=pvFXGB-79Kl338aI6gFPzJQ';
var login_db = 'http://spreadsheets.google.com/pub?key=pvFXGB-79Kl2JkNT5hLmiJA&gid=0&pub=1';
var login_form = 'http://spreadsheets.google.com/formResponse?key=pvFXGB-79Kl2JkNT5hLmiJA';
var question_count = 60;
var subel_prefix = 'NZ';
var subel_label = 'T1';
for(var i = 0; i < 60; i+=1){
subel_count[i] = 10;
}
var in_exam = true;
//Used to track current question number for passedseen tracking
var abs_qnum = 0;
//google.load("visualization", "1");
//google.setOnLoadCallback(test_initialize);
function uiSetup(){
}
var full_question_count = 0;
function test_initialize(){
//alert('Registerd setup handler');
//Determine which test we're in and setup accordingly
//test_help = nz_test_help;
document.getElementById('next_question').value = 'Next Question';
document.getElementById('next_question').disabled = true;
total_questions = 0;
element_count = 10;
if(test_type == 'NZ'){
test_help = nz_test_help;
test_qs = nz_test_qs;
question_count = 60;
full_question_count = 60;
score_row_count = 60;
element_count = 60;
subel_prefix = 'NZ';
splitter = '!';
$('test_header').innerHTML = nz_header;
clear_subel_buttons();
}
else if(test_type == 'T'){
test_help = t_test_help;
test_qs = t_test_qs;
question_count = 35;
full_question_count = 35;
score_row_count = 10;
subel_prefix = 'T';
splitter = '&';
$('test_header').innerHTML = t_header;
add_subel_buttons();
setup_subel_count('T');
}
else if(test_type == 'G'){
test_help = g_test_help;
test_qs = g_test_qs;
question_count = 35;
full_question_count = 35;
score_row_count = 10;
subel_prefix = 'G';
splitter = '&';
$('test_header').innerHTML = g_header;
add_subel_buttons();
setup_subel_count('GN');
}
else if(test_type == 'GN'){
test_help = gn_test_help;
test_qs = gn_test_qs;
question_count = 35;
full_question_count = 35;
score_row_count = 10;
subel_prefix = 'GN';
splitter = '&';
$('test_header').innerHTML = gn_header;
add_subel_buttons();
setup_subel_count('GN');
}
else if(test_type == 'C1'){
test_help = c1_test_help;
test_qs = c1_test_qs;
question_count = 24;
score_row_count = 4;
element_count = 4;
subel_prefix = '1';
splitter = '!';
$('test_header').innerHTML = c1_header;
clear_subel_buttons();
}
else if(test_type == 'C2'){
test_help = c2_test_help;
test_qs = c2_test_qs;
question_count = 100;
score_row_count = 17;
element_count = 17;
subel_prefix = '1';
splitter = '!';
$('test_header').innerHTML = c2_header;
clear_subel_buttons();
}
else if(test_type == 'C5'){
test_help = c5_test_help;
test_qs = c5_test_qs;
question_count = 100;
score_row_count = 2;
element_count = 2;
subel_prefix = '5';
splitter = '!';
$('test_header').innerHTML = c5_header;
clear_subel_buttons();
}
else if(test_type == 'C7'){
test_help = c7_test_help;
test_qs = c7_test_qs;
question_count = 100;
score_row_count = 10;
element_count = 10;
subel_prefix = '7';
splitter = '!';
$('test_header').innerHTML = c7_header;
clear_subel_buttons();
}
else if(test_type == 'E'){
test_help = e_test_help;
test_qs = e_test_qs;
question_count = 50;
full_question_count = 50;
score_row_count = 10;
subel_prefix = 'E';
splitter = '&';
$('test_header').innerHTML = e_header;
add_subel_buttons();
setup_subel_count('E');
}
else if(test_type == 'CB'){
test_help = cb_test_help;
test_qs = cb_test_qs;
question_count = 100;
score_row_count = 8;
subel_prefix = 'CB';
splitter = '&';
$('test_header').innerHTML = cb_header;
clear_subel_buttons();
}
else if(test_type == 'CA'){
test_help = ca_test_help;
test_qs = ca_test_qs;
question_count = 50;
score_row_count = 7;
subel_prefix = 'CA';
splitter = '&';
$('test_header').innerHTML = ca_header;
clear_subel_buttons();
}
group_offsets.clear();
questions_done = 0;
first_answer = 1;
correct = 'A';
q2test = 0;
questions_answered = 0;
questions_asked = 0;
raw_test_score = 0;
s_test_score = 0.0;
s_test_accuracy = 0.0;
group_count = 0;
group_offsets.clear();
subel_offsets.clear();
group_q_count.clear();
questions.clear();
total_questions = 0;
//Array to randomly select groups
//Used to randomly select the group number
groups_sel.clear();
question_sel.clear();
//Fields of the current question
q_sel_fields.clear();
init_groups();
//clearps();
//psprocessed = 0;
//Indicates that the passedseen data has come in for the user and has
//been added to the local copy
//passedseen.clear();
psprocessed = 0;
show_results();
init_test_structs();
initialize_test_scores();
init_score();
toggleTab(1,5);
//new_study_form();
start_test();
}
function start_test() {
questions_done = 0;
question_getter('Next Question');
}
var group_num = 0;
var group_index = 0;
var question_num = 0;
var quesiton_index = 0;
var scores_saved = false;
function debug_test(){
FB.ui(
{
method: 'stream.publish',
message: 'Just passed the technician class ham radio practice exam on Ham Shack from Copasetic Flows http://copaseticflows.appspot.com/hamtest',
user_message_prompt: 'Congratulations you passed the exam! Tell your friends!'
}
);
}
function invite_friends(){
//If there are scores to be saved, then save them.
if(questions_answered > 0 && !scores_saved){
log_scores();
}
FB.ui(
{
method: 'fbml.dialog',
display: 'dialog',
fbml: (
'<fb:fbml>'+
'<fb:request-form '+
'action="http://copaseticflows.appspot.com/hamtest" '+
'method="GET" '+
'invite="true" '+
'type="Ham Radio Practice Exams" '+
'content="You can study for your amateur radio license exam on Facebook! Track your scores and build customized tests! <fb:req-choice url=\'http://apps.facebook.com/fcctech\' label=\'Accept\'/>" '+
'<fb:multi-friend-selector max="20" actiontext="Invite your friends to practice for the amateur radio license exams." rows="4">' +
'<fb:request-form-submit import_external_friends="false" />'+
'</fb:request-form>'+
'</fb:fbml>'
)
},
function(response) {
alert('Thanks and Have Fun!');
});
}
function fb_tech_passed(){
var app_link = 'http://apps.facebook.com/fcctech';
var media = [
{
type: 'image',
src: 'img/techprep.png',
href: app_link
}
];
var attachment = {
name: 'Just passed the technician class ham radio practice exam',
href: app_link,
caption: 'Studying for my ham radio license',
media: media
}
FB.ui(
{
method: 'stream.publish',
attachment: attachment
}
);
}
function qso_mapped(){
var qso_message = rx_mirror_call + ' de ' + tx_mirror_call;
if(mikm == 0){
qso_message += ' ' + Number(distance/1609.344).toFixed(2) + ' miles ';
}else{
qso_message += ' ' + Number(distance/1000).toFixed(2) + ' kms ';
}
FB.ui(
{
method: 'stream.publish',
message: qso_message,
user_message_prompt: 'Nice QSO! Tell your friends!'
}
);
}
function fb_general_passed(){
var app_link = 'http://apps.facebook.com/fcctech';
var media = [
{
type: 'image',
src: 'img/genprep.png',
href: app_link
}
];
var attachment = {
name: 'Just passed the general class ham radio practice exam',
href: app_link,
caption: 'Studying for my ham radio license',
media: media
}
FB.ui(
{
method: 'stream.publish',
attachment: attachment
}
);
}
function fb_extra_passed(){
var app_link = 'http://apps.facebook.com/fcctech';
var media = [
{
type: 'image',
src: 'img/extraprep.png',
href: app_link
}
];
var attachment = {
name: 'Just passed the extra class ham radio practice exam',
href: app_link,
caption: 'Studying for my ham radio license',
media: media
}
FB.ui(
{
method: 'stream.publish',
attachment: attachment
}
);
}
function fb_cb_passed(){
FB.ui(
{
method: 'stream.publish',
message: 'Just passed the Canada Basic ham radio practice exam on Ham Shack from Copasetic Flows http://copaseticflows.appspot.com/hamtest',
user_message_prompt: 'Congratulations you passed the exam! Tell your friends!'
}
);
}
function fb_ca_passed(){
FB.ui(
{
method: 'stream.publish',
message: 'Just passed the Canada Advanced ham radio practice exam on Ham Shack from Copasetic Flows http://copaseticflows.appspot.com/hamtest',
user_message_prompt: 'Congratulations you passed the exam! Tell your friends!'
}
);
}
function debugqsel(){
//alert('group_index ' + group_index + ' ' +
// 'group_num ' + group_num + ' ' +
// 'question_index ' + question_index + ' ' +
// 'question_num ' + question_num + ' ');
//alert('goup_offset ' + group_offsets[group_num]);
alert('total_questions ' + total_questions);
var passedseen_str = '';
for(var i=0; i < total_questions; i+=1){
passedseen_str += passedseen[i] + '|';
}
var score_str_d = '';
for(var k = 0; k < score_row_count; k += 1){
score_str_d += subel[k] + '|';
}
alert('passedseen length = ' + passedseen.length);
alert(passedseen_str);
alert('new_test_b ' + new_test_b);
alert('score_row_count = ' + score_row_count + ' subel length ' + subel.length);
alert(score_str_d);
//alert('test_type ' + test_type + ' total questions ' + total_questions + ' group count ' + group_count);
//alert('group_offsets length ' + group_offsets.length + ' questions length ' + questions.length);
//alert('asked ' + questions_asked + ' count ' + question_count);
//alert('About to log scores');
//log_scores();
}
function save_score(){
if(login_user != ''){
log_scores();
}
else{
alert('You must be logged in to save scores');
}
}
function cull_unseenpassed( seenpass ){
//use passedseen array to remove questions from the
//random selection that have already been seen or passed
//Walk the groups and remove quesitons
//There are as many entries in group_offsets as there are groups
for(var i=0; i < group_offsets.length; i += 1){
//Determine if there are enough questions >1 to populate the test
unculled = 0;
for(var k=0; k < group_q_count[i]; k += 1){
if(passedseen[group_offsets[i] + k] < seenpass){
unculled += 1;
}
}
if(unculled > 0){
//Cull the group
for(var k=0; k < group_q_count[i]; k += 1){
if(!(passedseen[group_offsets[i] + k] < seenpass)){
//search the group until the question is found
//and then splice it out
for(var m=0; m < question_sel[i].length; m += 1){
if(questions_sel[i][m] == k){
questions_sel[i].splice(m, 1);
//Now that the question is removed, get out and start over
break;
}
}
}
}//Done culling the group
}//The group had something to cull
}//Done stepping through the groups
}
//global variables to carry around subelement study information
var subel_study_enable = false;
var subel_study_num = 0;
//use questions_asked to step through the subelement questions
//use subel_offsets to get the first and last question number
//along with questions.length for the last question for element 0
var subel_study_firstq = 0;
var subel_study_lastq = 0;
var subel_study_qnum = 0;
function subel_button(subel_num){
//return the string for a button that will start the specified subelement test
return '<input type="button" value="' + subel_prefix + subel_num + '" onclick="toggleTab(1,5); start_subel(' + subel_num + ')">';
}
function get_sub_labels(){
if(test_type == 'GN' || test_type == 'G'){
return gsub_labels;
}
if(test_type == 'T'){
return tsub_labels;
}
if(test_type == 'E'){
return esub_labels;
}
}
function add_subel_buttons(){
var stButtons = '';
//stButtons += '';
//alert(stButtons);
//Now display the subelement titles
var sub_lab = get_sub_labels();
for(var i=0; i<10; i+=1){
stButtons += '<div style="border-top: 1px solid #666666; ">';
stButtons+=subel_button(i);
stButtons += sub_lab[i] + '</div><br>';
}
$('subdiv').innerHTML = stButtons;
}
function clear_subel_buttons(){
$('subdiv').innerHTML = '';
}
var tsub_labels = [];
var tgroup_labels = [];
var gsub_labels = [];
var ggroup_labels = [];
var esub_labels = [];
var egroup_labels = [];
tsub_labels[0] = 'SUBELEMENT T0 - AC power circuits, antenna installation, RF hazards';
tsub_labels[1] = 'SUBELEMENT T1 - FCC Rules, descriptions and definitions for the amateur radio service, operator and station license responsibilities';
tsub_labels[2] = 'SUBELEMENT T2 - Operating Procedures';
tsub_labels[3] = 'SUBELEMENT T3 - Radio wave characteristics, radio and electromagnetic properties, propagation modes';
tsub_labels[4] = 'SUBELEMENT T4 - Amateur radio practices and station setup';
tsub_labels[5] = 'SUBELEMENT T5 - Electrical principles, math for electronics, electronic principles, Ohm\'s Law';
tsub_labels[6] = 'SUBELEMENT T6 - Electrical components, semiconductors, circuit diagrams, component functions';
tsub_labels[7] = 'SUBELEMENT T7 - Station equipment, common transmitter and receiver problems, antenna measurements and troubleshooting, basic repair and testing';
tsub_labels[8] = 'SUBELEMENT T8 - Modulation modes, amateur satellite operation, operating activities, non-voice communications';
tsub_labels[9] = 'SUBELEMENT T9 - Antennas, feedlines';
tgroup_labels[0] = 'T1A - Amateur Radio services; purpose of the amateur service, amateur-satellite service, operator/primary station license grant, where FCC rules are codified, basis and purpose of FCC rules, meanings of basic terms used in FCC rules';
tgroup_labels[1] = 'T1B - Authorized frequencies; frequency allocations, ITU regions, emission type, restricted sub-bands, spectrum sharing, transmissions near band edges';
tgroup_labels[2] = 'T1C - Operator classes and station call signs; operator classes, sequential, special event, and vanity call sign systems, international communications, reciprocal operation, station license licensee, places where the amateur service is regulated by the FCC, name and address on ULS, license term, renewal, grace period';
tgroup_labels[3] = 'T1D - Authorized and prohibited transmissions';
tgroup_labels[4] = 'T1E - Control operator and control types; control operator required, eligibility, designation of control operator, privileges and duties, control point, local, automatic and remote control, location of control operator ';
tgroup_labels[5] = 'T1F - Station identification and operation standards; special operations for repeaters and auxiliary stations, third party communications, club stations, station security, FCC inspection';
tgroup_labels[6] = 'T2A - Station operation; choosing an operating frequency, calling another station, test transmissions, use of minimum power, frequency use, band plans';
tgroup_labels[7] = 'T2B - VHF/UHF operating practices; SSB phone, FM repeater, simplex, frequency offsets, splits and shifts, CTCSS, DTMF, tone squelch, carrier squelch, phonetics';
tgroup_labels[8] = 'T2C -Public service; emergency and non-emergency operations, message traffic handling';
tgroup_labels[9] = 'T3A - Radio wave characteristics; how a radio signal travels; distinctions of HF, VHF and UHF; fading, multipath; wavelength vs. penetration; antenna orientation';
tgroup_labels[10] = 'T3B - Radio and electromagnetic wave properties; the electromagnetic spectrum, wavelength vs. frequency, velocity of electromagnetic waves ';
tgroup_labels[11] = 'T3C - Propagation modes; line of sight, sporadic E, meteor, aurora scatter, tropospheric ducting, F layer skip, radio horizon';
tgroup_labels[12] = 'T4A - Station setup; microphone, speaker, headphones, filters, power source, connecting a computer, RF grounding';
tgroup_labels[13] = 'T4B - Operating controls; tuning, use of filters, squelch, AGC, repeater offset, memory channels';
tgroup_labels[14] = 'T5A - Electrical principles; current and voltage, conductors and insulators, alternating and direct current';
tgroup_labels[15] = 'T5B - Math for electronics; decibels, electronic units and the metric system';
tgroup_labels[16] = 'T5C - Electronic principles; capacitance, inductance, current flow in circuits, alternating current, definition of RF, power calculations';
tgroup_labels[17] = 'T5D - Ohm\'s Law';
tgroup_labels[18] = 'T6A - Electrical components; fixed and variable resistors, capacitors, and inductors; fuses, switches, batteries';
tgroup_labels[19] = 'T6B - Semiconductors; basic principles of diodes and transistors';
tgroup_labels[20] = 'T6C - Circuit diagrams; schematic symbols';
tgroup_labels[21] = 'T6D - Component functions';
tgroup_labels[22] = 'T7A - Station radios; receivers, transmitters, transceivers';
tgroup_labels[23] = 'T7B - Common transmitter and receiver problems; symptoms of overload and overdrive, distortion, interference, over and under modulation, RF feedback, off frequency signals; fading and noise; problems with digital communications interfaces';
tgroup_labels[24] = 'T7C - Antenna measurements and troubleshooting; measuring SWR, dummy loads, feedline failure modes';
tgroup_labels[25] = 'T7D - Basic repair and testing; soldering, use of a voltmeter, ammeter, and ohmmeter';
tgroup_labels[26] = 'T8A - Modulation modes; bandwidth of various signals';
tgroup_labels[27] = 'T8B - Amateur satellite operation; Doppler shift, basic orbits, operating protocols';
tgroup_labels[28] = 'T8C - Operating activities; radio direction finding, radio control, contests, special event stations, basic linking over Internet';
tgroup_labels[29] = 'T8D - Non-voice communications; image data, digital modes, CW, packet, PSK31';
tgroup_labels[30] = 'T9A - Antennas; vertical and horizontal, concept of gain, common portable and mobile antennas, relationships between antenna length and frequency';
tgroup_labels[31] = 'T9B - Feedlines; types, losses vs. frequency, SWR concepts, matching, weather protection, connectors';
tgroup_labels[32] = 'T0A - AC power circuits; hazardous voltages, fuses and circuit breakers, grounding, lightning protection, battery safety, electrical code compliance';
tgroup_labels[33] = 'T0B - Antenna installation; tower safety, overhead power lines';
tgroup_labels[34] = 'T0C - RF hazards; radiation exposure, proximity to antennas, recognized safe power levels, exposure to others';
gsub_labels[0] = 'SUBELEMENT G0 - ELECTRICAL AND RF SAFETY';
gsub_labels[1] = 'SUBELEMENT G1 - COMMISSION\'S RULES';
gsub_labels[2] = 'SUBELEMENT G2 - OPERATING PROCEDURES ';
gsub_labels[3] = 'SUBELEMENT G3 - RADIO WAVE PROPAGATION ';
gsub_labels[4] = 'SUBELEMENT G4 - AMATEUR RADIO PRACTICES';
gsub_labels[5] = 'SUBELEMENT G5 - ELECTRICAL PRINCIPLES';
gsub_labels[6] = 'SUBELEMENT G6 - CIRCUIT COMPONENTS';
gsub_labels[7] = 'SUBELEMENT G7 - PRACTICAL CIRCUITS';
gsub_labels[8] = 'SUBELEMENT G8 - SIGNALS AND EMISSIONS';
gsub_labels[9] = 'SUBELEMENT G9 - ANTENNAS AND FEED LINES';
ggroup_labels[0] = 'G1A - General Class control operator frequency privileges; primary and secondary allocations';
ggroup_labels[1] = 'G1B - Antenna structure limitations; good engineering and good amateur practice; beacon operation; restricted operation; retransmitting radio signals';
ggroup_labels[2] = 'G1C - Transmitter power regulations; data emission standards';
ggroup_labels[3] = 'G1D - Volunteer Examiners and Volunteer Examiner Coordinators; temporary identification';
ggroup_labels[4] = 'G1E - Control categories; repeater regulations; harmful interference; third party rules; ITU regions';
ggroup_labels[5] = 'G2A Phone operating procedures; USB/LSB utilization conventions; procedural signals; breaking into a QSO in progress; VOX operation';
ggroup_labels[6] = 'G2B - Operating courtesy; band plans, emergencies, including drills and emergency communications';
ggroup_labels[7] = 'G2C - CW operating procedures and procedural signals, Q signals and common abbreviations; full break in';
ggroup_labels[8] = 'G2D - Amateur Auxiliary; minimizing interference; HF operations';
ggroup_labels[9] = 'G2E - Digital operating: procedures, procedural signals and common abbreviations';
ggroup_labels[10] = 'G3A - Sunspots and solar radiation; ionospheric disturbances; propagation forecasting and indices';
ggroup_labels[11] = 'G3B - Maximum Usable Frequency; Lowest Usable Frequency; propagation';
ggroup_labels[12] = 'G3C - Ionospheric layers; critical angle and frequency; HF scatter; Near Vertical Incidence Sky waves';
ggroup_labels[13] = 'G4A - Station Operation and setup';
ggroup_labels[14] = 'G4B - Test and monitoring equipment; two-tone test';
ggroup_labels[15] = 'G4C - Interference with consumer electronics; grounding; DSP';
ggroup_labels[16] = 'G4D - Speech processors; S meters; sideband operation near band edges';
ggroup_labels[17] = 'G4E - HF mobile radio installations; emergency and battery powered operation';
ggroup_labels[18] = 'G5A - Reactance; inductance; capacitance; impedance; impedance matching';
ggroup_labels[19] = 'G5B - The Decibel; current and voltage dividers; electrical power calculations; sine wave root-mean-square (RMS) values; PEP calculations';
ggroup_labels[20] = 'G5C - Resistors, capacitors and inductors in series and parallel; transformers';
ggroup_labels[21] = 'G6A - Resistors; capacitors; inductors';
ggroup_labels[22] = 'G6B - Rectifiers; solid state diodes and transistors; vacuum tubes; batteries';
ggroup_labels[23] = 'G6C - Analog and digital integrated circuits (IC\'s); microprocessors; memory; I/O devices; microwave IC\'s (MMIC\'s ); display devices';
ggroup_labels[24] = 'G7A - Power supplies; schematic symbols';
ggroup_labels[25] = 'G7B - Digital circuits; amplifiers and oscillators';
ggroup_labels[26] = 'G7C - Receivers and transmitters; filters, oscillators';
ggroup_labels[27] = 'G8A - Carriers and modulation: AM; FM; single and double sideband; modulation envelope; overmodulation';
ggroup_labels[28] = 'G8B - Frequency mixing; multiplication; HF data communications; bandwidths of various modes; deviation';
ggroup_labels[29] = 'G9A - Antenna feed lines: characteristic impedance and attenuation; SWR calculation, measurement and effects; matching networks';
ggroup_labels[30] = 'G9B - Basic antennas';
ggroup_labels[31] = 'G9C - Directional antennas';
ggroup_labels[32] = 'G9D - Specialized antennas';
ggroup_labels[33] = 'G0A - RF safety principles, rules and guidelines; routine station evaluation';
ggroup_labels[34] = 'G0B - Safety in the ham shack: electrical shock and treatment, safety grounding, fusing, interlocks, wiring, antenna and tower safety';
esub_labels[0] = 'SUBELEMENT E0 - Safety';
esub_labels[1] = 'SUBELEMENT E1 -- COMMISSION\'S RULES';
esub_labels[2] = 'SUBELEMENT E2 -- OPERATING PRACTICES AND PROCEDURES';
esub_labels[3] = 'SUBELEMENT E3 -- RADIO WAVE PROPAGATION';
esub_labels[4] = 'SUBELEMENT E4 -- AMATEUR RADIO TECHNOLOGY AND MEASUREMENTS';
esub_labels[5] = 'SUBELEMENT E5 -- ELECTRICAL PRINCIPLE';
esub_labels[6] = 'SUBELEMENT E6 -- CIRCUIT COMPONENTS';
esub_labels[7] = 'SUBELEMENT E7 -- PRACTICAL CIRCUITS';
esub_labels[8] = 'SUBELEMENT E8 -- SIGNALS AND EMISSIONS';
esub_labels[9] = 'SUBELEMENT E9 -- ANTENNAS AND TRANSMISSION LINES';
egroup_labels[0] = 'E1A Operating Standards: frequency privileges for Extra Class amateurs; emission standards; automatic message forwarding; frequency sharing; FCC license actions; stations aboard ships or aircraft ';
egroup_labels[1] = 'E1B Station restrictions and special operations: restrictions on station location; general operating restrictions, spurious emissions, control operator reimbursement; antenna structure restrictions; RACES operations';
egroup_labels[2] = 'E1C Station control: definitions and restrictions pertaining to local, automatic and remote control operation; control operator responsibilities for remote and automatically controlled stations';
egroup_labels[3] = 'E1D Amateur Satellite service: definitions and purpose; license requirements for space stations; available frequencies and bands; telecommand and telemetry operations; restrictions, and special provisions; notification requirements';
egroup_labels[4] = 'E1E Volunteer examiner program: definitions, qualifications, preparation and administration of exams; accreditation; question pools; documentation requirements';
egroup_labels[5] = 'E1F Miscellaneous rules: external RF power amplifiers; Line A; national quiet zone; business communications; compensated communications; spread spectrum; auxiliary stations; reciprocal operating privileges; IARP and CEPT licenses; third party communications with foreign countries; special temporary authority';
egroup_labels[6] = 'E2A Amateur radio in space: amateur satellites; orbital mechanics; frequencies and modes; satellite hardware; satellite operations';
egroup_labels[7] = 'E2B Television practices: fast scan television standards and techniques; slow scan television standards and techniques';
egroup_labels[8] = 'E2C Operating methods, part 1: contest and DX operating; spread-spectrum transmissions; automatic HF forwarding; selecting an operating frequency';
egroup_labels[9] = 'E2D Operating methods, part 2: VHF and UHF digital modes; packet clusters; Automatic Position Reporting System (APRS) ';
egroup_labels[10] = 'E2E Operating methods, part 3: operating HF digital modes; error correction';
egroup_labels[11] = 'E3A Propagation and technique, part 1: Earth-Moon-Earth communications; meteor scatter';
egroup_labels[12] = 'E3B Propagation and technique, part 2: transequatorial; long path; gray line; multi-path propagation';
egroup_labels[13] = 'E3C Propagation and technique, part 3: Auroral propagation; selective fading; radio-path horizon; take-off angle over flat or sloping terrain; earth effects on propagation; less common propagation modes';
egroup_labels[14] = 'E4A Test equipment: analog and digital instruments; spectrum and network analyzers, antenna analyzers; oscilloscopes; testing transistors; RF measurements ';
egroup_labels[15] = 'E4B Measurement technique and limitations: instrument accuracy and performance limitations; probes; techniques to minimize errors; measurement of "Q"; instrument calibration';
egroup_labels[16] = 'E4C Receiver performance characteristics, part 1: phase noise, capture effect, noise floor, image rejection, MDS, signal-to-noise-ratio; selectivity';
egroup_labels[17] = 'E4D Receiver performance characteristics, part 2: blocking dynamic range, intermodulation and cross-modulation interference; 3rd order intercept; desensitization; preselection';
egroup_labels[18] = 'E4E Noise suppression: system noise; electrical appliance noise; line noise; locating noise sources; DSP noise reduction; noise blankers';
egroup_labels[19] = 'E5A Resonance and Q: characteristics of resonant circuits: series and parallel resonance; Q; half-power bandwidth; phase relationships in reactive circuits';
egroup_labels[20] = 'E5B Time constants and phase relationships: R/L/C time constants: definition; time constants in RL and RC circuits; phase angle between voltage and current; phase angles of series and parallel circuits';
egroup_labels[21] = 'E5C Impedance plots and coordinate systems: plotting impedances in polar coordinates; rectangular coordinates';
egroup_labels[22] = 'E5D AC and RF energy in real circuits: skin effect; electrostatic and electromagnetic fields; reactive power; power factor; coordinate systems';
egroup_labels[23] = 'E6A Semiconductor materials and devices: semiconductor materials (germanium, silicon, P-type, N-type); transistor types: NPN, PNP, junction, power; field-effect transistors: enhancement mode; depletion mode; MOS; CMOS; N-channel; P-channel';
egroup_labels[24] = 'E6B Semiconductor diodes';
egroup_labels[25] = 'E6C Integrated circuits: TTL digital integrated circuits; CMOS digital integrated circuits; gates';
egroup_labels[26] = 'E6D Optical devices and toroids: vidicon and cathode-ray tube devices; charge-coupled devices (CCDs); liquid crystal displays (LCDs); toroids: permeability, core material, selecting, winding';