<?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');

$agy="y";
if (isset($_GET['aregeographicals'])) {
  $agy=str_replace('+',' ',urldecode($_GET['aregeographicals']));
}
$ctzsfa='';
$bstyle="background:url(placesmap.jpg);background-repeat:no-repeat;";

if (strpos($_SERVER['QUERY_STRING'],'data=') !==false) { $bstyle=""; }

$amwv=false;
if ((strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile/') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari/') == false)) {
  $amwv=true;
}

$redir="";
$justnumber="";

$https = "http://";
$portbit = ":" . $_SERVER['SERVER_PORT'];
if(isset($_SERVER['HTTPS'])) {
    if ($_SERVER['HTTPS'] == "on") {
        $https = "https://";
        $portbit = "";
    }
} else if ($portbit == ":80") {
        $portbit = "";
}

$burl="";
$bdivstart="";
$bdivend="";
$cdivc="background-color: yellow;";
$nondefs="";

$php_map_db=[""];
$dllwbits="";
if (isset($_POST['dllwbits'])) $dllwbits=str_replace("+"," ",urldecode($_POST['dllwbits']));
$dlltbits="";
if (isset($_POST['dlltbits'])) $dlltbits=str_replace("+"," ",urldecode($_POST['dlltbits']));


   function miniaturize($tzps, $gdis) {
        global $ctzsfa;
        $tzsfa=explode("#",$ctzsfa);
        $itzsfa=0;
        // Europe/Tirane/2018-07-10_01:25:15 (GMT2) Map
        $outtzps=$tzps;
        $tza=explode(' (',$tzps);
        $cit='';
        for ($itza=0; $itza<(-1 + sizeof($tza)); $itza++) {
          $cit=str_replace("<br>","",explode(' ',str_replace(","," ",$tza[$itza]))[-1 + sizeof(explode(' ',str_replace(","," ",$tza[$itza])))]) . ' (' . explode(')',$tza[1 + $itza])[0] . ')';
          if (strpos($cit,'/') !== false) {
           if (sizeof($tzsfa) > $itzsfa) {
            $nitzsfa=$itzsfa;
            $czx=explode("/",$cit);
            if (sizeof($czx) > 1) {
            for ($it=0; $it<sizeof($tzsfa); $it++) {
              if (strpos(str_replace("%20","_",$tzsfa[$it]), str_replace("%20","_",$czx[-2 + sizeof($czx)])) !== false) {
                $nitzsfa=$it;
                $tzsfa[$nitzsfa]=str_replace("TimeZone%20Place", str_replace("_","%20",$czx[-2 + sizeof($czx)]), $tzsfa[$nitzsfa]);
              }
            }
            }
            $outtzps=str_replace($cit,"<a style='font-size:12px;text-decoration:underline;cursor:pointer;' title=\"" . str_replace(' ','%20',$tzsfa[$nitzsfa]) . "\" onclick=\"window.open(this.title,'_blank','left=50,top=50,width=600,height=600');\">" . $cit . "</a>",$outtzps); 
            $itzsfa++;
           }
          }
        }
        return $outtzps;
    } 




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","Europe/London",""];
$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","51.5074"," "];
$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","-0.1278","  "];
$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;
        }
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        $dlltbitsm="top.location.href='HTTP://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($gettzname) . "');";
        } else {
        $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 {
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
         $zdlltbitsm="top.location.href='https://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('" . $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 $ctzsfa, $justnumber, $dllt, $dlltbits, $wparts, $dllw, $dllwbits, $GETtitle, $nearname, $nearlatitude, $nearlongitude, $bdivstart, $bdivend, $cdivc, $nondefs, $burl;
   $itzsfa=0;


   if (strpos($inwithtz, "~http;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~http;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~Http;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~Http;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~HTTP;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~HTTP;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~https;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~https;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~Https;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~Https;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~HTTPS;") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http;" . explode("~",explode("~HTTPS;", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~http") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http" . explode("~",explode("~http", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~Http") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("http" . explode("~",explode("~Http", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos($inwithtz, "~HTTP") !== false) { // co-ordinates via net
     $inwithtz=read_and_array("HTTP" . explode("~",explode("~HTTP", $inwithtz)[1])[0], str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos(str_replace("https;","http;",substr(strtolower($inwithtz . "      "),0,6)), "http;") !== false) { // co-ordinates longhand via prompt
     $inwithtz=read_and_array($inwithtz, str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   } else if (strpos(str_replace("https:","http:",substr(strtolower($inwithtz . "      "),0,6)), "http:") !== false) { // co-ordinates via URL via net
     $inwithtz=read_and_array($inwithtz, str_replace('map.php','map.php',str_replace('index.php','map.php',$_SERVER['REQUEST_URI'])));
   }
   
   $inherefrom=",[";
   $inhereto=",[";
   $sdp="~],";
   $pdp="";
   $lastb="";
   $fcs="";
   $okcc="";
   $lpv="";
   $cm="";
   $tzsofar="";
   $bl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=";
   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];
          $lpv=str_replace(" ","%20",$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(); 
        // ,[51.5072,-0.1275,~London~]
        //$ctzsfa.=$cm . "//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=" . ", [" . $cloc['latitude'] . "," . $cloc['longitude'] . ",~" . $lpv . "~]"; 
        //$itzsfa++;
        //$cm="#";
        //$bl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=";
        //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; 
          // ,[51.5072,-0.1275,~London~]
          //$ctzsfa.=$cm . "//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=" . ", [" . $cloc['latitude'] . "," . $cloc['longitude'] . ",~" . str_replace("_","%20",explode("/",$nearname[$best1])[-1 + sizeof(explode("/",$nearname[$best1]))]) . "~]"; 
          //$itzsfa++;
          //$cm="#";
          //$bl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=";
        }
       } 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| | | ~]
        $xw="";
        //$arContext['http']['timeout'] = 3;
        //$context = stream_context_create($arContext);       
        $ddb=@file_get_contents("HTTP://autocomplete.wunderground.com/aq?query=" . str_replace(" ","%20",str_replace("-"," ",str_replace("_"," ",explode("/",$nearname[$best1])[-1 + sizeof(explode("/",$nearname[$best1]))] . "," . (substr($fcs,1)))))); //,0,$context);
        //if (isset($_GET['x'])) file_put_contents("xx.html", "<html><body>" . "HTTP://autocomplete.wunderground.com/aq?query=" . str_replace(" ","%20",str_replace("-"," ",str_replace("_"," ",explode("/",$nearlatitude[$best1])[-1 + sizeof(explode("/",$nearlatitude[$best1]))] . "," . (substr($fcs,1))))) . "</body></html>");
        if (sizeof(explode('"l": "', $ddb)) == 2) {
          $restdd=explode('"',explode('"l": "', $ddb)[1])[0];
          $xw="https://www.wunderground.com" . $restdd;
        }
        //if (strlen($fcs) > 1) $fcs=""; //"%20" . substr($fcs,1);
        if ($yokcc) {
        $inhereto.=$pdp . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . str_replace(" |","|",explode("/", $nearname[$best1])[-1 + sizeof(explode("/", $nearname[$best1]))] . $fcs . "|" . $ooffset . $xw . "|" . $dremote_dt->format('Y-m-d_H:i:s') . "|" . $nearname[$best1]) . $sdp;
          $ctzsfa.=$cm . "//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=" . ", [" . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . $nearname[$best1] . "~]"; 
          $itzsfa++;
          $cm="#";
          $bl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=";
        } else {
        $xbitsare=explode((" " . $nearname[$best1] . "/"), str_replace("+("," (",str_replace(","," ",$GETtitle)));
        $inhereto.=$pdp . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . str_replace(" |","|",explode("/", $nearname[$best1])[-1 + sizeof(explode("/", $nearname[$best1]))] . $fcs . "|" . $ooffset . $xw . "|" . explode(" ", $xbitsare[1])[0] . "|" . $nearname[$best1]) . $sdp;
          $ctzsfa.=$cm . "//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=" . ", [" . $nearlatitude[$best1] . "," . $nearlongitude[$best1] . ",~" . $nearname[$best1] . "~]"; 
          $itzsfa++;
          $cm="#";
          $bl="//www.rjmprogramming.com.au/PHP/Map/map.php?title=TimeZone%20Place&onclick=y&label=['Lat',&value='Lon','Name']&data=";
        }
        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(',' + '[','" . str_replace(',[',",' + '[",$inhereto . $lastb) . "'); \n pardata=encodeURIComponent(paramdata); \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);
          $justnumber=str_replace(";","",str_replace("&amp;#","",str_replace("&#","",str_replace(";&amp;#",".",str_replace(";&#",".",explode("<",explode(">", $fbitsare[1])[1])[0])))));
          $ehd=str_replace("&amp;","&",explode("<",explode(">", $fbitsare[1])[1])[0]);
          $GETtitle=str_replace($tzsofar, " " . $ehd . " <br>" . $tzsofar, $GETtitle);
          if (strpos($GETtitle, "TimeZone Offset ") !== false) { $agy="Y"; }
        }
      }
   }
   //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);
    $inwithtz=urldecode(urldecode($inwithtz));
   }

   $outwithouttz=$inwithtz;
   $wparts=explode("]", $inwithtz);
   if (strpos($inwithtz, "|") !== false) {
     if ($dllt == "") {
       $withinbar=explode("|", $inwithtz);

              $stuff="";
           $gweather="";
           for ($iiz=0; $iiz<sizeof($withinbar); $iiz++) {
             if (strpos($withinbar[$iiz], "http") !== false && $gweather == "") {
           $zhuhw=explode("http", (";" . $withinbar[$iiz]));
           $zgetnonw=$zhuhw[0];
           $stuff .= "\n \$withinbar[\$iiz]=" . $withinbar[$iiz] . " \$zhuhw[0]=" . $zhuhw[0] . "\n";
   //if (isset($_GET['x'])) file_put_contents("xx.html", "<html><body>" . $stuff . "</body></html>");
           $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],"http") !== false) $gweather="http" . explode("|",explode("http", $withinbar[$iwb])[1])[0];
         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],"http") !== false) $gweather="http" . explode("|",explode("http", $withinbar[$iwb])[1])[0];
         if (strpos($withinbar[$iwb + 1],"http") !== false) $gweather="http" . explode("|",explode("http", $withinbar[$iwb + 1])[1])[0];
         if (strpos($withinbar[$iwb + 2],"http") !== false) $gweather="http" . explode("|",explode("http", $withinbar[$iwb + 2])[1])[0];
         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 tzpn='';
    
    var agy='<?php echo $agy; ?>';
    var documentURL="" , locationhref='', etodi='emailee', etodicc='EmailCC', etodibcc='EmailBCC', etodisubject='EmailSubject';
    if (document.URL.indexOf('file:') != 0) {
    documentURL=document.URL;
    documentURL=documentURL.split('#')[0];
    }
    
    <?php
      if (isset($_POST['data'])) {
        $bstyle="";
        $appval="";
        $appvald="?";
        if (strlen($_SERVER['QUERY_STRING']) > 1) $appvald="&";
        foreach ($_POST as $name => $val) {
          if ($name != "wouldlikeyouto" . "seekpermission") {
            $appval.=$appvald . htmlspecialchars($name) . "=" . str_replace("+","%20",urlencode(htmlspecialchars($val)));
            $appvald="&";
          }
        }
        echo "\n documentURL=document.URL.split('#')[0] + \"" . $appval . "\";   \n";
      }
      
      if (isset($_POST['emailto'])) {
        echo "\n etodi='" . urldecode($_POST['emailto']) . "'; \n";
        if (isset($_POST['emailcc'])) echo "\n etodicc='" . urldecode($_POST['emailcc']) . "'; \n";
        if (isset($_POST['emailbcc'])) echo "\n etodibcc='" . urldecode($_POST['emailbcc']) . "'; \n";
        if (isset($_POST['emailsubject'])) echo "\n etodisubject='" . urldecode($_POST['emailsubject']) . "'; \n";
      } else if (isset($_GET['emailto'])) {
        echo "\n etodi='" . urldecode($_GET['emailto']) . "'; \n";
        if (isset($_GET['emailcc'])) echo "\n etodicc='" . urldecode($_GET['emailcc']) . "'; \n";
        if (isset($_GET['emailbcc'])) echo "\n etodibcc='" . urldecode($_GET['emailbcc']) . "'; \n";
        if (isset($_GET['emailsubject'])) echo "\n etodisubject='" . urldecode($_GET['emailsubject']) . "'; \n";
      }

    ?>
   

