<?php
// map.php
// RJM Programming
// December, 2016
// Interface to Google Charts Map Chart
// http://www.rjmprogramming.com.au/PHP/Map/map.php?title=Other%20Side%20Of%20the%20World&onclick=y&label=[%27Lat%27,&value=%27Lon%27,%27Name%27]&data=,[49.259998,-123.110001,~Vancouver%2C%20Canada%7C-8https%3A%2F%2Fwww.wunderground.com%2Fq%2Fzmw%3A00000.6.71042%7C12%3A33%7CAmerica%2FVancouver~],[-49.259998,56.889999,~Other%20side%20of%20the%20world%20to%20...%20Vancouver%2C%20Canada~]

require('../php_database.php');


$php_map_db=[""];

function pm_server_remote_addr() {
    $rma = $_SERVER['REMOTE_ADDR'];
    $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
    // you can add different browsers with the same way ..
    if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
            $rma = '000000'.$rma;
    elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
            $rma = '00000'.$rma;
    elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
            $rma = '0000'.$rma;
    elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
            $rma = '000'.$rma;
    elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
            $rma = '00'.$rma;
    elseif(strpos($ua, ' applewebkit') !== false)
            $rma = '0'.$rma;
    elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua)) {
            $rma = '0000000'.$rma;
    }
    return str_replace("/","_",$rma);
}

function nocomm($inwcr) {
    $outwcr=$inwcr;
    $outa=explode("/" . "/ ", $inwcr);
    if (sizeof($outa) > 1) {
      $newa=$outa[0];
      for ($ij=1; $ij<sizeof($outa); $ij++) {
        if (strpos("\n", $outa[$ij]) !== false) {
          $newa.=str_replace((explode("\n", $outa[$ij])[0] . "\n"), "\n", $outa[$ij]); 
        } else {
          $newa.=str_replace((explode(".", $outa[$ij])[0] . "."), "", $outa[$ij]); 
        }
      }
      $outwcr=$newa;
    }
    if (substr((trim($outwcr) . " "),0,1) != ',') {
    //echo "1: " . str_replace('+',' ',str_replace('};','',str_replace('"', "'", str_replace("\n", " ", ("," . $outwcr)))));
    return str_replace('+',' ',str_replace('};','',str_replace('"', "'", str_replace("\n", " ", ("," . $outwcr)))));
    } else {
    //echo "2: " . str_replace('+',' ',str_replace('};','',str_replace('"', "'", str_replace("\n", " ", $outwcr))));
    return str_replace('+',' ',str_replace('};','',str_replace('"', "'", str_replace("\n", " ", $outwcr))));
    }
}

  $promptsuffix="";
  $optsfound="";
  $options_suffix="";
  $map_style_tailored="";
  $myfnameis="val";
  $dbval="";
  $dbval = include_get_params(dirname(__FILE__) . '/../php_database.php?' . $myfnameis . '=');  
  
  if ($dbval != "") {
   for ($idbv=0; $idbv<sizeof($php_map_db); $idbv++) {
     if (strpos(('~' . $php_map_db[$idbv]), ('~' . pm_server_remote_addr() . '`')) !== false) {
       $optsfound=(pm_server_remote_addr() . '`');
       $options_suffix=(explode((pm_server_remote_addr() . '`'), $php_map_db[$idbv])[1]);
       $optsfound=(pm_server_remote_addr() . '`') . $options_suffix;
       $options_suffix=urldecode($options_suffix);
     }
   }
   if (isset($_POST['custom_map'])) {
      $c_m=nocomm(urldecode($_POST['custom_map']));
      $herestr=file_get_contents(dirname(__FILE__) . "/map.php");
      if ($optsfound != "") {
      file_put_contents(dirname(__FILE__) . "/map.php", str_replace($optsfound, (pm_server_remote_addr() . '`' . urlencode($c_m)), $herestr));
      $options_suffix=$c_m;
      } else {
      $phpdb=explode('[' . '"' . '"' . '', $herestr)[0];
      $phprest=str_replace(($phpdb . '[' . '"' . '"' . ''), '', $herestr);
      file_put_contents(dirname(__FILE__) . "/map.php", ($phpdb . '[' . '"' . '"' . '') . ',"' . (pm_server_remote_addr() . '`' . urlencode($c_m)) . '"' . $phprest);
      $options_suffix=$c_m;
      }
   } else if (isset($_GET['custom_map'])) {
      $c_m=nocomm(urldecode($_GET['custom_map']));
      $herestr=file_get_contents(dirname(__FILE__) . "/map.php");
      if ($optsfound != "") {
      file_put_contents(dirname(__FILE__) . "/map.php", str_replace($optsfound, (pm_server_remote_addr() . '`' . urlencode($c_m)), $herestr));
      $options_suffix=$c_m;
      } else {
      $phpdb=explode('[' . '"' . '"' . '', $herestr)[0];
      $phprest=str_replace(($phpdb . '[' . '"' . '"' . ''), '', $herestr);
      file_put_contents(dirname(__FILE__) . "/map.php", ($phpdb . '[' . '"' . '"' . '') . ',"' . (pm_server_remote_addr() . '`' . urlencode($c_m)) . '"' . $phprest);
      $options_suffix=$c_m;
      }
   }
   if ($options_suffix == "") {
     $promptsuffix="  You have none so far, but you can read Styling Maps section of https://developers.google.com/chart/interactive/docs/gallery/map about ... ,maps: { ... prefixed ... ]}} ... suffixed ... entry you can tailor your maps with here. ";
   } else {
     $promptsuffix="  You have one defined already, but you can read Styling Maps section of https://developers.google.com/chart/interactive/docs/gallery/map about ... ,maps: { ... prefixed ... ]}} ... suffixed ... entry you can tailor your maps with here. ";
   }
  } else if (isset($_POST['custom_map'])) {
      $options_suffix=nocomm(urldecode($_POST['custom_map']));
  } else if (isset($_GET['custom_map'])) {
      $options_suffix=nocomm(urldecode($_GET['custom_map']));
  }

// Use URL like ./tz_places.php?upto= to populate arrays below ...
$nearname=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Choibalsan","Asia/Chongqing","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Lisbon","Europe/Ljubljana","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Wake","Pacific/Wallis","Australia/Perth","Antarctica/Troll","Asia/Chita","Asia/Khandyga","Asia/Srednekolymsk","Asia/Ust-Nera","Europe/Busingen","Pacific/Bougainville",""];
$nearlatitude=["5.31666","5.55","9.03333","36.78333","15.33333","12.65","4.36666","13.46666","11.85","-15.78334","-4.26667","-3.38334","30.05","33.65","35.88333","9.51666","14.66666","-6.8","11.6","4.05","27.15","8.5","-24.65001","-17.83334","-26.25","4.85","0.31666","15.6","-1.95","-4.3","6.45","0.38333","6.13333","-8.8","-11.66667","-15.41667","3.75","-25.96667","-29.46667","-26.3","2.06666","6.3","-1.28334","12.11666","13.51666","18.1","12.36666","6.48333","0.33333","32.9","36.8","-22.56667","51.88","61.21805","18.2","17.05","-7.2","-34.6","-28.46667","-31.4","-24.18334","-29.43334","-32.88334","-51.63334","-24.78334","-31.53334","-33.31667","-26.81667","-54.8","12.5","-25.26667","48.75861","-12.98334","20.8","13.1","-1.45","17.5","51.41666","2.81666","4.6","43.61361","69.11388","-20.45","21.08333","10.5","4.93333","19.3","41.85","28.63333","9.93333","49.1","-15.58334","12.18333","76.76666","64.06666","59.76666","39.73916","42.33138","15.3","53.55","-6.66667","13.7","-3.71667","46.19999","64.18333","53.33333","21.46666","12.05","16.23333","14.63333","-2.16667","6.8","44.65","23.13333","29.06666","39.76833","41.29583","38.37555","38.49194","37.95305","38.74777","38.67722","41.05138","68.34972","63.73333","18","58.30194","38.25416","36.82972","12.15083","-16.5","-12.05","34.05222","18.05138","-9.66667","12.15","-3.13334","18.06666","14.6","25.83333","23.21666","45.10777","20.96666","55.12694","19.4","47.05","46.1","25.66666","-34.88334","45.51666","16.71666","25.08333","40.71416","49.01666","64.50111","-3.85","47.26416","47.11638","46.845","29.56666","8.96666","66.13333","5.83333","33.44833","18.53333","10.65","-8.76667","18.46833","48.71666","62.81666","-8.05","50.4","74.69555","-9.96667","30.3","-2.43334","-33.45","18.46666","-23.53334","70.48333","36.78555","57.17638","17.88333","47.56666","17.3","14.01666","18.35","13.15","50.28333","14.1","76.56666","48.38333","32.53333","43.65","18.45","49.26666","60.71666","49.88333","59.54694","62.44999","-66.28334","-68.58334","-66.66667","-54.5","-67.6","-77.83334","-64.8","-67.56667","-90","-69.00612","-78.40001","78","12.75","43.25","31.95","64.75","44.51666","50.28333","37.95","33.35","26.38333","40.38333","13.75","33.88333","42.9","4.93333","48.06666","29.56666","6.93333","33.5","23.71666","-8.55","25.3","38.58333","31.5","45.75","31.53333","10.75","22.28333","48.01666","52.26666","-6.16667","-2.53334","31.76666","34.51666","53.01666","24.86666","39.48333","27.71666","22.53333","56.01666","3.16666","1.55","29.33333","22.23333","59.56666","-5.11667","14.58333","23.6","35.16666","53.75","55.03333","55","51.21666","11.55","-0.03334","39.01666","25.28333","44.8","16.78333","24.63333","46.96666","39.66666","37.55","31.23333","1.28333","25.05","41.33333","41.71666","35.66666","27.46666","35.65444","47.91666","43.8","17.96666","43.16666","62","56.85","40.18333","37.73333","32.28333","28.1","14.91666","62.01666","32.63333","64.15","-54.26667","-15.91667","-51.70001","-34.91667","-27.46667","-31.95","-39.93334","-12.46667","-31.71667","-42.88334","-20.26667","-31.55","-37.81667","-33.86667","52.36666","42.5","37.96666","44.83333","52.5","48.15","50.83333","44.43333","47.5","47","55.66666","53.33333","36.13333","49.44999","60.16666","54.15","41.01666","49.19999","54.71666","50.43333","38.71666","46.05","49.6","40.4","35.9","60.1","53.9","43.69999","55.75","59.91666","48.86666","42.43333","50.08333","56.94999","41.9","53.19999","43.91666","43.86666","44.94999","41.98333","42.68333","59.33333","59.41666","41.33333","48.61666","47.15","41.90222","48.21666","54.68333","48.73333","52.25","45.8","47.83333","47.38333","-18.91667","-7.33334","-10.41667","-12.16667","-11.68334","-49.35278","-4.66667","4.16666","-20.16667","-12.78334","-20.86667","-13.83334","-36.86667","-43.95","7.41666","-27.15","-17.66667","-3.13334","-9.36667","-18.13334","-8.51667","-0.9","-23.13334","-9.53334","13.46666","21.30694","16.75","1.86666","5.31666","9.08333","7.15","-9","28.21666","-0.51667","-19.01667","-29.05","-22.26667","-14.26667","7.33333","-25.06667","6.96666","-9.5","-21.23334","15.2","-17.53334","1.41666","-21.16667","19.28333","-13.3","-31.95","-72.01139","52.05","62.65638","67.46666","64.56027","47.69999","-6.21667"," "];
$nearlongitude=["-4.03334","-0.21667","38.7","3.05","38.88333","-8","18.58333","-16.65","-15.58334","35","15.28333","29.36666","31.25","-7.58334","-5.31667","-13.71667","-17.43334","39.28333","43.15","9.7","-13.2","-13.25","25.91666","31.05","28","31.6","32.41666","32.53333","30.06666","15.3","3.4","9.45","1.21666","13.23333","27.46666","28.28333","8.78333","32.58333","27.5","31.1","45.36666","-10.78334","36.81666","15.05","2.11666","-15.95","-1.51667","2.61666","6.73333","13.18333","10.18333","17.1","-176.65806","-149.90028","-63.06667","-61.8","-48.2","-58.45","-65.78334","-64.18334","-65.3","-66.85","-68.81667","-69.21667","-65.41667","-68.51667","-66.35","-65.21667","-68.3","-69.96667","-57.66667","-91.62167","-38.51667","-105.25","-59.61667","-48.48334","-88.2","-57.11667","-60.66667","-74.08334","-116.2025","-105.05278","-54.61667","-86.76667","-66.93334","-52.33334","-81.38334","-87.65","-106.08334","-84.08334","-116.51667","-56.08334","-69","-18.66667","-139.41667","-120.23334","-104.98417","-83.04584","-61.4","-113.46667","-69.86667","-89.2","-38.5","-59.95","-51.73334","-60.41667","-71.13334","-61.75","-61.53334","-90.51667","-79.83334","-58.16667","-63.6","-82.36667","-110.96667","-86.15806","-86.625","-86.34473","-87.27862","-86.76139","-85.06723","-87.52862","-86.60306","-133.71667","-68.46667","-76.8","-134.41973","-85.75945","-84.84917","-68.27667","-68.15","-77.05","-118.24278","-63.04723","-35.71667","-86.28334","-60.01667","-63.08334","-61.08334","-97.5","-106.41667","-87.61417","-89.61667","-131.57639","-99.15001","-56.33334","-64.78334","-100.31667","-56.18334","-73.56667","-62.21667","-77.35","-74.00639","-88.26667","-165.40639","-32.41667","-101.77778","-101.29917","-101.41084","-104.41667","-79.53334","-65.73334","-55.16667","-112.07334","-72.33334","-61.51667","-63.9","-66.10612","-94.56667","-92.08306","-34.9","-104.65001","-94.82917","-67.8","-114.86667","-54.86667","-70.66667","-69.9","-46.61667","-21.96667","-108.68639","-135.30195","-62.85","-52.71667","-62.71667","-61","-64.93334","-61.23334","-107.83334","-87.21667","-68.78334","-89.25","-117.01667","-79.38334","-64.61667","-123.11667","-135.05001","-97.15001","-139.72723","-114.35","110.51666","77.96666","140.01666","158.95","62.88333","166.6","-64.1","-68.13334","0","39.59","106.89999","16","45.2","76.95","35.93333","177.48333","50.26666","57.16666","58.38333","44.41666","50.58333","49.85","100.51666","35.5","74.6","114.91666","114.5","106.58333","79.85","36.3","90.41666","125.58333","55.3","68.8","34.46666","126.68333","35.095","106.66666","114.14999","91.64999","104.33333","106.8","140.7","35.23333","69.2","158.65","67.05","75.98333","85.31666","88.36666","92.83333","101.7","110.33333","47.98333","113.58333","150.8","119.39999","121","58.58333","33.36666","87.11666","82.91666","73.4","51.35","104.91666","109.33333","125.75","51.53333","65.46666","96.16666","46.71666","142.7","66.8","126.96666","121.46666","103.85","121.5","69.3","44.81666","51.43333","89.64999","139.74472","106.88333","87.58333","102.6","131.93333","129.66666","60.6","44.5","-25.66667","-64.76667","-15.4","-23.51667","-6.76667","-16.9","-21.85","-36.53334","-5.7","-57.85","138.58333","153.03333","141.45","143.86666","130.83333","128.86666","147.31666","149","159.08333","144.96666","151.21666","4.9","1.51666","23.71666","20.5","13.36666","17.11666","4.33333","26.1","19.08333","28.83333","12.58333","-6.25","-5.35","-2.53334","24.96666","-4.46667","28.96666","-2.11667","20.5","30.51666","-9.13334","14.51666","6.15","-3.68334","14.51666","19.95","27.56666","7.38333","37.58333","10.75","2.33333","19.26666","14.43333","24.1","12.48333","50.15","12.46666","18.41666","34.1","21.43333","23.31666","18.05","24.75","19.83333","22.3","9.51666","12.45305","16.33333","25.31666","44.41666","21","15.96666","35.16666","8.53333","47.51666","72.41666","105.71666","96.91666","43.26666","70.2175","55.46666","73.5","57.5","45.23333","55.46666","-171.73334","174.76666","-176.55001","151.78333","-109.43334","168.41666","-171.08334","-171.23334","178.41666","179.21666","-89.6","-134.95","160.2","144.75","-157.85834","-169.51667","-157.33334","162.98333","167.33333","171.2","-139.5","-177.36667","166.91666","-169.91667","167.96666","166.45","-170.7","134.48333","-130.08334","158.21666","147.16666","-159.76667","145.75","-149.56667","173","-175.16667","166.61666","-176.16667","115.85","2.535","113.46666","135.55388","153.71666","143.22666","8.68333","155.56666","  "];
$nearoffset=array();
$neartnow=array();
$seltz="";
$wparts=[];

