Datex.au3

Last modified:   Monday, 9 June 2008

;*******************************************************************************
;
;   Function List
;         __Date_GetTimeZoneInfo()
;         __DateIsLeapYear()
;         __DateToStarDate()
;         __DisplayDate()
;         __Now()
;         __StardateToDate()
;         _Astrology_Symbol()
;         _Astrology_Totem_Character()
;         _Astrology_Totem_NA_Native()
;         _Date_DaysLapsed()
;         _Date_DaysRemaining()
;         _Date_Epact()
;         _Date_GoldenYear()
;         _Date_InRange()
;         _MonthDisplay()
;
;*******************************************************************************

#include-once

;===============================================================================
; Function Name:    __Date_GetTimeZoneInfo()
; Description:      Retrieves the Time Zone information for the system
; Syntax:           __Date_GetTimeZoneInfo()
; Parameter(s):     
; Requirements:
; Return Value(s):  
; Author(s):        George (GEOSoft) Gedye
; Notes:            Unfinished
; Modifications:
;===============================================================================

Func __Date_GetTimeZoneInfo()
   $strComputer = "localhost"
   $objT_Zone = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
   $tzItems = $objT_Zone.ExecQuery("SELECT * FROM Win32_TimeZone", "WQL", 0x10 + 0x20)
   If IsObj($tzItems) then
      For $objItem In $tzItems
         With $objItem
            Global $tzBias = .Bias;; Time Zone Bias given in minutes from GMT (Use .Bias/60 to get Hours)
            Global $tzCaption = .Caption;; Time Zone Caption
            Global $tzDesc = .Description;; Time Zone Description (usually same as Caption)
            Global $setID = .SettingID;; Setting ID (not usually used)
            Global $dName = .DaylightName;; $Daylight Savings Name
            Global $dBias = .DaylightBias;; Daylight Savings Bias (in minutes)
            Global $dDay = .DaylightDay;; Daylight Savings Day
            Global $dWDay = .DaylightDayOfWeek;; Daylight Savings Day of Week
            Global $dYear = .DaylightYear;; Daylight Savings Year
            Global $dMon = .DaylightMonth;; Daylight Savings Month
            Global $dHour = .DaylightHour;; Daylight Savings Hours
            Global $dMin = .DaylightMinute;; Daylight Savings Minutes
            Global $dSec = .DaylightSecond;; Daylight Savings Seconds
            Global $dMsec = .DaylightMillisecond;; DayLight Milliseconds
            Global $sName = .StandardName;; Standard Time Name
            Global $sBias = .StandardBias;; Standard Time Bias (in minutes)
            Global $sDay = .StandardDay;; Standard Time Day
            Global $sWDay = .StandardDayOfWeek;; Standard Time Day Of Week
            Global $sYear = .StandardYear;; Standard Time Year
            Global $sMon = .StandardMonth;; Standard Time Month
            Global $sHour = .StandardHour;; Standard Time Hours
            Global $sMin = .StandardMinute;; Standard Time Minutes
            Global $sSec = .StandardSecond;; Standard Time Seconds
            Global $sMsec = .StandardMillisecond;; Standard Time Milliseconds
         EndWith
; For display only         
         $Output=""
         $Output &= "Computer: " & $strComputer  & @CRLF
         $Output &= "==========================================" & @CRLF
         $Output &= "Bias: " & $tzBias & " minutes from GMT" & @CRLF & "Caption: " & $tzCaption & @CRLF
         $Output &= "Description: " & $tzDesc & @CRLF & "SettingID: " & $setID & @CRLF & @CRLF
         $Output &= "Daylight Name: " & $dName & @CRLF & "Daylight Bias: " & $dBias & @CRLF & "Daylight Day: " & $dDay & @CRLF
         $Output &= "Daylight Day of Week: " & $dWDay & @CRLF & "Daylight Year: " & $dYear & @CRLF & "Daylight Month: " & $dMon & @CRLF
         $Output &= "Daylight Hour: " & $dHour & @CRLF & "Daylight Minute: " & $dMin & @CRLF & "Daylight Second: " & $dSec & @CRLF
         $Output &= "Daylight Millisecond: " & $dMsec & @CRLF & @CRLF
         $Output &= "Standard Name: " & $sName & @CRLF & "Standard Bias: " & $sBias & @CRLF & "Standard Day: " & $sDay & @CRLF
         $Output &= "Standard Day Of Week: " & $sWDay & @CRLF & "Standard Year: " & $sYear & @CRLF & "Standard Month: " & $sMon & @CRLF
         $Output &= "Standard Hour: " & $sHour & @CRLF & "Standard Minute: " & $sMin & @CRLF
         $Output &= "Standard Second: " & $sSec & @CRLF & "Standard Millisecond: " & $sMsec & @CRLF
         $Output &= "=========================================="
         If Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
         ;$Output=""
      Next
      Return $Output
   Endif
EndFunc    ;<===> __Date_GetTimeZoneInfo()