var yesgo='noway' + 'okay' + '675';
var nogo=yesgo;
var yesgo2=yesgo;
var nogo2=yesgo;
var yesgo3=yesgo;
var nogo3=yesgo;
var yesgo4=yesgo;
var nogo4=yesgo;
var yesgo5=yesgo;
var nogo5=yesgo;
var yesgo6=yesgo;
var nogo6=yesgo;
var redir='';
var fdata='';
var fdata0='';
var qs='';
var oneor='';

var wasurlgi='';
var isurlgi='';

   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 fti=false, gc_m="", gtitle="", glabel="", gvalue="";
   var aconto, pclong=['0','0'], polong=0.0, polat=0.0, poplace='';
   var zlatss,zlatd,zlatm,zlats=0,zlongss,zlongd,zlongm=0,zlongs; 
   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
  echo "\n var bstyle=\"" . $bstyle . "\"; \n";
  $wnearname="\n var jnearname=[]; \n";
  $wcom="";
  if (!isset($_GET['data']) && !isset($_POST['data'])) {
  for ($ity=0; $ity<sizeof($nearname); $ity++) {
    $wnearname=str_replace("];", $wcom . '"' . $nearname[$ity] . "," . $nearlatitude[$ity] . "," . $nearlongitude[$ity] . '"];', $wnearname);
    $wcom=","; 
  }
  }
  echo $wnearname;
  
  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


function alatr() {
  if (document.getElementById('psubm')) {
    //if (document.getElementById('pit').outerHTML.indexOf('geo_chart.php') != -1) { 
    // if (document.getElementById('pit').outerHTML.indexOf(' name="data"') != -1) { 
    //  alert(document.getElementById('pit').outerHTML.split(' name="data"')[1]); 
    // } else {
    //  alert(document.getElementById('pit').outerHTML); 
    // } 
    //} 
    document.getElementById('psubm').click();
  }
}

function toolong(inup) {
  var donealready=',';
  if (inup.split('&emailto=').length > 2) {
    while (inup.split('&emailto=').length > 2) {
     inup=inup.replace('&emailto=' + inup.split('&emailto=')[1].split('&')[0],'');
    }
  }
  if (inup.split('&emailsubject=').length > 2) {
    while (inup.split('&emailsubject=').length > 2) {
     inup=inup.replace('&emailsubject=' + inup.split('&emailsubject=')[1].split('&')[0],'');
    }
  }
  if (inup.split('&emailcc=').length > 2) {
    while (inup.split('&emailcc=').length > 2) {
     inup=inup.replace('&emailcc=' + inup.split('&emailcc=')[1].split('&')[0],'');
    }
  }
  if (inup.split('&emailbcc=').length > 2) {
    while (inup.split('&emailbcc=').length > 2) {
     inup=inup.replace('&emailbcc=' + inup.split('&emailbcc=')[1].split('&')[0],'');
    }
  }
  if (inup.indexOf('&email') > inup.indexOf('&data')) {
    var putb=inup.substring(inup.indexOf('&email'));
    inup=inup.replace(putb,'');
    inup=inup.replace('&data', putb + '&data');
  }
  if (inup.replace(/\%20\%7C/g, '%2C').length < 800) return inup.replace(/\%20\%7C/g, '%2C');
  //if (inup.replace(/\~\%5D/g, '~%2C2%5D').replace(/\%20\%7C/g, '%2C').length < 800) return inup.replace(/\~\%5D/g, '~%2C2%5D').replace(/\%20\%7C/g, '%2C');
  console.log('POST from map to geo');
  var pdone=false,pform='<form id=pit method=POST style=display:none; action=' + inup.split('?')[0] + '><input type=hidden name=onclick value=y></input><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><input type=submit id=psubm></input></form>';
  var pars=inup.replace('?','&').split('#')[0].split('&');
  for (var ipars=1; ipars<pars.length; ipars++) {
    if (!pdone) {
    if (pars[ipars].split('=')[0] == "data") {
    pdone=true;
  //if (documentURL.indexOf('rmetcalfe15') != -1) alert('here404 ' + inup.replace('?','&').split('#')[0].split('&data=')[1]);    
    if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1) { 
      //pform=pform.replace('</form>', '<textarea cols=120 rows=2 style=display:none; name="' + pars[ipars].split('=')[0] + '" value="">' + inup.replace('?','&').split('#')[0].split('&data=')[1].split('&')[0] + '</textarea></form>');
      pform=pform.replace('</form>', '<input type="hidden" name="' + pars[ipars].split('=')[0] + '" value="' + inup.replace('?','&').split('#')[0].split('&data=')[1].split('&')[0] + '"></input></form>');
    }
    } else if (decodeURIComponent(pars[ipars].split('=')[1]).indexOf("data:") != -1) {
    //if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1) { pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + (pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).replace(/\+/g,'%2b').split('&')[0] + '"></input></form>');
    if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1 && donealready.indexOf(',' + + ',') == -1) { donealready+=pars[ipars].split('=')[0] + ','; pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + decodeURIComponent(decodeURIComponent((pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).replace(/\+/g,'%2b').split('&')[0])) + '"></input></form>');
    }
    } else if (decodeURIComponent(pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).length > 500) {
    if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1) { 
      //pform=pform.replace('</form>', '<textarea cols=120 rows=2 style=display:none; name="' + pars[ipars].split('=')[0] + '" value="' + (pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).split('&')[0] + '"></textarea></form>');
      pform=pform.replace('</form>', '<input type="hidden" name="' + pars[ipars].split('=')[0] + '" value="' + (pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).split('&')[0] + '"></input></form>');
    }
    } else {
    //if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1) { pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + (pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).split('&')[0] + '"></input></form>');
    if (pform.indexOf(' name="' + pars[ipars].split('=')[0] + '" ') == -1 && donealready.indexOf(',' + + ',') == -1) { donealready+=pars[ipars].split('=')[0] + ',';  pform=pform.replace('</form>', '<input type=hidden name="' + pars[ipars].split('=')[0] + '" value="' + decodeURIComponent(decodeURIComponent((pars[ipars].replace(pars[ipars].split('=')[0] + '=','')).split('&')[0])) + '"></input></form>');
    }
    }
    }
  }
  //if (documentURL.indexOf('rmetcalfe15') != -1) alert('here44 ' + pform.substring(pform.indexOf('<textarea')));    
  //if (documentURL.indexOf('rmetcalfe15') != -1) alert('here444 ' + pform);    

// <form id=pit method=POST style=display:none; action=http://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php><input type=hidden name=onclick value=y></input><input type=hidden name=wouldlikeyoutoseekpermission value=y></input><input type=submit id=psubm></input><input type=hidden name="width" value="556"></input><input type=hidden name="height" value="347"></input><input type=hidden name="country" value="Places"></input><input type=hidden name="popularity" value=""></input><input type=hidden name="aregeographicals" value="y"></input><input type=hidden name="label" value="[%27Lat%27,"></input>
// <input type=hidden name="value" value="%27Lon%27,%20%27Name%27]"></input>
// <input type=hidden name="title" value="TimeZone%20Offset%20%2010%20Hours"></input>
// <input type=hidden name="label" value="[%27Lat%27,"></input>
// <input type=hidden name="value" value="%27Lon%27,%27Name%27]"></input>
// <input type=hidden name="width" value="1668.075"></input><input type=hidden name="height" value="1141.024"></input>
// <input type=hidden name="onclick" value="y"></input><input type=hidden name="country" value="country"></input>
// <input type=hidden name="popularity" value="popularity"></input><input type=hidden name="aregeographicals" value="Y"></input>
// <input type=hidden name="areplaces" value="Y"></input><input type=hidden name="geo16681141" value="Show"></input>
// <input type=hidden name="label" value="[%2527Lat%2527,"></input><input type=hidden name="value" value="%2527Lon%2527,%2527Name%2527]"></input>
// <input type=hidden name="title" value="TimeZone%2520Offset%2520%252010%2520Hours"></input>
// <textarea cols=120 rows=2 style=display:none; name="data" value="">,%20[-27.46667,153.03333,%7EAustralia%2FBrisbane%7E],[-39.93334,143.86666,%7EAustralia%2FCurrie%7E],[-42.88334,147.31666,%7EAustralia%2FHobart%7E],[-20.26667,149,%7EAustralia%2FLindeman%7E],[-37.81667,144.96666,%7EAustralia%2FMelbourne%7E],[-33.86667,151.21666,%7EAustralia%2FSydney%7E],[59.56666,150.8,%7ERussian_Federation%2FMagadan%7E],[46.96666,142.7,%7ERussian_Federation%2FSakhalin%7E],[64.56027,143.22666,%7ERussian_Federation%2FUst-Nera%7E],[43.16666,131.93333,%7ERussian_Federation%2FVladivostok%7E],[7.41666,151.78333,%7EMicronesia%2FChuuk%7E],[-9.5,147.16666,%7EPapua_New_Guinea%2FPort_Moresby%7E],[13.46666,144.75,%7EGuam%2FGuam%7E],[15.2,145.75,%7ENorthern_Mariana_Islands%2FSaipan%7E],[-66.66667,140.01666,%7EAntarctica%2FDumontDUrville%7E]&width=1668.075&height=1141.024&onclick=y&country=country&popularity=popularity&aregeographicals=Y&areplaces=Y&geo16681141=Show%20|%20[-90.0|0.0|~%20~,999999999]</textarea></form>


  console.log(pform.replace(/\%2520/g," ").replace(/\%252C/g,',').replace(/\%5B/g,'[').replace(/\%5D/g,']').replace(/\%25252C/g,',').replace(/\%25252F/g,'/').replace(/\%252F/g,'/').replace(/\%252F/g,'/').replace(/\%2C/g,',').replace(/\%252520/g,'_').replace(/\%2527/g,"'").replace(/\%27/g,"'").replace(/\%7E/g,'~').replace(/\%2F/g,'/').replace(/\%20/g,' ').replace(/\~\]/g, '~,2]').replace(/\,\ \[/g,'['));
  //alert(pform.replace(/\%2520/g," ").replace(/\%252C/g,',').replace(/\%5B/g,'[').replace(/\%5D/g,']').replace(/\%25252C/g,',').replace(/\%25252F/g,'/').replace(/\%252F/g,'/').replace(/\%252F/g,'/').replace(/\%2C/g,',').replace(/\%252520/g,'_').replace(/\%2527/g,"'").replace(/\%27/g,"'").replace(/\%7E/g,'~').replace(/\%2F/g,'/').replace(/\%20/g,' ').replace(/\~\]/g, '~,2]').replace(/\,\ \[/g,'['));
  if (agy != 'Y' || ('' + document.referrer).indexOf('/tz_places.php') != -1) {
  console.log('pform=' + pform);
  document.body.innerHTML+=pform;
  } else {
  document.body.innerHTML+=pform.replace(/\%252C/g,',').replace(/\%5B/g,'[').replace(/\%5D/g,']').replace(/\%25252C/g,',').replace(/\%25252F/g,'/').replace(/\%252F/g,'/').replace(/\%252F/g,'/').replace(/\%2C/g,',').replace(/\%252520/g,'_').replace(/\%2527/g,"'").replace(/\%27/g,"'").replace(/\%7E/g,'~').replace(/\%2F/g,'/').replace(/\%20/g,' ').replace(/\~\]/g, '~,2]').replace(/\,\ \[/g,'[');
  }
  //alert(pform.split(' name="task"')[1]);
  setTimeout(alatr, 2000); //document.getElementById('psubm').click();
  return '#';
}

 
 function clicktheemail() {
   if (document.getElementById('thesemail')) {
     document.getElementById('thesemail').click();
   }
 }

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;
   }
};
}

