<%
dim searchcity, searchcountry, lat, lon, latNS, latdeg, latmin, lonEW, londeg, lonmin, tz, tzAhead, tzh, tzm, dst
dim candles, tzaitdeg, tzaitmin
if Request("submitSave")<>"" then
' save mode
Session("City")=request("city")
Session("Country")=request("country")
Session("DSTRule")=request("dst")
Session("Latitude")=request("latNS")*(request("latdeg")*60+request("latmin"))
Session("Longitude")=request("lonEW")*(request("londeg")*60+request("lonmin"))
Session("TimeZone")=request("tzAhead")*(request("tzh")*60+request("tzm"))
Session("Candles")=request("candles")
Session("TzaitDeg")=request("tzaitdeg")
Session("TzaitMin")=request("tzaitmin")
else
' initial entry
searchcity=Session("City")
searchcountry=Session("Country")
lat=Session("Latitude")
lon=Session("Longitude")
tz=Session("TimeZone")
dst=Session("DSTRule")
candles=Session("Candles")
tzaitdeg=Session("TzaitDeg")
tzaitmin=Session("TzaitMin")
latNS=1 ' 1=North
if lat<0 then
latNS=-1
lat=-lat
end if
latdeg=int(lat/60)
latmin=lat mod 60
lonEW=1 ' 1=West
if lon<0 then
lonEW=-1
lon=-lon
end if
londeg=int(lon/60)
lonmin=lon mod 60
tzAhead=1
if tz<0 then
tzAhead=-1
tz=-tz
end if
tzh=int(tz/60)
tzm=tz mod 60
end if
%>
<% if Request("submitSave")<>"" then %>
Current city is now <%= session("City") %>.
<% else %>
Click on a city listed at the bottom of this page, and you will see its details (longitude, latitude etc) in the top section.
If you want to use that city, press the "Save" button.
You can edit the exact settings to those you require (click "Save" afterwards).
It's often useful to change the city name before you save - for example
you could save the settings with the name "London (Beth Din)".
<%
Function WriteCities
dim Conn, SQLQuery, List, hr, letter
if Request("showCities")="All" then
letter=""
else letter = Request("showCities")
end if
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={MySQL};DATABASE=consultdb; UID=consult;PASSWORD=jemima64"
if letter="" then
SQLQuery = "SELECT * FROM Locations order by city,country"
else
SQLQuery = "SELECT * FROM Locations where city like '" & letter & "%' order by city,country"
end if
Set List = Conn.Execute(SQLQuery)
Do While Not List.EOF
hr="javascript:SetParms('"& replace(List("city"),"'","\'") & "','" & List("country")& "'," &List("latitudeN")& "," &List("longitudeW")& "," &List("timeZone")& "," &List("DSTRule")&")"
response.write "" & List("city") & ", " &List("country") & "
"
List.MoveNext
Loop
List.Close
Conn.Close
end function
call WriteCities
%>
<% end if %>