<!--
var Today=new Date();
var ThisDay=Today.getDay(); // a number between 0 and 6 represent the weekday
var ThisDate=Today.getDate(); //day number between 0 and 31
var ThisMonth=Today.getMonth()+1; //month number between 1 and 12
var site_url = "http://www.stmar.org";
//var site_url = "https://id88.securedata.net/stmar";
//var site_url = "http://127.0.0.1:8080";


listofimages = new Array(4);
listofimages[0] = new Image(130, 125)
listofimages[0].src = "images/Christmas_Images/Advent-1-candles.gif"
listofimages[1] = new Image(130, 125)
listofimages[1].src = "images/Christmas_Images/Advent-2-candles.gif"
listofimages[2] = new Image(130, 125)
listofimages[2].src = "images/Christmas_Images/Advent-3-candles.gif"
listofimages[3] = new Image(130, 125)
listofimages[3].src = "images/Christmas_Images/Advent-4-candles.gif"


function showCookies() 
{
    var dc = document.cookie;

   document.writeln("cookies: "+dc);

}

//
// getCookie from website: www.webreference.com/js/column8/functions.html
//
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


// Get the value of the cookie with the specified name.
function MSgetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}

function showLoginButton() {

    var local_site_url = site_url;
    var log_action = "Login";
    var regexS = "127.0.0.1";
    var regex = new RegExp( regexS );
    if ( regex.exec( window.location.href ) )
	local_site_url = "http://127.0.0.1:8080";

    var cookie_value = getCookie("stmar_login");
    var cookie_user  = getCookie("stmar_user");


    // document.writeln("<i>cookie="+ cookie_value + "</i>");
    if ( cookie_value == "yes" )
    {
        document.writeln("<a href=\""+local_site_url+"/cgi-bin/stmar_login.pl?cmd=logout\">");
	log_action = "Logout";
    }
    else
    {
        document.writeln("<a href=\""+local_site_url+"/cgi-bin/stmar_login.pl?cmd=showform\">");
    }

      document.writeln("<i>" + log_action + "</i>");
//    document.writeln("<img alt=\"Login/Logout\" src=\""+local_site_url+"/cgi-bin/stmar_login.pl?cmd=showpic\" /></a>");

    if ( cookie_user )
    {
	document.writeln("<i>"+cookie_user + "</i>");
    }

}

function showEditButton() {
    var cookie_value = getCookie("stmar_login");
    var cookie_user  = getCookie("stmar_user");

     document.writeln("<a href=\""+site_url+"/cgi-bin/editnews.pl?cmd=edit&username="+cookie_user+"\">");
     document.writeln("<img alt=\"Edit\" src=\""+site_url+"/cgi-bin/showimage.pl?image=Edit\" /></a>");


}

function ShowArrow(name) {
// rarrow.gif and noarrow.gif for Ordinary time
  var arrow_color = ""; // "purple_"  for advent, green_ for christmas nothing for ordinary time
  
  if ( name ) {
      document.writeln("<IMG WIDTH=\"8\" HEIGHT=\"8\" SRC=\"images/" + arrow_color + "rarrow.gif\">");
  } else {
      document.writeln("<IMG WIDTH=\"8\" HEIGHT=\"8\" SRC=\"images/" + arrow_color + "noarrow.gif\">");
  }
}

function ShowSevenAM() {
    if ( ( ThisDate >= 5 ) ) 
    {
	document.write("7:30 AM");
    }
    else
    {
	document.write("&nbsp;");
    }
}

function ShowTenAM() {
    if ( ( ThisDate < 5 ) )
    {
	document.write("10:00 AM");
    }
    else
    {
	document.write("&nbsp;");
    }
}

function DisplayCross() {


    if ( ( ThisMonth == 7 && ThisDate == 25 ) ||
	 ( ThisMonth == 8 && ThisDate == 10 ) ||
	 ( ThisMonth == 8 && ThisDate == 14 ) ||
	 ( ThisMonth == 8 && ThisDate == 24 ) ||
	 ( ThisMonth == 8 && ThisDate == 29 )
       )
    {
	// St James Apostle, St. Lawerence, St. Maximilian Mary Kolbe
	document.writeln("<IMG BORDER=\"0\" SRC=\"images/redWEBCROSS.gif\" WIDTH=\"32\">"); 
    } 
    else
    {
        if ( ( ThisMonth == 11 && ( ThisDate == 1 || ThisDate == 2 || ThisDate == 4 ) ) ||
	     ( ThisMonth == 8 && ThisDate == 28 ) )
        {
            document.writeln("<IMG BORDER=\"0\" SRC=\"images/whiteWEBCROSS.gif\" WIDTH=\"32\">");
        }
        else
        {
	   document.writeln("<IMG BORDER=\"0\" SRC=\"images/greenWEBCROSS.gif\" WIDTH=\"32\">"); 
        }

     }
}

function DisplayAdventImage(){

var i = 0;
var draw = 0;

if(ThisMonth != 11 && ThisMonth != 12 )
{
  return;
}

if(ThisMonth == 11 || ThisDate == 28)
{
  i = 0;
  draw = 1;
}
else if(ThisDate >= 5 && ThisDate <= 11)
{
  i = 0;
  draw = 1;
}  
else if(ThisDate >= 5 && ThisDate <= 11)
{
  i = 1;
  draw = 1;
}
else if(ThisDate >= 12 && ThisDate <= 18)
{
  i = 2;
  draw = 1;
}  
else if(ThisDate >= 19 && ThisDate <= 25)
{
  i = 3;
  draw = 1;
}
else
 draw = 0;      
 
 if(draw == 1)
 {
  
  document.writeln('<img src="" width="130" height="125" alt="" border="0" align="">');
  document.images[1].src = listofimages[i].src
//  document.writeln('<FONT SIZE="4" FACE="Arial"><BR><A HREF="javascript:xmas_win()">Christmas Information... </A></FONT>');
 }

}

