Project

General

Profile

Bug #7456 » hotpotatoes_test.htm

Andre Boivin, 12/08/2015 23:59

 
1
<?xml version="1.0"?>
2
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
3
       <html xmlns="http://www.w3.org/1999/xhtml"
4
             xml:lang="en"><head><meta name="author" content="Created with Hot Potatoes by Half-Baked Software, registered to andre."></meta><meta name="keywords" content="Hot Potatoes, Hot Potatoes, Half-Baked Software, Windows, University of Victoria"></meta>
5

    
6
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
7
<meta name="DC:Creator" content="andre" />
8
<meta name="DC:Title" content="hotpotatoes test" />
9

    
10

    
11
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
12

    
13
<title>
14
hotpotatoes test
15
</title>
16

    
17
<!-- Made with executable version 6.3 Release 0 Build 3 -->
18

    
19
<!-- The following insertion allows you to add your own code directly to this head tag from the configuration screen -->
20

    
21

    
22

    
23
<style type="text/css">
24

    
25

    
26
/* This is the CSS stylesheet used in the exercise. */
27
/* Elements in square brackets are replaced by data based on configuration settings when the exercise is built. */
28

    
29
/* BeginCorePageCSS */
30

    
31
/* Made with executable version 6.3 Release 0 Build 3 */
32

    
33

    
34
/* Hack to hide a nested Quicktime player from IE, which can't handle it. */
35
* html object.MediaPlayerNotForIE {
36
	display: none;
37
}
38

    
39
body{
40
	font-family: Arial;
41
	background-color: #FFFFFF;
42
	color: #000000;
43
 
44
	margin-right: 2%;
45
	margin-left: 2%;
46
	font-size: ;
47

    
48
}
49

    
50
p{
51
	text-align: left;
52
	margin: 0px;
53
	font-size: 100%;
54

    
55
}
56

    
57
table,div,span,td{
58
	font-size: 100%;
59
 color: #000000;
60
	
61
}
62

    
63
div.Titles{
64
	padding: 0.5em;;
65
	text-align: center;
66
	color: #0000ff;
67
}
68

    
69
button{
70
	font-family: Arial;
71
	font-size: 100%;
72
	display: inline;
73
}
74

    
75
.ExerciseTitle{
76
	font-size: 140%;
77
	color: #0000ff;
78
}
79

    
80
.ExerciseSubtitle{
81
	font-size: 120%;
82
	color: #0000ff;
83
}
84

    
85
div.StdDiv{
86
	background-color: #ffffff;
87
	text-align: center;
88
	font-size: 100%;
89
	color: #000000;
90
	padding: 0.5em;
91
	border-style: solid;
92
	border-width: 0px 0px 0px 0px;
93
	border-color: #000000;
94
	margin-bottom: 1px;
95
}
96

    
97
/* EndCorePageCSS */
98

    
99
.RTLText{
100
	text-align: right;
101
	font-size: 150%;
102
	direction: rtl;
103
	font-family: "Arial", "Traditional Arabic", "Times New Roman", Arial;
104
}
105

    
106
.CentredRTLText{
107
	text-align: center;
108
	font-size: 150%;
109
	direction: rtl;
110
	font-family: "Arial", "Traditional Arabic", "Times New Roman", Arial;
111
}
112

    
113
button p.RTLText{
114
	text-align: center;
115
}
116

    
117
.RTLGapBox{
118
	text-align: right;
119
	font-size: 150%;
120
	direction: rtl;
121
	font-family: "Arial", Arial;
122
}
123

    
124
.Guess{
125
	font-weight: bold;
126
}
127

    
128
.CorrectAnswer{
129
	font-weight: bold;
130
}
131

    
132
div#Timer{
133
	padding: 0.25em;
134
	margin-left: auto;
135
	margin-right: auto;
136
	text-align: center;
137
	color: #0000ff;
138
}
139

    
140
span#TimerText{
141
	padding: 0.25em;
142
	border-width: 1px;
143
	border-style: solid;
144
	font-weight: bold;
145
	display: none;
146
	color: #0000ff;
147
}
148

    
149
span.Instructions{
150

    
151
}
152

    
153
div.ExerciseText{
154

    
155
}
156

    
157
.FeedbackText, .FeedbackText span.CorrectAnswer, .FeedbackText span.Guess, .FeedbackText span.Answer{
158
	color: #FF0000;
159
}
160

    
161
.LeftItem{
162
	font-size: 100%;
163
	color: #000000;
164
	text-align: left;
165
}
166

    
167
.RightItem{
168
	font-weight: bold;
169
	font-size: 100%;
170
	color: #000000;
171
}
172

    
173
span.CorrectMark{
174

    
175
}
176

    
177
input, textarea{
178
	font-family: Arial;
179
	font-size: 100%;
180
}
181

    
182
select{
183
	font-size: 100%;
184
}
185

    
186
div.Feedback {
187
	background-color: #FFFFFF;
188
	left: 33%;
189
	width: 34%;
190
	top: 33%;
191
	z-index: 1;
192
	border-style: solid;
193
	border-width: 1px;
194
	padding: 5px;
195
	text-align: center;
196
	color: #FF0000;
197
	position: absolute;
198
	display: none;
199
	font-size: 100%;
200

    
201
}
202

    
203

    
204

    
205

    
206
div.ExerciseDiv{
207
	color: #000000;
208
}
209

    
210
/* JMatch flashcard styles */
211
table.FlashcardTable{
212
	background-color: transparent;
213
	color: #000000;
214
	border-color: #000000;
215
	margin-left: 5%;
216
	margin-right: 5%;
217
	margin-top: 2em;
218
	margin-bottom: 2em;
219
	width: 90%;
220
	position: relative;
221
	text-align: center;
222
	padding: 0px;
223
}
224

    
225
table.FlashcardTable tr{
226
	border-style: none;
227
	margin: 0px;
228
	padding: 0px;
229
	background-color: #ffffff;
230
}
231

    
232
table.FlashcardTable td.Showing{
233
	font-size: 140%;
234
	text-align: center;
235
	width: 50%;
236
	display: table-cell;
237
	padding: 2em;
238
	margin: 0px;
239
	border-style: solid;
240
	border-width: 1px;
241
	color: #000000;
242
	background-color: #ffffff;
243
}
244

    
245
table.FlashcardTable td.Hidden{
246
	display: none;
247
}
248

    
249
/* JMix styles */
250
div#SegmentDiv{
251
	margin-top: 2em;