function sm() {
      zlatss=('' + polat).split('.');
      //zlatd
      zlatm=0;
      zlats=0;
      zlongss=('' + polong).split('.');
      //zlongd
      zlongm=0;
      zlongs=0;
      if (zlatss.length == 1) {
        zlatd=eval(zlatss[0]);
      } else {
        zlatd=eval(zlatss[0]);
        zlatm=Math.floor(60.0 * eval('0.' + zlatss[1]));
        zlats=Math.floor(eval(3600.0 * (Math.abs(eval(polat)) -  (Math.abs(eval(zlatd)) + eval(zlatm / 60.0)) )));
      }
      if (zlongss.length == 1) {
        zlongd=eval(zlongss[0]);
      } else {
        zlongd=eval(zlongss[0]);
        zlongm=Math.floor(60.0 * eval('0.' + zlongss[1]));
        zlongs=Math.floor(eval(3600.0 * (Math.abs(eval(polong)) -  (Math.abs(eval(zlongd)) + eval(zlongm / 60.0)) )));
      }
}

function dllb() {
  var qpw=0;
  if (window.location.protocol == 'file:') {
    if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
      if (document.getElementById('dlocs')) {
        document.getElementById('dlocs').setAttribute("open");
      }
    } else if (document.getElementById('dlocs')) {
      document.getElementById('dlocs').removeAttribute("open");
    }
  }
  if (dlltbits != '' && document.getElementById('zdlltbits')) {
    document.getElementById('zdlltbits').value=dlltbits;
  }
  if (dllwbits != '' && document.getElementById('zdllwbits')) {
    document.getElementById('zdllwbits').value=dllwbits;
  }
  if (window.parent) {  // Daylight Saving parent says it should be a Geo Chart
    if (parent.document.getElementById('sthgm') && ('' + document.referrer).indexOf('/map.php') == -1) {
     if (parent.document.getElementById('sthgm').value == '  ') {
      if (parent.document.URL.indexOf('/daylight_saving_time.htm') != -1) {
        if (document.getElementById('amapidgeo')) {
          document.getElementById('amapidgeo').click();
        }
      }
     }
    }
  }
  
  var isusdams='<?php echo (isset($_POST['iso']) ? trim(str_replace('+',' ',urldecode($_POST['iso']))) : (isset($_GET['iso']) ? trim(str_replace('+',' ',urldecode($_GET['iso']))) : '')); ?>';
  if (window.top || isusdams.trim() != '') {
        if (isusdams.trim() != '') {
          if (isusdams.indexOf(';') == -1) { isusdams+=';'; }
        } else if (top.document.URL.indexOf('/dams_usa.htm') != -1) {
          isusdams='US;';
        } else if (top.document.URL.indexOf('/australian_') != -1) {
          isusdams='AU;';
        } else if (document.URL.indexOf('iso=') != -1) {
          isusdams=document.URL.split('iso=')[1].split('&')[0].split('#')[0] + ';';
        } else if (parent.document.URL.indexOf('/tz_places.php?iso=') != -1) {
          isusdams=parent.document.URL.split('/tz_places.php?iso=')[1].split('&')[0].split('#')[0] + ';';
        } else if (top.document.URL.indexOf('/tz_places.php?iso=') != -1) {
          isusdams=top.document.URL.split('/tz_places.php?iso=')[1].split('&')[0].split('#')[0] + ';';
        }
  } else if (document.URL.indexOf('iso=') != -1) {
          isusdams=document.URL.split('iso=')[1].split('&')[0].split('#')[0] + ';';
  } 
  if (isusdams != '') {  // amapidgeo
        if (document.getElementById('amapidgeo')) {
          document.getElementById('amapidgeo').click();
        } else {
          setTimeout(latergeoclick, 5000);
        }
  }
}

function latergeoclick() {
        if (document.getElementById('amapidgeo')) {
          document.getElementById('amapidgeo').click();
        }
}

// Thanks to http://jennifermadden.com/javascript/stringEnterKeyDetector.html
function checkEnter(e, tbv, rele, ifone) { //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
}

var iamwv=0;
<?php
  if ($amwv) { echo "\n iamwv=1; \n"; }
?>

