/*
Satellite Tracker v1.5JavaScript copyright (c) Adrian R. Ashford, 11th February 2010.

Used with permission by Sky & Telescope magazine / SkyandTelescope.com

Based on MYBIRDSa.BAS by R. W. Sinnott, 3rd June 2001.

Free dynamic form event script:http://www.hscripts.com*/

proc_flag = 0;

x_scale = 339 / 360;
y_scale = 187 / 150;

function getParams(){var idx = document.URL.indexOf('?');var params = new Array();if (idx != -1) {var pairs = document.URL.substring(idx+1, document.URL.length).split('&');for (var i=0; i<pairs.length; i++){nameVal = pairs[i].split('=');params[nameVal[0]] = nameVal[1];}}return params;}params = getParams();latitude = parseFloat(unescape(params["latitude"]));longitude = parseFloat(unescape(params["longitude"]));t_zone = parseFloat(unescape(params["tzone"]));

aaa = new Array("Select","USA","Canada","Afghanistan","Albania","Algeria","Angola",
"Antigua","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas",
"Bahrain","Bangladesh",
"Barbados","Belarus","Belgium","Belize","Benin",
"Bermuda","Bhutan","Bolivia","Bosnia_and_Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina_Faso","Burundi","Cambodia","Cameroon","Cape_Verde","Central_African_Rep","Chad","Chile","China","Colombia",
"Comoros","Congo","Congo_Dem_Rep","Costa_Rica","Cote_dIvoire","Croatia","Cuba","Cyprus","Czech_Republic","Denmark","Djibouti","Dominican_Rep","East_Timor","Ecuador","Egypt","El_Salvador","Eritrea","Estonia","Ethiopia","Falkland_Islands","Fiji","Finland","France","French_Guiana","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Greenland","Guatemala","Guinea","Guinea_Bissau","Guyana","Haiti","Honduras","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Korea_North","Korea_South","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Lithuania",
"Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Mali",
"Malta",
"Marshall_Islands","Mauritania",
"Mauritius","Mexico","Moldova",
"Monaco","Mongolia","Morocco","Mozambique",
"Myanmar","Namibia","Nepal","Netherlands",
"New_Caledonia","New_Zealand","Nicaragua","Niger","Nigeria","Northern_Ireland","Norway",
"Oman","Pakistan","Panama","Papua_New_Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto_Rico","Qatar","Romania","Russia","Rwanda","Saudi_Arabia","Senegal",
"Serbia_Montenegro","Sierra_Leone","Singapore","Slovakia","Slovenia","Somalia","South_Africa","Spain","Sri_Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria",
"Tahiti","Taiwan","Tajikistan","Tanzania","Tasmania","Thailand","Togo","Trinidad_and_Tobago","Tunisia","Turkey","Turkmenistan","Uganda","Ukraine","United_Arab_Emirates",
"United_Kingdom","Uruguay","Uzbekistan","Vatican_City","Venezuela","Vietnam","Yemen","Zambia","Zimbabwe");Select = new Array("City");USA = new Array("---","Albany, NY","Albuquerque, NM","Amarillo, TX","Anchorage, AK","Atlanta, GA","Austin, TX","Baker, OR","Baltimore, MD","Bangor, ME","Birmingham, AL","Bismarck, ND","Boise, ID","Boston, MA","Buffalo, NY","Carlsbad, NM","Charleston, SC","Charleston, WV","Charlotte, NC","Cheyenne, WY","Chicago, IL","Cincinnati, OH","Cleveland, OH","Columbia, SC","Columbus, OH","Dallas, TX","Denver, CO","Des Moines, IA","Detroit, MI","Dubuque, IA","Duluth, MN","Eastport, ME","El Centro, CA","El Paso, TX","Eugene, OR","Fargo, ND","Flagstaff, AZ","Fort Worth, TX","Fresno, CA","Grand Junction, CO","Grand Rapids, MI","Havre, MT","Helena, MT","Honolulu, HI","Hot Springs, AR","Houston, TX","Idaho Falls, ID","Indianapolis, IN","Jackson, MS","Jacksonville, FL","Juneau, AK","Kansas City, MO","Key West, FL","Klamath Falls, OR","Knoxville, TN","Las Vegas, NV","Lewiston, ID","Lincoln, NE","Long Beach, CA","Los Angeles, CA","Louisville, KY","Manchester, NH","Memphis, TN","Miami, FL","Milwaukee, WI","Minneapolis, MN","Mobile, AL","Montgomery, AL","Montpelier, VT","Nashville, TN","Newark, NJ","New Haven, CT","New Orleans, LA","New York, NY","Nome, AK","Oakland, CA","Oklahoma City, OK","Omaha, NE","Philadelphia, PA","Phoenix, AZ","Pierre, SD","Pittsburgh, PA","Portland, ME","Portland, OR","Providence, RI","Raleigh, NC","Reno, NV","Richfield, UT","Richmond, VA","Roanoke, VA","Sacramento, CA","St Louis, MO","Salt Lake City, UT","San Antonio, TX","San Diego, CA","San Francisco, CA","San Jose, CA","Santa Fe, NM","Savannah, GA","Seattle, WA","Shreveport, LA","Sioux Falls, SD","Sitka, AK","Spokane, WA","Springfield, IL","Springfield, MA","Springfield, MO","Syracuse, NY","Tampa, FL","Toledo, OH","Tulsa, OK","Virginia Beach, VA","Washington, D.C.","Wichita, KS","Wilmington, NC");Canada = new Array("---","Calgary, AB","Charlottetown, PE","Chicoutimi, QC","Edmonton, AB","Guelph, ON","Halifax, NS","Hamilton, ON","Hull, QC","Iqaluit, NU","Kelowna, BC","Kingston, ON","Kitchener, ON","London, ON","Montreal, QC","Oshawa, ON","Ottawa, ON","Quebec City, QC","Regina, SK","Saint John, NB","Saskatoon, SK","Sherbrooke, QC","St Catharines, ON","St Johns, NL","Sudbury, ON","Thunder Bay, ON","Toronto, ON","Trois-Rivieres, QC","Vancouver, BC","Victoria, BC","Whitehorse, YT","Windsor, ON","Winnipeg, MB","Yellowknife, NT");Afghanistan = new Array("---","Kabul");Albania = new Array("---","Tirana");Algeria = new Array("---","Algiers");Angola = new Array("---","Luanda");
Antigua = new Array("---","St Johns");Argentina = new Array("---","Buenos Aires","Cordoba");Armenia = new Array("---","Yerevan");Australia = new Array("---","Adelaide","Brisbane","Darwin","Melbourne","Perth","Sydney");Austria = new Array("---","Vienna");Azerbaijan = new Array("---","Baku");Bahamas = new Array("---","Nassau");
Bahrain = new Array("---","Manama");Bangladesh = new Array("---","Chittagong");
Barbados = new Array("---","Bridgetown");Belarus = new Array("---","Minsk");Belgium = new Array("---","Brussels");Belize = new Array("---","Belmopan");Benin = new Array("---","Porto Novo");
Bermuda = new Array("---","Hamilton");Bhutan = new Array("---","Thimphu");Bolivia = new Array("---","La Paz");Bosnia_and_Herzegovina = new Array("---","Sarajevo");Botswana = new Array("---","Gaborone");Brazil = new Array("---","Belem","Rio de Janeiro","Salvador","Sao Paulo");Brunei = new Array("---","Bandar Seri Begawan");Bulgaria = new Array("---","Sofia");Burkina_Faso = new Array("---","Ouagadougou");Burundi = new Array("---","Bujumbura");Cambodia = new Array("---","Phnom Penh");Cameroon = new Array("---","Yaounde");Cape_Verde = new Array("---","Praia");Central_African_Rep = new Array("---","Bangui");Chad = new Array("---","Ndjamena");Chile = new Array("---","Iquique","Santiago");China = new Array("---","Beijing","Canton","Chongqing","Hong Kong","Nanjing","Shanghai");Colombia = new Array("---","Bogota");
Comoros = new Array("---","Moroni");Congo = new Array("---","Brazzaville");Congo_Dem_Rep = new Array("---","Kinshasa");Costa_Rica = new Array("---","San Jose");Cote_dIvoire = new Array("---","Abidjan");Croatia = new Array("---","Zagreb");Cuba = new Array("---","Havana");Cyprus = new Array("---","Nicosia");Czech_Republic = new Array("---","Prague");Denmark = new Array("---","Copenhagen");Djibouti = new Array("---","Djibouti");Dominican_Rep = new Array("---","Santo Domingo");East_Timor = new Array("---","Dili");Ecuador = new Array("---","Guayaquil");Egypt = new Array("---","Cairo");El_Salvador = new Array("---","San Salvador");Eritrea = new Array("---","Asmera");Estonia = new Array("---","Tallinn");Ethiopia = new Array("---","Addis Ababa");Falkland_Islands = new Array("---","Port Stanley");Fiji = new Array("---","Suva");Finland = new Array("---","Helsinki");France = new Array("---","Bordeaux","Lyons","Marseilles","Paris");French_Guiana = new Array("---","Cayenne");Gabon = new Array("---","Libreville");Gambia = new Array("---","Banjul");Georgia = new Array("---","Tbilisi");Germany = new Array("---","Berlin","Bremen","Frankfurt","Hamburg","Munich");Ghana = new Array("---","Accra");Greece = new Array("---","Athens");Greenland = new Array("---","Nuuk");Guatemala = new Array("---","Guatemala City");Guinea = new Array("---","Conakry");Guinea_Bissau = new Array("---","Bissau");Guyana = new Array("---","Georgetown");Haiti = new Array("---","Port-au-Prince");Honduras = new Array("---","Tegucigalpa");Hungary = new Array("---","Budapest");Iceland = new Array("---","Reykjavik");India = new Array("---","Bombay","Calcutta","Delhi");Indonesia = new Array("---","Jakarta");Iran = new Array("---","Teheran");Iraq = new Array("---","Baghdad");Ireland = new Array("---","Dublin");Israel = new Array("---","Jerusalem","Tel Aviv");Italy = new Array("---","Milan","Naples","Rome","Venice");Jamaica = new Array("---","Kingston");Japan = new Array("---","Nagasaki","Nagoya","Osaka","Tokyo");Jordan = new Array("---","Amman");Kazakhstan = new Array("---","Almaty");Kenya = new Array("---","Nairobi");Korea_North = new Array("---","Pyongyang");Korea_South = new Array("---","Seoul");Kyrgyzstan = new Array("---","Bishkek");Laos = new Array("---","Vientiane");Latvia = new Array("---","Riga");Lebanon = new Array("---","Beirut");Lesotho = new Array("---","Maseru");Liberia = new Array("---","Monrovia");Libya = new Array("---","Tripoli");Lithuania = new Array("---","Vilnius");
Luxembourg = new Array("---","Luxembourg");Macedonia = new Array("---","Skopje");Madagascar = new Array("---","Tananarive");Malawi = new Array("---","Lilongwe");Malaysia = new Array("---","Kuala Lumpur");Mali = new Array("---","Bamako");
Malta = new Array("---","Valletta");
Marshall_Islands = new Array("---","Majuro");Mauritania = new Array("---","Nouakchott");
Mauritius = new Array("---","Port Louis");Mexico = new Array("---","Chihuahua","Mazatlan","Mexico City","Veracruz");Moldova = new Array("---","Kishinev");
Monaco = new Array("---","Monaco");Mongolia = new Array("---","Ulaanbaatar");Morocco = new Array("---","Casablanca");Mozambique = new Array("---","Maputo");
Myanmar = new Array("---","Naypyidaw","Yangon");Namibia = new Array("---","Windhoek");Nepal = new Array("---","Kathmandu");Netherlands = new Array("---","Amsterdam");
New_Caledonia = new Array("---","Noumea");New_Zealand = new Array("---","Auckland","Christchurch","Wellington");Nicaragua = new Array("---","Managua");Niger = new Array("---","Niamey");Nigeria = new Array("---","Lagos");Northern_Ireland = new Array("---","Belfast");Norway = new Array("---","Hammerfest","Oslo");
Oman = new Array("---","Muscat");Pakistan = new Array("---","Islamabad");Panama = new Array("---","Panama City");Papua_New_Guinea = new Array("---","Port Moresby");Paraguay = new Array("---","Asuncion");Peru = new Array("---","Lima");Philippines = new Array("---","Manila");Poland = new Array("---","Warsaw");Portugal = new Array("---","Lisbon");Puerto_Rico = new Array("---","San Juan");Qatar = new Array("---","Doha");Romania = new Array("---","Bucharest");Russia = new Array("---","Irkutsk","Moscow","St Petersburg","Vladivostok");Rwanda = new Array("---","Kigali");Saudi_Arabia = new Array("---","Mecca");Senegal = new Array("---","Dakar");
Serbia_Montenegro = new Array("---","Belgrade");Sierra_Leone = new Array("---","Freetown");Singapore = new Array("---","Singapore");Slovakia = new Array("---","Bratislava");Slovenia = new Array("---","Ljubljana");Somalia = new Array("---","Mogadishu");South_Africa = new Array("---","Johannesburg","CapeTown","Durban");Spain = new Array("---","Barcelona","Madrid");Sri_Lanka = new Array("---","Colombo");Sudan = new Array("---","Khartoum");Suriname = new Array("---","Paramaribo");Swaziland = new Array("---","Mbabane");Sweden = new Array("---","Stockholm");Switzerland = new Array("---","Zurich");Syria = new Array("---","Damascus");
Tahiti = new Array("---","Papeete");Taiwan = new Array("---","Taipei");Tajikistan = new Array("---","Dushanbe");Tanzania = new Array("---","Dar es Salaam");Tasmania = new Array("---","Hobart");Thailand = new Array("---","Bangkok");Togo = new Array("---","Lome");Trinidad_and_Tobago = new Array("---","Port of Spain");Tunisia = new Array("---","Tunis");Turkey = new Array("---","Ankara");Turkmenistan = new Array("---","Ashgabat");Uganda = new Array("---","Kampala");Ukraine = new Array("---","Odessa");United_Arab_Emirates = new Array("---","Dubai");
United_Kingdom = new Array("---","Aberdeen","Birmingham","Bristol","Cardiff","Edinburgh","Glasgow","Leeds","Liverpool","London","Manchester","Newcastle","Norwich","Plymouth");Uruguay = new Array("---","Montevideo");Uzbekistan = new Array("---","Tashkent");Vatican_City = new Array("---","Vatican City");Venezuela = new Array("---","Caracas");Vietnam = new Array("---","Hanoi");Yemen = new Array("---","Sana");Zambia = new Array("---","Lusaka");Zimbabwe = new Array("---","Harare");