;===============================================================================
; Function Name:    __DateIsLeapYear()
; Description:      Determines if a given year is a leap year
; Syntax:           __DateIsLeapYear($iYear)
; Parameter(s):     $iYear - The year to check
; Requirements:
; Return Value(s):  Success - Returns 1 if it is a leap year, 0 otherwise
;                   Failure - Returns 0 and sets @error to 1
; Author(s):        George (GEOSoft) Gedye
; Notes:
; Modifications:
;===============================================================================

Func __DateIsLeapYear($iYear)
   If NOT StringIsInt($iYear) Then Return SetError(1,1,0)
   If Mod($iYear, 400) = 0 OR (Mod($iYear, 4) = 0 And Mod($iYear, 100) <> 0) Then Return 1
   Return 0
EndFunc    ;<===> __DateIsLeapYear()

;===============================================================================
; Function Name:    __DateToStarDate()
; Description:      Converts a given year to a Star date (as used on Star Trek)
; Syntax:           __DateToStarDate([$iYear])
; Parameter(s):     $iYear (optional) - The year to convert. The default is the current year
; Requirements:
; Return Value(s):  Success - The star date
; Author(s):        George (GEOSoft) Gedye
; Notes:
; Modifications:
;===============================================================================

Func __DateToStarDate($iYear = '')
   If $iYear = '' Then $iYear = @Year
   Local $Leapyear = _DateIsLeapYear($iYear)
   $sY = $iYear - 2323
   $sX = Int(1000 * @YDAY / ( 365 + $leapyear ))
   $sF = Round((60 * @Hour + @Min ) / 144, 2)
   $sDate = $sY & $sX & $sF
   Return $sDate
EndFunc    ;<===> __DateToStarDate()