if ((characterCode == 103 || characterCode == 71) && eval(ifone) < 100 && tbv.length <=1 && navigator.userAgent.match(/iPhone|iPad/i)) {   
if (iamwv == 0) {
top.location.href='//www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('//maps.google.com/maps?z=9&t=m&q=loc:' + polat + polong.replace('-',',-'));
} else {
document.getElementById('cdiv').innerHTML='<a id=mya href=#></a><iframe id=myiframe src=' + String.fromCharCode(34) + '//www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('//maps.google.com/maps?z=9&t=m&q=loc:' + polat + polong.replace('-',',-')) + String.fromCharCode(34) + ' width=450 height=450></iframe>';
}
} else if ((characterCode == 109 || characterCode == 77) && eval(ifone) < 100 && tbv.length <=1 && navigator.userAgent.match(/iPhone|iPad/i)) {   
if (iamwv == 0) {
top.location.href='//www.rjmprogramming.com.au/PHP/MoonAngle/moon_angle_now_at.php?latd=' + zlatd + '&latm=' + zlatm + '&lats=' + zlats + '&longd=' + zlongd + '&longm=' + zlongm + '&longs=' + zlongs + '&from=from&done=y';
} else {
document.getElementById('cdiv').innerHTML='<a id=mya href=#></a><iframe id=myiframe src=' + String.fromCharCode(34) + '//www.rjmprogramming.com.au/PHP/MoonAngle/moon_angle_now_at.php?latd=' + zlatd + '&latm=' + zlatm + '&lats=' + zlats + '&longd=' + zlongd + '&longm=' + zlongm + '&longs=' + zlongs + '&from=from&done=y' + String.fromCharCode(34) + ' width=450 height=450></iframe>';
}
} else if ((characterCode == 115 || characterCode == 83) && eval(ifone) < 100 && tbv.length <=1 && navigator.userAgent.match(/iPhone|iPad/i)) {   
if (iamwv == 0) {
top.location.href='//www.rjmprogramming.com.au/PHP/SunAngle/sun_angle_now_at.php?latd=' + zlatd + '&latm=' + zlatm + '&lats=' + zlats + '&longd=' + zlongd + '&longm=' + zlongm + '&longs=' + zlongs + '&from=from&done=y';
} else {
document.getElementById('cdiv').innerHTML='<a id=mya href=#></a><iframe id=myiframe src=' + String.fromCharCode(34) + '//www.rjmprogramming.com.au/PHP/SunAngle/sun_angle_now_at.php?latd=' + zlatd + '&latm=' + zlatm + '&lats=' + zlats + '&longd=' + zlongd + '&longm=' + zlongm + '&longs=' + zlongs + '&from=from&done=y' + String.fromCharCode(34) + ' width=450 height=450></iframe>';
}
} else if ((characterCode == 119 || characterCode == 87) && eval(ifone) < 100 && tbv.length <=1 && navigator.userAgent.match(/iPhone|iPad/i)) {   
<?php
 if (isset($_POST['r'])) echo "\n ir=" . urldecode($_POST['r']) . "; \n";
 echo "\n if (ir == -1 && document.getElementById('jr')) ir=eval(document.getElementById('jr').value); \n";
 echo $dllwbits;
?>
} else if ((characterCode == 116 || characterCode == 84) && eval(ifone) < 100 && tbv.length <=1 && navigator.userAgent.match(/iPhone|iPad/i)) {   
<?php
 if (isset($_POST['r'])) echo "\n ir=" . urldecode($_POST['r']) . "; \n";
 echo "\n if (ir == -1 && document.getElementById('jr')) ir=eval(document.getElementById('jr').value); \n";
 echo $dlltbits;
?>
} else 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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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 mbe(jc,jr) {
if (navigator.userAgent.match(/iPhone|iPad/i)) {
    if (jc != -1) {
      if (document.getElementById('jc')) {
         document.getElementById('jc').value='' + jc;
      } else if (document.getElementById('divir')) {
         document.getElementById('divir').innerHTML+="<input type=hidden name=c id=jc value='" + jc + "'></input>";
      }
    }
    if (jr != -1) {
      if (document.getElementById('jr')) {
         document.getElementById('jr').value='' + jr;
      } else if (document.getElementById('divir')) {
         document.getElementById('divir').innerHTML+="<input type=hidden name=r id=jr value='" + jr + "'></input>";
      }
    }
}
}

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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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.replace(' ',''),withit).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 makeright(inbo) {
  var startisc='';
  var endisc='';
  if (typeof documentURL === "undefined") {  
    inbo=inbo;
  } else {
    if (documentURL.indexOf('&') != -1 && inbo.indexOf('<bo' + 'dy') != -1) {
      if (inbo.indexOf('</bo' + 'dy>') != -1) {
      inbo=inbo.replace('</bo' + 'dy>', + '<scr' + 'ipt type="text/javascript">  function dub() { ' + "  documentURL=\"" + documentURL + "\"; if (documentURL.indexOf(\"&data=\") != -1) { paramdata=(documentURL + \"&\").split(\"&data=\")[1].split(\"&\")[0]; pardata=encodeURIComponent(paramdata);   }  } " + "   var tpardata='',tparamdata='', tdocumentURL=\"" + documentURL + "\"; if (tdocumentURL.indexOf(\"&data=\") != -1) { tparamdata=(tdocumentURL + \"&\").split(\"&data=\")[1].split(\"&\")[0]; tpardata=encodeURIComponent(tparamdata);   }  </scr" + 'ipt></bo' + 'dy>');
      } else {
      inbo+='<scr' + 'ipt type="text/javascript">  function dub() { ' + "  documentURL=\"" + documentURL + "\"; if (documentURL.indexOf(\"&data=\") != -1) { paramdata=(documentURL + \"&\").split(\"&data=\")[1].split(\"&\")[0]; pardata=encodeURIComponent(paramdata);   } } " + " var tpardata='',tparamdata='', tdocumentURL=\"" + documentURL + "\"; if (tdocumentURL.indexOf(\"&data=\") != -1) { tparamdata=(tdocumentURL + \"&\").split(\"&data=\")[1].split(\"&\")[0]; var tpardata=encodeURIComponent(tparamdata);   }  </scr" + ' </scr' + 'ipt>';
      }
      if (inbo.split('<bo' + 'dy')[1].split('>')[0].indexOf(' onload=') == -1) {
        return inbo.replace('<bo' + 'dy', '<bo' + 'dy onl' + "oad=' setTimeout(dub,1500); ' ");
      } else if (inbo.split('<bo' + 'dy')[1].split('>')[0].indexOf(' onload="') != -1) {
        startisc='<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0].split(' onload="')[0];
        endisc=inbo.split('<bo' + 'dy')[1].split('>')[0].split(' onload="')[1];
        return inbo.replace('<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0], startisc + ' onload=" setTimeout(dub(1500); ' + endisc);
      } else if (inbo.split('<bo' + 'dy')[1].split('>')[0].indexOf(" onload='") != -1) {
        startisc='<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0].split(" onload='")[0];
        endisc=inbo.split('<bo' + 'dy')[1].split('>')[0].split(" onload='")[1];
        return inbo.replace('<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0], startisc + " onload=' setTimeout(dub(1500); " + endisc);
      } else if (inbo.split('<bo' + 'dy')[1].split('>')[0].indexOf(" onload=") != -1) {
        startisc='<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0].split(" onload=")[0];
        endisc=inbo.split('<bo' + 'dy')[1].split('>')[0].split(" onload=")[1];
        return inbo.replace('<bo' + 'dy' + inbo.split('<bo' + 'dy')[1].split('>')[0], startisc + " onload=setTimeout(dub(1500);" + endisc);
      }
    }
  }
  return inbo;
}


  function foneor(udf) {
    if (oneor != '') return oneor;
    return udf;
  }

  function ourprompt(ourp1, ourp2) {
      var iop=0;
      tzpn='';
      var ourp1lines=ourp1.split(String.fromCharCode(10));
      // Is there something you want to try with Latitude -34.91667 and Longitude 138.58333 Australia/Adelaide in Australia 🇦🇺 is 1239.227km (+10.5 🕝 pm, Monday)  ?
      var andls=ourp1.split(' and Longitude ');
      if (eval('' + andls.length) > 1) {
       var nwds=andls[1].split(' ');
       if (eval('' + nwds.length) > 1) {
         if (nwds[1].indexOf('/') > 0 && ourp1.indexOf(' ? ') != -1) {
           tzpn=nwds[1];
           ourp1=ourp1.replace(' ? ', ' ?  Colour Wheel=H, ');
           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 = ourp2;
      if (!fti) {
        thisris=prompt(ourp1, ourp2); 
        if (thisris != null && tzpn != '') {
          if (thisris.toLowerCase() == 'h') {
            var idon=false;
            //alert(1);
            if (window.parent) {
             //alert(2);
             if (parent.document.getElementById('pcwheel') && parent.document.getElementById('tdpcwheel')) {
            //alert(3);
                if (1 == 1 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
            //alert(4);
                top.window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn, '_blank');
                //location.href=('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn); //, '_blank');
                } else {
                parent.document.getElementById('tdpcwheel').style.display='table-cell';
                parent.document.getElementById('pcwheel').style.display='block';
                parent.document.getElementById('pcwheel').src='//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn;
                }
                idon=true;
                //return null;
              }
            }
            if (!idon) {
            document.getElementById('cwheel').style.width='100%';
            document.getElementById('cwheel').style.height='800px';
            document.getElementById('cwheel').style.display='block';
            window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn, 'cwheel',); // 'top=50,left=50,width=600,height=600');
            document.getElementById('cwheel').scrollIntoView();
            }
            thisris=ourp2;
          }
        }
        if (ourp1.indexOf('(can enter URL') != -1 && thisris != null) {
          if (thisris.indexOf('/') > 0) {
            for (iop=0; iop<jnearname.length; iop++) {
              if (jnearname[iop].indexOf('/') > 0) {
              if (thisris.indexOf(jnearname[iop].split(',')[0]) != -1) {
                oneor=jnearname[iop].replace(jnearname[iop].split(',')[0] + ',','');
              } else if (oneor == '' && jnearname[iop].indexOf('/' + thisris + '|') != -1) {
                oneor=jnearname[iop].replace(jnearname[iop].split(',')[0] + ',','');
              }
              }
            }
          }
        }
      }
      if (document.getElementById('safariform')) {
      if (document.getElementById('hval1')) {
        if (decodeURIComponent(document.getElementById('hval1').value).indexOf('rjmprogramming.com.au') != -1) {
          return document.getElementById('hval1').value;
        }
       }
      }
      
      if (thisris != null && ourp1.indexOf(' there something you ') == -1 && ourp1.indexOf('background image URL') == -1) {
        var commacount=thisris.toLowerCase().replace(/\<\/td\>/g,'  ,  ').indexOf(',');
        if (commacount != -1) {
          commacount=(thisris + ' ').substring(eval(1 + commacount)).toLowerCase().replace(/\<\/td\>/g,'  ,  ').indexOf(',');
        }
        if (thisris.toLowerCase().replace("https:","http:").indexOf("http:") == 0) {
             if (gtitle == "") gtitle="Places";
             if (glabel == "") glabel="['Lat',";
             if (gvalue == "") gvalue="'Lon', 'Name']";
             document.getElementById('idivis').style.width='100%';
             document.getElementById('idivis').style.height='500px';
             document.getElementById('idivis').innerHTML='<iframe src="' + document.URL.split('#')[0].split('?')[0] + "?title=" + gtitle + "&label=" + glabel + "&value=" + gvalue.replace("  ercent ", "") + nojwinextra + "&custom_map=" + encodeURIComponent(jnocomm(gc_m)) + "&data=" + encodeURIComponent(thisris) + '"></iframe>';
             fti=true;
             allowed=true;
             //window.open(document.URL.split('#')[0].split('?')[0] + "?title=" + gtitle + "&label=" + glabel + "&value=" + gvalue.replace("  ercent ", "") + nojwinextra + "&custom_map=" + encodeURIComponent(jnocomm(gc_m)) + "&data=" + encodeURIComponent(thisris),'_self');
        } else if (commacount >= 0 && document.getElementById('myoptform') && document.getElementById('myoptsbutton')) {   // myoptform post via myoptsbutton click
             var vbits="";
             var thatris=thisris;
             //alert(thisris);
             while (thatris.indexOf(String.fromCharCode(10)) != -1) {
               thatris=thatris.replace(String.fromCharCode(10), ',');
             }
             
             //alert(thatris);
             //while (thatris.indexOf('""') != -1) {
             //  thatris=thatris.replace('""', '" "');
             //}
             //alert(thatris);
             
             thatris=thatris.replace(/\,\,/g,',');
             
             if (6 == 5) {
             if (gtitle == "") gtitle="Places";
             if (glabel == "") glabel="['Lat',";
             if (gvalue == "") gvalue="'Lon', 'Name']";
             document.getElementById('idivis').style.width='100%';
             document.getElementById('idivis').style.height='500px';
             document.getElementById('idivis').innerHTML='<iframe src="" name="imore" d="more"></iframe>';
             document.getElementById('myoptform').target='_blank';
             document.getElementById('myoptform').method='GET';
             document.getElementById('myoptform').action=document.URL.split('#')[0].split('?')[0];
             vbits+='<input type=hidden name=label value="' + glabel + '"></input>';
             vbits+='<input type=hidden name=value value="' + gvalue + '"></input>';
             if (gtitle.indexOf('&') != -1) {
             vbits+='<input type=hidden name=title value="' + gtitle.split('&')[0] + '"></input>';
             var vvbits=gtitle.split('&');
             for (var ivvbits=1; ivvbits<vvbits.length; ivvbits++) {
             vbits+='<input type=hidden name="' + vvbits[ivvbits].split('=')[0] + '" value="' +  vvbits[ivvbits].split('=')[1] + '"></input>';
             }
             } else {
             vbits+='<input type=hidden name=title value="' + gtitle + '"></input>';
             }
             vbits+='<input type=hidden name=g_c value="' + jnocomm(gc_m) + '"></input>';
             if (thisris.toLowerCase().indexOf('</td>') != -1) {
             vbits+='<textarea id=tadata rows=100 cols=100 style="display:none;" name=data value="">http;' + thatris + '</textarea>';
             document.getElementById('myoptform').innerHTML+=vbits;
             document.getElementById('tadata').value='http;' + thatris;
             } else {
             vbits+='<input type=hidden name=data value="http;' + thatris + '"></input>';
             document.getElementById('myoptform').innerHTML+=vbits;
             }
             //alert(document.getElementById('myoptform').outerHTML);
             document.getElementById('myoptsbutton').click();   
             }  
             fti=true;
             allowed=true;
             datac='http;' + thatris;
             thisris='http;' + thatris;    
             //exit();      
        }
      }
      
      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(32);
    } 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(32);
    } 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";
        }
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        $dlltbits="top.location.href='HTTP://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($_GET['tzname']) . "');";
        } else {
        $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";
        }
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        $dlltbits="top.location.href='HTTP://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($_POST['tzname']) . "');";
        } else {
        $dlltbits="window.open('HTTP://timezoneconverter.com/cgi-bin/zoneinfo?tz=" . urldecode($_POST['tzname']) . "','_blank');";
        }
      }
      if (isset($_GET['wlink']) && $wlok) {
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        $dllwbits="top.location.href='https://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('" . urldecode($_GET['wlink']) . "');";
        //$dllwbits="top.location.href='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?andthen=' + encodeURIComponent('" . urldecode($_GET['wlink']) . "');";
        } else {
        $dllwbits="window.open('" . urldecode($_GET['wlink']) . "','_blank');";
        }
      }
      if (isset($_POST['wlink']) && $wlok) {
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        $dllwbits="top.location.href='https://www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('" . urldecode($_POST['wlink']) . "');";
        //$dllwbits="top.location.href='//www.rjmprogramming.com.au/HTMLCSS/karaoke_youtube_api.htm?andthen=' + encodeURIComponent('" . urldecode($_POST['wlink']) . "');";
        } else {
        $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 . "'); if (ir != -1) { mbe(-1,ir); } \n";
      if ($GETc != "") echo "\n ic=eval('" . $GETc . "'); if (ic != -1) { mbe(ic,-1); } \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']";
      $mg=$GETdata;
            
      echo "var data, chart, pardata = (location.search.split('data=')[1] ? location.search.split('data=')[1].split('&')[0] : ''), paramdata=decodeURIComponent(pardata);\n";
      echo "\n var bstyle=\"" . $bstyle . "\"; \n";
      if (isset($_GET['value'])) {
       $GETtitle = str_replace("+"," ",urldecode($_GET['title']));
       if (strpos($GETtitle, "TimeZone Offset ") !== false) { $agy="Y"; }
       titlebits($burl, $GETtitle, $cdivc, $bdivstart, $bdivend, $nondefs);
       $GETlabel = str_replace("\\","",urldecode($_GET['label']));
       $GETvalue = str_replace("\\","",urldecode($_GET['value']));
       if (isset($_POST['data'])) {
       $bstyle="";
       $GETdata = tzlook($_POST['data']);
       } else {
       $bstyle="";
       $GETdata = tzlook($_GET['data']);
       }
      } else if (isset($_POST['value'])) {
       $GETtitle = str_replace("+"," ",urldecode($_POST['title']));
       if (strpos($GETtitle, "TimeZone Offset ") !== false) { $agy="Y"; }
       titlebits($burl, $GETtitle, $cdivc, $bdivstart, $bdivend, $nondefs);
       $GETlabel = str_replace("\\","",urldecode($_POST['label']));
       $GETvalue = str_replace("\\","",urldecode($_POST['value']));
       $GETdata = tzlook(urldecode($_POST['data']));
      }
      if (!isset($_GET['data']) && !isset($_POST['data']) && $mg == $GETdata && strpos($_SERVER['QUERY_STRING'],"title=") !== false) {
       $bbits = explode("data=", file_get_contents('php://input'));
         $GETtitle = str_replace("\\'", "'", urldecode(explode('&',explode("title=", $_SERVER['QUERY_STRING'])[1])[0]));
         $GETlabel = str_replace("\\'", "'", urldecode(explode('&',explode("label=", $_SERVER['QUERY_STRING'])[1])[0]));
         $GETvalue = str_replace("\\'", "'", urldecode(explode('&',explode("value=", $_SERVER['QUERY_STRING'])[1])[0]));
       if (sizeof($bbits) > 1) {
         $GETdata = str_replace("\\'", "'", urldecode(explode('&',$bbits[1])[0]));
         if (GETdata != "") $bstyle="";
       } else {
         $GETdata = "";
       }
      }      
      
      $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 agy=\"" . $agy . "\";\n";
      echo "var xparamdata=\"" . str_replace('"',"'",$GETdata) . "\";\n";
      echo " paramdata=\"" . str_replace('"',"'",$GETdata) . "\";\n";
      echo " pardata=encodeURIComponent(paramdata);\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 != "") {
        if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
        echo "\n dllwbits=\"" . str_replace('"',"'",$dllwbits) . "\" + String.fromCharCode(10) + String.fromCharCode(10); \n tzbrrbits.push(dllwbits); \n";
          //file_put_contents("zzz.zzz",$dllwbits);  
          //file_put_contents("zzzz.zzzz", str_replace('"',"'",$dllwbits));
        } else {
        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";
      if ($GETdata == "") {
      echo ' var prewert="data.addRows([ "; ' . "\n";
      echo " prewert+=parent.document.getElementById('data').value.substring(1).replace(/\~/g,\"'\").replace(/\'\'\'\'/g,\"''\"); " . "\n";
      echo ' prewert+=" ])";' . "\n";
      echo ' eval(prewert); ' . "\n";
      } else {
  echo " data.addRows([ \n";
      echo str_replace("''" . "''", "''", str_replace("~", "'", substr($GETdata,1)));
  echo "   ]); \n";
      }
 } else {
      if ($GETdata == "") {
      echo ' var wert="data=google.visualization.arrayToDataTable([ ' . urldecode(urldecode(urldecode(urldecode($GETlabel)))) . urldecode(urldecode(urldecode(urldecode($GETvalue)))) . ']"; ' . "\n";
      echo " wert+=parent.document.getElementById('data').value.replace(/\~/g,\"'\").replace(/\'\'\'\'/g,\"''\"); " . "\n";
      echo ' wert+=" ])";' . "\n";
      echo ' eval(wert); ' . "\n";
      } else {
      
      while (str_replace(',  ', ', ', $GETdata) != $GETdata) {
       $GETdata=str_replace(',  ', ', ', $GETdata);
      }
            
      if (str_replace(', , ', ', ', str_replace("''" . "''", "''", str_replace("~", "'", $GETdata))) != str_replace("''" . "''", "''", str_replace("~", "'", $GETdata))) {
       $GETdata=str_replace(', , ', ', ', $GETdata);
      }
      if (str_replace('][', '] , [', $GETdata) != $GETdata) {
       $GETdata=str_replace('][', '] , [', $GETdata);
      }
      if (str_replace("']']", "']", str_replace("''" . "''", "''", str_replace("~", "'", $GETdata))) != str_replace("''" . "''", "''", str_replace("~", "'", $GETdata))) {
       $GETdata=substr($GETdata,0,(strlen($GETdata) - 2));
      }
      
      
      $gdis=str_replace("''" . "''", "''", str_replace("~", "'", $GETdata));
      $gsxcs=explode(" , [-90.0,0.0,' ']", $gdis);
      if (sizeof($gsxcs) > 2) {
        $gdis=$gsxcs[0] . " , [-90.0,0.0,' ']";
      }
      
      if (substr((str_replace($gdis,' ','') . '  '),0,2) == ',,') {
        $gdis=ltrim($gdis);
        $gdis=ltrim($gdis,',');
        if (substr((str_replace($gdis,' ','') . ' '),0,1) != ',') {
        $gdis=',' . $gdis;
        }
      }

      while (str_replace(',  ', ', ', $gdis) != $gdis) {
       $gdis=str_replace(',  ', ', ', $gdis);
      }
      if (str_replace(', , ', ', ', $gdis) != $gdis) {
       $gdis=str_replace(', , ', ', ', $gdis);
      }

      echo ' data = google.visualization.arrayToDataTable([ ' . "\n";
      echo " " . urldecode(urldecode(urldecode(urldecode($GETlabel)))) . urldecode(urldecode(urldecode(urldecode($GETvalue)))) . " \n";
      echo $gdis;
      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";


      if ($bstyle == "") { 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']);
      $GETextraopts = "";
      if (isset($_GET['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_GET['extraopts'])); }
      if (isset($_POST['extraopts'])) { $GETextraopts = str_replace("+"," ",urldecode($_POST['extraopts'])); }
  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']));
  }
  
  
  
  
      if (trim($GETextraopts) != '') { $GETextraopts=str_replace(',,',',',trim($GETextraopts) . ',');   }
  echo str_replace(',,',','," if ((parent.d" . "ocument.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)) {  if (bstyle == '') { chart.draw(data, { useMapTypeControl:true" . $nondefs . ", " . $GETextraopts . " 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 { if (bstyle == '') { chart.draw(data, { useMapTypeControl:true" . $nondefs . ", 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(32) + '' + String.fromCharCode(32) + avblurb + '' + 'Google Map=G (optional zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(32) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(32) + '' + 'Geo Chart=O' + String.fromCharCode(32) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(32) + 'Moon Angle=M' + String.fromCharCode(32) + 'Coriolis Force=C' + String.fromCharCode(32) + '' + 'Nearest Airports=A (optional number of[3])' + String.fromCharCode(32) + 'Elevation=E' + String.fromCharCode(32) + '' + 'Nearest TimeZone=Z (and onto Weather)' + String.fromCharCode(32) + '' + 'YouTube=Y (for ' + oplace.split('|')[0] + ')' + String.fromCharCode(32) + '' + dllc + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(32) + tprop + String.fromCharCode(32) + 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;
         sm();
         //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;
        if (ir != -1) mbe(-1,ir);
        ic=item.column;
        if (ic != -1) mbe(ic,-1);
        //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;
        if (ir != -1) mbe(-1,ir);
        //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(32) + '' + String.fromCharCode(32) + avblurb + '' + 'Google Map=G (optional zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(32) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(32) + '' + 'Geo Chart=O' + String.fromCharCode(32) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(32) + 'Moon Angle=M' + String.fromCharCode(32) + 'Coriolis Force=C' + String.fromCharCode(32) + '' + 'Nearest Airports=A (optional number of[3])' + String.fromCharCode(32) + 'Elevation=E' + String.fromCharCode(32) + '' + 'Nearest TimeZone=Z (and onto Weather)' + String.fromCharCode(32) + '' + 'YouTube=Y (for ' + oplace.split('|')[0] + ')' + String.fromCharCode(32) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(32) + tptrop + String.fromCharCode(32) + '' + '... 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;
         sm();
         //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;
        if (ic != -1) mbe(ic,-1);
        //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(32) + '' + String.fromCharCode(32) + avblurb + '' + 'Google Map=G (optional zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(32) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(32) + '' + 'Geo Chart=O' + String.fromCharCode(32) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(32) + 'Moon Angle=M' + String.fromCharCode(32) + 'Coriolis Force=C' + String.fromCharCode(32) + '' + 'Nearest Airports=A (optional number of[3])' + String.fromCharCode(32) + 'Elevation=E' + String.fromCharCode(32) + '' + 'Nearest TimeZone=Z (and onto Weather)' + String.fromCharCode(32) + '' + 'YouTube=Y (for ' + oplace.split('|')[0] + ')' + String.fromCharCode(32) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(32) + xtprop + String.fromCharCode(32) + '' + '... 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;
         sm();
         //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);
      sm();

           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(32) + '' + String.fromCharCode(32) + avblurb + '' + 'Google Map=G (optional zoom factor[9m] + m=map, k=satellite, h=hybrid, p=terrain, e=GoogleEarth)' + String.fromCharCode(32) + '' + 'Bearing To Others=B[trip] (add trip for one place and onto next)' + String.fromCharCode(32) + '' + 'Geo Chart=O' + String.fromCharCode(32) + '' + 'Sun Angle at Noon=S' + String.fromCharCode(32) + 'Moon Angle=M' + String.fromCharCode(32) + 'Coriolis Force=C' + String.fromCharCode(32) + '' + 'Nearest Airports=A (optional number of[3])' + String.fromCharCode(32) + 'Elevation=E' + String.fromCharCode(32) + '' + 'Nearest TimeZone=Z (and onto Weather)' + String.fromCharCode(32) + '' + 'YouTube=Y (for ' + oplace.split('|')[0] + ')' + String.fromCharCode(32) + '' + maybeirw(dllw,ir) + maybeir(dllt,ir) + dllc + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(32) + '' + String.fromCharCode(32) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started.  Robert' + String.fromCharCode(32) + ytprop + String.fromCharCode(32) + '' + '...  else leave as blank or as is or choose Cancel to leave the status quo, and feel free to append (or place before non-first ,[) any/all of your own &emailto=[' + etodi + '] &emailsubject=[' + etodisubject + '] &emailcc=[' + etodicc + '] &emailbcc=[' + etodibcc + ']', paramdata);
    }
    if (andthen == null) andthen='';
         pclong=[clong[0],clong[1]];
         polong=olong;
         polat=olat;
         poplace=oplace;
         sm();
  }
  
  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 gogeo(usug) {
     if (documentURL.indexOf('data=') != -1) {
      if ((documentURL + '~').indexOf('&data=~') != -1 && ('' + pardata).replace('undefined','') != '') {
        documentURL=documentURL + pardata;
      }
      var isusdams='" . (isset($_POST['iso']) ? trim(str_replace('+',' ',urldecode($_POST['iso']))) : (isset($_GET['iso']) ? trim(str_replace('+',' ',urldecode($_GET['iso']))) : '')) . "';
      if (window.top || isusdams.trim() != '') {
        if (isusdams.trim() != '') {
          if (isusdams.indexOf(';') == -1) { isusdams+=';'; }
        } else if (top.document.URL.indexOf('/dams_usa.htm') != -1) {
          isusdams='US;';
        } else if (top.document.URL.indexOf('/australian_') != -1) {
          isusdams='AU;';
        } else if (document.URL.indexOf('iso=') != -1) {
          isusdams=document.URL.split('iso=')[1].split('&')[0].split('#')[0] + ';';
        } else if (parent.document.URL.indexOf('/tz_places.php?iso=') != -1) {
          isusdams=parent.document.URL.split('/tz_places.php?iso=')[1].split('&')[0].split('#')[0] + ';';
        } else if (top.document.URL.indexOf('/tz_places.php?iso=') != -1) {
          isusdams=top.document.URL.split('/tz_places.php?iso=')[1].split('&')[0].split('#')[0] + ';';
        } 
      } else if (document.URL.indexOf('iso=') != -1) {
          isusdams=document.URL.split('iso=')[1].split('&')[0].split('#')[0] + ';';
      }
      if (isusdams != '') {
      locationhref=toolong((documentURL + '%20,%20[-90.0|0.0|~%20~,999999999]').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=y&').replace('title=','title=' + isusdams).replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
      } else {
      locationhref=toolong((documentURL + '%20,%20[-90.0|0.0|~%20~,999999999]').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=y&').replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
      }
      //locationhref=toolong((documentURL + ',[-90.0,0.0,~%20~,999999999]').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=' + agy + '&').replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
      //locationhref=toolong((documentURL + '').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=' + agy + '&').replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
     } else {
      locationhref=usug;
     }
     if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
   }   
   
   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';
      console.log('andthen=' + andthen);
     }
    }
    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');
      if ('intair' == 'intair') {
      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).replace(/\-/g,'%' + '2d').replace(/\#/g,'%' + '23') + '~]' + 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>';
      location.href='#amapid';
      } else {
      window.open('//www.rjmprogramming.com.au/HTMLCSS/intair.php?num=' + numthing + '&lat=' + olat + '&long=' + olong + '&spawn=' + encodeURIComponent('//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).replace(/\-/g,'%' + '2d').replace(/\#/g,'%' + '23') + '~]'), '_blank','top=80,left=480,width=600,height=600');
      }
    } else if (andthen.toLowerCase().substring(0,1) == 'e') {
      window.open('http://veloroutes.org/elevation/?location=' + olat + '%2C' + olong + '&units=m', '_blank','top=80,left=80,width=980,height=600');
    } 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>');
      var dvbit='<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>';
      if ('intair' == 'intair') {
      document.getElementById('nearesttz').innerHTML=dvbit;
      location.href='#amapid';
      } else {
      dvbit='<div id=nearesttz><div id=pretz></div></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>';
      window.open('//www.rjmprogramming.com.au/PHP/tz_places.php?place=' + encodeURIComponent(oplace.split('|')[0]) + nojwinextra + '&latitude=' + olat + '&longitude=' + olong + '&plusdiv=' + encodeURIComponent(dvbit) + '#snearest','_blank','top=80,left=480,width=600,height=600');
      }
    } 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 if (navigator.userAgent.match(/iPhone|iPad/i)) {
         top.location.href='//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).toLowerCase() == 'o') {
      //locationhref=toolong((documentURL + '%20,%20[-90.0|0.0|~%20~,999999999]').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=y&').replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
      locationhref=toolong((documentURL + '%20,%20[-90.0|0.0|~%20~,999999999]').replace('/Map', '/GeoChart').replace('map.php', 'geo_chart.php').replace('?','?width=556&height=347&country=Places&popularity=&aregeographicals=' + agy + '&').replace(/\=\,/g,'=').replace(/\,\~/g,'|~').replace(/0\,/g,'0|').replace(/1\,/g,'1|').replace(/2\,/g,'2|').replace(/3\,/g,'3|').replace(/4\,/g,'4|').replace(/5\,/g,'5|').replace(/6\,/g,'6|').replace(/7\,/g,'7|').replace(/8\,/g,'8|').replace(/9\,/g,'9|').replace('%27|%20','%27,%20').replace('%27|','%27,').replace(/\~\]/g,'~,1]'));
      if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
    } else if (andthen.toLowerCase().substring(0,1) == 'h') {
        if (tzpn != '') {
          //if (thisris.toLowerCase() == 'w') {
            var idon=false;
            //alert(1);
            if (window.parent) {
             //alert(2);
             if (parent.document.getElementById('pcwheel') && parent.document.getElementById('tdpcwheel')) {
            //alert(3);
                if (1 == 1 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
            //alert(4);
                top.window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn, '_blank');
                //location.href=('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn); //, '_blank');
                } else {
                parent.document.getElementById('tdpcwheel').style.display='table-cell';
                parent.document.getElementById('pcwheel').style.display='block';
                parent.document.getElementById('pcwheel').src='//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn;
                }
                idon=true;
                //return null;
              }
            }
            if (!idon) {
            document.getElementById('cwheel').style.width='100%';
            document.getElementById('cwheel').style.height='800px';
            document.getElementById('cwheel').style.display='block';
            window.open('//www.rjmprogramming.com.au/HTMLCSS/colour_wheel.html?mode=' + tzpn, 'cwheel',); // 'top=50,left=50,width=600,height=600');
            document.getElementById('cwheel').scrollIntoView();
            }
            //thisris=ourp2;
          //}
        }
    } 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');
      if (navigator.userAgent.match(/iPhone|iPad/i)) {
            top.location.href='//www.rjmprogramming.com.au/PHP/Map/andthenon.php?andthen=' + encodeURIComponent('//maps.google.com/maps?z=' + numthing + '&t=' + mt + '&q=loc:' + olat + olong.replace('-',',-')); //, '_blank','top=50,left=450,width=700,height=600');
      } else {
            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)) )));
      }
      if (navigator.userAgent.match(/iPhone|iPad/i)) {
      //top.location.href='//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');
      document.getElementById('cdiv').innerHTML='<a id=mya href=#></a><iframe id=myiframe src=' + String.fromCharCode(34) + '//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' + String.fromCharCode(34) + ' width=450 height=450></iframe>';
      //window.open('//www.rjmprogramming.com.au/HTMLCSS/intair.php?num=' + numthing + '&lat=' + olat + '&long=' + olong, '_blank');
      //location.href='#amapid';
      } else {
      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)) )));
      }
      if (navigator.userAgent.match(/iPhone|iPad/i)) {
      top.location.href='//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 {
      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 {
      if (navigator.userAgent.match(/iPhone|iPad/i)) {
      top.location.href='//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 != '') {
    
      //if (typeof tdocumentURL === 'undefined') { 
      //  documentURL=documentURL;
      //} else if ((documentURL + 'file:').indexOf('file:') == 0) {
      //  documentURL=tdocumentURL;
      //} 
      
      var emb='', embe='';
      if (andthen.indexOf('&email') != -1) {
        emb='&email' + andthen.substring(andthen.indexOf('&email') + '&email'.length).split(',[')[0];
        var embee=emm.split('=');
        for (var ie=1; ie<embee.length; ie+=2) {
          embe+='&' + embee[eval(-1 + ie)].split('&')[eval(-1 + embee[eval(-1 + ie)].split('&').length)] + '=' + ourencodeURIComponent(embee[ie].split('&')[0]);
        }
  //if (documentURL.indexOf('rmetcalfe15') != -1) alert('here484 ' + embe);    
      }

    
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here ' + documentURL + ' ' + pardata);    
             if (documentURL.indexOf(pardata) != -1 && andthen.indexOf('&email') == -1) {
              locationhref=toolong(documentURL.replace(pardata, ourencodeURIComponent(andthen)));
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here1 ' + locationhref);    
              if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
             } else if (documentURL.indexOf('data=') != -1 && andthen.indexOf('&email') != -1) {
              var lmg=decodeURIComponent(documentURL.replace(emb,'').split('&data=')[1]);
              var vbn=documentURL.replace(emb,'').split('&data=')[0] + embe + '&data=' + lmg;
//if (documentURL.indexOf('rmetcalfe15') != -1) alert(vbn + ' ... ' + ourencodeURIComponent(('' + andthen.split('&')[0])));
              //locationhref=toolong(vbn.replace(vbn.split('data=')[1].split('&')[0], ourencodeURIComponent(('' + andthen.split('&')[0]))));
              locationhref=toolong(vbn.replace(vbn.split('data=')[1], ourencodeURIComponent(('' + andthen.replace(emb,'')))));
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here2 ' + locationhref);    
              if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
             } else if (documentURL.indexOf(pardata) != -1) {
              locationhref=toolong(documentURL.replace(pardata, ourencodeURIComponent(andthen)));
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here3 ' + locationhref);    
              if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
             } else if (documentURL.indexOf('data=') != -1) {
              //locationhref=toolong(documentURL.replace(documentURL.split('data=')[1].split('&')[0], ourencodeURIComponent(('' + andthen))));
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here4a ' + documentURL.split('data=')[1]);    
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here4b ' + ourencodeURIComponent(('' + andthen)));    
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here4c ' + documentURL.replace(documentURL.split('data=')[1], ourencodeURIComponent(('' + andthen))));    
              locationhref=toolong(documentURL.replace(documentURL.split('data=')[1], ourencodeURIComponent(('' + andthen))));
//if (documentURL.indexOf('rmetcalfe15') != -1) alert('here4 ' + locationhref);    
              if (locationhref != '#') { location.href=locationhref; } locationhref=''; 
             } 
    
             //if (document.URL.indexOf(pardata) != -1) {
      //location.href=document.URL.replace(pardata, ourencodeURIComponent(andthen));
             //} else if (document.URL.indexOf('data=') != -1) {
             // location.href=document.URL.replace(document.URL.split('data=')[1].split('&')[0], 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=\" dllb(); 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=\" dllb(); document.getElementById('myoptform').action=document.URL.split('#')[0]; brg_check_at_start(); \"> \n";
      }
      if ($amwv) {
      echo "<div id=idivis></div> <h1 id='myh1'>" . miniaturize(str_replace("+"," ", urldecode(urldecode(urldecode(urldecode($GETtitle))))),$GETdata) . " &#128205; Map <div id='dh1'></div></h1> \n";
      } else {
      echo "<div id=idivis></div> <h1 id='myh1'>" . miniaturize(str_replace("+"," ", urldecode(urldecode(urldecode(urldecode($GETtitle))))),$GETdata) . " Map <div id='dh1'></div></h1> \n";
      }

      echo $bdivstart . '<div id="chart_div" style="' . $bstyle . $cdivc . 'width: 400px; height: 300px;' . $opa . '" ontouchstart=" collectclick(event); " onmousedown=" collectclick(event); "></div>' . $bdivend . " \n";
      echo '<a id="amapid" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">Another</a> <a id="amapidgeo" title="Another Geo Map" style="text-decoration:underline;cursor:pointer;" onclick=gogeo("' . $https . 'www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php");>Geo</a> <a id="amapidtwo" title="Another Map" href="' . $https . 'www.rjmprogramming.com.au/PHP/Map/map.php">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 = "", fti=false, extra = ""; ' . "\n"; 
        echo ' var thisline = 1, gc_m="", gtitle="", glabel="", gvalue=""; ' . "\n";
        echo ' var ii = 0; ' . "\n";
        if ($dbval == "") { // && $options_suffix != "") {
        echo ' var c_m = " ", oneor="", thisdef = "0"; ' . "\n";
        } else {
        echo ' var c_m = "", oneor="", thisdef = "0"; ' . "\n";
        }
        echo ' gc_m=c_m; ' . "\n";
        echo ' var totalleft = 100.0; ' . "\n";

        echo ' var title = ourprompt("Enter Map Title (background image URL or image data URI ; separated (followed by ;) before title are options, and suffix by &iso=XX for XX as country code of interest and suffix by &lines=y for overlay clickable link lines and/or suffix by &onclick=y for all onclick functionalities such as &brgplace=[1] for Bearing Distance table and perhaps &brgmode=trip for that table in trip order). Email Attachment Title suffixes are &emailto=[emailTo] &emailsubject=[EmailSubject] ... ' . $promptsuffix . '", "' . str_replace("+"," ",urldecode($GETtitle)). '"); ' . "\n";
        echo ' gtitle=title; 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; gc_m=c_m  }  ' . "\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 ' glabel=label; 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 ' gvalue=value; ' . "\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 ' . " " . str_replace("+"," ",urldecode($GETtitle)) . ' Name' . " (can enter URL whose contents contains place,lat,long or your own list entered here comma separated) " . ' " + 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 ' . " " . str_replace("+"," ",urldecode($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))', foneor(thisdef)); oneor=''; " . "\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 > 800 || 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 (parent.document.getElementById('parmctd')) { if (parent.document.getElementById('parmctd').innerHTML.indexOf('<p>') == -1) { allowed=allowed; } else { if (parent.document.getElementById('wasurlgi')) { wasurlgi=parent.document.getElementById('wasurlgi').value; }   if (parent.document.getElementById('isurlgi')) { isurlgi=parent.document.getElementById('isurlgi').value; } allowed=false;  } } else { allowed=allowed; } \n";
        echo ' if (allowed) { var wl = toolong("./map.php?title=" + title + "&label=" + label + "&value=" + value.replace("  ercent ", "") + nojwinextra + "&custom_map=" + encodeURIComponent(jnocomm(c_m)) + "&data=" + datac);  if (wl != "#") { window.location=wl;  } }  ' . "\n";
        echo ' } else { ' . "\n";
        echo " if (parent.document.getElementById('parmctd')) { if (parent.document.getElementById('parmctd').innerHTML.indexOf('<p>') == -1) { allowed=allowed; } else { if (parent.document.getElementById('wasurlgi')) { wasurlgi=parent.document.getElementById('wasurlgi').value; }   if (parent.document.getElementById('isurlgi')) { isurlgi=parent.document.getElementById('isurlgi').value; } allowed=false;  } } else { allowed=allowed; } \n";
        echo ' if (allowed) { var wl = toolong("./map.php?title=" + title + "&label=" + label + "&value=" + value.replace("  ercent ", "") + nojwinextra + "&data=" + datac);  if (wl != "#") { window.location=wl;  } }  ' . "\n";
        echo ' } ' . "\n";
        }
        echo "} \n"; 
      } 
      echo "} \n" . '</' . 'script' . '>' . "\n";
    ?>
  <form style='display:none;' id='myoptform' method='POST' target='_self' action='map.php'><div id=divir></div><?php if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) { if ($dllwbits != '') { echo '<input type=hidden id=zdllwbits name=dllwbits value=></input>';  } if ($dlltbits != '') {  echo '<input type=hidden id=zdlltbits name=dlltbits value=></input>';  }  } 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'>
