﻿function f_open_window_max( aURL, aWinName )
{
  var wOpen;
  var sOptions;

  sOptions = 'status=yes,menubar=yes,scrollbars=yes,resizable=yes,toolbar=yes,location=yes,directories=yes';
  //sOptions = sOptions + ',fullscreen=yes';
  sOptions = sOptions + ',width=' + (screen.availWidth-2).toString();
  sOptions = sOptions + ',height=' + (screen.availHeight - 122).toString();
  sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
  
  //

  wOpen = window.open('', aWinName, sOptions);
  wOpen.location = aURL;
  wOpen.focus();
  centerWindow(screen.availWidth, screen.availHeight);
  wOpen.resizeTo(screen.availWidth, screen.availHeight);
  return wOpen;
}

//  Adjust the scroolbar to the grid specified  int the parameters . 
function adjust_nRows(idDiv, idGrid, nRows)
{    
    var aDiv = document.getElementById(idDiv);
	var aGrid = document.getElementById(idGrid);
	if ((aDiv != null) && (aGrid != null))
	{
	    var h = 0;
	    if (nRows > aGrid.rows.length)
	        nRows = aGrid.rows.length;
	    
	    for (var i=0; i<nRows; i++)
	    {
	        h += aGrid.rows[i].cells[0].offsetHeight;
	    }
	    aDiv.style.height = h + 4;
	    if (aGrid.offsetHeight > aDiv.offsetHeight)
	        aDiv.style.width = aGrid.offsetWidth + 18;
        else
            aDiv.style.width = aGrid.offsetWidth + 2;
	}
    else
	{
	    if (aDiv != null)
	        aDiv.style.border = 0;
	}
}