if (latitude != null && longitude != null && t_zone != null)
{
 lat_long_box();
 City = lat_long;
}function changeval(){var val1 = document.satellite.sel1.value;var optionArray = eval(val1);for (var df=0; df<optionArray.length; df++){var ss = document.satellite.sel2;ss.options.length = 0;for (var ff=0; ff<optionArray.length; ff++){var val = optionArray[ff];ss.options[ff] = new Option(val,val);}}}function recordval(){City = document.satellite.sel2.value;/* US cities listing */if (City == 'Albany, NY'){latitude = 42.666667;longitude = 73.75;t_zone = -5;}if (City == 'Albuquerque, NM'){latitude = 35.85;longitude = 106.65;t_zone = -7;}if (City == 'Amarillo, TX'){latitude = 35.183333;longitude = 101.833333;t_zone = -6;}if (City == 'Anchorage, AK'){latitude = 61.216667;longitude = 149.9;t_zone = -9;}if (City == 'Atlanta, GA'){latitude = 33.75;longitude = 84.383333;t_zone = -5;}if (City == 'Austin, TX'){latitude = 30.266667;longitude = 97.733333;t_zone = -6;}if (City == 'Baker, OR'){latitude = 44.783333;longitude = 117.833333;t_zone = -8;}if (City == 'Baltimore, MD'){latitude = 39.3;longitude = 76.633333;t_zone = -5;}if (City == 'Bangor, ME'){latitude = 44.8;longitude = 68.783333;t_zone = -5;}if (City == 'Birmingham, AL'){latitude = 33.5;longitude = 86.833333;t_zone = -6;}if (City == 'Bismarck, ND'){latitude = 46.8;longitude = 100.783333;t_zone = -6;}if (City == 'Boise, ID'){latitude = 43.6;longitude = 116.216667;t_zone = -7;}if (City == 'Boston, MA'){latitude = 42.35;longitude = 71.083333;t_zone = -5;}if (City == 'Buffalo, NY'){latitude = 42.916667;longitude = 78.833333;t_zone = -5;}if (City == 'Carlsbad, NM'){latitude = 32.433333;longitude = 104.25;t_zone = -7;}if (City == 'Charleston, SC'){latitude = 32.783333;longitude = 79.933333;t_zone = -5;}if (City == 'Charleston, WV'){latitude = 38.35;longitude = 81.633333;t_zone = -5;}if (City == 'Charlotte, NC'){latitude = 35.233333;longitude = 80.833333;t_zone = -5;}if (City == 'Cheyenne, WY'){latitude = 41.15;longitude = 104.866667;t_zone = -7;}if (City == 'Chicago, IL'){latitude = 41.833333;longitude = 87.616667;t_zone = -6;}if (City == 'Cincinnati, OH'){latitude = 39.133333;longitude = 84.5;t_zone = -5;}if (City == 'Cleveland, OH'){latitude = 41.466667;longitude = 81.616667;t_zone = -5;}if (City == 'Columbia, SC'){latitude = 34;longitude = 81.033333;t_zone = -5;}if (City == 'Columbus, OH'){latitude = 40;longitude = 83.016667;t_zone = -5;}if (City == 'Dallas, TX'){latitude = 32.766667;longitude = 96.766667;t_zone = -6;}if (City == 'Denver, CO'){latitude = 39.75;longitude = 105;t_zone = -7;}if (City == 'Des Moines, IA'){latitude = 41.583333;longitude = 93.616667;t_zone = -6;}if (City == 'Detroit, MI'){latitude = 42.333333;longitude = 83.05;t_zone = -5;}if (City == 'Dubuque, IA'){latitude = 42.516667;longitude = 90.666667;t_zone = -6;}if (City == 'Duluth, MN'){latitude = 46.816667;longitude = 92.083333;t_zone = -6;}if (City == 'Eastport, ME'){latitude = 44.9;longitude = 67;t_zone = -5;}if (City == 'El Centro, CA'){latitude = 32.633333;longitude = 115.55;t_zone = -8;}if (City == 'El Paso, TX'){latitude = 31.766667;longitude = 106.483333;t_zone = -7;}if (City == 'Eugene, OR'){latitude = 44.05;longitude = 123.083333;t_zone = -8;}if (City == 'Fargo, ND'){latitude = 46.866667;longitude = 96.8;t_zone = -6;}if (City == 'Flagstaff, AZ'){latitude = 35.216667;longitude = 111.683333;t_zone = -7;}if (City == 'Fort Worth, TX'){latitude = 32.716667;longitude = 97.316667;t_zone = -6;}if (City == 'Fresno, CA'){latitude = 36.733333;longitude = 119.8;t_zone = -8;}if (City == 'Grand Junction, CO'){latitude = 39.083333;longitude = 108.55;t_zone = -7;}if (City == 'Grand Rapids, MI'){latitude = 42.966667;longitude = 85.666667;t_zone = -5;}if (City == 'Havre, MT'){latitude = 48.55;longitude = 109.716667;t_zone = -7;}if (City == 'Helena, MT'){latitude = 46.583333;longitude = 112.033333;t_zone = -7;}if (City == 'Honolulu, HI'){latitude = 21.3;longitude = 157.833333;t_zone = -10;}if (City == 'Hot Springs, AR'){latitude = 34.516667;longitude = 93.05;t_zone = -6;}if (City == 'Houston, TX'){latitude = 29.75;longitude = 95.35;t_zone = -6;}if (City == 'Idaho Falls, ID'){latitude = 43.5;longitude = 112.016667;t_zone = -7;}if (City == 'Indianapolis, IN'){latitude = 39.766667;longitude = 86.166667;t_zone = -5;}if (City == 'Jackson, MS'){latitude = 32.333333;longitude = 90.2;t_zone = -6;}if (City == 'Jacksonville, FL'){latitude = 30.366667;longitude = 81.666667;t_zone = -5;}if (City == 'Juneau, AK'){latitude = 58.3;longitude = 134.4;t_zone = -9;}if (City == 'Kansas City, MO'){latitude = 39.1;longitude = 94.583333;t_zone = -6;}if (City == 'Key West, FL'){latitude = 24.55;longitude = 81.8;t_zone = -5;}if (City == 'Klamath Falls, OR'){latitude = 42.166667;longitude = 121.733333;t_zone = -8;}if (City == 'Knoxville, TN'){latitude = 35.95;longitude = 83.933333;t_zone = -5;}if (City == 'Las Vegas, NV'){latitude = 36.166667;longitude = 115.2;t_zone = -8;}if (City == 'Lewiston, ID'){latitude = 46.4;longitude = 117.033333;t_zone = -8;}if (City == 'Lincoln, NE'){latitude = 40.833333;longitude = 96.666667;t_zone = -6;}if (City == 'Long Beach, CA'){latitude = 33.766667;longitude = 118.183333;t_zone = -8;}if (City == 'Los Angeles, CA'){latitude = 34.05;longitude = 118.25;t_zone = -8;}if (City == 'Louisville, KY'){latitude = 38.25;longitude = 85.766667;t_zone = -5;}if (City == 'Manchester, NH'){latitude = 43;longitude = 71.5;t_zone = -5;}if (City == 'Memphis, TN'){latitude = 35.15;longitude = 90.05;t_zone = -6;}if (City == 'Miami, FL'){latitude = 25.766667;longitude = 80.2;t_zone = -5;}if (City == 'Milwaukee, WI'){latitude = 43.033333;longitude = 87.916667;t_zone = -6;}if (City == 'Minneapolis, MN'){latitude = 44.983333;longitude = 93.233333;t_zone = -6;}if (City == 'Mobile, AL'){latitude = 30.7;longitude = 88.05;t_zone = -6;}if (City == 'Montgomery, AL'){latitude = 32.35;longitude = 86.3;t_zone = -6;}if (City == 'Montpelier, VT'){latitude = 44.25;longitude = 72.533333;t_zone = -5;}if (City == 'Nashville, TN'){latitude = 36.166667;longitude = 86.783333;t_zone = -6;}if (City == 'Newark, NJ'){latitude = 40.733333;longitude = 74.166667;t_zone = -5;}if (City == 'New Haven, CT'){latitude = 41.316667;longitude = 72.916667;t_zone = -5;}if (City == 'New Orleans, LA'){latitude = 29.95;longitude = 90.066667;t_zone = -6;}if (City == 'New York, NY'){latitude = 40.783333;longitude = 73.966667;t_zone = -5;}if (City == 'Nome, AK'){latitude = 64.416667;longitude = 165.5;t_zone = -9;}if (City == 'Oakland, CA'){latitude = 37.8;longitude = 122.266667;t_zone = -8;}if (City == 'Oklahoma City, OK'){latitude = 35.433333;longitude = 97.466667;t_zone = -6;}if (City == 'Omaha, NE'){latitude = 41.25;longitude = 95.933333;t_zone = -6;}if (City == 'Philadelphia, PA'){latitude = 39.95;longitude = 75.166667;t_zone = -5;}if (City == 'Phoenix, AZ'){latitude = 33.483333;longitude = 112.066667;t_zone = -7;}if (City == 'Pierre, SD'){latitude = 44.366667;longitude = 100.35;t_zone = -6;}if (City == 'Pittsburgh, PA'){latitude = 40.45;longitude = 79.95;t_zone = -5;}if (City == 'Portland, ME'){latitude = 43.666667;longitude = 70.25;t_zone = -5;}if (City == 'Portland, OR'){latitude = 45.516667;longitude = 122.683333;t_zone = -8;}if (City == 'Providence, RI'){latitude = 41.833333;longitude = 71.4;t_zone = -5;}if (City == 'Raleigh, NC'){latitude = 35.766667;longitude = 78.65;t_zone = -5;}if (City == 'Reno, NV'){latitude = 39.5;longitude = 119.816667;t_zone = -8;}if (City == 'Richfield, UT'){latitude = 38.766667;longitude = 112.083333;t_zone = -7;}if (City == 'Richmond, VA'){latitude = 37.55;longitude = 77.483333;t_zone = -5;}if (City == 'Roanoke, VA'){latitude = 37.283333;longitude = 79.95;t_zone = -5;}if (City == 'Sacramento, CA'){latitude = 38.583333;longitude = 121.5;t_zone = -8;}if (City == 'St Louis, MO'){latitude = 38.583333;longitude = 90.2;t_zone = -6;}if (City == 'Salt Lake City, UT'){latitude = 40.766667;longitude = 111.9;t_zone = -7;}if (City == 'San Antonio, TX'){latitude = 29.383333;longitude = 98.55;t_zone = -6;}if (City == 'San Diego, CA'){latitude = 32.7;longitude = 117.166667;t_zone = -8;}if (City == 'San Francisco, CA'){latitude = 37.783333;longitude = 122.433333;t_zone = -8;}if (City == 'San Jose, CA'){latitude = 37.333333;longitude = 121.883333;t_zone = -8;}if (City == 'Santa Fe, NM'){latitude = 35.683333;longitude = 105.95;t_zone = -7;}if (City == 'Savannah, GA'){latitude = 32.083333;longitude = 81.083333;t_zone = -5;}if (City == 'Seattle, WA'){latitude = 47.616667;longitude = 122.333333;t_zone = -8;}if (City == 'Shreveport, LA'){latitude = 32.466667;longitude = 93.7;t_zone = -6;}if (City == 'Sioux Falls, SD'){latitude = 43.55;longitude = 96.733333;t_zone = -6;}if (City == 'Sitka, AK'){latitude = 57.166667;longitude = 135.25;t_zone = -9;}if (City == 'Spokane, WA'){latitude = 47.666667;longitude = 117.433333;t_zone = -8;}if (City == 'Springfield, IL'){latitude = 39.8;longitude = 89.633333;t_zone = -6;}if (City == 'Springfield, MA'){latitude = 42.1;longitude = 72.566667;t_zone = -5;}if (City == 'Springfield, MO'){latitude = 37.216667;longitude = 93.283333;t_zone = -6;}if (City == 'Syracuse, NY'){latitude = 43.033333;longitude = 76.133333;t_zone = -5;}if (City == 'Tampa, FL'){latitude = 27.95;longitude = 82.45;t_zone = -5;}if (City == 'Toledo, OH'){latitude = 41.65;longitude = 83.55;t_zone = -5;}if (City == 'Tulsa, OK'){latitude = 36.15;longitude = 95.983333;t_zone = -6;}if (City == 'Virginia Beach, VA'){latitude = 36.85;longitude = 75.966667;t_zone = -5;}if (City == 'Washington, D.C.'){latitude = 38.883333;longitude = 77.033333;t_zone = -5;}if (City == 'Wichita, KS'){latitude = 37.716667;longitude = 97.283333;t_zone = -6;}if (City == 'Wilmington, NC'){latitude = 34.233333;longitude = 77.95;t_zone = -5;}/* Canadian cities listing */if (City == 'Calgary, AB'){latitude = 51+6/60;longitude = 114+1/60;t_zone = -7;}if (City == 'Charlottetown, PE'){latitude = 46 + 14 / 60;longitude = 63 + 9 / 60;t_zone = -4;}if (City == 'Chicoutimi, QC'){latitude = 48+25/60;longitude = 71+5/60;t_zone = -5;}if (City == 'Edmonton, AB'){latitude = 53+34/60;longitude = 113+31/60;t_zone = -7;}if (City == 'Guelph, ON'){latitude = 43+33/60;longitude = 80+15/60;t_zone = -5;}if (City == 'Halifax, NS'){latitude = 44+39/60;longitude = 63+34/60;t_zone = -4;}if (City == 'Hamilton, ON'){latitude = 43+16/60;longitude = 79+54/60;t_zone = -5;}if (City == 'Hull, QC'){latitude = 45+26/60;longitude = 75+44/60;t_zone = -5;}if (City == 'Iqaluit, NU'){latitude = 63+45/60;longitude = 68+31/60;t_zone = -6;}if (City == 'Kelowna, BC'){latitude = 49+53/60;longitude = 119+30/60;t_zone = -8;}if (City == 'Kingston, ON'){latitude = 44+16/60;longitude = 76+30/60;t_zone = -5;}if (City == 'Kitchener, ON'){latitude = 43+26/60;longitude = 80+30/60;t_zone = -5;}if (City == 'London, ON'){latitude = 43+2/60;longitude = 81+9/60;t_zone = -5;}if (City == 'Montreal, QC'){latitude = 45+28/60;longitude = 73+45/60;t_zone = -5;}if (City == 'Oshawa, ON'){latitude = 43+54/60;longitude = 78+52/60;t_zone = -5;}if (City == 'Ottawa, ON'){latitude = 45+19/60;longitude = 75+40/60;t_zone = -5;}if (City == 'Quebec City, QC'){latitude = 46+48/60;longitude = 71+23/60;t_zone = -5;}if (City == 'Regina, SK'){latitude = 50+26/60;longitude = 104+40/60;t_zone = -7;}if (City == 'Saint John, NB'){latitude = 46+06/60;longitude = 64+46/60;t_zone = -4;}if (City == 'Saskatoon, SK'){latitude = 52+10/60;longitude = 106+41/60;t_zone = -7;}if (City == 'Sherbrooke, QC'){latitude = 45+24/60;longitude = 71+54/60;t_zone = -5;}if (City == 'St Catharines, ON'){latitude = 43+11/60;longitude = 79+14/60;t_zone = -5;}if (City == 'St Johns, NL'){latitude = 47+37/60;longitude = 52+45/60;t_zone = -3.5;}if (City == 'Sudbury, ON'){latitude = 46+37/60;longitude = 80+48/60;t_zone = -5;}if (City == 'Thunder Bay, ON'){latitude = 48+22/60;longitude = 89+19/60;t_zone = -5;}if (City == 'Toronto, ON'){latitude = 43+41/60;longitude = 79+38/60;t_zone = -5;}if (City == 'Trois-Rivieres, QC'){latitude = 46+21/60;longitude = 72+35/60;t_zone = -5;}if (City == 'Vancouver, BC'){latitude = 49+11/60;longitude = 123+10/60;t_zone = -8;}if (City == 'Victoria, BC'){latitude = 48+25/60;longitude = 123+19/60;t_zone = -8;}if (City == 'Whitehorse, YT'){latitude = 60+43/60;longitude = 135+03/60;t_zone = -8;}if (City == 'Windsor, ON'){latitude = 42+16/60;longitude = 82+58/60;t_zone = -4;}if (City == 'Winnipeg, MB'){latitude = 49+54/60;longitude = 97+14/60;t_zone = -6;}if (City == 'Yellowknife, NT'){latitude = 62+27/60;longitude = 114+24/60;t_zone = -7;}if (City == 'Kabul'){latitude = 34 + 35/60;longitude = -(69 + 12/60);t_zone = 4.5;}if (City == 'Luanda'){latitude = -(8 + 50/60);longitude = -(13 + 20/60);t_zone = 0;}if (City == 'Algiers'){latitude = 36.833333;longitude = -3;t_zone = 1;}if (City == 'Buenos Aires'){latitude = -34.583333;longitude = 58.366667;t_zone = -3;}if (City == 'Cordoba'){latitude = -31.466667;longitude = 64.166667;t_zone = -3;}if (City == 'Yerevan'){latitude = 40 + 16/60;longitude = -(44 + 34/60);t_zone = 4;}if (City == 'Adelaide'){latitude = -34.916667;longitude = -138.6;t_zone = 9.5;}if (City == 'Brisbane'){latitude = -27.483333;longitude = -153.133333;t_zone = 10;}if (City == 'Darwin'){latitude = -12.466667;longitude = -130.85;t_zone = 9.5;}if (City == 'Melbourne'){latitude = -37.783333;longitude = -144.966667;t_zone = 10;}if (City == 'Perth'){latitude = -31.95;longitude = -115.866667;t_zone = 8;}if (City == 'Sydney'){latitude = -34;longitude = -151;t_zone = 10;}if (City == 'Vienna'){latitude = 48.233333;longitude = -16.333333;t_zone = 1;}if (City == 'Baku'){latitude = 40 + 22/60;longitude = -(49 + 53/60);t_zone = 4;}if (City == 'Chittagong'){latitude = 22 + 21/60;longitude = -(91 + 50/60);t_zone = 6;}if (City == 'Minsk'){latitude = 53 + 54/60;longitude = -(27 + 33/60);t_zone = 2;}if (City == 'Brussels'){latitude = 50.866667;longitude = -4.366667;t_zone = 1;}if (City == 'La Paz'){latitude = -16.45;longitude = 68.366667;t_zone = -4;}if (City == 'Belem'){latitude = -1.466667;longitude = 48.483333;t_zone = -3;}if (City == 'Rio de Janeiro'){latitude = -22.95;longitude = 43.2;t_zone = -3;}if (City == 'Salvador'){latitude = -12.933333;longitude = 38.45;t_zone = -3;}if (City == 'Sao Paulo'){latitude = -23.516667;longitude = 46.516667;t_zone = -3;}if (City == 'Sofia'){latitude = 42.666667;longitude = -23.333333;t_zone = 2;}
if (City == 'Naypyidaw'){latitude = 19 + 45/60;longitude = -(96 + 12/60);t_zone = 6.5;}if (City == 'Yangon'){latitude = 16 + 47/60;longitude = -(96 + 9/60);t_zone = 6.5;}if (City == 'Phnom Penh'){latitude = 11 + 33/60;longitude = -(104 + 51/60);t_zone = 7;}if (City == 'Iquique'){latitude = -20.166667;longitude = 70.116667;t_zone = -4;}if (City == 'Santiago'){latitude = -33.466667;longitude = 70.75;t_zone = -4;}if (City == 'Beijing'){latitude = 39.916667;longitude = -116.416667;t_zone = 8;}if (City == 'Canton'){latitude = 23.116667;longitude = -113.25;t_zone = 8;}if (City == 'Chongqing'){latitude = 29.766667;longitude = -106.566667;t_zone = 8;}if (City == 'Hong Kong'){latitude = 22 + 17/60;longitude = -(114 + 8/60);t_zone = 8;}if (City == 'Nanjing'){latitude = 32.05;longitude = -118.883333;t_zone = 8;}if (City == 'Shanghai'){latitude = 31.166667;longitude = -121.466667;t_zone = 8;}if (City == 'Bogota'){latitude = 4.533333;longitude = 74.25;t_zone = -5;}if (City == 'Kinshasa'){latitude = -4.3;longitude = -15.283333;t_zone = 1;}if (City == 'Havana'){latitude = 23.133333;longitude = 82.383333;t_zone = -5;}if (City == 'Prague'){latitude = 50.083333;longitude = -14.433333;t_zone = 1;}if (City == 'Copenhagen'){latitude = 55.666667;longitude = -12.566667;t_zone = 1;}if (City == 'Djibouti'){latitude = 11.5;longitude = -43.05;t_zone = 3;}if (City == 'Guayaquil'){latitude = -2.166667;longitude = 79.933333;t_zone = -5;}if (City == 'Cairo'){latitude = 30.033333;longitude = -31.35;t_zone = 2;}if (City == 'Birmingham'){latitude = 52.416667;longitude = 1.916667;t_zone = 0;}if (City == 'Bristol'){latitude = 51.466667;longitude = 2.583333;t_zone = 0;}if (City == 'Leeds'){latitude = 53.75;longitude = 1.5;t_zone = 0;}if (City == 'Liverpool'){latitude = 53.416667;longitude = 3;t_zone = 0;}if (City == 'London'){latitude = 51.533333;longitude = 0.083333;t_zone = 0;}if (City == 'Manchester'){latitude = 53.5;longitude = 2.25;t_zone = 0;}if (City == 'Newcastle'){latitude = 54.966667;longitude = 1.616667;t_zone = 0;}if (City == 'Norwich'){latitude = 52.6309;longitude = -1.2973;t_zone = 0;}if (City == 'Plymouth'){latitude = 50.416667;longitude = 4.083333;t_zone = 0;}if (City == 'Helsinki'){latitude = 60.166667;longitude = -25;t_zone = 2;}if (City == 'Bordeaux'){latitude = 44.833333;longitude = 0.516667;t_zone = 1;}if (City == 'Lyons'){latitude = 45.75;longitude = -4.833333;t_zone = 1;}if (City == 'Marseilles'){latitude = 43.333333;longitude = -5.333333;t_zone = 1;}if (City == 'Paris'){latitude = 48.8;longitude = -2.333333;t_zone = 1;}if (City == 'Cayenne'){latitude = 4.816667;longitude = 52.3;t_zone = -4;}if (City == 'Berlin'){latitude = 52.5;longitude = -13.416667;t_zone = 1;}if (City == 'Bremen'){latitude = 53.083333;longitude = -8.816667;t_zone = 1;}if (City == 'Frankfurt'){latitude = 50.116667;longitude = -8.683333;t_zone = 1;}if (City == 'Hamburg'){latitude = 53.55;longitude = -10.033333;t_zone = 1;}if (City == 'Munich'){latitude = 48.133333;longitude = -11.583333;t_zone = 1;}if (City == 'Athens'){latitude = 37.966667;longitude = -23.716667;t_zone = 2;}if (City == 'Guatemala City'){latitude = 14.616667;longitude = 90.516667;t_zone = -6;}if (City == 'Georgetown'){latitude = 6.75;longitude = 58.25;t_zone = -3.75;}if (City == 'Budapest'){latitude = 47.5;longitude = -19.083333;t_zone = 1;}if (City == 'Reykjavik'){latitude = 64.066667;longitude = 21.966667;t_zone = -1;}if (City == 'Bombay'){latitude = 19;longitude = -72.8;t_zone = 5.5;}if (City == 'Calcutta'){latitude = 22.566667;longitude = -88.4;t_zone = 5.5;}if (City == 'Delhi'){latitude = 28.667;longitude = -77.233;t_zone = 5.5;}if (City == 'Jakarta'){latitude = -6.266667;longitude = -106.8;t_zone = 7.5;}if (City == 'Teheran'){latitude = 35.75;longitude = -51.75;t_zone = 3.5;}if (City == 'Baghdad'){latitude = 33 + 20/60;longitude = -(44 + 26/60);t_zone = 3;}if (City == 'Dublin'){latitude = 53.333333;longitude = 6.25;t_zone = 0;}if (City == 'Jerusalem'){latitude = 31 + 47/60;longitude = -(35 + 13/60);t_zone = 2;}if (City == 'Tel Aviv'){latitude = 32 + 5/60;longitude = -(34 + 46/60);t_zone = 2;}if (City == 'Milan'){latitude = 45.45;longitude = -9.166667;t_zone = 1;}if (City == 'Naples'){latitude = 40.833333;longitude = -14.25;t_zone = 1;}if (City == 'Rome'){latitude = 41.9;longitude = -12.45;t_zone = 1;}if (City == 'Venice'){latitude = 45.433333;longitude = -12.333333;t_zone = 1;}if (City == 'Kingston'){latitude = 17.983333;longitude = 76.816667;t_zone = -5;}if (City == 'Nagasaki'){latitude = 32.8;longitude = -129.95;t_zone = 9;}if (City == 'Nagoya'){latitude = 35.116667;longitude = -136.933333;t_zone = 9;}if (City == 'Osaka'){latitude = 34.533333;longitude = -135.5;t_zone = 9;}if (City == 'Tokyo'){latitude = 35.666667;longitude = -139.75;t_zone = 9;}if (City == 'Nairobi'){latitude = -1.416667;longitude = -36.916667;t_zone = 3;}if (City == 'Beirut'){latitude = 33 + 54/60;longitude = -(35 + 32/60);t_zone = 2;}if (City == 'Tripoli'){latitude = 32.95;longitude = -13.2;t_zone = 2;}if (City == 'Tananarive'){latitude = -18.833333;longitude = -47.55;t_zone = 3;}if (City == 'Chihuahua'){latitude = 28.616667;longitude = 106.083333;t_zone = -6;}if (City == 'Mazatlan'){latitude = 23.2;longitude = 106.416667;t_zone = -7;}if (City == 'Mexico City'){latitude = 19.433333;longitude = 99.116667;t_zone = -6;}if (City == 'Veracruz'){latitude = 19.166667;longitude = 96.166667;t_zone = -6;}if (City == 'Amsterdam'){latitude = 52.366667;longitude = -4.883333;t_zone = 1;}if (City == 'Auckland'){latitude = -36.883333;longitude = -174.75;t_zone = 12;}if (City == 'Christchurch'){latitude = -(43 + 31.8/60);longitude = -(172 + 37.2/60);t_zone = 12;}if (City == 'Wellington'){latitude = -41.283333;longitude = -174.783333;t_zone = 12;}if (City == 'Belfast'){latitude = 54.616667;longitude = 5.933333;t_zone = 0;}if (City == 'Hammerfest'){latitude = 70.633333;longitude = -23.633333;t_zone = 1;}if (City == 'Oslo'){latitude = 59.95;longitude = -10.7;t_zone = 1;}if (City == 'Islamabad'){latitude = 33 + 40/60;longitude = -(73 + 10/60);t_zone = 5;}if (City == 'Panama City'){latitude = 8.966667;longitude = 79.533333;t_zone = -5;}if (City == 'Port Moresby'){latitude = -9.416667;longitude = -147.133333;t_zone = 10;}if (City == 'Asuncion'){latitude = -25.25;longitude = 57.666667;t_zone = -4;}if (City == 'Lima'){latitude = -12;longitude = 77.033333;t_zone = -5;}if (City == 'Manila'){latitude = 14.583333;longitude = -120.95;t_zone = 8;}if (City == 'Warsaw'){latitude = 52.233333;longitude = -21;t_zone = 1;}if (City == 'Lisbon'){latitude = 38.733333;longitude = 9.15;t_zone = 0;}if (City == 'Bucharest'){latitude = 44.416667;longitude = -26.116667;t_zone = 2;}if (City == 'Irkutsk'){latitude = 52.5;longitude = -104.333333;t_zone = 8;}if (City == 'Moscow'){latitude = 55.75;longitude = -37.6;t_zone = 3;}if (City == 'St Petersburg'){latitude = 59.933333;longitude = -30.3;t_zone = 3;}if (City == 'Vladivostok'){latitude = 43.166667;longitude = -132;t_zone = 10;}if (City == 'Mecca'){latitude = 21.483333;longitude = -39.75;t_zone = 3;}if (City == 'Aberdeen'){latitude = 57.15;longitude = 2.15;t_zone = 0;}if (City == 'Edinburgh'){latitude = 55.916667;longitude = 3.166667;t_zone = 0;}if (City == 'Glasgow'){latitude = 55.833333;longitude = 4.25;t_zone = 0;}if (City == 'Dakar'){latitude = 14.666667;longitude = 17.466667;t_zone = 0;}if (City == 'Singapore'){latitude = 1.233333;longitude = -103.916667;t_zone = 8.0;}if (City == 'Johannesburg'){latitude = -26.2;longitude = -28.066667;t_zone = 2;}if (City == 'CapeTown'){latitude = -33.916667;longitude = -18.366667;t_zone = 2;}if (City == 'Durban'){latitude = -29.883333;longitude = -30.883333;t_zone = 2;}if (City == 'Barcelona'){latitude = 41.383333;longitude = -2.15;t_zone = 1;}if (City == 'Madrid'){latitude = 40.433333;longitude = 3.7;t_zone = 1;}if (City == 'Paramaribo'){latitude = 5.75;longitude = 55.25;t_zone = -3.5;}if (City == 'Stockholm'){latitude = 59.283333;longitude = -18.05;t_zone = 1;}if (City == 'Zurich'){latitude = 47.35;longitude = -8.516667;t_zone = 1;}if (City == 'Hobart'){latitude = -42.866667;longitude = -147.166667;t_zone = 10;}if (City == 'Bangkok'){latitude = 13.75;longitude = -100.5;t_zone = 7;}if (City == 'Ankara'){latitude = 39.916667;longitude = -32.916667;t_zone = 2;}if (City == 'Odessa'){latitude = 46.45;longitude = -30.8;t_zone = 3;}if (City == 'Montevideo'){latitude = -34.883333;longitude = 56.166667;t_zone = -3;}if (City == 'Caracas'){latitude = 10.466667;longitude = 67.033333;t_zone = -4;}if (City == 'Hanoi'){latitude = 21 + 2/60;longitude = -(105 + 51/60);t_zone = 7;}if (City == 'Cardiff'){latitude = 51 + 29/60;longitude = 3 + 11/60;t_zone = 0;}if (City == 'Belgrade'){latitude = 44.866667;longitude = -20.533333;t_zone = 1;}if (City == 'Tirana'){latitude = 41.33;longitude = -19.82;t_zone = 1;}if (City == 'Nassau'){latitude = 25.06;longitude = 77.33;t_zone = -5;}if (City == 'Belmopan'){latitude = 17 + 25/60;longitude = 88 + 46/60;t_zone = -6;}if (City == 'Porto Novo'){latitude = 6.5;longitude = -(2 + 47/60);t_zone = 1;}if (City == 'Thimphu'){latitude = 27.48;longitude = -89.70;t_zone = 6;}if (City == 'Sarajevo'){latitude = 43.85;longitude = -18.38;t_zone = 1;}if (City == 'Gaborone'){latitude = -24.65;longitude = -25.91;t_zone = 2;}if (City == 'Bandar Seri Begawan'){latitude = 4.93;longitude = -114.95;t_zone = 8;}if (City == 'Ouagadougou'){latitude = 12.37;longitude = 1.53;t_zone = 0;}if (City == 'Bujumbura'){latitude = -3.37;longitude = -29.35;t_zone = 2;}if (City == 'Yaounde'){latitude = 3 + 51/60;longitude = -(11 + 31/60);t_zone = 1;}if (City == 'Praia'){latitude = 14.93;longitude = 23.54;t_zone = -1;}if (City == 'Bangui'){latitude = 4.36;longitude = -18.56;t_zone = 1;}if (City == 'Ndjamena'){latitude = 12.11;longitude = -15.05;t_zone = 1;}if (City == 'Brazzaville'){latitude = -4.25;longitude = -15.26;t_zone = 1;}if (City == 'San Jose'){latitude = 9.93;longitude = 84.08;t_zone = -6;}if (City == 'Abidjan'){latitude = 5.33;longitude = 4.03;t_zone = 0;}if (City == 'Zagreb'){latitude = 45.80;longitude = -15.97;t_zone = 1;}if (City == 'Nicosia'){latitude = 35.16;longitude = -33.38;t_zone = 2;}if (City == 'Santo Domingo'){latitude = 18.48;longitude = 69.91;t_zone = -4;}if (City == 'Dili'){latitude = -8.57;longitude = -125.58;t_zone = 9;}if (City == 'San Salvador'){latitude = 13.69;longitude = 89.19;t_zone = -6;}if (City == 'Asmera'){latitude = 15.33;longitude = -38.94;t_zone = 3;}if (City == 'Tallinn'){latitude = 59.44;longitude = -24.74;t_zone = 2;}if (City == 'Addis Ababa'){latitude = 9.03;longitude = -38.74;t_zone = 3;}if (City == 'Port Stanley'){latitude = -51.70;longitude = 57.82;t_zone = -4;}if (City == 'Suva'){latitude = -18.13;longitude = -178.43;t_zone = 12;}if (City == 'Papeete'){latitude = -(17 + 32/60);longitude = 149 + 34/60;t_zone = -10;}if (City == 'Libreville'){latitude = 0.39;longitude = -9.45;t_zone = 1;}if (City == 'Banjul'){latitude = 13.45;longitude = 16.68;t_zone = 0;}if (City == 'Tbilisi'){latitude = 41.72;longitude = -44.79;t_zone = 4;}if (City == 'Accra'){latitude = 5.56;longitude = 0.20;t_zone = 0;}if (City == 'Nuuk'){latitude = 64 + 10/60;longitude = 51 + 40/60;t_zone = -3;}if (City == 'Conakry'){latitude = 9.55;longitude = 13.67;t_zone = 0;}if (City == 'Bissau'){latitude = 11.87;longitude = 15.60;t_zone = 0;}if (City == 'Port-au-Prince'){latitude = 18.54;longitude = 72.34;t_zone = -5;}if (City == 'Tegucigalpa'){latitude = 14.09;longitude = 87.22;t_zone = -6;}if (City == 'Amman'){latitude = 31.95;longitude = -35.93;t_zone = 2;}if (City == 'Almaty'){latitude = 43.32;longitude = -76.92;t_zone = 6;}if (City == 'Pyongyang'){latitude = 39.02;longitude = -125.75;t_zone = 9;}if (City == 'Seoul'){latitude = 37.56;longitude = -126.99;t_zone = 9;}if (City == 'Bishkek'){latitude = 42.87;longitude = -74.57;t_zone = 6;}if (City == 'Vientiane'){latitude = 17.97;longitude = -102.61;t_zone = 7;}if (City == 'Riga'){latitude = 56.97;longitude = -24.13;t_zone = 2;}if (City == 'Maseru'){latitude = -29.31;longitude = -27.49;t_zone = 2;}if (City == 'Monrovia'){latitude = 6.31;longitude = 10.80;t_zone = 0;}if (City == 'Vilnius'){latitude = 54.70;longitude = -25.27;t_zone = 2;}if (City == 'Skopje'){latitude = 42.00;longitude = -21.47;t_zone = 1;}if (City == 'Lilongwe'){latitude = -13.97;longitude = -33.80;t_zone = 2;}if (City == 'Kuala Lumpur'){latitude = 3.16;longitude = -101.71;t_zone = 8;}if (City == 'Bamako'){latitude = 12.65;longitude = 7.99;t_zone = 0;}if (City == 'Nouakchott'){latitude = 18.09;longitude = 15.98;t_zone = 0;}if (City == 'Kishinev'){latitude = 47.03;longitude = -28.83;t_zone = 2;}if (City == 'Ulaanbaatar'){latitude = 47.93;longitude = -106.91;t_zone = 8;}if (City == 'Casablanca'){latitude = 33.60;longitude = 7.62;t_zone = 0;}if (City == 'Maputo'){latitude = -25.95;longitude = -32.57;t_zone = 2;}if (City == 'Windhoek'){latitude = -22.56;longitude = -17.09;t_zone = 1;}if (City == 'Kathmandu'){latitude = 27.71;longitude = -85.31;t_zone = 5.75;}if (City == 'Managua'){latitude = 12.15;longitude = 86.27;t_zone = -6;}if (City == 'Niamey'){latitude = 13.52;longitude = -2.12;t_zone = 1;}if (City == 'Lagos'){latitude = 6.45;longitude = -3.47;t_zone = 1;}if (City == 'San Juan'){latitude = 18.44;longitude = 66.13;t_zone = -4;}if (City == 'Doha'){latitude = 25.30;longitude = -51.51;t_zone = 3;}if (City == 'Kigali'){latitude = -1.94;longitude = -30.06;t_zone = 2;}if (City == 'Freetown'){latitude = 8.49;longitude = 13.24;t_zone = 0;}if (City == 'Bratislava'){latitude = 48.16;longitude = -17.13;t_zone = 1;}if (City == 'Ljubljana'){latitude = 46.06;longitude = -14.51;t_zone = 1;}if (City == 'Mogadishu'){latitude = 2.05;longitude = -45.33;t_zone = 3;}if (City == 'Colombo'){latitude = 6.93;longitude = -79.85;t_zone = 5.5;}if (City == 'Khartoum'){latitude = 15.58;longitude = -32.52;t_zone = 3;}if (City == 'Mbabane'){latitude = -(26 + 19/60);longitude = -(31 + 7/60);t_zone = 2;}if (City == 'Damascus'){latitude = 33.4;longitude = -36.5;t_zone = 2;}if (City == 'Taipei'){latitude = 25.02;longitude = -121.45;t_zone = 8;}if (City == 'Dushanbe'){latitude = 38.57;longitude = -68.78;t_zone = 5;}if (City == 'Dar es Salaam'){latitude = -6.82;longitude = -39.28;t_zone = 3;}if (City == 'Lome'){latitude = 6.17;longitude = -1.35;t_zone = 0;}if (City == 'Port of Spain'){latitude = 10 + 38/60;longitude = 61 + 31/60;t_zone = -4;}if (City == 'Tunis'){latitude = 36.84;longitude = -10.22;t_zone = 1;}if (City == 'Ashgabat'){latitude = 37.95;longitude = -58.38;t_zone = 5;}if (City == 'Kampala'){latitude = 0.32;longitude = -32.58;t_zone = 3;}if (City == 'Dubai'){latitude = 25.27;longitude = -55.33;t_zone = 4;}if (City == 'Tashkent'){latitude = 41.31;longitude = -69.30;t_zone = 5;}if (City == 'Vatican City'){latitude = 41.90;longitude = -12.46;t_zone = 1;}if (City == 'Sana'){latitude = 15.38;longitude = -44.21;t_zone = 3;}if (City == 'Lusaka'){latitude = -15.42;longitude = -28.29;t_zone = 2;}if (City == 'Harare'){latitude = -17.82;longitude = -31.05;t_zone = 2;}

if (City == 'St Johns')
{
latitude = 17 + 6/60;
longitude = 61 + 45/60;
t_zone = -4;
}

if (City == 'Manama')
{
latitude = 26 + 13/60;
longitude = -(50 + 35/60);
t_zone = 3;
}

if (City == 'Bridgetown')
{
latitude = 13 + 10/60;
longitude = 59 + 32/60;
t_zone = -4;
}

if (City == 'Hamilton')
{
latitude = 32 + 18/60;
longitude = 64 + 47/60;
t_zone = -4;
}

if (City == 'Moroni')
{
latitude = -(11 + 41/60);
longitude = -(43 + 16/60);
t_zone = 3;
}

if (City == 'Luxembourg')
{
latitude = 49 + 36/60;
longitude = -(6 + 7/60);
t_zone = 1;
}

if (City == 'Valletta')
{
latitude = 35 + 53/60;
longitude = -(14 + 30/60);
t_zone = 1;
}

if (City == 'Majuro')
{
latitude = 7 + 7/60;
longitude = -(171 + 4/60);
t_zone = 12;
}

if (City == 'Port Louis')
{
latitude = -(20 + 10/60);
longitude = -(57 + 31/60);
t_zone = 4;
}

if (City == 'Monaco')
{
latitude = 43 + 44/60;
longitude = -(7 + 24/60);
t_zone = 1;
}

if (City == 'Noumea')
{
latitude = -(22 + 16/60);
longitude = -(166 + 27/60);
t_zone = 11;
}

if (City == 'Muscat')
{
latitude = 23 + 36/60;
longitude = -(58 + 33/60);
t_zone = 4
}

lat_long_box();
}