var cefalse=false;

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($_GET['data'])) { echo "\n cefalse=true; \n"; } if (isset($_POST['data'])) { echo "\n cefalse=true; \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>";
     //if (xansis.toLowerCase().indexOf('http') != -1) alert(xansis);
     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)) { 
 if (navigator.userAgent.match(/iPhone|iPad/i)) {
  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') { location.href=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,this.value,true,('' + this.id).replace('val',''));\" 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='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>"); 
 } else {
  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') { location.href=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,this.value,true,('' + this.id).replace('val',''));\" 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,this.value,false,('' + this.id + '00').replace('val',''));\" 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';
    }
    }
  }
}

function preclickforemail() {
<?php 
 if (isset($_POST['emailto'])) {
   if (strpos(urldecode($_POST['emailto']), '@') !== false) {
      if (isset($_POST['emailto'])) echo "\n if (document.getElementById('theto') && yesgo) { document.getElementById('theto').value='" . urldecode($_POST['emailto']) . "'; } \n";
      if (isset($_POST['emailsubject'])) echo "\n if (document.getElementById('thesubject') && yesgo) { document.getElementById('thesubject').innerHTML=\"" . urldecode($_POST['emailsubject']) . "\"; } \n";
      if (isset($_POST['emailcc'])) echo "\n if (document.getElementById('thecc') && yesgo) { document.getElementById('thecc').value='" . urldecode($_POST['emailcc']) . "'; } \n";
      if (isset($_POST['emailbcc'])) echo "\n if (document.getElementById('thebcc') && yesgo) { document.getElementById('thebcc').value='" . urldecode($_POST['emailbcc']) . "'; } \n";
    echo "\n 
    if (yesgo) {
    yesgo3='MAILTO:" . urldecode($_POST['emailto']) . "';
    nogo3='MAILTO:fillin.email@address';
    yesgo2='\"' + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0] + '/PHP/butsel.php';
    nogo2='\"//www.rjmprogramming.com.au';
    yesgo3='\"' + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0];
    nogo3='\"//www.rjmprogramming.com.au/PHP/butsel.php';
    yesgo4=\"'\" + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0];
    nogo4=\"'//www.rjmprogramming.com.au\";
    yesgo5='if (1 == 7 && (par' + 'ent.docu' + 'ment.URL.';
    nogo5='if ((pare' + 'nt.docu' + 'ment.URL.';
    if (document.getElementById('another')) {
    yesgo=document.getElementById('another').href=document.URL.split('#')[0].split('?')[0];
    nogo='./' + document.URL.split('#')[0].split('?')[0].split('/')[eval(-1 + document.URL.split('#')[0].split('?')[0].split('/').length)];
    }
    }
     \n ";
      echo "\n if (clicktheemail) { clicktheemail(); } else if (document.getElementById('thesemail')) { document.getElementById('thesemail').click(); } \n";
   }
 } else if (isset($_GET['emailto'])) {
   if (strpos(urldecode($_GET['emailto']), '@') !== false) {
      if (isset($_GET['emailto'])) echo "\n if (document.getElementById('theto') && yesgo) { document.getElementById('theto').value='" . urldecode($_GET['emailto']) . "'; } \n";
      if (isset($_GET['emailsubject'])) echo "\n if (document.getElementById('thesubject') && yesgo) { document.getElementById('thesubject').innerHTML=\"" . urldecode($_GET['emailsubject']) . "\"; } \n";
      if (isset($_GET['emailcc'])) echo "\n if (document.getElementById('thecc') && yesgo) { document.getElementById('thecc').value='" . urldecode($_GET['emailcc']) . "'; } \n";
      if (isset($_GET['emailbcc'])) echo "\n if (document.getElementById('thebcc') && yesgo) { document.getElementById('thebcc').value='" . urldecode($_GET['emailbcc']) . "'; } \n";
    echo "\n 
    if (yesgo) {
    yesgo3='MAILTO:" . urldecode($_GET['emailto']) . "';
    nogo3='MAILTO:fillin.email@address';
    yesgo2='\"' + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0] + '/PHP/butsel.php';
    nogo2='\"//www.rjmprogramming.com.au';
    yesgo3='\"' + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0];
    nogo3='\"//www.rjmprogramming.com.au/PHP/butsel.php';
    yesgo4=\"'\" + document.URL.split('#')[0].split('?')[0].substring(0,10) + document.URL.split('#')[0].split('?')[0].substring(10).split('/')[0];
    nogo4=\"'//www.rjmprogramming.com.au\";
    yesgo5='if (1 == 7 && (par' + 'ent.docu' + 'ment.URL.';
    nogo5='if ((pare' + 'nt.docu' + 'ment.URL.';
    if (document.getElementById('another')) {
    yesgo=document.getElementById('another').href=document.URL.split('#')[0].split('?')[0];
    nogo='./' + document.URL.split('#')[0].split('?')[0].split('/')[eval(-1 + document.URL.split('#')[0].split('?')[0].split('/').length)];
    }
    }
     \n ";
      //echo "\n if (clicktheemail) { clicktheemail(); } else if (document.getElementById('thesemail')) { document.getElementById('thesemail').click(); } \n";
   }
 }
