/* Author: Bobbie Pecev
 * Date Written: 01 April 2007
 * Description: Toggles visibility on DIVs.  The DIV is named "[id]". 
 *              Each DIV must have an anchor with the name "a[id]".
 * Parameters: ps_id = the id of the div to toggle
 *             pb_changeLink = a boolean true if the toggle link should change on click else false or null
 *             ps_changeLinkHide = a string holding text forming the innerHTML of a link to click to hide the toggled div
 *             ps_changeLinkShow =  a string holding text forming the innerHTML of a link to click to show the toggled div
 */
function toggle( ps_id, pb_changeLink, ps_changeLinkHide, ps_changeLinkShow )
{
   var lb_changeLink = (pb_changeLink == null)?true:pb_changeLink;
   var ls_capitalisedId = ps_id.substr(0,1).toUpperCase() + ps_id.substr(1);

   if ( document.getElementById(ps_id).style.display == "block" )
   {
      document.getElementById(ps_id).style.display = "none";
      if (lb_changeLink)
      {
         document.getElementById("a"+ls_capitalisedId).innerHTML = 
            (ps_changeLinkHide == null)?"-":ps_changeLinkHide; 
      }
   }
   else
   {
      document.getElementById(ps_id).style.display = "block";
      if (lb_changeLink)
      {
         document.getElementById("a"+ls_capitalisedId).innerHTML =
            (ps_changeLinkShow == null)?"+":ps_changeLinkShow;   
      }
   }
}

