// Javascript Library file for St Saviours Web Site

ns4 = document.layers
ie4 = document.all 
nn6 = document.getElementById && !document.all 

//Date to display for web page changes
ChangeDate = "24 August 2010";

//Variables for Diary URL creation
ThisMonth="09";  ThisYear="2010";
NextMonth="";  NextYear="";
ThreeMonth="";  ThreeYear="";

// Hide function for pointer objects
function hideObject(objectid) {
   if (ns4) {
      document.objectid.visibility = "hide";
   }
   else if (ie4) {
      document.all[objectid].style.visibility = "hidden";
   }
   else if (nn6) {
      document.getElementById(objectid).style.visibility = "hidden";
   }
}


// Show function for pointer objects   
function showObject(objectid) {
   if (ns4) {
      document.objectid.visibility = "show";
   }
   else if (ie4) {
      document.all[objectid].style.visibility = "visible";
   }
   else if (nn6) {
      document.getElementById(objectid).style.visibility = "visible";
   }
}

  // Set up arrays
  var days = new Array(8);
  days[1] = "Sunday";
  days[2] = "Monday";
  days[3] = "Tuesday";
  days[4] = "Wednesday";
  days[5] = "Thursday";
  days[6] = "Friday";
  days[7] = "Saturday";

  var months = new Array(13);
  months[1] = "January";
  months[2] = "February";
  months[3] = "March";
  months[4] = "April";
  months[5] = "May";
  months[6] = "June";
  months[7] = "July";
  months[8] = "August";
  months[9] = "September";
  months[10] = "October";
  months[11] = "November";
  months[12] = "December";

// Could enhance for all uses by having selective calls
// ---------------------------------------------------------

function showDiary() {

   if (ThisMonth > ""){
		LineOne = months[eval(ThisMonth)] +  " " + ThisYear;
		DiaryCurrent = "StSDiary_" + ThisYear + "_" + ThisMonth + ".pdf";
		document.write ("<A href=" +  DiaryCurrent  +  " target=VIEWFRAME class=P14B_0R00>" +  LineOne + "</A>")
 }
   if (NextMonth > ""){
		LineTwo = months[eval(NextMonth)] +  " " + NextYear;
		DiaryNext =  "StSDiary_" + NextYear + "_" + NextMonth + ".pdf";
		document.write ("<BR><A href=" +  DiaryNext  +  " target=VIEWFRAME class=P14B_0R00>" +  LineTwo + "</A>")
   } 
   if (ThreeMonth > ""){
		LineTwo = months[eval(ThreeMonth)] +  " " + ThreeYear;
		DiaryThree =  "StSDiary_" + ThreeYear + "_" + ThreeMonth + ".pdf";
		document.write ("<BR><A href=" +  DiaryThree  +  " target=VIEWFRAME class=P14B_0R00>" +  LineTwo + "</A>")
   } 
}

function DisplayDiary(){
// Creates the URL reference for the current Diary - no parameters

//	Var myDiary;
	var v_date = new Date();

	if (ie4){
		TheYear = v_date.getYear()
	}
	else{
		TheYear = v_date.getYear() + 1900;
	}
	TheMonth = v_date.getMonth() + 1;
	if (TheMonth > 9){
//		document.write("StSDiary_" + TheYear + "_" + TheMonth);
		myDiary = "StSDiary_" + TheYear + "_" + TheMonth + ".pdf";
	}
	else{
//		document.write("StSDiary_" + TheYear + "_0" + TheMonth);
		myDiary = "StSDiary_" + TheYear + "_0" + TheMonth + ".pdf";
	}
//	document.write(myDiary + "<P>");
//    document.write("<tr><td class=&quot;lnav&quot; OnMouseOver=&quot;this.className='lnavover'&quot; 
//      OnMouseOut=&quot;this.className='lnav'&quot;><A href=" + myDiary + " 
//      target=&quot;VIEWFRAME&quot; class=&quot;MenuFont&quot;>Parish Diary</A></td></tr>");

	LineOne = "<td class='lnav' OnMouseOver=this.className='lnavover' ";
	LineOne = LineOne + "OnMouseOut=this.className='lnav'><A href=" + myDiary; 
	LineOne = LineOne + " TARGET='VIEWFRAME' class='MenuFont' >Diary</A></td>";
	document.write(LineOne);
}
// ---------------------------------------------------------

