// BIRTHDAY CALCULATOR (1 of 2)
// Original Scripting by Ken Chandonait, 1999 <SevenDay@aol.com>


function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}
function getCookie(Name) {
   var search = Name + "="
   if (document.cookie.length > 0) { // if there are any cookies
      offset = document.cookie.indexOf(search) 
      if (offset != -1) { // if cookie exists 
         offset += search.length 
         // set index of beginning of value
            end = document.cookie.indexOf(";", offset) 
         // set index of end of cookie value
         if (end == -1) 
            end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      } 
   }
}

function calctm(mybday){
var today = new Date()
var q = Date.parse(mybday) - Date.parse(today)
var dayz = Math.ceil((q)/(1000*60*60*24))
return dayz
}

function dispyr(){
var y = document.data.year.options[document.data.year.selectedIndex].value
var m = document.data.mo.options[document.data.mo.selectedIndex].value
var d = document.data.days.options[document.data.days.selectedIndex].value
var realbd = m + ' ' + d + ', ' + y
//alert(realbd);
var tmp = Number(y) + 18
var dt = m + ' ' + d + ', ' + tmp 
var bd = new Date(dt)
var dayz = calctm(bd)
if (dayz < 0) {
var warning = 'Sorry, its too late for you to make Eagle.';
}
else {
                    var warning = 'You Have Only ' + dayz + ' days until you turn 18!'
     }

alert(warning);
if(confirm('This program can use Cookies to\n save your Time to Eagle information.  \n\nIf you DO NOT want cookies used, click Cancel.')){
setCookie("daystoeagle", bd, bd)
setCookie("t77idnfob", realbd, bd )
}

}
//End
