Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / hotpot / template / v6 / hp6showmessage.js_
blobd013a29904ebe2c74180a63aaffcd756b912b582
3 //CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX
5 var topZ = 1000;
7 function ShowMessage(Feedback){
8         var Output = Feedback + '<br /><br />';
9         document.getElementById('FeedbackContent').innerHTML = Output;
10         var FDiv = document.getElementById('FeedbackDiv');
11         topZ++;
12         FDiv.style.zIndex = topZ;
13         FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
15         FDiv.style.display = 'block';
17         ShowElements(false, 'input');
18         ShowElements(false, 'select');
19         ShowElements(false, 'object');
20         ShowElements(true, 'object', 'FeedbackContent');
22 //Focus the OK button
23         setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
25 //[inclPreloadImages]
26 //      RefreshImages();
27 //[/inclPreloadImages]
30 function ShowElements(Show, TagName, ContainerToReverse){
31 // added third argument to allow objects in the feedback box to appear
32 //IE bug -- hide all the form elements that will show through the popup
33 //FF on Mac bug : doesn't redisplay objects whose visibility is set to visible
34 //unless the object's display property is changed
36         //get container object (by Id passed in, or use document otherwise)
37         TopNode = document.getElementById(ContainerToReverse);
38         var Els;
39         if (TopNode != null) {
40                 Els = TopNode.getElementsByTagName(TagName);
41         } else {
42                 Els = document.getElementsByTagName(TagName);
43         }
45         for (var i=0; i<Els.length; i++){
46                 if (TagName == "object") {
47                         //manipulate object elements in all browsers
48                         if (Show == true){
49                                 Els[i].style.visibility = 'visible';
50                                 //get Mac FireFox to manipulate display, to force screen redraw
51                                 if (C.mac && C.gecko) {Els[i].style.display = '';}
52                         }
53                         else{
54                                 Els[i].style.visibility = 'hidden';
55                                 if (C.mac && C.gecko) {Els[i].style.display = 'none';}
56                         }
57                 }
58                 else {
59                         // tagName is either input or select (that is, Form Elements)
60                         // ie6 has a problem with Form elements, so manipulate those
61                         if (C.ie) {
62                                 if (C.ieVer < 7) {
63                                         if (Show == true){
64                                                 Els[i].style.visibility = 'visible';
65                                         }
66                                         else{
67                                                 Els[i].style.visibility = 'hidden';
68                                         }
69                                 }
70                         }
71                 }
72         }
77 function HideFeedback(){
78         document.getElementById('FeedbackDiv').style.display = 'none';
79         ShowElements(true, 'input');
80         ShowElements(true, 'select');
81         ShowElements(true, 'object');
82         if (Finished == true){
83                 Finish();
84         }