?>
}

<?php 
 if (isset($_POST['emailto'])) {
   if (strpos(urldecode($_POST['emailto']), '@') !== false) {
     $redir='<meta http-equiv="refresh" content="0;url=" />';
     echo "\n if (document.URL.indexOf('&') != -1 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { redir='" . $redir . "'.replace('url=',(''+document.URL+'')); } \n";
     echo "\n setTimeout(preclickforemail,4000); \n";
   }
 } else if (isset($_GET['emailto'])) {
   if (strpos(urldecode($_GET['emailto']), '@') !== false) {
     $redir='<meta http-equiv="refresh" content="0;url=" />';
     echo "\n if (document.URL.indexOf('&') != -1 && navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { redir='" . $redir . "'.replace('url=',(''+document.URL+'')); } \n";
     echo "\n setTimeout(preclickforemail,4000); \n";
   }
 }
?>

function analyzep(inou) {
  var outou=inou;
  var lotsmore='', lpro='';
  var ifps=1, jfps=1, ebit='';
  var nameis='', ens, twos, newf='';
  var fps=parent.document.getElementsByTagName('form');
  var qqs=(''+document.URL+'').split('#')[0].split('?')[0]; // + '?';
  qs='?';
  for (ifps=0; ifps<eval('' + fps.length); ifps++) {
    if (fps[ifps].action.indexOf('ma' + 'p.php') != -1 && fps[ifps].method.toUpperCase().indexOf('POST') != -1) {
     ens=fps[ifps].innerHTML.split('<input');
     for (jfps=1; jfps<eval('' + ens.length); jfps++) {
     //alert('' + jfps + ' of ' + ens.length + ';' + ens[jfps].split('>')[0]+ ';' + ens[eval(1 + jfps)].split('>')[0]);
      if (ens[jfps].split('>')[0].indexOf('name=') != -1 && ens[jfps].split('>')[0].indexOf('value=') != -1) {
     //alert('' + jfps + ' of ' + ens.length + ':' + ens[jfps].split('>')[0]);
       nameis=ens[jfps].split('>')[0].split('name=')[1].substring(1).split(ens[jfps].split('>')[0].split('name=')[1].substring(0,1))[0];
     //alert(nameis);
       if (nameis.indexOf('data') == 0) {
       if (nameis == 'data') {
       fdata=ens[jfps].split('>')[0].split('value=')[1].substring(1).split(ens[jfps].split('>')[0].split('value=')[1].substring(0,1))[0];
   //alert(ens[jfps].split('>')[0].split('value=')[1].substring(1));
       if ((fdata.trim() + '  ').substring(0,2) != ',[') {


       fdata="<?php echo  str_replace('#@$!','\"', str_replace('"','" + String.fromCharCode(34) + "',  str_replace('\"','#@$!',   str_replace('#','%23',str_replace('&','%26',str_replace('?','%3f',urldecode($_POST['data']))))))); ?>";
       }
       //alert(fdata);
       } else {
       fdata0=ens[jfps].split('>')[0].split('value=')[1].substring(1).split(ens[jfps].split('>')[0].split('value=')[1].substring(0,1))[0];
       if ((fdata0.trim() + '  ').substring(0,2) != ',[') {
       fdata0="<?php echo str_replace('#@$!','\"', str_replace('"','" + String.fromCharCode(34) + "',  str_replace('\"','#@$!',   str_replace('#','%23',str_replace('&','%26',str_replace('?','%3f',urldecode($_POST['data0']))))))); ?>";

       }
       }
       qs+=nameis + '=' + '' + '&';
       } else if (nameis.indexOf("wouldlikeyoutoseekpermission") == -1) {
       qs+=nameis + '=' + encodeURIComponent(ens[jfps].split('>')[0].split('value=')[1].substring(1).split(ens[jfps].split('>')[0].split('value=')[1].substring(0,1))[0]) + '&';
       }
      //} else {
      // alert('bad ... ' + ens[jfps].split('>')[0]);
      }
     }
     //if (outou.indexOf('>Anot' + 'her Map') != -1) alert('found1');
     //if (outou.indexOf('?nojwi' + 'n=Y">Anothe' + 'r Map') != -1) alert('found2');
     //if (outou.indexOf('.php">Anot' + 'her Map') != -1) alert('found3');
     if (1 == 2 && outou.indexOf('?nojwi' + 'n=Y">Anoth' + 'er Map') != -1) {
     //alert(34);
     ebit='nojwin=Y">An' + 'other Map' + outou.split('?nojwin=Y">An' + 'other Map')[1];
     //alert(341);
     outou=outou.split('?nojwin=Y">Ano' + 'ther Map')[0] + qs.substring(0,eval(-1 + qs.length)).replace('nojwin=','jknonkjwin=') + ebit;
     //alert(342);
     } else if (1 == 2 && outou.indexOf('.php">Anot' + 'her Map') != -1) {
     //alert(346);
     //alert(outou.length);
     //alert(outou.split('.php">Anot' + 'her Map').length);
     ebit='">Anot' + 'her Map' + outou.split('.php">Anot' + 'her Map')[1];
     //alert(qs);
     outou=outou.split('.php">Anot' + 'her Map')[0] + '.php' + qs.substring(0,eval(-1 + qs.length)).replace('nojwin=','jknonkjwin=') + ebit;
     //alert(347);
     }
     var dbits=fdata.split(',[');
     var mpro=1, kpro=0, llpres,llrest, xfound="";
     if (dbits.length > 2) {
       for (kpro=1; kpro<dbits.length; kpro++) {
         if (lpro == '') lpro=qqs + qs;
         llpres=dbits[kpro].split(',');
         lpro=lpro.replace('&data=','&data=' + encodeURIComponent(',[') + encodeURIComponent(llpres[0]) + ',' + encodeURIComponent(llpres[1]) + ',' + encodeURIComponent(dbits[kpro].substring((llpres[0] + ',' + llpres[1] + ',').length)).replace(/\-/g,'%' + '2d').replace(/\#/g,'%' + '23'));
         //if (mpro == 52 && dbits[kpro].indexOf(',PAONIA,DELTA') != -1) {
         //  xfound=(encodeURIComponent(',[') + encodeURIComponent(llpres[0]) + ',' + encodeURIComponent(llpres[1]) + ',' + encodeURIComponent(dbits[kpro].substring((llpres[0] + ',' + llpres[1] + ',').length)).replace(/\-/g,'%' + '2d').replace(/\#/g,'%' + '23'));
           //alert(lpro);
         //}
         if (lpro.length > 700) {
           //if (xfound != "") {
           //  alert(lpro);
           //  xfound="";
           //}
           lotsmore+='<a id="amapid' + mpro + '" title="Another Map ' + mpro + '" href="' + (lpro + '"').replace('&"','"') + '>Locations ' + mpro + '</a> ';
           mpro++;
           lpro='';
         }
       }
       if (lpro != '') lotsmore+='<a id="amapid' + mpro + '" title="Another Map ' + mpro + '" href="' + (lpro + '"').replace('&"','"') + '>Locations ' + mpro + '</a> ';
       lpro='';
     } else {
       lotsmore+='<a id="amapid1" title="Another Map 1" href="' + (qqs + qs.replace('&data=&', '&data=' + encodeURIComponent(fdata) + '&')).replace('&"','"') + '">Locations 1 of 1</a> ';
     }
     if (lotsmore != '') {
     var xlots=lotsmore;
     if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
       lotsmore='<br><details id=dlocs open><summary>Partial Data Sets for No Pins Showing</summary>' + xlots + '</details><br>';
     } else {
       lotsmore='<br><details id=dlocs><summary>Partial Data Sets in Case No Pins Showing</summary>' + xlots + '</details><br>';
     }
     }
     twos=fps[ifps].outerHTML.split(' onsubmit="');
     if (twos.length == 2) {
     newf=(twos[0] + twos[1].replace(twos[1].split('"')[0] + '"',' '));
     twos=newf.split(' target="');
     if (twos.length == 2) {
     outou=outou.replace("Anot" + "her Map?</a>","Anot" + "her Map</a> " + lotsmore + (twos[0] + twos[1].replace(twos[1].split('"')[0] + '"',' ')).replace(' target=',' data-target=').replace(' onsubmit=',' data-onsubmit=').replace(' value="" ', ' value="<?php echo urlencode($_POST['data']); ?>" ').replace('none;','inline;').replace('none;','inline;').replace(' action="//', ' action="https://').replace(' value="Show"',' value="If No Pins?"').replace(/emailto/g,'emailWasTo')); //.replace('>',' target="_self">'));
     } else {
     outou=outou.replace("Anot" + "her Map?</a>","Anot" + "her Map</a> " + lotsmore + newf.replace(' target=',' data-target=').replace(' onsubmit=',' data-onsubmit=').replace(' value="" ', ' value="<?php echo urlencode($_POST['data']); ?>" ').replace('none;','inline;').replace('none;','inline;').replace(' action="//', ' action="https://').replace(' value="Show"',' value="If No Pins?"').replace(/emailto/g,'emailWasTo')); //.replace('>',' target="_self">'));
     }
     } else {
     outou=outou.replace("Anot" + "her Map?</a>","Anot" + "her Map</a> " + lotsmore + fps[ifps].outerHTML.replace(' target=',' data-target=').replace(' onsubmit=',' data-onsubmit=').replace(' value="" ', ' value="<?php echo urlencode($_POST['data']); ?>" ').replace('none;','inline;').replace('none;','inline;').replace(' action="//', ' action="https://').replace(' value="Show"',' value="If No Pins?"').replace(/emailto/g,'emailWasTo')); //.replace('>',' target="_self">'));
     }
     //alert(outou.split("Anot" + "her Map")[1].substring(0,900));
    }
  }
  return outou;
}

function makeab(inh) {
  var outh=inh;
  var uide=["ww" + "w.","ma" + "ps.","ic" + "ons.","go" + "ogle.","yo" + "utube."];
<?php
  if ((isset($_GET['data']) || isset($_POST['data'])) && (isset($_GET['emailto']) || isset($_POST['emailto']))) {
    echo "\n outh=outh.replace('var documentURL=\"\"', 'var documentURL=\"' + documentURL + '\"'); \n";
  }
?>
  for (var iuyt=0; iuyt<uide.length; iuyt++) {
  while (outh.indexOf("if ((parent.do" + "cument.URL.") != -1) {
    outh=outh.replace("if ((parent.do" + "cument.URL.","if (1 == 6 && (parent.do" + "cument.URL.");
  }
  while (outh.indexOf("ourencodeURIComponent(paramdata)).replace(") != -1) {
    outh=outh.replace("ourencodeURIComponent(paramdata)).replace(","ourencodeURIComponent(paramdata) ).replace('file:','http:').replace(");
  }
  while (outh.indexOf("if ('int" + "air' == 'int" + "air'") != -1) {
    outh=outh.replace("if ('int" + "air' == 'int" + "air'","if ('int" + "air' != 'int" + "air'");
  }
  while (outh.indexOf("'//" + uide[iuyt]) != -1) {
    outh=outh.replace("'//" + uide[iuyt],"'http://" + uide[iuyt]);
  }
  while (outh.indexOf('"//' + uide[iuyt]) != -1) {
    outh=outh.replace('"//' + uide[iuyt],'"http://' + uide[iuyt]);
  }
  if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
  while (outh.indexOf('ht' + 'tp:') != -1) {
    outh=outh.replace('ht' + 'tp:','ht' + 'tps:');
  }
  if (document.URL.indexOf('&') != -1) {
  outh=outh.replace(" dllb(); "," location.href='"+document.URL+"'; dllb(); ");
  }
  }
  }
  if (document.URL.indexOf('&') != -1) {
  outh=outh.replace("Anot" + "her Map?","Anot" + "her Map</a> <a title=ThisLive href=\""+document.URL+"\">If No Pins?");
  } else if (111 == 111 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
<?php 
  if (isset($_POST['data'])) {
  echo "\n if (1 == 1) { outh=analyzep(outh); } \n";
  }
?>
  }
  return outh;
}

