try it
edit
//check if the Itemid is set correctly
echo $Itemid;
if ($Itemid == 1 or $Itemid == ""
{
$database->setQuery("select id from #__menu where link='index.php?option=com_fireboard'"

;
$Itemid=$database->loadResult();
echo " ".$itemid;
}
with echo you can monitor pre and post if the $Identid value.
For example:
if the echo print on the screen 86 (your itemid link to fireboard component) and 87 (the wrong Identid), 86-87 = -1 the you must add the line
//check if the Itemid is set correctly
if ($Itemid == 1 or $Itemid == ""
{
$database->setQuery("select id from #__menu where link='index.php?option=com_fireboard'"

;
$Itemid=$database->loadResult();
$Itemid-=1;
}
bye