﻿/* ---------------------------------------------------------------------- *\
  Function    : openWindowWithMenu
  Description : Opens the given URL in a popup window. The window opens
                with menu bar.
                Resizable   = 1 
                Status      = 1 
                Scrollbars  = 1 
                width       =1000
                height      =700
                left        =70
                top         =20                
  Usage       :
  Arguments   : url - URL to be opened in the new window
\* ---------------------------------------------------------------------- */
function openWindowWithMenu(url)
{
    window.open(url, 'GFMResearchDataWindow','width=1000,height=700,left=70,top=20,border=0,status=1,menubar=1,resizable=1,scrollbars=1');
}

/* ---------------------------------------------------------------------- *\
  Function    : openWindowWithoutMenu
  Description : Opens the given URL in a popup window. The window opens
                with menu bar.
                Resizable   = 1 
                Status      = 1 
                Scrollbars  = 1 
                width       =1000
                height      =700
                left        =70
                top         =20                
  Usage       :
  Arguments   : url - URL to be opened in the new window
\* ---------------------------------------------------------------------- */
function openWindowWithoutMenu(url)
{
    window.open(url, 'GFMResearchDataWindow','width=1000,height=700,left=70,top=20,border=0,status=1,menubar=1,location=0,toolbar=0,resizable=1,scrollbars=1');
}

/* ---------------------------------------------------------------------- *\
  Function    : trim
  Description : Removes spaces from left and right of a string parameter
  Usage       :
  Arguments   : s - data
\* ---------------------------------------------------------------------- */
function trim(s)
{
	return rtrim(ltrim(s));
}

/* ---------------------------------------------------------------------- *\
  Function    : ltrim
  Description : Removes spaces from left of a string parameter
  Usage       :
  Arguments   : s - data
\* ---------------------------------------------------------------------- */
function ltrim(s)
{
	var l=0;
	var length = s.length;
	while(l < length && s.charAt(l) == ' ')
	{	l++; }
	return s.substring(l, length);
}

/* ---------------------------------------------------------------------- *\
  Function    : rtrim
  Description : Removes spaces from right of a string parameter
  Usage       :
  Arguments   : s - data
\* ---------------------------------------------------------------------- */
function rtrim(s)
{
	var r=s.length -1;
	while(r > 0 && s.charAt(r) == ' ')
	{	r-=1;	}
	return s.substring(0, r+1);
}
