var bUsernameHasFocus = false;
var bPasswordHasFocus = false;

function toggleDiv(id) {
	if (document.getElementById) {
		if (document.getElementById(id).style.display == 'block') {
			document.getElementById(id).style.display = 'none';
		}
		else {
			document.getElementById(id).style.display = 'block';
		}
	}
	else {
		if (document.layers) {
			if (document.id.display == 'block') {
				document.id.display = 'none';
			}
			else {
				document.id.display = 'block';
			}
		}
		else {
			if (document.all.id.style.display == 'block') {
				document.all.id.style.display = 'none';
			}
			else {
				document.all.id.style.display = 'block';
			}
		}
	}
}

function toggleRow(id) {
  if (document.getElementById) {
    if (document.getElementById(id).style.display == '') {
      document.getElementById(id).style.display = 'none';
    }
    else {
      document.getElementById(id).style.display = '';
    }
  }
  else {
    if (document.layers) {
      if (document.id.display == '') {
        document.id.display = 'none';
      }
      else {
        document.id.display = 'table-row';
      }
    }
    else {
      if (document.all.id.style.display == '') {
        document.all.id.style.display = 'none';
      }
      else {
        document.all.id.style.display = '';
      }
    }
  }
}

function toggleVisible(id) {
  if (document.getElementById) {
    if (document.getElementById(id).style.visibility == 'visible') {
      document.getElementById(id).style.visibility = 'hidden';
    }
    else {
      document.getElementById(id).style.visibility = 'visible';
    }
  }
}

function statusMonWindow(page,id) {
	OpenWin = this.open(page, id,"width=150,height=150,status=0,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0");
}

// assumes the user name field has this: onfocus="bUsernameHasFocus = true;" onblur="bUsernameHasFocus = false;"
// and the password field has: onfocus="bPasswordHasFocus = true;" onblur="bPasswordHasFocus = false;"
// also the two global variables should be declared in a global scope
function safeFocus(Id) {
	if (bUsernameHasFocus == false && bPasswordHasFocus == false) {
		if(document.getElementById(Id)) {
			document.getElementById(Id).focus();
		}
	}
}