function lat_long_box()
{
 with (Math) {
 
 lat_long = "";
 x = floor(abs(latitude)); y = floor((abs(latitude) - x) * 60 + 0.5); if (x < 10) lat_long += "0"; lat_long = lat_long + x + "\u00B0" + " "; if (y < 10) lat_long += "0"; lat_long = lat_long + y + "\'"; if (latitude >= 0) { lat_long += " N  "; } else { lat_long += " S  "; } x = floor(abs(longitude)); y = floor((abs(longitude) - x) * 60 + 0.5); if (x < 100) lat_long += "0"; if (x < 10) lat_long += "0"; lat_long = lat_long + x + "\u00B0" + " "; if (y < 10) lat_long += "0"; lat_long = lat_long + y + "\'"; if (longitude >= 0) { lat_long += " W"; } else { lat_long += " E"; }

}
}

function setup()
{
 satellite_position();
 setInterval("satellite_position()",7000);
}

function satellite_position()
{
with (Math) {

var iss_x, iss_y, iss_layer;
var hst_x, hst_y, hst_layer;
var sts_x, sts_y, sts_layer;var new_sat_x, new_sat_y, new_sat_layer;
var sat_x, sat_y, sat_layer;

document.satellite.lat_long.value = lat_long;

proc_flag = 1;

iss_x = 7;
iss_y = 7;
iss_layer = 1;

hst_x = 7;
hst_y = 7;
hst_layer = 1;

sts_x = 7;
sts_y = 7;
sts_layer = 1;new_sat_x = 7;new_sat_y = 7;new_sat_layer = 1;

t5_x = 7;
t5_y = 7;
t5_layer = 1;

t10_x = 7;
t10_y = 7;
t10_layer = 1;

t15_x = 7;
t15_y = 7;
t15_layer = 1;

t20_x = 7;
t20_y = 7;
t20_layer = 1;

t25_x = 7;
t25_y = 7;
t25_layer = 1;

t30_x = 7;
t30_y = 7;
t30_layer = 1;

t35_x = 7;
t35_y = 7;
t35_layer = 1;

t40_x = 7;
t40_y = 7;
t40_layer = 1;

t45_x = 7;
t45_y = 7;
t45_layer = 1;

t50_x = 7;
t50_y = 7;
t50_layer = 1;

t55_x = 7;
t55_y = 7;
t55_layer = 1;

t60_x = 7;
t60_y = 7;
t60_layer = 1;

PROCinit();if (document.satellite.sat.value == "STS" && shuttle_status == "ground"){ alert("The Space Shuttle isn't currently in orbit. Please select another satellite."); return;}if (document.satellite.sat.value == "STS" && shuttle_status == "docked"){ alert("The Space Shuttle is docked to the International Space Station. Please select the ISS for predictions."); return;}if (document.satellite.sat.value == "ATV" && atv_status != "orbit"){ alert("The Automated Transfer Vehicle isn't currently in orbit. Please select another satellite."); return;}

T = JDS - JDE;

PROCsatvec();

if (document.satellite.sat.value == "ISS")
{
iss_x = 497 + Sat_lo * x_scale;
iss_y = 79 - Sat_lat * y_scale;
iss_layer = 4;
}

if (document.satellite.sat.value == "HST")
{
hst_x = 492 + Sat_lo * x_scale;
hst_y = 72 - Sat_lat * y_scale;
hst_layer = 4;
}

if (document.satellite.sat.value == "STS")
{
sts_x = 497 + Sat_lo * x_scale;
sts_y = 79 - Sat_lat * y_scale;
sts_layer = 4;
}if (document.satellite.sat.value == "ATV")
{
new_sat_x = 497 + Sat_lo * x_scale;
new_sat_y = 79 - Sat_lat * y_scale;
new_sat_layer = 4;
}if (document.satellite.sat.value == "ENVISAT")
{
new_sat_x = 497 + Sat_lo * x_scale;
new_sat_y = 79 - Sat_lat * y_scale;
new_sat_layer = 4;
}if (document.satellite.sat.value == "SEASAT")
{
new_sat_x = 497 + Sat_lo * x_scale;
new_sat_y = 79 - Sat_lat * y_scale;
new_sat_layer = 4;
}

if (document.all){document.all.iss.style.pixelTop = iss_y;document.all.iss.style.pixelLeft = iss_x;document.all.iss.style.zIndex = iss_layer;document.all.hst.style.pixelTop = hst_y;document.all.hst.style.pixelLeft = hst_x;document.all.hst.style.zIndex = hst_layer;

document.all.sts.style.pixelTop = sts_y;document.all.sts.style.pixelLeft = sts_x;document.all.sts.style.zIndex = sts_layer;document.all.atv.style.pixelTop = new_sat_y;document.all.atv.style.pixelLeft = new_sat_x;document.all.atv.style.zIndex = new_sat_layer;}else{if (document.layers){document.layers["iss"].left = iss_x;document.layers["iss"].top = iss_y;document.layers["iss"].zIndex = iss_layer;document.layers["hst"].left = hst_x;document.layers["hst"].top = hst_y;document.layers["hst"].zIndex = hst_layer;

document.layers["sts"].left = sts_x;document.layers["sts"].top = sts_y;document.layers["sts"].zIndex = sts_layer;document.layers["atv"].left = new_sat_x;document.layers["atv"].top = new_sat_y;document.layers["atv"].zIndex = new_sat_layer;}else{if (document.getElementById){document.getElementById("iss").style.left = iss_x;document.getElementById("iss").style.top = iss_y;document.getElementById("iss").style.zIndex = iss_layer;document.getElementById("hst").style.left = hst_x;document.getElementById("hst").style.top = hst_y;document.getElementById("hst").style.zIndex = hst_layer;

document.getElementById("sts").style.left = sts_x;document.getElementById("sts").style.top = sts_y;document.getElementById("sts").style.zIndex = sts_layer;document.getElementById("atv").style.left = new_sat_x;document.getElementById("atv").style.top = new_sat_y;document.getElementById("atv").style.zIndex = new_sat_layer;}}}

for (satpos=1; satpos<=12; satpos++)
{
T += 5 / 1440;

PROCsatvec();

sat_x = 509 + Sat_lo * x_scale;
sat_y = 96 - Sat_lat * y_scale;

if (satpos == 1)
{
t5_x = sat_x;
t5_y = sat_y;
t5_layer = 4;
}

if (satpos == 2)
{
t10_x = sat_x;
t10_y = sat_y;
t10_layer = 4;
}

if (satpos == 3)
{
t15_x = sat_x;
t15_y = sat_y;
t15_layer = 4;
}

if (satpos == 4)
{
t20_x = sat_x;
t20_y = sat_y;
t20_layer = 4;
}

if (satpos == 5)
{
t25_x = sat_x;
t25_y = sat_y;
t25_layer = 4;
}

if (satpos == 6)
{
t30_x = sat_x;
t30_y = sat_y;
t30_layer = 4;
}

if (satpos == 7)
{
t35_x = sat_x;
t35_y = sat_y;
t35_layer = 4;
}

if (satpos == 8)
{
t40_x = sat_x;
t40_y = sat_y;
t40_layer = 4;
}

if (satpos == 9)
{
t45_x = sat_x;
t45_y = sat_y;
t45_layer = 4;
}

if (satpos == 10)
{
t50_x = sat_x;
t50_y = sat_y;
t50_layer = 4;
}

if (satpos == 11)
{
t55_x = sat_x;
t55_y = sat_y;
t55_layer = 4;
}

if (satpos == 12)
{
t60_x = sat_x;
t60_y = sat_y;
t60_layer = 4;
}

if (document.all){document.all.t5.style.pixelTop = t5_y;document.all.t5.style.pixelLeft = t5_x;document.all.t5.style.zIndex = t5_layer;document.all.t10.style.pixelTop = t10_y;document.all.t10.style.pixelLeft = t10_x;document.all.t10.style.zIndex = t10_layer;

document.all.t15.style.pixelTop = t15_y;document.all.t15.style.pixelLeft = t15_x;document.all.t15.style.zIndex = t15_layer;

document.all.t20.style.pixelTop = t20_y;document.all.t20.style.pixelLeft = t20_x;document.all.t20.style.zIndex = t20_layer;

document.all.t25.style.pixelTop = t25_y;document.all.t25.style.pixelLeft = t25_x;document.all.t25.style.zIndex = t25_layer;

document.all.t30.style.pixelTop = t30_y;document.all.t30.style.pixelLeft = t30_x;document.all.t30.style.zIndex = t30_layer;

document.all.t35.style.pixelTop = t35_y;document.all.t35.style.pixelLeft = t35_x;document.all.t35.style.zIndex = t35_layer;

document.all.t40.style.pixelTop = t40_y;document.all.t40.style.pixelLeft = t40_x;document.all.t40.style.zIndex = t40_layer;

document.all.t45.style.pixelTop = t45_y;document.all.t45.style.pixelLeft = t45_x;document.all.t45.style.zIndex = t45_layer;

document.all.t50.style.pixelTop = t50_y;document.all.t50.style.pixelLeft = t50_x;document.all.t50.style.zIndex = t50_layer;

document.all.t55.style.pixelTop = t55_y;document.all.t55.style.pixelLeft = t55_x;document.all.t55.style.zIndex = t55_layer;

document.all.t60.style.pixelTop = t60_y;document.all.t60.style.pixelLeft = t60_x;document.all.t60.style.zIndex = t60_layer;}else{if (document.layers){document.layers["t5"].left = t5_x;document.layers["t5"].top = t5_y;document.layers["t5"].zIndex = t5_layer;document.layers["t10"].left = t10_x;document.layers["t10"].top = t10_y;document.layers["t10"].zIndex = t10_layer;

document.layers["t15"].left = t15_x;document.layers["t15"].top = t15_y;document.layers["t15"].zIndex = t15_layer;

document.layers["t20"].left = t20_x;document.layers["t20"].top = t20_y;document.layers["t20"].zIndex = t20_layer;

document.layers["t25"].left = t25_x;document.layers["t25"].top = t25_y;document.layers["t25"].zIndex = t25_layer;

document.layers["t30"].left = t30_x;document.layers["t30"].top = t30_y;document.layers["t30"].zIndex = t30_layer;

document.layers["t35"].left = t35_x;document.layers["t35"].top = t35_y;document.layers["t35"].zIndex = t35_layer;

document.layers["t40"].left = t40_x;document.layers["t40"].top = t40_y;document.layers["t40"].zIndex = t40_layer;

document.layers["t45"].left = t45_x;document.layers["t45"].top = t45_y;document.layers["t45"].zIndex = t45_layer;

document.layers["t50"].left = t50_x;document.layers["t50"].top = t50_y;document.layers["t50"].zIndex = t50_layer;

document.layers["t55"].left = t55_x;document.layers["t55"].top = t55_y;document.layers["t55"].zIndex = t55_layer;

document.layers["t60"].left = t60_x;document.layers["t60"].top = t60_y;document.layers["t60"].zIndex = t60_layer;}else{if (document.getElementById){document.getElementById("t5").style.left = t5_x;document.getElementById("t5").style.top = t5_y;document.getElementById("t5").style.zIndex = t5_layer;document.getElementById("t10").style.left = t10_x;document.getElementById("t10").style.top = t10_y;document.getElementById("t10").style.zIndex = t10_layer;

document.getElementById("t15").style.left = t15_x;document.getElementById("t15").style.top = t15_y;document.getElementById("t15").style.zIndex = t15_layer;

document.getElementById("t20").style.left = t20_x;document.getElementById("t20").style.top = t20_y;document.getElementById("t20").style.zIndex = t20_layer;

document.getElementById("t25").style.left = t25_x;document.getElementById("t25").style.top = t25_y;document.getElementById("t25").style.zIndex = t25_layer;

document.getElementById("t30").style.left = t30_x;document.getElementById("t30").style.top = t30_y;document.getElementById("t30").style.zIndex = t30_layer;

document.getElementById("t35").style.left = t35_x;document.getElementById("t35").style.top = t35_y;document.getElementById("t35").style.zIndex = t35_layer;

document.getElementById("t40").style.left = t40_x;document.getElementById("t40").style.top = t40_y;document.getElementById("t40").style.zIndex = t40_layer;

document.getElementById("t45").style.left = t45_x;document.getElementById("t45").style.top = t45_y;document.getElementById("t45").style.zIndex = t45_layer;

document.getElementById("t50").style.left = t50_x;document.getElementById("t50").style.top = t50_y;document.getElementById("t50").style.zIndex = t50_layer;

document.getElementById("t55").style.left = t55_x;document.getElementById("t55").style.top = t55_y;document.getElementById("t55").style.zIndex = t55_layer;

document.getElementById("t60").style.left = t60_x;document.getElementById("t60").style.top = t60_y;document.getElementById("t60").style.zIndex = t60_layer;}}}

}

display_location();

proc_flag = 0;
}
}

