// Nicola Zordan, 15:27 8/3/2011

var sections=[]; //['Functions','Zones','Members'];
var sectionsNames=null;
var section=null;

function sectionShow (s) {
  var hs=false,div,btn;
  for (var i=0;i<sections.length;i++) {
    hs=(s==sections[i]);
    div=document.getElementById(sections[i]);
    if (div!=null) HideShowDiv(sections[i],bShowHide(hs));
    btn=document.getElementById(sections[i]+'_Button');
    if (btn!=null) {
      if (hs) { 
        btn.style.fontWeight='bold';
       } else {
        btn.style.fontWeight='';
      };
    };
  };
};

function sectionSelectorsHTML (s) {
  var html='';
  var sn=sectionsNames;
  if (sn==null) sn=sections;
  var style='';
  for (var i=0;i<sections.length;i++) {
    html+='<input type="button" id="'+sections[i]+'_Button" value="'+sn[i]+'" '
    style='';
    if (s==sections[i]) style='font-weight:bold'; 
    html+='style="'+style+'"';
    html+=' onClick="sectionShow(\''+sections[i]+'\')" />'
  };
  return html;
};

function bShowHide (s) {
  var r='none';
  if (s) r='block';
  return r;
}


function HideShowDiv(divId,display) {
  var div=document.getElementById(divId);
  var status=div.style.display;
  var toShow=(status=='none');
  var show='none';
  if (toShow) 
    show='block';
  if (display!=null) show=display;
  div.style.display=show;
};