$seltz="<select onchange='tzsuffix=calcofftimenow(this,String.fromCharCode(32));' style='display:none' id='seltz'><option value=''>Please select a Time Zone place ...</option></select>";
if (1 == 1) {
for ($ik=0; $ik<((sizeof($nearname) * 1) / 1 - 2); $ik++) {
  if (substr($nearlatitude[$ik],0,1) != " ") {
    $origin_dtz = new DateTimeZone("UTC"); //Europe/London");  // Thanks to //php.net/manual/en/function.timezone-offset-get.php
    $remote_dtz = new DateTimeZone($nearname[$ik]);
    $origin_dt = new DateTime("now", $origin_dtz);
    $remote_dt = new DateTime("now", $remote_dtz);
    if (1 == 1) {   // better idea is ...
    $bnow = new DateTime(null, $remote_dtz);
    $offset = $bnow->getOffset() / 3600.0;
    } else {
    $offset = ($remote_dtz->getOffset($remote_dt) - $origin_dtz->getOffset($origin_dt)) / 3600.0;  
    }
    array_push($nearoffset, $offset);  
    array_push($neartnow, $remote_dt->format('Y/m/d/H:i'));  
    $aseltz=explode("/",$nearname[$ik]);
    //array_push($neartnow, $remote_dt->format('H:i'));  
    //$aseltz=explode("/",$nearname[$ik]);
    $seltz=str_replace("</select>", "<option value='" . str_replace("_"," ",$aseltz[-1 + sizeof($aseltz)]) . "' title='|" . str_replace("+-","-",("+" . $offset)) . "|" . $remote_dt->format('Y/m/d/H:i') . ";" . $nearlatitude[$ik] . "," . $nearlongitude[$ik] . "'>" . $nearname[$ik] . "</option>"  . "</select>",$seltz);
  }
}
}


  if (file_exists("csv.php")) {
    include "csv.php";
  } else if (file_exists("../csv.php")) { 
    include "../csv.php";
  }
  function retval($inv) {
    if (strpos($inv, "E-") !== false) return "0";
    return $inv;
  }

  function dlltf($gettzname, $getgmtoff, $getrightnow, $dllmode, $dllbitsmode, $tzais, $lastpar) {
      global $dllt, $dlltbits, $nearname, $nearoffset, $neartnow, $dllw, $dllwbits;
      $getweather=$lastpar;
      if ($dllmode >= 0 && $dllbitsmode >= 0) {
      //echo "\ngWeaTHER=" . $lastpar;
       $dllarr=explode("|", $dllt);
       $dllbitsarr=explode("|", $dlltbits);
       if (sizeof($dllarr) > $dllmode && sizeof($dllbitsarr) > $dllbitsmode) {
        return $dllarr[$dllmode] . "|" . $dllbitsarr[$dllbitsmode];
       } else if (sizeof($dllarr) > $dllmode) {
        return $dllarr[$dllarr] . "|";
       } else if (sizeof($dllbitsarr) > $dllbitsmode) {
        return "|" . $dllbitsarr[$dllbitsarr];
       } else {
        return "|";
       }
      } else if ($dllmode >= 0) {
      //echo "\ngWeaThER=" . $lastpar;
       $dllarr=explode("|", $dllt);
       if (sizeof($dllarr) > $dllmode) {
        return $dllarr[$dllmode];
       } else {
        return "";
       }
      } else if ($dllbitsmode >= 0) {
      //echo "\ngWeAThER=" . $lastpar;
       $dllbitsarr=explode("|", $dlltbits);
       if (sizeof($dllbitsarr) > $dllbitsmode) {
        return $dllbitsarr[$dllbitsmode];
       } else {
        return "";
       }
      } else {
      //echo "\ngWeAThER= =" . $lastpar;
       //echo "\n1: ... " . $zdllarr[0] . " ... " . $zdllarr[1] . " ... " . $zdllarr[2] . " ... " . $zdllarr[3] . " ... " . " getgmtoff,gettzname,getrightnow=" . $getgmtoff . ' ... ' . $gettzname . ' ... ' . $getrightnow;
       if (str_replace("?","",$getgmtoff) == "") {
         if (array_search($gettzname, $nearname) !== false) {
           $getgmtoff=$nearoffset[array_search($gettzname, $nearname)];
           if (str_replace("?","",$getrightnow) == "") {
            $getrightnow=$neartnow[array_search($gettzname, $nearname)];
           }
         }
       } 
       if (str_replace("?","",$getrightnow) == "") {
         if (array_search($gettzname, $nearname) !== false) {
           $getrightnow=$neartnow[array_search($gettzname, $nearname)];
         }
       } 
       //echo "\n2: getgmtoff,gettzname,getrightnow=" . $getgmtoff . ' ... ' . $gettzname . ' ... ' . $getrightnow;
       if ($getgmtoff != "" && $gettzname != "") {
      //echo "\ngWeAThER= = =" . $lastpar . " ... " . $dllt;
        $arrdll=explode("|", $dllt);
        if ($dllt != "") $dllt.="|";
        if ($dlltbits != "") {
          $dlltbits.=" else if (ir == " . $tzais . ") { ";
        } else {
          $dlltbits=" if (ir == " . $tzais . ") { ";
        }
        if ($getrightnow != "") {
         $huhw=explode("http", $getrightnow);
         if (sizeof($huhw) > 1) {
           $getnonw=$huhw[0];
           if ($getweather == "") $getweather=str_replace($getnonw . "http", "http", $getrightnow);
           $getrightnow=$getnonw;
         }
         if (strpos($gettzname,"/") === false && strpos($getgmtoff, ":") !== false) {
           $spareg=$gettzname;
           $gettzname=$getrightnow;
           $getrightnow=$getgmtoff;
           $getgmtoff=$spareg;
         }
         $dlltm="TimeZone " . $gettzname . " (GMT " . str_replace("+-","-",("+" . $getgmtoff)) . ") (where it is " . $getrightnow . ") Information=T";
         $dllt.=$dlltm; //"TimeZone " . $gettzname . " (GMT " . str_replace("+-","-",("+" . $getgmtoff)) . ") (where it is " . $getrightnow . ") Information=T";
      //echo "\ngWeAThER= = =- =" . $lastpar . " ... " . $dllt . "\n getweather=" . $getweather;
        } else {
         $dlltm="TimeZone " . $gettzname . " (GMT " . str_replace("+-","-",("+" . $getgmtoff)) . ") Information=T";
         $dllt.=$dlltm; //"TimeZone " . $gettzname . " (GMT " . str_replace("+-","-",("+" . $getgmtoff)) . ") Information=T";
      //echo "\ngWeAThER= = = =" . $lastpar . " ... " . $dllt . "\n getweather=" . $getweather;
        }
        $dlltbitsm="window.open('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($gettzname) . "','_blank');";
        $dlltbits.=$dlltbitsm; //"window.open('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($gettzname) . "','_blank');";
        echo "\n" . ' if (' . $tzais . ' >= 0) {  while (tzarr.length < ' . $tzais . ') { tzbrr.push(""); tzbrrbits.push(""); tzarr.push(""); tzarrbits.push("");  }  } ' . "\n" . ' tzarr.push("' . $dlltm . '"); ' . "\n";
        echo "\n" . ' tzarrbits.push("' . $dlltbitsm . '"); ' . "\n";

        if (strpos($dllwbits, "'',") !== false) $dllwbits="";

        if ($dllw != "") {
         $dllw.="|";
        } 

        if ($getweather != "") {
         $dllw.="Weather=W";
         //if (isset($_GET['nojwin']) != -1 || isset($_GET['nojwinyes']) != -1 || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
         //$zdlltbitsm="location.href='" . $getweather . "';";
         //} else {
         $zdlltbitsm="window.open('" . $getweather . "','_blank');";
         //}
        if ($dllwbits != "") {
          $dllwbits.=" else if (ir == " . $tzais . ") { ";
        } else {
          $dllwbits=" if (ir == " . $tzais . ") { ";
        }
        $dllwbits.=$zdlltbitsm;
         echo "\n" . ' tzbrrbits.push("' . $zdlltbitsm . '"); tzbrr.push("Weather=W");  ' . "\n";
        } else {
          echo "\n" . ' tzbrrbits.push(""); tzbrr.push(""); ' . "\n";
        }

        $dlltbits.=" } ";
        if (strpos($dllwbits, "if (ir") !== false) $dllwbits.="   } ";
      // }
      } else {
      echo "\nGWeaTHER=" . $lastpar;
       $arrdll=explode("|", $dllt);
       $dllt.="|";
       if ($dlltbits != "") {
          $dlltbits.=" else if (ir == " . $tzais . ") { ir=ir; } ";
       } else {
          $dlltbits=" if (ir == " . $tzais . ") { ir=ir } ";
       }
      }
      }
      return "";
  }

  function whereinwparts($wpa, $sf) {
   global $wparts;
   $rq=-1;
   for ($irq=0; $irq<sizeof($wpa); $irq++) {
     if (strpos($wpa[$irq], $sf) !== false) {
       $wparts[$irq]="";
       return $irq;
     }
   }
   return $rq;
  }

// http://www.rjmprogramming.com.au/PHP/Map/map.php?title=Other%20Side%20Of%20the%20World&onclick=y&label=[%27Lat%27,&value=%27Lon%27,%27Name%27]&data=,[-16.500000,-68.150002,~La%20Paz%2C%20Bolivia%7C-4https%3A%2F%2Fwww.wunderground.com%2Fq%2Fzmw%3A00000.2.85201%7C17%3A04%7CAmerica%2FLa_Paz~],[16.5,111.849998,~Other%20side%20of%20the%20world%20to%20...%20La%20Paz%2C%20Bolivia|%20|%20|%20~]
// ,[-16.500000,-68.150002,~La Paz, Bolivia|-4https://www.wunderground.com/q/zmw:00000.2.85201|17:04|America/La_Paz~],[16.5,111.849998,~Other side of the world to ... La Paz, Bolivia| | | ~]
  function tzlook($inwithtz) {  // am expecting PlaceName|TimeZoneName|GMTOffset|TimeRightNow from inside data 
   global $dllt, $dlltbits, $wparts, $dllw, $dllwbits, $GETtitle, $nearname, $nearlatitude, $nearlongitude;
   $inherefrom=",[";
   $inhereto=",[";
   $sdp="~],";
   $pdp="";
   $lastb="";
   $fcs="";
   $okcc="";
   $tzsofar="";
   if (strpos($GETtitle, "/") !== false) {
    // Australia Antarctica/Macquarie/2018-02-22_10:28:16 (GMT11)
    if (strpos(explode("/", $GETtitle)[0], " ") !== false) {
     $fcs="," . explode(explode(" ",explode("/", $GETtitle)[0])[-1 + sizeof(explode(" ",explode("/", $GETtitle)[0]))] . "/", $GETtitle)[0];
 if (1 == 1) {
     try {
        $tzsofar=explode(" ",explode("/", $GETtitle)[0])[-1 + sizeof(explode(" ",explode("/", $GETtitle)[0]))];
        $stz=explode("/", $GETtitle);
        $jkh=1;
        while (strcmp(substr($stz[$jkh],0,1),'A') >= 0 && strcmp(substr($stz[$jkh],0,1),'Z') <= 0) {
          $tzsofar.="/" . $stz[$jkh];
          $jkh++;
        }
        //if (isset($_GET['x'])) file_put_contents("xx.html", "<html><body><p>1:" . $tzsofar . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");

        $dtz=new DateTimeZone($tzsofar);
        //if (isset($_GET['x'])) file_put_contents("xx.html", "<html><body><p>2:" . $tzsofar . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");
        $cloc=$dtz->getLocation(); 
        //if (isset($_GET['x'])) file_put_contents("xx.html", "<html><body><p>3:" . $tzsofar . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");
        $okcc=$cloc['country_code']; 
        //if (isset($_GET['x'])) file_put_contents("x.html", "<html><body><p>" . $fcs . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");
     } catch (Exception $eqwd) { }
 }
    }
    $ootz = new DateTimeZone("UTC");
    $jj=0;
    $dorigin_dt = new DateTime("now", $ootz);
    for ($best1=0; $best1<sizeof($nearname); $best1++) {
     $yokcc=false;
     if ($okcc != "" && strpos(str_replace("+("," (",str_replace(","," ",$GETtitle)), (" " . $nearname[$best1] . "/")) === false) {
       try {
        $dtz=new DateTimeZone($nearname[$best1]);
        $cloc=$dtz->getLocation(); 
        if (strcmp($okcc,$cloc['country_code']) == 0) $yokcc=true; 
       } catch (Exception $epou) { 
        //if (isset($_GET['x']) && strpos($epou->getMessage(), "Unknown or bad timezone") === false) file_put_contents("xxxxxx.html", $epou->getMessage());
       }
     }
     if ($yokcc || strpos(str_replace("+("," (",str_replace(","," ",$GETtitle)), (" " . $nearname[$best1] . "/")) !== false) {
        if ($inwithtz == "") { 
         $inwithtz=",[";
         $sdp="~]";
         $pdp="";
         $lastb="";
        } else if (strpos($inwithtz,"~") === false) {
         $inwithtz=",[";
         $sdp="~]";
         $pdp="";
         $lastb="";
        } else {
         $lastb="[";
        }
        try {
        //if (isset($_GET['x'])) echo "<p>here</p>";
        //if (isset($_GET['x'])) exit;
        if (!$yokcc) $dtz = new DateTimeZone($nearname[$best1]);
        $dremote_dt = new DateTime("now", $dtz);
        $ooffset = ($dtz->getOffset($dremote_dt) - $ootz->getOffset($dorigin_dt)) / 3600;
        // ,[-33.869999,151.210007,~Sydney, Australia|11https://www.wunderground.com/q/zmw:00000.16.94768|13:10|Australia/Sydney~],[33.869999,-28.78999300000001,~Other side of the world to ... Sydney, Australia| | | ~]
        if ($yokcc) {
        $inhereto.=$pdp . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . explode("/", $nearname[$best1])[-1 + sizeof(explode("/", $nearname[$best1]))] . $fcs . "|" . $ooffset . "|" . $dremote_dt->format('Y-m-d_H:i:s') . "|" . $nearname[$best1] . $sdp;
        } else {
        $xbitsare=explode((" " . $nearname[$best1] . "/"), str_replace("+("," (",str_replace(","," ",$GETtitle)));
        $inhereto.=$pdp . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . explode("/", $nearname[$best1])[-1 + sizeof(explode("/", $nearname[$best1]))] . $fcs . "|" . $ooffset . "|" . explode(" ", $xbitsare[1])[0] . "|" . $nearname[$best1] . $sdp;
        }
        if ($sdp == "~]") {
         $pdp=",[";
        } else {
         $pdp="[";
        }
        } catch (Exception $excc) {  }
     }
    }
   }
   //if (isset($_GET['x'])) file_put_contents("xxx.html", "<html><body><p>" . $inhereto . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");
   $inwithtz=str_replace($inherefrom, $inhereto . $lastb, $inwithtz);
   if ($inhereto != ",['") {
      echo "\n paramdata=paramdata.replace(',[','" . $inhereto . $lastb . "'); \n";
      if (strlen($fcs) > 1 && $tzsofar != "") {
        $flagfor=@file_get_contents("HTTP://emojiterra.com/flag-for-" . str_replace(" ","-",strtolower(substr($fcs,1))));
        if (strpos($flagfor, ">HTML dec</td><td") !== false) {
          $fbitsare=explode(">HTML dec</td><td", $flagfor);
          $ehd=str_replace("&amp;","&",explode("<",explode(">", $fbitsare[1])[1])[0]);
          $GETtitle=str_replace($tzsofar, " " . $ehd . " " . $tzsofar, $GETtitle);
        }
      }
   }
   //if (isset($_GET['x'])) file_put_contents("xxxx.html", "<html><body><p>" . $inhereto . "</p><br><p>" . $inwithtz . "</p><br><p>" . $GETtitle . "</p></body></html>");
   if (strpos($inwithtz, "]") === false) {
      $inwithtz=urldecode($inwithtz);
   }
   $outwithouttz=$inwithtz;
   $wparts=explode("]", $inwithtz);
   if (strpos($inwithtz, "|") !== false) {
     if ($dllt == "") {
       $withinbar=explode("|", $inwithtz);

           $gweather="";
           for ($iiz=0; $iiz<sizeof($withinbar); $iiz++) {
             if (strpos($withinbar[$iiz], "http") !== false && $gweather == "") {
           $zhuhw=explode("http", (";" . $withinbar[$iiz]));
           $zgetnonw=$zhuhw[0];
           $gweather=str_replace($zgetnonw . "http", "http", (";" . $withinbar[$iiz]));
           $inwithtz=str_replace($gweather,"",$inwithtz);
           $withinbar=explode("|", $inwithtz);
           //echo "\ngweather=" . $gweather;
             }
           }

       $outwithouttz=$withinbar[0];
       if (strpos($inwithtz, "|" . "+") === false && strpos($inwithtz, "|" . " ") === false && strpos($inwithtz, "|" . "?") === false && strpos($inwithtz, "|" . "-") === false && strpos($inwithtz, "|" . "0") === false) {
       for ($iwb=1; $iwb<sizeof($withinbar); $iwb+=1) {
         if (strpos($withinbar[$iwb + 0], "~") !== false) {
          $withoutbar=explode("~", $withinbar[$iwb + 0]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 0]);
          //echo "\ngWeather=" . $gweather;
          dlltf($withoutbar[0], "?", "?", -1, -1, whereinwparts($wparts, $withoutbar[0]), $gweather);
         } else if (strpos($withinbar[$iwb + 0], '"') !== false) {
          $withoutbar=explode('"', $withinbar[$iwb + 0]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 0]);
          //echo "\ngWeaTher=" . $gweather;
          dlltf($withoutbar[0], "?", "?", -1, -1, whereinwparts($wparts, $withoutbar[0]), $gweather);
         } else if (strpos($withinbar[$iwb + 0], "'") !== false) {
          $withoutbar=explode("'", $withinbar[$iwb + 0]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 0]);
          //echo "\ngWeatheR=" . $gweather;
          dlltf($withoutbar[0], "?", "?", -1, -1, whereinwparts($wparts, $withoutbar[0]), $gweather);
         } else {
          $outwithouttz.="";
         }
       }
       } else { 
       for ($iwb=1; $iwb<sizeof($withinbar); $iwb+=3) {
         if (strpos($withinbar[$iwb + 2], "~") !== false) {
          $withoutbar=explode("~", $withinbar[$iwb + 2]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 2]);
          //echo "\ngWeAther=" . $gweather;
          dlltf($withinbar[$iwb], $withinbar[$iwb + 1], $withoutbar[0], -1, -1, whereinwparts($wparts, $withinbar[$iwb]), $gweather);
         } else if (strpos($withinbar[$iwb + 2], '"') !== false) {
          $withoutbar=explode('"', $withinbar[$iwb + 2]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 2]);
          //echo "\nGWeather=" . $gweather;
          dlltf($withinbar[$iwb], $withinbar[$iwb + 1], $withoutbar[0], -1, -1, whereinwparts($wparts, $withinbar[$iwb]), $gweather);
         } else if (strpos($withinbar[$iwb + 2], "'") !== false) {
          $withoutbar=explode("'", $withinbar[$iwb + 2]);
          $outwithouttz.=str_replace($withoutbar[0],"",$withinbar[$iwb + 2]);
          //echo "\ngWeathEr=" . $gweather;
          dlltf($withinbar[$iwb], $withinbar[$iwb + 1], $withoutbar[0], -1, -1, whereinwparts($wparts, $withinbar[$iwb]), $gweather);
         } else {
          $outwithouttz.="";
         }
       }
       }
     }
   }
   if (isset($_GET['x'])) file_put_contents("xxxxx.html", "<html><body><p>" . $inhereto . "</p><br><p>" . $outwithouttz . "</p><br><p>" . $GETtitle . "</p></body></html>");
   return $outwithouttz;
  }