252
	margin-bottom: 2em;
253
	text-align: center;
254
}
255

    
256
a.ExSegment{
257
	font-size: 120%;
258
	font-weight: bold;
259
	text-decoration: none;
260
	color: #000000;
261
}
262

    
263
span.RemainingWordList{
264
	font-style: italic;
265
}
266

    
267
div.DropLine {
268
	position: absolute;
269
	text-align: center;
270
	border-bottom-style: solid;
271
	border-bottom-width: 1px;
272
	border-bottom-color: #0000ff;
273
	width: 80%;
274
}
275

    
276
/* JCloze styles */
277

    
278
.ClozeWordList{
279
	text-align: center;
280
	font-weight: bold;
281
}
282

    
283
div.ClozeBody{
284
	text-align: left;
285
	margin-top: 2em;
286
	margin-bottom: 2em;
287
	line-height: 2.0
288
}
289

    
290
span.GapSpan{
291
	font-weight: bold;
292
}
293

    
294
/* JCross styles */
295

    
296
table.CrosswordGrid{
297
	margin: auto auto 1em auto;
298
	border-collapse: collapse;
299
	padding: 0px;
300
	background-color: #000000;
301
}
302

    
303
table.CrosswordGrid tbody tr td{
304
	width: 1.0em;
305
	height: 1.0em;
306
	text-align: center;
307
	vertical-align: middle;
308
	font-size: 110%;
309
	padding: 1px;
310
	margin: 0px;
311
	border-style: solid;
312
	border-width: 1px;
313
	border-color: #000000;
314
 color: #000000;
315
}
316

    
317
table.CrosswordGrid span{
318
	color: #0000FF;
319
}
320

    
321
table.CrosswordGrid td.BlankCell{
322
	background-color: #C0C0C0;
323
	color: #000000;
324
}
325

    
326
table.CrosswordGrid td.LetterOnlyCell{
327
	text-align: center;
328
	vertical-align: middle;
329
	background-color: #ffffff;
330
	color: #000000;
331
	
332
}
333

    
334
table.CrosswordGrid td.NumLetterCell{
335
	text-align: left;
336
	vertical-align: top;
337
	background-color: #ffffff;
338
	color: #000000;
339
	padding: 1px;
340

    
341
}
342

    
343
.NumLetterCellText{
344
	cursor: pointer;
345
	color: #000000;
346
}
347

    
348
.GridNum{
349
	vertical-align: super;
350
	font-size: 46%;
351
	
352
	text-decoration: none;
353
	color: #000000;
354
}
355

    
356
.GridNum:hover, .GridNum:visited{
357
	color: #000000;
358
}
359

    
360
table#Clues{
361
	margin: auto;
362
	vertical-align: top;
363

    
364
}
365

    
366
table#Clues td{
367
	vertical-align: top;
368

    
369
}
370

    
371
table.ClueList{
372
  margin: auto;
373

    
374
}
375

    
376
td.ClueNum{
377
	text-align: right;
378
	font-weight: bold;
379
	vertical-align: top;
380

    
381
}
382

    
383
td.Clue{
384
	text-align: left;
385
	
386
}
387

    
388
div#ClueEntry{
389
	text-align: left;
390
	margin-bottom: 1em;