// allows the e-mail addresses to be hidden from worms and crawlers
function EmailAddress() {
  user  = "&#112;&#97;&#114;&#105;&#115;&#104;";
  site1 = "&#115;&#116;&#115;&#97;&#118;&#105;&#111;&#117;&#114;&#115;&#103;&#111;";
  site2 = ".net";

  document.write('<a href="mailto:' + user + '@' + site1 + site2 + '" class="P12B_0W0B">');
  document.write(user + '@' + site1 + site2 + '</a>')
}

function RectorAddress() {
  user  = "&#114;&#101;&#99;&#116;&#111;&#114;";
  site1 = "&#115;&#116;&#115;&#97;&#118;&#105;&#111;&#117;&#114;&#115;&#103;&#111;";
  site2 = ".net";

  document.write('<a href="mailto:' + user + '@' + site1 + site2 + '" class="P12B_0W0B">');
  document.write(user + '@' + site1 + site2 + '</a>')
}


// Extracts the date file last modified and displays it on the page
function LastModified() {
  document.write('<CENTER><P><SPAN class="P10B_0B00"> Site last updated on ' + ChangeDate + '</SPAN></CENTER>');
 }

// Go to a named anchor PAGETOP
function PageTop() {
  document.write("<CENTER><a href='#PAGETOP' class='P10B_0R00'>Top of page</a></CENTER>");
}

// Display a standardised footer on all pages
function Footer() {
  document.write('<CENTER><SPAN class="P10_0B00">St Saviour&acute;s Anglican Church,<BR>');
  document.write('2 Pridmore Road, Glen Osmond, South Australia<BR>');
  document.write('Contact the Parish Office: 8379 4114 <BR>');
  document.write('or e-mail: ');
  EmailAddress();
  document.write('</SPAN></CENTER>');
  LastModified();
}


// Set up a menu table using the DIV object
function StSMenu() {
  StSText = '<CENTER>'
    +'<IMG src="Images/StSLogo.gif" width="70" height="70" border="0" align="middle"><BR>'
    +'</CENTER>'
    +'<DIV class = lnav> <A href="index.html" target="_top" class="MenuFont">HOME</A></DIV>'
    +'<DIV class = lnav TITLE="Our vision for Christian growth and service"> '
    +'  <A href="StSVision.html" target="_top" class="MenuFont">Our Vision</A></DIV>'
    +'<DIV class = lnav TITLE="Worship, baptism, marriage, counselling - and more ..."> '
    +'  <A href="StSServices.html" target="_top" class="MenuFont">Services</A></DIV>'
    +'<DIV class = lnav> <A href="StSContacts.html" target="_top" class="MenuFont">Contact us</A></DIV>'
    +'<DIV class = lnav> <A href="StSOutreach.html" target="_top" class="MenuFont">Outreach</A></DIV>'
    +'<DIV class = lnav> <A href="StSYouth.html" target="_top" class="MenuFont">Youth</A></DIV>'
    +'<DIV class = lnav> <A href="StSWorship.html" target="_top" class="MenuFont">Worship</A></DIV>'
    +'<DIV class = lnav> <A href="StSGroups.html" target="_top" class="MenuFont">Groups</A></DIV>'
    +'<DIV class = lnav> <A href="StSHistory.html" target="_top" class="MenuFont">History</A></DIV>'
    +'<DIV class = lnav> <A href="StSLinks.html" target="_top" class="MenuFont">Links</A></DIV>'
    +'<IMG src="Images/StSaviours2001thmb.jpg" width="100" height="92"> <BR>'       
  document.write(StSText)
}
	
