Toggle Visibility

Do you want a button to hide a layout or control, then the next time to show it again?

Call this function.

togglevis.js
function toggleVisibility(control,gone)
//param1 is a control or layout
//param2 true=Gone,false=Hide (default false)
{
   if(control.GetVisibility()=="Show")
   {
       control.SetVisibility(gone?"Gone":"Hide")
   }
   else
   {
       control.SetVisibility("Show")
   }
}

Note

If you pass true as the second parameter, when the control is hidden, it will be set to Gone.
If the second parameter is missing or false the visibility mode will be Hide