;===============================================================================
; Function Name:    __DisplayDate()
; Description:      Converts a Date of the type YYYYMMDDhhmmss to a nicly formated text display
; Syntax:           __DisplayDate($iDate[,$iTime[, $yDelim[, $tDelim[, $mLong]]])
; Parameter(s):     $iDate - Date to display
;                   $iTime - include the time string in the output
;                   $mLong - if set to 1 displays the full month name (default[0] is first 3 characters of month name)
;                   $yDelim - Character to place before the year (default is  "/")
;                   $tDelim - Delimiter to use for the time display (default is ":")
; Requirements:
; Return Value(s):  Success - returns the formatted date time string
; Author(s):        George (GEOSoft) Gedye
; Notes:            
;===============================================================================

Func __DisplayDate($iDate, $iTime = 1, $mLong = 0, $yDelim = "/", $tDelim = ":")
   Local $ap = " PM", $tStr = "", $oTime = ""
   $aMonth = StringSplit("January|February|March|April|May|June|July|August|September|October|November|December", "|")
   $dStr = StringLeft($iDate, 8)
   If StringLen($iDate) < 9 Then $iTime = 0
   If $iTime = 1 Then
      $tStr = StringReplace($iDate, $dStr, "")
      $oTime = "  "
      $tHr = StringLeft($tStr, 2)
      If $tHr < 12 Then
         $ap = " AM"
         If $tHr = 0 Then $tHr = 12
      EndIf
      $oTime &= $tHr & $tDelim & StringMid($tStr, 3, 2) & $tDelim & StringRight($tStr, 2) & $ap
   EndIf
   $yStr = $yDelim & StringLeft($dStr, 4)
   $mStr = $aMonth[StringRight($dStr, 2)]
   If $mLong = 0 Then $mStr = StringLeft($mStr, 3)
   $mStr &= Chr(32)
   $dStr = StringMid($dStr, 5, 2)
   $oDate = $mStr & $dStr & $yStr
   Return $oDate & $oTime
EndFunc

;===============================================================================
; Function Name:    __Now()
; Description:      Current date and time in several formats and including the quarter of the year
; Syntax:           __Now([$Format = 0[, $tFmt = 12[, $wDay = 1[, $Mth = 3[, $Day = 1[, $Yr = 1]]]]]])
; Parameter(s):     $Format - Return as: 0 = Array (default), 1 = date as formatted string ( [day of week]  [month/day/year]  [time] )
;                   $tFmt - Time format 12 = 12 hour (default), anything else = 24 hour
;                   $wDay - Day format 1 = full name (default), anything else = abbreviation
;                   $Mth - Month format 1 = full name, 2 = abbreviation of month name, anything else = 0 padded month number (default)
;                   $Day - Day format 1 = 0 padded day (default), anything else = @MDAY
;                   $Yr - Year format 1 = 4 digit, anything else = 2 digit
; Requirements:
; Return Value(s):  If $Format = 0 then returns an array of date and time values where
;                   $array[1] = Day name
;                   $array[2] = Month name or 0 padded number
;                   $array[3] = 0 padded day of month
;                   $array[4] = formatted year eg:(2007 or 07)
;                   $array[5] = formatted time eg:(14:32 or 02:32 PM)
;                   $array[6] = Quarter of the year
;                   $array[7] = Quarter suffix (st quarter, nd quarter, rd quarter, th quarter)
;                   If $Format = 1 Then returns a string with a pre-formatted day / date string of (Day Name, Formatted date, Formated Time) where
;                   Day name formatted per $wDay
;                   Pre- formatted date per $Mth - eg:(02/04/07 or Feb 04/07 or February 04, 2007)
;                   Pre-formatted time per $tFmt eg:(14:32 or 02:32 PM)
;
; Author(s):        George (GEOSoft) Gedye
; Notes:
; Modifications:
; Example(s):       $Dt=__Now(1)
;===============================================================================

Func __Now($Format = 0, $tFmt = 12, $wDay = 1, $Mth = 3, $Day = 1, $Yr = 1)
   Local $Ap = 'AM', $Rtn[8], $rHour = @Hour, $Qtr, $ap = '', $hDay = StringSplit('Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday','|')
   Local $Tmth
   ;;
   If $wDay = 1 Then
      $Rtn[1] = $hDay[@WDAY]
   Else
      $Rtn[1] = StringLeft($hDay[@WDAY], 3)
   EndIf
   $rMth = _MonthDisplay(@Mon, $Mth)
   If IsNumber($rMth) And $rMth < 10 Then $rMth = '0' & $rMth &"/"
   $Rtn[2] = $rMth
   $rDay = @MDay
   If $Day = 1 AND StringLen($rDay) = 1 Then $rDay = '0' & $rDay
   $Rtn[3] = $rDay
   $rYr = @Year
   If $Yr <> 1 Then $rYr = StringRight($rYr,2)
   $Rtn[4] = $rYr
   If $tFmt = 12 Then
      If $rHour > 12 Then $rHour = $rHour - 12
      If $rHour > 11 Then $ap = 'PM'
   EndIf
   $ap = Chr(32) & $ap
   $Rtn[5] = $rHour & ':' & @Min & $ap

   Switch @Mon
      Case 1 To 3
         $Qtr = 1
         $Qs = 'st quarter'
      Case 4 To 6
         $Qtr = 2
         $Qs = 'nd quarter'
      Case 7 To 9
         $Qtr = 3
         $Qs = 'rd quarter'
      Case Else
         $Qtr = 4
         $Qs = 'th quarter'
   EndSwitch

   $Rtn[6] = $Qtr
   $Rtn[7] = $Qs
   If $Format = 1 Then
      $Td = $Rtn[1]
      If $Mth = 2 Then
         $Tmth = $Rtn[2] & '/' & $Rtn[3] & '/' & $Rtn[4]
      Else
         $Tmth = $Rtn[2] & ' ' & $Rtn[3] & ', ' & $Rtn[4]
         If $Yr <> 1 Then $Tmth = StringReplace($Tmth, ', ','/')
      EndIf
      $Ta = $Tmth
      $Ttm = $Rtn[5]
      Redim $Rtn[6]
      $Rtn[1] = $Td
      $Rtn[2] = $Ta
      $Rtn[3] = $Ttm
      $Rtn[4] = $Qtr
      $Rtn[5] = $Qs
   EndIf
   If $Format = 1 Then
      Return $Rtn[1] & ", " & $Rtn[2] & " " & $Rtn[3]
   EndIf
   Return $Rtn
EndFunc    ;<===> __Now()

;===============================================================================
; Function Name:    __StardateToDate()
; Description:      Converts a star date (as used on Star Trek) to the date
; Syntax:           __StardateToDate($iDate)
; Parameter(s):     $iDate - Star date to convert
; Requirements:
; Return Value(s):  Success - Date (See Note)
; Author(s):        George (GEOSoft) Gedye
; Notes:            Currently it only returns the year.  If you want more then figure out the algorithm from _DateToStarDate()
; Modifications:
;===============================================================================

Func __StardateToDate($iDate)
   $iDate = Round($iDate,2)
   If StringLeft($iDate, 1) = '-' Then
      $sY = StringLeft($iDate, 4) + 2323
      $iDate = StringTrimLeft($iDate,4)
   Else
      $sY = StringLeft($iDate,3) + 2323
      $iDate = StringTrimLeft($iDate,3)
   EndIf
   Return $sY
EndFunc    ;<===> __StardateToDate()

;===============================================================================
; Function Name:    _Astrology_Symbol()
; Description:      Retrieves the Astrological symbol and element for a given month and day
; Syntax:           _Astrology_Symbol("month", "day")
; Parameter(s):     $iMth = the month
;                   $iDay = the day
; Requirements:
; Return Value(s):  Returns an array where array[0] = astrological sign and array[1] = the element for the given date.
; Author(s):        George (GEOSoft) Gedye
; Notes:            
; Modifications:
;===============================================================================

Func _Astrology_Symbol($iMth, $iDay) ;;Return Astrological Data of a Date
   Local $aData[2][13] = [ ["","Capricorn", "Aquarius", "Pisces", "Aries", "Taurus", "Gemini", "Cancer", "Leo", _
   "Virgo", "Libra", "Scorpio", "Sagittarius"] _
         , ["","Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire", "Earth", "Air", "Water", "Fire"]]
   $rSign = $iMth
   Switch $iMth
      Case 1, 3 ; Capricorn
         If $iDay > 19 Then $rSign += 1
      Case 2 ; Aquarius
         If $iDay > 17 Then $rSign += 1
      Case 4, 5, 11 ; Aries
         If $iDay > 20 Then $rSign += 1
      Case 6 ;Gemini
         If $iDay > 22 Then $rSign += 1
      Case 12 ; Sagittarius
         If $iDay > 21 Then $rSign = 1
      Case Else
         If $iDay > 21 Then $rSign += 1
   EndSwitch
   local $Sg = $aData[0][$rSign], $El = $aData[1][$rSign], $oData[2] = [$Sg, $El]
   Return $oData
EndFunc    ;<===> _Astrology_Symbol()

;===============================================================================
; Function Name:    _Astrology_Totem_Character()
; Description:      Retrieves the personal traits for a person born under a given animal sign
; Syntax:           _Astrology_Totem_Character(Animal)
; Parameter(s):     $anim - The animal sign as returned from _Astrology_Totem_NA_Native() array[1]
; Requirements:
; Return Value(s):  Success - Returns personal traits
;                   Failure - @Error = 1 , Invalid animal
; Author(s):        George (GEOSoft) Gedye
; Notes:            
; Modifications:
;===============================================================================

Func _Astrology_Totem_Character($anim)
   Local $oData = "The " & StringUpper(StringLeft($anim, 1)) & StringLower(StringMid($Anim,2)) & @CRLF & @CRLF
   Switch $anim
   Case "Otter"
      $oData &= "A little quirky, and unorthodox, the Otter is a hard one to figure sometimes. Perceived as "
      $oData &= "unconventional, the Otter methods aren't the first ones chosen to get the job done. This "
      $oData &= "is a big mistake on the part of others  because although unconventional, the Otter's "
      $oData &= "methods are usually quite effective." & @CRLF & @CRLF & "The Otter has an unusual way of "
      $oData &= "looking at things, but they are equipped with a brilliant imagination and intelligence, "
      $oData &= "giving them an edge over every one else." & @CRLF & @CRLF & "The Otter makes a "
      $oData &= "very good friend, and can be very attentive. In a nurturing environment the Otter is sensitive, "
      $oData &= "sympathetic, courageous, and honest. Left to their own devices, the Otter can be unscrupulous, "
      $oData &= "lewd, rebellious, and isolated."
   Case "Wolf"
      $oData &= "Deeply emotional, and wholly passionate, the Wolf is the lover of the zodiac in both the physical and "
      $oData &= "philosophical sense of the word. The Wolf understands that all we need is love, and is fully capable "
      $oData &= "of providing it." & @CRLF & @CRLF & "Juxtaposed with his/her fierce independence  this Native "
      $oData &= "American animal symbol is a bit of a contradiction in terms. Needing his/her freedom, yet still "
      $oData &= "being quite gentle and compassionate  we get the picture of the " & '"lone wolf"' & " with this sign."
      $oData &= @CRLF & @CRFL & "In a nurturing environment the Wolf is intensely passionate, generous, deeply"
      $oData &= "affectionate, and gentle. Left to his/her own devices the Wolf can become impractical, recalcitrant, "
      $oData &= "obsessive, and vindictive."
   Case "Falcon"
      $oData &= "A natural born leader, the Falcon can always be looked upon for clear judgment in sticky situations. "
      $oData &= "Furthermore, the characteristics for this Native American animal symbol never wastes time, rather "
      $oData &= "he/she strikes while the iron is hot, and takes action in what must be done." & @CRLF & @CRLF
      $oData &= "Ever persistent, and always taking the initiative, the Falcon is a gem of a personality to have "
      $oData &= "for projects or team sports. The Falcon can be a little on the conceited side  but he/she is usually "
      $oData &= "right in his/her opinions  so a little arrogance is understood." & @CRLF & @CRLF
      $oData &= "In a supportive environmental the Falcon " & '"soars"' & " in his/her ability to maintain passion and fire "
      $oData &= "in relationships, and always remaining compassionate. Left to his/her own devices, the Falcon "
      $oData &= "can be vain, rude, intolerant, impatient, and over-sensitive."
   Case "Beaver"
      $oData &= "Take charge, adapt, overcome  this is the Beaver motto. Mostly business, the Beaver gets the "
      $oData &= "the job at hand done with maximum efficiency and aplomb. Strategic, and cunning the Beaver is "
      $oData &= "a force to be reckoned with in matters of business and combat." & @CRLF & @CRLF
      $oData &= "One might also think twice about engaging the Beaver in a match of wits  as his/her mental "
      $oData &= "acuity is razor sharp. The Beaver has everything going for him/her  however tendencies "
      $oData &= "toward " & '"my way or the highway "' & "get them in trouble. Yes, they are usually right, "
      $oData &= "but the bearer of this Native American animal symbol may need to work on tact." & @CRLF
      $oData &= @CRLF & "In a nurturing environment the Beaver can be compassionate, generous, helpful, "
      $oData &= "and loyal. Left to his/her own devices the Beaver can be nervous, cowardly, possessive, "
      $oData &= "arrogant, and over-demanding."
   Case "Deer"
      $oData &= "This Native American animal symbol is the muse of the zodiac. The Deer is inspiring, lively and "
      $oData &= "quick-witted. With a tailor-made humor, the Deer has a tendency to get a laugh out of anyone."
      $oData &= @CRLF & @CRLF & "Excellent ability for vocalizing, the Deer is a consummate conversationalist. "
      $odata &= "This combined with his/her natural intelligence make the Deer a must-have guest at dinner parties. "
      $oData &= "Always aware of his/her surroundings, and even more aware of his/her appearance, the Deer can "
      $oData &= "be a bit self-involved. However, the Deer's narcissism is overlooked because of his/her "
      $oData &="congeniality and affability." & @CRLF & @CRLF & "In a supportive environment the Deer's natural "
      $oData &= "liveliness and sparkly personality radiate even more. He/she is an inspiring force in any nurturing "
      $oData &= "relationship. Left to his/her own devices the Deer can be selfish, moody, impatient, lazy, and two-faced."
   Case "Woodpecker"
      $oData &= "Woodpeckers are usually the most nuturing of all the Native American animal symbols. The "
      $oData &= "consummate listener, totally empathic and understanding, the Woodpecker is the one to have on your "
      $oData &= "side when you need support." & @CRLF & @CRLF & "Of course, they make wonderful parents, "
      $oData &= "and equally wonderful friends and partners. Another proverbial feather in the Woodpeckers cap "
      $oData &= "is the tendency to be naturally frugal, resourceful, and organized." & @CRLF & @CRLF
      $oData &= "In a nurturing environment the Woodpecker is of course caring, devoted, and very romantic. Left to "
      $oData &= "his/her own devices the Woodpecker can be possessive, angry, jealous, and spiteful."
   Case "Salmon"
      $oData &= "Electric, focused, intuitive, and wholly creative, the Salmon is a real live-wire. His/her energy is palpable. "
      $oData &= "A natural motivator, the Salmon's confidence and enthusiasm is easily infectious. Soon, everybody "
      $oData &= "is on board with the Salmon  even if the idea seems too hair-brained to work." & @CRLF & @CRLF
      $oData &= "Generous, intelligent, and intuitive, it's no wonder why the Salmon has no shortage of friends. This "
      $oData &= "Native American animal symbol expresses a need for purpose and goals, and has no trouble finding "
      $oData &= "volunteers for his/her personal crusades." & @CRLF & @CRLF & "In a supportive environment, "
      $oData &= "the Salmon is stable, calm, sensual, and giving. Left to his/her own devices, those that bear this "
      $oData &= "Native American animal symbol can be egotistical, vulgar, and intolerant of others."
   Case "Bear"
      $oData &= "Pragmatic, and methodical the Bear is the one to call when a steady hand is needed. The Bear's "
      $oData &= "practicality and levelheadedness makes him/her an excellent business partner. Usually the voice "
      $oData &= "of reason in most scenarios, the Bear is a good balance for Owls." & @CRLF & @CRLF
      $oData &= "The Bear is also gifted with an enormous heart, and a penchant for generosity. However, one "
      $oData &= "might not know it as the Bear tends to be very modest, and a bit shy." & @CRLF & @CRLF
      $oData &= "In a loving environment this Native American animal symbol showers love and generosity in return. "
      $oData &= "Further, the Bear has a capacity for patience and temperance, which makes him/her excellent "
      $oData &= "teachers & mentors. Left to his/her own devices the bear can be skeptical, sloth, "
      $oData &= "small-minded and reclusive."
   Case "Crow/Raven", "Crow", "Raven"
      $oData &= "Highly enthusiastic, and a natural entrepreneur, the Crow is quite a charmer. But he/she doesn't "
      $oData &= "have to work at being charming  it comes easily." & @CRLF & @CRLF & "Everyone recognizes "
      $oData &= "the Crow's easy energy, and everyone turns to the Crow for his/her ideas and opinions. This is "
      $oData &= "because the Crow is both idealistic and diplomatic and is quite ingenious." & @CRLF & @CRLF
      $oData &= "In nurturing environments this Native American animal symbol is easy-going, can be romantic, and "
      $oData &= "soft-spoken. Further, the crow can be quite patient, and intuitive in relationships. Left to "
      $oData &= "his/her own devices, the Crow can be demanding, inconsistent, vindictive, and abrasive."
   Case "Snake/Serpent", "Snake", "Serpent"
      $oData &= "Most shamans are born under this Native American animal symbol. The Snake is a natural in all "
      $oData &= "matters of spirit. Easily attuned to the ethereal realm the Snake makes an excellent spiritual leader."
      $oData &= &@CRLF & @CRLF & "Also respected for his/her healing capacities, the Snake also excels in "
      $oData &= "medical professions. The Snake's preoccupation with matters intangible often lead others to "
      $oData &= "view them as mysterious, and sometimes frightening. True, the Snake can be secretive, and "
      $oData &= "a bit dark  he/she is also quite sensitive, and caring." & @CRLF & @CRLF & "In a supportive "
      $oData &= "relationship the cool Snake can be passionate, inspiring, humorous, and helpful. Left to his/her "
      $oData &= "own devices, the Snake can be despondent, violent, and prone to abnormal mood swings."
   Case "Owl"
      $oData &= "Changeable and mutable as the wind, the Owl is a tough one to pin down. Warm, natural, with "
      $oData &= "an easy-going nature, the Owl is friend to the world." & @CRLF & @CRLF & "The bearer of this "
      $oData &= "Native American animal symbol is notorious for engaging in life at full speed, and whole-hearted "
      $oData &= "loves adventure. This can be to his/her detriment as the Owl can be reckless, careless, and "
      $oData &= "thoughtless. Owls make great artists, teachers, and conservationists. However, due to his/her "
      $oData &= "adaptability and versatility  the Owl would likely excel in any occupation." & @CRLF & @CRLF
      $oData &= "In a supportive, nurturing environment the Owl is sensitive, enthusiastic, and an attentive listener. "
      $oData &= "Left to his/her own devices, the Owl can be excessive, overindulgent, bitter, and belligerent."
   Case "Goose"
      $oData &= "If you want something done  give it to the Goose. Persevering, dogged, and ambitious to a fault, the "
      $oData &= "Goose sets goals for accomplishment, and always obtains them. The goose is determined to "
      $oData &= "succeed at all cost  not for the approval of other  but those with this Native American animal "
      $oData &= "symbol competes with his/her own internal foe." & @CRLF & @CRLF & "Driven is the watchword "
      $oData &= "for the Goose's dominating personality trait  which makes them excellent in business and "
      $oData &= "competitive sports. When tempered with supportive, nurturing family and friends, the Goose "
      $oData &= "excels in all things he/she attempts." & @CRLF & @CRLF & "In a loving environment the Goose "
      $oData &= "can be very passionate, humorous, gregarious, and even sensual. However, left to his/her own "
      $oData &= "devices, the Goose may fall into obsessive or addictive behaviors that will inevitably be "
      $oData &= "his/her demise."
   Case Else
      Return SetError(1)
   EndSwitch
   Return String($oData)
EndFunc

;===============================================================================
; Function Name:    _Astrology_Totem_NA_Native()
; Description:      Return details of North American native totems
; Syntax:           _Astrology_Totem_NA_Native("month", "day")
; Parameter(s):     $iMth = the month
;                   $iDay = the day of the month
; Requirements:
; Return Value(s):  Returns an array of 6 elements where;
;                                array[0] = Moon/Element
;                                array[1] = Animal
;                                array[2] = Plant
;                                array[3] = Mineral
;                                array[4] = Clan
;                                array[5] = Color
; Author(s):        George (GEOSoft) Gedye
; Notes:            
; Modifications:
;===============================================================================

Func _Astrology_Totem_NA_Native($iMth, $iDay)
   Local $aData[6][13] = [ ["Moon/Element","Earth Renewal", "Rest & Cleansing", "Big Winds", _
         "Budding Trees", "Frogs Return", "Corn Planting", "Strong Sun", "Ripe Berries", "Harvest", _
         "Ducks Fly", "Freeze Up", "Long Snows"], ["Animal", "Goose", "Otter", "Wolf", "Falcon", "Beaver", "Deer", _
         "Woodpecker", "Salmon", "Bear", "Crow/Raven", "Snake", "Owl"], ["Plant", "Birch Tree", "Aspen", "Plantain", _
         "Dandelion", "Blue Camas", "Yarrow", "Wild Rose", "Raspberry", "Violet", "Mullein", "Thistle", "Spruce"], _
         ["Mineral", "Quartz", "Silver", "Turquoise", "Fire Opal", "Chrysocolia", "Moss Agate", "Carnelian", "Garnet", _
         "Amethyst", "Jasper", "Malachite", "Obsidian"], ["Clan", "Turtle", "Butterfly", "Frog", "Thunderbird", "Turtle", _
         "Butterfly", "Frog", "Thunderbird", "Turtle", "Butterfly", "Frog", "Thunderbird"], ["Color", "White", "Silver", _
         "Blue - Green", "Yellow", "Blue", "White or Green", "Pink", "Red", "Purple", "Brown", "Orange", "Black"] ]
   Local $rSign = $iMth
   Switch $iMth
      Case 1, 3 ; Capricorn
         If $iDay > 19 Then $rSign += 1
      Case 2 ; Aquarius
         If $iDay > 17 Then $rSign += 1
      Case 4, 5, 11 ; Aries
         If $iDay > 20 Then $rSign += 1
      Case 6 ;Gemini
         If $iDay > 22 Then $rSign += 1
      Case 12 ; Sagittarius
         If $iDay > 21 Then $rSign = 1
      Case Else
         If $iDay > 21 Then $rSign += 1
   EndSwitch
   Local $Moon = $aData[0][$rSign], $Anim = $aData[1][$rSign], $Plant = $aData[2][$rSign], $Min = $aData[3][$rSign]
   Local $Clan = $aData[4][$rSign], $Clr = $aData[5][$rSign], $oData[6] = [$Moon, $Anim, $Plant, $Min, $Clan, $Clr]
   Return $oData
EndFunc   ;<==> _Astrology_Totem_NA_Native($iMth, $iDay)

;===============================================================================
; Function Name:    _Date_DaysLapsed()
; Description:      Calculates the number of days since a specified date (Leap years are accounted for)
; Syntax:           _Date_DaysLapsed(year, month, month day)
; Parameter(s):     $cYr  - The year to start.
;                   $iMth - The month to start (month number)
;                   $iDay - The day to start (month day number)
; Requirements:
; Return Value(s):  Success - The number of days remaining  before the input date
; Author(s):        George (GEOSoft) Gedye
; Notes:              
; Modifications:
;===============================================================================

Func _Date_DaysLapsed($nYr, $nMth, $nDay)
   Local $I, $cMth = $nMth, $aDays = _DateDaysInMonth($nYr, $nMth) - $nDay, $aYrs = @Year - ($nYr + 1), $aMths = $aYrs * 12
   Local $dDiff = (_DateDaysInMonth($nYr, $nMth) - $nDay) + @Mday
   $aMths += Round((12 - ($nMth)) + @Mon -1 + ($dDiff/30), 2)
   $dYrs = Round($aMths/12, 2)
   $nMth += 1
   For $I = $nYr to @Year
      Do
         $aDays += _DateDaysInMonth($I, $nMth)
         $nMth += 1
         If $nMth = @Mon -1 AND $I = @Year Then ExitLoop(2)
      Until $nMth = 12
      $nMth = 1
   Next
   $aDays += @Mday
   $aHrs = (($aDays -1) *24) + @Hour
   $aMin = ($aHrs *60) + @Min
   $aSec = ($aMin * 60) + @Sec
   If StringInStr($aMths, ".") Then
      $dMths = StringLeft($aMths, StringInStr($aMths, ".") -1)
      $aMths = _Number_AddSep(Int($dMths)) & StringMid($aMths, StringInStr($aMths, "."))
   Else
      $aMths = _Number_AddSep(Int($aMths))
   EndIf
   $aWks = Round($aDays/7, 2)
   If StringInStr($aWks, ".") Then
      $dWks = StringLeft($aWks, StringInStr($aWks, ".") -1)
      $aWks = _Number_AddSep(Int($dWks)) & StringMid($aWks, StringInStr($aWks, "."))
   Else
      $aWks = _Number_AddSep(Int($aWks))
   EndIf
   $aDays = _Number_AddSep(Int($aDays))
   $aHrs = _Number_AddSep(Int($aHrs))
   $aMin = _Number_AddSep(Int($aMin))
   $aSec = _Number_AddSep(Int($aSec))
   If $cMth = @Mon AND $nDay = @Mday Then $aYrs += 1
   Local $oArray [8] = [$aYrs, $dYrs, $aMths, $aWks, $aDays, $aHrs, $aMin, $aSec]
   Return $oArray
EndFunc   ;<==> _Date_DaysLapsed()

;===============================================================================
; Function Name:    _Date_DaysRemaining()
; Description:      Calculates the number of days remaing before a specified date
; Syntax:           _Date_DaysRemaining(month, month day [, year])
; Parameter(s):     $iMth - The month to end (month number)
;                   $iDay - The day to end (month day number)
;                   $cYr (optional) - The year to end. The default is the current year
; Requirements:
; Return Value(s):  Success - The number of days remaining  before the input date
; Author(s):        George (GEOSoft) Gedye
; Notes:      If The month and day are less than the current month and day and
;                 $cYr = current year then $cYr will be $cYr +1)
; Modifications:
;===============================================================================

