function expand(id) {
  var elem = document.getElementById(id);
  if (elem) {
    var interior = document.getElementById('id_interior');
    if (elem.style.display != 'none') {
      var width = interior.style.width;
      interior.style.width = '200px'; // mozilla hack
      interior.style.visibility='hidden';
      elem.style.display = 'none';
      interior.style.width = width;
      interior.style.visibility='visible';
    } else {
      var width = interior.style.width;
      interior.style.visibility='hidden';
      interior.style.width = '200px'; // mozilla hack
      elem.style.display = '';
      interior.style.width = width;
      interior.style.visibility='visible';
    }
  }
}

function get_cookie( name )
{
  var all_cookies = document.cookie;
  var pos = all_cookies.indexOf(name);
  if (pos >= 0) {
    if (pos != 1) {
      var start = pos + name.length + 1;
      var end = all_cookies.indexOf(";", start);
      if (end == -1) {
        end = all_cookies.length;
      }
      var value = all_cookies.substring(start, end);
      return unescape(value);
    }
  }

  return "";
}

function delete_cookie( cookie_name )
{
    var d = new Date();
    document.cookie = cookie_name + "=mitcheljh;expires=" + d.toGMTString() + ";path=/" + ";";

}

function open_external_link( lnk )
{
  var width = screen.availWidth - 100;
  var height = screen.availHeight - 100;
  var new_wnd = window.open( lnk, 'new_wnd', 'height=' + height + ',width=' + width + ',scrollbars,resizable', true );
  new_wnd.moveTo(50,50);
  new_wnd.focus();
}


function on_toplink_btn_mousedown( btn_id )
{
    switch( btn_id )
  {
  case 'id_tl_home':
      document.location='/index.php';
    break;
    
  case 'id_tcl_overview':
     location='/tree_container_library/overview.php';
     break;

  case 'id_tcl_download':
     location='/tree_container_library/download.php';
     break;

  case 'id_tl_latest_news':
     location='/latest_news.php';
     break;

  case 'id_tl_xportpro_download':
     location='/xportpro/download.php';
     break;
  }
}

function on_footer_btn_mousedown( btn_id )
{
    switch( btn_id )
  {
  case 'id_tl_about_us':
      document.location='/about_us/overview.php';
    break;
    
  case 'id_tl_terms_of_use':
     location='/about_us/terms_of_use.php';
     break;
     
  case 'id_tl_privacy_policy':
     location='/about_us/your_privacy.php';
     break;
     
  case 'id_tl_contact_us':
     location='/about_us/contact_us.php';
     break;
    }
     
}


function set_content_height()
{
  var height = Math.max( document.getElementById('id_div_content').offsetHeight, window.screen.availHeight * 4/5 ) + 'px';
  document.body.style.height = height;
}

function open_help_file( src_file )
{
  var help_wnd = window.open( src_file, 'rounding_wnd', 'height=400,width=400,scrollbars', true );
  help_wnd.focus();
}

var img_wnd;  // global var
function open_thumbnail( src_img )
{
  img_wnd = window.open( "/main/php/generic_image_wnd.php?image=" + src_img, 'thumbnail_img',  'height=20 width=30', true );
  img_wnd.focus();
}

