function showOrHide(eId, thisImg, state) {
  if (e = document.getElementById(eId)) {
      if (state == null) {
	      state = e.style.display == 'none';
	      e.style.display = (state ? '' : 'none');
      }

      var myItm = document.getElementById('li_' + eId);
      if (myItm != null){
	        myItm.className = 'current';      
      }
      
      //...except for this, probably a better way of doing this, but it works at any rate...
      var myImg = document.getElementById(thisImg);
      if (myImg != null){
          if (state == true){				
	          myImg.src="../images/collapse.jpg";
          }
          if (state == false){
	          myImg.src="../images/expand.jpg";
          }
      }
   
      
  }
}

//opens a window and centers it
function openWin(sPage,w,h,scrollbars,status,resize,percentage){

	var fullHeight = getViewportHeight();
	var fullWidth = getViewportWidth();

	if (percentage != null){
		h = fullHeight*percentage;
		w = fullWidth*percentage;
	}
	
	var winL = (fullWidth - w) / 2;
	var winT = (fullHeight - h) / 2;
	
	var myWin = window.open(sPage,'','height=' + h + ',width=' + w + ',left=' + winL + ',top=' + winT + ',status=' + status + ',scrollbars=' + scrollbars + ',resizable=' + resize);
	
	return myWin;
}

function setFocus2(ctl_name){
    var o = getElementById(ctl_name);
    if (o != null){
        o.focus();
    }
    
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
	if (window.innerHeight!=window.undefined) return window.innerHeight;
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 
	return window.undefined; 
}
function getViewportWidth() {
	if (window.innerWidth!=window.undefined) return window.innerWidth; 
	if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
	return window.undefined; 
}

