2 * This array is used to remember mark status of rows in browse mode
4 var marked_row
= new Array
;
5 var orig_row_colors
= new Array();
9 * (un)Checks checkbox for the row that the current table cell is in
10 * when it gets clicked.
12 * @param string the name of the checkbox that should be (un)checked
14 function row_click(chkboxName
) {
15 chkbox
= document
.getElementById(chkboxName
);
17 // initialize orig_row_color if not defined already
18 if (!orig_row_colors
[chkboxName
]) {
19 orig_row_colors
[chkboxName
] = chkbox
.parentNode
.getAttribute('bgcolor');
21 chkbox
.checked
= (chkbox
.checked
? false : true);
25 * This function is used to initialize the orig_row_color array so we do not
26 * need to predefine the entire array
28 function rowOver(chkboxName
, overColor
, clickedColor
) {
29 chkbox
= document
.getElementById(chkboxName
);
31 if (!orig_row_colors
[chkboxName
]) {
32 bgColor
= chkbox
.parentNode
.getAttribute('bgcolor');
33 orig_row_colors
[chkboxName
] = bgColor
;
35 bgColor
= orig_row_colors
[chkboxName
];
37 j
= chkbox
.name
.length
- 1
38 setPointer(chkbox
.parentNode
.parentNode
, j
,'over' , bgColor
, overColor
, clickedColor
);
43 * (un)Checks all checkboxes for the message list from a specific form
44 * when it gets clicked.
46 * @param string the id of the form where all checkboxes should be (un)checked
47 * @param boolean use fancy row coloring when a checkbox is checked
48 * @param string new color of the checked rows
50 function toggle_all(formname
, fancy
, clickedColor
) {
51 TargetForm
= document
.getElementById(formname
);
53 for (var i
= 0; i
< TargetForm
.elements
.length
; i
++) {
54 if (TargetForm
.elements
[i
].type
== 'checkbox' && TargetForm
.elements
[i
].name
.substring(0,3) == 'msg') {
56 array_key
= TargetForm
.elements
[i
].getAttribute('id');
57 if (TargetForm
.elements
[i
].checked
== false) {
58 // initialize orig_row_color if not defined already
59 if (!orig_row_colors
[array_key
]) {
60 orig_row_colors
[array_key
] = TargetForm
.elements
[i
].parentNode
.getAttribute('bgcolor');
63 origColor
= orig_row_colors
[array_key
];
64 setPointer(TargetForm
.elements
[i
].parentNode
.parentNode
, j
,'click' , origColor
, origColor
, clickedColor
);
67 TargetForm
.elements
[i
].checked
= !(TargetForm
.elements
[i
].checked
);
73 * Sets/unsets the pointer and marker in browse mode
75 * @param object the table row
76 * @param integer the row number
77 * @param string the action calling this script (over, out or click)
78 * @param string the default background color
79 * @param string the color to use for mouseover
80 * @param string the color to use for marking a row
82 * @return boolean whether pointer is set or not
84 function setPointer(theRow
, theRowNum
, theAction
, theDefaultColor
, thePointerColor
, theMarkColor
)
88 // 1. Pointer and mark feature are disabled or the browser can't get the
90 if ((thePointerColor
== '' && theMarkColor
== '')
91 || typeof(theRow
.style
) == 'undefined') {
95 // 2. Gets the current row and exits if the browser can't get it
96 if (typeof(document
.getElementsByTagName
) != 'undefined') {
97 theCells
= theRow
.getElementsByTagName('td');
99 else if (typeof(theRow
.cells
) != 'undefined') {
100 theCells
= theRow
.cells
;
106 // 3. Gets the current color...
107 var rowCellsCnt
= theCells
.length
;
108 var domDetect
= null;
109 var currentColor
= null;
111 // 3.1 ... with DOM compatible browsers except Opera that does not return
112 // valid values with "getAttribute"
113 if (typeof(window
.opera
) == 'undefined'
114 && typeof(theCells
[0].getAttribute
) != 'undefined') {
115 currentColor
= theCells
[0].getAttribute('bgcolor');
118 // 3.2 ... with other browsers
120 currentColor
= theCells
[0].style
.backgroundColor
;
124 // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
125 if (currentColor
.indexOf("rgb") >= 0)
127 var rgbStr
= currentColor
.slice(currentColor
.indexOf('(') + 1,
128 currentColor
.indexOf(')'));
129 var rgbValues
= rgbStr
.split(",");
131 var hexChars
= "0123456789ABCDEF";
132 for (var i
= 0; i
< 3; i
++)
134 var v
= rgbValues
[i
].valueOf();
135 currentColor
+= hexChars
.charAt(v
/16) + hexChars
.charAt(v
%16);
139 // 4. Defines the new color
140 // 4.1 Current color is the default one
141 if (currentColor
== ''
142 || currentColor
.toLowerCase() == theDefaultColor
.toLowerCase()) {
143 if (theAction
== 'over' && thePointerColor
!= '') {
144 newColor
= thePointerColor
;
146 else if (theAction
== 'click' && theMarkColor
!= '') {
147 newColor
= theMarkColor
;
148 marked_row
[theRowNum
] = true;
149 // deactivated onclick marking of the checkbox because it's also executed
150 // when an action (clicking on the checkbox itself) on a single item is
151 // performed. Then the checkbox would get deactived, even though we need
152 // it activated. Maybe there is a way to detect if the row was clicked,
153 // and not an item therein...
154 //document.getElementById('msg[' + theRowNum + ']').checked = true;
157 // 4.1.2 Current color is the pointer one
158 else if (currentColor
.toLowerCase() == thePointerColor
.toLowerCase()
159 && (typeof(marked_row
[theRowNum
]) == 'undefined' || !marked_row
[theRowNum
])) {
160 if (theAction
== 'out') {
161 newColor
= theDefaultColor
;
163 else if (theAction
== 'click' && theMarkColor
!= '') {
164 newColor
= theMarkColor
;
165 marked_row
[theRowNum
] = true;
166 //document.getElementById('msg[' + theRowNum + ']').checked = true;
169 // 4.1.3 Current color is the marker one
170 else if (currentColor
.toLowerCase() == theMarkColor
.toLowerCase()) {
171 if (theAction
== 'click') {
172 newColor
= (thePointerColor
!= '')
175 marked_row
[theRowNum
] = (typeof(marked_row
[theRowNum
]) == 'undefined' || !marked_row
[theRowNum
])
178 //document.getElementById('msg[' + theRowNum + ']').checked = false;
182 // 5. Sets the new color...
185 // 5.1 ... with DOM compatible browsers except Opera
187 for (c
= 0; c
< rowCellsCnt
; c
++) {
188 theCells
[c
].setAttribute('bgcolor', newColor
, 0);
191 // 5.2 ... with other browsers
193 for (c
= 0; c
< rowCellsCnt
; c
++) {
194 theCells
[c
].style
.backgroundColor
= newColor
;
200 } // end of the 'setPointer()' function
202 function comp_in_new_form(comp_uri
, button
, myform
, iWidth
, iHeight
) {
203 comp_uri
+= "&" + button
.name
+ "=1";
204 for ( var i
=0; i
< myform
.elements
.length
; i
++ ) {
205 if ( myform
.elements
[i
].type
== "checkbox" && myform
.elements
[i
].checked
)
206 comp_uri
+= "&" + myform
.elements
[i
].name
+ "=1";
208 if (!iWidth
) iWidth
= 640;
209 if (!iHeight
) iHeight
= 550;
210 sArg
= "width=" + iWidth
+ ",height=" + iHeight
+ ",scrollbars=yes,resizable=yes,status=yes";
211 var newwin
= window
.open(comp_uri
, "_blank", sArg
);
214 function comp_in_new(comp_uri
, iWidth
, iHeight
) {
215 if (!iWidth
) iWidth
= 640;
216 if (!iHeight
) iHeight
= 550;
217 sArg
= "width=" + iWidth
+ ",height=" + iHeight
+ ",scrollbars=yes,resizable=yes,status=yes";
218 var newwin
= window
.open(comp_uri
, "_blank", sArg
);
222 * Reload the read_body screen on sending an mdn receipt
225 mdnuri
=window
.location
+'&sendreceipt=1';
226 var newwin
= window
.open(mdnuri
,'right');
229 function checkForm(smaction
) {
231 * this part is used for setting the focus in the compose screen
234 if (smaction
== "select") {
235 document
.forms
['compose'].body
.select();
236 } else if (smaction
== "focus") {
237 document
.forms
['compose'].body
.focus();
241 * All other forms that need to set the focus
243 var f
= document
.forms
.length
;
246 while( pos
== -1 && i
< f
) {
247 var e
= document
.forms
[i
].elements
.length
;
249 while( pos
== -1 && j
< e
) {
250 if ( document
.forms
[i
].elements
[j
].type
== 'text' || document
.forms
[i
].elements
[j
].type
== 'password' ) {
258 document
.forms
[i
-1].elements
[pos
].focus();