function display_location()
{
 location_x = 7;
 location_y = 7;
 location_layer = 1;
 
 if (City != "...")
 {
 location_x = 509 + LO * RD * x_scale;
 location_y = 96 - LA * RD * y_scale;
 location_layer = 4;
 }

 if (document.all) { document.all.location.style.pixelTop = location_y; document.all.location.style.pixelLeft = location_x; document.all.location.style.zIndex = location_layer; } else { if (document.layers) { document.layers["location"].left = location_x; document.layers["location"].top = location_y; document.layers["location"].zIndex = location_layer; } else { if (document.getElementById) { document.getElementById("location").style.left = location_x; document.getElementById("location").style.top = location_y; document.getElementById("location").style.zIndex = location_layer; } } }
}

function satellite_calc()
{
 with (Math) {
    
    PROCinit();        if (document.satellite.sat.value == "STS" && shuttle_status != "orbit")    {     alert("The Space Shuttle isn't currently in orbit. Please select another satellite.");     return;    }        if (document.satellite.sat.value == "ATV" && atv_status != "orbit")    {     alert("The Automated Transfer Vehicle isn't currently in orbit. Please select another satellite.");     return;    }        PROCheader();    T = JDS - JDE;do {
    PROCsatvec();    PROCrangevec();    PROCsunvec();
        if (EL >= SatTest && ECL == "   vis")
    {
     PROCassemble();
    }    else
    {
     if (Pflag == 1)
     {      dur = floor((Tend - Tstart) * 1440 + 0.5);
      if (dur >= 1)
      {
      output_display += "   " + dur + "   ";
      }
      else
      {      output_display += "   <1  ";
      }
      output_display += P1 + "   " + P2 + "   " + P3 + "\n";      Pcount += 1;      Pflag = 0;
     }
    }
    if (Pflag == 0)    {     T += Stepday;    }    else    {     T += Stepday / 4;    }
} while(Pcount < Plimit && (JDE + T - JDS) < Looktime);if (Pcount == 0)
{ output_display += "Sorry, no visible passes of " + SAT + " in the next " + Looktime + " days.\n"
}

output_display += "\n";

document.satellite.result.value = output_display;
}
}function PROCinit()
{
with (Math) {

output_display = "";DR = PI / 180;
RD = 1 / DR;
azimuth = new Array("N  ","NNE","NE ","ENE","E  ","ESE","SE ","SSE","S  ","SSW","SW ","WSW","W  ","WNW","NW ","NNW");if (document.satellite.sat.value == "ISS") iss_elements();

if (document.satellite.sat.value == "HST") hst_elements();

if (document.satellite.sat.value == "STS") sts_elements();if (document.satellite.sat.value == "ATV") atv_elements();if (document.satellite.sat.value == "ENVISAT") envisat_elements();if (document.satellite.sat.value == "SEASAT") seasat_elements();
Stepday = 1 / 1440;Looktime = 10;Plimit = 10;SunTest = -4;SatTest = 10;

if (document.satellite.sat.value != "ISS" && document.satellite.sat.value != "STS") SunTest = -8;

daylight_saving = document.satellite.d_s_t.checked;if (daylight_saving == true){dst = 1;zone = t_zone + dst;}else{zone = t_zone;}

LC = City;
LA = latitude;
LO = -longitude;
HT = 10;
TZ = zone;

start_date = new Date();
YR = start_date.getUTCFullYear();
MN = start_date.getUTCMonth() + 1;
DY = start_date.getUTCDate();
HR = start_date.getUTCHours();
MIN = start_date.getUTCMinutes();
SEC = start_date.getUTCSeconds();
if (proc_flag == 1)
{
MIN += SEC / 60;
}
JDS = caljd(YR,MN,DY + HR / 24 + MIN / 1440);LA = DR * LA;
LO = DR * LO;
HT = HT / 1000;CL = cos(LA);
SL = sin(LA);
CO = cos(LO);
SO = sin(LO);RE = 6378.140;
FL = 1 / 298.257;RP = RE * (1 - FL);
XX = RE * RE;
ZZ = RP * RP;D = sqrt(XX * CL * CL + ZZ * SL * SL);Rx = XX / D + HT;
Rz = ZZ / D + HT;Ux = CL * CO;
Ex = -SO;
Nx = -SL * CO;Uy = CL * SO;
Ey = CO;
Ny = -SL * SOUz = SL;
Ez = 0;
Nz = CL;Ox = Rx * Ux;
Oy = Rx * Uy;
Oz = Rz * Uz;RA = DR * RA;
INC = DR * INC;
WP = DR * WP;MA = DR * MA;
MM = MM * 2 * PI;
M2 = M2 * 2 * PI;JDE = caljd(YE,1,0) + TE;GM = 3.986E+5;J2 = 1.08263E-3;N0 = MM / 86400;A0 = pow(GM / (N0 * N0),1 / 3);B0 = A0 * sqrt(1 - EC * EC);SI = sin(INC);
CI = cos(INC);PC = RE * A0 / (B0 * B0);
PC = 1.5 * J2 * PC * PC * MM;QD = -PC * CI;WD = PC * (5 * CI * CI - 1) / 2;DC = -2 * M2 / MM / 3;Pflag = 0;Pcount = 0;}
}