<?php
   $goodlat=explode(",",explode("[",$GETdata)[1])[0]; // ",[37.4232, -122.0853, 'Work']
   $goodlong=explode(",",explode("[",$GETdata)[1])[1]; // ",[37.4232, -122.0853, 'Work']
   echo "\n function check_partd_pargi() {
     var tf=10000, doitd=false;
     if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
        tf=11000;
     }
     if (parent.document) {
      if (parent.document.getElementById('partd') && parent.document.getElementById('pargi')) {
       if (wasurlgi == '') {
        wasurlgi=parent.document.getElementById('pargi').src;
        // https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title= Denmark&amp;onclick=y&amp;width=298&amp;height=194&amp;country=Country&amp;popularity=Intensity&amp;guess=&amp;data=%20[~dk~,66]%20
        var preis=wasurlgi.split('data=')[0].replace('title=%20','title=').replace('title= ','title=');
        isurlgi=(preis + 'data=' + '%20[" . $goodlat . "|" . $goodlong . "|~' + preis.split('title=')[1].split('&')[0].trim() + '~,66]%20').replace('?','?aregeographicals=' + 'http.' + preis.split('title=')[1].split('&')[0].trim().replace(/\%20/g,'_') + '&peninfo=" . $justnumber . "_' + preis.split('title=')[1].split('&')[0].trim().replace(/\%20/g,'_') + '&').replace('popularity=Intensity','popularity=');
        if (parent.document.getElementById('pargialt')) {
        parent.document.getElementById('pargialt').src=isurlgi;
        } else {
        parent.document.getElementById('pargi').src=isurlgi;
        }
        setTimeout(check_partd_pargi, tf);
       } else if (parent.document.getElementById('pargi').src.indexOf('aregeographicals=') == -1) {
        parent.document.getElementById('pargi').src=isurlgi + '&rand=' + Math.floor(Math.random() * 23456);
        setTimeout(check_partd_pargi, tf);
       } else {
        parent.document.getElementById('pargi').src=wasurlgi + '&rand=' + Math.floor(Math.random() * 23456);
        setTimeout(check_partd_pargi, tf);
       }
      }
     }
        if (parent.document) {
        if (parent.document.getElementById('parmctd')) {
        if (!parent.document.getElementById('isurlgi') && !parent.document.getElementById('wasurlgi') && isurlgi != '' && wasurlgi != '') {
                parent.document.getElementById('parmctd').innerHTML+='<input type=hidden id=wasurlgi value=\"' + wasurlgi + '\"></input><input type=hidden id=isurlgi value=\"' + isurlgi + '\"></input>';
        } else if (parent.document.getElementById('isurlgi') && parent.document.getElementById('wasurlgi') && isurlgi != '' && wasurlgi != '') {
                parent.document.getElementById('isurlgi')=isurlgi;
                parent.document.getElementById('wasurlgi')=wasurlgi;
        }
        }
        }
   } \n";

 if ($justnumber != "") {
   echo "\n  setTimeout(check_partd_pargi, 4000);   \n";
 }