function xmas_win()
{
var w = 500;
var h = 350;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
window.open('christmas_masses.html','Christmas_Masses',config="toolbar=no,location=no,height=525,width=500,top='wint',left='winl',directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no");
}

function DayTxt (DayNumber) {

var Day=new Array();
Day[0]="Sunday";
Day[1]="Monday";
Day[2]="Tuesday";
Day[3]="Wednesday";
Day[4]="Thursday";
Day[5]="Friday";
Day[6]="Saturday";
return Day[DayNumber];
}
var DayName=DayTxt(ThisDay);

function MonthTxt (MonthNumber) {
var Month=new Array();
Month[1]="January";
Month[2]="February";
Month[3]="March";
Month[4]="April";
Month[5]="May";
Month[6]="June";
Month[7]="July";
Month[8]="August";
Month[9]="September";
Month[10]="October";
Month[11]="November";
Month[12]="December";
return Month[MonthNumber];
}
var MonthName=MonthTxt(ThisMonth);

function LentDates () {
var lentday;
var lentdates=new Array();
lentdates[1]="Ash Wednesday";
lentdates[2]="First Sunday of Lent";
lentdates[3]="Second Sunday of Lent";
lentdates[4]="Third Sunday of Lent";
lentdates[5]="Fourth Sunday of Lent";
lentdates[6]="Fifth Sunday of Lent";
lentdates[7]="Palm Sunday";
lentdates[8]="Monday of Holy Week";
lentdates[9]="Tuesday of Holy Week";
lentdates[10]="Wednesday of Holy Week";
lentdates[11]="Holy Thursday";
lentdates[12]="Good Friday";
lentdates[13]="Holy Saturday Easter Vigil";
lentdates[14]="Happy Easter";
lentdates[15]=" ";

if(ThisMonth == 2 &&
   ThisDate  == 13)
   lentday = 1;
   else if(ThisMonth == 2 &&
           ThisDate  == 17)
     lentday = 2;
   else if(ThisMonth == 2 &&
           ThisDate  == 24)
     lentday = 3;
	else if(ThisMonth == 3 &&
           ThisDate  == 3)
     lentday = 4;
	else if(ThisMonth == 3 &&
           ThisDate  == 10)
     lentday = 5;
	else if(ThisMonth == 3 &&
           ThisDate  == 17)
     lentday = 6;
	else if(ThisMonth == 3 &&
           ThisDate  == 24)
     lentday = 7;      
    else if(ThisMonth == 3 &&
           ThisDate  == 25)
     lentday = 8;
	else if(ThisMonth == 3 &&
           ThisDate  == 26)
     lentday = 9;
	else if(ThisMonth == 3 &&
           ThisDate  == 27)
     lentday = 10;
	else if(ThisMonth == 3 &&
           ThisDate  == 28)
     lentday = 11;
	else if(ThisMonth == 3 &&
           ThisDate  == 29)
     lentday = 12;
	else if(ThisMonth == 3 &&
           ThisDate  == 30)
     lentday = 13;
	else if(ThisMonth == 3 &&
           ThisDate  == 31)
     lentday = 14;
	else
	 lentday = 15;       
	 
return lentdates[lentday];
}
//document.write("<center><TABLE BORDER=3 BGCOLOR=WHITE  WIDTH=75 HEIGHT=85><tr><TD align=center><font size=-2 >"+DayName+"<br><font color=orangered size=+3 >"+ThisDate+"</font><br>"+MonthName+"<br></b></font></TD></TR></TABLE></center>");

function LastModified() {
 var lastmod = document.lastModified // get string of last modified 
 var lastmoddate = Date.parse(lastmod)   // convert modified string to date
 if(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)   
   document.writeln("<FONT SIZE=-2>Last Updated: Unknown</FONT>")   
 } 
 else{   
   document.writeln("<FONT SIZE=-2>Last Updated: <I>" + lastmod + "</I></FONT>")
 }
}


var alert_counter = 0

// This will show a new image every second - the image on your webpage
// would have to have a name of 'titleImg' for this to work. JJL
//
function slideShow( update_milli_secs )
{
    var imageFullName = document.titleImg.src;
    var imageNameArray = imageFullName.split("/");
    var imageName = imageNameArray[ imageNameArray.length - 1 ];
    var last_slide_num = 9;

    if (imageName == "" )
    {
       return;
    }

    // all slides start 'slide' + number + '.gif'
    //
    
    slidenum = parseInt( imageName.substr(5, 1) ) ;  // upto 9 slides allowed
    slidenum++ ;


    if ( slidenum > last_slide_num )
    {
	slidenum = 1;
    }

    imageName = "slide" + slidenum + ".gif" ;
    if (! update_milli_secs )
    {
	update_milli_secs = 2000 ;
    }


    document.titleImg.src = 'images/' + imageName ;
    setTimeout("slideShow(" +update_milli_secs+ " )", update_milli_secs );
}


-->
