
// ===================================================================================
// ===================================================================================
// JavaScript Filename: subs02.js
// ------------------------------
// Last Updated:        21 April 2010
// ===================================================================================
// ===================================================================================
// ===================================================================================

// =====================================================================
// Display a message text in the browser's status window ===============
// =====================================================================
function message(txt){
   window.status = txt;         
}

// =====================================================================
// Display a new page with specified picture and background ============
// =====================================================================
// Parameter Definition: picName      = Filename of picture to display.
//                       backgroundFN = Filename of background to display 
//                                      (or "undefined").
//                       bgndColor    = Background RGB Color 
//                                      (or "undefined").
//                       bgColorT2a   = Background Color Tbl2a 
//                                      (or "undefined").
//                       bgColorT2b   = Background Color Tbl2b 
//                                      (or "undefined").
// =====================================================================
// Example:
// ========
//
// <A HREF="javascript:void dsplyPic('waterfls.jpg', 'undefined', '#52693d', 'Black', 'undefined');" class="link1">Click to Enlarge</A>
//
// =====================================================================
//                       Version 1.10 (June 30, 2002)
// =====================================================================
function dsplyPic(picName, backgroundFN, bgndColor, bgColorT2a, bgColorT2b) {

var cs = 2 // Default to cellspacing value for IE.
var myStr = navigator.appName;

  if (myStr=="Netscape"){ cs = 4 } // Reset cellspacing for Netscape Navigator.

  if ((picName == null) || (picName == "undefined")) {
  alert('"picName" is a required parameter\nCorrect "dsplyPic" in program')
  return false
  }
  else
  var screenImage = ""; // Initialize screenImage.
  screenImage    += '<!doctype html public "-//w3c//dtd html 4.0 transitional//en">' + '\n' +
                    '<html>' + '\n\n' + '<head>' + '\n' + '<title>Requested Large Picture: [' + picName + ']</title>' + '\n' + 
                    '<!---- This page was dynamically generated. ---->' + '\n' +
                    '</head>' + '\n\n' +
                    '<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 '
		    if (backgroundFN != "undefined") {screenImage += 'background="' + backgroundFN + '"'}
		    if (bgndColor    != "undefined") {screenImage += 'bgcolor="' + bgndColor + '"'}
  screenImage    += '>' + '\n\n<p>&nbsp;</p>\n' +
                    '<center>' + '\n' +
                    '<table border=0 cellspacing=0 cellpadding=0 width=640>' + '\n' +
                    '<tr><td align="Center">' + '\n\n'
		    if (bgColorT2a != "undefined") {screenImage += '<table border=1 cellspacing=' + cs + ' cellpadding=0 bgcolor="' +  bgColorT2a + '">\n'} else {screenImage += '<table cellspacing=2 cellpadding=0 border=0>\n'}
  screenImage    += '<tr>' 
		    if (bgColorT2b != "undefined") {screenImage += '<td align="Center" bgcolor="' + bgColorT2b + '">\n'} else {screenImage += '<td align="Center">\n'}
  screenImage    += '<center><img src="' + picName  + '"' + ' border=0 alt=""></center>' + '\n' +
                    '</td></tr>' + '\n' + 
                    '</table>' + '\n\n' +
                    '</td></tr>' + '\n' +
                    '</table>' + '\n<p>&nbsp;</p>\n' +                       
                    '</center>' + '\n\n' +
                    '</body>' + '\n' + '</html>' + '\n'
      document.write(screenImage)   // Write contents of screenImage to browser window.
      document.close()              // Close.
      return true                   // Return with true.
}

// =====================================================================
// Go to Specified URL =================================================
// =====================================================================
function gotoURL(url) {
var urlSave
      urlSave = url
      message("Buttons Example...");
	top.location.href = urlSave;
}