Func _Date_DaysRemaining($iMth, $iDay, $cYr = 0)
   Local $bDate, $cDate, $rDays = 0, $dDiff, $I
   $wYears = ($cYr-1) - (@Year)
   If ($wYears = 0 OR $wYears = 1) AND @Mon < $iMth Then $wYears += 1
   If $wYears > 0 Then
      For $y = @Year + 1 To @Year + $wYears
         For $I = 1 To 12
            $rDays += _DateDaysInMonth($y, $i)
         Next
      Next
      $cYr = 0
   EndIf
   If $cYr = 0 Then $cYr = @Year
   If StringLeft(_DateDiff("D", StringFormat("%u/%02u/%02u", $cYr, @Mon, @Mday), StringFormat("%s/%02u/%02u", $cYr, $iMth, $iDay)), 1) = "-" Then
      $cYr += 1
         For $I = @Mon to 12
            $rDays += _DateDaysInMonth($cYr, $i)
         Next
         If $iMth >= 2 Then
            For $i = 1 To $iMth-1
               $rDays += _DateDaysInMonth($cYr+1, $i)
            Next
         EndIf
      If (NOT _DateIsLeapYear($cYr)) AND $iMth = 2 AND $iDay = 29 Then $rDays -= 1
   Else
      $cMth = @Mon
         For $i = $cMth To $iMth-1
            $rDays += _DateDaysInMonth(@Year, $i)
         Next
         If $I > 12 Then $I = 1
   EndIf
   $dDiff = ($rDays - @Mday) + $iDay
   Return $dDiff
