then in the remapCmd part, where nexus said function, that's to call a function (ie, "quack", would call function quack(){})
then in the function for a toggle you could then have
$togglethingy = !$togglethingy;
if($togglethingy)
{
a();
}
else
{
b();
}
a and b as functions