function PROCheader()
{
 with (Math) {

 jdcal(JDS + TZ / 24);
 x = (dy - floor(dy)) * 24;
 dy = floor(dy);
 
 output_display += LC + "   " + yr + "/";
 if (mth < 10) output_display += "0";
 output_display += mth + "/";
 if (dy < 10) output_display += "0";
 output_display += dy + "  " + am_pm(x) + "   Sunrise/set: " + sun_rise_set(latitude * DR,longitude * DR,zone) + "\n"; output_display += "Predicted passes for: " + SAT; if (daylight_saving == true) {  output_display += "         daylight-saving time enabled"; } output_display += "\n\n             Local   Duration\n"; output_display += "   Date       Time    (min)   Approach     Max. elevation    Departure\n"; output_display += "------------------------------------------------------------------------\n";
}
}

function PROCsatvec()
{
 with (Math) {
DT = DC * T / 2;
KD = 1 + 4 * DT;
KDP = 1 - 7 * DT;M = MA + MM * T * (1 - 3 * DT);DR0 = floor(M / (2 * PI));M = M - DR0 * 2 * PI;RN = RV + DR0;EA = M;

for (count = 1; count <= 10; count++)
{ E1 = M + EC * sin(EA); if (abs(E1-EA) < 1E-8) break;
 EA = E1;
}
A = A0 * KD;
B = B0 * KD;RS = A * (1 - EC * cos(EA));Sx  =  A * (cos(EA) - EC);Sy  =  B * sin(EA);

AP = WP + WD * T * KDP;
CW = cos(AP);
SW = sin(AP);RAAN = RA + QD * T * KDP;
CQ = cos(RAAN);
SQ = sin(RAAN);CXx = CW * CQ - SW * CI * SQ;
CXy = -SW * CQ - CW * CI * SQ;
CXz = SI * SQ;CYx = CW * SQ + SW * CI * CQ;
CYy = -SW * SQ + CW * CI * CQ;
CYz = -SI * CQ;CZx = SW * SI;
CZy = CW * SI;
CZz = CI;SATx = Sx * CXx + Sy * CXy;SATy = Sx * CYx + Sy * CYy;SATz = Sx * CZx + Sy * CZy;H = gmst(JDE + T);GHAA = (H * 15) * DR;C = cos(-GHAA);
S = sin(-GHAA);Sx = SATx * C - SATy * S;Sy = SATx * S + SATy * C;Sz = SATz;

Sat_lo = RD * arc_tan(Sy,Sx);
Sat_lat = RD * asin(Sz/RS);
if (Sat_lo > 180) Sat_lo -= 360;}
}