EndFunc   ;<==> _Date_DaysRemaining()

;===============================================================================
; Function Name:   _Date_Epact()
; Description:     Return the Epact for a given year.
; Syntax:          _Date_Epact(Year[, Julian Year])
; Parameter(s):    $iYear - Year to calculate
;                  $Julian - Anything except 1 = $iYear is Julian (default)
;                          - 1 $iYear is Julian year
; Requirement(s):   
; Return Value(s): Epact of $iYear.  Corrected to Gregorian when $Julian is not 1
; Author(s):   George (GEOSoft) Gedye
; Modification(s): 
; Note(s):    
; Example(s):   
;===============================================================================

Func _Date_Epact($iYear, $Julian = 0)
   $iYear = Number($iYear)
   Local $Epact = (_Date_GoldenYear($iYear)*11)/30
   If $Julian <> 0 Then Return $Epact
   Switch $iYear
      Case 1582 To 1699
         $Epact += 21
      Case 1700 To 1799
         $Epact += 20
      Case 1800 To 1899
         $Epact += 19
      Case 1900 To 2099
         $Epact += 18
      Case 2100 To 2199
         $Epact += 17
      Case 2200 To 2299
         $Epact += 16
      Case 2300 To 2499
         $Epact += 15
   EndSwitch
   Return Int($Epact) ;; Corrected for Gregorian Calendar