?>
<html>
  <head> 
    <title>Map - RJM Programming - //www.rjmprogramming.com.au (Copyright &copy; 2013 rjmprogramming.com.au all rights reserved.)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

   var dllw='', dllt='', dllwbits='', dlltbits='', dllc='Draw Link Lines=D', lastel=null, ifoeo='', x=-1, y=-1, prevx=-1, prevy=-1, posx=-1, posy=-1, elemLeft=0, elemTop=0, ir=-1, ic=-1, talkingpoint='', lcnt=0, lasttrip='', thisplace='', lastplace='';   

   var tzarr=[], tzarrbits=[], tzbrr=[], tzbrrbits=[], tzsuffix='', tzoffs=[], tztns=[];

   var datalineprefix='', datalineprefix2='';
    
   var aconto, pclong=['0','0'], polong=0.0, polat=0.0, poplace='';; 
   var pnum=1,lastfi=false,xpnum=1; // done here at supervisor
   var allowed=true; // done here at supervisor
   var nojwinextra=""; // done here at supervisor
   var topdocumentURLindexOfnojwin='';
<?php
  if (!isset($_POST['data'])) {
  echo "
   var dposted=false;
   if (document.URL.indexOf('nojwin') == -1 && (topdocumentURLindexOfnojwin.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i))) {
     if (document.URL.indexOf('?') == -1) {
       location.href=document.URL.split('#')[0] + '?nojwin=Q';
     } else if (document.URL.indexOf('&data=') != -1) {
       location.href=document.URL.split('#')[0] + '&nojwinyes=Q';
     } else {
       location.href=document.URL.split('#')[0] + '&nojwin=Q';
     }
   }
   ";
  } else {
  echo "
   var dposted=true;
   ";
  }
  if (isset($_GET['dposted'])) {
  echo "
   dposted=true;
   ";
  }
  if (isset($_POST['nojwin']) || isset($_POST['nojwinyes']) || isset($_GET['nojwinyes']) || (isset($_POST['data']) && (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')))) {
    echo " \n topdocumentURLindexOfnojwin='nojwinyes'; \n";
  } else if (dposted) {
    echo " \n if (top.document.URL.indexOf('rjmprogramming.com.au/PHP/Map/map.php') == -1) { topdocumentURLindexOfnojwin=top.document.URL.replace('nojwin','nojwinyes'); } \n";
  } else {
    echo " \n  if (top.document.URL.indexOf('rjmprogramming.com.au/PHP/Map/map.php') == -1) { topdocumentURLindexOfnojwin=top.document.URL; } \n";
  }
?>
   if (topdocumentURLindexOfnojwin.indexOf('nojwin') != -1 || document.URL.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i)) {
     nojwinextra="&nojwinyes=Y";
   }

// var xpnum=1; // done back at supervisor
// var allowed=true; // done back at supervisor

if (topdocumentURLindexOfnojwin.indexOf('nojwin') != -1 || document.URL.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i)) {
var prompt = function(zwords, defwords){
   var vcancel='';
   var vok='';
   if (!document.getElementById('val' + pnum) && document.getElementById('val' + eval(-1 + pnum)) && (' ' + zwords).indexOf(' Is there something ') != -1) {
     pnum--;
   }
   var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
   if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
   if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
     vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
     vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
   }
   if ((' ' + zwords).indexOf(' Is there something ') != -1) {
     document.title+=' its ' + pnum + ' ' + xpnum + ' ' + vcancel + ' ' + vok + ' ' + zwords.substring(0,80);
     if (!document.getElementById('val' + pnum)) document.title+=' x ';
     if (document.getElementById('val' + eval(-1 + pnum))) document.title+=' o ';
   }
   if (vcancel != '') {
     pnum++;
     return null;
   } else if (vok != '') {
     pnum++;
     return ansis;
   } else if (document.getElementById('val' + pnum)) {
     allowed=false;
     lastfi=true;
     document.getElementById('safariform').style.display='block';
     document.getElementById('prompt').value=zwords;
     document.getElementById('val' + pnum).value=defwords;
     document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
     if (zwords.split(String.fromCharCode(10)).length > eval('0' + document.getElementById('prompt').rows)) {
       document.getElementById('prompt').rows=zwords.split(String.fromCharCode(10)).length;
     } else if (zwords.split('<br>').length > eval('0' + document.getElementById('prompt').rows)) {
       document.getElementById('prompt').rows=zwords.split('<br>').length;
     }
     document.getElementById('val' + pnum).focus();
     pnum++;
     return ansis;
   } else if (lastfi) {
     pnum++;
     lastfi=false;
     if (ansis == 'null') return null;
     return ansis;
   } else {
     pnum++;
     if (ansis == 'null') return null;
     return ansis;
   }
};
var alert = function(zwords){
   var defwords='';
   var vcancel='';
   var vok='';
   var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
   if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
   if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
     vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
     vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
   }
   if (vcancel != '') {
     pnum++;
     return null;
   } else if (vok != '') {
     pnum++;
     return '';
   } else if (document.getElementById('val' + pnum)) {
     allowed=false;
     lastfi=true;
     document.getElementById('safariform').style.display='block';
     document.getElementById('prompt').value=zwords;
     document.getElementById('val' + pnum).value=defwords;
     document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
     document.getElementById('Cancel').style.display='none';
     document.getElementById('bCancel').style.display='none';
     document.getElementById('val' + pnum).style.display='none';
     document.getElementById('OK').focus();
     pnum++;
     return ansis;
   } else if (lastfi) {
     pnum++;
     lastfi=false;
     if (ansis == 'null') return null;
     return ansis;
   } else {
     pnum++;
     if (ansis == 'null') return null;
     return ansis;
   }
};
var confirm = function(zwords){
   //alert('val' + pnum + '=? ' + ' pnum=' + pnum + ' xpnum=' + xpnum + ' ' + document.URL);
   var defwords='1trueYesOK';
   var vcancel='';
   var vok='';
   var ansis=location.search.split('val' + pnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + pnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
   if (document.URL.indexOf('val' + pnum + '=') == -1) ansis=null;
   if (document.URL.indexOf('val' + pnum + '=') != -1 && pnum == eval(-1 + xpnum)) {
     vcancel=location.search.split('Cancel=')[1] ? location.search.split('Cancel=')[1].split('&')[0] : '';
     vok=location.search.split('OK=')[1] ? location.search.split('OK=')[1].split('&')[0] : '';
   }
   //alert('vok=' + vok);
   if (vcancel != '') {
     pnum++;
     return null;
   } else if (vok != '') {
     pnum++;
     return '1trueYesOK';
   } else if (document.getElementById('val' + pnum)) {
     allowed=false;
     lastfi=true;
     document.getElementById('safariform').style.display='block';
     document.getElementById('prompt').value=zwords;
     document.getElementById('val' + pnum).value=defwords;
     document.getElementById('hval' + pnum).value=encodeURIComponent(defwords);
     document.getElementById('val' + pnum).style.display='none';
     document.getElementById('OK').focus();
     pnum++;
     return ansis;
   } else if (lastfi) {
     pnum++;
     lastfi=false;
     if (ansis == 'null') return null;
     return ansis;
   } else {
     pnum++;
     if (ansis == 'null') return null;
     return ansis;
   }
};
}


// Thanks to http://jennifermadden.com/javascript/stringEnterKeyDetector.html
function checkEnter(e){ //e is event object passed from function invocation
var characterCode; //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
document.getElementById('hval' + xpnum).value=encodeURIComponent(document.getElementById('val' + xpnum).value);
document.forms[-1 + eval(document.forms.length)].submit(); //submit the form
return false;
}
else{
return true;
}

}

function preexpandthen() {
  var xabi="";
         if (top.document.getElementById('snearest')) {
           xabi=top.document.getElementById('snearest').innerHTML;
           if (xabi != "") expandthen(xabi);
         } else if (parent.document.getElementById('snearest')) {
           xabi=parent.document.getElementById('snearest').innerHTML;
           if (xabi != "") expandthen(xabi);
         } else if (document.getElementById('snearest')) {
           xabi=document.getElementById('snearest').innerHTML;
           if (xabi != "") expandthen(xabi);
         }
}

function expandthen(abi) {
       var optionarrs=abi.split('</option>'), stored='', repit='', withit='', placns="", placn, iplacn;
       //alert(optionarrs.length + ' aconto.body.innerHTML=' + aconto.body.innerHTML);
       
       for (var ioptarrs=1; ioptarrs<optionarrs.length; ioptarrs++) {
        repit='youllneverfindthis';
        withit='youllneverfindthis';
        if (1 == 1 || optionarrs[ioptarrs].replace(/>/g,'/').indexOf('/' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0] + '/') != -1) {
          repit=", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0] + ", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0];
          withit=", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0];
        }
        if (ioptarrs == 1) {
         if (parent.document.getElementById('my_video')) {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf("/") != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored+="<br><a style=text-decoration:underline;cursor:pointer;background-color:pink; onclick=\"parent.document.getElementById('my_video').style.display='block'; parent.document.getElementById('my_video').src='//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=" + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(placn) + "';\" title=WeatherViaOtherSideOfTheWorld>" + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + "</a>&nbsp;";
         } else {
         stored+="<br><a style=text-decoration:underline;cursor:pointer;background-color:pink; onclick=\"parent.document.getElementById('my_video').style.display='block'; parent.document.getElementById('my_video').src='//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=" + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + "';\" title=WeatherViaOtherSideOfTheWorld>" + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + "</a>&nbsp;";
         }
         } else {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf('/') != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored+='<br><a target=_blank style=background-color:pink; href=//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=' + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(placn) + ' title=WeatherViaOtherSideOfTheWorld>' + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + '</a>&nbsp;';
         } else {
         stored+='<br><a target=_blank style=background-color:pink; href=//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=' + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + ' title=WeatherViaOtherSideOfTheWorld>' + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + '</a>&nbsp;';
         }
         }
         if (optionarrs[ioptarrs].indexOf('</select>') == -1 && optionarrs[ioptarrs].indexOf(' (') == -1) {
         stored+='<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + '</a>&nbsp;';
         } else if (optionarrs[ioptarrs].indexOf('</select>') == -1) {
         stored+='<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + ' (' + optionarrs[ioptarrs].split(' (')[1].split(')')[0] + ')</a>&nbsp;';
         }
        } else {
        if (stored != '') {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf("/") != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored=stored.replace(' title=WeatherViaOtherSideOfTheWorld','&altplacethree=' + encodeURIComponent(placn) + ' title=WeatherViaOtherSideOfTheWorld');
         } else {
         stored=stored.replace(' title=WeatherViaOtherSideOfTheWorld','&altplacethree=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + ' title=WeatherViaOtherSideOfTheWorld');
         }
        }
        if (optionarrs[ioptarrs].indexOf('</select>') == -1 && optionarrs[ioptarrs].indexOf(' (') == -1) {
         document.getElementById('pretz').innerHTML+=stored + '<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + '</a>&nbsp;';
        } else if (optionarrs[ioptarrs].indexOf('</select>') == -1) {
         document.getElementById('pretz').innerHTML+=stored +'<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + ' (' + optionarrs[ioptarrs].split(' (')[1].split(')')[0] + ')</a>&nbsp;';
        }
        stored='';
        }
       }
       if (aconto.body.innerHTML.indexOf('</select>') != -1) {
          stored+='<br><select' + aconto.body.innerHTML.split('<select')[-1 + aconto.body.innerHTML.split('<select').length].split('</select>')[0].replace(' style=',' data-style=') + '</select><br>';
       }
       //alert('stored=' + stored);
       if (parent.document.getElementById('pretz')) {
       parent.document.getElementById('pretz').innerHTML+=stored;
       if (stored != '') {
         parent.document.getElementById('itz').style.display='none';
       } else {
         parent.document.getElementById('itz').style.display='block';
       }
       } else {
       document.getElementById('pretz').innerHTML+=stored;
       if (stored != '') {
         document.getElementById('itz').style.display='none';
       } else {
         document.getElementById('itz').style.display='block';
       }
       }
}


function expand(iois) {
  if (iois != null) {
    var placns="", placn, iplacn;
    aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
     if (aconto.document) { aconto = aconto.document; }
     if (aconto.body != null) {
       var abi=aconto.body.innerHTML;
       if (navigator.userAgent.match(/iPhone|iPad/i)) {
         abi=abi;
         alert(abi);
       } else if (abi.length == 0) {
         if (top.document.getElementById('snearest')) {
           abi=top.document.getElementById('snearest').innerHTML;
         } else if (parent.document.getElementById('snearest')) {
           abi=parent.document.getElementById('snearest').innerHTML;
       //alert(parent.document.getElementById('snearest').innerHTML.length + ' parent.document.getElementById(snearest).innerHTML=' + parent.document.getElementById('snearest').innerHTML);
         } else if (document.getElementById('snearest')) {
           abi=document.getElementById('snearest').innerHTML;
       //alert(parent.document.getElementById('snearest').innerHTML.length + ' parent.document.getElementById(snearest).innerHTML=' + parent.document.getElementById('snearest').innerHTML);
         }
       }
       if (abi.length == 0 || abi.toLowerCase().indexOf("/option") == -1) {
       setTimeout(preexpandthen,2000);
       } else if (1 == 1) {
       //if (abi.indexOf('Hobart') != -1) alert(abi);
       expandthen(abi);
       } else if (1 == 11) {
       var optionarrs=abi.split('</option>'), stored='', repit='', withit='';
       //alert(optionarrs.length + ' aconto.body.innerHTML=' + aconto.body.innerHTML);
       
       for (var ioptarrs=1; ioptarrs<optionarrs.length; ioptarrs++) {
        repit='youllneverfindthis';
        withit='youllneverfindthis';
        if (1 == 1 || optionarrs[ioptarrs].replace(/>/g,'/').indexOf('/' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0] + '/') != -1) {
          repit=", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0] + ", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0];
          withit=", " + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0];
        }
        if (ioptarrs == 1) {
         if (parent.document.getElementById('my_video')) {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf("/") != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored+="<br><a style=text-decoration:underline;cursor:pointer;background-color:pink; onclick=\"parent.document.getElementById('my_video').style.display='block'; parent.document.getElementById('my_video').src='//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=" + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(placn) + "';\" title=WeatherViaOtherSideOfTheWorld>" + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + "</a>&nbsp;";
         } else {
         stored+="<br><a style=text-decoration:underline;cursor:pointer;background-color:pink; onclick=\"parent.document.getElementById('my_video').style.display='block'; parent.document.getElementById('my_video').src='//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=" + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + "';\" title=WeatherViaOtherSideOfTheWorld>" + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + "</a>&nbsp;";
         }
         } else {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf('/') != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored+='<br><a target=_blank style=background-color:pink; href=//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=' + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(placn) + ' title=WeatherViaOtherSideOfTheWorld>' + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + '</a>&nbsp;';
         } else {
         stored+='<br><a target=_blank style=background-color:pink; href=//www.rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm?place=' + encodeURIComponent((optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit)) + nojwinextra + '&altplace=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + ' title=WeatherViaOtherSideOfTheWorld>' + (optionarrs[ioptarrs].split(' from ')[-1 + optionarrs[ioptarrs].split(' from ').length].split(' (')[0] + ', ' + optionarrs[ioptarrs].split(' in ')[-1 + optionarrs[ioptarrs].split(' in ').length].split(' is ')[0]).replace(repit,withit) + '</a>&nbsp;';
         }
         }
         if (optionarrs[ioptarrs].indexOf('</select>') == -1 && optionarrs[ioptarrs].indexOf(' (') == -1) {
         stored+='<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + '</a>&nbsp;';
         } else if (optionarrs[ioptarrs].indexOf('</select>') == -1) {
         stored+='<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + ' (' + optionarrs[ioptarrs].split(' (')[1].split(')')[0] + ')</a>&nbsp;';
         }
        } else {
        if (stored != '') {
         if (optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").indexOf("/") != -1) {
         placns=optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").split('/');
         placn=placns[eval(-1 + placns.length)];
         for (iplacn=eval(-2 + placns.length); iplacn>=eval(-2 + placns.length); iplacn--) {
         placn+=', ' + placns[iplacn];
         }
         stored=stored.replace(' title=WeatherViaOtherSideOfTheWorld','&altplacethree=' + encodeURIComponent(placn) + ' title=WeatherViaOtherSideOfTheWorld');
         } else {
         stored=stored.replace(' title=WeatherViaOtherSideOfTheWorld','&altplacethree=' + encodeURIComponent(optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"")) + ' title=WeatherViaOtherSideOfTheWorld');
         }
        }
        if (optionarrs[ioptarrs].indexOf('</select>') == -1 && optionarrs[ioptarrs].indexOf(' (') == -1) {
         document.getElementById('pretz').innerHTML+=stored + '<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + '</a>&nbsp;';
        } else if (optionarrs[ioptarrs].indexOf('</select>') == -1) {
         document.getElementById('pretz').innerHTML+=stored +'<a target=_blank style=background-color:yellow; href=HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"") + ' title=TimeZoneConverter>' + optionarrs[ioptarrs].split(' value=')[-1 + optionarrs[ioptarrs].split(' value=').length].split('>')[0].replace(/"/g,"").replace(/_/g,' ') + ' (' + optionarrs[ioptarrs].split(' (')[1].split(')')[0] + ')</a>&nbsp;';
        }
        stored='';
        }
       }
       if (aconto.body.innerHTML.indexOf('</select>') != -1) {
          stored+='<br><select' + aconto.body.innerHTML.split('<select')[-1 + aconto.body.innerHTML.split('<select').length].split('</select>')[0].replace(' style=',' data-style=') + '</select><br>';
       }
       //alert('stored=' + stored);

       document.getElementById('pretz').innerHTML+=stored;
       if (stored != '') {
         document.getElementById('itz').style.display='none';
       } else {
         document.getElementById('itz').style.display='block';
       }
       }
     }
    }
  }
}

