<?php
// regions.php
// JSON parse https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_geography_regions_polys.geojson via http://geojson.xyz/ as "geography regions polys"
// RJM Programming
// January, 2023
set_time_limit(2000);

$dolatlong=false;
$longoff=180.0;
$latoff=90.0;
$factor=1.0;
$abit="";
$sih="";
$rih="";

function oururlencode($instuff) {
  $outstuff='';
  $dotbits=explode('.', $instuff);
  if (sizeof($dotbits) > 1) {
    $outstuff=$instuff;
    for ($ii=1; $ii<sizeof($dotbits); $ii++) {
      if (strlen( explode(',',  explode(' ', $dotbits[$ii])[0])[0]  ) > 3) {
        $outstuff=str_replace('.' . explode(',',  explode(' ', $dotbits[$ii])[0])[0], '.' . substr(explode(',',  explode(' ', $dotbits[$ii])[0])[0],0,3), $outstuff);
      }
    }
    return urlencode($outstuff);
  }
  return urlencode($instuff);
}

if (isset($_GET['zoom'])) {
  if (strlen(str_replace('+','',urldecode($_GET['zoom']))) > 0) {
    $factor=str_replace('+','',urldecode($_GET['zoom']));
  } 
}  

if (isset($_GET['uselatlaong'])) {  
  $dolatlong=true;  
  $longoff=0.0;
  $latoff=0.0;
} else if (file_exists('regions.html')) {
  if ($factor != 1.0) {
    echo str_replace("function onl() {", "function onl() { \n document.body.style.zoom=((izoom == 1.0) ? ('' + eval(izoom * 100.0) + '%') : '" . (100.0 * $factor) . "%'); \n ", file_get_contents('regions.html'));
    exit;
  } else {
    echo file_get_contents('regions.html');
    exit;
  }
}

if (file_exists('population.geojson')) {
  $rbits=explode(']}}', file_get_contents('./population.geojson'));
  for ($irr=1; $irr<(-1 + sizeof($rbits)); $irr++) {
       $hdrbit=explode('{"type":"Feature', $rbits[-1 + $irr])[-1 + sizeof(explode('{"type":"Feature', $rbits[-1 + $irr]))];
       $hbits=explode(',"NAME":"', $hdrbit);   
       if (sizeof($hbits) > 1) {
       if (strpos($sih, ' id=' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . ' ') === false) {
       $sih.='<option id=' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . ' value=' . str_replace('+','%20', str_replace('[','', str_replace(']','', str_replace('],[',',' ,explode(']}', explode(':[',$hdrbit)[1])[0])))) . '></option>';
       }
       }
  }
}

if (file_exists('rivers.geojson')) {
  $rbits=explode(']]}}', file_get_contents('./rivers.geojson'));
  for ($irr=1; $irr<(-1 + sizeof($rbits)); $irr++) {
       $hdrbit=explode('{"type":"Feature', $rbits[-1 + $irr])[-1 + sizeof(explode('{"type":"Feature', $rbits[-1 + $irr]))];
       $hbits=explode(',"name":"', $hdrbit);   
       if (sizeof($hbits) > 1) {
       if (strpos($sih, 'id=river' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . '>') === false) {
       $rih.='<option value=' . str_replace('+','%20', oururlencode(str_replace('[','', str_replace(']','', str_replace('],[', ',', str_replace(']],[[', ' ', explode(']]}', explode(':[[',$hdrbit)[1])[0])))))) . ' id=river' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . '></option>';
       } else {
       $rih=str_replace(' id=river' . str_replace('+','%20', oururlencode(explode('"', $hbits[1])[0])) . '>', str_replace('+','%20', urlencode(str_replace('[','', str_replace(']','', str_replace('],[', ',', str_replace(']],[[', ' ', explode(']]}', explode(':[[',$hdrbit)[1])[0])))))) . ' id=river' . str_replace('+','%20',urlencode(explode('"', $hbits[1])[0])) . '>', $rih);
       }
       }
  }
}

// Create a transparent image thanks to https://www.php.net/manual/en/function.imagecolortransparent.php

$im = imagecreatetruecolor((360.0 * $factor), (180.0 * $factor));
$black = imagecolorallocate($im, 0, 0, 0);

// Make the background transparent

imagecolortransparent($im, $black);

// Save the image

$udirnameprebimg='/tmp/imagecolortransparent.png';
imagepng($im, $udirnameprebimg);
$duis='data:image/' . str_replace('jpg','jpeg',strtolower(explode('.',$udirnameprebimg)[-1 + sizeof(explode('.',$udirnameprebimg))])) . ';base64,' . base64_encode(file_get_contents($udirnameprebimg));
imagedestroy($im);
unlink($udirnameprebimg); 