EndFunc   ;<==> _Date_Epact()

;===============================================================================
; Function Name:   _Date_GoldenYear()
; Description:     Returns the "Golden Year" of a given year
; Syntax:          _Date_GoldenYear(Year)
; Parameter(s):    $iYear - Year to calculate
; Requirement(s):   
; Return Value(s): Success - The golden year as an integer
;                  Failure - @Error = 1 - Invalid year input 
; Author(s):   George (GEOSoft) Gedye
; Modification(s): 
; Note(s):    Used in calculating Epact. $iYear must be 19 or greater
; Example(s):   
;===============================================================================

Func _Date_GoldenYear($iYear)
   $iYear = Number($iYear)
   If $iYear < 19 Then Return SetError(1,1, "Invalid Year")
   Return Int(Mod($iYear, 19) +1)
EndFunc   ;<==> _Date_GoldenYear()

;===============================================================================
; Function Name:   _Date_InRange()
; Description:     Check if the current date is within a given range
; Syntax:          _Date_InRange("Start Month", "Start day", "End Month", "End day")
; Parameter(s):    $sMonth - Starting month of the range
;                  $sDay - Starting day of the range
;                  $eMonth - Ending month of the range
;                  $eDay - Ending day of the range
; Requirement(s):   
; Return Value(s): Success - 1 if current date is within the range, otherwise 0
; Author(s):   George (GEOSoft) Gedye
; Modification(s): 
; Note(s):    All paramaters can be input as either one or two digits
; Example(s):   
;===============================================================================