function PROCrangevec()
{
 with (Math) {
Rx = Sx - Ox;
Ry = Sy - Oy;
Rz = Sz - Oz;

R = sqrt(Rx * Rx + Ry * Ry + Rz * Rz);
Rx = Rx / R;
Ry = Ry / R;
Rz = Rz / R;
U = Rx * Ux + Ry * Uy + Rz * Uz;East = Rx * Ex + Ry * Ey;North = Rx * Nx + Ry * Ny + Rz * Nz;
AZ0 = RD * arc_tan(East,North);EL = RD * atan(U / sqrt(1 - U * U));}
}

function SUNxyz(j_date){
 with (Math) {
 var n, ll, g, le, ob; n = j_date - 2451545.0; ll = (280.460 + 0.9856474 * n) / 360; ll = (ll - floor(ll)) * 2 * PI; g = (357.528 + 0.9856003 * n) / 360; g = (g - floor(g)) * 2 * PI; le = ll + 1.915 * DR * sin(g) + 0.020 * DR * sin(2 * g); ob = (23.439 - 0.0000004 * n) * DR; SUNx = cos(le);
 SUNy = cos(ob) * sin(le);
 SUNz = sin(ob) * sin(le);}
}
function PROCsunvec()
{
 with (Math) {
SUNxyz(JDE + T);
CUA = -(SATx * SUNx + SATy * SUNy + SATz * SUNz) / RS;UMD = RS * sqrt(1 - CUA * CUA) / RE;

if (CUA >= 0)
 {ECL = "     +  ";}
 else
 {ECL = "     -  ";}
if (UMD <=  1 && CUA >= 0) ECL = "   ECL";  C = cos( - GHAA);
  S = sin( - GHAA);  Hx = SUNx * C - SUNy * S;  Hy = SUNx * S + SUNy * C;  Hz = SUNz;
    cSunZD = Hx * Ux + Hy * Uy + Hz * Uz;  SunZD = atan(sqrt(1 - cSunZD * cSunZD) / cSunZD);
  if (cSunZD < 0) SunZD += PI;
  SunAlt = 90 - SunZD * RD;
  if (SunAlt < SunTest && ECL != "   ECL") ECL = "   vis";}
}
function PROCassemble()
{
 with (Math) {
  if (Pflag == 0) {  jdcal(JDE + T + TZ / 24);
  HR1 = (dy - floor(dy)) * 24;
  Hr = floor(HR1);
  Min = floor(60 * (HR1 - Hr));  PM = " pm";
  if (Hr < 12) PM = " am";  if (Hr > 12) Hr -= 12;  if (Hr == 0) Hr = 12;
  if (Hr < 10) Hr = "0" + Hr;
  if (Min < 10) Min = "0" + Min;  time = "  " + Hr + ":" + Min + PM;
  dy = floor(dy);
  if (mth < 10) mth = "0" + mth;
  if (dy < 10) dy = "0" + dy;
  date = yr + "/" + mth + "/" + dy + " "; }
  
  AZ0 += 11.25;
  if (AZ0 >= 360) AZ0 -= 360;  AZI = floor(AZ0 / 22.5);  AZ = azimuth[AZI];  P0 = floor(EL + 0.5) + "\u00B0" + " above " + AZ;  if (EL < 9.5) P0 = " " + P0;

  if (Pflag == 1)
  {   if (EL > EL2)
   {
    EL2 = EL;
    P2 = P0;
   }   P3 = P0;
   Tend = T;  }
  else
  {   output_display += date + time;   P1 = P0;
   Tstart = T;   P2 = P0;
   EL2 = EL;   P3 = P0;
   Tend = T;
  }

  Pflag = 1;}
}

