-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTutorial.js
executable file
·3563 lines (3331 loc) · 154 KB
/
Tutorial.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
// For Old IE
if (!window.console) window.console = {};
if (!window.console.log) {}
var analyzeCharge;
var on = false;
var isEnergySelectionOn = false;
var chargeJoules = 2;
var fchargeJoules = 2;
var isShockReady = false;
var initp = 130;
var PacerCurrent = 30;
var PacerRate = 100;
var isPacerOn = false;
var isCPROn = false;
var isLeftPadConnected = false;
var isRightPadConnected = false;
var isLLEKGConnected = false;
var isLAEKGConnected = false;
var isRAEKGConnected = false;
var isLeadSelectOn = false;
var turnEnergyOff;
var patientState = "VTac";
var isCharging = false;
var heartRate = 98;
var leadNum = 1;
var TickVar = null;
var c;
var b;
var heartBeat;
var isTestPlugAttached = true;
var isElectrodesConnected = false;
var isSyncOn;
var isTutorialOn = false;
var leadStatus = "Paddles";
var ispacerFuncOn;
var isRhythmTransitionOn = false;
var changeInit;
var isTransOver;
var readyForDeletion;
var transitonRhythm;
var isAEDOn = false;
var isTherapyCableAttached = true;
var isECGStumpAttached = true;
var isOnLoading = false;
var isChargeDialogOn = false;
var instance;
var istestPlugCharged = false;
var dataLogString = "";
var isTestOn = false;
var CPRDeathTime;
var HRNum;
var MinDeathTimeout;
var errorstatus;
var casePointsTimeDeduction;
var SyncwinTimeout;
var DefibSession = {
Id: -1,
UserId: "",
SessionDate: ""
};
var TestCase1 = {
Casenum: 1,
SessionId: -1,
UserID: "d",
FirstTimeUser: true,
SessionDate: 50,
TimeToStartCPR: -1,
TimeToTurnDefibOn: -1,
TimeToPadsAttached: -1,
ShocKWithEnergyGreaterThan59: false,
AnalyzePressed: false,
ShockInAnalyze: false,
ClickedStartCPRAfterShock: false,
SurvivalStateReached: false,
DeathStateReached: false,
TotalCaseTime: 0,
CaseTimeMoreThanFourMin: false,
CaseTimeLessThan2Min: false,
TotalPoints: 0
};
var TestCase2 = {
Casenum: 2,
UserID: "d",
FirstTimeUser: true,
SessionDate: 50,
VFibStateEntered: false,
TimeToStartCPRAfterVFib: 0,
TimeToTurnDefibOn: -1,
TimeToPadsAttached: -1,
ShockWithEnergyGreaterThan84: false,
VFibStartTime: 0,
ShockWithoutSync: false,
AnalyzePressed: false,
ShockInAnalyze: false,
StartedCPRAfterVFibShock: false,
SurvivalStateReached: false,
DeathStateReached: false,
TotalCaseTime: 0,
CaseTimeMoreThanFourMin: false,
CaseTimeLessThan2Min: false,
TotalPoints: 0
};
var TestCase3 = {
Casenum: 3,
UserID: "d",
FirstTimeUser: true,
SessionDate: 50,
TimeToTurnDefibOn: -1,
TimeToPadsAttached: -1,
ECGLeadsPlaced: false,
TimeToECGLeadsPlaced: -1,
EnergySelectWhilePacing: false,
AnalyzePressed: false,
ShockInAnalyze: false,
SurvivalStateReached: false,
ClickedAssessAfterPatient: false,
DeathStateReached: false,
TotalCaseTime: 0,
CaseTimeMoreThanFourMin: false,
CaseTimeLessThan2Min: false,
TotalPoints: 0
};
var objToday = new Date(),
weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
dayOfWeek = weekday[objToday.getDay()],
domEnder = new Array('th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th'),
dayOfMonth = today + (objToday.getDate() < 10) ? '0' + objToday.getDate() + domEnder[objToday.getDate()] : objToday.getDate() + domEnder[parseFloat(("" + objToday.getDate()).substr(("" + objToday.getDate()).length - 1))],
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'),
curMonth = months[objToday.getMonth()],
curYear = objToday.getFullYear(),
curHour = objToday.getHours() > 12 ? objToday.getHours() - 12 : (objToday.getHours() < 10 ? "0" + objToday.getHours() : objToday.getHours()),
curMinute = objToday.getMinutes() < 10 ? "0" + objToday.getMinutes() : objToday.getMinutes(),
curSeconds = objToday.getSeconds() < 10 ? "0" + objToday.getSeconds() : objToday.getSeconds(),
curMeridiem = objToday.getHours() > 12 ? "PM" : "AM";
var today = curHour + ":" + curMinute + "." + curSeconds + curMeridiem + " " + dayOfWeek + " " + dayOfMonth + " of " + curMonth + ", " + curYear;
othershockbool = true;
TestCase3.SessionDate = today;
TestCase2.SessionDate = today;
TestCase1.SessionDate = today;
var startTime = new Date() / 1000;
var tickTime = new Date();
var parseQueryString = function() {
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) {
objURL[$1] = $3;
}
);
return objURL;
};
var params = parseQueryString();
if (DefibSession.UserId == '' && params['user'] != '') {
DefibSession.UserId = params['user'];
}
function transformMiliseconds(t) {
var h = Math.floor((t / (1000 * 60 * 60)) % 24);
var m = Math.floor((t / (1000 * 60)) % 60);
var s = Math.floor((t / 1000) % 60);
h = (h < 10) ? '0' + h : h;
m = (m < 10) ? '0' + m : m;
s = (s < 10) ? '0' + s : s;
return h + ':' + m + ':' + s;
}
//ticker function that will refresh our display every second
function tick1() {
var newd = new Date();
document.getElementById('time_ticker').innerHTML = transformMiliseconds(newd - tickTime);
document.getElementById('score').innerHTML = TestCase1.TotalPoints;
}
function tick2() {
var newd = new Date();
document.getElementById('time_ticker').innerHTML = transformMiliseconds(newd - tickTime);
document.getElementById('score').innerHTML = TestCase2.TotalPoints;
}
function tick3() {
var newd = new Date();
document.getElementById('time_ticker').innerHTML = transformMiliseconds(newd - tickTime);
document.getElementById('score').innerHTML = TestCase3.TotalPoints;
}
//the runner
if (GetUrlValue('testnum') == 4)
var t = setInterval(tick1, 1000);
if (GetUrlValue('testnum') == 5)
var t = setInterval(tick2, 1000);
if (GetUrlValue('testnum') == 6)
var t = setInterval(tick3, 1000);
function GetUrlValue(VarSearch) {
var SearchString = window.location.search.substring(1);
var VariableArray = SearchString.split('&');
for (var i = 0; i < VariableArray.length; i++) {
var KeyValuePair = VariableArray[i].split('=');
if (KeyValuePair[0] == VarSearch) {
return KeyValuePair[1];
}
}
}
function sendPostData(data) {
alert('NOTE: This is for debugging purposes.\nIf you see this message then sendPostData was called\nand we will try to log the results now.');
var sessId = params["sess"];
if (sessId && sessId > 1) {
DefibSession.Id = sessId;
}
var userId = params["user"];
if (userId) {
DefibSession.UserId = params["user"];
}
if (DefibSession.Id == -1) {
DefibSession.SessionDate = new Date();
$.ajax({
type: "POST",
async: false,
contentType: "application/json; charset=utf-8",
url: "/Services/DefibSimulatorSvc.svc/DefibSession",
//url: "https://defibsim.thechildrenshospital.org/DefibSimulatorSvc.svc/DefibSession",
data: JSON.stringify(DefibSession),
dataType: "json",
success: function(response) {
DefibSession = response;
postCaseResult(data);
},
error: function(request, status, error) {
alert("Could not create session for results: " + request.responseText);
//alert(request.status);
//alert(request.statusText);
}
});
} else {
postCaseResult(data);
}
alert('NOTE: This is for debugging purposes.\nAttempt to log results completed.');
}
function postCaseResult(data) {
var caseURI = '';
if (data.Casenum == 1) {
caseURI = 'CaseAResult';
} else if (data.Casenum == 2) {
caseURI = 'CaseBResult';
} else if (data.Casenum == 3) {
caseURI = 'CaseCResult';
}
data.UserId = DefibSession.UserId;
data.SessionId = DefibSession.Id;
if (caseURI != '') {
$.ajax({
type: "POST",
async: false,
contentType: "application/json; charset=utf-8",
url: "/Services/DefibSimulatorSvc.svc/" + caseURI,
//url: "https://defibsim.thechildrenshospital.org/DefibSimulatorSvc.svc/" + caseURI,
data: JSON.stringify(data),
dataType: "json",
success: function(response) {
//alert('NOTE: This is for debugging purposes.\nIf you see this message then the results should have been logged.');
},
error: function(request, status, error) {
alert("Could not log result" + request.responseText);
//alert(request.status);
//alert(request.statusText);
}
});
}
}
function showMeHow() {
if (isRAEKGConnected && isLAEKGConnected && isLLEKGConnected) {
$("#LAEKG").animate({
"left": "946px",
"top": "70px"
});
$("#LLEKG").animate({
"left": "913px",
"top": "70px"
});
$("#RAEKG").animate({
"left": "880px",
"top": "70px"
});
isRAEKGConnected = false;
isLAEKGConnected = false;
isLLEKGConnected = false;
document.getElementById('EKGBox').style.display = "block";
document.getElementById('EKGBoxText').style.display = "block";
threeEKGController();
} else {
$("#LAEKG").animate({
"left": "941px",
"top": "326px"
});
$("#LLEKG").animate({
"left": "948px",
"top": "432px"
});
$("#RAEKG").animate({
"left": "850px",
"top": "352px"
});
isRAEKGConnected = true;
isLAEKGConnected = true;
isLLEKGConnected = true;
threeEKGController();
}
}
function showMeHow2() {
if (isLeftPadConnected && isRightPadConnected) {
instance.animate($("#LeftPad"), {
"left": "950px",
"top": "500px"
});
instance.animate($("#RightPad"), {
"left": "1000px",
"top": "500px"
});
instance.animate($("#GrayCable"), {
"left": "820px",
"top": "548px"
});
instance.animate($("#TherapyCable"), {
"left": "548px",
"top": "561px"
});
isLeftPadConnected = false;
isRightPadConnected = false;
isElectrodesConnected = true;
isTherapyCableAttached = true;
isTestPlugAttached = false;
document.getElementById('RemoveTestPlug').style.display = "none";
ecgController();
} else {
instance.animate($("#LeftPad"), {
"left": "838px",
"top": "371px"
});
instance.animate($("#RightPad"), {
"left": "947px",
"top": "390px"
});
instance.animate($("#GrayCable"), {
"left": "820px",
"top": "548px"
});
instance.animate($("#TherapyCable"), {
"left": "548px",
"top": "561px"
});
isLeftPadConnected = true;
isRightPadConnected = true;
isElectrodesConnected = true;
isTherapyCableAttached = true;
isTestPlugAttached = false;
document.getElementById('RemoveTestPlug').style.display = "none";
ecgController();
}
}
document.syncInterval = -1;
document.bcapsule = "black url('assets/Flatline.png')";
document.ccapsule = "black url('assets/Flatline.png')";
$(function() {
document.getElementById('shockprompt').addEventListener('ended', function() {
this.currentTime = 0;
this.play();
}, false);
MinDeathTimeout = setTimeout(function() {
if (GetUrlValue('testnum') == 4) {
TestCase1.DeathStateReached = true;
document.getElementById("PatientInfo").innerHTML = "Unfortunately the baby has died. You will need to speak with the family. Please review VF management and repeat the VF cases on the simulator another time. <a href=\"Tutorial.html?testnum=5&sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "\"> Click here to advance to the next test case.</a>";
TestCase1.SurvivalStateReached = false;
TestCase1.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase1.TotalPoints -= 100;
if (TestCase1.TotalCaseTime > 60 * 4) {
TestCase1.CaseTimeMoreThanFourMin = true;
}
if (TestCase1.TotalCaseTime < 60 * 2) {
TestCase1.CaseTimeLessThan2Min = true;
}
sendPostData(TestCase1);
errorController(10);
}
if (GetUrlValue('testnum') == 5) {
TestCase2.DeathStateReached = true;
document.getElementById("PatientInfo").innerHTML = "Unfortunately, the baby has died. You will need to speak with the family. Please review SVT management and repeat the case on the simulator another time. <a href=\"Tutorial.html?testnum=6&sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "\"> Click here to advance to the next test case.</a>";
TestCase2.SurvivalStateReached = false;
TestCase2.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase2.TotalPoints -= 100;
if (TestCase2.TotalCaseTime > 60 * 4) {
TestCase2.CaseTimeMoreThanFourMin = true;
}
if (TestCase2.TotalCaseTime < 60 * 2) {
TestCase2.CaseTimeLessThan2Min = true;
}
sendPostData(TestCase2);
errorController(11);
}
if (GetUrlValue('testnum') == 6) {
document.getElementById("PatientInfo").innerHTML = "Unfortunately your patient has died. You will need to speak with the family. Please review how to performa transcutaneous pacing and try this case again another time. You have now completed all the test cases on this simulator.";
TestCase3.DeathStateReached = true;
TestCase3.SurvivalStateReached = false;
TestCase3.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase3.TotalPoints -= 100;
if (TestCase3.TotalCaseTime > 60 * 4) {
TestCase3.CaseTimeMoreThanFourMin = true;
}
if (TestCase3.TotalCaseTime < 60 * 2) {
TestCase3.CaseTimeLessThan2Min = true;
}
sendPostData(TestCase3);
errorController(12);
}
if (GetUrlValue('testnum') == 1 || GetUrlValue('testnum') == 2 || GetUrlValue('testnum') == 3) {
}
clearTimeout(casePointsTimeDeduction);
patientState = "Dead";
HRNum = 0;
document.getElementById('HRNum').innerHTML = HRNum;
rhythmChange(initp, "black url('assets/DeadLine.png')");
}, 600000); //600000 20000
document.getElementById("TestPlug").style.left = "994px";
document.getElementById("TestPlug").style.top = "613px";
document.getElementById("GrayCable").style.left = "959px";
document.getElementById("GrayCable").style.top = "608px";
document.getElementById("WhiteCable").style.left = "850px";
document.getElementById("WhiteCable").style.top = "550px";
caseSelection(GetUrlValue("testnum"));
// if (!isTutorialOn) {
// document.getElementById('Continue').innerHTML = "<div class=\"button\" id=\"Continue\"><a href=\"Tutorial.html?testnum="+GetUrlValue("testnum")+"\">Click here to repeat case</a></div>"
// }
if (isTestOn) {
document.getElementById('back').style.display = "none";
}
if (!isTestOn) {
document.getElementById('score').style.display = "none";
document.getElementById('score_label').style.display = "none";
document.getElementById('time_ticker_label').style.display = "none";
}
if (isTutorialOn) {
document.getElementById('Close').style.display = "block";
document.getElementById('PatientWeight').style.display = "none";
document.getElementById('CaseDescription').style.display = "none";
document.getElementById('CPRButton').style.display = "none";
document.getElementById('Assess').style.display = "none";
isTherapyCableAttached = false;
document.getElementById('OnOff').className += ' tutorial';
document.getElementById('Charge').className += ' tutorial';
document.getElementById('ShockButton').className += ' tutorial';
document.getElementById('EnergySelectLeft').className += ' tutorial';
document.getElementById('EnergySelectRight').className += ' tutorial';
document.getElementById('CurrentLeft').className += ' tutorial';
document.getElementById('CurrentRight').className += ' tutorial';
document.getElementById('RateLeft').className += ' tutorial';
document.getElementById('RateRight').className += ' tutorial';
document.getElementById('PauseButton').className += ' tutorial';
document.getElementById('LAEKG').className += ' tutorial';
document.getElementById('RAEKG').className += ' tutorial';
document.getElementById('LLEKG').className += ' tutorial';
document.getElementById('TherapyCable').className += ' tutorial';
document.getElementById('TestPlug').className += ' tutorial';
document.getElementById('LeadButton').className += ' tutorial';
document.getElementById('Pacer').className += ' tutorial';
document.getElementById('Sync').className += ' tutorial';
document.getElementById('AnalyzeButton').className += ' tutorial';
document.getElementById('LeftPad').className += ' tutorial';
document.getElementById('RightPad').className += ' tutorial';
document.getElementById('GrayCable').className += ' tutorial';
document.getElementById('TherapyPort').className += ' tutorial';
document.getElementById('EKGPort').className += ' tutorial';
document.getElementById('EKGConnector').className += ' tutorial';
document.getElementById('SpeedDial').className += ' tutorial';
document.getElementById('EventButton').className += ' tutorial';
document.getElementById('CodeSummary').className += ' tutorial';
document.getElementById('PrintButton').className += ' tutorial';
document.getElementById('Alarms').className += ' tutorial';
document.getElementById('Options').className += ' tutorial';
document.getElementById('SizeButton').className += ' tutorial';
document.getElementById('HomeScreen').className += ' tutorial';
document.getElementById('EKGPort').className += ' tutorial';
document.getElementById('TherapyPort').className += ' tutorial';
instance.repaintEverything();
$("#IntroModal").dialog({
modal: true,
dialogClass: "helpDialog"
});
var tutStatement;
var tutStatement2;
var tutTitle;
$(".tutorial").hover(function() {
var top = 50;
var left = 1100;
if (isChargeDialogOn) {
isChargeDialogOn = false;
$("#HelpDialog2").dialog("close");
}
switch ($(this).attr('id')) {
case "OnOff":
tutStatement = "ON button: Turns machine power ON or OFF. Turning the machine ON is the first step in performing any function with the Lifepak defibrillator.";
tutTitle = "On";
break;
case "EnergySelectLeft":
tutStatement = "This control allows the user to select the desired energy dose by pushing the up or down arrows.";
tutTitle = "Energy Select";
break;
case "EnergySelectRight":
tutStatement = "This control allows the user to select the desired energy dose by pushing the up or down arrows.";
tutTitle = "Energy Select";
break;
case "Charge":
tutStatement = "Pressing the CHARGE button charges the machine to the selected energy dose. You must press CHARGE first before delivering a shock.";
tutTitle = "Charge";
tutStatement2 = "You can interrupt the charging process by pressing the Speed Dial button right here. -->";
isChargeDialogOn = true;
break;
case "ShockButton":
tutStatement = "The SHOCK button discharges the selected energy dose to the patient.";
tutTitle = "Shock";
break;
case "AnalyzeButton":
tutStatement = "Pressing ANALYZE activates the machine's AED mode. To exit AED mode, press either the ENERGY SELECT button, or the LEAD button.<br><br> Once you press ANALYZE, the machine will issue audible prompts. In AED mode on the Lifepak, the default energy dose is 200J. <a class=\"youtube\" href=\"https://www.youtube.com/watch?v=3a41lR1W1JI\">More on AED Mode <img class='playicon' style='vertical-align:bottom' width='30' src='assets/playicon.png'></a> ";
tutTitle = "Analyze";
top = 70;
left = 150;
break;
case "Pacer":
tutStatement = "Pressing the PACER button engages the machine's pacing functions.<i>The Lifepak's own ECG leads must be attached to the patient in order to perform demand pacing.</i>";
tutTitle = "Pacer";
break;
case "Sync":
tutStatement = "Pressing the SYNC button engages the machine's ability to time the delivery of a shock to the patient's QRS complex. You must press and HOLD the Shock Button.<br> <a class=\"youtube\" href=\"https://www.youtube.com/watch?v=4yQvfTjHlHw\">Synchronized Cardioversion <img class='playicon' style='vertical-align:bottom' width='30' src='assets/playicon.png'></a>";
tutTitle = "Sync";
break;
case "RateLeft":
tutStatement = "Once the PACER button is engaged, press the up or down arrows to select the (paced) heart rate you wish the patient to have.";
tutTitle = "Rate";
break;
case "RateRight":
tutStatement = "Once the PACER button is engaged, press the up or down arrows to select the (paced) heart rate you wish the patient to have.";
tutTitle = "Rate";
break;
case "CurrentLeft":
tutStatement = "Once the PACER button is engaged and the desired RATE is selected, press the up or down arrows to adjust the pacing current until each vertical pacing spike is followed by a wide QRS complex.";
tutTitle = "Current";
break;
case "CurrentRight":
tutStatement = "Once the PACER button is engaged and the desired RATE is selected, press the up or down arrows to adjust the pacing current until each vertical pacing spike is followed by a wide QRS complex. ";
tutTitle = "Current";
break;
case "LeadButton":
tutStatement = "Pressing the LEAD button allows you to select the ECG lead that is reading the patient's heart rhythm for display on the defibrillator monitor. Press the LEAD button repeatedly to highlight and select a particular lead.<br><a class=\"youtube\" href=\"https://www.youtube.com/watch?v=5SHkhFtLwvE\">Defibrillation without monitor display.<img class='playicon' style='vertical-align:bottom' width='30' src='assets/playicon.png'></a></div>";
tutTitle = "Lead";
top = 70;
left = 150;
break;
case "PauseButton":
tutStatement = "Pressing the PAUSE button allows you to check the patient's underlying rhythm. When the PAUSE button is held, the Lifepak paces at 25% of the set rate.<br><br> In demand pacing mode, when the patient's underlying rate is greater than 25% of the paced rate, there will be no demand for pacing and you will not see any vertical pacing spikes. ";
tutTitle = "Pause";
break;
case "SpeedDial":
tutStatement = "The Speed Dial can be used to scroll through and select desired energy doses, pacer rate, pacer current settings, or cardiac leads. In clinical practice you turn the dial to scroll, and push to select. On this simulator, you will not be able to \"scroll\" using the Speed Dial, but you can \"push\" it by clicking on it with your mouse or touchpad. Pushing the Speed Dial button during the defibrillator's charging process will interrupt the charge and disarm the machine. ";
tutTitle = "Speed Dial";
break;
case "LeftPad":
tutStatement = "Multifunction electrodes that allow the defibrillator to deliver an electrical stimulus to the patient. Attaching the Quik-Combo pads is a multistep process. <a style='color:blue; cursor: pointer; text-decoration:underline' onclick='showMeHow2()'>Show Me How</a>";
tutTitle = "Quik-Combo Pad";
break;
case "RightPad":
tutStatement = "Multifunction electrodes that allow the defibrillator to deliver an electrical stimulus to the patient. Attaching the Quik-Combo pads is a multistep process <a style='color:blue; cursor: pointer; text-decoration:underline' onclick='showMeHow2()'>Show Me How</a>";
tutTitle = "Quik-Combo Pad";
break;
case "TestPlug":
tutStatement = "When the defibrillator is not in use, the test plug is typically attached to the therapy cable, and must be removed in order to connect Quick-Combo pads to the therapy cable. Use your mouse to drag the test plug away from the therapy cable.";
tutTitle = "Test Plug";
break;
case "LLEKG":
case "LAEKG":
case "RAEKG":
tutStatement = "To attach the the Lifepak's ECG leads, drag and drop each individual lead to the designated location marker on the body. <a style='color:blue; cursor: pointer; text-decoration:underline' onclick='showMeHow()'>Show me how</a>";
tutTitle = "Lifepak ECG Lead";
break;
case "GrayCable":
case "TherapyCable":
tutStatement = "The therapy cable must be connected to its attachment port in order for the pads to work. You can use your mouse to attach the therapy cable to the Quik-Combo pads once you drag off the black test plug.";
tutTitle = "Therapy Cable";
break;
case "EKGConnector":
tutStatement = "Lifepak's own ECG leads connect to the defibrillator when the ECG cable is plugged in to the ECG cable port. Use your mouse to drag and drop the end of the cable onto the ECG port.";
tutTitle = "ECG Cable";
break;
case "EKGPort":
tutStatement = "To connect the Lifepak's own ECG leads, drag the ECG cable to the green ECG Cable Port and drag the individual leads to the patient.";
tutTitle = "ECG Port";
break;
case "TherapyPort":
tutStatement = " Site of attachment for EITHER the therapy cable or the machine's hard paddles.";
tutTitle = "Therapy Cable Attachment Port";
break;
case "PrintButton":
tutTitle = "Print Button";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "EventButton":
tutTitle = "Event Button";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "CodeSummary":
tutTitle = "Code Summary";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "SizeButton":
tutTitle = "Size Button";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "Alarms":
tutTitle = "Alarms";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "Options":
tutTitle = "Options";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "HomeScreen":
tutTitle = "Home Screen";
tutStatement = "This feature is not essential for defibrillator operation and will not be covered in this module";
break;
case "Help":
tutTitle = "Help";
tutStatement = "Clicking the HELP button will tell you what to do next during the Tutorial Cases. HELP will not be available during the Test Cases.";
break;
}
document.getElementById("TutorialDialog").innerHTML = tutStatement;
$('#TutorialDialog').dialog({
dialogClass: "helpDialog",
autoOpen: true,
position: [left, top],
title: tutTitle
});
if (tutStatement2 != undefined) {
document.getElementById("HelpDialog2").innerHTML = tutStatement2;
$('#HelpDialog2').dialog({
dialogClass: "helpDialog",
autoOpen: true,
position: ['top', 20],
position: ['left', 500],
title: tutTitle
});
tutStatement2 = undefined;
}
$("a.youtube").YouTubePopup();
});
}
$("#ShockButton").mousedown(function() {
if (isTestPlugAttached || !isElectrodesConnected) {
return;
}
if (patientState == "Sync" && chargeJoules <= 20 && !isTestOn && isShockReady) {
document.shockTimeout = setTimeout(function() {
rhythmChange(initp, "black url('assets/NormalRate.png')");
clearTimeout(casePointsTimeDeduction);
clearTimeout(MinDeathTimeout);
isSyncOn = false;
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
HRNum = 120;
patientState = "NormalVTac";
helpController(213);
document.getElementById('PatientInfo').innerHTML = "Saved!";
clearTimeout(MinDeathTimeout);
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
document.getElementById('EnergyDelivered').style.display = "block";
document.getElementById('shockprompt').pause();
setTimeout(function() {
document.getElementById('EnergyDelivered').style.display = "none";
}, 5000);
}, 1000);
} else if ((patientState == "VTac" || patientState == "Sync") && isTestOn && chargeJoules > 84 && isShockReady) {
TestCase2.DeathStateReached = true;
TestCase2.ShockWithEnergyGreaterThan84 = true;
patientState = "Dead";
if (!isSyncOn) {
TestCase2.ShockWithoutSync = true;
}
TestCase2.SurvivalStateReached = false;
TestCase2.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase2.TotalPoints -= 100;
clearTimeout(casePointsTimeDeduction);
clearTimeout(MinDeathTimeout);
if (TestCase2.TotalCaseTime > 60 * 4) {
TestCase2.CaseTimeMoreThanFourMin = true;
}
if (TestCase2.TotalCaseTime < 60 * 2) {
TestCase2.CaseTimeLessThan2Min = true;
}
HRNum = 0;
document.getElementById('HRNum').innerHTML = HRNum;
rhythmChange(initp, "black url('assets/DeadLine.png')");
document.getElementById("SyncLight").style.display = "none";
document.getElementById('EnergyDelivered').style.display = "block";
document.getElementById("ShockLight").style.display = "none";
clearInterval(document.interval);
document.getElementById('ShockMenu').style.display = "none";
document.getElementById('shockprompt').pause();
isShockReady = false;
setTimeout(function() {
document.getElementById('EnergyDelivered').style.display = "none";
}, 5000);
sendPostData(TestCase2);
setTimeout(function() {
errorController(11);
}, 1000);
} else if (patientState == "VTac" && isTestOn && !isSyncOn && isShockReady) {
othershockbool = false;
TestCase2.ShockWithoutSync = true;
TestCase2.VFibStateEntered = true;
TestCase2.VFibStartTime = Math.round((new Date() / 1000) - startTime);
TestCase2.TotalPoints -= 20;
patientState = "VFib";
document.getElementById('PatientInfo').innerHTML = "The patient is pulseless and not breathing!";
rhythmChange(initp, "black url('assets/vfib.png')");
document.getElementById('HRNum').innerHTML = "170";
document.getElementById('EnergyDelivered').style.display = "block";
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
document.getElementById('shockprompt').pause();
isShockReady = false;
setTimeout(function() {
othershockbool = true;
}, 1000);
setTimeout(function() {
document.getElementById('EnergyDelivered').style.display = "none";
}, 5000);
document.getElementById("ShockLight").style.display = "none";
clearInterval(document.interval);
document.getElementById('ShockMenu').style.display = "none";
CPRDeathTime = setTimeout(function() {
TestCase2.SurvivalStateReached = false;
TestCase2.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase2.DeathStateReached = true;
TestCase2.TotalPoints -= 100;
if (TestCase2.TotalCaseTime > 60 * 4) {
TestCase2.CaseTimeMoreThanFourMin = true;
}
if (TestCase2.TotalCaseTime < 60 * 2) {
TestCase2.CaseTimeLessThan2Min = true;
}
HRNum = 0;
document.getElementById('HRNum').innerHTML = HRNum;
clearTimeout(casePointsTimeDeduction);
patientState = "Dead";
rhythmChange(initp, "black url('assets/DeadLine.png')");
sendPostData(TestCase2);
setTimeout(function() {
errorController(11);
}, 1000);
}, 45000);
} else if (patientState == "Sync" && isTestOn && isSyncOn && chargeJoules < 85 && chargeJoules > 4 && isShockReady) {
document.shockTimeout = setTimeout(function() {
TestCase2.TotalPoints += 20;
rhythmChange(initp, "black url('assets/NormalRate.png')");
clearTimeout(MinDeathTimeout);
SyncwinTimeout = setTimeout(function() {
if (GetUrlValue('testnum') == 5) {
TestCase2.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase2.SurvivalStateReached = true;
clearTimeout(MinDeathTimeout);
$('#obj').val(JSON.stringify(TestCase2));
}
if (TestCase2.TotalCaseTime > 60 * 4) {
TestCase2.CaseTimeMoreThanFourMin = true;
}
if (TestCase2.TotalCaseTime < 60 * 2) {
TestCase2.CaseTimeLessThan2Min = true;
}
if (GetUrlValue('testnum') == 5) {
sendPostData(TestCase2);
}
if (!isTestOn) {
document.getElementById("EndDialog").innerHTML = "The patient is breathing spontaneously, has a strong pulse, and is back in a normal heart rhythm. You successfully cardioverted the patient. <a href='testintro.html?sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "'>Click here to move on to the Test Cases</a>.";
$('#EndDialog').dialog({
"width": 400,
dialogClass: "statusDialog",
modal: true,
autoOpen: true
});
} else {
document.getElementById("EndDialog").innerHTML = "Good job! The baby is awake and breathing spontaneously. The pulse is strong. BP 82/40. <a href='Tutorial.html?testnum=6&sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "'>Click here to move on to the last Test Case</a>.";
$('#EndDialog').dialog({
"width": 400,
dialogClass: "statusDialog",
modal: true,
autoOpen: true
});
}
}, 30000);
isSyncOn = false;
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
HRNum = 89;
patientState = "NormalVTac";
helpController(213);
document.getElementById('HRNum').innerHTML = HRNum;
clearTimeout(MinDeathTimeout);
document.getElementById('PatientInfo').innerHTML = "Saved!";
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
document.getElementById('EnergyDelivered').style.display = "block";
document.getElementById('shockprompt').pause();
clearTimeout(casePointsTimeDeduction);
setTimeout(function() {
document.getElementById('EnergyDelivered').style.display = "none";
}, 5000);
}, 1000);
} else if (patientState == "Sync" && isTestOn && isSyncOn && chargeJoules <= 4 && isShockReady) {
document.shockTimeout = setTimeout(function() {
rhythmChange(initp, "black url('assets/SVT.png')");
isSyncOn = false;
document.getElementById("SyncLight").style.display = "none";
clearInterval(document.syncInterval);
document.getElementById("SyncLight").style.display = "none";
document.getElementById('EnergyDelivered').style.display = "block";
document.getElementById('shockprompt').pause();
document.getElementById("ShockLight").style.display = "none";
clearInterval(document.interval);
document.getElementById('ShockMenu').style.display = "none";
isShockReady = false;
patientState = "VTac";
setTimeout(function() {
document.getElementById('EnergyDelivered').style.display = "none";
}, 5000);
}, 1000);
} else if (patientState == "VTac" && !isTestOn) {
errorController(7);
} else if (patientState == "Sync" && chargeJoules > 20 && !isTestOn) {
errorController(9);
}
}
);
$("#ShockButton").mouseup(function() {
clearTimeout(document.shockTimeout);
});
$("Assess").button();
$('#StartInfo').dialog({
autoOpen: false,
dialogClass: "statusDialog",
closeText: "close"
});
$('#PatientStatus').dialog({
title: "Status",
dialogClass: "statusDialog",
autoOpen: false,
closeText: "close"
});
$('#CaseDescription').click(function(e) {
$('#StartInfo').dialog('open');
});
var firstassess = true;
$("#Assess").click(function(e) {
e.preventDefault();
dataLogString += "AssessButton ";
if (patientState == "GoodWithPace" && !isTestOn) {
$('#PatientInfo').html("The patient is awake and breathing, with a pulse of 100 (equal to the pacing rate) and BP 92/60.Congratulations! You saved the patient. <a href='Tutorial.html?testnum=3&sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "' >Click here to move on to the next case</a>.");
$('#PatientStatus').dialog({
title: "Congratulations!",
autoOpen: true,
modal: true
});
}
if (patientState == "GoodWithPace" && isTestOn) {
if (GetUrlValue('testnum') == 6) {
TestCase3.SurvivalStateReached = true;
clearTimeout(MinDeathTimeout);
TestCase3.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
if (TestCase3.TotalCaseTime > 60 * 4) {
TestCase3.CaseTimeMoreThanFourMin = true;
}
if (TestCase3.TotalCaseTime < 60 * 2) {
TestCase3.CaseTimeLessThan2Min = true;
}
TestCase3.ClickedAssessAfterPatient = true;
sendPostData(TestCase3);
}
$('#PatientInfo').html(" Good job! The patient is awake and breathing, with a pulse of 100 (or equal to the pacing rate) and BP 92/60. Congratulations. You have now completed all the test cases on this simulator. Please close your browser window to end your session.");
$('#PatientStatus').dialog({
title: "Congratulations!",
autoOpen: true,
modal: true
});
} else if (patientState == "NormalVTac") {
if (GetUrlValue('testnum') == 5) {
TestCase2.TotalCaseTime = Math.round((new Date() / 1000) - startTime);
TestCase2.SurvivalStateReached = true;
clearTimeout(MinDeathTimeout);
clearTimeout(SyncwinTimeout);
$('#obj').val(JSON.stringify(TestCase2));
}
if (TestCase2.TotalCaseTime > 60 * 4) {
TestCase2.CaseTimeMoreThanFourMin = true;
}
if (TestCase2.TotalCaseTime < 60 * 2) {
TestCase2.CaseTimeLessThan2Min = true;
}
if (GetUrlValue('testnum') == 5) {
sendPostData(TestCase2);
}
if (!isTestOn) {
document.getElementById("EndDialog").innerHTML = "The patient is breathing spontaneously, has a strong pulse, and is back in a normal heart rhythm. You successfully cardioverted the patient. <a href='testintro.html'>Click here to move on to the Test Cases</a>.";
$('#EndDialog').dialog({
"width": 400,
dialogClass: "statusDialog",
modal: true,
autoOpen: true
});
} else {
document.getElementById("EndDialog").innerHTML = "Good job! The baby is awake and breathing spontaneously. The pulse is strong. BP 82/40. <a href='Tutorial.html?testnum=6&sess=" + DefibSession.Id + "&user=" + DefibSession.UserId + "'>Click here to move on to the last Test Case</a>.";
$('#EndDialog').dialog({
"width": 400,
dialogClass: "statusDialog",
modal: true,
autoOpen: true
});
}
} else {
$('#PatientStatus').dialog('open');
if (patientState == "SlowRhythm" && firstassess === true) {
helpController(101);
firstassess = false;
}
if (patientState == "VTac" && firstassess === true) {
TestCase2.TotalPoints += 15;
helpController(201);
firstassess = false;
}
if (patientState == "VFib" && firstassess === true) {
TestCase1.TotalPoints += 5;
helpController(2);
firstassess = false;
}
}
});
if (!isTestOn) {
$("#Help").button();
$('#HelpDialog').dialog({
position: [1100, 450],
autoOpen: false,
dialogClass: "helpDialog"
});
}
$('#HelpDialog').dialog({