/*===========================================================================
*
*                            PUBLIC DOMAIN NOTICE
*               National Center for Biotechnology Information
*
*  This software/database is a "United States Government Work" under the
*  terms of the United States Coyright Act.  It was written as part of
*  the author's official duties as a United States Government employee and
*  thus cannot be copyrighted.  This software/database is freely available
*  to the public for use. The National Library of Medicine and the U.S.
*  Government have not placed any restriction on its use or reproduction.
*
*  Although all reasonable efforts have been taken to ensure the accuracy
*  and reliability of the software and data, the NLM and the U.S.
*  Government do not and cannot warrant the performance or results that
*  may be obtained by using this software or data. The NLM and the U.S.
*  Government disclaim all warranties, express or implied, including
*  warranties of performance, merchantability or fitness for any particular
*  purpose.
*
*  Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: Ron Edgar
* File:  gds_browse.js
* note: hey sorry, I ain't no JS coder! just getting by
* ===========================================================================*/

var imghome = "/projects/geo/img/";
var wi1=new Image();wi1.src = imghome + 'whatis1.gif';
var wi2=new Image();wi2.src = imghome + 'whatis2.gif';

function over(src) {
  if (("SPAN" == src.tagName && "tecNotes" == src.id) || "B" == src.tagName) {
    src.style.color = "rgb(255,0,0)";
    src.style.cursor = (document.all) ? "hand" : "pointer";
  }
}

function out(src) {
  if (("SPAN" == src.tagName && "tecNotes" == src.id) || "B" == src.tagName) {
    src.style.color = "rgb(0,0,0)";
    src.style.cursor = "auto";
  }
}

function getChildElement(obj, childNum) {
  var child = 0;
  if (obj.hasChildNodes()) {
    for (var i=0; i < obj.childNodes.length; i++) {
      if (obj.childNodes[i].nodeType != 1) continue;
      if (child != childNum) {
         child++;
         continue;
      } else
         return obj.childNodes[i];
    }
  }
  return null;
}

function showIt(src) {
  var child = null, parent;
  if (("SPAN" == src.tagName && "tecNotes" == src.id) || "B" == src.tagName) {
     if (document.all) {
       parent = document.all[src.sourceIndex -1];
       child = document.all[src.sourceIndex + 1];
     } else {
       parent = src.parentNode;
       child = getChildElement(parent, 1);
     }
     if (null != child && "LI" == parent.tagName && "UL" == child.tagName) {
       parent.className = ("close" == parent.className ? "open" : "close");
       child.className = ('expanded' == child.className ? 'none' : 'expanded');
     }
  }
}

function check_all(name) {
  for(i=0;i<name.length;++i)
     name[i].checked = true;
}

function uncheck_all(name) {
  for(i=0;i<name.length;++i)
     name[i].checked = false;
}

function img_fwd(iname) {
	var i2 = iname + "2";
	var nsrc = eval(i2).src;
	if(nsrc != document.images[iname].src)
	   document.images[iname].src = nsrc;
}

function img_bkwd(iname) {
	var i1 = iname + "1";
	var nsrc = eval(i1).src;
	if(nsrc != document.images[iname].src)
	    document.images[iname].src = nsrc;
}

function show_record(gds, spotids) {
       var tocgi = "gds_browse.cgi?gds=" + gds;
      if(spotids.length > 0 && spotids != 'void')
         tocgi += "&spotids=" + spotids;
       var open_cmd = '"width=635,height=700,resizable,scrollbars,toolbar"'
       recordWin = window.open(tocgi,"gds",eval(open_cmd)); 
      recordWin.focus();
     }

function whatis(ffname) {
       var tocgi = ffname + ".html";
       var open_cmd = '"width=530,height=600,resizable,scrollbars"'
       var w = window.open(tocgi,"whatis",eval(open_cmd)); 
      w.focus();
     }