$htmlis="<html><head><title>Display GeoJSON Coastline</title><meta charset='utf-8'/>
<meta id='myviewport' name='viewport' content='width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes'  >
<scr" . "ipt type='text/javascript'>
  var jzoom=1.0, izoom=location.search.split('zoom=')[1] ? eval(decodeURIComponent(location.search.split('zoom=')[1].split('&')[0])) : 1.0;
  var lastl='', longlastl='', elem=null, context=null, thislat=0.0, thisong=0.0, mapwo=null;
  var yourtzlist='<option value=\"GMT\" data-geo=\"51.4934,0.0098,GMT,GB,+0\">GMT</option><option value=\"Africa/Abidjan\" data-geo=\"5.31666,-4.03334,GMT,CI,+0\">Africa/Abidjan</option><option value=\"Africa/Accra\" data-geo=\"5.55,-0.21667,GMT,GH,+0\">Africa/Accra</option><option value=\"Africa/Addis_Ababa\" data-geo=\"9.03333,38.7,EAT,ET,+3\">Africa/Addis_Ababa</option><option value=\"Africa/Algiers\" data-geo=\"36.78333,3.05,CET,DZ,+1\">Africa/Algiers</option><option value=\"Africa/Asmara\" data-geo=\"15.33333,38.88333,EAT,ER,+3\">Africa/Asmara</option><option value=\"Africa/Bamako\" data-geo=\"12.65,-8,GMT,ML,+0\">Africa/Bamako</option><option value=\"Africa/Bangui\" data-geo=\"4.36666,18.58333,WAT,CF,+1\">Africa/Bangui</option><option value=\"Africa/Banjul\" data-geo=\"13.46666,-16.65,GMT,GM,+0\">Africa/Banjul</option><option value=\"Africa/Bissau\" data-geo=\"11.85,-15.58334,GMT,GW,+0\">Africa/Bissau</option><option value=\"Africa/Blantyre\" data-geo=\"-15.78334,35,CAT,MW,+2\">Africa/Blantyre</option><option value=\"Africa/Brazzaville\" data-geo=\"-4.26667,15.28333,WAT,CG,+1\">Africa/Brazzaville</option><option value=\"Africa/Bujumbura\" data-geo=\"-3.38334,29.36666,CAT,BI,+2\">Africa/Bujumbura</option><option value=\"Africa/Cairo\" data-geo=\"30.05,31.25,EET,EG,+2\">Africa/Cairo</option><option value=\"Africa/Casablanca\" data-geo=\"33.65,-7.58334,+01,MA,+0\">Africa/Casablanca</option><option value=\"Africa/Ceuta\" data-geo=\"35.88333,-5.31667,CEST,ES,+1\">Africa/Ceuta</option><option value=\"Africa/Conakry\" data-geo=\"9.51666,-13.71667,GMT,GN,+0\">Africa/Conakry</option><option value=\"Africa/Dakar\" data-geo=\"14.66666,-17.43334,GMT,SN,+0\">Africa/Dakar</option><option value=\"Africa/Dar_es_Salaam\" data-geo=\"-6.8,39.28333,EAT,TZ,+3\">Africa/Dar_es_Salaam</option><option value=\"Africa/Djibouti\" data-geo=\"11.6,43.15,EAT,DJ,+3\">Africa/Djibouti</option><option value=\"Africa/Douala\" data-geo=\"4.05,9.7,WAT,CM,+1\">Africa/Douala</option><option value=\"Africa/El_Aaiun\" data-geo=\"27.15,-13.2,+01,EH,+0\">Africa/El_Aaiun</option><option value=\"Africa/Freetown\" data-geo=\"8.5,-13.25,GMT,SL,+0\">Africa/Freetown</option><option value=\"Africa/Gaborone\" data-geo=\"-24.65001,25.91666,CAT,BW,+2\">Africa/Gaborone</option><option value=\"Africa/Harare\" data-geo=\"-17.83334,31.05,CAT,ZW,+2\">Africa/Harare</option><option value=\"Africa/Johannesburg\" data-geo=\"-26.25,28,SAST,ZA,+2\">Africa/Johannesburg</option><option value=\"Africa/Juba\" data-geo=\"4.85,31.6,EAT,SS,+3\">Africa/Juba</option><option value=\"Africa/Kampala\" data-geo=\"0.31666,32.41666,EAT,UG,+3\">Africa/Kampala</option><option value=\"Africa/Khartoum\" data-geo=\"15.6,32.53333,CAT,SD,+3\">Africa/Khartoum</option><option value=\"Africa/Kigali\" data-geo=\"-1.95,30.06666,CAT,RW,+2\">Africa/Kigali</option><option value=\"Africa/Kinshasa\" data-geo=\"-4.3,15.3,WAT,CD,+1\">Africa/Kinshasa</option><option value=\"Africa/Lagos\" data-geo=\"6.45,3.4,WAT,NG,+1\">Africa/Lagos</option><option value=\"Africa/Libreville\" data-geo=\"0.38333,9.45,WAT,GA,+1\">Africa/Libreville</option><option value=\"Africa/Lome\" data-geo=\"6.13333,1.21666,GMT,TG,+0\">Africa/Lome</option><option value=\"Africa/Luanda\" data-geo=\"-8.8,13.23333,WAT,AO,+1\">Africa/Luanda</option><option value=\"Africa/Lubumbashi\" data-geo=\"-11.66667,27.46666,CAT,CD,+2\">Africa/Lubumbashi</option><option value=\"Africa/Lusaka\" data-geo=\"-15.41667,28.28333,CAT,ZM,+2\">Africa/Lusaka</option><option value=\"Africa/Malabo\" data-geo=\"3.75,8.78333,WAT,GQ,+1\">Africa/Malabo</option><option value=\"Africa/Maputo\" data-geo=\"-25.96667,32.58333,CAT,MZ,+2\">Africa/Maputo</option><option value=\"Africa/Maseru\" data-geo=\"-29.46667,27.5,SAST,LS,+2\">Africa/Maseru</option><option value=\"Africa/Mbabane\" data-geo=\"-26.3,31.1,SAST,SZ,+2\">Africa/Mbabane</option><option value=\"Africa/Mogadishu\" data-geo=\"2.06666,45.36666,EAT,SO,+3\">Africa/Mogadishu</option><option value=\"Africa/Monrovia\" data-geo=\"6.3,-10.78334,GMT,LR,+0\">Africa/Monrovia</option><option value=\"Africa/Nairobi\" data-geo=\"-1.28334,36.81666,EAT,KE,+3\">Africa/Nairobi</option><option value=\"Africa/Ndjamena\" data-geo=\"12.11666,15.05,WAT,TD,+1\">Africa/Ndjamena</option><option value=\"Africa/Niamey\" data-geo=\"13.51666,2.11666,WAT,NE,+1\">Africa/Niamey</option><option value=\"Africa/Nouakchott\" data-geo=\"18.1,-15.95,GMT,MR,+0\">Africa/Nouakchott</option><option value=\"Africa/Ouagadougou\" data-geo=\"12.36666,-1.51667,GMT,BF,+0\">Africa/Ouagadougou</option><option value=\"Africa/Porto-Novo\" data-geo=\"6.48333,2.61666,WAT,BJ,+1\">Africa/Porto-Novo</option><option value=\"Africa/Sao_Tome\" data-geo=\"0.33333,6.73333,GMT,ST,+0\">Africa/Sao_Tome</option><option value=\"Africa/Tripoli\" data-geo=\"32.9,13.18333,EET,LY,+2\">Africa/Tripoli</option><option value=\"Africa/Tunis\" data-geo=\"36.8,10.18333,CET,TN,+1\">Africa/Tunis</option><option value=\"Africa/Windhoek\" data-geo=\"-22.56667,17.1,CAT,NA,+2\">Africa/Windhoek</option><option value=\"America/Adak\" data-geo=\"51.88,-176.65806,HDT,US,-10\">America/Adak</option><option value=\"America/Anchorage\" data-geo=\"61.21805,-149.90028,AKDT,US,-9\">America/Anchorage</option><option value=\"America/Anguilla\" data-geo=\"18.2,-63.06667,AST,AI,-4\">America/Anguilla</option><option value=\"America/Antigua\" data-geo=\"17.05,-61.8,AST,AG,-4\">America/Antigua</option><option value=\"America/Araguaina\" data-geo=\"-7.2,-48.2,-03,BR,-3\">America/Araguaina</option><option value=\"America/Argentina/Buenos_Aires\" data-geo=\"-34.6,-58.45,-03,AR,-3\">America/Argentina/Buenos_Aires</option><option value=\"America/Argentina/Catamarca\" data-geo=\"-28.46667,-65.78334,-03,AR,-3\">America/Argentina/Catamarca</option><option value=\"America/Argentina/Cordoba\" data-geo=\"-31.4,-64.18334,-03,AR,-3\">America/Argentina/Cordoba</option><option value=\"America/Argentina/Jujuy\" data-geo=\"-24.18334,-65.3,-03,AR,-3\">America/Argentina/Jujuy</option><option value=\"America/Argentina/La_Rioja\" data-geo=\"-29.43334,-66.85,-03,AR,-3\">America/Argentina/La_Rioja</option><option value=\"America/Argentina/Mendoza\" data-geo=\"-32.88334,-68.81667,-03,AR,-3\">America/Argentina/Mendoza</option><option value=\"America/Argentina/Rio_Gallegos\" data-geo=\"-51.63334,-69.21667,-03,AR,-3\">America/Argentina/Rio_Gallegos</option><option value=\"America/Argentina/Salta\" data-geo=\"-24.78334,-65.41667,-03,AR,-3\">America/Argentina/Salta</option><option value=\"America/Argentina/San_Juan\" data-geo=\"-31.53334,-68.51667,-03,AR,-3\">America/Argentina/San_Juan</option><option value=\"America/Argentina/San_Luis\" data-geo=\"-33.31667,-66.35,-03,AR,-3\">America/Argentina/San_Luis</option><option value=\"America/Argentina/Tucuman\" data-geo=\"-26.81667,-65.21667,-03,AR,-3\">America/Argentina/Tucuman</option><option value=\"America/Argentina/Ushuaia\" data-geo=\"-54.8,-68.3,-03,AR,-3\">America/Argentina/Ushuaia</option><option value=\"America/Aruba\" data-geo=\"12.5,-69.96667,AST,AW,-4\">America/Aruba</option><option value=\"America/Asuncion\" data-geo=\"-25.26667,-57.66667,-04,PY,-3\">America/Asuncion</option><option value=\"America/Atikokan\" data-geo=\"48.75861,-91.62167,EST,CA,-5\">America/Atikokan</option><option value=\"America/Bahia\" data-geo=\"-12.98334,-38.51667,-03,BR,-3\">America/Bahia</option><option value=\"America/Bahia_Banderas\" data-geo=\"20.8,-105.25,CDT,MX,-6\">America/Bahia_Banderas</option><option value=\"America/Barbados\" data-geo=\"13.1,-59.61667,AST,BB,-4\">America/Barbados</option><option value=\"America/Belem\" data-geo=\"-1.45,-48.48334,-03,BR,-3\">America/Belem</option><option value=\"America/Belize\" data-geo=\"17.5,-88.2,CST,BZ,-6\">America/Belize</option><option value=\"America/Blanc-Sablon\" data-geo=\"51.41666,-57.11667,AST,CA,-4\">America/Blanc-Sablon</option><option value=\"America/Boa_Vista\" data-geo=\"2.81666,-60.66667,-04,BR,-4\">America/Boa_Vista</option><option value=\"America/Bogota\" data-geo=\"4.6,-74.08334,-05,CO,-5\">America/Bogota</option><option value=\"America/Boise\" data-geo=\"43.61361,-116.2025,MDT,US,-7\">America/Boise</option><option value=\"America/Cambridge_Bay\" data-geo=\"69.11388,-105.05278,MDT,CA,-7\">America/Cambridge_Bay</option><option value=\"America/Campo_Grande\" data-geo=\"-20.45,-54.61667,-04,BR,-3\">America/Campo_Grande</option><option value=\"America/Cancun\" data-geo=\"21.08333,-86.76667,EST,MX,-5\">America/Cancun</option><option value=\"America/Caracas\" data-geo=\"10.5,-66.93334,-04,VE,-4.5\">America/Caracas</option><option value=\"America/Cayenne\" data-geo=\"4.93333,-52.33334,-03,GF,-3\">America/Cayenne</option><option value=\"America/Cayman\" data-geo=\"19.3,-81.38334,EST,KY,-5\">America/Cayman</option><option value=\"America/Chicago\" data-geo=\"41.85,-87.65,CDT,US,-6\">America/Chicago</option><option value=\"America/Chihuahua\" data-geo=\"28.63333,-106.08334,MDT,MX,-7\">America/Chihuahua</option><option value=\"America/Costa_Rica\" data-geo=\"9.93333,-84.08334,CST,CR,-6\">America/Costa_Rica</option><option value=\"America/Creston\" data-geo=\"49.1,-116.51667,MST,CA,-7\">America/Creston</option><option value=\"America/Cuiaba\" data-geo=\"-15.58334,-56.08334,-04,BR,-3\">America/Cuiaba</option><option value=\"America/Curacao\" data-geo=\"12.18333,-69,AST,CW,-4\">America/Curacao</option><option value=\"America/Danmarkshavn\" data-geo=\"76.76666,-18.66667,GMT,GL,+0\">America/Danmarkshavn</option><option value=\"America/Dawson\" data-geo=\"64.06666,-139.41667,PDT,CA,-8\">America/Dawson</option><option value=\"America/Dawson_Creek\" data-geo=\"59.76666,-120.23334,MST,CA,-7\">America/Dawson_Creek</option><option value=\"America/Denver\" data-geo=\"39.73916,-104.98417,MDT,US,-7\">America/Denver</option><option value=\"America/Detroit\" data-geo=\"42.33138,-83.04584,EDT,US,-5\">America/Detroit</option><option value=\"America/Dominica\" data-geo=\"15.3,-61.4,AST,DM,-4\">America/Dominica</option><option value=\"America/Edmonton\" data-geo=\"53.55,-113.46667,MDT,CA,-7\">America/Edmonton</option><option value=\"America/Eirunepe\" data-geo=\"-6.66667,-69.86667,-05,BR,-5\">America/Eirunepe</option><option value=\"America/El_Salvador\" data-geo=\"13.7,-89.2,CST,SV,-6\">America/El_Salvador</option><option value=\"America/Fortaleza\" data-geo=\"-3.71667,-38.5,-03,BR,-3\">America/Fortaleza</option><option value=\"America/Glace_Bay\" data-geo=\"46.19999,-59.95,ADT,CA,-4\">America/Glace_Bay</option><option value=\"America/Godthab\" data-geo=\"64.18333,-51.73334,-02,GL,-3\">America/Godthab</option><option value=\"America/Goose_Bay\" data-geo=\"53.33333,-60.41667,ADT,CA,-4\">America/Goose_Bay</option><option value=\"America/Grand_Turk\" data-geo=\"21.46666,-71.13334,EDT,TC,-4\">America/Grand_Turk</option><option value=\"America/Grenada\" data-geo=\"12.05,-61.75,AST,GD,-4\">America/Grenada</option><option value=\"America/Guadeloupe\" data-geo=\"16.23333,-61.53334,AST,GP,-4\">America/Guadeloupe</option><option value=\"America/Guatemala\" data-geo=\"14.63333,-90.51667,CST,GT,-6\">America/Guatemala</option><option value=\"America/Guayaquil\" data-geo=\"-2.16667,-79.83334,-05,EC,-5\">America/Guayaquil</option><option value=\"America/Guyana\" data-geo=\"6.8,-58.16667,-04,GY,-4\">America/Guyana</option><option value=\"America/Halifax\" data-geo=\"44.65,-63.6,ADT,CA,-4\">America/Halifax</option><option value=\"America/Havana\" data-geo=\"23.13333,-82.36667,CDT,CU,-5\">America/Havana</option><option value=\"America/Hermosillo\" data-geo=\"29.06666,-110.96667,MST,MX,-7\">America/Hermosillo</option><option value=\"America/Indiana/Indianapolis\" data-geo=\"39.76833,-86.15806,EDT,US,-5\">America/Indiana/Indianapolis</option><option value=\"America/Indiana/Knox\" data-geo=\"41.29583,-86.625,CDT,US,-6\">America/Indiana/Knox</option><option value=\"America/Indiana/Marengo\" data-geo=\"38.37555,-86.34473,EDT,US,-5\">America/Indiana/Marengo</option><option value=\"America/Indiana/Petersburg\" data-geo=\"38.49194,-87.27862,EDT,US,-5\">America/Indiana/Petersburg</option><option value=\"America/Indiana/Tell_City\" data-geo=\"37.95305,-86.76139,CDT,US,-6\">America/Indiana/Tell_City</option><option value=\"America/Indiana/Vevay\" data-geo=\"38.74777,-85.06723,EDT,US,-5\">America/Indiana/Vevay</option><option value=\"America/Indiana/Vincennes\" data-geo=\"38.67722,-87.52862,EDT,US,-5\">America/Indiana/Vincennes</option><option value=\"America/Indiana/Winamac\" data-geo=\"41.05138,-86.60306,EDT,US,-5\">America/Indiana/Winamac</option><option value=\"America/Inuvik\" data-geo=\"68.34972,-133.71667,MDT,CA,-7\">America/Inuvik</option><option value=\"America/Iqaluit\" data-geo=\"63.73333,-68.46667,EDT,CA,-5\">America/Iqaluit</option><option value=\"America/Jamaica\" data-geo=\"18,-76.8,EST,JM,-5\">America/Jamaica</option><option value=\"America/Juneau\" data-geo=\"58.30194,-134.41973,AKDT,US,-9\">America/Juneau</option><option value=\"America/Kentucky/Louisville\" data-geo=\"38.25416,-85.75945,EDT,US,-5\">America/Kentucky/Louisville</option><option value=\"America/Kentucky/Monticello\" data-geo=\"36.82972,-84.84917,EDT,US,-5\">America/Kentucky/Monticello</option><option value=\"America/Kralendijk\" data-geo=\"12.15083,-68.27667,AST,BQ,-4\">America/Kralendijk</option><option value=\"America/La_Paz\" data-geo=\"-16.5,-68.15,-04,BO,-4\">America/La_Paz</option><option value=\"America/Lima\" data-geo=\"-12.05,-77.05,-05,PE,-5\">America/Lima</option><option value=\"America/Los_Angeles\" data-geo=\"34.05222,-118.24278,PDT,US,-8\">America/Los_Angeles</option><option value=\"America/Lower_Princes\" data-geo=\"18.05138,-63.04723,AST,SX,-4\">America/Lower_Princes</option><option value=\"America/Maceio\" data-geo=\"-9.66667,-35.71667,-03,BR,-3\">America/Maceio</option><option value=\"America/Managua\" data-geo=\"12.15,-86.28334,CST,NI,-6\">America/Managua</option><option value=\"America/Manaus\" data-geo=\"-3.13334,-60.01667,-04,BR,-4\">America/Manaus</option><option value=\"America/Marigot\" data-geo=\"18.06666,-63.08334,AST,MF,-4\">America/Marigot</option><option value=\"America/Martinique\" data-geo=\"14.6,-61.08334,AST,MQ,-4\">America/Martinique</option><option value=\"America/Matamoros\" data-geo=\"25.83333,-97.5,CDT,MX,-6\">America/Matamoros</option><option value=\"America/Mazatlan\" data-geo=\"23.21666,-106.41667,MDT,MX,-7\">America/Mazatlan</option><option value=\"America/Menominee\" data-geo=\"45.10777,-87.61417,CDT,US,-6\">America/Menominee</option><option value=\"America/Merida\" data-geo=\"20.96666,-89.61667,CDT,MX,-6\">America/Merida</option><option value=\"America/Metlakatla\" data-geo=\"55.12694,-131.57639,AKDT,US,-8\">America/Metlakatla</option><option value=\"America/Mexico_City\" data-geo=\"19.4,-99.15001,CDT,MX,-6\">America/Mexico_City</option><option value=\"America/Miquelon\" data-geo=\"47.05,-56.33334,-02,PM,-3\">America/Miquelon</option><option value=\"America/Moncton\" data-geo=\"46.1,-64.78334,ADT,CA,-4\">America/Moncton</option><option value=\"America/Monterrey\" data-geo=\"25.66666,-100.31667,CDT,MX,-6\">America/Monterrey</option><option value=\"America/Montevideo\" data-geo=\"-34.88334,-56.18334,-03,UY,-2\">America/Montevideo</option><option value=\"America/Montreal\" data-geo=\"45.51666,-73.56667,UTC,??,-5\">America/Montreal</option><option value=\"America/Montserrat\" data-geo=\"16.71666,-62.21667,AST,MS,-4\">America/Montserrat</option><option value=\"America/Nassau\" data-geo=\"25.08333,-77.35,EDT,BS,-5\">America/Nassau</option><option value=\"America/New_York\" data-geo=\"40.71416,-74.00639,EDT,US,-5\">America/New_York</option><option value=\"America/Nipigon\" data-geo=\"49.01666,-88.26667,EDT,CA,-5\">America/Nipigon</option><option value=\"America/Nome\" data-geo=\"64.50111,-165.40639,AKDT,US,-9\">America/Nome</option><option value=\"America/Noronha\" data-geo=\"-3.85,-32.41667,-02,BR,-2\">America/Noronha</option><option value=\"America/North_Dakota/Beulah\" data-geo=\"47.26416,-101.77778,CDT,US,-6\">America/North_Dakota/Beulah</option><option value=\"America/North_Dakota/Center\" data-geo=\"47.11638,-101.29917,CDT,US,-6\">America/North_Dakota/Center</option><option value=\"America/North_Dakota/New_Salem\" data-geo=\"46.845,-101.41084,CDT,US,-6\">America/North_Dakota/New_Salem</option><option value=\"America/Ojinaga\" data-geo=\"29.56666,-104.41667,MDT,MX,-7\">America/Ojinaga</option><option value=\"America/Panama\" data-geo=\"8.96666,-79.53334,EST,PA,-5\">America/Panama</option><option value=\"America/Pangnirtung\" data-geo=\"66.13333,-65.73334,EDT,CA,-5\">America/Pangnirtung</option><option value=\"America/Paramaribo\" data-geo=\"5.83333,-55.16667,-03,SR,-3\">America/Paramaribo</option><option value=\"America/Phoenix\" data-geo=\"33.44833,-112.07334,MST,US,-7\">America/Phoenix</option><option value=\"America/Port-au-Prince\" data-geo=\"18.53333,-72.33334,EDT,HT,-5\">America/Port-au-Prince</option><option value=\"America/Port_of_Spain\" data-geo=\"10.65,-61.51667,AST,TT,-4\">America/Port_of_Spain</option><option value=\"America/Porto_Velho\" data-geo=\"-8.76667,-63.9,-04,BR,-4\">America/Porto_Velho</option><option value=\"America/Puerto_Rico\" data-geo=\"18.46833,-66.10612,AST,PR,-4\">America/Puerto_Rico</option><option value=\"America/Rainy_River\" data-geo=\"48.71666,-94.56667,CDT,CA,-6\">America/Rainy_River</option><option value=\"America/Rankin_Inlet\" data-geo=\"62.81666,-92.08306,CDT,CA,-6\">America/Rankin_Inlet</option><option value=\"America/Recife\" data-geo=\"-8.05,-34.9,-03,BR,-3\">America/Recife</option><option value=\"America/Regina\" data-geo=\"50.4,-104.65001,CST,CA,-6\">America/Regina</option><option value=\"America/Resolute\" data-geo=\"74.69555,-94.82917,CDT,CA,-6\">America/Resolute</option><option value=\"America/Rio_Branco\" data-geo=\"-9.96667,-67.8,-05,BR,-5\">America/Rio_Branco</option><option value=\"America/Santa_Isabel\" data-geo=\"30.3,-114.86667,UTC,MX,-8\">America/Santa_Isabel</option><option value=\"America/Santarem\" data-geo=\"-2.43334,-54.86667,-03,BR,-3\">America/Santarem</option><option value=\"America/Santiago\" data-geo=\"-33.45,-70.66667,-03,CL,-3\">America/Santiago</option><option value=\"America/Santo_Domingo\" data-geo=\"18.46666,-69.9,AST,DO,-4\">America/Santo_Domingo</option><option value=\"America/Sao_Paulo\" data-geo=\"-23.53334,-46.61667,-03,BR,-2\">America/Sao_Paulo</option><option value=\"America/Scoresbysund\" data-geo=\"70.48333,-21.96667,+00,GL,-1\">America/Scoresbysund</option><option value=\"America/Shiprock\" data-geo=\"36.78555,-108.68639,UTC,??,-7\">America/Shiprock</option><option value=\"America/Sitka\" data-geo=\"57.17638,-135.30195,AKDT,US,-9\">America/Sitka</option><option value=\"America/St_Barthelemy\" data-geo=\"17.88333,-62.85,AST,BL,-4\">America/St_Barthelemy</option><option value=\"America/St_Johns\" data-geo=\"47.56666,-52.71667,NDT,CA,-3.5\">America/St_Johns</option><option value=\"America/St_Kitts\" data-geo=\"17.3,-62.71667,AST,KN,-4\">America/St_Kitts</option><option value=\"America/St_Lucia\" data-geo=\"14.01666,-61,AST,LC,-4\">America/St_Lucia</option><option value=\"America/St_Thomas\" data-geo=\"18.35,-64.93334,AST,VI,-4\">America/St_Thomas</option><option value=\"America/St_Vincent\" data-geo=\"13.15,-61.23334,AST,VC,-4\">America/St_Vincent</option><option value=\"America/Swift_Current\" data-geo=\"50.28333,-107.83334,CST,CA,-6\">America/Swift_Current</option><option value=\"America/Tegucigalpa\" data-geo=\"14.1,-87.21667,CST,HN,-6\">America/Tegucigalpa</option><option value=\"America/Thule\" data-geo=\"76.56666,-68.78334,ADT,GL,-4\">America/Thule</option><option value=\"America/Thunder_Bay\" data-geo=\"48.38333,-89.25,EDT,CA,-5\">America/Thunder_Bay</option><option value=\"America/Tijuana\" data-geo=\"32.53333,-117.01667,PDT,MX,-8\">America/Tijuana</option><option value=\"America/Toronto\" data-geo=\"43.65,-79.38334,EDT,CA,-5\">America/Toronto</option><option value=\"America/Tortola\" data-geo=\"18.45,-64.61667,AST,VG,-4\">America/Tortola</option><option value=\"America/Vancouver\" data-geo=\"49.26666,-123.11667,PDT,CA,-8\">America/Vancouver</option><option value=\"America/Whitehorse\" data-geo=\"60.71666,-135.05001,PDT,CA,-8\">America/Whitehorse</option><option value=\"America/Winnipeg\" data-geo=\"49.88333,-97.15001,CDT,CA,-6\">America/Winnipeg</option><option value=\"America/Yakutat\" data-geo=\"59.54694,-139.72723,AKDT,US,-9\">America/Yakutat</option><option value=\"America/Yellowknife\" data-geo=\"62.44999,-114.35,MDT,CA,-7\">America/Yellowknife</option><option value=\"Antarctica/Casey\" data-geo=\"-66.28334,110.51666,+08,AQ,+8\">Antarctica/Casey</option><option value=\"Antarctica/Davis\" data-geo=\"-68.58334,77.96666,+07,AQ,+7\">Antarctica/Davis</option><option value=\"Antarctica/DumontDUrville\" data-geo=\"-66.66667,140.01666,+10,AQ,+10\">Antarctica/DumontDUrville</option><option value=\"Antarctica/Macquarie\" data-geo=\"-54.5,158.95,+11,AU,+11\">Antarctica/Macquarie</option><option value=\"Antarctica/Mawson\" data-geo=\"-67.6,62.88333,+05,AQ,+5\">Antarctica/Mawson</option><option value=\"Antarctica/McMurdo\" data-geo=\"-77.83334,166.6,NZST,AQ,+13\">Antarctica/McMurdo</option><option value=\"Antarctica/Palmer\" data-geo=\"-64.8,-64.1,-03,AQ,-3\">Antarctica/Palmer</option><option value=\"Antarctica/Rothera\" data-geo=\"-67.56667,-68.13334,-03,AQ,-3\">Antarctica/Rothera</option><option value=\"Antarctica/South_Pole\" data-geo=\"-90,0,UTC,??,+13\">Antarctica/South_Pole</option><option value=\"Antarctica/Syowa\" data-geo=\"-69.00612,39.59,+03,AQ,+3\">Antarctica/Syowa</option><option value=\"Antarctica/Vostok\" data-geo=\"-78.40001,106.89999,+06,AQ,+6\">Antarctica/Vostok</option><option value=\"Arctic/Longyearbyen\" data-geo=\"78,16,CEST,SJ,+1\">Arctic/Longyearbyen</option><option value=\"Asia/Aden\" data-geo=\"12.75,45.2,+03,YE,+3\">Asia/Aden</option><option value=\"Asia/Almaty\" data-geo=\"43.25,76.95,+06,KZ,+6\">Asia/Almaty</option><option value=\"Asia/Amman\" data-geo=\"31.95,35.93333,EEST,JO,+2\">Asia/Amman</option><option value=\"Asia/Anadyr\" data-geo=\"64.75,177.48333,+12,RU,+12\">Asia/Anadyr</option><option value=\"Asia/Aqtau\" data-geo=\"44.51666,50.26666,+05,KZ,+5\">Asia/Aqtau</option><option value=\"Asia/Aqtobe\" data-geo=\"50.28333,57.16666,+05,KZ,+5\">Asia/Aqtobe</option><option value=\"Asia/Ashgabat\" data-geo=\"37.95,58.38333,+05,TM,+5\">Asia/Ashgabat</option><option value=\"Asia/Baghdad\" data-geo=\"33.35,44.41666,+03,IQ,+3\">Asia/Baghdad</option><option value=\"Asia/Bahrain\" data-geo=\"26.38333,50.58333,+03,BH,+3\">Asia/Bahrain</option><option value=\"Asia/Baku\" data-geo=\"40.38333,49.85,+04,AZ,+4\">Asia/Baku</option><option value=\"Asia/Bangkok\" data-geo=\"13.75,100.51666,+07,TH,+7\">Asia/Bangkok</option><option value=\"Asia/Beirut\" data-geo=\"33.88333,35.5,EEST,LB,+2\">Asia/Beirut</option><option value=\"Asia/Bishkek\" data-geo=\"42.9,74.6,+06,KG,+6\">Asia/Bishkek</option><option value=\"Asia/Brunei\" data-geo=\"4.93333,114.91666,+08,BN,+8\">Asia/Brunei</option><option value=\"Asia/Choibalsan\" data-geo=\"48.06666,114.5,+08,MN,+8\">Asia/Choibalsan</option><option value=\"Asia/Chongqing\" data-geo=\"29.56666,106.58333,UTC,??,+8\">Asia/Chongqing</option><option value=\"Asia/Colombo\" data-geo=\"6.93333,79.85,+0530,LK,+5.5\">Asia/Colombo</option><option value=\"Asia/Damascus\" data-geo=\"33.5,36.3,EEST,SY,+2\">Asia/Damascus</option><option value=\"Asia/Dhaka\" data-geo=\"23.71666,90.41666,+06,BD,+6\">Asia/Dhaka</option><option value=\"Asia/Dili\" data-geo=\"-8.55,125.58333,+09,TL,+9\">Asia/Dili</option><option value=\"Asia/Dubai\" data-geo=\"25.3,55.3,+04,AE,+4\">Asia/Dubai</option><option value=\"Asia/Dushanbe\" data-geo=\"38.58333,68.8,+05,TJ,+5\">Asia/Dushanbe</option><option value=\"Asia/Gaza\" data-geo=\"31.5,34.46666,EEST,PS,+2\">Asia/Gaza</option><option value=\"Asia/Harbin\" data-geo=\"45.75,126.68333,UTC,??,+8\">Asia/Harbin</option><option value=\"Asia/Hebron\" data-geo=\"31.53333,35.095,EEST,PS,+2\">Asia/Hebron</option><option value=\"Asia/Ho_Chi_Minh\" data-geo=\"10.75,106.66666,+07,VN,+7\">Asia/Ho_Chi_Minh</option><option value=\"Asia/Hong_Kong\" data-geo=\"22.28333,114.14999,HKT,HK,+8\">Asia/Hong_Kong</option><option value=\"Asia/Hovd\" data-geo=\"48.01666,91.64999,+07,MN,+7\">Asia/Hovd</option><option value=\"Asia/Irkutsk\" data-geo=\"52.26666,104.33333,+08,RU,+8\">Asia/Irkutsk</option><option value=\"Asia/Jakarta\" data-geo=\"-6.16667,106.8,WIB,ID,+7\">Asia/Jakarta</option><option value=\"Asia/Jayapura\" data-geo=\"-2.53334,140.7,WIT,ID,+9\">Asia/Jayapura</option><option value=\"Asia/Jerusalem\" data-geo=\"31.76666,35.23333,IDT,IL,+2\">Asia/Jerusalem</option><option value=\"Asia/Kabul\" data-geo=\"34.51666,69.2,+0430,AF,+4.5\">Asia/Kabul</option><option value=\"Asia/Kamchatka\" data-geo=\"53.01666,158.65,+12,RU,+12\">Asia/Kamchatka</option><option value=\"Asia/Karachi\" data-geo=\"24.86666,67.05,PKT,PK,+5\">Asia/Karachi</option><option value=\"Asia/Kashgar\" data-geo=\"39.48333,75.98333,UTC,??,+6\">Asia/Kashgar</option><option value=\"Asia/Kathmandu\" data-geo=\"27.71666,85.31666,+0545,NP,+5.75\">Asia/Kathmandu</option><option value=\"Asia/Kolkata\" data-geo=\"22.53333,88.36666,IST,IN,+5.5\">Asia/Kolkata</option><option value=\"Asia/Krasnoyarsk\" data-geo=\"56.01666,92.83333,+07,RU,+7\">Asia/Krasnoyarsk</option><option value=\"Asia/Kuala_Lumpur\" data-geo=\"3.16666,101.7,+08,MY,+8\">Asia/Kuala_Lumpur</option><option value=\"Asia/Kuching\" data-geo=\"1.55,110.33333,+08,MY,+8\">Asia/Kuching</option><option value=\"Asia/Kuwait\" data-geo=\"29.33333,47.98333,+03,KW,+3\">Asia/Kuwait</option><option value=\"Asia/Macau\" data-geo=\"22.23333,113.58333,CST,MO,+8\">Asia/Macau</option><option value=\"Asia/Magadan\" data-geo=\"59.56666,150.8,+11,RU,+10\">Asia/Magadan</option><option value=\"Asia/Makassar\" data-geo=\"-5.11667,119.39999,WITA,ID,+8\">Asia/Makassar</option><option value=\"Asia/Manila\" data-geo=\"14.58333,121,PST,PH,+8\">Asia/Manila</option><option value=\"Asia/Muscat\" data-geo=\"23.6,58.58333,+04,OM,+4\">Asia/Muscat</option><option value=\"Asia/Nicosia\" data-geo=\"35.16666,33.36666,EEST,CY,+2\">Asia/Nicosia</option><option value=\"Asia/Novokuznetsk\" data-geo=\"53.75,87.11666,+07,RU,+7\">Asia/Novokuznetsk</option><option value=\"Asia/Novosibirsk\" data-geo=\"55.03333,82.91666,+07,RU,+6\">Asia/Novosibirsk</option><option value=\"Asia/Omsk\" data-geo=\"55,73.4,+06,RU,+6\">Asia/Omsk</option><option value=\"Asia/Oral\" data-geo=\"51.21666,51.35,+05,KZ,+5\">Asia/Oral</option><option value=\"Asia/Phnom_Penh\" data-geo=\"11.55,104.91666,+07,KH,+7\">Asia/Phnom_Penh</option><option value=\"Asia/Pontianak\" data-geo=\"-0.03334,109.33333,WIB,ID,+7\">Asia/Pontianak</option><option value=\"Asia/Pyongyang\" data-geo=\"39.01666,125.75,KST,KP,+9\">Asia/Pyongyang</option><option value=\"Asia/Qatar\" data-geo=\"25.28333,51.53333,+03,QA,+3\">Asia/Qatar</option><option value=\"Asia/Qyzylorda\" data-geo=\"44.8,65.46666,+05,KZ,+6\">Asia/Qyzylorda</option><option value=\"Asia/Rangoon\" data-geo=\"16.78333,96.16666,UTC,MM,+6.5\">Asia/Rangoon</option><option value=\"Asia/Riyadh\" data-geo=\"24.63333,46.71666,+03,SA,+3\">Asia/Riyadh</option><option value=\"Asia/Sakhalin\" data-geo=\"46.96666,142.7,+11,RU,+10\">Asia/Sakhalin</option><option value=\"Asia/Samarkand\" data-geo=\"39.66666,66.8,+05,UZ,+5\">Asia/Samarkand</option><option value=\"Asia/Seoul\" data-geo=\"37.55,126.96666,KST,KR,+9\">Asia/Seoul</option><option value=\"Asia/Shanghai\" data-geo=\"31.23333,121.46666,CST,CN,+8\">Asia/Shanghai</option><option value=\"Asia/Singapore\" data-geo=\"1.28333,103.85,+08,SG,+8\">Asia/Singapore</option><option value=\"Asia/Taipei\" data-geo=\"25.05,121.5,CST,TW,+8\">Asia/Taipei</option><option value=\"Asia/Tashkent\" data-geo=\"41.33333,69.3,+05,UZ,+5\">Asia/Tashkent</option><option value=\"Asia/Tbilisi\" data-geo=\"41.71666,44.81666,+04,GE,+4\">Asia/Tbilisi</option><option value=\"Asia/Tehran\" data-geo=\"35.66666,51.43333,+0430,IR,+3.5\">Asia/Tehran</option><option value=\"Asia/Thimphu\" data-geo=\"27.46666,89.64999,+06,BT,+6\">Asia/Thimphu</option><option value=\"Asia/Tokyo\" data-geo=\"35.65444,139.74472,JST,JP,+9\">Asia/Tokyo</option><option value=\"Asia/Ulaanbaatar\" data-geo=\"47.91666,106.88333,+08,MN,+8\">Asia/Ulaanbaatar</option><option value=\"Asia/Urumqi\" data-geo=\"43.8,87.58333,+06,CN,+6\">Asia/Urumqi</option><option value=\"Asia/Vientiane\" data-geo=\"17.96666,102.6,+07,LA,+7\">Asia/Vientiane</option><option value=\"Asia/Vladivostok\" data-geo=\"43.16666,131.93333,+10,RU,+10\">Asia/Vladivostok</option><option value=\"Asia/Yakutsk\" data-geo=\"62,129.66666,+09,RU,+9\">Asia/Yakutsk</option><option value=\"Asia/Yekaterinburg\" data-geo=\"56.85,60.6,+05,RU,+5\">Asia/Yekaterinburg</option><option value=\"Asia/Yerevan\" data-geo=\"40.18333,44.5,+04,AM,+4\">Asia/Yerevan</option><option value=\"Atlantic/Azores\" data-geo=\"37.73333,-25.66667,+00,PT,-1\">Atlantic/Azores</option><option value=\"Atlantic/Bermuda\" data-geo=\"32.28333,-64.76667,ADT,BM,-4\">Atlantic/Bermuda</option><option value=\"Atlantic/Canary\" data-geo=\"28.1,-15.4,WEST,ES,+0\">Atlantic/Canary</option><option value=\"Atlantic/Cape_Verde\" data-geo=\"14.91666,-23.51667,-01,CV,-1\">Atlantic/Cape_Verde</option><option value=\"Atlantic/Faroe\" data-geo=\"62.01666,-6.76667,WEST,FO,+0\">Atlantic/Faroe</option><option value=\"Atlantic/Madeira\" data-geo=\"32.63333,-16.9,WEST,PT,+0\">Atlantic/Madeira</option><option value=\"Atlantic/Reykjavik\" data-geo=\"64.15,-21.85,GMT,IS,+0\">Atlantic/Reykjavik</option><option value=\"Atlantic/South_Georgia\" data-geo=\"-54.26667,-36.53334,-02,GS,-2\">Atlantic/South_Georgia</option><option value=\"Atlantic/St_Helena\" data-geo=\"-15.91667,-5.7,GMT,SH,+0\">Atlantic/St_Helena</option><option value=\"Atlantic/Stanley\" data-geo=\"-51.70001,-57.85,-03,FK,-3\">Atlantic/Stanley</option><option value=\"Australia/Adelaide\" data-geo=\"-34.91667,138.58333,ACST,AU,+10.5\">Australia/Adelaide</option><option value=\"Australia/Brisbane\" data-geo=\"-27.46667,153.03333,AEST,AU,+10\">Australia/Brisbane</option><option value=\"Australia/Broken_Hill\" data-geo=\"-31.95,141.45,ACST,AU,+10.5\">Australia/Broken_Hill</option><option value=\"Australia/Currie\" data-geo=\"-39.93334,143.86666,AEST,AU,+11\">Australia/Currie</option><option value=\"Australia/Darwin\" data-geo=\"-12.46667,130.83333,ACST,AU,+9.5\">Australia/Darwin</option><option value=\"Australia/Eucla\" data-geo=\"-31.71667,128.86666,+0845,AU,+8.75\">Australia/Eucla</option><option value=\"Australia/Hobart\" data-geo=\"-42.88334,147.31666,AEST,AU,+11\">Australia/Hobart</option><option value=\"Australia/Lindeman\" data-geo=\"-20.26667,149,AEST,AU,+10\">Australia/Lindeman</option><option value=\"Australia/Lord_Howe\" data-geo=\"-31.55,159.08333,+1030,AU,+11\">Australia/Lord_Howe</option><option value=\"Australia/Melbourne\" data-geo=\"-37.81667,144.96666,AEST,AU,+11\">Australia/Melbourne</option><option value=\"Australia/Sydney\" data-geo=\"-33.86667,151.21666,AEST,AU,+11\">Australia/Sydney</option><option value=\"Europe/Amsterdam\" data-geo=\"52.36666,4.9,CEST,NL,+1\">Europe/Amsterdam</option><option value=\"Europe/Andorra\" data-geo=\"42.5,1.51666,CEST,AD,+1\">Europe/Andorra</option><option value=\"Europe/Athens\" data-geo=\"37.96666,23.71666,EEST,GR,+2\">Europe/Athens</option><option value=\"Europe/Belgrade\" data-geo=\"44.83333,20.5,CEST,RS,+1\">Europe/Belgrade</option><option value=\"Europe/Berlin\" data-geo=\"52.5,13.36666,CEST,DE,+1\">Europe/Berlin</option><option value=\"Europe/Bratislava\" data-geo=\"48.15,17.11666,CEST,SK,+1\">Europe/Bratislava</option><option value=\"Europe/Brussels\" data-geo=\"50.83333,4.33333,CEST,BE,+1\">Europe/Brussels</option><option value=\"Europe/Bucharest\" data-geo=\"44.43333,26.1,EEST,RO,+2\">Europe/Bucharest</option><option value=\"Europe/Budapest\" data-geo=\"47.5,19.08333,CEST,HU,+1\">Europe/Budapest</option><option value=\"Europe/Chisinau\" data-geo=\"47,28.83333,EEST,MD,+2\">Europe/Chisinau</option><option value=\"Europe/Copenhagen\" data-geo=\"55.66666,12.58333,CEST,DK,+1\">Europe/Copenhagen</option><option value=\"Europe/Dublin\" data-geo=\"53.33333,-6.25,IST,IE,+0\">Europe/Dublin</option><option value=\"Europe/Gibraltar\" data-geo=\"36.13333,-5.35,CEST,GI,+1\">Europe/Gibraltar</option><option value=\"Europe/Guernsey\" data-geo=\"49.44999,-2.53334,BST,GG,+0\">Europe/Guernsey</option><option value=\"Europe/Helsinki\" data-geo=\"60.16666,24.96666,EEST,FI,+2\">Europe/Helsinki</option><option value=\"Europe/Isle_of_Man\" data-geo=\"54.15,-4.46667,BST,IM,+0\">Europe/Isle_of_Man</option><option value=\"Europe/Istanbul\" data-geo=\"41.01666,28.96666,+03,TR,+2\">Europe/Istanbul</option><option value=\"Europe/Jersey\" data-geo=\"49.19999,-2.11667,BST,JE,+0\">Europe/Jersey</option><option value=\"Europe/Kaliningrad\" data-geo=\"54.71666,20.5,EET,RU,+2\">Europe/Kaliningrad</option><option value=\"Europe/Kiev\" data-geo=\"50.43333,30.51666,EEST,UA,+2\">Europe/Kiev</option><option value=\"Europe/Lisbon\" data-geo=\"38.71666,-9.13334,WEST,PT,+0\">Europe/Lisbon</option><option value=\"Europe/Ljubljana\" data-geo=\"46.05,14.51666,CEST,SI,+1\">Europe/Ljubljana</option><option value=\"Europe/Luxembourg\" data-geo=\"49.6,6.15,CEST,LU,+1\">Europe/Luxembourg</option><option value=\"Europe/Madrid\" data-geo=\"40.4,-3.68334,CEST,ES,+1\">Europe/Madrid</option><option value=\"Europe/Malta\" data-geo=\"35.9,14.51666,CEST,MT,+1\">Europe/Malta</option><option value=\"Europe/Mariehamn\" data-geo=\"60.1,19.95,EEST,AX,+2\">Europe/Mariehamn</option><option value=\"Europe/Minsk\" data-geo=\"53.9,27.56666,+03,BY,+3\">Europe/Minsk</option><option value=\"Europe/Monaco\" data-geo=\"43.69999,7.38333,CEST,MC,+1\">Europe/Monaco</option><option value=\"Europe/Moscow\" data-geo=\"55.75,37.58333,MSK,RU,+3\">Europe/Moscow</option><option value=\"Europe/Oslo\" data-geo=\"59.91666,10.75,CEST,NO,+1\">Europe/Oslo</option><option value=\"Europe/Paris\" data-geo=\"48.86666,2.33333,CEST,FR,+1\">Europe/Paris</option><option value=\"Europe/Podgorica\" data-geo=\"42.43333,19.26666,CEST,ME,+1\">Europe/Podgorica</option><option value=\"Europe/Prague\" data-geo=\"50.08333,14.43333,CEST,CZ,+1\">Europe/Prague</option><option value=\"Europe/Riga\" data-geo=\"56.94999,24.1,EEST,LV,+2\">Europe/Riga</option><option value=\"Europe/Rome\" data-geo=\"41.9,12.48333,CEST,IT,+1\">Europe/Rome</option><option value=\"Europe/Samara\" data-geo=\"53.19999,50.15,+04,RU,+4\">Europe/Samara</option><option value=\"Europe/San_Marino\" data-geo=\"43.91666,12.46666,CEST,SM,+1\">Europe/San_Marino</option><option value=\"Europe/Sarajevo\" data-geo=\"43.86666,18.41666,CEST,BA,+1\">Europe/Sarajevo</option><option value=\"Europe/Simferopol\" data-geo=\"44.94999,34.1,MSK,RU,+3\">Europe/Simferopol</option><option value=\"Europe/Skopje\" data-geo=\"41.98333,21.43333,CEST,MK,+1\">Europe/Skopje</option><option value=\"Europe/Sofia\" data-geo=\"42.68333,23.31666,EEST,BG,+2\">Europe/Sofia</option><option value=\"Europe/Stockholm\" data-geo=\"59.33333,18.05,CEST,SE,+1\">Europe/Stockholm</option><option value=\"Europe/Tallinn\" data-geo=\"59.41666,24.75,EEST,EE,+2\">Europe/Tallinn</option><option value=\"Europe/Tirane\" data-geo=\"41.33333,19.83333,CEST,AL,+1\">Europe/Tirane</option><option value=\"Europe/Uzhgorod\" data-geo=\"48.61666,22.3,EEST,UA,+2\">Europe/Uzhgorod</option><option value=\"Europe/Vaduz\" data-geo=\"47.15,9.51666,CEST,LI,+1\">Europe/Vaduz</option><option value=\"Europe/Vatican\" data-geo=\"41.90222,12.45305,CEST,VA,+1\">Europe/Vatican</option><option value=\"Europe/Vienna\" data-geo=\"48.21666,16.33333,CEST,AT,+1\">Europe/Vienna</option><option value=\"Europe/Vilnius\" data-geo=\"54.68333,25.31666,EEST,LT,+2\">Europe/Vilnius</option><option value=\"Europe/Volgograd\" data-geo=\"48.73333,44.41666,+04,RU,+3\">Europe/Volgograd</option><option value=\"Europe/Warsaw\" data-geo=\"52.25,21,CEST,PL,+1\">Europe/Warsaw</option><option value=\"Europe/Zagreb\" data-geo=\"45.8,15.96666,CEST,HR,+1\">Europe/Zagreb</option><option value=\"Europe/Zaporozhye\" data-geo=\"47.83333,35.16666,EEST,UA,+2\">Europe/Zaporozhye</option><option value=\"Europe/Zurich\" data-geo=\"47.38333,8.53333,CEST,CH,+1\">Europe/Zurich</option><option value=\"Indian/Antananarivo\" data-geo=\"-18.91667,47.51666,EAT,MG,+3\">Indian/Antananarivo</option><option value=\"Indian/Chagos\" data-geo=\"-7.33334,72.41666,+06,IO,+6\">Indian/Chagos</option><option value=\"Indian/Christmas\" data-geo=\"-10.41667,105.71666,+07,CX,+7\">Indian/Christmas</option><option value=\"Indian/Cocos\" data-geo=\"-12.16667,96.91666,+0630,CC,+6.5\">Indian/Cocos</option><option value=\"Indian/Comoro\" data-geo=\"-11.68334,43.26666,EAT,KM,+3\">Indian/Comoro</option><option value=\"Indian/Kerguelen\" data-geo=\"-49.35278,70.2175,+05,TF,+5\">Indian/Kerguelen</option><option value=\"Indian/Mahe\" data-geo=\"-4.66667,55.46666,+04,SC,+4\">Indian/Mahe</option><option value=\"Indian/Maldives\" data-geo=\"4.16666,73.5,+05,MV,+5\">Indian/Maldives</option><option value=\"Indian/Mauritius\" data-geo=\"-20.16667,57.5,+04,MU,+4\">Indian/Mauritius</option><option value=\"Indian/Mayotte\" data-geo=\"-12.78334,45.23333,EAT,YT,+3\">Indian/Mayotte</option><option value=\"Indian/Reunion\" data-geo=\"-20.86667,55.46666,+04,RE,+4\">Indian/Reunion</option><option value=\"Pacific/Apia\" data-geo=\"-13.83334,-171.73334,+13,WS,+14\">Pacific/Apia</option><option value=\"Pacific/Auckland\" data-geo=\"-36.86667,174.76666,NZST,NZ,+13\">Pacific/Auckland</option><option value=\"Pacific/Chatham\" data-geo=\"-43.95,-176.55001,+1245,NZ,+13.75\">Pacific/Chatham</option><option value=\"Pacific/Chuuk\" data-geo=\"7.41666,151.78333,+10,FM,+10\">Pacific/Chuuk</option><option value=\"Pacific/Easter\" data-geo=\"-27.15,-109.43334,-05,CL,-5\">Pacific/Easter</option><option value=\"Pacific/Efate\" data-geo=\"-17.66667,168.41666,+11,VU,+11\">Pacific/Efate</option><option value=\"Pacific/Enderbury\" data-geo=\"-3.13334,-171.08334,+13,KI,+13\">Pacific/Enderbury</option><option value=\"Pacific/Fakaofo\" data-geo=\"-9.36667,-171.23334,+13,TK,+13\">Pacific/Fakaofo</option><option value=\"Pacific/Fiji\" data-geo=\"-18.13334,178.41666,+12,FJ,+13\">Pacific/Fiji</option><option value=\"Pacific/Funafuti\" data-geo=\"-8.51667,179.21666,+12,TV,+12\">Pacific/Funafuti</option><option value=\"Pacific/Galapagos\" data-geo=\"-0.9,-89.6,-06,EC,-6\">Pacific/Galapagos</option><option value=\"Pacific/Gambier\" data-geo=\"-23.13334,-134.95,-09,PF,-9\">Pacific/Gambier</option><option value=\"Pacific/Guadalcanal\" data-geo=\"-9.53334,160.2,+11,SB,+11\">Pacific/Guadalcanal</option><option value=\"Pacific/Guam\" data-geo=\"13.46666,144.75,ChST,GU,+10\">Pacific/Guam</option><option value=\"Pacific/Honolulu\" data-geo=\"21.30694,-157.85834,HST,US,-10\">Pacific/Honolulu</option><option value=\"Pacific/Johnston\" data-geo=\"16.75,-169.51667,UTC,UM,-10\">Pacific/Johnston</option><option value=\"Pacific/Kiritimati\" data-geo=\"1.86666,-157.33334,+14,KI,+14\">Pacific/Kiritimati</option><option value=\"Pacific/Kosrae\" data-geo=\"5.31666,162.98333,+11,FM,+11\">Pacific/Kosrae</option><option value=\"Pacific/Kwajalein\" data-geo=\"9.08333,167.33333,+12,MH,+12\">Pacific/Kwajalein</option><option value=\"Pacific/Majuro\" data-geo=\"7.15,171.2,+12,MH,+12\">Pacific/Majuro</option><option value=\"Pacific/Marquesas\" data-geo=\"-9,-139.5,-0930,PF,-9.5\">Pacific/Marquesas</option><option value=\"Pacific/Midway\" data-geo=\"28.21666,-177.36667,SST,UM,-11\">Pacific/Midway</option><option value=\"Pacific/Nauru\" data-geo=\"-0.51667,166.91666,+12,NR,+12\">Pacific/Nauru</option><option value=\"Pacific/Niue\" data-geo=\"-19.01667,-169.91667,-11,NU,-11\">Pacific/Niue</option><option value=\"Pacific/Norfolk\" data-geo=\"-29.05,167.96666,+11,NF,+11.5\">Pacific/Norfolk</option><option value=\"Pacific/Noumea\" data-geo=\"-22.26667,166.45,+11,NC,+11\">Pacific/Noumea</option><option value=\"Pacific/Pago_Pago\" data-geo=\"-14.26667,-170.7,SST,AS,-11\">Pacific/Pago_Pago</option><option value=\"Pacific/Palau\" data-geo=\"7.33333,134.48333,+09,PW,+9\">Pacific/Palau</option><option value=\"Pacific/Pitcairn\" data-geo=\"-25.06667,-130.08334,-08,PN,-8\">Pacific/Pitcairn</option><option value=\"Pacific/Pohnpei\" data-geo=\"6.96666,158.21666,+11,FM,+11\">Pacific/Pohnpei</option><option value=\"Pacific/Port_Moresby\" data-geo=\"-9.5,147.16666,+10,PG,+10\">Pacific/Port_Moresby</option><option value=\"Pacific/Rarotonga\" data-geo=\"-21.23334,-159.76667,-10,CK,-10\">Pacific/Rarotonga</option><option value=\"Pacific/Saipan\" data-geo=\"15.2,145.75,ChST,MP,+10\">Pacific/Saipan</option><option value=\"Pacific/Tahiti\" data-geo=\"-17.53334,-149.56667,-10,PF,-10\">Pacific/Tahiti</option><option value=\"Pacific/Tarawa\" data-geo=\"1.41666,173,+12,KI,+12\">Pacific/Tarawa</option><option value=\"Pacific/Tongatapu\" data-geo=\"-21.16667,-175.16667,+13,TO,+13\">Pacific/Tongatapu</option><option value=\"Pacific/Wake\" data-geo=\"19.28333,166.61666,+12,UM,+12\">Pacific/Wake</option><option value=\"Pacific/Wallis\" data-geo=\"-13.3,-176.16667,+12,WF,+12\">Pacific/Wallis</option><option value=\"Australia/Perth\" data-geo=\"-31.95,115.85,AWST,AU,+8\">Australia/Perth</option><option value=\"Antarctica/Troll\" data-geo=\"-72.01139,2.535,+02,AQ,+0\">Antarctica/Troll</option><option value=\"Asia/Chita\" data-geo=\"52.05,113.46666,+09,RU,+8\">Asia/Chita</option><option value=\"Asia/Khandyga\" data-geo=\"62.65638,135.55388,+09,RU,+9\">Asia/Khandyga</option><option value=\"Asia/Srednekolymsk\" data-geo=\"67.46666,153.71666,+11,RU,+11\">Asia/Srednekolymsk</option><option value=\"Asia/Ust-Nera\" data-geo=\"64.56027,143.22666,+10,RU,+10\">Asia/Ust-Nera</option><option value=\"Europe/Busingen\" data-geo=\"47.69999,8.68333,CEST,DE,+1\">Europe/Busingen</option><option value=\"Pacific/Bougainville\" data-geo=\"-6.21667,155.56666,+11,PG,+11\">Pacific/Bougainville</option><option value=\"America/Fort_Nelson\" data-geo=\"58.8,-122.7,MST\">America/Fort_Nelson</option><option value=\"Asia/Atyrau\" data-geo=\"47.11666,51.93333,+05\">Asia/Atyrau</option><option value=\"Asia/Barnaul\" data-geo=\"53.36666,83.75,+07\">Asia/Barnaul</option><option value=\"Asia/Famagusta\" data-geo=\"35.11666,33.95,EEST\">Asia/Famagusta</option><option value=\"Asia/Tomsk\" data-geo=\"56.5,84.96666,+07\">Asia/Tomsk</option><option value=\"Europe/London\" data-geo=\"51.5074,-0.1278,BST,GB,+0\">Europe/London</option>';
  var rivers='', arivers=[], iguess=-1, isofar=' ', jscore=0, jgoes=0, elema=null, contexta=null, rectisleft=0, rectistop=0;
  var populations='', apopulations=[], jguess=-1, jsofar=' ', isokto=true, both=false, jlastn='', idone=false;
  
  function onl() {
    if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) document.getElementById('srivs').innerHTML='';
    if (izoom != 1.0) document.body.style.zoom=('' + eval(izoom * 100.0) + '%');
    elem = document.getElementById('mycanvas');
    elem.style.cursor='progress';
    elema = document.getElementById('myacanvas');
    context = elem.getContext('2d');
    contexta = elema.getContext('2d');
    context.strokeStyle = '#000000';
    context.lineWidth = 0.4;
  }
  
