<?php
  function TitleTemplate($Caption=null,$Logo=null,$MenuFile=null,$Title=null,$Home=null,$Image=null,$Quote=null,$ImageCap=null,$TitleSize=null,$CaptionSize=null,$Link=null,$LetterHead=null)
  { global  $Session;
    global  $Site;
    global  $DisclaimerLink;
    global  $Quote;

    if ($Session->Browser->Mobile)
      echo "    <div id='header' class='header' style='font-size:75%;'></div>\r\n";
    else
      echo "    <div id='header' class='header'></div>\r\n";
    echo "    <table style='table-layout:fixed; width:100%; margin:0px; padding:0px;'>\r\n";
    echo "      <tbody>\r\n";
    echo "        <tr>\r\n";
    echo "          <td style='width:25%; text-align:left;'>\r\n";
    if (isset($Home) && empty($Session->PT->PageOption(PageOptionNoHomeLink)))
    { echo "            <a href='",iPageLink($Home),"'>\r\n";
      if (isset($Logo))
      { echo "              <img title=\"Click on the ",$Caption," Logo to take you to the website's home page\"\r\n";
        echo " src='",$Logo,"' alt='Logo' style='border: 0px solid ; width: 100%;'>\r\n";
      }
      echo "            </a>\r\n";
      echo "            <div id='header_user_type' class='header_title_title_caption'  style='width:100%; font-size:100%; text-align:center; color: rgb(128, 128, 255); padding:0px; margin:0px;'>\r\n";
      if (empty($Session->PT->PageOption(PageOptionNoMobileTest)) && $Session->Mobile)
      { if (empty($Session->PT->PageOption(PageOptionNoBotTest)) && $Session->Browser->Robot)
          echo "      <span id='TitleSessionTest' style='padding-left:10px;'>(Mobile Bot)</span>";
        else
          echo "      <span id='TitleSessionTest' style='padding-left:10px;'>(Mobile)</span>";
      }
      else if (empty($Session->PT->PageOption(PageOptionNoBotTest)) && $Session->Browser->Robot)
        echo "      <span id='TitleSessionTest style='padding-left:10px;''>(Bot)</span>";
      if (empty($Session->PT->PageOption(PageOptionNoPublicHdr)))
        echo "      <br><span style='font-weight:900; padding-left:10px;'>",$Session->MT->MemberTypeStr(),"</span>\r\n";
      echo "            </div>\r\n";
    }
    echo "          </td>\r\n";
    echo "          <td style='width:50%;'>\r\n";
    if (isset($Image))
    { echo "            <img alt='' ";
      if (isset($ImageCap))
        echo "title='",$ImageCap,"'";
      echo " src='",$Image,"' style='width: 100%;'><br>\r\n";
    }
    else if (isset($ImageCap)) echo  $ImageCap, "\r\n";
    if (isset($Caption))
    { echo "    <div id='header_title' class='header_title_title_caption'  style='font-size:125%; font-weight:bold; text-align:center; white-space:nowrap; color: rgb(128, 128, 255); padding:0px; margin:0px;'>\r\n";
      echo "      ",$Caption,"\r\n";
      echo "    </div>\r\n";
    }
    if (empty($Session->PT->PageOption(PageOptionNoPublicHdr)))
    { echo "    <div id='header_user' class='header_title_title_caption'  style='font-size:125%; font-weight:bold; text-align:center; white-space:nowrap; color: rgb(128, 128, 255); padding:0px; margin:0px;'>\r\n";
      echo "      ",$Session->ST->Record[SessionUserName],"\r\n";
      if ($Session->Admin && $Session->ST->RawRecord[SessionID])
        echo "      <span style='font-size:75%'>(",$Session->ST->Record[SessionID],")</span>\r\n";
      echo "    </div>\r\n";
    }

    echo "          </td>\r\n";
    echo "          <td style='text-align:center; vertical-align:top;'>\r\n";

    if (empty($Session->PT->PageOption(PageOptionNoLogin)))
    { if ($Session->ST->Record[SessionID])
        echo "              <input type='button' title='Log out when finished'  value='Logout' style='font-size:100%; width:20vw; height:15vw; padding:0px; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick=\"location.assign('",iPageLink('iLogout.php'),"');\">\r\n";
    }
    else
      echo "              <input type='button' title='Log in to the site'  value='Login' style='font-size:100%; width:15vw; height:15vw; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick=\"location.assign('",iPageLink('iMemberLogin.php'),"');\">\r\n";
    if ($Session->SCT->CFGOption(SiteCFGContactUs) && empty($Session->PT->PageOption(PageOptionNoContact)))
      echo "              <input type='button' title='Contact Us'  value='Contact Us' style='font-size:100%; width:15vw; height:15vw; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick=\"location.assign('",iPageLink('iContactUs.php'),"');\">\r\n";
    if ($Session->Admin && empty($Session->PT->PageOption(PageOptionNoACP)))
      echo "      <input type='button' title='Go to the Administrator Control Panel (ACP)'  value='(ACP)' style='font-size:100%; width:20vw; height:15vw; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick=\"location.assign('",iPageLink('/Admin/iACP.php'),"');\">\r\n";
    else if ($Session->SCT->CFGOption(SiteCFGContactUs) && empty($Session->PT->PageOption(PageOptionNoContact)))
      echo "              <input type='button' title='Contact Us'  value='Contact Us' style='font-size:100%; width:15vw; height:15vw; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick=\"location.assign('",iPageLink('iContactUs.php'),"');\">\r\n";
    echo "          </td>\r\n";
    echo "        </tr>\r\n";
    echo "      </tbody>\r\n";
    echo "    </table>\r\n";
    echo "    <hr class='header_no_menu'>\r\n";
    if (!empty($MenuFile) && empty($Session->PT->PageOption(PageOptionNoMenuBar)))
    { echo "    <div id='MenuBar'>\r\n";
      if (strpos($MenuFile,'/') == false)
        include_once    $Site.'Include/'.$MenuFile;
      else
        include_once    $Site.$MenuFile;
      echo "    </div>\r\n";
    }
    if (empty($Session->PT->PageOption(PageOptionNoPublicHdr)))
    { echo "    <table style='table-layout:fixed; width:100%; margin:0px auto; padding:0px;'>\r\n";
      echo "      <tbody>\r\n";
      echo "        <tr style='height:15vw;'>\r\n";
      echo "          <td id='PrevSection' style='width:25%;  height:15vw; text-align:left; margin:0px; padding:0px;'>\r\n";
      echo "            <input type='button' title='The webpages on this website can be accessed sequentially by section. Click on this button to go to the previous sequential section&apos;s webpage.' value='Prev Section' style='width:100%; height:100%; margin:0px; padding:0px; white-space: normal; font-size:100%; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick='location.assign(PrevSection);'>\r\n";
      echo "          </td>\r\n";
      echo "          <td id='Prev' style='width:24%;  height:15vw; text-align:left; margin:0px; padding:0px;'>\r\n";
      echo "            <input type='button' title='The webpages on this website can be accessed sequentially by section. Click on this button to go to the previous sequential webpage.' value='Prev' style='width:100%; height:100%; font-size:100%; margin:0px; padding:0px; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick='location.assign(Prev);'>\r\n";
      echo "          </td>\r\n";
      echo "          <td id='Next' style='width:24%;  height:15vw; text-align:left; margin:0px; padding:0px;'>\r\n";
      echo "            <input type='button' title='The webpages on this website can be accessed sequentially by section. Click on this button to go to the next sequential webpage.' value='Next' style='width:100%; height:100%; font-size:100%; margin:0px; padding:0px; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick='location.assign(Next);'>\r\n";
      echo "          </td>\r\n";
      echo "          <td id='NextSection' style='width:25%;  height:15vw; text-align:left; margin:0px; padding:0px;'>\r\n";
      echo "            <input type='button' title='The webpages on this website can be accessed sequentially by section. Click on this button to go to the next sequential section&apos;s webpage.' value='Next Section' style='width:100%; height:100%; margin:0px; padding:0px; white-space: normal; font-size:100%; background-color:#E0E0FF; -webkit-appearance:none; border-radius:0;' onclick='location.assign(NextSection);'>\r\n";
      echo "          </td>\r\n";
      echo "        </tr>\r\n";
      echo "      </tbody>\r\n";
      echo "    </table>\r\n";
    }

    echo "    <hr class='header_no_menu'>\r\n";
    if (!empty($Session->PT->Record[PageTitle]))
    { echo "    <div id='header_subtitle' class='header_sub_title_title_box' style='width:100%; color: rgb(128, 128, 255); text-align:center; display:inline-block; font-style: italic; font-weight: bold; font-size:120%;'>\r\n";
      if (!empty($Session->PT->Record[PageLink]))
      { if (strpos($Session->PT->Record[PageLink],"http://") === FALSE)
        { echo "        <a title='Click on the page Title for more information.' href=\"",iPageLink($Link),"\">\r\n";
          echo "          $Title\r\n";
          echo "        </a>\r\n";
        }
        else  OffSite($Session->PT->Record[iPageLink],$Session->PT->Record[PageTitle]);
      }
      else  echo $Session->PT->Record[PageTitle],"\r\n";
      echo "      </div>\r\n";
    }


    if (!empty($Quote) && empty($Session->PT->PageOption(PageOptionNoQuote)))
    { echo "    <div class='header_quote' style='vertical-align: top;'>\r\n";
      echo "      <hr class='header_quote_sep1'>\r\n";
      if (is_array($Quote))
      { if (!empty($Quote[1]))
          echo "      <div class='header_quote_text' title='",$Quote[1],"' style='vertical-align: top; background-color: rgb(240, 240, 240); font-size:1.25vw; text-align: center; border-style:outset; border-width:2px;'>\r\n";
        else
          echo "      <div class='header_quote_text' title='",$Quote[1],"' style='vertical-align: top; background-color: rgb(240, 240, 240); font-size:1.25vw; text-align: center; border-style:outset; border-width:2px;'>\r\n";
        echo "        ", $Quote[0], "\r\n";
      }
      else
      { echo "      <div class='header_quote_text' style='vertical-align: top; background-color: rgb(240, 240, 240); font-size:1.25vw; text-align: center; border-style:outset; border-width:2px;'>\r\n";
        echo "          ", $Quote, "\r\n";
      }
      echo "  	  </div>\r\n";
      echo "    </div>\r\n";
    }

    echo "  <hr>\r\n";
    echo "  <script>\r\n";
    echo "    if (document.getElementById('PrevSection')) document.getElementById('PrevSection').style.display  = (PrevSection)?'':'none';\r\n";
    echo "    if (document.getElementById('Prev'))        document.getElementById('Prev').style.display         = (Prev)?'':'none';\r\n";
    echo "    if (document.getElementById('Next'))        document.getElementById('Next').style.display         = (Next)?'':'none';\r\n";
    echo "    if (document.getElementById('NextSection')) document.getElementById('NextSection').style.display  = (NextSection)?'':'none';\r\n";
    echo "  </script>\r\n";
  }
?>