391

    
392
}
393

    
394
/* Keypad styles */
395

    
396
div.Keypad{
397
	text-align: center;
398
	display: none; /* initially hidden, shown if needed */
399
	margin-bottom: 0.5em;
400
}
401

    
402
div.Keypad button{
403
	font-family: Arial;
404
	font-size: 120%;
405
	background-color: #ffffff;
406
	color: #000000;
407
	width: 2em;
408
}
409

    
410
/* JQuiz styles */
411

    
412
div.QuestionNavigation{
413
	text-align: center;
414
}
415

    
416
.QNum{
417
	margin: 0em 1em 0.5em 1em;
418
	font-weight: bold;
419
	vertical-align: middle;
420
}
421

    
422
textarea{
423
	font-family: Arial;
424
}
425

    
426
.QuestionText{
427
	text-align: left;
428
	margin: 0px;
429
	font-size: 100%;
430
}
431

    
432
.Answer{
433
	font-size: 120%;
434
	letter-spacing: 0.1em;
435
}
436

    
437
.PartialAnswer{
438
	font-size: 120%;
439
	letter-spacing: 0.1em;
440
	color: #0000ff;
441
}
442

    
443
.Highlight{
444
	color: #000000;
445
	background-color: #ffff00;
446
	font-weight: bold;
447
	font-size: 120%;
448
}
449

    
450
ol.QuizQuestions{
451
	text-align: left;
452
	list-style-type: none;
453
}
454

    
455
li.QuizQuestion{
456
	padding: 1em;
457
	border-style: solid;
458
	border-width: 0px 0px 1px 0px;
459
}
460

    
461
ol.MCAnswers{
462
	text-align: left;
463
	list-style-type: upper-alpha;
464
	padding: 1em;
465
}
466

    
467
ol.MCAnswers li{
468
	margin-bottom: 1em;
469
}
470

    
471
ol.MSelAnswers{
472
	text-align: left;
473
	list-style-type: lower-alpha;
474
	padding: 1em;
475
}
476

    
477
div.ShortAnswer{
478
	padding: 1em;
479
}
480

    
481
.FuncButton {
482
	text-align: center;
483
	border-style: solid;
484

    
485
	border-left-color: #ffffff;
486
	border-top-color: #ffffff;
487
	border-right-color: #7f7f7f;
488
	border-bottom-color: #7f7f7f;
489
	color: #000000;
490
	background-color: #8ACAEC;
491

    
492
	border-width: 2px;
493
	padding: 3px 6px 3px 6px;
494
	cursor: pointer;
495
}
496

    
497
.FuncButtonUp {
498
	color: #ffffff;
499
	text-align: center;
500
	border-style: solid;
501

    
502
	border-left-color: #ffffff;
503
	border-top-color: #ffffff;
504
	border-right-color: #7f7f7f;
505
	border-bottom-color: #7f7f7f;
506

    
507
	background-color: #FF0000;
508
	color: #ffffff;
509
	border-width: 2px;
510
	padding: 3px 6px 3px 6px;
511
	cursor: pointer;
512
}
513

    
514
.FuncButtonDown {
515
	color: #ffffff;
516
	text-align: center;
517
	border-style: solid;
518

    
519
	border-left-color: #7f7f7f;
520
	border-top-color: #7f7f7f;
521
	border-right-color: #ffffff;
522
	border-bottom-color: #ffffff;
523
	background-color: #000000;
524
	color: #ffffff;
525

    
526
	border-width: 2px;
527
	padding: 3px 6px 3px 6px;
528
	cursor: pointer;
529
}
530

    
531
/*BeginNavBarStyle*/
532

    
533
div.NavButtonBar{
534
	background-color: #ffffff;
535
	text-align: center;
536
	margin: 2px 0px 2px 0px;
537
	clear: both;
538
	font-size: 100%;
539
}
540

    
541
.NavButton {
542
	border-style: solid;
543
	
544
	border-left-color: #ffffff;
545
	border-top-color: #ffffff;
546
	border-right-color: #7f7f7f;
547
	border-bottom-color: #7f7f7f;
548
	background-color: #ffffff;
549
	color: #000000;
550

    
551
	border-width: 2px;
552
	cursor: pointer;	
553
}
554

    
555
.NavButtonUp {
556
	border-style: solid;
557

    
558
	border-left-color: #ffffff;
559
	border-top-color: #ffffff;
560
	border-right-color: #7f7f7f;
561
	border-bottom-color: #7f7f7f;
562
	color: #ffffff;
563
	background-color: #000000;
564

    
565
	border-width: 2px;
566
	cursor: pointer;	
567
}
568

    
569
.NavButtonDown {
570
	border-style: solid;
571

    
572
	border-left-color: #7f7f7f;
573
	border-top-color: #7f7f7f;
574
	border-right-color: #ffffff;
575
	border-bottom-color: #ffffff;
576
	color: #ffffff;
577
	background-color: #000000;
578

    
579
	border-width: 2px;
580
	cursor: pointer;	
581
}
582

    
583
/*EndNavBarStyle*/
584

    
585
a{
586
	color: #0000ff;
587
}
588

    
589
a:visited{
590
	color: #0000cc;
591
}
592

    
593
a:hover{
594
	color: #0000ff;
595
}
596

    
597
div.CardStyle {
598
	position: absolute;
599
	font-family: Arial;
600
	font-size: 100%;
601
	padding: 5px;
602
	border-style: solid;
603
	border-width: 1px;
604
	color: #000000;
605
	background-color: #ffffff;
606
	left: -50px;
607
	top: -50px;
608
	overflow: visible;
609
}
610

    
611
.rtl{
612
	text-align: right;
613
	font-size: 140%;
614
}
615

    
616

    
617
</style>
618

    
619
<script type="text/javascript">
620

    
621
//<![CDATA[
622

    
623
<!--
624

    
625

    
626

    
627

    
628
function Client(){
629
//if not a DOM browser, hopeless

630
	this.min = false; if (document.getElementById){this.min = true;};
631

    
632
	this.ua = navigator.userAgent;
633
	this.name = navigator.appName;
634
	this.ver = navigator.appVersion;  
635

    
636
//Get data about the browser

637
	this.mac = (this.ver.indexOf('Mac') != -1);
638
	this.win = (this.ver.indexOf('Windows') != -1);
639

    
640
//Look for Gecko

641
	this.gecko = (this.ua.indexOf('Gecko') > 1);
642
	if (this.gecko){
643
		this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length));
644
		if (this.geckoVer < 20020000){this.min = false;}
645
	}
646
	
647
//Look for Firebird

648
	this.firebird = (this.ua.indexOf('Firebird') > 1);
649
	
650
//Look for Safari

651
	this.safari = (this.ua.indexOf('Safari') > 1);
652
	if (this.safari){
653
		this.gecko = false;
654
	}
655
	
656
//Look for IE

657
	this.ie = (this.ua.indexOf('MSIE') > 0);