";

$midbit="  

  const confirm = (cblurb) => {
    if (cblurb.indexOf('Answer was ') != -1 && cblurb.indexOf('. ') != -1) {
      var resp=prompt(cblurb.replace(cblurb.split('Answer was ')[1].split('. ')[0] + '. ', cblurb.split('Answer was ')[1].split('. ')[0] + ' (answer W to see more information on Wikipedia). '), '');
      if (resp != null) {
        if (resp.toLowerCase() == 'w') {
         window.open('//en.wikipedia.org/wiki/' + cblurb.split('Answer was ')[1].split('. ')[0].replace(/\ /g,'_'), '_blank', 'top=70,left=70,width=650,height=650');
         return true;
        }
        return true;
      } else {
        return false;
      }
    }
    return window.confirm(cblurb);
  };
   
  function ouralert(inclist) {
   if (inclist.indexOf(',') != -1) {
   var cls=inclist.replace('Longitude,Latitude coordinates are ','').split(',');
   longlastl=inclist;
   document.getElementById('ntz').value='';
   //document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent(cls[1]) + '&longitude=' + encodeURIComponent(cls[0]) + '&ntztontz=y'; 
   //setTimeout(lookforntz, 1000);
   }
  }
  
  function drawc(centerX, centerY) {
       var topllong=-180.0;
       var topllat=90.0;
       var onepixelequals=izoom;
    if (centerX > eval(izoom * elem.width) || centerY > eval(izoom * elem.height)) return false;
    context.beginPath();
    context.globalAlpha = 0.5;
    context.arc(centerX, centerY, 1, 0, 2 * Math.PI, false);
    context.fillStyle = 'green';
    context.fill();
    context.lineWidth = 5;
    context.lineWidth = 2;
    context.strokeStyle = '#003300';
    context.stroke();
    return true;
  }
  
  function callmap(inintzl) {
    var intzl=inintzl; 
    var thisplace=-1;
    var places=['', '', ''];
    var mapurl=\"//www.rjmprogramming.com.au/PHP/Map/map.php?title=Nearby%20TimeZone%20Places&onclick=y&label=['Lat',&value='Lon','Name']&data=,[\" + thislat + \",\" + thislong + \",~Your%20Place~]\";
    var tzs=['', '', ''];
    var lats=[0, 0, 0];
    var longs=[0, 0, 0];
    var ioff=0, joff=0;
    var wasp='';
    var prefix='';
    var tzls=intzl.split('/');
    if (eval('' + tzls.length) > 3) {
      for (var ih=0; ih<3; ih++) {
        if (tzls[eval(1 + ih + ioff)].indexOf(' ') == -1) {
        prefix='/' + tzls[eval(1 + ih + ioff)] + '/';
        joff++;
        } else {
        prefix='/';
        }
        thisplace=-1;
        while (tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != '.' && tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) != ' ') {
          wasp=prefix;
          prefix=tzls[eval(0 + ih + ioff)].slice(thisplace).substring(0,1) + wasp;
    //alert('IH=' + ih + ' and prefix=' + prefix + ' ' + tzls[eval(0 + ih + ioff)].slice(thisplace));
          thisplace--; 
        }
    //alert('ih=' + ih + ' and prefix=' + prefix);
        places[ih]=prefix;
        tzs[ih]=prefix;
        thisplace=1;
        ioff=joff;
        while (tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != '.' && tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1) != ' ') {
          places[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1);
          tzs[ih]+=tzls[eval(1 + ih + ioff)].substring(0,thisplace).slice(-1);
          thisplace++; 
        }
    //alert('ih=' + ih + ' and thisplace=' + thisplace + ' and tzs[]=' + tzs[eval(0 + ih)] + ' and yourtzlist=' + yourtzlist);
        if (tzls[eval(1 + ih + ioff)].indexOf(' is ') != -1) {
          places[ih]+=(' in ' + ('' + tzls[eval(1 + ih + ioff)].substring(thisplace).split(' is ')[0]).replace(' in ','').replace(' in ','').replace(' in ','').replace(' in ','')).replace(' in in ',' in ');
        }
        if (yourtzlist.indexOf(tzs[ih]) != -1) {
          mapurl+=',[' + yourtzlist.split(tzs[ih])[1].split('=')[1].split(',')[0].replace(String.fromCharCode(34),'') + ',' + yourtzlist.split(tzs[ih].replace(/America\!Argentina\//g, 'America/Argentina/'))[1].split('=')[1].split(',')[1].replace(String.fromCharCode(34),'') + ',~' + encodeURIComponent(places[ih].replace(/America\!Argentina\//g, 'America/Argentina/')) + '~]';
        }
      }
      if (mapwo) {
          if (!mapwo.closed) {
            mapwo.close();
            mapwo=null;
          }
          //alert(mapurl);
    var rectm=document.getElementById('mycanvas').getBoundingClientRect();
    document.getElementById('geomaps').style.position='absolute';
    document.getElementById('geomaps').style.left='0px';
    document.getElementById('geomaps').style.top='' + eval(50 + rectm.height) + 'px';
          document.getElementById('geomaps').style.display='block';
          document.getElementById('mapchart').style.display='block';
          document.getElementById('lpcwheel').style.width='500px';
          document.getElementById('pcwheel').style.width='' + eval(-520 + screen.width) + 'px';
          document.getElementById('mapchart').src=mapurl; //mapwo=window.open(mapurl, 'mapchart'); //, 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height));
      } else {
    var rectmm=document.getElementById('mycanvas').getBoundingClientRect();
    document.getElementById('geomaps').style.position='absolute';
    document.getElementById('geomaps').style.left='0px';
    document.getElementById('geomaps').style.top='' + eval(50 + rectmm.height) + 'px';
          document.getElementById('geomaps').style.display='block';
          document.getElementById('mapchart').style.display='block';
          document.getElementById('lpcwheel').style.width='500px';
          document.getElementById('pcwheel').style.width='' + eval(-520 + screen.width) + 'px';
          document.getElementById('mapchart').src=mapurl; //mapwo=window.open(mapurl, 'mapchart'); //, 'top=20,left=20,width=' + eval(-40 + screen.width) + ',height=' + eval(-40 + screen.height));
      }
    }
  }
  
  function withinit(abi) {
    var outi='';
    var putin=true;
    for (var ii=0; ii<abi.length; ii++) {
      if (abi.substring(ii).substring(0,1) == '<') {
        putin=false;
      } else if (abi.substring(ii).substring(0,1) == '>') {
        putin=true;
        if (outi != '') { outi+=' '; }
      } else if (putin) {
        outi+=abi.substring(ii).substring(0,1);
      }
    }
    return outi.replace('rror :', 'rror:');
  }
  
  function checkif(iois) {
    var morehuh=false;
    var what='', ourabi='';
    var ourl=lastl;
    var ourlong=longlastl;
    if (iois.src.indexOf('tz_places.php') != -1) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       ourabi='' + aconto.body.innerHTML;
       if (aconto.body != null) {
          lastl='';
          longlastl='';
          if (ourlong != '') {
          what=withinit(ourabi).replace(/\)/g,') ');
          if (what.indexOf('rror:') != -1) {
          alert(what + ' ' + ourlong);
          } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
          morehuh=confirm(what + '  See these on a map?  ' + ourlong);
          } else {
          morehuh=confirm(what + '  See these on a map?  ');
          }
          } else {
          what=withinit(ourabi).replace(/\)/g,') ');
          if (what.indexOf('rror:') != -1) {
          alert(what.replace(/\)/g,') ') + ' ' + ourl);
          } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
          morehuh=confirm(what.replace(/\)/g,') ') + '  See these on a map?  ' + ourl);
          } else {
          morehuh=confirm(what.replace(/\)/g,') ') + '  See these on a map?  ');
          }
          }
       }
    }
    }
    if (morehuh) {  callmap(what); }
  }
  
  function oldcanvasclick(e) {
       var topllong=-180.0;
       var topllat=90.0;
       var onepixelequals=izoom;
       //document.title='canvasclick';
       e = e || window.event;
       e.preventDefault();
       if (e.touches) {
       if (e.touches[0].pageX) {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals);
   drawc(e.touches[0].pageX, e.touches[0].pageY);
   thislat=eval(topllat - e.touches[0].pageY * onepixelequals);
   thislong=eval(topllong + e.touches[0].pageX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; 
       } else {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals);
   drawc(e.touches[0].clientX, e.touches[0].clientY);
   thislat=eval(topllat - e.touches[0].clientY * onepixelequals);
   thislong=eval(topllong + e.touches[0].clientX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; 
       }
       } else if (e.clientX || e.clientY) {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals);
   drawc(e.pageX, e.pageY);
   thislat=eval(topllat - e.pageY * onepixelequals);
   thislong=eval(topllong + e.pageX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; 
       } else {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals);
   drawc(e.clientX, e.clientY);
   thislat=eval(topllat - e.clientY * onepixelequals);
   thislong=eval(topllong + e.clientX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; 
       }
  }
  
  function canvasclick(e) {
       var topllong=-180.0;
       var topllat=90.0;
       var onepixelequals=izoom;
       //document.title='canvasclick';
       e = e || window.event;
       e.preventDefault();
       if (e.touches) {
       if (e.touches[0].pageX) {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals);
   if (drawc(e.touches[0].pageX, e.touches[0].pageY)) {
   //thislat=eval(topllat - e.touches[0].pageY * onepixelequals);
   //thislong=eval(topllong + e.touches[0].pageX * onepixelequals);
   thislat=eval(topllat - eval(-rectistop + e.touches[0].pageY) * onepixelequals);
   thislong=eval(topllong + eval(-rectisleft + e.touches[0].pageX) * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; 
   }
       } else {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals);
   if (drawc(e.touches[0].clientX, e.touches[0].clientY)) {
   //thislat=eval(topllat - e.touches[0].clientY * onepixelequals);
   //thislong=eval(topllong + e.touches[0].clientX * onepixelequals);
   thislat=eval(topllat - eval(-rectis.top + e.touches[0].clientY) * onepixelequals);
   thislong=eval(topllong + eval(-rectis.left + e.touches[0].clientX) * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; 
   }
       }
       } else if (e.pageX || e.pageY) {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals);
   if (drawc(e.pageX, e.pageY)) {
   //thislat=eval(topllat - e.pageY * onepixelequals);
   //thislong=eval(topllong + e.pageX * onepixelequals);
   thislat=eval(eval(eval(topllat * onepixelequals - eval(-rectistop + e.pageY) * 1)) / onepixelequals);
   thislong=eval(eval(eval(topllong * onepixelequals + eval(-rectisleft + e.pageX) * 1)) / onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; 
   }
       } else {
         //lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals);
   if (drawc(e.clientX, e.clientY)) {
   thislat=eval(topllat - e.clientY * onepixelequals);
   thislong=eval(topllong + e.clientX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + thislat) + '&longitude=' + encodeURIComponent('' + thislong) + '&ntztontz=y'; 
   }
       }
  }
  
  function defclick(e) {
       canvasclick(e);
       return true;
       var topllong=-180.0;
       var topllat=90.0;
       var onepixelequals=izoom;
       //document.title='defclick';
       e = e || window.event;
       e.preventDefault();
       if (e.touches) {
       if (e.touches[0].pageX) {
         lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].pageX * onepixelequals) + ',' + eval(topllat - e.touches[0].pageY * onepixelequals);
   drawc(e.touches[0].pageX, e.touches[0].pageY);
   thislat=eval(topllat - e.touches[0].pageY * onepixelequals);
   thislong=eval(topllong + e.touches[0].pageX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].pageX * onepixelequals)) + '&ntztontz=y'; 
       } else {
         lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.touches[0].clientX * onepixelequals) + ',' + eval(topllat - e.touches[0].clientY * onepixelequals);
   drawc(e.touches[0].clientX, e.touches[0].clientY);
   thislat=eval(topllat - e.touches[0].clientY * onepixelequals);
   thislong=eval(topllong + e.touches[0].clientX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.touches[0].clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.touches[0].clientX * onepixelequals)) + '&ntztontz=y'; 
       }
       } else if (e.clientX || e.clientY) {
         lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.clientX * onepixelequals) + ',' + eval(topllat - e.clientY * onepixelequals);
   drawc(e.pageX, e.pageY);
   thislat=eval(topllat - e.pageY * onepixelequals);
   thislong=eval(topllong + e.pageX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.clientY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.clientX * onepixelequals)) + '&ntztontz=y'; 
       } else {
         lastl='Longitude,Latitude coordinates are ' + eval(topllong + e.pageX * onepixelequals) + ',' + eval(topllat - e.pageY * onepixelequals);
   drawc(e.clientX, e.clientY);
   thislat=eval(topllat - e.clientY * onepixelequals);
   thislong=eval(topllong + e.clientX * onepixelequals);
   document.getElementById('nearestif').src='/PHP/tz_places.php?place=&latitude=' + encodeURIComponent('' + eval(topllat - e.pageY * onepixelequals)) + '&longitude=' + encodeURIComponent('' + eval(topllong + e.pageX * onepixelequals)) + '&ntztontz=y'; 
       }
  }
  
  function areado() {
    var ars=document.getElementsByTagName('area');
    var cs=[];
    
    for (var ij=0; ij<ars.length; ij++) {
      cs=('' + ars[ij].coords).split(',');
      if (eval('' + cs.length) >= 2) {
       ars[ij].coords+=',' + cs[0] + ',' + cs[1];
      }
    }
  }
  
  
    
  
  function plotarivervia(aname, thecontent) {
    var found=-1, ifnd=0;
    var rbits=thecontent.split(']]}}');
    var murraytotal=0.0;
    llist='';
    thecontent='';
    var hdrbit='', hbits=[];
    lastn='';
    for (var irr=1; irr<(-1 + rbits.length); irr++) {
      hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + '';
//alert(hdrbit);
      hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + aname + String.fromCharCode(34));
      if (hbits.length > 1) {
        //if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) {
        if (lastn != aname) {
          lastn=aname;
          found=-1;
          if (arivers.length > 0) {
          for (ifnd=0; ifnd<arivers.length; ifnd++) {
            if (('' + arivers[ifnd]).indexOf(':') != -1 && found == -1) {
              if (('' + arivers[ifnd]).split(':')[0] == lastn) { found=ifnd; }
            }
          }
          }
          if (found >= 0) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          if (1 == 1 || !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNJKd|iPod|Opera Mini|IEMobile/i)) {
          llist+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          }
          } else {
          //if (lastn == 'Murray') { 
          //  console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          //}
          llist=(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')));
          }
        } else if (1 == 1 || !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          llist+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
        }
        //}
      }
    }
    plottheriver(found, llist)
  }
  
  function populateriversvia(ts) {
    if (document.getElementById('srivs').innerHTML.trim() == '') {
    var found=-1, ifnd=0;
    var rbits=ts.split(']]}}');
    var murraytotal=0.0;
    var hdrbit='', hbits=[];
    lastn='';
    for (var irr=1; irr<(-1 + rbits.length); irr++) {
      hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + '';
//alert(hdrbit);
      hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34));
      if (hbits.length > 1) {
        if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) {
        if (lastn != hbits[1].split(String.fromCharCode(34))[0]) {
          lastn=hbits[1].split(String.fromCharCode(34))[0];
          found=-1;
          if (arivers.length > 0) {
          for (ifnd=0; ifnd<arivers.length; ifnd++) {
            if (('' + arivers[ifnd]).indexOf(':') != -1 && found == -1) {
              if (('' + arivers[ifnd]).split(':')[0] == lastn) { found=ifnd; }
            }
          }
          }
          if (found >= 0) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
          arivers[found]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          }
          } else {
          //if (lastn == 'Murray') { 
          //  console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          //}
          arivers.push(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')));
          }
        } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          arivers[-1 + arivers.length]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
        }
        }
      }
    }
    rbits=[];
    if (document.getElementById('srivs').innerHTML.trim() != '') {
        arivers=[];
    }
    }
    lastn='';
    //if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    //  alert(arivers.length);
    //}
    //return;
    //plotariver(getariver());
    if (!idone) { idone=true; if (document.getElementById('srivs').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { getapopulation(); } else { getariver(); }  }
  }
  
  function populaterivers() {
    if (document.getElementById('srivs').innerHTML.trim() == '') {
    var found=-1, ifnd=0;
    var rbits=rivers.split(']]}}');
    var murraytotal=0.0;
    rivers='';
    var hdrbit='', hbits=[];
    lastn='';
    for (var irr=1; irr<(-1 + rbits.length); irr++) {
      hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + '';
//alert(hdrbit);
      hbits=hdrbit.split(',' + String.fromCharCode(34) + 'name' + String.fromCharCode(34) + ':' + String.fromCharCode(34));
      if (hbits.length > 1) {
        if ((!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i) || eval('' + arivers.length) <= 200)) {
        if (lastn != hbits[1].split(String.fromCharCode(34))[0]) {
          lastn=hbits[1].split(String.fromCharCode(34))[0];
          found=-1;
          if (arivers.length > 0) {
          for (ifnd=0; ifnd<arivers.length; ifnd++) {
            if (('' + arivers[ifnd]).indexOf(':') != -1 && found == -1) {
              if (('' + arivers[ifnd]).split(':')[0] == lastn) { found=ifnd; }
            }
          }
          }
          if (found >= 0) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
          arivers[found]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          }
          } else {
          //if (lastn == 'Murray') { 
          //  console.log(lastn + ':' + hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          //}
          arivers.push(lastn + ':' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')));
          }
        } else if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
          //if (lastn == 'Murray') { 
          //  console.log(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); 
          //}
          arivers[-1 + arivers.length]+=' ' + lessit(hdrbit.split(':[[')[1].replace(/\]\]\,\[\[/g,' ').replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
        }
        }
      }
    }
    rbits=[];
    if (document.getElementById('srivs').innerHTML.trim() != '') {
        arivers=[];
    }
    }
    lastn='';
    //if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    //  alert(arivers.length);
    //}
    //return;
    //plotariver(getariver());
    if (!idone) { idone=true; if (document.getElementById('srivs').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { getapopulation(); } else { getariver(); }  }
  }
  
  function lessitp(maybe) {
     var altmaybe='', altmaybed='';
     if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       var acsvs=maybe.split(',');
       for (var ic=0; ic<acsvs.length; ic++) {
          altmaybe+=altmaybed + (acsvs[ic] + '.xyz').substring(0,eval(3 + (acsvs[ic] + '.xyz').indexOf('.'))).split('.xyz')[0];
          if (ic == 1) { 
            acsvs=[]; 
            if (document.getElementById(encodeURIComponent(jlastn))) {
            document.getElementById(encodeURIComponent(jlastn)).value+=encodeURIComponent(' ' + altmaybe);
            } else {
            document.getElementById('spops').innerHTML+='<option id=' + encodeURIComponent(jlastn) + ' value=' +  encodeURIComponent(altmaybe) + '></option>';
            }
            return ''; //altmaybe; 
          }
          altmaybed=',';
       }
       acsvs=[];
       return ''; //altmaybe;
     } 
     return maybe;
  }
  
  function lessit(maybe) {
     var altmaybe='', xaltmaybe='', altmaybed='', sls=[], isls=0;
     if (document.getElementById('srivs').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       var acsvs=maybe.split(',');
       for (var ic=0; ic<acsvs.length; ic++) {
          xaltmaybe=(acsvs[ic] + '.xyz').substring(0,eval(3 + (acsvs[ic] + '.xyz').indexOf('.'))).split('.xyz')[0];
          altmaybe+=altmaybed + xaltmaybe;
          if (document.getElementById('srivs').innerHTML.trim() != '') {
            sls=xaltmaybe.split(' ');
            if (document.getElementById(encodeURIComponent('river' + lastn))) {
            if (eval('' + sls.length) > 1) {
            document.getElementById(encodeURIComponent('river' + lastn)).value+=encodeURIComponent(' ' + altmaybed + sls[0] + ' ' + sls[1]);
            } else {
            document.getElementById(encodeURIComponent('river' + lastn)).value+=encodeURIComponent(' ' + altmaybed + xaltmaybe);
            }
            } else if (eval('' + sls.length) > 1) {
            document.getElementById('srivs').innerHTML+='<option id=' + encodeURIComponent('river' + lastn) + ' value=' +  encodeURIComponent(' ' + altmaybed + sls[0] + ' ' + sls[1]) + '></option>';
            } else {
            document.getElementById('srivs').innerHTML+='<option id=' + encodeURIComponent('river' + lastn) + ' value=' +  encodeURIComponent(altmaybed + xaltmaybe) + '></option>';
            }
          } else {
          if (ic == 1) { acsvs=[]; return altmaybe; }
          }
          altmaybed=',';
       }
       acsvs=[];
       if (document.getElementById('srivs').innerHTML.trim() != '') { return ''; }
       return altmaybe;
     } 
     return maybe;
  }
   
  function populatepopulationsvia(ts) {
    console.log('here in populatepopulationsvia');
    if (document.getElementById('spops').innerHTML.trim() == '') {
    var found=-1, ifnd=0;
    var rbits=ts.split(']}}');
    //populations='';
    var hdrbit='', hbits=[];
    jlastn='';
    for (var irr=1; irr<(-1 + rbits.length); irr++) {
      hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + '';
//alert(hdrbit);
      hbits=hdrbit.split(',' + String.fromCharCode(34) + 'NAME' + String.fromCharCode(34) + ':' + String.fromCharCode(34));
      if (hbits.length > 1) {
        if (jlastn != hbits[1].split(String.fromCharCode(34))[0]) {
          jlastn=hbits[1].split(String.fromCharCode(34))[0];
          found=-1;
          if (apopulations.length > 0) {
          for (ifnd=0; ifnd<apopulations.length; ifnd++) {
            if (('' + apopulations[ifnd]).indexOf(':') != -1 && found == -1) {
              if (('' + apopulations[ifnd]).split(':')[0] == jlastn) { found=ifnd; }
            }
          }
          }
          if (found >= 0) {
          //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations[found]+=' ' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          } else {
          //if (jlastn == 'Sydney') { console.log(jlastn + ':' + hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations.push(jlastn + ':' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')));
          }
        } else {
          //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations[-1 + apopulations.length]+=' ' + lessitp(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
        }
      }
    }
    if (document.getElementById('spops').innerHTML.trim() != '') {
        //console.log(document.getElementById('spops').innerHTML);
        apopulations=[];
    }
    rbits=[];
    }
    jlastn='';
    //return;
    //plotariver(getariver());
  }
   
  function populatepopulations() {
    var found=-1, ifnd=0;
    var rbits=populations.split(']}}');
    populations='';
    var hdrbit='', hbits=[];
    jlastn='';
    for (var irr=1; irr<(-1 + rbits.length); irr++) {
      hdrbit=rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature')[eval(-1 + rbits[-1 + irr].split('{' + String.fromCharCode(34) + 'type' + String.fromCharCode(34) + ':' + String.fromCharCode(34) + 'Feature').length)] + '';
//alert(hdrbit);
      hbits=hdrbit.split(',' + String.fromCharCode(34) + 'NAME' + String.fromCharCode(34) + ':' + String.fromCharCode(34));
      if (hbits.length > 1) {
        if (jlastn != hbits[1].split(String.fromCharCode(34))[0]) {
          jlastn=hbits[1].split(String.fromCharCode(34))[0];
          found=-1;
          if (apopulations.length > 0) {
          for (ifnd=0; ifnd<apopulations.length; ifnd++) {
            if (('' + apopulations[ifnd]).indexOf(':') != -1 && found == -1) {
              if (('' + apopulations[ifnd]).split(':')[0] == jlastn) { found=ifnd; }
            }
          }
          }
          if (found >= 0) {
          //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations[found]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
          } else {
          //if (jlastn == 'Sydney') { console.log(jlastn + ':' + hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations.push(jlastn + ':' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')));
          }
        } else {
          //if (jlastn == 'Sydney') { console.log(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,'')); }
          apopulations[-1 + apopulations.length]+=' ' + lessit(hdrbit.split(':[')[1].replace(/\]\,\[/g,',').replace(/\[/g,'').replace(/\]/g,''));
        }
      }
    }
    if (document.getElementById('spops').innerHTML.trim() != '') {
        apopulations=[];
    }
    rbits=[];
    jlastn='';
    //return;
    //plotariver(getariver());
  }
 
  function getariver() {
    console.log('here in getariver');
    //for (var ih=0; ih<arivers.length; ih++) {
    //  if (arivers[ih].split(':')[0] == 'Murray') { return ih; }
    //}
    if (document.getElementById('srivs').innerHTML.trim() != '' && !idone) {  idone=true; }
    if (!idone) { document.getElementById('ifrivers').src='./rivers.geojson';  } else if (arivers.length > 0 || document.getElementById('srivs').innerHTML.trim() != '') {

    if (document.getElementById('srivs').innerHTML.trim() != '') { // || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    iguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('srivs').innerHTML.split('</option').length)));
    } else {
    iguess=Math.floor(Math.random() * arivers.length);
    }
    if (isofar.indexOf(',' + iguess + ',') != -1) {
    while (isofar.indexOf(',' + iguess + ',') != -1) {
    if (document.getElementById('srivs').innerHTML.trim() != '') {
    iguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('srivs').innerHTML.split('</option').length)));
    } else {
    iguess=Math.floor(Math.random() * arivers.length);
    }
    }
    }
    isofar+=',' + iguess + ',';
    if (document.getElementById('srivs').innerHTML.trim() != '') { // || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    lastn=decodeURIComponent(document.getElementById('srivs').innerHTML.split(' id=')[eval(1 + iguess)].split(' ')[0].split('>')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),'')).replace(/^river/g,'');
    } else {
    lastn=arivers[iguess].split(':')[0];
    }
    if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPaJUNKd|iPod|Opera Mini|IEMobile/i)) {
    document.getElementById('ifriverstwo').src='./rivers.geojson?name=' + encodeURIComponent(lastn);
    } else {
    plotariver(iguess);
    }
    setTimeout(askariver, 8000);
    return iguess;
    }
  }


  function getapopulation() {
    console.log('here in getapopulation jsofar=' + jsofar + ' opt count=' + document.getElementById('spops').innerHTML.split('</option').length + ' vs ' + eval(-1 + eval('' + document.getElementById('spops').innerHTML.split('</option').length)));
    //for (var ih=0; ih<apopulations.length; ih++) {
    //  if (apopulations[ih].split(':')[0] == 'Murray') { return ih; }
    //}
    if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    jguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('spops').innerHTML.split('</option').length)));
    } else {
    jguess=Math.floor(Math.random() * apopulations.length);
    }
    if (jsofar.indexOf(',' + jguess + ',') != -1) {
    console.log('Here ' + jguess + ' in getapopulation jsofar=' + jsofar + ' opt count=' + document.getElementById('spops').innerHTML.split('</option').length);
    while (jsofar.indexOf(',' + jguess + ',') != -1) {
    if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    jguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('spops').innerHTML.split('</option').length)));
    } else {
    jguess=Math.floor(Math.random() * apopulations.length);
    }
    }
    }
    jsofar+=',' + jguess + ',';
    if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    jlastn=decodeURIComponent(document.getElementById('spops').innerHTML.split(' id=')[eval(1 + jguess)].split(' ')[0].split('>')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),''));
    if (!document.getElementById(encodeURIComponent(jlastn))) {
    while (jsofar.indexOf(',' + jguess + ',') != -1) {
    if (document.getElementById('spops').innerHTML.trim() != '' || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
    jguess=Math.floor(Math.random() * eval(-1 + eval('' + document.getElementById('spops').innerHTML.split('</option').length)));
    } else {
    jguess=Math.floor(Math.random() * apopulations.length);
    }
    }
    jlastn=decodeURIComponent(document.getElementById('spops').innerHTML.split(' id=')[eval(1 + jguess)].split(' ')[0].split('>')[0].replace(String.fromCharCode(34),'').replace(String.fromCharCode(34),''));
    }
    } else {
    jlastn=apopulations[jguess].split(':')[0];
    }
    plotapopulation(jguess);
    setTimeout(askapopulation, 9000);
    return jguess;
  }
  
    
  function askariver() {
    var another=false;
    var midbit='';
    var origboth=both;
    var thing='river';
    if (!both) {  midbit='Append spaces to also answer a question regarding the Populations Quiz, or P to just do Populations Quiz.';   } else { thing='population'; }
    var retthis=null;
    if (document.getElementById(encodeURIComponent('river' + lastn))) {
    retthis=prompt('What is the name of this new blue river plotted on the world map?  ' + midbit + '  Enter ? to get given more time looking at (longitude,latitude) = (' + decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value).split(',')[0] + ',' + decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value).split(',')[1].split(' ')[0] + ')', '');
    } else {
    retthis=prompt('What is the name of this new blue river plotted on the world map?  ' + midbit + '  Enter ? to get given more time looking at (longitude,latitude) = (' + arivers[iguess].split(':')[1].split(',')[0] + ',' + arivers[iguess].split(':')[1].split(',')[1] + ')', '');
    }
    if (retthis == null) {
      both=false;
      jgoes++;
      another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (retthis.toLowerCase().trim() == 'p') {
      both=false;
      isokto=true; 
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      setTimeout(getapopulation, 9000);
      return '';
    } else if (retthis.trim() == '?') {
      if (retthis.trim() != retthis && !origboth) {  
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      both=true;   
      }
      setTimeout(askariver, 8000);
      return '';
    } else if (retthis.trim() == '') {
      if (retthis != '' && !origboth) { thing='population'; }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
      if (retthis != '' && !origboth) {  
      isokto=true;  
      both=true;   
      if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      if (document.getElementById('spops').innerHTML.trim() == '') { document.getElementById('ifrivers').src='./population.geojson';  }  
      setTimeout(getapopulation, 9000);
      } else {
      getapopulation();  
      }
      }
    } else if (lastn.toLowerCase().indexOf(retthis.toLowerCase()) != -1 && lastn.toLowerCase() == retthis.toLowerCase() && retthis.trim().length >= 1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='population';    
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Will pay that.  Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (lastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;   
      thing='population';  
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
       document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (lastn.toLowerCase() == retthis.toLowerCase()) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='population';   
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Well done!  Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (retthis.trim().length >= 1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='population';   
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='population';   
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Will pay that.  Answer was ' + lastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    }
    if (both && !origboth) { isitok=true;   setTimeout(getapopulation, 9000);  return '';   } else if (both) {  setTimeout(getapopulation, 9000);   return '';  }
    if (another) {  if (both) { getariver(); getapopulation(); } else { getariver(); } } else {   contexta.clearRect(0,0,360,180);   }
    return '';
  }
  
  function plottheriver(ariverswhich) {
    if (both) { isokto=true; }
    if (isokto) { contexta.clearRect(0,0,360,180); }
    if (both) { isokto=false; }
    lastn=ariverswhich.split(':')[0];
    var rest=ariverswhich.split(':')[1];
    var consolelog='';
    //console.log(rest);
    var restlonglat=[];  //rest.split(',');
    var therest=rest.split(' ');
    //alert(eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1])));
    for (var jrrr=0; jrrr<therest.length; jrrr++) {
    restlonglat=therest[jrrr].split(',');
    for (var irrr=2; irrr<restlonglat.length; irrr+=2) {
       if (eval(1 + irrr) < eval('' + restlonglat.length)) {
       if (irrr == 2) { 
         contexta.strokeStyle = '#0000ff';
         contexta.lineWidth = 1;
         contexta.beginPath(); 
         //console.log('context.moveTo(' + eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1])) + ');');
         contexta.moveTo(eval(180.0 + eval('' + restlonglat[0])), eval(90.0 - eval('' + restlonglat[1]))); 
       }
    //alert(eval(180.0 + eval('' + restlonglat[irrr])) + ',' + eval(90.0 - eval('' + restlonglat[1 + irrr])));
         consolelog=('context.lineTo(' + eval(180.0 + eval('' + restlonglat[eval(0 + eval('' + irrr))])) + ',' + eval(90.0 - eval('' + restlonglat[eval(1 + eval('' + irrr))])) + ');');
       if (consolelog.indexOf('NaN') == -1) {
       contexta.lineTo(eval(180.0 + eval('' + restlonglat[eval(0 + eval('' + irrr))])), eval(90.0 - eval('' + restlonglat[eval(1 + eval('' + irrr))])));
       }
       //if (eval(irrr + 1) >= eval('' + restlonglat.length)) { context.stroke(); }
       }
    }
    contexta.stroke(); 
    }
  }
  
  function plotariver(which) {
    var rest='';
    if (both) { isokto=true; }
    if (isokto) { contexta.clearRect(0,0,360,180); }
    if (both) { isokto=false; }
    if (document.getElementById(encodeURIComponent('river' + lastn))) {
    rest=decodeURIComponent(document.getElementById(encodeURIComponent('river' + lastn)).value); //.split(' ')[0];
    } else {
    lastn=arivers[which].split(':')[0];
    rest=arivers[which].split(':')[1];
    }
    var consolelog='';
    //console.log(rest);
    var restlonglat=[];  //rest.split(',');
    var therest=rest.split(' ');
    //alert(eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1])));
    for (var jrrr=0; jrrr<therest.length; jrrr++) {
    restlonglat=therest[jrrr].split(',');
    for (var irrr=2; irrr<restlonglat.length; irrr+=2) {
       if (eval(1 + irrr) < eval('' + restlonglat.length)) {
       if (irrr == 2) { 
         contexta.strokeStyle = '#0000ff';
         contexta.lineWidth = 1;
         contexta.beginPath(); 
         //console.log('context.moveTo(' + eval(180.0 + eval('' + restlonglat[0])) + ',' + eval(90.0 - eval('' + restlonglat[1])) + ');');
         contexta.moveTo(eval(180.0 + eval('' + restlonglat[0])), eval(90.0 - eval('' + restlonglat[1]))); 
       }
    //alert(eval(180.0 + eval('' + restlonglat[irrr])) + ',' + eval(90.0 - eval('' + restlonglat[1 + irrr])));
         consolelog=('context.lineTo(' + eval(180.0 + eval('' + restlonglat[eval(0 + eval('' + irrr))])) + ',' + eval(90.0 - eval('' + restlonglat[eval(1 + eval('' + irrr))])) + ');');
       if (consolelog.indexOf('NaN') == -1) {
       contexta.lineTo(eval(180.0 + eval('' + restlonglat[eval(0 + eval('' + irrr))])), eval(90.0 - eval('' + restlonglat[eval(1 + eval('' + irrr))])));
       }
       //if (eval(irrr + 1) >= eval('' + restlonglat.length)) { context.stroke(); }
       }
    }
    contexta.stroke(); 
    }
  }
  
  function getthejson(iois) {
    if (iois.src.indexOf('.geojson') != -1) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
       if (iois.src.indexOf('rivers.geojson?name=') != -1) {
       plotarivervia(lastn, aconto.body.innerHTML);
       } else if (iois.src.indexOf('rivers.geojson') != -1) {
       if (1 == 1) {
       populateriversvia(aconto.body.innerHTML);
       } else {
       rivers='' + aconto.body.innerHTML;
       setTimeout(populaterivers, 500);
       }
       if (!navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       iois.src='./population.geojson';
       }
       } else if (iois.src.indexOf('population.geojson') != -1) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       if (1 == 1) {
       populatepopulationsvia(aconto.body.innerHTML);
       if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       getapopulation();
       }
       } else {
       populations='' + aconto.body.innerHTML;
       setTimeout(populatepopulations, 500);
       }
       }
       }
    }
    }
  }
  
  function getthejsontwo(iois) {
    if (iois.src.indexOf('.geojson') != -1) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
       if (aconto.document) { aconto = aconto.document; }
       if (aconto.body != null) {
       if (iois.src.indexOf('rivers.geojson?name=') != -1) {
       plotarivervia(lastn, aconto.body.innerHTML);
       } else if (iois.src.indexOf('rivers.geojson') != -1) {
       rivers='' + aconto.body.innerHTML;
       setTimeout(populaterivers, 500);
       iois.src='./population.geojson';
       } else if (iois.src.indexOf('population.geojson') != -1) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       populations='' + aconto.body.innerHTML;
       setTimeout(populatepopulations, 500);
       }
       }
    }
    }
  }

   function askapopulation() {
    var another=false;
    var origboth=both;
    var midbit='';
    var thing='population';
    if (!both) {  midbit='Append spaces to also answer a question regarding the Rivers Quiz, or R to just do Rivers Quiz.';   } else { thing='river'; }
    var retthis='';
    if (document.getElementById(encodeURIComponent(jlastn))) {
    retthis=prompt('What is the name of this new red population area plotted on the world map? ' + midbit + '  Enter ? to get given more time looking at (longitude,latitude) = (' + decodeURIComponent(document.getElementById(encodeURIComponent(jlastn)).value) + ')', '');
    } else {
    retthis=prompt('What is the name of this new red population area plotted on the world map? ' + midbit + '  Enter ? to get given more time looking at (longitude,latitude) = (' + apopulations[jguess].split(':')[1].split(',')[0] + ',' + apopulations[jguess].split(':')[1].split(',')[1] + ')', '');
    }
    if (retthis == null) {
      both=false;
      jgoes++;
      another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (retthis.toLowerCase().trim() == 'r') {
      both=false;
      isokto=true; 
      getariver();
      return '';
    } else if (retthis.trim() == '?') {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;   
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      setTimeout(askapopulation, 9000);
      return '';
    } else if (retthis.trim() == '') {
      if (retthis != '' && !origboth) { thing='river'; }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
      if (retthis != '' && !origboth) { 
      isokto=true;  
      both=true; 
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      getariver();   
      }
    } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) != -1 && jlastn.toLowerCase() == retthis.toLowerCase() && retthis.trim().length >= 1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='river';    
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Will pay that.  Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (jlastn.toLowerCase().indexOf(retthis.toLowerCase()) == -1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='river';   
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (jlastn.toLowerCase() == retthis.toLowerCase()) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='river';    
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Well done!  Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else if (retthis.trim().length >= 1) {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='river';    
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      another=confirm('Bad luck. Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    } else {
      if (retthis.trim() != retthis && !origboth) { 
      both=true;  
      thing='river';    
      if (document.getElementById('spops').innerHTML.trim() == '' && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
      document.getElementById('ifrivers').src='./population.geojson';   
      }
      }
      jgoes++;
      jscore++;
      another=confirm('Will pay that.  Answer was ' + jlastn + '. Score ' + jscore + '/' + jgoes + '.  Another go with a new ' + thing + '?');
    }
    if (both) {   contexta.clearRect(0,0,360,180);   }
    if (both && (!origboth || 6 == 6)) { isitok=true; getariver();  return '';   }
    if (another) { if (both) { getariver(); getapopulation(); } else { getapopulation(); } } else {   contexta.clearRect(0,0,360,180);   }
    return '';
  }
  
  function plotapopulation(which) {
    var rest='', restlonglat=[];
    if (isokto) { contexta.clearRect(0,0,360,180); }
    //if (both) { isokto=true; }
    if (document.getElementById(encodeURIComponent(jlastn))) {
    rest=decodeURIComponent(document.getElementById(encodeURIComponent(jlastn)).value).split(' ')[0];
    } else {
    jlastn=apopulations[which].split(':')[0];
    rest=apopulations[which].split(':')[1].split(' ')[0];
    }
    restlonglat=rest.split(',');
    if (eval('' + restlonglat.length) >= 2) {
    contexta.fillStyle = 'red';
    console.log(rest + ': ' + restlonglat[0] + ',' + restlonglat[1]);
    contexta.fillRect(eval(180.0 + eval('' + restlonglat[0])), eval(90.0 - eval('' + restlonglat[1])),2,2);
    contexta.fill();
    }
  }

   
function zoomin() {
   if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
   jzoom*=2;
   document.getElementById('myviewport').setAttribute('content', 'width=device-width, initial-scale=' + eval(jzoom * izoom) + ', minimum-scale=0.1, maximum-scale=8, user-scalable=yes');
   window.scrollTo(0,0);    //izoom*=2;
   } else {
   //if (1 == 1) {
   //  alert('Please use your web browser View Menu options Zoom In or Zoom Out');
   //} else {
     document.body.style.zoom=('' + eval(izoom * 200.0) + '%');
     izoom*=2;
     //location.href=document.URL.split('?')[0].split('#')[0] + '?zoom=' + encodeURIComponent('' + eval(2 * izoom));
   //}
   }
}
   
  function derivethislong(xco) {
       var rectis=document.body.getBoundingClientRect();
       var topllong=-180.0;
       var topllat=90.0;
       //var onepixelequals=izoom;
       thislong=eval(topllong + eval(eval(eval(-rectis.left * izoom) + xco) / izoom));
       return thislong;
  }
 
  function derivethislat(yco) {
       var rectis=document.body.getBoundingClientRect();
       var topllong=-180.0;
       var topllat=90.0;
       //var onepixelequals=izoom;
       thislat=eval(topllat - eval(eval(eval(-rectis.top * izoom) + yco) / izoom));
       return thislat;
  }
  

function getzoom() {
   if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
      return jzoom;
   }
   return izoom;
}