function caljd(year,month,day)
{
 with (Math) {

 var y0, m0, a, b, b1;

 y0 = year;
 m0 = month;

 if (m0 < 2.5) 
 {
 y0 = y0 - 1;
 m0 = m0 + 12;
 }
 a = floor(y0 / 100);
 b = 0;
 b1 = 2 - a + floor(a / 4);

 if (y0 > 1582) b = b1;
 if (y0 == 1582 && month > 10) b = b1;
 if (y0 == 1582 && month == 10 && day >= 15.0) b = b1;

 return floor(365.25 * (y0 + 4716)) + floor(30.6001 * (m0 + 1)) + day + b - 1524.5;
}
}

function jdcal(jd)
{
 with (Math) {
 
 var jd_temp, zz, ff, alpha, aa, bb, cc, dd, ee;
 
 jd_temp = jd + 0.5;
 zz = floor(jd_temp);
 ff = jd_temp - zz;
 alpha = floor((zz - 1867216.25) / 36524.25);
 aa = zz + 1 + alpha - floor(alpha / 4);
 bb = aa + 1524;
 cc = floor((bb - 122.1) / 365.25);
 dd = floor(365.25 * cc);
 ee = floor((bb - dd) / 30.6001);
 dy = bb - dd - floor(30.6001 * ee) + ff;
 mth = ee;
 if (ee < 13.5) mth = ee - 1;
 if (ee > 13.5) mth = ee - 13;
 yr = cc;
 if (mth > 2.5) yr = cc - 4716;
 if (mth < 2.5) yr = cc - 4715; 
}
}