658
	if (this.ie){
659
		this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
660
		if (this.ieVer < 5.5){this.min = false;}
661
	}
662
	
663
//Look for Opera

664
	this.opera = (this.ua.indexOf('Opera') > 0);
665
	if (this.opera){
666
		this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length));
667
		if (this.operaVer < 7.04){this.min = false;}
668
	}
669
	if (this.min == false){
670
		alert('Your browser may not be able to handle this page.');
671
	}
672
	
673
//Special case for the horrible ie5mac

674
	this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6));
675
}
676

    
677
var C = new Client();
678

    
679
//for (prop in C){

680
//	alert(prop + ': ' + C[prop]);

681
//}

682

    
683

    
684

    
685
//CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS

686

    
687
//[strNavBarJS]

688
function NavBtnOver(Btn){
689
	if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';}
690
}
691

    
692
function NavBtnOut(Btn){
693
	Btn.className = 'NavButton';
694
}
695

    
696
function NavBtnDown(Btn){
697
	Btn.className = 'NavButtonDown';
698
}
699
//[/strNavBarJS]

700

    
701
function FuncBtnOver(Btn){
702
	if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';}
703
}
704

    
705
function FuncBtnOut(Btn){
706
	Btn.className = 'FuncButton';
707
}
708

    
709
function FuncBtnDown(Btn){
710
	Btn.className = 'FuncButtonDown';
711
}
712

    
713
function FocusAButton(){
714
	if (document.getElementById('CheckButton1') != null){
715
		document.getElementById('CheckButton1').focus();
716
	}
717
	else{
718
		if (document.getElementById('CheckButton2') != null){
719
			document.getElementById('CheckButton2').focus();
720
		}
721
		else{
722
			document.getElementsByTagName('button')[0].focus();
723
		}
724
	}
725
}
726

    
727

    
728

    
729

    
730
//CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX

731

    
732
var topZ = 1000;
733

    
734
function ShowMessage(Feedback){
735
	var Output = Feedback + '<br /><br />';
736
	document.getElementById('FeedbackContent').innerHTML = Output;
737
	var FDiv = document.getElementById('FeedbackDiv');
738
	topZ++;
739
	FDiv.style.zIndex = topZ;
740
	FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
741

    
742
	FDiv.style.display = 'block';
743

    
744
	ShowElements(false, 'input');
745
	ShowElements(false, 'select');
746
	ShowElements(false, 'object');
747
	ShowElements(true, 'object', 'FeedbackContent');
748

    
749
//Focus the OK button

750
	setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
751
	
752
//

753
}
754

    
755
function ShowElements(Show, TagName, ContainerToReverse){
756
// added third argument to allow objects in the feedback box to appear

757
//IE bug -- hide all the form elements that will show through the popup

758
//FF on Mac bug : doesn't redisplay objects whose visibility is set to visible

759
//unless the object's display property is changed

760

    
761
	//get container object (by Id passed in, or use document otherwise)

762
	TopNode = document.getElementById(ContainerToReverse);
763
	var Els;
764
	if (TopNode != null) {
765
		Els = TopNode.getElementsByTagName(TagName);
766
	} else {
767
		Els = document.getElementsByTagName(TagName);
768
	}
769

    
770
	for (var i=0; i<Els.length; i++){
771
		if (TagName == "object") {
772
			//manipulate object elements in all browsers

773
			if (Show == true){
774
				Els[i].style.visibility = 'visible';
775
				//get Mac FireFox to manipulate display, to force screen redraw

776
				if (C.mac && C.gecko) {Els[i].style.display = '';}
777
			}
778
			else{
779
				Els[i].style.visibility = 'hidden';
780
				if (C.mac && C.gecko) {Els[i].style.display = 'none';}
781
			}
782
		} 
783
		else {
784
			// tagName is either input or select (that is, Form Elements)

785
			// ie6 has a problem with Form elements, so manipulate those

786
			if (C.ie) {
787
				if (C.ieVer < 7) {
788
					if (Show == true){
789
						Els[i].style.visibility = 'visible';
790
					}
791
					else{
792
						Els[i].style.visibility = 'hidden';
793
					}
794
				}
795
			}
796
		}
797
	}
798
}
799

    
800

    
801

    
802
function HideFeedback(){
803
	document.getElementById('FeedbackDiv').style.display = 'none';
804
	ShowElements(true, 'input');
805
	ShowElements(true, 'select');
806
	ShowElements(true, 'object');
807
	if (Finished == true){
808
		Finish();
809
	}
810
}
811

    
812

    
813
//GENERAL UTILITY FUNCTIONS AND VARIABLES

814

    
815
//PAGE DIMENSION FUNCTIONS

816
function PageDim(){
817
//Get the page width and height

818
	this.W = 600;
819
	this.H = 400;
820
	this.W = document.getElementsByTagName('body')[0].clientWidth;
821
	this.H = document.getElementsByTagName('body')[0].clientHeight;
822
}
823

    
824
var pg = null;
825

    
826
function GetPageXY(El) {
827
	var XY = {x: 0, y: 0};
828
	while(El){
829
		XY.x += El.offsetLeft;
830
		XY.y += El.offsetTop;
831
		El = El.offsetParent;
832
	}
833
	return XY;
834
}
835

    
836
function GetScrollTop(){
837
	if (typeof(window.pageYOffset) == 'number'){
838
		return window.pageYOffset;
839
	}
840
	else{
841
		if ((document.body)&&(document.body.scrollTop)){
842
			return document.body.scrollTop;
843
		}
844
		else{
845
			if ((document.documentElement)&&(document.documentElement.scrollTop)){
846
				return document.documentElement.scrollTop;
847
			}
848
			else{
849
				return 0;
850
			}
851
		}
852
	}
853
}
854

    
855
function GetViewportHeight(){
856
	if (typeof window.innerHeight != 'undefined'){
857
		return window.innerHeight;
858
	}
859
	else{
860
		if (((typeof document.documentElement != 'undefined')&&(typeof document.documentElement.clientHeight !=
861
     'undefined'))&&(document.documentElement.clientHeight != 0)){
862
			return document.documentElement.clientHeight;
863
		}
864
		else{
865
			return document.getElementsByTagName('body')[0].clientHeight;
866
		}
867
	}
868
}
869

    
870
function TopSettingWithScrollOffset(TopPercent){
871
	var T = Math.floor(GetViewportHeight() * (TopPercent/100));
872
	return GetScrollTop() + T; 
873
}
874

    
875
//CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back()

