// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --                                                                      -- //
// --  SCRCOM - COMMON SCRIPT FILE                                         -- //
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  pg_body - common <body> tag                                         -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function pg_body() {
with(document) {
   write('<BODY')
   write(' bgcolor="#00CC99"')
   write(" background='images/Bkgd/Dflt.jpg'");
   write(' style="');
   write("background-attachment: fixed");
   write('"');
   write(' link="#0000FF" vlink="#0000FF" alink="#FF0000"')
   write('>');
}
}
// -- write("font-family: 'Times New Roman'"); --//
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  pg_hdr - display common page header                                 -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function pg_hdr(pg_desc) {
with(document) {
write('<table border="0" height="200" width="900">');

write('<tr>');

write('<td width=15% height="100" rowspan=2>');
write('<img border="0" src="images/cmalogo.gif"></td>');

write('<td width=5% height="100"></td>');

write('<td align="center" width=80% height="100" style="font-size: 36pt">');
write('Port Wentworth Alliance Church</td>');

write('</tr>');

write('<tr>');
if (pg_desc > ' ') {
write('<td colspan="2" align="center" style="font-size: 24pt">' + pg_desc + '</td>')
}

write('</tr>');
write('</table>');

write('<table border="1" width="900"><tr>');
write('<td width=15%><a href="index.htm">Home</a></td>')
write('<td width=15%><a href="cal0904.htm">Calendar</a></td>')
write('<td width=15%><a href="Contact.htm">Contact Us</a></td>')
write('</tr></table>');

}
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  pg_foot - display common page footer                                -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function pg_foot() {
with(document) {
write("<table border=0><tr>")
write("<td align='center' width='25%'><a href='www.pwalliance.org'>Home</a>")
write("<td align='center' width='25%'><a href='Contact.htm'>Contact Us</a>")
write("<td align='center' width='25%'>")
write("<td align='center' width='25%'>")
write("</tr></table>")
write("<p id='#foot' style='padding-left: 10%'>");
write('URL ' + URL + ' last modified ' + lastModified + '.<br>')
write("</p>");
}
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  hl_text - display highlighted text                                  -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function hl_text(lc_text, lc_fmt) {
with(document) {

write("<ins style='")

i=1
j=lc_fmt.length+1

while (i<j) {

   if (i>1) {write('; ')}

   write("font-weight: bold")

   i=i+1
   
   }

write("'>")
write(lc_text)
write("</ins>")
}
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// -- pg_constr -  display "under construction" message                    -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function pg_constr() {
with (document) {

write("<br><table border=0>");

write("<tr>");
write("<td width=10%></td>");
write("<td width=80% align=center>");
write("<img src='images/Elem/undcon.bmp'></td>");
write("<td width=10%></td>");
write("</tr>");

// -     -     -     -     -     -     -     -     -     -     -    -

write("<tr>");
write("<td width=10%></td>");
write("<td width=80% align=center>");
write("<h1 style='font-size: 16pt; text-align: center'>");
write("<br>This page is under construction.</h1></td>");
write("<td width=10%></td>");
write("</tr>");

// -     -     -     -     -     -     -     -     -     -     -    -

write("<tr>");
write("<td width=10%></td>");
write("<td width=80% align=center>");
write("<img src='images/Elem/undcon.bmp'></td>");
write("<td width=10%></td>");

write("</tr>");
write("</table>");

                    }
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  gal_disp - display gallery                                          -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function gal_disp(gal_pfx, gal_ext, gal_cnt, gal_cols, gal_ver, gal_hor) {
//    gal_pfx - image file prefix
//    gal_ext - image file extention (bmp,jpg,gif)
//    gal_cnt - number of images to display
//    gal_cols - number of images in a row
//    gal_ver - vertical size of images
//    gal_hor - horizontal size of images

gal_tbl_width=(gal_cols*gal_hor)+((gal_cols+1)*2)+10
with(document) {
write('<table width="' + gal_tbl_width + '" border=2>');

i=1
j=gal_cnt+1
k=1

while (i < j) {
      gal_cndx=i.toString()
      while (gal_cndx.length < 3) {
            gal_cndx = "0" + gal_cndx
                                       }
      if (k=1) {
             write('<tr height="' + gal_ver + '">')
                }

      gal_fnam="galleries/" + gal_pfx + gal_cndx + "." + gal_ext
      write('<td width="' + gal_hor + '">')
      write('<img src="' + gal_fnam + '" width="' + gal_hor + '" height="' + gal_ver + '">')
      write('</td>')

      k=k+1
          window.prompt('Pretest: k=' + k + ' and gal_cols=' + gal_cols,'?')
      if (k>gal_cols) {
          window.prompt('Test true: k=' + k + ' and gal_cols=' + gal_cols,'?')
          write('</tr>')
          k=1
                         }
      i=i+1

               }

write("</table>");
                    }
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  cal_mrow - display month name row on calendar                       -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function cal_mrow(mon_name,mon_bkwd,mon_fwd) {
with(document) {
write('<tr>');
write('<td>');
    if (mon_bkwd > '    ') { write('<a href="cal'+mon_bkwd+'.htm">') 
                             write('<img border="0" ')
                             write('src="images/Arrows/bwd_arrow.gif"')
                             write('width="57" height="34" align="right"></a>') }
write('</td>');
write('<td colspan="5"><p align="center"><font size="5">')
write(mon_name+'</font></td>');
write('<td>');
    if (mon_fwd > '    ') { write('<a href="cal'+mon_fwd+'.htm">') 
                             write('<img border="0" ')
                             write('src="images/Arrows/fwd_arrow.gif"')
                             write('width="57" height="34" align="right"></a>') }
write('</td>');

write('</tr>');
}
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  cal_drow - display day name row on calendar                         -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function cal_drow() {
with(document) {
write('<tr>');
write('<td align="center" width="16%"><font size="4"><b>Sun</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Mon</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Tue</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Wed</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Thu</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Fri</b></font></td>');
write('<td align="center" width="14%"><font size="4"><b>Sat</b></font></td>');
write('</tr>');
}
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  cal_nrow - display day number row on calendar                       -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function cal_nrow(cal_start,cal_lim) {
document.write('<tr>')
k=cal_start
for (i=1; i <= 7; i++) {
    if (k > cal_lim) { k=1 }

    document.write('<td bgcolor="#CCCCCC" align="center"><font size="4">'+ k +'</font></td>')
    k=k+1
    }
document.write('</tr>')
}
// --                                                                      -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
// --                                                                      -- //
// --  cal_td - configure calendar date cell                               -- //
// --                                                                      -- //
// -------------------------------------------------------------------------- //
//
function cal_td(td_color) {
j=cal_td.arguments.length
with(document) {     
write('<td')
write(' bgcolor="'  +  td_color  +  '"') 
write(' style="font-size: ' + "'8pt'" + '"')
write('>')
}
}
