function showmenu(elmnt)
{
document.getElementById(elmnt).style.visibility="visible"
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden"
}

function printpage()
{
window.print()
}

function toggle( targetId, sourceId){
target = document.getElementById( targetId );
if (sourceId.checked){
target.style.display = "block";
} else {
target.style.display = "none";
}
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// LIST ALL SHOW/HIDE ELEMENT IDS HERE

menus_array = new Array ('Energy News', 'Energy Industry Links',
                          'Energy Policy', 'Energy Capital', 'Research & Development',
                          'Energy Topic Focus', 'Educational Primers', 'Green Conference</a>', 'Products',
                          'Innovators of the Month', 'EV Macro-Innovation Projects',
                          'EV Forecasts', 'Inventor Support Center', 'EV Radio', 'EV Blogs',
                          'Energy Views', 'Guest Columns', 'EV Newsletter', 'EV Wiki', 'Energy Primer'

                          ); //<?php echo $this->title ?>
menus_status_array = new Array ();// remembers state of switches
img_close = '/images/expandbutton-open.gif';
img_open = '/images/expandbutton-close.gif';

function showHideSwitch (theid) {
  if (document.getElementById) {
    var switch_id = document.getElementById(theid);
    var imgid = theid+'Button';
    var button_id = document.getElementById(imgid);
    var exdate = new Date()
    exdate.setTime(exdate.getTime()+(365*24*3600*1000))
    if (menus_status_array[theid] != 'show') {
      button_id.setAttribute ('src', img_open);
      switch_id.className = 'showSwitch';
      menus_status_array[theid] = 'show';
      document.cookie = theid+'=show'+ "; expires="+exdate;
    }else{
      button_id.setAttribute ('src', img_close);
      switch_id.className = 'hideSwitch';
      menus_status_array[theid] = 'hide';
      document.cookie = theid+'=hide'+ "; expires="+exdate;

    }
  }
}
function resetMenu () { // read cookies and set menus to last visited state
  if (document.getElementById) {
    for (var i=0; i<menus_array.length; i++) {
      var idname = menus_array[i];
      var switch_id = document.getElementById(idname);
      var imgid = idname+'Button';
      var button_id = document.getElementById(imgid);
      if (getCookie(idname) == 'show') {
        button_id.setAttribute ('src', img_open);
        switch_id.className = 'showSwitch';
        menus_status_array [idname] = 'show';
      }else{
        button_id.setAttribute ('src', img_close);
        switch_id.className = 'hideSwitch';
        menus_status_array [idname] = 'hide';
      }
    }
  }
}

        function toggle_visibility(id) {
        var e = document.getElementById(id);
        if(e.style.display == 'none')
        e.style.display = 'block';
        else
        e.style.display = 'none';
        }