Func _Date_InRange($sMth, $sDay, $eMth, $eDay)
  Local $cDate, $sYear = Number(@Year), $eYear = $sYear
  Local $vRange = 0, $vStart = 0, $vEnd = 0
  $cDate = Number(@Mon & @MDay & @Year)
  ;; The next 4 lines simply allow you to input single digit months (6 instead of 06)
  $sMth = Number(StringFormat("%02d",$sMth))
  $sDay = Number(StringFormat("%02d",$sDay))
  $eMth = Number(StringFormat("%02d",$eMth))
  $eDay = Number(StringFormat("%02d",$eDay))
  If Number(@Mon) > $sMth Then $sYear += 1
  If $sMth > $eMth Then
    $eMth += 12
    $eYear += 1
  EndIf
  $sDate = $sMth & $sDay & $sYear
  $eDate = $eMth & $eDay & $eYear
  If ($cDate - $sDate) >= 0 AND ($eDate - $cDate) >= 0 Then $vRange = 1
  Return $vRange
EndFunc   ;<==> _Date_InRange()

;===============================================================================
; Function Name:    _MonthDisplay()
; Description:      Displays the month as name, full or abbreviated.
; Syntax:           _MonthDisplay($nMon[,$mType] )
; Parameter(s):     $nMon - number of month (use @Mon for current month)
;                   $mType - 1 = long display (default),  2 = abbreviated month, 3 = Strip leading zeros from month number
; Requirements:
; Return Value(s):  Success - Return the month formatted according to $mType
;                   Failure - Sets @Error to 1
; Author(s):        George (GEOSoft) Gedye
; Notes:            If $mType = 2 a period is added to the abbreviated month display.
; Modifications:
;===============================================================================

Func _MonthDisplay($nMon, $mType = 1)
   If $nMon <= 0 OR $nMon >= 13 Then Return SetError(1)
   $nMon = Number($nMon)
   Local $hMonth = StringSplit('January|February|March|April|May|June|July|August|September|October|November|December', '|')
   Switch $mType
      Case 1
         Return $hMonth[$nMon]
      Case 2
         Return StringLeft($hMonth[$nMon], 3) & "."
      Case Else
         Return $nMon
   EndSwitch
EndFunc