var isMSIE = /*@cc_on!@*/false; function bodyOnLoad() { showSystemMessage(); } function bodyOnUnload() {} /* return selected radiobutton */ function getSelectedRadio(id) { var r = document.getElementsByName(id); for (var i = 0; i < r.length; i++) { if (r[i].checked) { return r[i].value }} return false; } // show system message in the middle of the screen function showSystemMessage() { var msg = document.getElementById('systemMessage'); if (msg) { // make half-visible standard content var substrate = document.getElementById('bodySubstrate'); if (substrate) { substrate.style.display = 'block'; } } if (isMSIE) { // stupid IE, it needs time to understand that content has been scrolled window.setTimeout( centerSystemMessage, 400); } else { // just do it centerSystemMessage(); } } function centerSystemMessage() { var msg = document.getElementById('systemMessage'); if (msg) { var viewport = _cas.window.getViewPort(); var margin = 4; // same value as in style.css var border = 1; // same value as in see style.css var padding = 4; // same value as in see style.css var screenWidth = parseInt(viewport.x2 - viewport.x1); var msgWidth = screenWidth / 2; msg.style.top = viewport.y1 + parseInt(viewport.y2 - viewport.y1 - msg.offsetHeight ) / 2 + 'px'; msg.style.left = screenWidth / 4 - margin - border - padding + 'px'; msg.style.width = msgWidth + 'px'; msg.style.display = 'block'; var closeButton = document.getElementById('messages_close_button'); if (closeButton) { closeButton.focus(); } } } function hideSystemMessage() { var msg = document.getElementById('systemMessage'); if (msg) { msg.style.display = 'none'; } // make half-visible standard content var substrate = document.getElementById('bodySubstrate'); if (substrate) { substrate.style.display = 'none'; } } /* returns selected checkbox IDs */ function getSelectedItems(id) { ids = new Array(); p = document.getElementsByName(id); for (i = 0; i < p.length; i++) { if (p[i].checked) { ids[ids.length] = p[i].value }}; if (ids.length == 0) { alert('Empty selection. Please select at least one participant'); return false; } return ids.join(','); } /* inverts the selection */ function invertSelection(id) { var c = document.getElementsByName(id); for ( var i = 0; i < c.length; i++ ) { c[i].checked = !c[i].checked; } } /* change the selection */ function setSelection(id, checked) { var c = document.getElementsByName(id); for ( var i = 0; i < c.length; i++ ) { c[i].checked = checked; } } /* resizes scrollable tables to fit the screen optimally */ function resizeTables() { if (isMSIE) return; var table = document.getElementById('dataTable'); if (!table) { return; } var currentTableHeight = table.scrollHeight; var otherHeight = document.body.scrollHeight - currentTableHeight; var desiredHeight = getPageHeight() - otherHeight - 60; if (desiredHeight < 250) desiredHeight = 250 if (getPageHeight() - otherHeight < currentTableHeight) { //do not fit, change size of table contents table.style.height = desiredHeight + 'px'; //tbody height must be = desiredHeight = thead.height if (table.getElementsByTagName('thead') && table.getElementsByTagName('tbody')){ thead = table.getElementsByTagName('thead')[0]; tbody = table.getElementsByTagName('tbody')[0]; tbody.style.height = desiredHeight - thead.scrollHeight + 'px'; } } } /* redirects browther to an URL */ function gotoURL(url, target) { var s = url.indexOf('?') < 0 ? '?' : '&'; var location = url + s + 'sid=' + parseInt(Math.random() * 1000000); if (typeof(target) == 'undefined') { window.location.href = location; } else { var newWindow = window.open(location, target); newWindow.focus(); } } /* returns client page width and height */ function getPageWidth() { var W; if( typeof( window.innerWidth ) == 'number' ) { W = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { W = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { W = document.body.clientWidth; } return W } function getPageHeight() { var H; if( typeof( window.innerWidth ) == 'number' ) { H = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { H = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { H = document.body.clientHeight; } return H } function getDocHeight() { var D = document; return Math.max( Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight) ); }