<?php echo "\n var topdocumentURL=\"" . $_SERVER['HTTP_REFERER'] . "\"; \n"; ?>

function jnocomm(inwcr) {
    outwcr=inwcr;
    outa=inwcr.split("/" + "/ ");
    if (outa.length > 1) {
      newa=outa[0];
      for (ij=1; ij<outa.length; ij++) {
        if (outa[ij].indexOf(String.fromCharCode(10)) != -1) {
          newa+=outa[ij].replace(outa[ij].split(String.fromCharCode(10))[0] +  String.fromCharCode(10), String.fromCharCode(10)); 
        } else {
          newa+=outa[ij].replace(outa[ij].split(".")[0] + ".", ""); 
        }
      }
      outwcr=newa;
    }
    while (outwcr.indexOf(String.fromCharCode(10)) != -1) {
      outwcr=outwcr.replace(String.fromCharCode(10), " ");
    }
    while (outwcr.indexOf('"') != -1) {
      outwcr=outwcr.replace('"', "'");
    }
    while (outwcr.indexOf('+') != -1) {
      outwcr=outwcr.replace('+', ' ');
    }
    if ((outwcr.trim() + " ").substring(0,1) != ',') {
    return ("," + outwcr).replace('};','');
    } else {
    return outwcr.replace('};','');
    }
}


function calcofftimenow(osels,sugg) {
  var rva="";
  if (sugg == '') {
    osels.value='';
  } else if (sugg.replace(' ','') != '') {
    if (osels.innerHTML.indexOf('="' + sugg.split('|')[0] + '"') != -1) {
     osels.value=sugg.split('|')[0];
    } else {
     osels.value='';
    }
  } 
  if (osels.value != "") {
    var lalo=osels.options[osels.selectedIndex].title;
    var asugg=sugg.split('|');
    if (asugg.length < 3) {
     if (lalo.indexOf(';') != -1) {
      rva="|" + osels.options[osels.selectedIndex].text + lalo; 
     } else {
      rva="|" + osels.options[osels.selectedIndex].text + "|+0|00:00;" + lalo; 
     }
    }
  }
  tzsuffix=rva;
  return rva;
}

  function ourprompt(ourp1, ourp2) {
      var ourp1lines=ourp1.split(String.fromCharCode(10));
      if (ourp1lines.length > 10) {
         if (navigator.userAgent.match(/Android/i)) { 
           while (ourp1.indexOf(String.fromCharCode(10)) != -1) {
             ourp1=ourp1.replace(String.fromCharCode(10), '  ');
           }
           ourp1=ourp1.replace('Is there something you want to try with ','Options for ');
           ourp1=ourp1.replace('Comma Separated Values Spreadsheet Export','CSV Export');
           ourp1=ourp1.replace('Email with or without Talking Point','Email');
           ourp1=ourp1.replace('else leave as blank or as is or choose Cancel to leave the status quo.','else ...');
           ourp1=ourp1.replace('Moon Angle at Noon','Moon Angle');
           ourp1=ourp1.replace('(where it is ','(');
         } 
      } 
      var thisris = prompt(ourp1, ourp2); 
      if (document.getElementById('safariform')) {
      if (document.getElementById('hval1')) {
        if (decodeURIComponent(document.getElementById('hval1').value).indexOf('rjmprogramming.com.au') != -1) {
          return document.getElementById('hval1').value;
        }
       }
      }
      return thisris;
  }

function giveandtake(dpr) {
   if (dpr.indexOf('|') != -1 && dpr.indexOf(';') != -1) {
      if (datalineprefix2 != '') {
      datalineprefix2+=dpr.split(';')[0];
      } else {
      datalineprefix+=dpr.split(';')[0];
      }
      return dpr.split(';')[1];
   }
   return dpr;
}

function ourencodeURIComponent(insis) {
  var outsis=encodeURIComponent(insis), ebits;
  var kbits=insis.split('&');
  var jbits=insis.split('=');
  var altsis='';
  if (eval(kbits.length) > 1 && eval(jbits.length) > 1 && eval(kbits.length) == eval(jbits.length) && eval(jbits[0].length) > eval(kbits[0].length)) {
    altsis=encodeURIComponent(kbits[0]);
    for (var iu=1; iu<eval(jbits.length); iu++) {
        ebits=kbits[iu].split('=');
        altsis+='&' + ebits[0] + '='; // &title=
        altsis+=encodeURIComponent(ebits[1]);  // hello
    }
  }
  if (altsis != '') return altsis;
  return outsis;
}

function maybeir(indl, inir) {
  if (tzarr.length > inir) {
    if (tzarr[inir] != "") {
     return tzarr[inir] + String.fromCharCode(10);
    } else {
     return "";
    }
  } else if (tzarr.length <= inir && dllt != "") {
    return "";
  }
  return indl;
}

function maybeirw(indl, inir) {
  if (tzbrr.length > inir) {
    if (tzbrr[inir] != "") {
     return tzbrr[inir] + String.fromCharCode(10);
    } else {
     return "";
    }
  } else if (tzbrr.length <= inir && dllw != "") {
    return "";
  }
  return indl;
}

function handleStart(evt) {
  evt.preventDefault();
  more(lastel, 1);
}

function draw_a_line() {
  lcnt++;
  //document.getElementById('xydiv').innerHTML+='<svg height="' + Math.abs(y - prevy) + '" width="' + Math.abs(x - prevx) + '" title="' + lasttrip + '" id="sl' + lcnt + '"  style="position:absolute;z-index:8;margin-top:0px;margin-left:0px;" xmlns="//www.w3.org/2000/svg"><line title="' + lasttrip + '" id="l' + lcnt + '" onclick="more(this);" style="stroke:red;stroke-width:4;" x1="' + prevx + '" y1="' + prevy + '" x2="' + x + '" y2="' + y + '" /></svg>';
  //document.getElementById('xydiv').innerHTML+='<svg id="sl' + lcnt + '"  style="position:absolute;z-index:8;margin-top:0px;margin-left:0px;top:' + prevy + 'px;" xmlns="//www.w3.org/2000/svg"><g><title>' + lasttrip + '</title><line id="l' + lcnt + '" onmouseover="more(this,0);" onclick="more(this,1);" style="stroke:red;stroke-width:4;" x1="' + prevx + '" y1="' + 0 + '" x2="' + x + '" y2="' + eval(y - prevy) + '" /></g></svg>';
  document.getElementById('xydiv').innerHTML='<svg id="sl' + lcnt + '"  style="position:absolute;z-index:8;margin-top:0px;margin-left:0px;top:' + prevy + 'px;" xmlns="//www.w3.org/2000/svg"><g><title>' + distmore(lasttrip) + '</title><line id="l' + lcnt + '" onmouseover="more(this,0);" onclick="more(this,1);" style="stroke:red;stroke-width:4;" x1="' + prevx + '" y1="' + 0 + '" x2="' + x + '" y2="' + eval(y - prevy) + '" /></g></svg>';
  lastel=document.getElementById(document.getElementById('l' + lcnt));
  if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
    lastel.addEventListener("touchstart", handleStart, false);  // idea via https://developer.mozilla.org/en-US/docs/Web/API/Touch_events
  }
  more(lastel, 0);
}

<?php  
      $opa='';     
      $dllc='Draw Link Lines=D';
      $dllw='';
      $dllt='';
      $dllwbits='';
      $dlltbits='';
      $wlok=true;
        if (isset($_GET['rightnow'])) {
          if (strpos($_GET['rightnow'], "http") !== false) $wlok=false;
        } else if (isset($_POST['rightnow'])) {
          if (strpos($_POST['rightnow'], "http") !== false) $wlok=false;
        }
      if (isset($_GET['wlink']) && $wlok) $dllw="Weather=W";
      if (isset($_POST['wlink']) && $wlok) $dllw="Weather=W";
      if (isset($_GET['gmtoff']) && isset($_GET['tzname'])) {
        if (isset($_GET['rightnow'])) {
         $dllt="TimeZone " . urldecode($_GET['tzname']) . " (GMT " . str_replace("+-","-",("+" . $_GET['gmtoff'])) . ") (where it is " . urldecode($_GET['rightnow']) . ") Information=T";
        } else {
         $dllt="TimeZone " . urldecode($_GET['tzname']) . " (GMT " . str_replace("+-","-",("+" . $_GET['gmtoff'])) . ") Information=T";
        }
        $dlltbits="window.open('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($_GET['tzname']) . "','_blank');";
      }
      if (isset($_POST['gmtoff']) && isset($_POST['tzname'])) {
        if (isset($_POST['rightnow'])) {
         $dllt="TimeZone " . urldecode($_POST['tzname']) . " (GMT " . str_replace("+-","-",("+" . $_POST['gmtoff'])) . ") (where it is " . urldecode($_POST['rightnow']) . ") Information=T";
        } else {
         $dllt="TimeZone " . urldecode($_POST['tzname']) . " (GMT " . str_replace("+-","-",("+" . $_POST['gmtoff'])) . ") Information=T";
        }
        $dlltbits="window.open('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($_POST['tzname']) . "','_blank');";
      }
      if (isset($_GET['wlink']) && $wlok) $dllwbits="window.open('" . urldecode($_GET['wlink']) . "','_blank');";
      if (isset($_POST['wlink']) && $wlok) $dllwbits="window.open('" . urldecode($_POST['wlink']) . "','_blank');";
      $GETtp="";
      if (isset($_GET['tp'])) $GETtp = urldecode($_GET['tp']);
      if (isset($_POST['tp'])) $GETtp = urldecode($_POST['tp']);
      if ($GETtp != "") echo "\n talkingpoint=String.fromCharCode(10) + String.fromCharCode(10) + " . '"' . str_replace("`", '" + String.fromCharCode(10) + "', str_replace("\n", '" + String.fromCharCode(10) + "', $GETtp)) . '"' . " + String.fromCharCode(10) + String.fromCharCode(10); \n";

      $GETr = "";
      $GETc = "";
      if (isset($_GET['r'])) $GETr = urldecode($_GET['r']);
      if (isset($_POST['r'])) $GETr = urldecode($_POST['r']);
      if (isset($_GET['c'])) $GETc = urldecode($_GET['c']);
      if (isset($_POST['c'])) $GETc = urldecode($_POST['c']);
      if ($GETr != "") echo "\n ir=eval('" . $GETr . "'); \n";
      if ($GETc != "") echo "\n ic=eval('" . $GETc . "'); \n";

      $GETx = "";
      $GETy = "";
      if (isset($_GET['x'])) $GETx = urldecode($_GET['x']);
      if (isset($_POST['x'])) $GETx = urldecode($_POST['x']);
      if (isset($_GET['y'])) $GETy = urldecode($_GET['y']);
      if (isset($_POST['y'])) $GETy = urldecode($_POST['y']);
      if ($GETx != "" && $GETy != "") {
        echo "\n x=eval('" . $GETx . "'); \n";
        echo "\n y=eval('" . $GETy . "'); \n";
      }

      $GETtitle = "Places";
      $GETlabel = "['Lat',";
      $GETvalue = "'Lon', 'Name']";
      $GETdata = ",[37.4232, -122.0853, 'Work'],[37.4289, -122.1697, 'University'],[37.6153, -122.3900, 'Airport'],[37.4422, -122.1731, 'Shopping']";
            
      echo "var data, chart, pardata = (location.search.split('data=')[1] ? location.search.split('data=')[1].split('&')[0] : ''), paramdata=decodeURIComponent(pardata);\n";
      if (isset($_GET['value'])) {
       $GETtitle = $_GET['title'];
       $GETlabel = str_replace("\\","",$_GET['label']);
       $GETvalue = str_replace("\\","",$_GET['value']);
       $GETdata = tzlook($_GET['data']);
      } else if (isset($_POST['value'])) {
       $GETtitle = urldecode($_POST['title']);
       $GETlabel = str_replace("\\","",urldecode($_POST['label']));
       $GETvalue = str_replace("\\","",urldecode($_POST['value']));
       $GETdata = tzlook(urldecode($_POST['data']));
      }
      
      
      $hdgs = split(",", $GETvalue);
      $GETval = "";
      if (isset($hdgs[0])) $GETval = "'" . str_replace("'", "", $hdgs[0]) . "'";
      if (isset($hdgs[1])) $GETval .= ",'" . str_replace("'", "", $hdgs[1]) . "'";
      if (isset($hdgs[2])) $GETval .= ",'" . str_replace("'", "", $hdgs[2]) . "'";
      if (isset($hdgs[3])) $GETval .= ",'" . str_replace("'", "", $hdgs[3]) . "'";
      
      $ifoeo="";
      
      echo "var xparamdata=\"" . str_replace('"',"'",$GETdata) . "\";\n";
      $GETonclick = "";
      if (isset($_GET['onclick'])) $GETonclick = urldecode($_GET['onclick']) + " ";
      if (isset($_POST['onclick'])) $GETonclick = urldecode($_POST['onclick']) + " ";
      $GETlines = "";
      $GETlinescall = "";
      if (isset($_GET['lines'])) $GETlines = "\n if (eval(prevx) >= 0 && eval(prevy) >= 0 && eval(x) >= 0 && eval(y) >= 0) { setTimeout(draw_a_line,500); } \n";
      if (isset($_POST['lines'])) $GETlines =  "\n if (eval(prevx) >= 0 && eval(prevy) >= 0 && eval(x) >= 0 && eval(y) >= 0) { setTimeout(draw_a_line,500); } \n";
      if ($GETlines != "") $GETlinescall = "\n postcollectclick(olat + '~' + olong + '~' + oplace); \n";
      if ($GETlines != "") $dllc='Link Lines Pen Up=D';
      if ($GETlines != "") $opa='opacity:0.8;';
      echo "\n dllc='" . $dllc . "'; \n";
      if ($dllw != "") echo "\n dllw='" . $dllw . "' + String.fromCharCode(10) + String.fromCharCode(10); \n tzbrr.push(dllw); \n";
      if ($dllwbits != "") echo "\n dllwbits=\"" . str_replace('"',"'",$dllwbits) . "\" + String.fromCharCode(10) + String.fromCharCode(10); \n tzbrrbits.push(dllwbits); \n";
      if ($dllt != "") echo "\n dllt='" . $dllt . "' + String.fromCharCode(10) + String.fromCharCode(10); \n tzarr.push(dllt); \n";
      if ($dlltbits != "") echo "\n dlltbits=\"" . str_replace('"',"'",$dlltbits) . "\" + String.fromCharCode(10) + String.fromCharCode(10); \n tzarrbits.push(dlltbits); \n";
      echo " var selonclick='" . $GETonclick . str_replace("\n","",$GETlines) . "';\n";
      echo " google.load('visualization', '1', {packages:['map']}); " . "\n";
      echo ' google.setOnLoadCallback(drawChart); ' . "\n";
      echo ' function drawChart() { ' . "\n";
 if ((isset($_GET['value']) || isset($_POST['value'])) && (isset($_GET['tooltip']) || isset($_POST['tooltip']) || strpos($GETdata, "'") !== false || strpos($GETdata, '"') !== false)) {
  echo "     data = new google.visualization.DataTable(); /" . "/" . $GETlabel . $GETvalue . " \n";
  echo "   data.addColumn('number', '" . str_replace("'","",str_replace(",","",str_replace("['","",$GETlabel))) . "');  \n";
  //echo "   data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}});  \n";
  echo "   data.addColumn('number', " . str_replace(",", "); data.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); data.addColumn('string', ", str_replace("]","",$GETvalue)) . ");  \n";
  echo " data.addRows([ \n";
      echo str_replace("''" . "''", "''", str_replace("~", "'", substr($GETdata,1)));
  echo "   ]); \n";
 } else {
      echo ' data = google.visualization.arrayToDataTable([ ' . "\n";
      echo " " . $GETlabel . $GETvalue . " \n";
      echo str_replace("''" . "''", "''", str_replace("~", "'", $GETdata));
      echo "        ]);\n";
 }
      
      //echo "        var options = { \n";
      //if (isset($hdgs[3])) {
      //echo "        title: '" . $GETtitle . "', \n";
      //echo "        hAxis: {title: '" . $hdgs[0] . "'}," . " \n";
      //echo "        vAxis: {title: '" . $hdgs[1] . "'}," . " \n";
      //echo "        Map: {textStyle: {fontSize: 11}} \n";
      //} else {
      //echo "        colorAxis: {colors: ['yellow', 'red']} \n";
      //}
      //echo "       }; \n";

      
      if ($GETlines != "" && (!isset($_GET['onclick']) && !isset($_POST['onclick']))) $ifoeo=" if (1 == 2) ";
      
      echo "\n ifoeo='" . $ifoeo . "'; \n";


      echo " chart = new google.visualization.Map(document.getElementById('chart_div')); \n";
      //echo " chart.draw(data, {showTip: true, focusTarget: 'category', tooltip: {isHtml: true}}); \n } \n";
      //echo " chart.draw(data, {focusTarget: 'category',  tooltip: {isHtml: true}, showTip: true}); \n } \n";
      //echo " chart.draw(data, {focusTarget: 'category',  tooltip.isHtml: true, showTip: true}); \n } \n";
      //echo " chart.draw(data, { tooltip: {isHtml: true}, showTip: true }); \n } \n";
      $GEToptions = "";
      if (isset($_GET['options'])) $GEToptions = urldecode($_GET['options']);
      if (isset($_POST['options'])) $GEToptions = urldecode($_POST['options']);
  if (isset($_POST['custom_map'])) {
      $options_suffix=nocomm(urldecode($_POST['custom_map']));
  } else if (isset($_GET['custom_map'])) {
      $options_suffix=nocomm(urldecode($_GET['custom_map']));
  }
  
  
  
  
  echo " if ((parent.document.URL.indexOf('rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm') != -1 || top.document.URL.indexOf('rjmprogramming.com.au/HTMLCSS/other_side_of_the_world.htm') != -1) && !navigator.userAgent.match(/iPhone/i) && !navigator.userAgent.match(/iPad/i)) {  chart.draw(data, { useMapTypeControl:true, tooltip: {isHtml: true}" . $GEToptions . $options_suffix . ", showTip: true,  icons: { default: { normal: '//icons.iconarchive.com/icons/icons-land/vista-map-markers/48/Map-Marker-Ball-Azure-icon.png', selected: '//icons.iconarchive.com/icons/icons-land/vista-map-markers/48/Map-Marker-Ball-Right-Azure-icon.png' } }   ,maps: { styledMap: { name: 'Styled Map', styles: [ {featureType: 'poi.attraction', stylers: [{color: '#fce8b2'}] }, {featureType: 'road.highway', stylers: [{hue: '#0277bd'}, {saturation: -50}] }, {featureType: 'road.highway', elementType: 'labels.icon', stylers: [{hue: '#000'}, {saturation: 100}, {lightness: 50}] }, {featureType: 'landscape', stylers: [{hue: '#259b24'}, {saturation: 10}, {lightness: -22}] } ]}} });  } else { chart.draw(data, { useMapTypeControl:true, tooltip: {isHtml: true}" . $GEToptions . $options_suffix . ", showTip: true  }); } \n"; // } \n";
  $cssis="";
      if ($GETr != "" && $GETc == "") $cssis=" if (1 == 2) { chart.setSelection([{'row': " . $GETr . "}]); } setTimeout(selectHandler,4100); \n";
      if ($GETr == "" && $GETc != "") $cssis=" if (1 == 2) { chart.setSelection([{'column': " . $GETc . "}]); }  setTimeout(selectHandler,4100); \n";
      if ($GETr != "" && $GETc != "") $cssis=" if (1 == 2) { chart.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]); }  setTimeout(selectHandler,4100); \n";