876
var InTextBox = false;
877

    
878
function SuppressBackspace(e){ 
879
	if (InTextBox == true){return;}
880
	if (C.ie) {
881
		thisKey = window.event.keyCode;
882
	}
883
	else {
884
		thisKey = e.keyCode;
885
	}
886

    
887
	var Suppress = false;
888

    
889
	if (thisKey == 8) {
890
		Suppress = true;
891
	}
892

    
893
	if (Suppress == true){
894
		if (C.ie){
895
			window.event.returnValue = false;	
896
			window.event.cancelBubble = true;
897
		}
898
		else{
899
			e.preventDefault();
900
		}
901
	}
902
}
903

    
904
if (C.ie){
905
	document.attachEvent('onkeydown',SuppressBackspace);
906
	window.attachEvent('onkeydown',SuppressBackspace);
907
}
908
else{
909
	if (window.addEventListener){
910
		window.addEventListener('keypress',SuppressBackspace,false);
911
	}
912
}
913

    
914
function ReduceItems(InArray, ReduceToSize){
915
	var ItemToDump=0;
916
	var j=0;
917
	while (InArray.length > ReduceToSize){
918
		ItemToDump = Math.floor(InArray.length*Math.random());
919
		InArray.splice(ItemToDump, 1);
920
	}
921
}
922

    
923
function Shuffle(InArray){
924
	var Num;
925
	var Temp = new Array();
926
	var Len = InArray.length;
927

    
928
	var j = Len;
929

    
930
	for (var i=0; i<Len; i++){
931
		Temp[i] = InArray[i];
932
	}
933

    
934
	for (i=0; i<Len; i++){
935
		Num = Math.floor(j  *  Math.random());
936
		InArray[i] = Temp[Num];
937

    
938
		for (var k=Num; k < (j-1); k++) {
939
			Temp[k] = Temp[k+1];
940
		}
941
		j--;
942
	}
943
	return InArray;
944
}
945

    
946
function WriteToInstructions(Feedback) {
947
	document.getElementById('InstructionsDiv').innerHTML = Feedback;
948

    
949
}
950

    
951

    
952

    
953

    
954
function EscapeDoubleQuotes(InString){
955
	return InString.replace(/"/g, '&quot;')
956
}
957

    
958
function TrimString(InString){
959
        var x = 0;
960

    
961
        if (InString.length != 0) {
962
                while ((InString.charAt(InString.length - 1) == '\u0020') || (InString.charAt(InString.length - 1) == '\u000A') || (InString.charAt(InString.length - 1) == '\u000D')){
963
                        InString = InString.substring(0, InString.length - 1)
964
                }
965

    
966
                while ((InString.charAt(0) == '\u0020') || (InString.charAt(0) == '\u000A') || (InString.charAt(0) == '\u000D')){
967
                        InString = InString.substring(1, InString.length)
968
                }
969

    
970
                while (InString.indexOf('  ') != -1) {
971
                        x = InString.indexOf('  ')
972
                        InString = InString.substring(0, x) + InString.substring(x+1, InString.length)
973
                 }
974

    
975
                return InString;
976
        }
977

    
978
        else {
979
                return '';
980
        }
981
}
982

    
983
function FindLongest(InArray){
984
	if (InArray.length < 1){return -1;}
985

    
986
	var Longest = 0;
987
	for (var i=1; i<InArray.length; i++){
988
		if (InArray[i].length > InArray[Longest].length){
989
			Longest = i;
990
		}
991
	}
992
	return Longest;
993
}
994

    
995
//UNICODE CHARACTER FUNCTIONS

996
function IsCombiningDiacritic(CharNum){
997
	var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff)));
998
	Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23)));
999
	return Result;
1000
}
1001

    
1002
function IsCJK(CharNum){
1003
	return ((CharNum >= 0x3000)&&(CharNum < 0xd800));
1004
}
1005

    
1006
//SETUP FUNCTIONS

1007
//BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED

1008
function ClearTextBoxes(){
1009
	var NList = document.getElementsByTagName('input');
1010
	for (var i=0; i<NList.length; i++){
1011
		if ((NList[i].id.indexOf('Guess') > -1)||(NList[i].id.indexOf('Gap') > -1)){
1012
			NList[i].value = '';
1013
		}
1014
		if (NList[i].id.indexOf('Chk') > -1){
1015
			NList[i].checked = '';
1016
		}
1017
	}
1018
}
1019

    
1020
//EXTENSION TO ARRAY OBJECT

