var shownTopBoxId = 1;

function toggleTopBox(id, altURL )
{
if(id != shownTopBoxId)
  {
  var baseURL =  window.location.href;
  var qix = baseURL.indexOf( "?" );
  if( qix != -1 )
    baseURL = baseURL.substring( 0, qix );

  if( altURL )    
    window.location = baseURL + altURL;
  else if( id == 1 && qix != -1 )
    window.location = baseURL;
  else if( qix == -1 )
    {
    //var link = document.getElementById('boxLink'+id).style.fontWeight;
    var text = document.getElementById('boxText'+id).style.display;

    //document.getElementById('boxLink'+shownTopBoxId).style.fontWeight = "normal";
    document.getElementById('boxLink'+shownTopBoxId).className = '';
    document.getElementById('boxText'+shownTopBoxId).style.display = "none";

    shownTopBoxId = id;

    moreTextElement = document.getElementById('readFullText'+id);
    if(moreTextElement)
    {
      moreTextElement.style.display = "none";
      document.getElementById('readFullLink'+id).style.display = "block";
    }

    //document.getElementById('boxLink'+id).style.fontWeight = (link != "bold" ? "bold" : "normal");
    document.getElementById('boxLink'+id).className = 'active';
    document.getElementById('boxText'+id).style.display = (text != "block" ? "block" : "none");
    }
  else
    window.location = baseURL + "?tab=" + id;
  }
}

function showFull(id)
{
  document.getElementById('readFullText'+id).style.display = "block";
  document.getElementById('readFullLink'+id).style.display = "none";
}

function showFullToggle(id) { 
  var show = document.getElementById('readFullText'+id).style.display == "none"; 
  document.getElementById('readFullText'+id).style.display = (show ? "block" : "none"); 
  document.getElementById('readFullLink'+id).style.display = (show ? "none" : "block"); 
 }

function showMoreToggle(id)
{
  var show = document.getElementById('showMoreLessTd'+id).style.verticalAlign == "top";

  document.getElementById('showMoreItems'+id).style.display = (show ? "block" : "none");
  document.getElementById('showMoreLessTd'+id).style.verticalAlign = (show ? "bottom" : "top");
  document.getElementById('showMoreText'+id).style.display = (show ? "none" : "block");
  document.getElementById('showLessText'+id).style.display = (show ? "block" : "none");
}