echo "
 if (selonclick != '') { " . $cssis . "
  google.visualization.events.addListener(chart, 'select', selectHandler);
 }
}

function getirplace(idea) {
  var qpbirs=paramdata.split('[');
  if (paramdata == '') qpbirs=xparamdata.split('[');
  var xqpbirs;
  if (eval(1 + ir) >= qpbirs.length) {
    //alert(paramdata);
    return idea;
  }
  if (qpbirs[eval(1 + ir)].indexOf('~') != -1) {
    xqpbirs=qpbirs[eval(1 + ir)].split('~');
    return xqpbirs[1];
  }
  return qpbirs[eval(1 + ir)].split(',')[2];
}

function getirlat(idea) {
  var qpbirs=paramdata.split('[');
  if (paramdata == '') qpbirs=xparamdata.split('[');
  if (eval(1 + ir) >= qpbirs.length) {
    //alert(paramdata);
    return idea;
  }
  return qpbirs[eval(1 + ir)].split(',')[0];
}

function getirlong(idea) {
  var qpbirs=paramdata.split('[');
  if (paramdata == '') qpbirs=xparamdata.split('[');
  if (eval(1 + ir) >= qpbirs.length) {
    //alert(paramdata);
    return idea;
  }
  return qpbirs[eval(1 + ir)].split(',')[1];
}