function gmst(jd)
{
 with (Math) {

 var a, b, c, d, k, g;

 a = 0.7790572732639;
 b = 1.002737909350795;
 c = 8.07745E-16;
 d = 1.47E-24;
 k = jd - 2451545.0;
 g = a + k * (b + k * (c + k * d));
 return 24 * (g - floor(g));
}
}

function sign_of(x){return x == 0 ? 0 : (x > 0 ? 1 : -1);}

function arc_tan(y,x)
{
 with (Math) {
 
 var a;
   if (x != 0)
  {a = atan(y / x);}
  else
  {a = PI / 2 * sign_of(y);}  if (x < 0) a += PI;  if (a < 0) a += 2 * PI;  return a;}
}

function round_1000(num){return Math.floor((num + 0.0005) * 1000) / 1000;}

function am_pm(h){with (Math) {var hours, minutes, ampm, result="";hours = floor(h);minutes = floor((h - hours) * 60 + 0.5);if (minutes == 60){hours += 1;minutes = 0;}if (hours > 11){hours -= 12; ampm = " pm";}else{ampm = " am";}if (hours < 1) hours = 12;if (hours < 10){result = result + "0" + floor(hours);}else{result = result + floor(hours);}result = result + ":";if (minutes < 10){result = result + "0" + minutes;}else{result = result + minutes;}}result = result + ampmreturn result;}

function sun_rise_set(latitude,longitude,tzone){with (Math) {

var r_a = new Array(2);
var dec = new Array(2);var p1 = PI;
var p2 = 2 * p1;var dr = p1 / 180;
var RAD = 1 / dr;
var k1 = 15 * dr * 1.0027379;

var b5, l5, h, z0, t, tt, t0, s, l, g, v, u, w;
var a5, d5, r5, z1, c, z, m8, w8, a0, d0, da, dd;
var c0, p, a2, d2, l0, l2, h0, h1, h2, d1;
var v0=0, v1=0, v2=0, a, b, d, e, t3;
var rise_str = "", set_str = "", result = "";
b5 = latitude * RAD;l5 = longitude * RAD;h = tzone;l5 = -l5 / 360;z0 = -h / 24;
/*t = JDS - 2451545.0;*/jdcal(JDS + TZ / 24);
t = caljd(yr,mth,floor(dy)) - 2451545.0;

tt = t / 36525 + 1;t0 = t / 36525;s = (24110.5 + 8640184.813 * t0 + 86636.6 * z0 + 86400 * l5) / 86400;
s = s - floor(s);t0 = s * 360 * dr;

t = t + z0;

for (c0=1; c0<3; c0++)
{l = .779072+.00273790931*t;g = .993126+.0027377785*t;l = (l-floor(l))*p2;
g = (g-floor(g))*p2;v = .39785*sin(l)-.01000*sin(l-g)+.00333*sin(l+g)-.00021*tt*sin(l);u = 1-.03349*cos(g)-.00014*cos(2*l)+.00008*cos(l);w = -.00010-.04129*sin(2*l)+.03211*sin(g)+.00104*sin(2*l-g)-.00035*sin(2*l+g)-.00008*tt*sin(g);s = w/sqrt(u-v*v);a5 = l+atan(s/sqrt(1-s*s));s = v/sqrt(u);
d5 = atan(s/sqrt(1-s*s));r5 = 1.00021*sqrt(u);
r_a[c0] = a5;
dec[c0] = d5;

t += 1;
}
if (r_a[2] < r_a[1]) r_a[2] += p2;
z1 = dr * 90.833;s = sin(b5 * dr);
c = cos(b5 * dr);z = cos(z1);
m8 = 0;
w8 = 0;a0 = r_a[1];
d0 = dec[1];da = r_a[2] - r_a[1];
dd = dec[2] - dec[1];

for (c0=0; c0<24; c0++)
{p = (c0 + 1) / 24;a2 = r_a[1] + p * da;
d2 = dec[1] + p * dd;

l0 = t0 + c0 * k1;l2 = l0 + k1;h0 = l0 - a0;h2 = l2 - a2;h1 = (h2 + h0) / 2;d1 = (d2 + d0) / 2;if (c0 < 1) v0 = s * sin(d0) + c * cos(d0) * cos(h0) - z;v2 = s * sin(d2) + c * cos(d2) * cos(h2) - z;
if (sign_of(v0) != sign_of(v2)){ v1 = s * sin(d1) + c * cos(d1) * cos(h1) - z; a = 2 * v2 - 4 * v1 + 2 * v0; b = 4 * v1 - 3 * v0 - v2; d = b * b - 4 * a * v0; if (d >= 0) { d = sqrt(d); e = (-b + d) / (2 * a); if (e > 1 || e < 0) e = (-b - d) / (2 * a); t3 = am_pm(c0 + e); if (v0 < 0 && v2 > 0) {  m8 = 1;  rise_str = t3; } if (v0 > 0 && v2 < 0) {  w8 = 1;  set_str = t3; } }}
a0 = a2;d0 = d2;v0 = v2;}if (m8 == 0 && w8 == 0){ if (v2 < 0) { rise_str = "down 24h"; set_str = "down 24h"; } if (v2 > 0) { rise_str = " up 24h "; set_str = " up 24h "; }}
else
{ if (m8 == 0) rise_str = " ------ "; if (w8 == 0) set_str = " ------ ";
}

result = rise_str + " / " + set_str;return result;}}

function getCookie( name )
{  var start = document.cookie.indexOf( name + "=" );  var len = start + name.length + 1;  if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {    return null;  }  if ( start == -1 ) return null;  var end = document.cookie.indexOf( ";", len );  if ( end == -1 ) end = document.cookie.length;  return unescape( document.cookie.substring( len, end ) );}function setCookie( name, value, expires, path, domain, secure )
{  var today = new Date();  today.setTime( today.getTime() );  if ( expires ) {    expires = expires * 1000 * 60 * 60 * 24;  }  var expires_date = new Date( today.getTime() + (expires) );  document.cookie = name+"="+escape( value ) +    ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()    ( ( path ) ? ";path=" + path : "" ) +    ( ( domain ) ? ";domain=" + domain : "" ) +    ( ( secure ) ? ";secure" : "" );}function deleteCookie( name, path, domain )
{  if ( getCookie( name ) ) document.cookie = name + "=" +    ( ( path ) ? ";path=" + path : "") +    ( ( domain ) ? ";domain=" + domain : "" ) +    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";}

function save_loc()
{
deleteCookie('satellite2latdeg','','');
deleteCookie('satellite2longdeg','','');
deleteCookie('satellite2tzonehours','','');
setCookie('satellite2latdeg',round_1000(latitude),365,'','','');
setCookie('satellite2longdeg',round_1000(longitude),365,'','','');
setCookie('satellite2tzonehours',t_zone,365,'','','');
alert("The current location has been saved.");
}

function load_loc()
{
var full_custom_URL = "custom.html?";
var display_saved_satellite;
var lat_deg = getCookie('satellite2latdeg');
var lng_deg = getCookie('satellite2longdeg');
var time_zone_hours = getCookie('satellite2tzonehours');

if (lat_deg == null && lng_deg == null)
{
 alert ("Sorry, but you haven't saved a previous latitude and longitude. If you want Satellite Tracker to remember the currently displayed location, please click the 'Save this?' link. Alternatively, enter a new latitude and longitude by clicking the 'New?' link.")
}
else
{
 full_custom_URL += "latitude=" + lat_deg + "&";
 full_custom_URL += "longitude=" + lng_deg + "&";
 full_custom_URL += "tzone=" + time_zone_hours;
 display_saved_satellite = window.open(full_custom_URL,'_self');
}
}