diff --git a/html/include/focus.js b/html/include/focus.js
index cce26f4efedd62e56e15326f863d38d76db6d949..710d741d5cdcca5f1af62b7427c0f32de471a5c4 100644 (file)
--- a/html/include/focus.js
+++ b/html/include/focus.js
var browserType;
+var timeout;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
}
netscape= (ver.charAt(iln+1).toUpperCase() != "C");
+function toggle_all_(regex,state_object)
+{
+ state = document.getElementById(state_object).checked;
+ chk_set_all(regex, state);
+}
+
+
+/* Toggle checkbox that matches regex */
+function chk_set_all(regex,value)
+{
+ for (var i = 0; i < document.mainform.elements.length; i++) {
+ var _id=document.mainform.elements[i].id;
+ if(_id.match(regex)) {
+ document.getElementById(_id).checked= value;
+ }
+ }
+}
+
+
+function scrollDown() {
+ document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
+ timeout= setTimeout("scrollDown()", 500);
+}
+
+/* Scroll down the body frame */
+function scrollDown2()
+{
+ document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
+}
+
function keyPress(DnEvents) {
// determines whether Netscape or Internet Explorer
document.poppedLayer = document.all[element];
else
document.poppedLayer = document.layers[element];
- document.poppedLayer.style.visibility = "hidden";
+ document.poppedLayer.style.visibility = "hidden";
}
function show(element) {
else
document.poppedLayer = document.layers[element];
- if (document.poppedLayer.style.visibility == "visible")
+ if (document.poppedLayer.style.visibility == "visible") {
hide (element);
- else
+ } else {
show (element);
-
+ }
}
function popup(target, name) {
form.javascript.value = 'true';
}
-window.onload = register;
-window.onresize = register;
+window.onload = adjust;
+window.onresize = adjust;
+
+function adjust (e) {
+ adjust_height(e);
+ adjust_width(e);
+}
-function register(e) {
+// Automatic resize (height) of divlists
+function adjust_height(e) {
if (!e) e=window.event;
- var px_height= window.innerHeight-220;
- if(px_height >= 480) {
- document.getElementById("d_scrollbody").style.height=px_height+"px";
+ if (document.getElementById("menucell") && document.getElementById("d_scrollbody")) {
+ var inner_height= window.innerHeight;
+ var min_height= 450;
+ var px_height= min_height;
+ var suggested= px_height;
+
+ // document.defaultView allows access to the rendered size of elements and should be supported by modern browsers
+ if(document.defaultView) {
+ var menu_height=parseInt(document.defaultView.getComputedStyle(document.getElementById("menucell"),"").getPropertyValue('height'));
+
+ // Minimum height for divlist should be the bottom edge of the menu
+ min_height= menu_height-197;
+ suggested= min_height;
+ if((inner_height-230)-suggested>0) {
+ suggested= inner_height-230;
+ }
+
+ // IE uses other height specifications
+ } else if (browserType == "ie") {
+ suggested= document.all.menucell.offsetHeight;
+ offset= absTop(d_scrollbody);
+ suggested-= offset;
+ if((inner_height-230)-suggested>0) {
+ suggested= inner_height-230;
+ }
+ }
+ document.getElementById("d_scrollbody").style.height=suggested+"px";
}
return true;
}
+
+function absTop(e) {
+ return (e.offsetParent)?e.offsetTop+absTop(e.offsetParent) : e.offsetTop;
+}
+
+// Automatic resize (width) of divlists
+function adjust_width(e) {
+ if (!e) e=window.event;
+
+ // Known to not work with IE
+ if(document.defaultView && document.getElementById("t_scrolltable")) {
+ // Resize the div
+ var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width'));
+ var width= parseInt(window.innerWidth);
+
+ // Resize the body cells
+ var diff= width-div_width-470;
+
+ // window has been upscaled
+ if(div_width+diff>=600) {
+ document.getElementById('d_scrollbody').style.width=div_width+diff+"px";
+ document.getElementById('t_scrollbody').style.width=(div_width-19)+diff+"px";
+
+ // Resize the Header cells (only the relative-width ones)
+ document.getElementById('t_scrollhead').style.width=div_width+diff+"px";
+
+ // window has been downscaled, we must reset the div to 600px
+ } else if (width < 930) {
+ // Reset layout (set width to 600px)
+ div_width=600;
+ document.getElementById('d_scrollbody').style.width=div_width+"px";
+ document.getElementById('t_scrollbody').style.width=(div_width-19)+"px";
+
+ // Resize the Header cells (only the relative-width ones)
+ document.getElementById('t_scrollhead').style.width=div_width+"px";
+ }
+ } else if(document.defaultView && document.getElementById("t_scrolltable_onlywidth")) {
+ // Resize the div
+ var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable_onlywidth"),"").getPropertyValue('width'));
+ var width= parseInt(window.innerWidth);
+
+ // Resize the body cells
+ var diff= width-div_width-470;
+
+ // window has been upscaled
+ if(div_width+diff>=600) {
+ document.getElementById('d_scrollbody_onlywidth').style.width=div_width+diff+"px";
+ document.getElementById('t_scrollbody_onlywidth').style.width=(div_width-19)+diff+"px";
+
+ // Resize the Header cells (only the relative-width ones)
+ document.getElementById('t_scrollhead_onlywidth').style.width=div_width+diff+"px";
+
+ // window has been downscaled, we must reset the div to 600px
+ } else if (width < 930) {
+ // Reset layout (set width to 600px)
+ div_width=600;
+ document.getElementById('d_scrollbody_onlywidth').style.width=div_width+"px";
+ document.getElementById('t_scrollbody_onlywidth').style.width=(div_width-19)+"px";
+
+ // Resize the Header cells (only the relative-width ones)
+ document.getElementById('t_scrollhead_onlywidth').style.width=div_width+"px";
+ }
+ } else {
+ // IE
+
+ }
+}
+
+
+
+/* Set focus to first valid input field
+ avoid IExplorer warning about hidding or disabled fields
+*/
+function focus_field()
+{
+ var i = 0;
+ var e = 0;
+ var found = false;
+ var element_name = "";
+ var element =null;
+
+ while(focus_field.arguments[i] && !found){
+
+ var tmp = document.getElementsByName(focus_field.arguments[i]);
+ for(e = 0 ; e < tmp.length ; e ++ ){
+
+ if(tmp[e].disabled != true && tmp[e].type != "none" && tmp[e].type != "hidden" ){
+ found = true;
+ element = tmp[e];
+ }
+ }
+ i++;
+ }
+
+ if(element && found){
+ element.blur();
+ element.focus();
+ }
+}
+
// vim:ts=2:syntax