/*
* This script contains Javascript that will set up a page header for all pages
* that are part of the Town of Arlington Treasurer's site, so that they have a
* standard look and feel.
*/

/*****************************************************************************/

// Page information.
var PageWidth = 750;                    // Page width, in pixels
var MenuWidth = 190;                    // Menu width, in pixels
var ContentWidth = PageWidth - MenuWidth - 9 - 9;

/*****************************************************************************/

var SecureURLPrefix = '';               // Secure prefix for URLs in this page
var RegularURLPrefix = '';              // Regular prefix for URLs in this page

// Determine which set of pages we're embedded within: http; or https.
if (document.URL.match(/\/Billing\/(Scripts|Content)\//))
  { SecureURLPrefix = '/Billing/Content'; }

if (document.URL.match(/^https/))
  { RegularURLPrefix = 'http://arlingtontreasurer.com'; }

// Draw a table which will center the page and give us a nice border around it.
if (IsNav)
  {
  document.write(
    '<center><table class="PageFrame" border=1 cellspacing=0 cellpadding=0>' +
      '<tr><td align=center valign=top>');
  }
else
  {
  document.write(
    '<center><table class="PageFrame" cellspacing=0 cellpadding=0>' +
      '<tr><td align=center valign=top>');
  }

// Start the page off with the town seal and the page title.  Don't even think
// of removing the <br> after any of these images or the Web pages will look
// like doo, doo, poo, poo, ka, ka under Internet Braindead.  Without the <br>,
// IB will insert gratuitous spaces after each table row.  Just another in the
// long list of bugs in its rendering algorithms.
document.write(
  '<table width='+PageWidth+' border=0 cellspacing=0 cellpadding=0>' +
    '<tr><td>' +
      '<a href="'+RegularURLPrefix+'/ArlingtonFlag.html">' +
        '<img src="'+SecureURLPrefix+'/Page/PageBanner_Left.gif" ' +
          'width=150 height=130 border=0 alt="Shield of Arlington, MA">' +
      '</a><br>' +
    '</td><td>' +
      '<img src="'+SecureURLPrefix+'/Page/PageBanner_Right.gif" ' +
          'width=600 height=130 border=0 alt="Welcome to Arlington, MA">' +
      '<br>' +
    '</td></tr>' +
    '<tr><td colspan=2>' +
      '<img src="'+SecureURLPrefix+'/Page/PageBanner_Spacer.gif" ' +
        'width='+PageWidth+' height=3 border=0 alt="Spacer"><br>' +
    '</td></tr>' +
  '</table>');

// Show the title bar next.
document.write(
  '<table width='+PageWidth+' border=0 cellspacing=0 cellpadding=0>' +
    '<tr><td background="'+SecureURLPrefix+'/Page/TitleBar_Left.gif" width=6>' +
      '<img src="'+SecureURLPrefix+'/Page/TitleBar_Left.gif" ' +
        'width=6 height=33 border=0 alt="Title bar, left edge"><br>' +
    '</td><td width=149 bgcolor=#848282>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width=149 height=1 border=0 alt="Spacer"><br>' +
    '</td><td width=70 bgcolor=#848282>' +
      '<a href="'+RegularURLPrefix+'/index.html">' +
        '<img src="'+SecureURLPrefix+'/Page/TitleBar_HomeButton.gif" ' +
          'width=70 height=33 border=0 alt="Home Page Link"></a><br>' +
    '</td><td width=4 bgcolor=#848282>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width=4 height=1 border=0 alt="Spacer"><br>' +
    '</td><td width=109 bgcolor=#848282>' +
      '<a href="http://www.town.arlington.ma.us/Public_Documents/Residents">' +
        '<img src="'+SecureURLPrefix+'/Page/TitleBar_ResidentsButton.gif" ' +
          'width=109 height=33 border=0 alt="Residents Link"></a><br>' +
    '</td><td width=4 bgcolor=#848282>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width=4 height=1 border=0 alt="Spacer"><br>' +
    '</td><td width=123 bgcolor=#848282>' +
      '<a href="http://www.town.arlington.ma.us/Public_Documents/businesses">' +
        '<img src="'+SecureURLPrefix+'/Page/TitleBar_BusinessesButton.gif" ' +
          'width=123 height=33 border=0 alt="Businesses Link"></a><br>' +
    '</td><td width=4 bgcolor=#848282>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width=4 height=1 border=0 alt="Spacer"><br>' +
    '</td><td width=127 bgcolor=#848282>' +
      '<a href="http://www.town.arlington.ma.us/Public_Documents/newcomers">' +
        '<img src="'+SecureURLPrefix+'/Page/TitleBar_NewcomersButton.gif" ' +
          'width=127 height=33 border=0 alt="Newcomers Link"></a><br>' +
    '</td><td width=32 bgcolor=#848282>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width=32 height=1 border=0 alt="Spacer"><br>' +
    '</td><td width=116 bgcolor=#848282>' +
      '<a href="http://en.wikipedia.org/wiki/Uncle_Sam">' +
        '<img src="'+SecureURLPrefix+'/Page/TitleBar_UncleSam.gif" ' +
          'width=116 height=33 border=0 alt="Uncle Sam Link"></a><br>' +
    '</td><td background="'+SecureURLPrefix+'/Page/TitleBar_Right.gif" width=6>' +
      '<img src="'+SecureURLPrefix+'/Page/TitleBar_Right.gif" ' +
        'width=6 height=33 border=0 alt="Title bar, right edge"><br>' +
    '</td></tr>' +
  '</table>');
document.write('<img src="'+SecureURLPrefix+'/Page/TitleBar_Spacer.gif" ' +
  'width='+PageWidth+' height=13 border=0 alt="Spacer"><br>');

// Create a table to space the menu bar left, content right.  Add a search of
// Google to it.
document.write(
  '<table width='+PageWidth+' bgcolor=#FFFFFF border=0 ' +
    'cellspacing=0 cellpadding=0>' +
    '<tr><td width='+MenuWidth+' align=center valign=top bgcolor=#FFFFFF>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'height=240 width='+MenuWidth+' border=0 alt="Spacer">' +
      '<center><form method=GET action="http://www.google.com/u/ArlingtonMA">' +
        '<table width=156 border=0 cellspacing=0 cellpadding=1>' +
          '<tr><td align=center>' +
            '<input type=text name=q size=12 maxlength=255 value=""><br>' +
            '<input type=submit name=sa value="Google Search"><br>' +
            '<a href="http://www.google.com/">' +
              '<img src="http://www.google.com/logos/Logo_40wht.gif" ' +
                'border=0 alt=Google></a><br>' +
          '</td></tr>' +
        '</table>' +
      '</form></center>' +
    '</td><td width=9 ' +
      'background="'+SecureURLPrefix+'/Page/PageBorder_Left.gif"><br>' +
      '<img src="'+SecureURLPrefix+'/Page/PageBorder_Left.gif" ' +
        'width=9 height=200 border=0 alt="Page border, left edge"><br>' +
    '</td>');

// Begin the page content.
document.write(
    '<td width='+ContentWidth+' align=center valign=top bgcolor=#FFFFFF>' +
      '<img src="'+SecureURLPrefix+'/Page/OneByOne.gif" ' +
        'width='+ContentWidth+' height=1 border=0 alt="Spacer"><br>');
