var ie = (document.all) ? 1 : 0;

function MouseOverTab2(cellID, theClassName) {
  var cell = document.getElementById(cellID);
  if ( theClassName != '' ) {
    cell.className=theClassName;
  }
  
  var id = '99';
  if ( cell.id == 'PS' ) {
    window.status = 'Products & Services (ps.htm)';
    id = '1'
  } else if ( cell.id == 'RD' ) {
    window.status = 'Research & Development (rd.htm)';
  } else if ( cell.id == 'NR' ) {
    window.status = 'News & Resources (nr.htm)';
  } else if ( cell.id == 'CI' ) {
    window.status = 'Company Info (info.htm)';
    id = '0'
  }
   
  if ( id != '' ) {
    showDelayedMenu ( id, cell.id );
  }
}

function MouseOutTab2(cellID, theClassName) {
  var cell = document.getElementById(cellID);
  if ( theClassName != '' ) {
    cell.className=theClassName;
  }
  
  window.status = '';
  
  if ( ie ) 
    setHideTimeOut(500);
  else setHideTimeOut(1000);
}

function MouseOverTab(cell, theClassName) {
  if ( theClassName != '' ) {
    cell.className=theClassName;
  }
  
  var id = '';
  if ( cell.id == 'PS' ) {
    window.status = 'Products & Services (ps.htm)';
    id = '1'
  } else if ( cell.id == 'RD' ) {
    window.status = 'Research & Development (rd.htm)';
  } else if ( cell.id == 'NR' ) {
    window.status = 'News & Resources (nr.htm)';
  } else if ( cell.id == 'CI' ) {
    window.status = 'Company Info (info.htm)';
    id = '0'
  }
}

function MouseOutTab(cell, theClassName) {
  if ( theClassName != '' ) {
    cell.className=theClassName;
  }
  
  window.status = '';
}

function MouseClickTab ( cell ) {
  if ( cell.id == 'PS' ) {
      document.location.href='../products/ps.htm';
  } else if ( cell.id == 'RD' ) {
    document.location.href='../research/rd.htm';
  } else if ( cell.id == 'NR' ) {
    document.location.href='../news/nr.htm';
  } else if ( cell.id == 'CI' ) {
    document.location.href='../corp/info.htm';
  }
}

function MouseOverSideMenu(cell, theClassName) {
  cell.className=theClassName;
}

function MouseOutSideMenu(cell, theClassName) {
  cell.className=theClassName;
}

function MouseClickSideMenu(theUrl) {
  document.location.href=theUrl;
}


function changeLink(linkId,className) {
var link = document.getElementById(linkId);
link.className = className;
}


/* This function removes elements of the "expiringElement" class once their expiration date passes.
 * It should be called when the page loads and works in conjunction with an element's class and
 * attribute specifications. To enable expiration for an element, it should be specified with the
 * "expiringElement" class and the "expires" attribute. There is an optional "notExpired" attribute
 * which specifies the "display" value if the element hasn't expired (defaults to "block").
 *
 * Here is an example:
 *   <P CLASS="expiredElement" EXPIRES="200061231" NOTEXPIRED="inline">
 *      blah... blah... blah...
 *   </P>
 *
 * In this example, the paragraph will be displayed inline until January 1st, 2007. At which time
 * it will disappear.
 *
 * NOTE: Make sure ".expiringElement {DISPLAY:none;}" is specified somewhere.
 */
function removeExpiredElements(tag) {
  if (!tag) {  // If only one tag uses the "expiringElement" class, you can specify it to improve performance.
    tag = "*";
  }
  var myDate = new Date();
  var today = new Date();
  var els = document.getElementsByTagName(tag);  // Get all candidate elements.
  for (var i=0; i<els.length; i++) {
    var el = els[i];
    if (el.className=="expiringElement") {  // If it's an "expiringElement"...
      var date = el.getAttribute("expires");  // Get its expiration date (yyyymmdd).
      myDate.setFullYear(date.substr(0, 4), date.substr(4, 2)-1, date.substr(6, 2));
      if (myDate >= today) {  // If it hasn't expired...
        var show = el.getAttribute("notExpired");  // "notExpired" attr tells what kind of display to use
        if (!show) {
          show = "block";  // Defaults "to block".
        }
        el.style.display = show;
      }
    }
  } 
}