1021
function Array_IndexOf(Input){
1022
	var Result = -1;
1023
	for (var i=0; i<this.length; i++){
1024
		if (this[i] == Input){
1025
			Result = i;
1026
		}
1027
	}
1028
	return Result;
1029
}
1030
Array.prototype.indexOf = Array_IndexOf;
1031

    
1032
//IE HAS RENDERING BUG WITH BOTTOM NAVBAR

1033
function RemoveBottomNavBarForIE(){
1034
	if ((C.ie)&&(document.getElementById('Reading') != null)){
1035
		if (document.getElementById('BottomNavBar') != null){
1036
			document.getElementById('TheBody').removeChild(document.getElementById('BottomNavBar'));
1037
		}
1038
	}
1039
}
1040

    
1041

    
1042

    
1043

    
1044
//HOTPOTNET-RELATED CODE

1045

    
1046
var HPNStartTime = (new Date()).getTime();
1047
var SubmissionTimeout = 30000;
1048
var Detail = ''; //Global that is used to submit tracking data

1049

    
1050
function Finish(){
1051
//If there's a form, fill it out and submit it

1052
	if (document.store != null){
1053
		Frm = document.store;
1054
		Frm.starttime.value = HPNStartTime;
1055
		Frm.endtime.value = (new Date()).getTime();
1056
		Frm.mark.value = Score;
1057
		Frm.detail.value = Detail;
1058
		Frm.submit();
1059
	}
1060
}
1061

    
1062

    
1063

    
1064

    
1065

    
1066
//JCLOZE CORE JAVASCRIPT CODE

1067

    
1068
function ItemState(){
1069
	this.ClueGiven = false;
1070
	this.HintsAndChecks = 0;
1071
	this.MatchedAnswerLength = 0;
1072
	this.ItemScore = 0;
1073
	this.AnsweredCorrectly = false;
1074
	this.Guesses = new Array();
1075
	return this;
1076
}
1077

    
1078
var Feedback = '';
1079
var Correct = 'Bravo! Bien jou&#x00E9;.';
1080
var Incorrect = 'Une partie de la r&#x00E9;ponse est correcte. Les erreurs ont &#x00E9;t&#x00E9; effac&#x00E9;es.'; 
1081
var GiveHint = 'La lettre suivante a &#x00E9;t&#x00E9; ajout&#x00E9;e.';
1082
var CaseSensitive = false;
1083
var YourScoreIs = 'Votre score est de:';
1084
var Finished = false;
1085
var Locked = false;
1086
var Score = 0;
1087
var CurrentWord = 0;
1088
var Guesses = '';
1089
var TimeOver = false;
1090

    
1091
I = new Array();
1092

    
1093
I[0] = new Array();
1094
I[0][1] = new Array();
1095
I[0][1][0] = new Array();
1096
I[0][1][0][0] = '\u0034';
1097
I[0][2]='';
1098

    
1099
I[1] = new Array();
1100
I[1][1] = new Array();
1101
I[1][1][0] = new Array();
1102
I[1][1][0][0] = '\u0037';
1103
I[1][2]='';
1104

    
1105

    
1106
State = new Array();
1107

    
1108
function StartUp(){
1109
	RemoveBottomNavBarForIE();
1110
//Show a keypad if there is one	(added bugfix for 6.0.4.12)

1111
	if (document.getElementById('CharacterKeypad') != null){
1112
		document.getElementById('CharacterKeypad').style.display = 'block';
1113
	}
1114
	
1115

    
1116

    
1117

    
1118

    
1119

    
1120

    
1121
	var i = 0;
1122

    
1123
	State.length = 0;
1124
	for (i=0; i<I.length; i++){
1125
		State[i] = new ItemState();
1126
	}
1127
	
1128
	ClearTextBoxes();
1129
	
1130

    
1131

    
1132
}
1133

    
1134
function ShowClue(ItemNum){
1135
	if (Locked == true){return;}
1136
	State[ItemNum].ClueGiven = true;
1137
	ShowMessage(I[ItemNum][2]);
1138
}
1139

    
1140
function SaveCurrentAnswers(){
1141
	var Ans = '';
1142
	for (var i=0; i<I.length; i++){
1143
		Ans = GetGapValue(i);
1144
		if ((Ans.length > 0)&&(Ans != State[i].Guesses[State[i].Guesses.length-1])){
1145
			State[i].Guesses[State[i].Guesses.length] = Ans;
1146
		}
1147
	}
1148
}
1149

    
1150
function CompileGuesses(){
1151
	var F = document.getElementById('store');
1152
	if (F != null){
1153
		var Temp = '<?xml version="1.0"?><hpnetresult><fields>';
1154
		var GapLabel = '';
1155
		for (var i=0; i<State.length; i++){
1156
			GapLabel = 'Gap ' + (i+1).toString();
1157
			Temp += '<field><fieldname>' + GapLabel + '</fieldname>';
1158
			Temp += '<fieldtype>student-responses</fieldtype><fieldlabel>' + GapLabel + '</fieldlabel>';
1159
			Temp += '<fieldlabelid>JClozeStudentResponses</fieldlabelid><fielddata>';
1160
			for (var j=0; j<State[i].Guesses.length; j++){
1161
				if (j>0){Temp += '| ';}
1162
				Temp += State[i].Guesses[j] + ' ';	
1163
			}	
1164
  		Temp += '</fielddata></field>';
1165
		}
1166
		Temp += '</fields></hpnetresult>';
1167
		Detail = Temp;
1168
	}
1169
}
1170

    
1171
function CheckAnswers(){
1172
	if (Locked == true){return;}
1173
	SaveCurrentAnswers();
1174
	var AllCorrect = true;
1175

    
1176
//Check each answer

1177
	for (var i = 0; i<I.length; i++){
1178

    
1179
		if (State[i].AnsweredCorrectly == false){
1180
//If it's right, calculate its score

1181
			if (CheckAnswer(i, true) > -1){
1182
				var TotalChars = GetGapValue(i).length;
1183
				State[i].ItemScore = (TotalChars-State[i].HintsAndChecks)/TotalChars;
1184
				if (State[i].ClueGiven == true){State[i].ItemScore /= 2;}
1185
				if (State[i].ItemScore <0 ){State[i].ItemScore = 0;}
1186
				State[i].AnsweredCorrectly = true;
1187
//Drop the correct answer into the page, replacing the text box

1188
				SetCorrectAnswer(i, GetGapValue(i));
1189
			}
1190
			else{
1191
//Otherwise, increment the hints for this item, as a penalty

1192
				State[i].HintsAndChecks++;
1193

    
1194
//then set the flag

1195
				AllCorrect = false;
1196
			}
1197
		}
1198
	}
1199

    
1200
//Calculate the total score

1201
	var TotalScore = 0;
1202
	for (i=0; i<State.length; i++){
1203
		TotalScore += State[i].ItemScore;
1204
	}
1205
	TotalScore = Math.floor((TotalScore * 100)/I.length);
1206

    
1207
//Compile the output

1208
	Output = '';
1209

    
1210
	if (AllCorrect == true){
1211
		Output = Correct + '<br />';
1212
	}
1213

    
1214
	Output += YourScoreIs + ' ' + TotalScore + '%.<br />';
1215
	if (AllCorrect == false){
1216
		Output += Incorrect;
1217
	}
1218
	ShowMessage(Output);
1219
	setTimeout('WriteToInstructions(Output)', 50);
1220
	
1221
	Score = TotalScore;
1222
	CompileGuesses();
1223
	
1224
	if ((AllCorrect == true)||(Finished == true)){
1225
	
1226

    
1227

    
1228
		TimeOver = true;
1229
		Locked = true;
1230
		Finished = true;
1231
		setTimeout('Finish()', SubmissionTimeout);
1232
	}
1233

    
1234
}
1235

    
1236
function TrackFocus(BoxNumber){
1237
	CurrentWord = BoxNumber;
1238
	InTextBox = true;
1239
}
1240

    
1241
function LeaveGap(){
1242
	InTextBox = false;
1243
}
1244

    
1245
function CheckBeginning(Guess, Answer){
1246
	var OutString = '';
1247
	var i = 0;
1248
	var UpperGuess = '';
1249
	var UpperAnswer = '';
1250

    
1251
	if (CaseSensitive == false) {
1252
		UpperGuess = Guess.toUpperCase();
1253
		UpperAnswer = Answer.toUpperCase();
1254
	}
1255
	else {
1256
		UpperGuess = Guess;
1257
		UpperAnswer = Answer;
1258
	}
1259

    
1260
	while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) {
1261
		OutString += Guess.charAt(i);
1262
		i++;
1263
	}