function brg_check_at_start() {
  var tolatis=0.0, tolongis=0.0, thisp='';
  var brgplace=location.search.split('brgplace=')[1] ? decodeURIComponent(location.search.split('brgplace=')[1]).split('&')[0] : ' ';
  var brgmode=location.search.split('brgmode=')[1] ? decodeURIComponent(location.search.split('brgmode=')[1]).split('&')[0] : '';
  var tmode=true;
  if (brgmode.toLowerCase().replace('f','trip').indexOf('trip') != -1) tmode=false;
  if (brgplace != ' ') {
   var ppbits=xparamdata.split('[');
   if (ppbits.length == 0) ppbits=paramdata.split('[');
   for (var ippbits=1; ippbits<ppbits.length; ippbits++) {
     tolatis=eval(ppbits[ippbits].split(',')[0]);
     tolongis=eval(ppbits[ippbits].split(',')[1]);
     thisp=ppbits[ippbits].split('~')[1].split('~')[0].split('|')[0].replace(/#/g,'Number');
     if (brgplace == '') {
       brg_from(tolatis, tolongis, thisp, tmode);
       brgplace='mvmhvmnbvmnvm';
       return;
     } else if (('' + ippbits) == ('' + brgplace)) {
       brg_from(tolatis, tolongis, thisp, tmode);
       brgplace='mvmhvmnbvmnvm';
       return;
     } else if (('' + thisp) == ('' + brgplace)) {
       brg_from(tolatis, tolongis, thisp, tmode);
       brgplace='mvmhvmnbvmnvm';
       return;
     }
   }
  }
}

function brg_from(xtalis, xgnolis, opl, centralview) {
  //, [39.099912,-94.581213,~Kansas City~] , [38.627089,-90.200203,~St Louis~]
  var oktodo=false, lastlat=-100.0, lastlong=-190.0, tolatis=0.0, tolongis=0.0, bre='', ourtables='<table style=background-color:yellow; border=5><tbody><tr><th style=background-color:#d0d0d0;color:magenta; colspan=3><a title=Up onclick=location.href=\"#myh1\"; style=cursor:pointer;>^</a>&nbsp;&nbsp;' + opl.split('|')[0] + ' ...</th></tr><tr><th>Bearing <br>in Degrees</th><th>Distance <br>in Kilometres</th><th>To</th></tr></tbody></table>';
  var ppbits=xparamdata.split('[');
  if (ppbits.length == 0) ppbits=paramdata.split('[');
  for (var ippbits=1; ippbits<ppbits.length; ippbits++) {
   tolatis=eval(ppbits[ippbits].split(',')[0]);
   tolongis=eval(ppbits[ippbits].split(',')[1]);
   if ((Math.abs(tolatis - eval(lastlat)) > 0.0001 || Math.abs(tolongis - eval(lastlong)) > 0.0001) && (Math.abs(tolatis - eval(xtalis)) > 0.001 || Math.abs(tolongis - eval(xgnolis)) > 0.001)) {
     bre=bearing_from_to(xtalis, xgnolis, tolatis, tolongis, opl); //ppbits[ippbits].split('~')[1].split('~')[0].split('|')[0].replace(/#/g,'Number'));
     if (!centralview && oktodo) {
       ourtables=ourtables.replace('</tbody>','<tr><td colspan=3> ... and then onto ...</td></tr></tbody>');
     }
     ourtables=ourtables.replace('</tbody>','<tr><td style=background-color:#f0f0f0;color:blue;>' + bre + '</td><td>' + ppbits[ippbits].split('~')[1].split('~')[0].split('|')[0].replace(/#/g,'Number') + '</td></tr></tbody>');
     lastlat=tolatis;
     lastlong=tolongis;
     if (!centralview) {
       xtalis=tolatis;
       xgnolis=tolongis;
       opl=ppbits[ippbits].split('~')[1].split('~')[0].split('|')[0].replace(/#/g,'Number');
       //lastlat=-100.0;
       //lastlong=-190.0;
       oktodo=true; //ourtables=ourtables.replace('</tbody>','<tr><td colspan=3> ... and then onto ...</td></tr></tbody>');
     }
   }
  }
  document.getElementById('nearesttz').innerHTML=ourtables;
}

function bearing_from_to(talis, gnolis, latis, longis, olp) {  // http://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/
  var ourbrg=0.0, emojiprefix='', emojisuffix='', thisemoji='';
  //latis=prompt('Second latitude', '' + latis);
  //longis=prompt('Second longitude', '' + latis);
  
  var crs=['n-resize','ne-resize','e-resize','se-resize','s-resize','sw-resize','w-resize','nw-resize'];
    
  var rgnol=eval((gnolis) * Math.PI / 180.0);
  var rtal=eval((talis) * Math.PI / 180.0);
  var rlong=eval((longis) * Math.PI / 180.0);
  var rlat=eval((latis) * Math.PI / 180.0);
  
  if (Math.abs(eval(longis - eval(gnolis))) > 179.99 && Math.abs(eval(latis) + eval(talis)) < 0.001) {
    rtal=0.0;
    if (longis > 90.0) {
      rlong-=eval(90.0 * Math.PI / 180.0);
    } else {
      rlong=eval((longis + eval(90.0 * Math.PI / 180.0)) % Math.PI);
    }
  }
  
  var x_X=eval(Math.cos(rlat) * Math.sin(eval(rlong - eval(rgnol))));
  var y_Y=eval(Math.cos(rtal) * Math.sin(rlat)) - eval(Math.sin(rtal) * Math.cos(rlat) * Math.cos(eval(rlong - eval(rgnol))));

  if (('' + x_X).indexOf('e-') != -1) x_X=0.0;
  if (('' + y_Y).indexOf('e-') != -1) y_Y=0.0;

  ourbrg=eval((Math.atan2(x_X,y_Y) * 180.0) / Math.PI);
  if (ourbrg < 0.0) ourbrg+=360.0;
  
  // 1  o'clock is &#128336;
  // 2  o'clock is &#128337;
  // 12 o'clock is &#128347;
  //  1:30 is &#128348;
  //  2:30 is &#128349;
  // 11:30 is &#128358;
  // 12:30 is &#128359;
  
  // 360 / 24 = 15
  
  var nft=Math.floor(Math.floor(eval((ourbrg + 7.5) % 360.0)) / 15.0);
  var ncrsft=Math.floor(Math.floor(eval((ourbrg + 27.5) % 360.0)) / 45.0);
  
  if (nft == 0) {
    thisemoji='&#128347;';
    emojiprefix='<table><tbody><tr><td>' + thisemoji + '</td><td>';
    emojisuffix='</td></tr></tbody></table>';
  } else if (nft == 1) {
    thisemoji='&#128359;';
    emojiprefix='<table><tbody><tr><td>' + thisemoji + '</td><td>';
    emojisuffix='</td></tr></tbody></table>';
  } if (eval(nft % 2) == 0) {
    thisemoji='&#' + eval(128335 + (nft / 2)) + ';';
    emojiprefix='<table><tbody><tr><td>' + thisemoji + '</td><td>';
    emojisuffix='</td></tr></tbody></table>';
  } else {
    thisemoji='&#' + eval(128347 + ((nft - 1) / 2)) + ';';
    emojiprefix='<table><tbody><tr><td>' + thisemoji + '</td><td>';
    emojisuffix='</td></tr></tbody></table>';
  }
  
  //alert(Math.abs(eval(rlong - eval(rgnol))) + ' x_X=' + x_X + ' and y_Y=' + y_Y + ' ... ' + ourbrg);
  //alert(emojiprefix + ourbrg.toFixed(5) + emojisuffix + '</td><td>' + eval(0.001 * eval(great_circle_distance(talis, gnolis, latis, longis))).toFixed(3));
  //return emojiprefix + ourbrg.toFixed(5) + emojisuffix + '</td><td>' + eval(0.001 * eval(great_circle_distance(talis, gnolis, latis, longis))).toFixed(3);
  return ourbrg.toFixed(5) + ' ' + thisemoji + '</td><td title=\"Kilometres from ' + olp + ' to ...\" style=cursor:' + crs[ncrsft] + ';>' + eval(0.001 * eval(great_circle_distance(talis, gnolis, latis, longis))).toFixed(3);
}

function great_circle_distance(talis, gnolis, latis, longis) {
  var ourdist=0.0;
  var rgnol=eval((gnolis) * Math.PI / 180.0);
  var rtal=eval((talis) * Math.PI / 180.0);
  var rlong=eval((longis) * Math.PI / 180.0);
  var rlat=eval((latis) * Math.PI / 180.0);
  var deltalong = Math.abs(eval(((gnolis)-(longis)) * Math.PI / 180.0));
  var acof = eval(Math.sin(rtal) * Math.sin(rlat)) + (Math.cos(rtal) * Math.cos(rlat) * Math.cos(deltalong)); // via //en.wikipedia.org/wiki/Great-circle_distance ... thanks
  ourdist = eval(Math.round((Math.acos(acof) * 6371000.0) + 0.00001) * 100) / 100;
  return ourdist;
}

function distmore(tofrominfo1) {
    var twoplaces=tofrominfo1.split('_');
    if (twoplaces.length > 1 && tofrominfo1.indexOf(' km)') == -1) {
     for (var ipl=1; ipl<twoplaces.length; ipl++) {
       qbitsare=twoplaces[eval(-1 + ipl)].split('~');
       qlatfrom=eval(qbitsare[0]);
       qlongfrom=eval(qbitsare[1]);
       qplacefrom=twoplaces[eval(-1 + ipl)].replace(qlatfrom + '~' + qlongfrom + '~','').replace(/~/g, ' ');
       qbitsare=twoplaces[ipl].split('~');
       qlatto=eval(qbitsare[0]);
       qlongto=eval(qbitsare[1]);
       qplaceto=twoplaces[ipl].replace(qlatto + '~' + qlongto + '~','').replace(/~/g, ' ');
       var dis=Math.floor(eval(eval(0.001 * great_circle_distance(qlatfrom,qlongfrom,qlatto,qlongto)) + 0.5));
       return tofrominfo1 + ' (' + dis + ' km)';
     }
    }
    return tofrominfo1;
}

function more(svgo,dmode) {
  var qlatfrom=0, qlongfrom=0, qplacefrom='', qlatto=0, qlongto=0, qplaceto='', qbitsare, dih='', dihs, ds;
  if (svgo) {
  dihs=document.body.innerHTML.split('<svg id=' + String.fromCharCode(34) + 's' + svgo.id + '' + String.fromCharCode(34) + '');
  if (dihs.length > 1) {
  dih=dihs[1];
  } else if (document.getElementById('s' + svgo.id)) {
  dih=document.getElementById('s' + svgo.id).innerHTML;
  } 
  var tofrominfo=dih.replace('</title>','<title>').split('<title>');
  if (tofrominfo.length > 1) {
    var twoplaces=tofrominfo[1].split('_');
    if (twoplaces.length > 1) {
     for (var ipl=1; ipl<twoplaces.length; ipl++) {
       qbitsare=twoplaces[eval(-1 + ipl)].split('~');
       qlatfrom=eval(qbitsare[0]);
       qlongfrom=eval(qbitsare[1]);
       qplacefrom=twoplaces[eval(-1 + ipl)].replace(qlatfrom + '~' + qlongfrom + '~','').replace(/~/g, ' ');
       qbitsare=twoplaces[ipl].split('~');
       qlatto=eval(qbitsare[0]);
       qlongto=eval(qbitsare[1]);
       qplaceto=twoplaces[ipl].replace(qlatto + '~' + qlongto + '~','').replace(/~/g, ' ');
       if (qplaceto.indexOf(' km)') != -1 && qplaceto.indexOf(' (') != -1) {
         ds=qplaceto.split(' (');
         qplaceto=ds[0];
       }
       if (Math.floor(eval(eval(0.001 * great_circle_distance(qlatfrom,qlongfrom,qlatto,qlongto)) + 0.5)) > 0) {
       if (dmode == 0) {
        document.title=Math.floor(eval(eval(0.001 * great_circle_distance(qlatfrom,qlongfrom,qlatto,qlongto)) + 0.5)) + ' kilometres separate ' + qplacefrom + ' (' + qlatfrom + ',' + qlongfrom + ') from ' + qplaceto + ' (' + qlatto + ',' + qlongto + ') as the crow flies.';
        document.getElementById('dh1').innerHTML='<font size=1>' + 'As the crow flies it is ' + Math.floor(eval(eval(0.001 * great_circle_distance(qlatfrom,qlongfrom,qlatto,qlongto)) + 0.5)) + ' kilometres from ' + qplacefrom + ' (' + qlatfrom + ',' + qlongfrom + ') to ' + qplaceto + ' (' + qlatto + ',' + qlongto + ').' + '</font>';
       } else {
        alert('As the crow flies it is ' + Math.floor(eval(eval(0.001 * great_circle_distance(qlatfrom,qlongfrom,qlatto,qlongto)) + 0.5)) + ' kilometres from ' + qplacefrom + ' (' + qlatfrom + ',' + qlongfrom + ') to ' + qplaceto + ' (' + qlatto + ',' + qlongto + ').');
       }
       }
     }
    }
  }
  }
}

function collectclick(event) {
       if (event.clientX || event.clientY) {
       posx = event.clientX - elemLeft;
       posy = event.clientY - elemTop;
       } else {
       posx = event.pageX - elemLeft;
       posy = event.pageY - elemTop;
       }
}

function postcollectclick(aplace) {
       if (eval(x) >= 0 && eval(y) >= 0) {
       if (  eval((eval(posx) - eval(x)) * (eval(posx) - eval(x)) +  (eval(posy) - eval(y)) * (eval(posy) - eval(y)) ) > 5) {
        lastplace=thisplace;
        prevx=x;
        prevy=y;
       } else {
        prevx=-1;
        prevy=-1;
       }
       }
       x = posx;
       y = posy;
       thisplace=aplace.replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~').replace(' ','~');
       if (lastplace != '') lasttrip=lastplace + '_' + thisplace;
       " . $GETlines . "       
}

function selectHandler() {
  var relist=['remail',''],ire,andthen='', str, oplace='', numthing='4', ansbits,avblurb=talkingpoint,ans='',mc,mctwo;
  var selection = chart.getSelection();
  var jj=eval(selection.length);
  if (jj == 0 && (eval(ir) >= 0 || eval(ic) >= 0)) jj=1;
  var clong, message = '', olat='-190.0', olong='-190.0', latlongs, delim='',ij;
  var documentheadinnerHTML=document.head.innerHTML;
  mc=documentheadinnerHTML.split('data.a' + 'ddRows([');
  if (mc.length == 2) {
    documentheadinnerHTML=mc[1].replace('[',',[');
  } 
  for (var i = 0; i < jj; i++) {
    var item = selection[i];
 //document.title='ic=' + ic + ' ' + 'ir=' + ir + ' ' + 'item.row=' + item.row + ' item.column=' + item.column;
    if ((eval(ir) >= 0 && eval(ic) < 0)) {
 //document.title='ir=' + ir + ' ';
      str = data.getFormattedValue(ir, 0);
 //document.title+='str=' + str + ' ';
      latlongs=documentheadinnerHTML.replace(/, \[/g,',[').split(',['); // + str + ',');
      olat=eval(str);
      if (1 == 1) {
        oplace='';
        mc=latlongs[eval(1 + ir)].split('>');
        if (mc.length > 1) {
          mctwo=mc[1].split('<');
          oplace=mctwo[0];
        }
        clong=latlongs[eval(1 + ir)].replace(str + ',', '').replace(']',',').split(',');
        olong=eval(clong[0]);
        if (oplace == '') oplace=clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'');
      } else if (eval(eval(latlongs.length) - eval(ir)) == 2) {
        clong=latlongs[eval(1 + ir)].replace(']',',').split(',');
        olong=eval(clong[0]);
        oplace=clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'');
      } else if (eval(eval(latlongs.length) - eval(ir)) > 2) {
        olong='';
        oplace='()';
        for (ij=1; ij<latlongs.length; ij++) {
         clong=latlongs[ij].replace(']',',').split(',');
         olong+=(delim + eval(clong[0]));
         oplace=oplace.replace(')',(delim + (clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'')) + ')'));
         if (delim == '' && selonclick.length > 0 && eval(olong) >= -180.0 && eval(olong) <= 180.0 && eval(olat) >= -90.0 && eval(olat) <= 90.0) {
          andthen=' ';
         } else if (delim == '') {
          oplace='';
         }
         delim=',';
        }
        if (andthen == ' ') {
         andthen='';
         clong=olong.split(',');
         if (ifoeo == '') {
           
           var tprop='';
           if (topdocumentURL.indexOf('rjmprogramming.com.au') != -1) {
           if (top.document.getElementById('mapphpmailbox')) {
             if (parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_'))) {
              tprop=parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_')).title;
              if (top.document.getElementById('mapphpmailbox').value.indexOf(tprop) == -1) {
                if (top.document.getElementById('mapphpmailbox').value == '') {
                  top.document.getElementById('mapphpmailbox').value=tprop;
                } else {
                  top.document.getElementById('mapphpmailbox').value+=';' + tprop;
                }
                tprop=String.fromCharCode(10) + 'As you click multiple places see TimeZone Places supervisor dropdown options' + String.fromCharCode(10);
              }
             }
           }
           }
           
           andthen=ourprompt('Is there something you want to try with Latitude ' + olat + ' and one of Longitudes ' + ('(' + olong + ')').replace('(','([').replace(',','],') + '' + oplace.replace('(','([').replace(',','],').split('|')[0] + ' ? ' + String.fromCharCode(10) + '' + String.fromCharCode(10) + avblurb + '' + 'Google Map=G (optional, plus zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(10) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(10) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(10) + 'Moon Angle at Noon=M' + String.fromCharCode(10) + 'Coriolis Force=C' + String.fromCharCode(10) + '' + 'Nearest Airports=A (optional, plus number of nearest airports[3])' + String.fromCharCode(10) + '' + 'Nearest TimeZone=Z (and onto Other Side of the World and Weather)' + String.fromCharCode(10) + '' + 'YouTube=Y (looking for ' + oplace.split('|')[0] + ')' + String.fromCharCode(10) + '' + dllc + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + tprop + String.fromCharCode(10) + maybeirw(dllw,ir) + maybeir(dllt,ir) + '' + '... and please suffix answer by comma and preferred Longitude to use, else leave as blank or as is or choose Cancel to leave the status quo.', paramdata);
         }
         if (andthen == null) andthen='';
         pclong=[clong[0],clong[1]];
         polong=olong;
         polat=olat;
         poplace=oplace;
         //if (andthen.indexOf(',') == -1 && andthen != '') {
         //  olong=eval(clong[0]);
         //} else if (andthen != '') {
         //  clong=andthen.split(',');
         //  olong=eval(clong[1]);
         //  andthen=clong[0];
         //}
         selectevent(andthen); //,olong,clong);
        }
      }
         " . substr((' ' . $GETlinescall),0,1) . "       
    } else if ((item.row != null && item.column != null) || (eval(ir) >= 0 && eval(ic) >= 0)) {
      if (eval(ir) >= 0 && eval(ic) >= 0) {
  //alert(999);
        item.row=ir;
        item.column=ic;
  //alert(9999);
        ir=-1;
        ic=-1;
      } else {
        ir=item.row;
        ic=item.column;
        //document.title=ir + ',' + ic;
      }
      str = data.getFormattedValue(item.row, item.column);
      clong = str.replace('[','').replace(']','').replace('{','').replace('}','').split(',');
      olat=eval(clong[0]);
      olong=eval(clong[1]);
         " . $GETlinescall . "       
    } else if ((item.row != null) || (eval(ir) >= 0 && eval(ic) < 0)) {
      if (eval(ir) >= 0 && eval(ic) < 0) {
  //alert(999);
        item.row=ir;
        //item.column=ic;
  //alert(9999);
        ir=-1;
        //ic=-1;
      } else {
        ir=item.row;
        //ic=item.column;
        //document.title+='xx:'+ir + ',' + ic;
      }
      str = data.getFormattedValue(item.row, 0);
        //document.title+='zz:'+str;
      latlongs=documentheadinnerHTML.replace(/, \[/g,',[').split(',['); // + str + ',');
        //document.title+='ll:'+latlongs[eval(1 + item.row)].slice(-20);
      olat=eval(str);
      if (1 == 1) {
        oplace='';
        mc=latlongs[eval(1 + item.row)].split('>');
        if (mc.length > 1) {
          mctwo=mc[1].split('<');
          oplace=mctwo[0];
        }
        //document.title+='oplace:'+oplace;
        clong=latlongs[eval(1 + item.row)].replace(str + ',', '').replace(']',',').split(',');
       // document.title+='clong:'+clong;
        olong=eval(clong[0]);
        if (oplace == '') oplace=clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'');
        //document.title+='olong:'+olong;
      } else if (eval(eval(latlongs.length) - eval(item.row)) == 2) {
        clong=latlongs[eval(1 + item.row)].replace(']',',').split(',');
        olong=eval(clong[0]);
        oplace=clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'');
      } else if (eval(eval(latlongs.length) - eval(item.row)) > 2) {
        olong='';
        oplace='()';
        for (ij=1; ij<latlongs.length; ij++) {
         clong=latlongs[ij].replace(']',',').split(',');
         olong+=(delim + eval(clong[0]));
         oplace=oplace.replace(')',(delim + (clong[1].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'')) + ')'));
         if (delim == '' && selonclick.length > 0 && eval(olong) >= -180.0 && eval(olong) <= 180.0 && eval(olat) >= -90.0 && eval(olat) <= 90.0) {
          andthen=' ';
         } else if (delim == '') {
          oplace='';
         }
         delim=',';
        }
        if (andthen == ' ') {
         andthen='';
         clong=olong.split(',');
         if (ifoeo == '') {
         
           var tptrop='';
           if (topdocumentURL.indexOf('rjmprogramming.com.au') != -1) {
           if (top.document.getElementById('mapphpmailbox')) {
             if (parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_'))) {
              tptrop=parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_')).title;
              if (top.document.getElementById('mapphpmailbox').value.indexOf(tprop) == -1) {
                if (top.document.getElementById('mapphpmailbox').value == '') {
                  top.document.getElementById('mapphpmailbox').value=tptrop;
                } else {
                  top.document.getElementById('mapphpmailbox').value+=';' + tptrop;
                }
                tptrop=String.fromCharCode(10) + 'As you click multiple places see TimeZone Places supervisor dropdown options' + String.fromCharCode(10);
              }
             }
           }
           }

           andthen=ourprompt(' Is there something you want to try with Latitude ' + olat + ' and one of Longitudes ' + ('(' + olong + ')').replace('(','([').replace(',','],') + '' + oplace.replace('(','([').replace(',','],').split('|')[0] + ' ? ' + String.fromCharCode(10) + '' + String.fromCharCode(10) + avblurb + '' + 'Google Map=G (optional, plus zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(10) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(10) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(10) + 'Moon Angle at Noon=M' + String.fromCharCode(10) + 'Coriolis Force=C' + String.fromCharCode(10) + '' + 'Nearest Airports=A (optional, plus number of nearest airports[3])' + String.fromCharCode(10) + '' + 'Nearest TimeZone=Z (and onto Other Side of the World and Weather)' + String.fromCharCode(10) + '' + 'YouTube=Y (looking for ' + oplace.split('|')[0] + ')' + String.fromCharCode(10) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + tptrop + String.fromCharCode(10) + '' + '... and please suffix answer by comma and preferred Longitude to use, else leave as blank or as is or choose Cancel to leave the status quo.', paramdata);
         }
         if (andthen == null) andthen='';
         pclong=[clong[0],clong[1]];
         polong=olong;
         polat=olat;
         poplace=oplace;
         //if (andthen.indexOf(',') == -1 && andthen != '') {
         //  olong=eval(clong[0]);
         //} else if (andthen != '') {
         //  clong=andthen.split(',');
         //  olong=eval(clong[1]);
         //  andthen=clong[0];
         //}
         selecteventtwo(andthen); //,olong,clong);
        }
      }
         " . substr((' ' . $GETlinescall),0,1) . "       
    } else if ((item.column != null) || (eval(ir) < 0 && eval(ic) >= 0)) {
      if (eval(ir) >= 0 && eval(ic) < 0) {
  //alert(999);
        //item.row=ir;
        item.column=ic;
  //alert(9999);
        //ir=-1;
        ic=-1;
      } else {
        //ir=item.row;
        ic=item.column;
        //document.title=ir + ',' + ic;
      }
      str = data.getFormattedValue(0, item.column);
      latlongs=documentheadinnerHTML.split(',' + str + ',');
      olong=eval(str);
      if (eval(latlongs.length) == 2) {
        clong=latlongs[0].split('[');
        olat=eval(clong[eval(-1 + clong.length)]);
        clong=latlongs[1].split(']');
        oplace=clong[0].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'');
      } else if (eval(latlongs.length) > 2) {
        olat='';
        oplace='()';
        for (ij=1; ij<latlongs.length; ij++) {
         clong=latlongs[ij].replace(']',',').split(',');
         oplace=oplace.replace(')',(delim + (clong[0].replace(String.fromCharCode(39),'').replace(String.fromCharCode(39),'')) + ')'));
         clong=latlongs[eval(-1 + ij)].replace(']',',').split('[');
         olat+=(delim + eval(clong[eval(-1 + clong.length)]));
         if (delim == '' && selonclick.length > 0 && eval(olong) >= -180.0 && eval(olong) <= 180.0 && eval(olat) >= -90.0 && eval(olat) <= 90.0) {
          andthen=' ';
         } else if (delim == '') {
          oplace='';
         }
         delim=',';
        }
        if (andthen == ' ') {
         andthen='';
         clong=olat.split(',');
         if (ifoeo == '') {
         
           var xtprop='';
           if (topdocumentURL.indexOf('rjmprogramming.com.au') != -1) {
           if (top.document.getElementById('mapphpmailbox')) {
             if (parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_'))) {
              xtprop=parent.document.getElementById('aof_' + oplace.replace('(','([').replace(',','],').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_')).title;
              if (top.document.getElementById('mapphpmailbox').value.indexOf(tprop) == -1) {
                if (top.document.getElementById('mapphpmailbox').value == '') {
                  top.document.getElementById('mapphpmailbox').value=xtprop;
                } else {
                  top.document.getElementById('mapphpmailbox').value+=';' + xtprop;
                }
                xtprop=String.fromCharCode(10) + 'As you click multiple places see TimeZone Places supervisor dropdown options' + String.fromCharCode(10);
              }
             }
           }
           }
           
           andthen=ourprompt('  Is there something you want to try with one of Latitudes ' + ('(' + olat + ')').replace('(','([').replace(',','],') + ' and Longitude ' + olong + ' ' + oplace.replace('(','([').replace(',','],').split('|')[0] + ' ? ' + String.fromCharCode(10) + '' + String.fromCharCode(10) + avblurb + '' + 'Google Map=G (optional, plus zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(10) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(10) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(10) + 'Moon Angle at Noon=M' + String.fromCharCode(10) + 'Coriolis Force=C' + String.fromCharCode(10) + '' + 'Nearest Airports=A (optional, plus number of nearest airports[3])' + String.fromCharCode(10) + '' + 'Nearest TimeZone=Z (and onto Other Side of the World and Weather)' + String.fromCharCode(10) + '' + 'YouTube=Y (looking for ' + oplace.split('|')[0] + ')' + String.fromCharCode(10) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + xtprop + String.fromCharCode(10) + '' + '... and please suffix answer by comma and preferred Latitude to use, else leave as blank or as is or choose Cancel to leave the status quo.', paramdata);
         }
         if (andthen == null) andthen='';
         pclong=[clong[0],clong[1]];
         polong=olong;
         polat=olat;
         poplace=oplace;
         //if (andthen.indexOf(',') == -1 && andthen != '') {
         //  olat=eval(clong[0]);
         //} else if (andthen != '') {
         //  clong=andthen.split(',');
         //  olat=eval(clong[1]);
         //  andthen=clong[0];
         //}
         selecteventthree(andthen); //,olong,clong);
        }
      }
         " . substr((' ' . $GETlinescall),0,1) . "       
    }
  }
  if (selonclick.length > 0 && eval(olong) >= -180.0 && eval(olong) <= 180.0 && eval(olat) >= -90.0 && eval(olat) <= 90.0) {
    if (andthen == '' && ifoeo == '') {
      olat=getirlat(olat);  // new idea as of September, 2016
      olong=getirlong(olong);
      oplace=getirplace(oplace);

           var ytprop='';
           if (topdocumentURL.indexOf('rjmprogramming.com.au') != -1) {
           if (top.document.getElementById('mapphpmailbox')) {
             if (parent.document.getElementById('aof_' + oplace.replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_'))) {
              ytprop=parent.document.getElementById('aof_' + oplace.replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_').replace(' ','_')).title;
              if (top.document.getElementById('mapphpmailbox').value.indexOf(tprop) == -1) {
                if (top.document.getElementById('mapphpmailbox').value == '') {
                  top.document.getElementById('mapphpmailbox').value=ytprop;
                } else {
                  top.document.getElementById('mapphpmailbox').value+=';' + ytprop;
                }
                ytprop=String.fromCharCode(10) + 'As you click multiple places see TimeZone Places supervisor dropdown options' + String.fromCharCode(10);
              }
             }
           }
           }

      andthen=ourprompt('   Is there something you want to try with Latitude ' + olat + ' and Longitude ' + olong + ' ' + oplace.split('|')[0] + ' ? ' + String.fromCharCode(10) + '' + String.fromCharCode(10) + avblurb + '' + 'Google Map=G (optional, plus zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(10) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(10) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(10) + 'Moon Angle at Noon=M' + String.fromCharCode(10) + 'Coriolis Force=C' + String.fromCharCode(10) + '' + 'Nearest Airports=A (optional, plus number of nearest airports[3])' + String.fromCharCode(10) + '' + 'Nearest TimeZone=Z (and onto Other Side of the World and Weather)' + String.fromCharCode(10) + '' + 'YouTube=Y (looking for ' + oplace.split('|')[0] + ')' + String.fromCharCode(10) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(10) + ytprop + String.fromCharCode(10) + '' + '...  else leave as blank or as is or choose Cancel to leave the status quo.', paramdata);
    }
    if (andthen == null) andthen='';
         pclong=[clong[0],clong[1]];
         polong=olong;
         polat=olat;
         poplace=oplace;
  }
  
  selecteventfour(andthen);
  

}
";




 echo "

   function selectevent(andthen) { //,olong,clong) {
         var clong=[pclong[0],pclong[1]], olong=polong, olat=polat, oplace=poplace;     
         if (andthen.indexOf(',') == -1 && andthen != '') {
           olong=eval(clong[0]);
         } else if (andthen != '') {
           clong=andthen.split(',');
           olong=eval(clong[1]);
           andthen=clong[0];
         }
         " . $GETlinescall . "       
     }
   
   function selecteventtwo(andthen) { //,olong,clong) {
         var clong=[pclong[0],pclong[1]], olong=polong, olat=polat, oplace=poplace;     
         if (andthen.indexOf(',') == -1 && andthen != '') {
           olong=eval(clong[0]);
         } else if (andthen != '') {
           clong=andthen.split(',');
           olong=eval(clong[1]);
           andthen=clong[0];
         }
         " . $GETlinescall . "       
   
   }    
   
   function selecteventthree(andthen) { //,olong,clong) {
         var clong=[pclong[0],pclong[1]], olong=polong, olat=polat, oplace=poplace;     
         if (andthen.indexOf(',') == -1 && andthen != '') {
           olat=eval(clong[0]);
         } else if (andthen != '') {
           clong=andthen.split(',');
           olat=eval(clong[1]);
           andthen=clong[0];
         }
         " . $GETlinescall . "       
   }
   
   function selecteventfour(andthen) { //,olong,clong) {
         var clong=[pclong[0],pclong[1]], olong=polong, olat=polat, oplace=poplace;     
  if (andthen.length > 0) {
    if (andthen.toLowerCase().substring(0,1) == 'd')  {
     if (dllc != 'Draw Link Lines=D') {
      x=-1; 
      y=-1; 
      prevx=-1; 
      prevy=-1; 
      andthen='';
     } else {
      andthen=paramdata + '&lines=y';
     }
    }
    if ((andthen.toLowerCase() + '~').indexOf('.csv~') != -1 && andthen.toLowerCase().indexOf('&') == -1) andthen=paramdata + '&csv=' + andthen;
    ans=andthen;
    ansbits=ans.split(' ');
    
                  if (document.getElementById('altemail')) {
              document.getElementById('altemail').value=ansbits[0];
              document.getElementById('remail').href=document.getElementById('remail').href.replace('mt=','mt=' + ansbits[0] + '&junk=youshallneverfindthis').replace('get=','mt=' + ansbits[0] + '&junk=youshallneverfindthis');
              }
              if (document.getElementById('email')) relist[1]='email';

    
             if (ansbits[0].indexOf('@') != -1) {
               for (ire=0; ire<2; ire++) {
              if (trim(relist[ire]) != '') {
             document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace('fillin.email@address', ansbits[0]);
              if (item.row != null && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&r=') + item.row) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&r=') + item.row;
              if (item.column != null && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&c=') + item.column;
              if (ansbits.length > 1) {
                ans=ans.replace(ansbits[0] + ' ','');
                while (ans.indexOf(' ') != -1) {
                  ans=ans.replace(' ','%20');
                }
                while (ans.indexOf('?') != -1) {
                  ans=ans.replace('?','%3f');
                }
                while (ans.indexOf('&') != -1) {
                  ans=ans.replace('&','%26');
                }
                if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) == -1 && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) == -1) {
                  document.getElementById(relist[ire]).href+=encodeURIComponent('&tp=') + encodeURIComponent(ans);
                } else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('&tp='), encodeURIComponent('&tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
				} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('?tp='), encodeURIComponent('?tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
                }
                while (document.getElementById(relist[ire]).href.indexOf(' ') != -1) {
                  document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(' ','%20');
                }
                //alert(document.getElementById(relist[ire]).href);
              }
              document.getElementById(relist[ire]).click();
              }
              }
             } else if (andthen.toLowerCase().substring(0,1) == 'w') {
      " . $dllwbits . "
             } else if (andthen.toLowerCase().substring(0,1) == 't') {
      " . $dlltbits . "
             } else if (andthen.toLowerCase().substring(0,1) == 'a') {
      andthen=andthen.replace('a','').replace('A','');
      numthing='3';  // '4'
      if ((andthen + ' ').substring(0,1) >= '1' && (andthen + ' ').substring(0,1) <= '9') {
       numthing=andthen;
      }
      //andthen=document.getElementById('chart_div').innerHTML;
      //alert('airports');
      document.getElementById('cdiv').innerHTML='<a id=mya href=#></a><iframe id=myiframe src=' + String.fromCharCode(34) + '//www.rjmprogramming.com.au/PHP/Map/map.php?title=Your%20Place%20and%20Airports' + nojwinextra + '&onclick=y&label=[%27Lat%27,&value=%27Lon%27,%27Name%27]&data=,' + '[' + olat + ',' + olong + ',~' + encodeURIComponent(oplace) + '~]' + String.fromCharCode(34) + ' width=450 height=450></iframe><iframe id=mypiframe src=' + String.fromCharCode(34) + '//www.rjmprogramming.com.au/HTMLCSS/intair.php?num=' + numthing + String.fromCharCode(38) + 'lat=' + olat + String.fromCharCode(38) + 'long=' + olong + String.fromCharCode(34) + ' style=display:none></iframe>';
      //window.open('//www.rjmprogramming.com.au/HTMLCSS/intair.php?num=' + numthing + '&lat=' + olat + '&long=' + olong, '_blank');
      location.href='#amapid';
    } else if (andthen.toLowerCase().substring(0,1) == 'z') {
      //alert('<div id=pretz></div><iframe id=itz onload=expand(this); height=150 width=100% src=//www.rjmprogramming.com.au/PHP/tz_places.php?place=' + encodeURIComponent(oplace.split('|')[0]) + nojwinextra + '&latitude=' + olat + '&longitude=' + olong + '#snearest title=NearestTimeZone></iframe>');
      document.getElementById('nearesttz').innerHTML='<div id=pretz></div><iframe id=itz onload=expand(this); height=150 width=100% src=//www.rjmprogramming.com.au/PHP/tz_places.php?place=' + encodeURIComponent(oplace.split('|')[0]) + nojwinextra + '&latitude=' + olat + '&longitude=' + olong + '#snearest title=NearestTimeZone></iframe>';
      location.href='#amapid';
    } else if (andthen.toLowerCase().substring(0,1) == 'y') {
      if (parent.document.getElementById('my_video')) {
         parent.document.getElementById('my_video').style.display='block';
         parent.document.getElementById('my_video').src='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=%20%20%20%20%20%20%20%20%20%20%20%20%20%20' + encodeURIComponent(oplace.split('|')[0]);
      } else {
         window.open('//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?emoji=on&nokaraoke=y&youtubeid=%20%20%20%20%20%20%20%20%20%20%20%20%20%20' + encodeURIComponent(oplace.split('|')[0]),'_blank');
      }
    } else if (andthen.toLowerCase().substring(0,1) == 'b') {
      if (andthen.toLowerCase().substring(0,5) == 'btrip') {
      brg_from(olat,olong,oplace,false);
      } else {
      brg_from(olat,olong,oplace,true);
      }
      location.href='#amapid';
    } else if (andthen.toLowerCase().substring(0,1) == 'g') {
      var mt='m';
      andthen=andthen.replace('g','').replace('G','');
      if (andthen.toLowerCase() != andthen.toLowerCase().replace('m','')) {
        anthen=andthen.toLowerCase().replace('m','');
      }
      if (andthen.toLowerCase() != andthen.toLowerCase().replace('k','')) {
        anthen=andthen.toLowerCase().replace('k','');
        mt='k';
      }
      if (andthen.toLowerCase() != andthen.toLowerCase().replace('h','')) {
        anthen=andthen.toLowerCase().replace('h','');
        mt='h';
      }
      if (andthen.toLowerCase() != andthen.toLowerCase().replace('p','')) {
        anthen=andthen.toLowerCase().replace('p','');
        mt='p';
      }
      if (andthen.toLowerCase() != andthen.toLowerCase().replace('e','')) {
        anthen=andthen.toLowerCase().replace('e','');
        mt='e';
      }
      numthing='9'; //'10';
      if ((andthen + ' ').substring(0,1) >= '1' && (andthen + ' ').substring(0,1) <= '9') {
       numthing=andthen;
      }
      //alert('google map');
      if (('' + olat).indexOf('.') == -1) olat='' + olat + '.0';
      if (eval(olong) >= 0.0) olong='+' + olong;
      //window.open('//maps.google.com/maps?z=' + numthing + '&t=m&q=loc:' + olat + olong.replace('-',',-'), '_blank','top=50,left=450,width=600,height=600');
      window.open('//maps.google.com/maps?z=' + numthing + '&t=' + mt + '&q=loc:' + olat + olong.replace('-',',-'), '_blank','top=50,left=450,width=700,height=600');
    } else if (andthen.toLowerCase().substring(0,1) == 's') {
      var latss=('' + olat).split('.'), latd,latm=0,lats=0;
      if (latss.length == 1) {
        latd=eval(latss[0]);
      } else {
        latd=eval(latss[0]);
        latm=Math.floor(60.0 * eval('0.' + latss[1]));
        lats=Math.floor(eval(3600.0 * (Math.abs(eval(olat)) -  (Math.abs(eval(latd)) + eval(latm / 60.0)) )));
      }
      var longss=('' + olong).split('.'), longd,longm=0,longs=0;
      if (longss.length == 1) {
        longd=eval(longss[0]);
      } else {
        longd=eval(longss[0]);
        longm=Math.floor(60.0 * eval('0.' + longss[1]));
        longs=Math.floor(eval(3600.0 * (Math.abs(eval(olong)) -  (Math.abs(eval(longd)) + eval(longm / 60.0)) )));
      }
      window.open('//www.rjmprogramming.com.au/PHP/SunAngle/sun_angle_now_at.php?latd=' + latd + '&latm=' + latm + '&lats=' + lats + '&longd=' + longd + '&longm=' + longm + '&longs=' + longs + '&from=from&done=y', '_blank','top=80,left=480,width=600,height=600');
    } else if (andthen.toLowerCase().substring(0,1) == 'm') {
      var latss=('' + olat).split('.'), latd,latm=0,lats=0;
      if (latss.length == 1) {
        latd=eval(latss[0]);
      } else {
        latd=eval(latss[0]);
        latm=Math.floor(60.0 * eval('0.' + latss[1]));
        lats=Math.floor(eval(3600.0 * (Math.abs(eval(olat)) -  (Math.abs(eval(latd)) + eval(latm / 60.0)) )));
      }
      var longss=('' + olong).split('.'), longd,longm=0,longs=0;
      if (longss.length == 1) {
        longd=eval(longss[0]);
      } else {
        longd=eval(longss[0]);
        longm=Math.floor(60.0 * eval('0.' + longss[1]));
        longs=Math.floor(eval(3600.0 * (Math.abs(eval(olong)) -  (Math.abs(eval(longd)) + eval(longm / 60.0)) )));
      }
      window.open('//www.rjmprogramming.com.au/PHP/MoonAngle/moon_angle_now_at.php?latd=' + latd + '&latm=' + latm + '&lats=' + lats + '&longd=' + longd + '&longm=' + longm + '&longs=' + longs + '&from=from&done=y', '_blank','top=100,left=500,width=600,height=600');
    } else if (andthen.toLowerCase().substring(0,1) == 'c') {
      var latss=('' + olat).split('.'), latd,latm=0,lats=0;
      if (latss.length == 1) {
        latd=eval(latss[0]);
      } else {
        latd=eval(latss[0]);
        latm=Math.floor(60.0 * eval('0.' + latss[1]));
        lats=Math.floor(eval(3600.0 * (Math.abs(eval(olat)) -  (Math.abs(eval(latd)) + eval(latm / 60.0)) )));
      }
      var longss=('' + olong).split('.'), longd,longm=0,longs=0;
      if (longss.length == 1) {
        longd=eval(longss[0]);
      } else {
        longd=eval(longss[0]);
        longm=Math.floor(60.0 * eval('0.' + longss[1]));
        longs=Math.floor(eval(3600.0 * (Math.abs(eval(olong)) -  (Math.abs(eval(longd)) + eval(longm / 60.0)) )));
      }
      //if (document.getElementById('hval1')) {
      //document.getElementById('hval1').value=\"window.open('//www.rjmprogramming.com.au/PHP/Coriolis/coriolis_force_at.php?latd=\" + latd + '&latm=' + latm + '&lats=' + lats + '&longd=' + longd + '&longm=' + longm + '&longs=' + longs + '&from=from&done=y' + \", '_blank','top=120,left=520,width=600,height=600')\";
      //} else {
      window.open('//www.rjmprogramming.com.au/PHP/Coriolis/coriolis_force_at.php?latd=' + latd + '&latm=' + latm + '&lats=' + lats + '&longd=' + longd + '&longm=' + longm + '&longs=' + longs + '&from=from&done=y', '_blank','top=120,left=520,width=600,height=600');
      //}
    } else if (andthen != paramdata && andthen != '') {
      location.href=document.URL.replace(pardata, ourencodeURIComponent(andthen));
    }
  }
  ir=-1;
  ic=-1;    
   
   }
   
   function selecteventfive(andthen) { //,olong,clong) {
   }

   function selecteventsix(andthen) { //,olong,clong) {
   }
   ";




      
      echo " </script> \n";
      echo " </head> \n";
      
      
      if (!isset($_GET['value']) && !isset($_POST['value'])) {
      echo " <body ontouchstart=' collectclick(event); ' onmousedown=' collectclick(event); ' onload=\" document.getElementById('myoptform').action=document.URL.split('#')[0]; brg_check_at_start(); if (later) { setTimeout(later, 2 * 1000); } \" style='background-color: silver;'> \n";
      } else {
      echo " <body ontouchstart=' collectclick(event); ' onmousedown=' collectclick(event); ' style='background-color: silver;' onload=\" document.getElementById('myoptform').action=document.URL.split('#')[0]; brg_check_at_start(); \"> \n";
      }
      echo " <h1 id='myh1'>" . $GETtitle . " Map <div id='dh1'></div></h1> \n";

      echo '<div id="chart_div" style="width: 400px; height: 300px;' . $opa . '" ontouchstart=" collectclick(event); " onmousedown=" collectclick(event); "></div>' . " \n";
      echo '<a id="amapid" title="Another Map" href="./map.php">Another Map?</a>' . '&nbsp;&nbsp;<a href="MAILTO:fillin.email@address?subject=Google%20Chart%20Snapshot&body=' . urlencode("HTTP://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . '" style="display:inline;" title="To email a snapshot of this Google Chart click me." id="remail">Email snapshot of Google Chart ...</a>' . " \n";
      echo '<' . 'script' . ' type="text/javascript">' . "\n " . " function later() { \n"; 
      if (!isset($_GET['value']) && !isset($_POST['value'])) {
      
        echo ' datalineprefix = " "; ' . "\n";
        echo ' datalinesuffix = ""; ' . "\n";
        echo ' var prethisline = "", extra = ""; ' . "\n";
        echo ' var thisline = 1; ' . "\n";
        echo ' var ii = 0; ' . "\n";
        if ($dbval == "") { // && $options_suffix != "") {
        echo ' var c_m = " ", thisdef = "0"; ' . "\n";
        } else {
        echo ' var c_m = "", thisdef = "0"; ' . "\n";
        }
        echo ' var totalleft = 100.0; ' . "\n";

        echo ' var title = ourprompt("Enter Map Title (suffix by &lines=y for overlay clickable link lines and/or suffix by &onclick=y for all types of onclick functionality such as &brgplace=[1] for Bearing Distance table and perhaps &brgmode=trip for that table in trip order). ' . $promptsuffix . '", "' . $GETtitle . '"); ' . "\n";
        echo ' if (title != null) { ' . "\n";
        echo ' if (title.indexOf(",") == 0) { if (title.indexOf("]}}") != -1) {  document.getElementById("custom_map").value=title.replace("};","").split("]}}")[0] + "]}} "; title=title.replace("};","").split("]}}")[1];  } else if (title.indexOf("}") != -1) {    document.getElementById("custom_map").value=(title + "            ").replace("};","").replace("}" + (title + "            ").replace("};","").split("}")[eval(-1 + (title + "            ").replace("};","").split("}").length)],"}"); title=title.replace("};","").replace(document.getElementById("custom_map").value,"");   } else {  document.getElementById("custom_map").value=title; }  if (c_m.length == 0) { document.getElementById("myoptsbutton").click(); } c_m=document.getElementById("custom_map").value;  }  ' . "\n";
        echo ' if (title.indexOf("&onclick=") != -1) { prethisline=" (note, here, suffix of |TimeZoneName|GMTOffset|TimeNow is recognized in the onclick select event prompt window later ... for example Sydney|Australia/Sydney|+11|12:32 uses this functionality) "; } ' . "\n";
        echo ' var label = "' . $GETlabel . '"; ' . "\n";
        echo ' if (label == null) label = ""; ' . "\n";
        echo ' var xlabel = "' . "'" . '" + label.replace("' . "'" . '","") + "' . "'" . '"; ' . "\n";
        //echo ' var value = ourprompt("Enter Map " + xlabel + " Criteria (separated by ,) ...  decimal latitude and longitude ", "' . $GETvalue . '"); ' . "\n";
        echo ' var value = "' . $GETvalue . '"; ' . "\n";


        echo ' if (value.indexOf(",") != (0 - 1)) { ' . "\n";
        echo '  for (ii=0; ii < value.length; ii++) { if (value.substring(ii,(ii+1)) == ",") { if (value.substring((ii+1),(ii+2)) == "' . "'" . '") {  thisdef = thisdef + ",' . "'0'" . '"; } else { thisdef = thisdef + ",0"; } } } ' . "\n";
        echo ' } ' . "\n";


        echo ' var dlsa, dlp2="", datac = ""; ' . "\n";
        echo ' dataprefix2 = ""; ' . "\n";
        echo ' var sq = "' . "'" . '"; ' . "\n";
        echo ' datalineprefix = "' . "''" . '";' . "\n";
        echo ' if (label.length != 0) { datalineprefix2 = ourprompt("Enter ' . " " . $GETtitle . ' Name' . " " . ' " + prethisline + thisline, ""); if (datalineprefix2 != null) {  calcofftimenow(document.getElementById("seltz"),datalineprefix2); dlp2=datalineprefix2; } } ' . "\n";


        echo ' while (datalineprefix.length != 0 && (value.indexOf("ercent") == (0 - 1) || value.indexOf("  ercent ") != (0 - 1) || (value.indexOf("ercent") != (0 - 1) && totalleft > 0))) { ' . "\n";
        echo ' datalineprefix = "' . "''" . '";' . "\n";
        echo ' if (datalinesuffix.length != 0 && label.length != 0) { datalineprefix = ourprompt("Enter ' . " " . $GETtitle . ' Name' . " " . ' " + prethisline + thisline + " (for no more hit Cancel button)", ""); if (datalineprefix != null) {  calcofftimenow(document.getElementById("seltz"),datalineprefix);  datalineprefix2=""; dlp2=datalineprefix; } } ' . "\n";
        echo ' if (datalineprefix == null) { ' . "\n";
        echo '     datalineprefix = ""; ' . "\n";
        echo '     totalleft = 0; ' . "\n";
        echo ' } else if (datalineprefix.length != 0) { ' . "\n";
        echo '     extra = "";  ' . "\n";
        echo '     if (value.indexOf("ercent") != (0 - 1) && value.indexOf("  ercent ") == (0 - 1)) extra = " (for " + totalleft + " enter nothing or hit Cancel button)";  ' . "\n";
        echo "  if (tzsuffix == '') {   datalinesuffix = ourprompt('Enter decimal Latitude,Longitude ' + thisline + extra +  ' (for no more hit Cancel button and append with ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map of <a target=_blank href=' + \"'\" + 'https://www.google.com.au/maps/place/' + encodeURIComponent(dlp2) + \"'\" + '>' + dlp2 + '</a>\" ' + '\\n\\n' + ' or maybe perhaps ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map based on latitude and longitude of <a target=_blank href=' + \"'\" + 'https://maps.google.com.au/maps?' + encodeURIComponent('z=15&t=m&q=loc:') + '{latitude}{longitude}' + \"'\" + '>' + dlp2 + '</a>\"' + '\\n\\n' + ' optionally (as (just) two examples of what is possible with HTML included (activates with onclick bit not onmouseover))', thisdef); " . "\n";
        echo "  } else if (tzsuffix != '') {   datalinesuffix = ourprompt('Just click OK to accept the ' + tzsuffix.split('|')[1] + ' Time Zone place geographicals we found, else enter decimal Latitude,Longitude ' + thisline + extra +  ' (for no more hit Cancel button and append with ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map of <a target=_blank href=' + \"'\" + 'https://www.google.com.au/maps/place/' + encodeURIComponent(dlp2) + \"'\" + '>' + dlp2 + '</a>\" ' + '\\n\\n' + ' or maybe perhaps ' + '\\n\\n' + ',\"A tooltip and clicking link for Google Map based on latitude and longitude of <a target=_blank href=' + \"'\" + 'https://maps.google.com.au/maps?' + encodeURIComponent('z=15&t=m&q=loc:') + '{latitude}{longitude}' + \"'\" + '>' + dlp2 + '</a>\"' + '\\n\\n' + ' optionally (as (just) two examples of what is possible with HTML included (activates with onclick bit not onmouseover))', tzsuffix); tzsuffix=''; } " . "\n";
        echo '     if (datalinesuffix != null) { datalinesuffix=giveandtake(datalinesuffix).replace(/#/g, "%23");  if (datalinesuffix.indexOf("{latitude}") != -1) { dlsa=datalinesuffix.split(","); if (dlsa[0].indexOf(".") == -1) { dlsa[0]=dlsa[0]+".0";  } if (dlsa[0].indexOf("-") == -1) { datalinesuffix=datalinesuffix.replace("{latitude}",encodeURIComponent("" + dlsa[0]));  } else { datalinesuffix=datalinesuffix.replace("{latitude}",encodeURIComponent(dlsa[0]));  }  } if (datalinesuffix.indexOf("{longitude}") != -1) { dlsa=datalinesuffix.split(","); if (dlsa.length > 1) {  if (dlsa[0].indexOf(".") == -1) { dlsa[0]=dlsa[0]+".0";  }  if (dlsa[1].indexOf(".") == -1) { dlsa[1]=dlsa[1]+".0";  } if (dlsa[1].indexOf("-") == -1) { datalinesuffix=datalinesuffix.replace("{longitude}",encodeURIComponent("+" + dlsa[1]));  } else { datalinesuffix=datalinesuffix.replace("{longitude}","+" + encodeURIComponent(dlsa[1])); }  }  }  datalinesuffix=("@!@" + datalinesuffix).replace(/loc:+/g, "loc:").replace(/,0,/g, ",0.00000001,").replace(/@!@0,/g, "0.00000001,").replace(/@!@/g, "");    } ' . "\n";
        echo '     if (datalinesuffix == null && value.indexOf("ercent") != (0 - 1) && value.indexOf("  ercent ") == (0 - 1)) datalinesuffix = totalleft; ' . "\n";
        echo '     if (datalinesuffix == null) break; ' . "\n";
        echo '     if (datalinesuffix == null) datalinesuffix = "0,0"; ' . "\n";
        echo '     if (datalinesuffix.length == 0) { ' . "\n";
        echo '       datalinesuffix = eval(totalleft); ' . "\n";
        echo '       totalleft = 0; ' . "\n";
        echo '     } else if (eval(totalleft) == eval(datalinesuffix) && value.indexOf("ercent") != (0 - 1) && value.indexOf("  ercent ") == (0 - 1)) { ' . "\n";
        echo '       totalleft = 0; ' . "\n";
        echo '     } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") != (0 - 1) && value.indexOf("  ercent ") == (0 - 1)) { ' . "\n";
        echo '       datalinesuffix = eval(totalleft); ' . "\n";
        echo '       totalleft = 0; ' . "\n";
        echo '     } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") == (0 - 1) && value.indexOf("  ercent ") == (0 - 1)) { ' . "\n";
        echo '       value = value + "  ercent "; ' . "\n";
        echo '     } else { ' . "\n";
        echo '       totalleft = eval(totalleft) - eval(datalinesuffix); ' . "\n";
        echo '     } ' . "\n";
        echo '     if (datalineprefix2 != "") datalineprefix = datalineprefix2;  ' . "\n";
        echo '     if (datalinesuffix.indexOf("' . "'" . '") == -1) datac = datac + ", [" + datalinesuffix + ",~" + datalineprefix + "~] "; ' . "\n";
        echo '     if (datalinesuffix.indexOf("' . "'" . '") != -1) datac = datac + ", [" + datalinesuffix + ",' . "'" . '" + datalineprefix + "~] "; ' . "\n";
        echo '     dataprefix2 = ""; ' . "\n";
        echo '     thisline++; ' . "\n";
        echo '   } ' . "\n";
        echo ' } ' . "\n";
        if ($dbval == "" && $options_suffix != "") {
        echo " document.getElementById('custom_map').value=\"" . $options_suffix . "\";  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=title type=hidden value=\"' + title.split('&')[0] + '\"></input>';  " . "\n";

        echo " if (title.indexOf('&onclick=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=onclick type=hidden value=\"' + (title + '&').split('&onclick=')[1].split('&')[0] + '\"></input>' };  " . "\n";
        echo " if (title.indexOf('&lines=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=lines type=hidden value=\"' + (title + '&').split('&lines=')[1].split('&')[0] + '\"></input>' };  " . "\n";
        echo " if (title.indexOf('&options=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=options type=hidden value=\"' + (title + '&').split('&options=')[1].split('&')[0] + '\"></input>' };  " . "\n";

        echo " document.getElementById('myoptform').innerHTML+='<input name=label type=hidden value=\"' + label + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=value type=hidden value=\"' + value.replace(\"  ercent \", \"\") + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=data type=hidden value=\"' + datac + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptsbutton').click(); " . "\n";
        } else {
        echo ' if (("./map.php?title=" + title + "&custom_map=" + encodeURIComponent(jnocomm(c_m)) + "&label=" + label + "&value=" + value.replace("  ercent ", "") + "&data=" + datac).length > 900 || c_m.trim() != "") { ' . "\n";
        echo " document.getElementById('custom_map').value=jnocomm(c_m);  " . "\n";

        echo " if (title.indexOf('&onclick=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=onclick type=hidden value=\"' + (title + '&').split('&onclick=')[1].split('&')[0] + '\"></input>' };  " . "\n";
        echo " if (title.indexOf('&lines=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=lines type=hidden value=\"' + (title + '&').split('&lines=')[1].split('&')[0] + '\"></input>' };  " . "\n";
        echo " if (title.indexOf('&options=') != -1) { document.getElementById('myoptform').innerHTML+='<input name=options type=hidden value=\"' + (title + '&').split('&options=')[1].split('&')[0] + '\"></input>' };  " . "\n";

        echo " document.getElementById('myoptform').innerHTML+='<input name=title type=hidden value=\"' + title.split('&')[0] + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=label type=hidden value=\"' + label + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=value type=hidden value=\"' + value.replace(\"  ercent \", \"\") + '\"></input>';  " . "\n";
        echo " document.getElementById('myoptform').innerHTML+='<input name=data type=hidden value=\"' + datac + '\"></input>';     " . "\n";
        echo " document.getElementById('myoptsbutton').click(); " . "\n";
        echo ' } else if (c_m.trim() != "") { ' . "\n";
        echo ' if (allowed) window.location = "./map.php?title=" + title + "&label=" + label + "&value=" + value.replace("  ercent ", "") + nojwinextra + "&custom_map=" + encodeURIComponent(jnocomm(c_m)) + "&data=" + datac; ' . "\n";
        echo ' } else { ' . "\n";
        echo ' if (allowed) window.location = "./map.php?title=" + title + "&label=" + label + "&value=" + value.replace("  ercent ", "") + nojwinextra + "&data=" + datac; ' . "\n";
        echo ' } ' . "\n";
        }
        echo "} \n"; 
      } 
      echo "} \n" . '</' . 'script' . '>' . "\n";
    ?>
  <form style='display:none;' id='myoptform' method='POST' target='_self' action='map.php'><?php if (isset($_GET['nojwin']) || isset($_GET['nojwinyes']) || isset($_POST['nojwinyes'])) { echo "<input type=hidden value=y name=nowinyes></input>";  } ?><input id='custom_map' name='custom_map' type='hidden' value=''></input><input type='submit' id='myoptsbutton' value='Show This Way'></input></form>
  <a id=ajustmenu title='menu' href='//www.rjmprogramming.com.au/PHP/butsel.php?justmenu=justmenu'>Menu</a>
  <div id='cdiv'></div><div id='xydiv'></div><div id='nearesttz'></div>
<?php echo $seltz; ?>
<script type='text/javascript'>
if (topdocumentURLindexOfnojwin.indexOf('nojwin') != -1 || document.URL.indexOf('nojwin') != -1 || navigator.userAgent.match(/iPhone|iPad/i)) {
  //document.getElementById('pch1').innerHTML+='.';
  var xansis='x', hiddenbits='';
  xpnum=1;
  if (document.URL.indexOf('?') != -1) {
    var pairing, argsare=document.URL.split('#')[0].split('?')[1].split('&');
    for (var iargsare=0; iargsare<argsare.length; iargsare++) {
      pairing=argsare[iargsare].split('=');
      if (('*' + pairing[0]).indexOf('*val') == -1 && ('*' + pairing[0]).indexOf('*prompt') == -1 && ('*' + pairing[0]).indexOf('*OK') == -1 && ('*' + pairing[0]).indexOf('*Cancel') == -1) {
       hiddenbits+="<input type=hidden name=" + pairing[0] + " value='" + pairing[1] + "'></input>";
       if (pairing[0] == 'dposted') dposted=true;
      }
    }
  }
  <?php if (isset($_POST['data'])) { echo "\n dposted=true; \n hiddenbits+='<input type=hidden name=dposted value=y></input>'; \n"; } ?>
  while (xansis != '') {
   xansis=location.search.split('val' + xpnum + '=')[1] ? decodeURIComponent(decodeURIComponent(location.search.split('val' + xpnum + '=')[1].split('&')[0]).replace(/\+/g,' ')) : '';
   if (document.URL.indexOf('val' + xpnum + '=') != -1) {
     hiddenbits+="<input type=hidden name=val" + xpnum + " value=\"" + encodeURIComponent(xansis) + "\"></input>";
     xpnum++;
     xansis='x';
   } else {
     xansis='';
   }
  }
  if (topdocumentURLindexOfnojwin.indexOf('nojwinyes') != -1 || document.URL.indexOf('nojwinyes=') != -1 || (document.URL.indexOf('nojwin=') != -1 && document.URL.indexOf('data=') != -1)) { 
  document.write("<form onsubmit=\" if (document.getElementById('val" + xpnum + "').value.replace('null','') != '') { if (decodeURIComponent(document.getElementById('prompt').value).indexOf('     Is ') == 0) {  selecteventsix(document.getElementById('val" + xpnum + "').value);  }  else if (decodeURIComponent(document.getElementById('prompt').value).indexOf('    Is ') == 0) {  selecteventfive(document.getElementById('val" + xpnum + "').value);  } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf('   Is ') == 0) {  selecteventfour(document.getElementById('val" + xpnum + "').value);  } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf('  Is ') == 0) {  selecteventthree(document.getElementById('val" + xpnum + "').value);  } else if (decodeURIComponent(document.getElementById('prompt').value).indexOf(' Is ') == 0) {  selecteventtwo(document.getElementById('val" + xpnum + "').value);  } else { selectevent(document.getElementById('val" + xpnum + "').value); } } else if (document.URL.indexOf('&data=') != -1) { location.href=document.URL; } else { this.style.display='none'; } xpnum++; if (!dposted && (decodeURIComponent(document.getElementById('hval1').value) + ' ').toLowerCase().substring(0,1).replace('a','z').replace(',','z') != 'z') { window.location=document.URL.split('#')[0]; } else {  if (dposted) { document.getElementById('safariform').style.opacity='0.5'; }  document.getElementById('safariform').style.left='420px';    }  return false;  \" enctype='text/plain' style='opacity:0.9;display:none;position:absolute;top:70;left:420px;z-index:56;width:45%;background-color:rgba(255,165,0,0.8);border:2px solid red;' id=safariform method=GET action=" + document.URL.split('#')[0].split('?')[0] + " readonly>" + hiddenbits + "<textarea style='width:96%;background-color:#eeeeee;' rows=5 id='prompt' readonly='readonly'></textarea><br><input type=hidden value='' name=val" + xpnum + " id=hval" + xpnum + "></input><input onkeypress=\"checkEnter(event);\" onblur=\" document.getElementById('h' + this.id).value=encodeURIComponent(this.value); \" style='width:50%;background-color:yellow;' type=text value='' id=val" + xpnum + "></input>&nbsp;&nbsp;<input style='float:right;width:25%;' type=submit value=OK name=OK id=OK></input>&nbsp;<input style='display:none;' type=submit value=Cancel name=Cancel id=Cancel></input>&nbsp;<input type=button value=Cancel id=bCancel onclick=\" document.getElementById('val" + xpnum + "').value='null'; document.getElementById('hval" + xpnum + "').value=encodeURIComponent('null'); this.style.display='none';  document.getElementById('Cancel').style.display='block'; document.getElementById('Cancel').click(); \"></input>&nbsp;</input></form>"); 
  //document.getElementById('pch1').innerHTML+='....';
  } else {
  document.write("<form enctype='text/plain' style='opacity:0.9;display:none;position:absolute;top:70;left:2%;z-index:56;width:48%;background-color:rgba(255,165,0,0.8);border:2px solid red;' id=safariform method=GET action=" + document.URL.split('#')[0].split('?')[0] + " readonly>" + hiddenbits + "<textarea style='width:96%;background-color:#eeeeee;' rows=2 id='prompt' readonly='readonly'></textarea><br><input type=hidden value='' name=val" + xpnum + " id=hval" + xpnum + "></input><input onkeypress=\"checkEnter(event);\" onblur=\" document.getElementById('h' + this.id).value=encodeURIComponent(this.value); \" style='width:50%;background-color:yellow;' type=text value='' id=val" + xpnum + "></input>&nbsp;&nbsp;<input style='float:right;width:25%;' type=submit value=OK name=OK id=OK></input>&nbsp;<input style='display:none;' type=submit value=Cancel name=Cancel id=Cancel></input>&nbsp;<input type=button value=Cancel id=bCancel onclick=\" document.getElementById('val" + xpnum + "').value='null'; document.getElementById('hval" + xpnum + "').value=encodeURIComponent('null'); this.style.display='none';  document.getElementById('Cancel').style.display='block'; document.getElementById('Cancel').click(); \"></input>&nbsp;</input></form>"); 
  //document.getElementById('pch1').innerHTML+='..';
  }
  if (document.getElementById('amapid')) {
    if (document.getElementById('amapid').href.indexOf('nojwin') == -1) {
     document.getElementById('amapid').href+='?nojwin=Y';
    }
  }
  if (document.getElementById('ajustmenu')) {
    if (document.getElementById('ajustmenu').href.indexOf('nojwin') == -1) {
    if (document.getElementById('ajustmenu').href.indexOf('?') == -1) {
     document.getElementById('ajustmenu').href+='?nojwin=Y';
    } else {
     document.getElementById('ajustmenu').href+='&nojwin=Y';
    }
    }
  }
}
</script>
</body>
</html>