function windowopentwo(p1,p2,p3) {
   if (1 == 1 && navigator.userAgent.match(/iPad/i)) { 
   if (p1 != 'cn' + 't.ht' + 'm') {
   document.getElementById('ifxtr').src=p1;
   }
   document.getElementById('ifxtr').style.width='60px'; //'80px';
   document.getElementById('ifxtr').style.height='60px'; //'60px';
   document.getElementById('ifxtr').style.zIndex='345';
//   document.getElementById('ifxtr').style.backgroundColor='transparent';
   if (9 == 99) {
   alert(document.getElementById('iftr').outerHTML.replace('if' + 'tr', 'ifxtr').replace('none;', 'block:'));
      document.getElementById('ipadpin').innerHTML=document.getElementById('iftr').outerHTML.replace('if' + 'tr', 'ifxtr').replace('none;', 'block:');
   } else {
   document.getElementById('ifxtr').srcdoc=document.getElementById('iftr').srcdoc;
   document.getElementById('ifxtr').style.display='block'; //'inline-block';
   //alert('iPad ' + document.getElementById('ifxtr').srcdoc);
   //document.getElementById('iftr').style.position='absolute';
   //document.getElementById('iftr').style.left='' + eval(-80 + screen.width);
   //document.getElementById('iftr').style.top='0px';
   //document.getElementById('iftr').style.position='fixed';
   //document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width);
   //document.getElementById('iftr').style.top='calc(100vh - 60px)'; // '' + eval(-60 + screen.height) + 'px'; //'calc(100vh - 60px)'; // 
   //alert('' + eval(-60 + screen.height) + 'px');
   }
   } else if (6 == 6) {
   if (p1 != 'cn' + 't.ht' + 'm') { // || navigator.userAgent.match(/iPad/i)) {
   document.getElementById('iftr').src=p1;
   }
   document.getElementById('iftr').style.width='60px'; //'80px';
   document.getElementById('iftr').style.height='60px'; //'60px';
   document.getElementById('iftr').style.zIndex='345';
   document.getElementById('iftr').style.display='block';
   document.getElementById('iftr').style.backgroundColor='transparent';
   if (1 == 1 && navigator.userAgent.match(/iPad/i)) {
   //alert('iPad');
   document.getElementById('iftr').style.position='fixed';
   document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width);
   document.getElementById('iftr').style.top='0px'; // + eval(-60 + screen.height) + 'px';
   } else {
   document.getElementById('ipadpin').innerHTML='';
   document.getElementById('iftr').style.position='fixed';
   document.getElementById('iftr').style.left='0px'; //'' + eval(-80 + screen.width);
   document.getElementById('iftr').style.top='calc(100% - 60px)'; // + eval(-60 + screen.height) + 'px';
   }
   }
   return null;
}
  