?>

</script>
<div id="thedivemail"><form target=theiemail onsubmit=" if (document.getElementById('theto').value.indexOf('@') == -1) {  return false; } else {  if (document.getElementById('thesubject').value == '') { document.getElementById('thesubject').value='Google Charts Map Chart via RJM Programming';    }  document.getElementById('thehtml').value=('<!DOCTYPE HTML PUBLIC ' + String.fromCharCode(34) + '-//W3C//DTD HTML 4.0 Transitional//EN' + String.fromCharCode(34) + '><html><head>' + redir + makeab(document.head.innerHTML) + '</head>' + makeab(makeright(document.body.outerHTML.split('<div id=' + String.fromCharCode(34) + 'thedi' + 'vemail' + String.fromCharCode(34) + '>')[0]).replace(nogo,yesgo).replace(nogo2,yesgo2).replace(nogo3,yesgo3).replace(nogo4,yesgo4).replace(nogo5,yesgo5).replace(nogo6,yesgo6)) + '</body></html>').replace(/\+/g,'%2b');  return true; }" style='display:none;' id=theformemail method=POST action=../webviewemail.php> 
<input type=hidden name=theto id=theto value='<?php if (isset($_POST['emailto'])) {  echo urldecode($_POST['emailto']);   } else if (isset($_GET['emailto'])) {  echo urldecode($_GET['emailto']);  } ?>'></input> 
<input type=hidden name=thecc id=thecc value='<?php if (isset($_POST['emailcc'])) {  echo urldecode($_POST['emailcc']);   } else if (isset($_GET['emailcc'])) {  echo urldecode($_GET['emailcc']);  } ?>'></input> 
<input type=hidden name=thebcc id=thebcc value='<?php if (isset($_POST['emailbcc'])) {  echo urldecode($_POST['emailbcc']);   } else if (isset($_GET['emailbcc'])) {  echo urldecode($_GET['emailbcc']);  } ?>'></input> 
<textarea style='display:none;' cols=120 rows=2 value='' name=thesubject id=thesubject><?php if (isset($_POST['emailsubject'])) {  echo urldecode($_POST['emailsubject']);   } else if (isset($_GET['emailsubject'])) {  echo urldecode($_GET['emailsubject']);  } ?></textarea> 
<textarea style='display:none;' cols=120 rows=2 value='' name=thehtml id=thehtml></textarea> 
<input type=submit id='thesemail' style='display:none;' value=Email></input>
</form><br><input type=text readonly=readonly id=theemail value='' style='display:none;width:50%;'></input>
<iframe name=theiemail id=theiemail style='display:none;' src='../webviewemail.php'></iframe>
<?php if (isset($_POST['emailto']) || isset($_GET['emailto'])) {  echo "<scr" . "ipt type='text/javascript'> setTimeout(clicktheemail,3000); </scr" . "ipt>";   } ?>
</div>
<iframe name=cwheel id=cwheel style='display:none;' src=></iframe>
</body>
</html>
