function subplot_popup(url, w, h)
{
  //alert('subplot_popup()');
  infopopWindow=open(url,'infopopWindow','scrollbars=yes,resizable=yes,width='+w+',height='+h);
  if (infopopWindow.opener == null)
    infopopWindow.opener = self;
  //else
  //  infopopWindow.opener.focus();
}

function popup(wname, url)
{
  popWindow_l1=open(url,wname,'resizable=yes,width=1000,height=1200,scrollbars=yes,toolbar=yes,menubar=yes,location=yes');
  if (popWindow_l1.opener == null)
    popWindow_l1.opener = self;
  else
    popWindow_l1.focus();

  //popWindow_l1.moveTo(0,0);
}

function goto_url(url)
{
  window.top.location.href = url;
}

function swapImage(ImageFileName) 
{
  //alert(ImageFileName);
  document.images['sarDisplayImage'].src = ImageFileName;
}
 
if (window.top != self)
{
  window.top.location.href = location.href;
}

function MM_swapImgRestore() 
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() 
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) 
{ //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() 
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i
+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=
a[i+2];}
}

function doTabOver(i)
{
  if (document.layers)
  {
    //alert('doTabOver(1)');
    window.document.layers['id'+i].style.background = '#006699';
  }
  else if (document.all) //IE
  {
    //alert('doTabOver(2)');
    window.document.all['id'+i].style.background = '#006699';
  }
  else //other
  {
    //alert('doTabOver(3)');
    document.getElementById("id"+i).style.background = '#006699';
  }
}

function doTabOut(i)
{
  if (document.layers)
  {
    window.document.layers['id'+i].style.background = '#666666';
  }
  else if (document.all)
  {
   window.document.all['id'+i].style.background = '#666666';
  }
  else //other
  {
    //alert('doTabOver(3)');
    document.getElementById("id"+i).style.background = '#666666';
  }
}

function doTabClick(url)
{
  //window.document.location.href = url;
  subplot_popup(url, 1000, 800);
}

String.prototype.trim = function() 
{
  return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() 
{
  return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() 
{
  return this.replace(/\s+$/,"");
}

String.prototype.isEmpty = function() 
{
  if (this == null)
    return true;
  str = this.trim();
  if (str.length == 0)
    return true;
  return false;
}