1264
	OutString += Answer.charAt(i);
1265
	return OutString;
1266
}
1267

    
1268
function GetGapValue(GNum){
1269
	var RetVal = '';
1270
	if ((GNum<0)||(GNum>=I.length)){return RetVal;}
1271
	if (document.getElementById('Gap' + GNum) != null){
1272
		RetVal = document.getElementById('Gap' + GNum).value;
1273
		RetVal = TrimString(RetVal);
1274
	}
1275
	else{
1276
		RetVal = State[GNum].Guesses[State[GNum].Guesses.length-1];
1277
	}
1278
	return RetVal;
1279
}
1280

    
1281
function SetGapValue(GNum, Val){
1282
	if ((GNum<0)||(GNum>=I.length)){return;}
1283
	if (document.getElementById('Gap' + GNum) != null){
1284
		document.getElementById('Gap' + GNum).value = Val;
1285
		document.getElementById('Gap' + GNum).focus();
1286
	}
1287
}
1288

    
1289
function SetCorrectAnswer(GNum, Val){
1290
	if ((GNum<0)||(GNum>=I.length)){return;}
1291
	if (document.getElementById('GapSpan' + GNum) != null){
1292
		document.getElementById('GapSpan' + GNum).innerHTML = Val;
1293
	}
1294
}
1295

    
1296
function FindCurrent() {
1297
	var x = 0;
1298
	FoundCurrent = -1;
1299

    
1300
//Test the current word:

1301
//If its state is not set to already correct, check the word.

1302
	if (State[CurrentWord].AnsweredCorrectly == false){
1303
		if (CheckAnswer(CurrentWord, false) < 0){
1304
			return CurrentWord;
1305
		}
1306
	}
1307
	
1308
	x=CurrentWord + 1;
1309
	while (x<I.length){
1310
		if (State[x].AnsweredCorrectly == false){
1311
			if (CheckAnswer(x, false) < 0){
1312
				return x;
1313
			}
1314
		}
1315
	x++;	
1316
	}
1317

    
1318
	x = 0;
1319
	while (x<CurrentWord){
1320
		if (State[x].AnsweredCorrectly == false){
1321
			if (CheckAnswer(x, false) < 0){
1322
				return x;
1323
			}
1324
		}
1325
	x++;	
1326
	}
1327
	return FoundCurrent;
1328
}
1329

    
1330
function CheckAnswer(GapNum, MarkAnswer){
1331
	var Guess = GetGapValue(GapNum);
1332
	var UpperGuess = '';
1333
	var UpperAnswer = '';
1334
	if (CaseSensitive == false){
1335
		UpperGuess = Guess.toUpperCase();
1336
	}
1337
	else{
1338
		UpperGuess = Guess;
1339
	}
1340
	var Match = -1;
1341
	for (var i = 0; i<I[GapNum][1].length; i++){
1342
		if (CaseSensitive == false){
1343
			UpperAnswer = I[GapNum][1][i][0].toUpperCase();
1344
		}
1345
		else{
1346
			UpperAnswer = I[GapNum][1][i][0];
1347
		}
1348
		if (TrimString(UpperGuess) == UpperAnswer){
1349
			Match = i;
1350
			if (MarkAnswer == true){
1351
				State[GapNum].AnsweredCorrectly = true;
1352
			}
1353
		}
1354
	}
1355
	return Match;
1356
}
1357

    
1358
function GetHint(GapNum){
1359
	Guess = GetGapValue(GapNum);
1360

    
1361
	if (CheckAnswer(GapNum, false) > -1){return ''}
1362
	RightBits = new Array();
1363
	for (var i=0; i<I[GapNum][1].length; i++){
1364
		RightBits[i] = CheckBeginning(Guess, I[GapNum][1][i][0]);
1365
	}
1366
	var RightOne = FindLongest(RightBits);
1367
	var Result = I[GapNum][1][RightOne][0].substring(0,RightBits[RightOne].length);
1368
//Add another char if the last one is a space

1369
	if (Result.charAt(Result.length-1) == ' '){
1370
		Result = I[GapNum][1][RightOne][0].substring(0,RightBits[RightOne].length+1);
1371
	}
1372
	return Result;
1373
}
1374

    
1375
function ShowHint(){
1376
	if (document.getElementById('FeedbackDiv').style.display == 'block'){return;}
1377
	if (Locked == true){return;}
1378
	var CurrGap = FindCurrent();
1379
	if (CurrGap < 0){return;}
1380

    
1381
	var HintString = GetHint(CurrGap);
1382

    
1383
	if (HintString.length > 0){
1384
		SetGapValue(CurrGap, HintString);
1385
		State[CurrGap].HintsAndChecks += 1;
1386
	}
1387
	ShowMessage(GiveHint);
1388
}
1389

    
1390
function TypeChars(Chars){
1391
	var CurrGap = FindCurrent();
1392
	if (CurrGap < 0){return;}
1393
	if (document.getElementById('Gap' + CurrGap) != null){
1394
		SetGapValue(CurrGap, document.getElementById('Gap' + CurrGap).value + Chars);
1395
	}
1396
}
1397

    
1398

    
1399

    
1400

    
1401

    
1402

    
1403

    
1404

    
1405
//-->

