var newWindow = null;

function closeWin(){
  if (newWindow != null){
    if(!newWindow.closed)
      newWindow.close();
  }
}

function popUpWin(url, type, strWidth, strHeight) {

  /*
   * type = [ standard | fullscreen | console ]
   */

  closeWin();

  if (type == "fullScreen"){
    strWidth = screen.availWidth - 10;
    strHeight = screen.availHeight - 160;
  }

  var tools="";
  if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
  if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
  newWindow = window.open(url, 'newWin', tools);
  newWindow.focus();
}

function hideItem( obj, hideId ) {
  var target = document.getElementById( hideId );
  var pattern = new RegExp("id\=(\\d+$)");

  if( obj.value == 0 ) {
    target.style.visibility = 'hidden';
  } else {
    target.href = target.href.replace( pattern, "id=" + obj.value );
    target.style.visibility = 'visible';
  }
}

/*
function getQSElements() {
  var url_string = String( document.location );
  var query_string = url_string.split('?');

  if( query_string[1] ){
    var elem_array = query_string[1].split( '&' );

    for( i = 0; i < elem_array.length; i++ ){
      if( elem_array[i] ){
        pullQSElements( elem_array[i] );
      }
    }
  }
}

function pullQSElements( val ) {
  var useVal = val.split( '=' );
  return useVal[1];
}
*/

function cancelForm( url ) {
  window.location.replace( url );
}

/*
function adjustBioColumns() {
    var sn = document.getElementById('subnav');
    var ct = document.getElementById('content');

    var snHeight = sn.offsetHeight;
    var ctHeight = ct.offsetHeight;

    // alert( "SUBNAV: " + snHeight + "\n" + "CONTENT: " + ctHeight );

    if( ctHeight > snHeight ) {
      sn.style.height = ctHeight + "px";
    }

}
*/