// =====================================================================
// Display a Window on User's Browser ==================================
// =====================================================================
function OpenWin(url, name, width, height) {
      var xMax = screen.width, yMax = screen.height;
	  var xOffset = (xMax - width)/2, yOffset = (yMax - height)/2;
	  var Win = window.open(url,name,'width=' + width + ',height=' + height +
	  ',resizable=1,scrollbars=yes,location=yes,directories=no,menubar=no,status=yes,toolbar=no,navbar=no,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'' );
	  Win.focus();
}

// =====================================================================
// Display a Window on User's Browser ==================================
// =====================================================================
var myPopupWindow=null;
function OpenWindow(url, width, height, options){
     if (!width) width = 640;	
     if (!height) height = 480;  
     if (!options) {
        options = "left=180,top=100,scrollbars=no,menubar=no,toolbar=no,location=no,status=no,resizable=no"; 
    }
    if(!myPopupWindow || myPopupWindow.closed) {  
    	myPopupWindow = window.open( url, "popupWindow",
     "width=" + width + ",height=" + height + "," + options );
    }
    if (!myPopupWindow.opener) {
	newwin.opener = self;
    }
    myPopupWindow.focus();
}

// =====================================================================
// Display a Help Window on User's Browser =============================
// =====================================================================
function helpWin(){
 window.open("","help","toolbar=no,location=no,directories=no,status=yes,menubar=no," +
 "scrollbars=yes,copyhistory=no,resizable=no,width=450,height=420");
 }

// =====================================================================
// Print the contents of the current window or frame ===================
// =====================================================================
function print_me() {
	if (window.print) { 
		window.print()
		} else {
		var platform = navigator.platform.toUpperCase()
		var browser = navigator.appName.toUpperCase()
		if (platform == "MACPPC" && browser == "NETSCAPE") {
			alert('Please use command-p to print.')
			} else {
			alert('Please use control-p to print.')
			}
		}
	}

// =====================================================================
// Format Date and Time of Day  ========================================
// =====================================================================
// Insert the following line in the body of your HTML file where you want
// the Date and Time to be inserted.
//
// document.write('<br>' + finalDate + '<br><br>');
//
// =====================================================================


	var monthNames = new Array ("Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec");
	var now = new Date();
	var theHour = now.getHours();
	var amPm = (theHour < 12) ? "am" : "pm";
	var hour = (theHour > 12) ? (theHour - 12) : (theHour == 0) ? 12 : theHour;
	var min = (now.getMinutes() < 10) ? ("0" + now.getMinutes()) : (now.getMinutes());
	var finalDate = (monthNames[now.getMonth()] + " " + now.getDate() + ", " + hour + ":" + min + amPm);	


// =====================================================================
// Add a leading "0" to each number that's smaller than 10.  ===========
// =====================================================================
function leadingZero(nmbr)
{
	if (nmbr < 10) nmbr = "0" + nmbr;
	return nmbr;
}

// =====================================================================
// Generalized Date Script.  ===========================================
// =====================================================================
// 
// Style  1: 2004 (Year only - For Copyright Year Stamp)
// Style  2: March 17, 2000
// Style  3: Mar 17, 2000
// Style  4: Saturday March 17, 2000
// Style  5: Sat Mar 17, 2000
// Style  6: Sat March 17, 2000
// Style  7: 17 March 2000
// Style  8: 17 Mar 2000
// Style  9: 17 Mar 00
// Style 10: 3/17/00
// Style 11: 3-17-00
// Style 12: Saturday March 17
//
// Style 13: Salutations (only).
// Style 14: Salutations (w/Date).
// Style 15: Time (am/pm).
// Style 16: Time (Military).
//
// Style 17: Day of Week (short).
// Style 18: Day of Week (long).
//
 

function getDate(Style){

if ( ! Style ) {Style = 1};

var months = new Array();
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";

var months2 = new Array();
months2[1]  = "Jan"; 
months2[2]  = "Feb"; 
months2[3]  = "Mar"; 
months2[4]  = "Apr"; 
months2[5]  = "May"; 
months2[6]  = "Jun"; 
months2[7]  = "Jul";
months2[8]  = "Aug";
months2[9]  = "Sep";
months2[10] = "Oct";
months2[11] = "Nov";
months2[12] = "Dec";

var days = new Array();
days[1]  = "Sunday";    
days[2]  = "Monday";    
days[3]  = "Tuesday";   
days[4]  = "Wednesday";
days[5]  = "Thursday";
days[6]  = "Friday";
days[7]  = "Saturday";

var days2 = new Array();
days2[1]  = "Sun"; 
days2[2]  = "Mon"; 
days2[3]  = "Tue"; 
days2[4]  = "Wed";
days2[5]  = "Thu";
days2[6]  = "Fri";
days2[7]  = "Sat";

var greetings = new Array ();
greetings[1] = "Good morning, ";
greetings[2] = "Good afternoon, ";
greetings[3] = "Good evening, ";

var todaysdate = new Date();
var date       = todaysdate.getDate();
var day        = todaysdate.getDay() + 1;
var month      = todaysdate.getMonth() + 1;
var yy         = todaysdate.getYear();
var year       = (yy < 1000) ? yy + 1900 : yy;
var year2      = year - 2000;

now = new Date();
if (now.getHours() < 12) index = 1; else
if (now.getHours() < 17) index = 2; else
                         index = 3;
var d    = new Date();
var Hrs  = d.getHours();
var MHrs = Hrs;		// Use "MHrs" for Military time option.
var Min  = d.getMinutes();
var AmPm = "am";
if (Hrs > 11) AmPm = "pm";
if (Hrs  == 0) Hrs = 12;
if (Hrs > 12) Hrs = Hrs - 12;

var dataLine = new Array();
dataLine[1]  = year;									// 2004 (Year only - For Copyright Year Stamp).
dataLine[2]  = months[month] + " " + leadingZero(date) + ", " + year;			// March 17, 2000.
dataLine[3]  = months2[month] + " " + leadingZero(date) + ", " + year;			// Mar 17, 2000.
dataLine[4]  = days[day] + " " + months[month] + " " + date + ", " + year;		// Saturday March 17, 2000. 
dataLine[5]  = days2[day] + " " + months2[month] + " " + date + ", " + year;		// Sat Mar 17, 2000.
dataLine[6]  = days2[day] + " " + months[month] + " " + date + ", " + year;		// Sat March 17, 2000.
dataLine[7]  = date + " " + months[month] + " " + year;					// 17 March 2000.
dataLine[8]  = date + " " + months2[month] + " " + year;				// 17 Mar 2000.
dataLine[9]  = date + " " + months2[month] + " " + leadingZero(year2);			// 17 Mar 00.
dataLine[10] = leadingZero(month) + "/" + leadingZero(date) + "/" + leadingZero(year2);	// 3/17/00.
dataLine[11] = leadingZero(month) + "-" + leadingZero(date) + "-" + leadingZero(year2);	// 3-17-00.
dataLine[12] = days[day] + " " + months[month] + " " + leadingZero(date);		// Saturday March 17.

dataLine[13] = greetings[index];							// Salutations (only).
dataLine[14] = greetings[index] + "today is " + days[day] + ", " + months[month] + " " + date + ", " + year;  // Salutations (w/Date).
dataLine[15] = leadingZero(Hrs) + ":" + leadingZero(Min) + " " + AmPm;			// Time (am/pm).
dataLine[16] = leadingZero(MHrs) + ":" + leadingZero(Min);				// Time (Military).

dataLine[17] = days2[day];								// Day of Week (short).
dataLine[18] = days[day];								// Day of Week (long).


return(dataLine[Style]);
}

// =====================================================================
// Display Holy Ground Farm Copyright with Current Year  ===============
// =====================================================================
//  
// copyrite(bColor,fColor,tSize,xFont,xSize,xCompany)
//
//
// bColor   = Background Color of Message (Default = "White")
// fColor   = Foreground Color of Message (Default = "Black").
// tSize    = Table Size (Default = 640).
// xFont    = Font Face (Default = "Arial")
// xSize    = Font Size (Default = "1")
// xCompany = Company Name (Default = "Holy Ground Farm, Inc."
//
// ---------------------------------------------------------------------
// Other Functions: Format Date and Time of Day.
// ---------------------------------------------------------------------

function copyrite(bColor,fColor,tSize,xFont,xSize,xCompany){

if ( ! bColor ) bColor = '#ffffff';				// Default Background Color of Message = White.			
if ( ! fColor ) fColor = '#000000';				// Default Foreground Color of Message = Black.
if ( ! tSize )  tSize  = 640;					// Default = 640.

if ( ! xFont )    {xFont = 'Arial'};				// Default Font Face.
if ( ! xSize )    {xSize = '1'};				// Default Font Size.
if ( ! xCompany ) {xCompany = 'Holy Ground Farm, Inc.'};	// Default Font Size.

mHTML =  '<table border=0 cellpadding=0 cellspacing=0 align="Center" width=' + tSize + '>\n';
mHTML += '<tr><td align="Center" bgcolor="' + bColor + '">\n';
mHTML += '<font face="' + xFont + '" size=' + xSize + ' color="' + fColor + '">\n';
mHTML += '<b>Copyright&#169; ';
mHTML +=  new Date().getFullYear()  // Get current year.
mHTML +=  ' ' + xCompany + '</b><br>\n';
mHTML += '<center>a 501(C)(3) Non-Profit Company.</center>\n';
mHTML += '<center>Federal EIN: 56-2191533</center>\n';
mHTML += '<center>All rights reserved.</center>\n';
mHTML += '</font>\n';
mHTML += '</td></tr>\n';
mHTML += '</table>';

document.write(mHTML);
}

// =====================================================================
// Display Holy Ground Farm Disclaimer  ================================
// =====================================================================
//  
// disclaimer(bColor,fColor,tSize)
//
// bColor = Background Color of Message (Default = "White")
// fColor = Foreground Color of Message (Default = "Black").
// tSize  = Table Size (Default = 640).
//
function disclaimer(bColor,fColor,tSize)
{
var mFont = "Arial";			// Message Font Type.
var mSize = '1';			// Message Font Size.

if ( ! bColor ) bColor = '#ffffff'	// Default Background Color of Message = White			
if ( ! fColor ) fColor = '#000000'	// Default Foreground Color of Message = Black
if ( ! tSize )  tSize  = 640		// Default = 640;

script =  '<table border=0 cellpadding=0 cellspacing=0 width=' + tSize + '>\n';
script += '<tr><td align="Center" bgcolor="' + bColor + '">\n'  ;
script += '<font face="' + mFont + '" size=' + mSize + ' color="' + fColor + '">\n';
script += 'The information on this and subsequent web pages is intended to educate. Do not ';
script += 'substitute it for the advice of a qualified health care professional. Viewer ';
script += 'discretion is advised.\n';
script += '</font>\n';
script += '</td></tr>\n';
script += '</table>';
document.write(script);			// Display Disclaimer.
}


