Okay, this is very long, but it also contains the code for the header if a custom header has not been defined. I wasn't sure exactly which part you needed so I included it all, although I think what might be the applicable part is in bold:
-----------------------------------------------------------
# shows header (inc. custom layout for shop
function showhead($shop,$cat,$cart,$titleadd = ""

{
$ret = "<!-- START HEADER -->\n";
$shopid = intval($shop);
$qry_gethead = mysql_query("SELECT name, title, dividercellcolor, pagetitle, shoplogo, background, fontcolour, fontfamily, ".
"fontsize, linkcolour, visitedlinkcolour, activelinkcolour, header, ".
"displaycartlink, displayhomelink, otherhomelink, displaysearchbox ".
"FROM shop ".
"WHERE id=$shop"

;
list ($name,$title,$dividercellcolor,$pagetitle,$shoplogo,$background,$fontcolour,$fontfamily,$fontsize,$linkcolour,$visitedlinkcolour,$activelinkcolour,$header,$displaycartlink, $displayhomelink, $otherhomelink, $displaysearchbox) = mysql_fetch_array($qry_gethead);
if (trim($header) != '' && $titleadd != '| Final Page') {
// if theyve created a custom header...
$ret .= $header . "\n<!-- STOP HEADER -->";
return $ret;
}
$ret .= "<html>\n<head>\n";
$ret .= " <title>$name - $title $titleadd</title>\n";
$ret .= " <style type='text/css'>\n";
$ret .= " body {\n";
if (ereg("^#",$background)) {
$ret .= " background-color: $background;\n";
}
else {
$ret .= " background-image: url($background);\n";
}
$ret .= " color: $fontcolour;\n";
$ret .= " font-family: $fontfamily;\n";
$ret .= " font-size: ".$fontsize."px;\n";
$ret .= " }\n";
$ret .= " td {\n";
$ret .= " color: $fontcolour;\n";
$ret .= " font-family: $fontfamily;\n";
$ret .= " font-size: ".$fontsize."px;\n";
$ret .= " }\n";
$ret .= " input {\n";
$ret .= " font-family: $fontfamily;\n";
$ret .= " font-size: ".$fontsize."px;\n";
$ret .= " }\n";
$ret .= " textarea {\n";
$ret .= " font-family: $fontfamily;\n";
$ret .= " font-size: ".$fontsize."px;\n";
$ret .= " }\n";
$ret .= " select {\n";
$ret .= " font-family: $fontfamily;\n";
$ret .= " font-size: ".$fontsize."px;\n";
$ret .= " }\n";
$ret .= " .justified {\n";
$ret .= " text-align: justify;\n";
$ret .= " }\n";
$ret .= " </style>\n";
$ret .= "</head>\n";
$ret .= "<body link='$linkcolour' vlink='$visitedlinkcolour' alink='$activelinkcolour'>";
$ret .= "<table border=0 width='100%' cellpadding=0 cellspacing=0>";
$ret .= "<tr>";
$ret .= "<td width=50% valign=top>";
//$qry_getpagetitle = mysql_query("SELECT pagetitle FROM shop WHERE id=$shop"

;
//list ($pagetitle) = mysql_fetch_array($qry_getpagetitle);
if ($shoplogo != '' and $titleadd != '| Final Page') {
$ret .= "<a href='index.php?shop=$shop&cart=$cart'><img src='$shoplogo' border=0 alt='$title'></a>";
} else {
$ret .= "<font size=4><b>$title</b></font>";
}
$ret .= "</td>";
$ret .= "<td height=60 width=50% valign=top align=right>";
if ($displaysearchbox == 1)
$ret .= "<form method=GET action='" . URL_START . "index.php'>Search Inventory for Keyword(s):<br><input type=text name=keywords value='' size=21 maxlength=50><input type=submit value='Search'><input type=hidden name=shop value='$shop'><input type=hidden name=cart value='$cart'></form>";
else
$ret .= " ";
$ret .= "</td>";
$ret .= "</tr>";
$ret .= "<tr>";
$ret .= "<td valign=middle>$pagetitle</td>";
// Begin - Custom Display Arrangement - 03042002
$tcartlink = "";
if ($displaycartlink == 1) {
if ($titleadd != '| Final Page') {
$tcartlink = "<a href='cart.php?shop=$shop&cart=$cart'>View Shopping Cart</a>";
} else {
$tcartlink = "<a href='" . URL_START . "cart.php?shop=$shop&cart=$cart'>View Shopping Cart</a>";
}
}
$thomelink = "";
if ($displayhomelink == 1) {
if ($titleadd != '| Final Page') {
$thomelink = "<a href='index.php?shop=$shop&cart=$cart'>Home</a>";
} else {
$thomelink = "<a href='" . URL_START . "index.php?shop=$shop&cart=$cart'>Home</a>";
}
}
elseif ($displayhomelink == 2)
$thomelink = "<a href='$otherhomelink'>Home</a>";
if ($tcartlink == "" && $thomelink == ""

$tdisplay = " ";
elseif ($tcartlink == ""

$tdisplay = $thomelink . " ";
elseif ($thomelink == ""

$tdisplay = $tcartlink . " ";
else
$tdisplay = "<a href=\"previous_orders.php?shop=$shop&cart=$cart\">Order History</a> | ".$tcartlink . " | " . $thomelink . " ";
$ret .= "<td valign=middle align=right>".$tdisplay."</td>";
// End - Custom Display Arrangement
$ret .= "</tr>";
$ret .= "<tr>";
$ret .= "<td colspan=2> </td>";
$ret .= "</tr>";
$ret .= "<tr>";
$ret .= "<td colspan=2 bgcolor='$dividercellcolor'> </td>";
$ret .= "</tr>";
$ret .= "</table>";
$ret .= "\n<!-- STOP HEADER -->";
return $ret;
}