";

$htmlis.="  
</scr" . "ipt>
</head><body ontouchdown=canvasclick(event); onmousedown=canvasclick(event); onload=\"onl(); areado();  var xx=windowopentwo('cnt.htm','_blank','top=50,left=600,width=100,height=150');\" style='background-color: yellow;'><img name=myimg id=myimg style='height:" . (180.0 * $factor) . "px;z-index:56;position:absolute;top:0px;left:0px;width:" . (360.0 * $factor) . "px;' src='" . $duis . "' usemap='#mymap'></img>
<map name='mymap' style='z-index:56;'>
</map><canvas id=mycanvas height='" . (180.0 * $factor) . "' width='" . (360.0 * $factor) . "' style='background-color: white;z-index:1;display:inline-block;border-bottom:1px dotted gray;border-right:1px dotted gray;position:absolute;top:0px;left:0px;'></canvas><canvas id=myacanvas height='180' width='360' style='background-color:transparent;z-index:55;display:inline-block;position:absolute;top:0px;left:0px;'></canvas>&nbsp;<table style='position:absolute;top:0px;left:" . (360.0 * $factor + 25) . "px;'><tr><td><h1><div style=display:inline-block; id=ipadpin><iframe scrolling=no frameborder=0 name=ifxtr id=ifxtr style=display:block;height:60px;width:60px;z-index:345; srcdoc=\"<body style=background-color:transparent;><p id=mg title='Wikipedia country page below via drag and drop to world map' draggable='true'>&#128205;</p><br><br><div id=myh1></div><script type='text/javascript' src='./countries.js?rand=4321156747657' defer></script></body>\" data-src=cnt.htm></iframe></div>&nbsp;GeoJSON World Coastline</h1></td></tr><tr><td><h4 id=myh4></h4><h3>RJM Programming <a style=cursor:pointer; title='Zoom In' onclick='event.stopPropagation(); event.preventDefault(); zoomin();'>&#128270;</a> January,<sub style=cursor:pointer; onclick=getariver(); title='River Quiz'>&#10067;</sub> 2023</h3></td></tr><tr><td><h3>Thanks to <a target=_blank title=https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_coastline.geojson href='https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_coastline.geojson'>https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_coastline.geojson</a></h3></td></tr></table><input type=hidden title='' id=ntz value=''></input><iframe onload=checkif(this); id=nearestif style=display:none; src=></iframe>
<iframe id=ifrivers onload=getthejson(this); style=display:none; src=></iframe><iframe id=ifriverstwo onload=getthejsontwo(this); style=display:none; src=></iframe>
<br><br><table id=geomaps name=geomaps border=2 style=display:none;background-color:#f0f0f0;width:100%;height:900px;><tr><td id=lpcwheel><iframe name=mapchart id=mapchart style=width:100%;height:900px;display:none; src=></iframe></td><td id=tdpcwheel style=display:none;><iframe name=pcwheel id=pcwheel style=width:100%;height:900px;display:none; src=></iframe></td></tr></table>
<select id=spops style=display:none;>" . $sih . "</select>
<select id=srivs style=display:none;>" . $rih . "</select>
<iframe name=wop id=wop style=display:none; src=></iframe>
<iframe scrolling=no frameborder=0 name=iftr id=iftr style=display:none; srcdoc=\"<body style=background-color:transparent;><p id=mg title='Wikipedia country page below via drag and drop to world map' draggable='true'>&#128205;</p><br><br><div id=myh1></div><script type='text/javascript' src='./countries.js?rand=321156747657' defer></script></body>\" data-src=></iframe>
<iframe onerror=ifintair(this); onload=ifintair(this); name=myiframe id=myiframe style=display:none; src=\"//www.rjmprogramming.com.au/PHP/Map/map.php?title=Airports&label=['Lat',&value='Lon','Name']&data=\"></iframe>
<style>
 body { margin: 0 0 0 0; }
