52b6a65bcff4ccde398773e59bb81ad7c48c18d7
[citadel.git] / webcit / static / wclib.js
1 //
2 // $Id$
3 //
4 // JavaScript function library for WebCit
5 //
6 //
7
8
9 //
10 // This code handles the popups for instant messages.
11 //
12
13 var browserType;
14
15 if (document.layers) {browserType = "nn4"}
16 if (document.all) {browserType = "ie"}
17 if (window.navigator.userAgent.toLowerCase().match("gecko")) {
18         browserType= "gecko"
19 }
20
21 function hide_page_popup() {
22         if (browserType == "gecko" )
23                 document.poppedLayer = eval('document.getElementById(\'page_popup\')');
24         else if (browserType == "ie")
25                 document.poppedLayer = eval('document.all[\'page_popup\']');
26         else
27                 document.poppedLayer = eval('document.layers[\'`page_popup\']');
28
29         document.poppedLayer.style.visibility = "hidden";
30 }
31
32 function hide_imsg_popup_old() {
33         if (browserType == "gecko" )
34                 document.poppedLayer = eval('document.getElementById(\'important_message\')');
35         else if (browserType == "ie")
36                 document.poppedLayer = eval('document.all[\'important_message\']');
37         else
38                 document.poppedLayer = eval('document.layers[\'`important_message\']');
39
40         document.poppedLayer.style.visibility = "hidden";
41 }
42
43 function hide_imsg_popup() {
44         // new Effect.FadeTo('important_message', 0.0, 1000, 20, {complete:function() { hide_imsg_popup_old(); }} );
45         hide_imsg_popup_old();  // Do it the old way for now, to avoid library conflicts
46 }
47
48
49 // This function activates the ajax-powered recipient autocompleters on the message entry screen.
50 function activate_entmsg_autocompleters() {
51         new Ajax.Autocompleter('cc_id', 'cc_name_choices', '/cc_autocomplete', {} );
52         new Ajax.Autocompleter('bcc_id', 'bcc_name_choices', '/bcc_autocomplete', {} );
53         new Ajax.Autocompleter('recp_id', 'recp_name_choices', '/recp_autocomplete', {} );
54 }