// FILE: published.js
// GOAL: To identify current publishing attributes
// WHO:  Bradley Roberts


// Set the following attributes for each edition in turn:
// Update these as appropriate with each publishing of the site
var copyright_year = "2010";
var current_edition = "05";
var as_of_date = "05/03/2010";
var webmaster_name = "Webmaster";
var webmaster_id = "webmaster";
var webmaster_domain = "watsonline.org"; // http://www.watsonline.org/
var staff_name = "Gary Maxey";
var staff_id = "GMAfrica";
var staff_domain = "aol.com";
var dev_name = "Gary Maxey";
var dev_id = "GMAfrica";
var dev_domain = "aol.com";
var info_name = "WATS Information";
var info_id = "wats";
var info_domain = "watsonline.org";
var scholarship_name = "Lorraine Schaffer";
var scholarship_id = "lsafrica13";
var scholarship_domain = "aol.com";

// S/B: "PO Box 490306<br />Lawrenceville GA   30049-0006";
var mailing = "PO Box 490306<br />Lawrenceville GA   30049";
var street = "2865 Lenox Road NE, #304<br />Atlanta, GA 30324-2853";
var ofc_phone = "404-784-4618";  // Mark's cell phone
var founder_phone = "404-895-0018"; // Gary's cell phone


// The following sets the minimum date to show for the next meeting of the General Assembly
var next_date = "May 29, 2010"; 	// Next Graduation Date

// Be sure to check for the next major event
var next_major_event = "Sat, 29 May 2010 08:30:00 EDT";  // Next Commencement

// Setup for SlideShows defined
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;

// Duration of crossfade (seconds)
var crossFadeDuration = 3;

// Specify the image files
var Pic = new Array();
// To add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'album/image001.jpg'
Pic[1] = 'album/image002.jpg'
Pic[2] = 'album/image003.jpg'
Pic[3] = 'album/image004.jpg'
Pic[4] = 'album/image005.jpg'
Pic[5] = 'album/image006.jpg'
Pic[6] = 'album/image007.jpg'
Pic[7] = 'album/image008.jpg'
Pic[8] = 'album/image009.jpg'
// ...

var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++) 
{
    preLoad[i] = new Image();
    preLoad[i].src = Pic[i];
}


// The following functions use the information above to display 
// various items on a page. You should not have to change these.