</style>
</body></html>";

$geojsonis=file_get_contents('coastline.geojson');
$parts=explode("]]", $geojsonis);

for ($i=0; $i<(-1 + sizeof($parts)); $i++) {
  $coords=str_replace('[','',str_replace(']','',explode('[[' , $parts[$i])[-1 + sizeof(explode('[[' , $parts[$i]))]));
  $newcoords=$coords;
  if (!$dolatlong || 1 == 1) {
  $lls=explode(",", $coords);
  $newcoords="";
  for ($j=0; $j<sizeof($lls); $j+=2) {
  $lls[$j]=($lls[$j] + $longoff) * $factor;
  $lls[$j + 1]=($lls[$j + 1] + $latoff) * $factor;
  if ($newcoords != "") { $newcoords.=",";  $htmlis=str_replace("}", " context.lineTo(" . $lls[$j] . ',' . ((180.0 * $factor) - $lls[$j + 1]) . "); \n}", $htmlis);  } else { $htmlis=str_replace("}", " context.stroke(); \n context.beginPath(); \n context.moveTo(" . $lls[$j] . ',' . ((180.0 * $factor) - $lls[$j + 1]) . "); \n}", $htmlis); }
  $newcoords.='' . $lls[$j] . ',' . ((180.0 * $factor) - $lls[$j + 1]);
  }
  }
  $abit.="<area onclick=\"ouralert('Longitude,Latitude coordinates are " . $coords . "');\" shape='poly' coords='" . $newcoords . "' nohref></area>\n";
  //echo "<area type='poly' coords='" . $newcoords . "'></area>\n";
}

$bitsare=explode("}", $htmlis);
$onebit=$bitsare[0] . "}";
$newh=str_replace($onebit, substr($onebit,0,(-1 + strlen($onebit))) . " context.stroke(); \n  elem.style.cursor='pointer';  \n} \n " . $midbit, str_replace("</map>", $abit . "<area onclick=defclick(event); shape='default' nohref></area></map>", $htmlis));
if (strpos($newh, "function ouralert(") === false) {
  $newh=str_replace("</sc" . "ript>", "\n" . $midbit . "\n" . "</sc" . "ript>", $newh);
}
if (!file_exists('regions.html') && strpos(('' . $_SERVER['QUERY_STRING']), 'zoom=') === false && strpos(('' . $_SERVER['QUERY_STRING']), 'uselatlaong=') === false) {
  file_put_contents('regions.html', $newh);
}
echo $newh;
?>
