<!--

function preloadNavImages() {
  WM_preloadImages(
    'http://www.canaan.com/images/tab-pn-on.gif',
    'http://www.canaan.com/images/tab-pn-off.gif',
    'http://www.canaan.com/images/tab-ce-on.gif',
    'http://www.canaan.com/images/tab-ce-off.gif',
    'http://www.canaan.com/images/tab-cn-on.gif',
    'http://www.canaan.com/images/tab-cn-off.gif'
  );
}

var currentTab = "tab-pn"; /* id of the tab image object */
var currentContent = "portfolio-news"; /* id of the content div */

function showDiv(pageElement) {
  document.getElementById(pageElement).style.visibility = "visible";
  document.getElementById(pageElement).style.display = "block";
}

function hideDiv(pageElement) {
  document.getElementById(pageElement).style.visibility = "hidden";
  document.getElementById(pageElement).style.display = "none";
}

function switchTab(newTab,newContent) {
  if (newTab == currentTab) {
    return false;
  } else {
    WM_imageSwap(document.getElementById(newTab),'http://www.canaan.com/images/' + newTab + '-on.gif');
    WM_imageSwap(document.getElementById(currentTab),'http://www.canaan.com/images/' + currentTab + '-off.gif');
    hideDiv(currentContent);
    showDiv(newContent);
    currentTab = newTab;
    currentContent = newContent;
    return false;
  }
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){

    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      objStr = 'document.getElementById(' + daImage + ')';
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') || daImage || daImage.src) {
      daImage.src = daSrc;
    }
  }
}

// -->
