/*
     FILE ARCHIVED ON 11:57:45 Aug 29, 2007 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 16:16:52 Jun 27, 2011.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/

	var latitudi,longitudi,tzr;

	function GetLastVisit ()
	{
			// Info about last visit
			latitudi = GetCookie ('latitude');	
			longitudi = GetCookie ('longitude');	
			tzr = GetCookie ('tzone');	
			document.myform.latmins.value = dms(latitudi);
			document.myform.anylatit.value = Math.floor(latitudi);
			document.myform.longmins.value = dms(longitudi);
			document.myform.anylong.value = Math.floor(longitudi);
			document.myform.anytzone.value = tzr;
			if (longitudi<0) document.myform.eastwest[0].checked= true;

	}
	function SetLastVisit () 
	{
		var expDate = new Date (); 
		var latitudi = document.myform.anylatit.value;
    var latmin = document.myform.latmins.value;
		var longitudi = document.myform.anylong.value;
    var lonmin = document.myform.longmins.value;
		var tzr = document.myform.anytzone.value;
	latitudi = parseFloat(1.0*latitudi +latmin/60.0);
	longitudi = 1.0*longitudi +lonmin/60.0;
		// The expDate is the date when the cookie should
		// expire, we will keep it for 12 weeks
		expDate.setTime( expDate.getTime() + (84 * 24 * 60 * 60 * 1000) ); 

			// Store info about this visit
		SetCookie( 'latitude', latitudi, expDate); 
		SetCookie( 'longitude', longitudi, expDate); 
		SetCookie( 'tzone', tzr, expDate); 
	}
    function GetCookie (name) {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }
      return null;
    }
      function SetCookie (name, value) {
      var argv = SetCookie.arguments;
      var argc = SetCookie.arguments.length;
      var expires = (argc > 2) ? argv[2] : null;
      var path = (argc > 3) ? argv[3] : null;
      var domain = (argc > 4) ? argv[4] : null;
      var secure = (argc > 5) ? argv[5] : false;
      document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }

function getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }

function dms(x) {
// convert decimal fraction of degrees to minutes // 
var m,i,f;
x = Math.abs(x);	// minutes always > 0
i = Math.floor(x);
f = x - i;
m = Math.round(60.0*f);
return m;
}