//////////////////////////////////////////////////////////////////
// FUNCTION: show_copyright()
// GOAL:     To show the copyright notice on a particular page
// EG:       © 2007 Darby Consulting
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_copyright();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_copyright()
{
    document.write('&copy;&nbsp;' + copyright_year + ' by the <b>West Africa Theological Seminary</b>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_volume()
// GOAL:     To show the volume number on the page
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_volume();
//              // End -->
//              </script>
//////////////////////////////////////////////////////////////////
function show_volume()
{
    document.write(copyright_year);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_edition()
// GOAL:     To check and show the edition on the page
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_edition();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_edition()
{
    document.write(current_edition);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_director_phone()
// GOAL:     To show the Executive Director Cell Phone number on the page
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_director_phone();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_director_phone()
{
    document.write(founder_phone);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_ofc_phone()
// GOAL:     To show the Office Phone number on the page
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_ofc_phone();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_ofc_phone()
{
    document.write(ofc_phone);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: get_email(subject)
// GOAL:     To generate an eMail link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       webmaster@DarbyConsulting.net
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               get_email("Need Info, Please");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function get_email(subject)
{
    document.write('<a href=\"mailto:' + webmaster_id + '@' + webmaster_domain + '?subject='+subject+ '\">'); 
    document.write('<font face="Arial, Helvetica, sans-serif">' + webmaster_name + '</font></a>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: link_email(name, subject)
// GOAL:     To generate an eMail link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       staff_member@domain
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               link_email("Info", "Need Info, Please");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function link_email(name, subject)
{
    document.write('<a href=\"mailto:' + staff_id + '@' + staff_domain + '?subject='+subject+ '\">'); 
    document.write('<font face="Arial, Helvetica, sans-serif">' + name + '</font></a>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: get_staff_email(subject)
// GOAL:     To generate an eMail href link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       staff_id@DarbyConsulting.net
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               get_staff_email("Need Info, Please");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function get_staff_email(subject)
{
    document.write('<a href=\"mailto:' + staff_id + '@' + staff_domain + '?subject='+subject+ '\">' + staff_name + '</a>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: dev_email(name, subject)
// GOAL:     To generate an eMail link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       dev_member@domain
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               dev_email("Info", "Want to Give");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function dev_email(name, subject)
{
    document.write('<a href=\"mailto:' + dev_id + '@' + dev_domain + '?subject='+subject+ '\">'); 
    document.write('<font face="Arial, Helvetica, sans-serif">' + name + '</font></a>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: scholarship_email(name, subject)
// GOAL:     To generate an eMail link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       scholarship_member@domain
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               scholarship_email("Info", "Want to Give");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function scholarship_email(name, subject)
{
    document.write('<a href=\"mailto:' + scholarship_id + '@' + scholarship_domain + '?subject='+subject+ '\">'); 
    document.write('<font face="Arial, Helvetica, sans-serif">' + name + '</font></a>');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: get_link_email(subject, btn)
// GOAL:     To generate an eMail href link as appropriate. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       staff_id@DarbyConsulting.net
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               get_link_email("Need Info, Please", "event_btn.jpg");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function get_link_email(subject, img)
{
    document.write('<a href=\"mailto:' + staff_id + '@' + webmaster_domain + '?subject='+subject+ '\">');
	document.write('<img src=\"images/' + img + '\" alt=\"eMail to \"' + staff_name + '\" width=\"167\" height=\"70\"/>');
	document.write('</a>');
	 
}


//////////////////////////////////////////////////////////////////
// FUNCTION: get_info_email(subject, btn)
// GOAL:     To generate an eMail href link for more information. This helps 
//           combat SPAM by encapsulating the actual mailto link.
// EG:       wats@watsonline.org?subject=$SUBJECT
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//               get_info_email("Registration Information", "event_btn.jpg");
//               // End --></script>
//////////////////////////////////////////////////////////////////
function get_info_email(subject, img)
{
    document.write('<a href=\"mailto:' + info_id + '@' + info_domain + '?subject='+subject+ '\">');
	document.write('<img src=\"images/' + img + '\" alt=\"eMail to \"' + info_name + '\" width=\"50\" height=\"66\"/>');
	document.write('</a>');
	 
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_mailing()
// GOAL:     To show the current mailing address
// EG:       PO Box 490306, Lawrenceville GA   30049-0006
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_mailing();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_mailing()
{
    document.write(mailing);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_street()
// GOAL:     To show the copyright notice on a particular page
// EG:       100 Crescent Centre Pkwy, Ste 710<br />Tucker, GA 30084-7060
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_street();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_street()
{
    document.write(street);
}


//////////////////////////////////////////////////////////////////
// FUNCTION: last_update()
// GOAL:     To show the last time this site was updated
// EG:       "Last updated on 06/15/2007"
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              last_update();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function last_update()
{
    document.write('Last updated on ' + as_of_date + ' ');
}


//////////////////////////////////////////////////////////////////
// FUNCTION: next_graduation()
// GOAL:     To show the next date for Graduation - variable
// EG:       "May 29, 2010"
//           Graduations are typically held on the 4th Saturday of May
//           Specify next_date forward to skip dates
// NOTE:     =FIRST-WEEKDAY(FIRST,3)+10+IF(WEEKDAY(FIRST,3)>3,7,0)
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              next_graduation();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function next_graduation()
{
  	now = new Date();
	ahead = new Date(next_date);
	if (now < ahead)
	{
		now = ahead;
	}

  	first = new Date(now.getFullYear(), now.getMonth(), 1);
	dow = first.getDay();	// 0=SU, 1=MO, 2=TU, 3=WE, 4=TH, 5=FR, 6=SA
	dom = first.getDate();
	mth = first.getMonth();
	yr  = first.getFullYear();
	sat = new Date(yr, mth, 12-dow);
	if (dow > 4) 
	{
		sat = new Date(yr, mth, 19-dow);;
	}

	// Now determine if we have missed the meeting
	if (now.getDate() > sat.getDate()) 
	{
		mth = mth + 1;
		if (mth > 11) 
		{
			mth = 0; // Jan
			yr += 1;
		}
		nxtmth = new Date(yr, mth, 1);
		dow = nxtmth.getDay();
		sat = new Date(yr, mth, 12-dow);
		if (dow > 4) 
		{
			sat = new Date(yr, mth, 19-dow);;
		}
	}

	document.write(" "+ sat.toLocaleDateString());   

}


//////////////////////////////////////////////////////////////////
// FUNCTION: show_today()
// GOAL:     To show today
// EG:       © 2008 Darby Consulting
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              show_today();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function show_today()
{
	var now = new Date();
	
    document.write(now.toLocaleDateString());
}




//////////////////////////////////////////////////////////////////
// FUNCTION: setNewDeliveryTimeAgain()
// GOAL:     To set the time this site will be delivered
// EG:       "Last updated on 08/15/2004. Contact the _Webmaster_
//           with any corrections."
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              setNewDeliveryTimeAgain();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function setNewDeliveryTimeAgain()
{   // Called by setNewDeliveryTimeAgain
  setDeliveryTime();
}



//////////////////////////////////////////////////////////////////
// FUNCTION: setDeliveryTime()
// GOAL:     To show the time this site will be delivered
// EG:       "Last updated on 08/15/2004. Contact the _Webmaster_
//           with any corrections."
// USE:      Just call this as follows where needed:
//              <script language="javascript" type="text/javascript"><!-- Hidden from some browsers
//              setDeliveryTime();
//              // End --></script>
//////////////////////////////////////////////////////////////////
function setDeliveryTime()
{
  now = new Date();
  launch = Date.parse(next_major_event);
  timeNow = now.getTime();

  if ( (launch - timeNow) >= 0)
  {
	  timeLeft = launch - timeNow;
  }

  else
  {
  	  timeLeft = timeNow - launch;
  }

  days = parseInt(timeLeft / 86400000);
  if (isNaN(days))
  {
	  days = 0;
  }

  timeLeft = parseInt(timeLeft % 86400000);
  hours = parseInt(timeLeft / 3600000);
  timeLeft = parseInt(timeLeft % 3600000);
  mins = parseInt(timeLeft / 60000);
  timeLeft = parseInt(timeLeft % 60000);
  secs = parseInt(timeLeft / 1000);
  d1 = parseInt(days / 10);

  if ( isNaN(d1))
	  d1 = 0;
  d2 = parseInt(days % 10);

  if ( isNaN(d2))
	  d2 = 0;
  h1 = parseInt(hours / 10);

  if ( isNaN(h1))
	  h1 = 0;
  h2 = parseInt(hours % 10);

  if ( isNaN(h2))
	  h2 = 0;
  m1 = parseInt(mins / 10);

  if ( isNaN(m1))
	  m1 = 0;
  m2 = parseInt(mins % 10);

  if ( isNaN(m2))
	  m2 = 0;
  s1 = parseInt(secs / 10);

  if ( isNaN(s1))
	  s1 = 0;
  s2 = parseInt(secs % 10);

  if ( isNaN(s2))
	  s2 = 0;

  document.timeForm.deliveryTime.value="  "+days+" Days "+h1+h2+" hrs "+m1+m2+" mins "+s1+s2+" secs";
  setTimeout("setNewDeliveryTimeAgain()", 950);
  return;
}

// Now define the function to run the show
function runSlideShow()
{
    if (document.all) 
    {
        document.images.SlideShow.style.filter="blendTrans(duration=2)";
        document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
        document.images.SlideShow.filters.blendTrans.Apply();
    }
    document.images.SlideShow.src = preLoad[j].src;
    if (document.all) 
    {
        document.images.SlideShow.filters.blendTrans.Play();
    }
    j = j + 1;
    if (j > (p - 1)) j = 0;
    t = setTimeout('runSlideShow()', slideShowSpeed);
}


// End of functions

