Using the following, would get the rest of your dialog/switchbar to work.
Code:
On *:Dialog:switchy:*:*: {  
  if ($devent == sclick) { 
    if ($did == 21) { server -m $$did($dname,19)   }
    if ($did == 4) { join $did($dname,2) }
    if ($did == 5) { part $did($dname,2) }
    if ($did == 25) { msg nickserv identify $did($dname,23) $did($dname,24) }
  }
}

What you're attempting to do is create a dialog and use it as a custom switchbar. So in all reality, you're just creating a dialog.