var Glb_QAMode = 0;
function OpenModalWindow
(  parameters,  lWidth,      lHeight,    lhotkeys,  ltoolbar,  lmenubar,
   lstatus,     lscrollbars, lresizable, nlocation, Xlocation, Ylocation, strScroll
)
{
  var clUrl=parameters;
  //clUrl = document.location.protocol + "//" + document.location.host + "/" + window.location.pathname.split("/")[1] + parameters;
  clUrl = clUrl.replace( ' ', '+' );
  var leftX ;
  var topX ;  
  if( (typeof lhotkeys == 'undefined') )
    lhotkeys = 0;
  if( lhotkeys == -1 )
    lhotkeys = 0;
  if( (typeof ltoolbar == 'undefined') )
    ltoolbar = 0;
  if( ltoolbar == -1 )
    ltoolbar = 0;
  if( (typeof lmenubar == 'undefined') )
    lmenubar = 0;
  if( ltoolbar == '' )
    ltoolbar = 0;
  if( (typeof lstatus == 'undefined') )
    lstatus = 0;
  if( (typeof lscrollbars == 'undefined') )
    lscrollbars = 0;
  if( (typeof lresizable == 'undefined') )
    lresizable = 0;
  if( (typeof nlocation == 'undefined') )
    nlocation = -1;
  if( (typeof Xlocation == 'undefined') )
    Xlocation = -1;
  if( (typeof strScroll == 'undefined') )
    strScroll = "no";
  if( lWidth == -1 )
    lWidth = window.screen.width;
  if( lHeight == -1 )
    lHeight = window.screen.height;
  if( Xlocation == -1 )
    leftX = (window.screen.width - lWidth) / 2;
  else
    leftX = Xlocation;

  if( Ylocation == -1 )
    topX  = (window.screen.height - lHeight) / 2;
  else
    topX  = Ylocation;

  if( clUrl.indexOf('?') < 0 )
    clUrl += '?';

  if( Glb_QAMode == 1 )
  {
    OpenalignedWindow( clUrl, lWidth,      lHeight,    lhotkeys,  ltoolbar,  lmenubar,
               lstatus,     lscrollbars, lresizable, nlocation, Xlocation, Ylocation);
    return;
  }
  var fullUrl = clUrl + "&r="+Math.random();
  fullUrl += "&ParentPageWidth="+ lWidth + "&ParentPageHeight="+ lHeight
  window.showModalDialog(fullUrl,window,"dialogHeight: " + lHeight + "px; dialogWidth: " + lWidth + "px; dialogTop: " + topX + "px; dialogLeft: " + leftX + "px; edge: Raised; center: Yes; help: No; resizable: " + lresizable + "; maximize: " + lresizable + "; status: " + lstatus + "; scroll: " + strScroll + ";");
}

function OpenalignedWindow
( clUrl,   lWidth,      lHeight,    lhotkeys,  ltoolbar,  lmenubar,
  lstatus, lscrollbars, lresizable, nlocation, Xlocation, Ylocation,WindowName)
{
  var leftX;
  var topX;
  if(WindowName == null)
      WindowName = ""
  if( lWidth == -1 )
    lWidth = window.screen.width;
  if( lHeight == -1 )
    lHeight = window.screen.height;
  if( Xlocation == -1 )
    leftX = (window.screen.width - lWidth) / 2;
  else
    leftX = Xlocation;
  if( Ylocation == -1 )
    topX  = (window.screen.height - lHeight) / 2;
  else
    topX  = Ylocation;
  if( clUrl.indexOf('?') < 0 )
    clUrl += '?';
  var newWnd = window.open(clUrl + "&r="+Math.random(), WindowName, "hotkeys=" + lhotkeys + ",toolbar=" + ltoolbar + ",menubar=" + lmenubar + ",status=" + lstatus + ",scrollbars=" + lscrollbars + ",resizable=" + lresizable + ",location=" + nlocation + ",width=" + lWidth + ",height=" + lHeight + ",top=" + topX + ",left=" + leftX);
}

function ReColorRows(oTable)
{
  _ReColorRows(oTable, "rowEven", "rowOdd", "rowSelected");
}

function _ReColorRows(oTable, EvenRowClass, OddRowClass, SelectedRowClass)
{
  var Rowlength = oTable.rows.length;
  var oRow;
  var preVColor = OddRowClass;
	for( var i = 1;i < Rowlength-1;i++ )
  {
    oRow = oTable.rows[i];
    if( oRow.style.display.toLowerCase() != 'none' )
	  { 
      if(oRow.className != SelectedRowClass)
      { 
        oRow.rowcls = oRow.className;
        if(preVColor == OddRowClass)
        {
          oRow.className = EvenRowClass;
          preVColor = EvenRowClass;
        }
        else
        {
          oRow.className = OddRowClass;
          preVColor = OddRowClass;
        }
      }
      else //If Selected just save it when it will be unselected
      {
        oRow.rowcls = (preVColor == OddRowClass)? EvenRowClass:OddRowClass;
        preVColor = oRow.rowcls;
      }
    }
  }
}

function CloseWindow( message)
{
  if(confirm(message))
  {
    self.close();
  }
}

function myprint()
{
  window.print()
}