1406

    
1407
//]]>

1408

    
1409
</script>
1410

    
1411

    
1412
</head>
1413

    
1414
<body onload="StartUp()" id="TheBody" >
1415

    
1416
<!-- BeginTopNavButtons -->
1417

    
1418

    
1419

    
1420
<!-- EndTopNavButtons -->
1421

    
1422
<div class="Titles">
1423
	<h2 class="ExerciseTitle">hotpotatoes test</h2>
1424

    
1425
	<h3 class="ExerciseSubtitle">Texte trou&#x00E9;.</h3>
1426

    
1427

    
1428

    
1429
</div>
1430

    
1431
<div id="InstructionsDiv" class="StdDiv">
1432
	<div id="Instructions"></div>
1433
</div>
1434

    
1435

    
1436

    
1437

    
1438

    
1439
<div id="MainDiv" class="StdDiv">
1440

    
1441
<!-- These top buttons hidden; reveal if required -->
1442
<!--

1443
<button id="CheckButton1" class="FuncButton" onmouseover="FuncBtnOver(this)" onfocus="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onblur="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="CheckAnswers()">&nbsp;Correction&nbsp;</button>

1444


1445


1446


1447
 -->
1448
 
1449
<div id="ClozeDiv">
1450
<form id="Cloze" method="post" action="" onsubmit="return false;">
1451
<div class="ClozeBody">
1452
2+2 = <span class="GapSpan" id="GapSpan0"><input type="text" id="Gap0" onfocus="TrackFocus(0)" onblur="LeaveGap()" class="GapBox" size="6"></input></span> <br /><br />2=5 = <span class="GapSpan" id="GapSpan1"><input type="text" id="Gap1" onfocus="TrackFocus(1)" onblur="LeaveGap()" class="GapBox" size="6"></input></span> 
1453
</div>
1454
</form>
1455
</div>
1456

    
1457

    
1458

    
1459
<button id="CheckButton2" class="FuncButton" onmouseover="FuncBtnOver(this)" onfocus="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onblur="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="CheckAnswers()">&nbsp;Correction&nbsp;</button>
1460

    
1461

    
1462

    
1463
</div>
1464

    
1465

    
1466

    
1467
<div class="Feedback" id="FeedbackDiv">
1468
<div class="FeedbackText" id="FeedbackContent"></div>
1469
<button id="FeedbackOKButton" class="FuncButton" onfocus="FuncBtnOver(this)" onblur="FuncBtnOut(this)" onmouseover="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="HideFeedback(); return false;">&nbsp;OK&nbsp;</button>
1470
</div>
1471

    
1472
<!-- BeginBottomNavButtons -->
1473

    
1474

    
1475

    
1476
<!-- EndBottomNavButtons -->
1477

    
1478
<!-- BeginSubmissionForm -->
1479

    
1480
<!-- EndSubmissionForm -->
1481

    
1482
</body>
1483

    
1484
</html>
(2-2/4)