function getbyid(id) {
itm = null;
if (document.getElementById) {
itm = document.getElementById(id);
}
else if (document.all) {
itm = document.all[id];
}
else if (document.layers) {
itm = document.layers[id];
}
return itm;
}
function hide_div(itm) {
if ( ! itm ) return;
itm.style.display = "none";
}
function show_div(itm) {
if ( ! itm ) return;
itm.style.display = "";
}
function resizeTextarea(itm,direction)
{
var txtarea = document.getElementById(itm);
if (direction == 'down')
{
txtarea.rows = txtarea.rows + 3;
}
else
{
txtarea.rows = txtarea.rows - 3;
}
}
function openCentered(theURL,winName,winWidth,winHeight,features) {
var w = (screen.width - winWidth)/2;
var h = (screen.height - winHeight)/2 - 30;
features = features+',width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
window.open(theURL,winName,features);
}
function getElementsByClass(searchClass, node, tagName) {
if(node == null) {
node = document;
}
// For browsers that have this built in
if(document.getElementsByClassName) {
return node.getElementsByClassName(searchClass);
}
// at least try with querySelector (IE8 standards mode)
// about 5x quicker than below
if(node.querySelectorAll) {
if (tagName == null) {
tagName = '';
}
return node.querySelectorAll(tagName + '.' + searchClass);
}
// For everything else
var classElements = new Array();
if (tagName == null) {
tagName = '*';
}
var els = node.getElementsByTagName(tagName);
var elsLen = els.length;
var pattern = new RegExp('(^|\\\\s)' + searchClass + '(\\\\s|$)');
for (i = 0, j = 0; i < elsLen; i++) {
if(pattern.test(els[i].className)) {
classElements[j] = els[i];
j++;
}
}
return classElements;
}