<?php
// intair.php
// RJM Programming
// April, 2016
// International Airport database via http://www.partow.net/miscellaneous/airportdatabase/ ... thanks
//AYGA:GKA:GOROKA:GOROKA:PAPUA NEW GUINEA:06:04:54:S:145:23:30:E:5282
//AYLA:LAE::LAE:PAPUA NEW GUINEA:00:00:00:U:00:00:00:U:0000
//AYMD:MAG:MADANG:MADANG:PAPUA NEW GUINEA:05:12:25:S:145:47:19:E:0020
//AYMH:HGU:MOUNT HAGEN:MOUNT HAGEN:PAPUA NEW GUINEA:05:49:34:S:144:17:46:E:5388
//AYNZ:LAE:NADZAB:NADZAB:PAPUA NEW GUINEA:06:34:11:S:146:43:34:E:0239
//AYPY:POM:PORT MORESBY JACKSONS INTERNATIONAL:PORT MORESBY:PAPUA NEW GUINEA:09:26:36:S:147:13:12:E:0146
//
// or ...
//
// Ports database via https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_10m_ports.geojson ... thanks
// {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"scalerank":8,"name":"Sint Nicolaas","website":"www.rocargo.com/SanNicolas.html","natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-69.92355713,12.4375]}},
// {"type":"Feature","properties":{"scalerank":8,"name":"Campana","website":"www.consejoportuario.com.ar","natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-58.95141343,-34.15333333]}},
// {"type":"Feature","properties":{"scalerank":8,"name":"Zarate","website":"www.consejoportuario.com.ar","natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-59.004947,-34.09888889]}},
// {"type":"Feature","properties":{"scalerank":8,"name":"Puerto Belgrano/Bahia Blanca","website":null,"natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-62.10088339,-38.89444444]}},
// {"type":"Feature","properties":{"scalerank":8,"name":"Puerto Galvan/Bahia Blanca","website":null,"natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-62.30053004,-38.78305556]}},

$murl="";
$anticprefix="youllneverfindthis"; // " Clickaround";
$cprefix=""; // " Clickaround";
$csuffix="<select "; 
$wprefix=" or <br>So where is? ... ";
$wiprefix="";
$promptclobber="";
$wisc="world";
if (strpos($_SERVER['HTTP_REFERER'], "welcometonation.htm") !== false) {
  $wprefix=" or <br>So where is?";
  $wisc="welcometonation";
}


$isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad');
if ($isiPad === false) {
  $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPhone');
}
if ($isiPad === false) {
  $isiPad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'Android');
}
if ($isiPad) {
  $wprefix="";
  $wiprefix="Where? style=width:50px";
  $anticprefix=" Clickaround";
  $promptclobber=""; 
}


$gprefix="http://www.rjmprogramming.com.au/HTMLCSS/" . $wisc . ".html?lat=0000.0&long=0000.0&name=%20&lat2=0000.0&long2=0000.0&name2=%20&lat3=0000.0&long3=0000.0&name3=%20&lat4=0000.0&long4=0000.0&name4=%20&lat5=0000.0&long5=0000.0&name5=%20&lat6=0000.0&long6=0000.0&name6=%20&lat7=0000.0&long7=0000.0&name7=%20&lat8=0000.0&long8=0000.0&name8=%20&lat9=0000.0&long9=0000.0&name9=%20&lat10=0000.0&long10=0000.0&name10=&nothing=";

$alat = 0.0;
$along = 0.0;
$proposed = "<html><head><script type='text/javascript'>    </script></head><body></body></html>";
$prefix = "%20Airport";
if (isset($_GET['port'])) {
$prefix = "%20Port";
}
$num = 3;
if (isset($_GET['num'])) $num = $_GET['num'];

function lastlook($pis) {
  global $cprefix, $anticprefix, $csuffix;
  if (strlen($_SERVER['QUERY_STRING']) == 0 || 2 == 2) {
    return str_replace($anticprefix, "", str_replace("</script>", "\n  var iss=' " . $cprefix . $wprefix . "<input title=\"Place name or latitude;longitude;name\" onblur=\"' + \" if (this.value.indexOf(';') != -1) {  parent.document.getElementById('siswi').innerHTML+='<option value=' + String.fromCharCode(34) + '' + String.fromCharCode(34) + '>Please select last value below ...</option><option value=' + String.fromCharCode(34) + this.value + String.fromCharCode(34) + '>' + this.value + '</option>';  parent.document.getElementById('siswi').value=''; if (1 == 2) { parent.document.getElementById('siswi').value=this.value; }   } else if (this.value.indexOf(';') != -1) {  parent.document.getElementById('siswi').innerHTML+='<option value=' + String.fromCharCode(34) + this.value + String.fromCharCode(34) + '></option>'; parent.document.getElementById('siswi').value=this.value;   } else if (this.value != '') { parent.document.getElementById('mypiframe').src='intair.php?sofar=' + encodeURIComponent(this.value.replace(.replace('Where?','')); } \" + '\" type=text onclick=this.value=\"\" id=iswi value=" . $wiprefix . "></input><select id=siswi onchange=\"document.getElementById(' + \"'myiframe'\" + ').style.opacity=0.5;  document.getElementById(' + \"'myiframe'\" + ').onclick=' + \"function() { this.style.opacity=1.0; } \" + ';   document.getElementById(' + \"'iswi'\" + ').value=this.value; var lls=this.value.split(' + \"';'\" + '); var ourp=document.getElementById(' + \"'iprefix'\" + ').value; var newp=ourp;  newp=newp.replace(' + \"'0000.0'\" + ',lls[0]);   newp=newp.replace(' + \"'0000.0'\" + ',lls[1]);   newp=newp.replace(' + \"'=%20'\" + ',' + \"'=' + lls[2]);    document.getElementById(\" + \"'iprefix'\" + ').value=newp;   window.open(newp,' + \"'_blank','top=20,left=20,width=950,height=850'\" + \"); newp=newp.replace('welcometonation','world'); \" + '   document.getElementById(' + \"'iiswi'\" + ').src=newp;     document.getElementById(' + \"'iiswi'\" + ').style.display=' + \"'block'\" + ';    \"></select><div id=diswi><input type=hidden id=iprefix value=" . $gprefix . "></input><iframe id=iiswi style=display:none src=></iframe></div> " . $csuffix . "';  if (parent.document.getElementById('mya')) {  if (!parent.document.getElementById('diswi')) {     parent.document.getElementById('mya').innerHTML='';   var hones=parent.document.getElementsByTagName('h1');  if (hones.length != 0) {  if (hones[0].innerHTML.indexOf('" . $cprefix . $csuffix . "') != -1) {  hones[0].innerHTML=hones[0].innerHTML.replace('" . $cprefix . $csuffix . "',iss.replace('xq',encodeURIComponent(this.value)));   } } } } \n </script> ", $pis));
  }
  return $pis;
}

function pre_great_circle_nodistance($ptalis, $pgnolis, $one, $two, $three, $four, $five, $six, $seven, $eight, $sanity) {
  global $alat;
  global $along;
  $alat = ($one + ($two / 60.00) + ($three / 3600.0));
  $along = ($five + ($six / 60.00) + ($seven / 3600.0));
  if ($one == 0 && $two == 0 && $three == 0 && $five == 0 && $six == 0 && $seven == 0) {
    return 0.0;
  } else {
    //echo "*" . $sanity . "+++" . $four . "---" . $eight . "*";
    if ($four == "S" && $eight == "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0));
    if ($four == "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0));
    if ($four != "S" && $eight == "U") $alat = ($one + ($two / 60.00) + ($three / 3600.0));
    if ($four != "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0));
    if ($four == "S" && $eight != "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0));
    if ($four == "S" && $eight != "U") $along = ($five + ($six / 60.00) + ($seven / 3600.0));
    return 0.0;
  }
}

function pre_great_circle_distance($ptalis, $pgnolis, $one, $two, $three, $four, $five, $six, $seven, $eight, $sanity) {
  global $alat;
  global $along;
  $alat = ($one + ($two / 60.00) + ($three / 3600.0));
  $along = ($five + ($six / 60.00) + ($seven / 3600.0));
  if ($one == 0 && $two == 0 && $three == 0 && $five == 0 && $six == 0 && $seven == 0) {
    return -9.0;
  } else {
    //echo "*" . $sanity . "+++" . $four . "---" . $eight . "*";
    if ($four == "S" && $eight == "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0));
    if ($four == "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0));
    if ($four != "S" && $eight == "U") $alat = ($one + ($two / 60.00) + ($three / 3600.0));
    if ($four != "S" && $eight == "U") $along = -($five + ($six / 60.00) + ($seven / 3600.0));
    if ($four == "S" && $eight != "U") $alat = -($one + ($two / 60.00) + ($three / 3600.0));
    if ($four == "S" && $eight != "U") $along = ($five + ($six / 60.00) + ($seven / 3600.0));
    return great_circle_distance($ptalis, $pgnolis, $alat, $along);
  }
}

function great_circle_distance($talis, $gnolis, $latis, $longis) {
  $ourdist=0.0;
  $rgnol=(($gnolis) * pi() / 180.0);
  $rtal=(($talis) * pi() / 180.0);
  $rlong=(($longis) * pi() / 180.0);
  $rlat=(($latis) * pi() / 180.0);
  
    
  $deltalong = abs(((($gnolis)-($longis)) * pi() / 180.0));

  
  $acof = (sin($rtal) * sin($rlat)) + (cos($rtal) * cos($rlat) * cos($deltalong)); // via http://en.wikipedia.org/wiki/Great-circle_distance ... thanks
  
  $ourdist = (round((acos($acof) * 6371000.0) + 0.00001) * 100) / 100;
  return $ourdist;
}

$postproposed='';
$postrecs='';
$nsf = -9.0;
$name = "";
$glat = 0.0;
$glong = 0.0;
$mindist = -9.0;
if (isset($_GET['lat']) && isset($_GET['long'])) {
 //{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"scalerank":8,"name":"Sint Nicolaas","website":"www.rocargo.com/SanNicolas.html","natlscale":5,"featureclass":"Port"}
 //,"geometry":{"type":"Point","coordinates":[-69.92355713,12.4375]}},
 //{"type":"Feature","properties":{"scalerank":8,"name":"Campana","website":"www.consejoportuario.com.ar","natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-58.95141343,-34.15333333]}},
 // {"type":"Feature","properties":{"scalerank":8,"name":"Zarate","website":"www.consejoportuario.com.ar","natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-59.004947,-34.09888889]}},
 // {"type":"Feature","properties":{"scalerank":8,"name":"Puerto Belgrano/Bahia Blanca","website":null,"natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-62.10088339,-38.89444444]}},
 // {"type":"Feature","properties":{"scalerank":8,"name":"Puerto Galvan/Bahia Blanca","website":null,"natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-62.30053004,-38.78305556]}},
 // {"type":"Feature","properties":{"scalerank":8,"name":"Ingeniero White/Bahia Blanca","website":null,"natlscale":5,"featureclass":"Port"},"geometry":{"type":"Point","coordinates":[-62.25989399,-38.79194444]}},
 
 if (isset($_GET['port'])) {
 if ($_GET['port'] == "air") {
 $postproposed=@file_get_contents(explode("intair.php", str_replace("::",":","http://" . $_SERVER['SERVER_NAME'] . ":" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~"))))) . "" . $_SERVER['REQUEST_URI'])[0] . "intair.php?num=" . $num . "&lat=" . $_GET['lat'] . "&long=" . $_GET['long']);
 $recs=explode("parent.document.getElementById('myiframe').src=parent.document.getElementById('myiframe').src", $postproposed);
 for ($ir=1; $ir<sizeof($recs); $ir++) {
   $postrecs.="\n parent.document.getElementById('myiframe').src=parent.document.getElementById('myiframe').src" . explode(';', $recs[$ir])[0] . "; \n";
 }
 }
 $adb = @file_get_contents("GlobalAirportDatabase/ports.geojson");
 $cols = explode("]}}", $adb);
 for ($j=0; $j<$num; $j++) {
 for ($i=0; $i<(-1 + sizeof($cols)); $i++) {
   $distis = great_circle_distance($_GET['lat'], $_GET['long'], explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0], explode(',', explode(':[', $cols[$i])[1])[0]);
   if ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf)) {
    $nsf = $distis;
    $name = explode('"', explode(',"name":"', $cols[$i])[1])[0]; //$cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0];
    $glong = explode(',', explode(':[', $cols[$i])[1])[0];
 //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n";
  }
 }
 if ($glat != 0.0 || $glong != 0.0) {
   if (isset($_GET['spawn'])) {
     if ($murl == "") $murl=$_GET['spawn'];
     $murl.=",[" . round($glat, 4) . "," . round($glong, 4) . ",~Nearest" . $prefix . "%20on%20geojson.xyz%20ports%20" . round($nsf / 1000.0) . "km%20to%20" . str_replace("'","`",$name) . "~]";
   } 
   $proposed = str_replace("</script>", $postrecs . "\n parent.document.getElementById('myiframe').src=parent.document.getElementById('myiframe').src + ',[" . round($glat, 4) . "," . round($glong, 4) . ",~Nearest" . $prefix . "%20on%20geojson.xyz%20ports%20" . round($nsf / 1000.0) . "km%20to%20" . urlencode(str_replace("'","`",$name)) . "~]';   \n" . "</script>", $proposed);
   $prefix = (str_replace("%20Airport", "", $prefix) . "-");
   $mindist = $nsf;
   $nsf = -9.0;
   $name = "";
   $glat = 0.0;
   $glong = 0.0;
   $distis = 0.0;
 }
 }
 } else {
 $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt");
 $cols = explode(":", "0000 " . $adb);
 for ($j=0; $j<$num; $j++) {
 for ($i=0; $i<sizeof($cols); $i+=13) {
  if (sizeof($cols) >= 12) {
   $distis = pre_great_circle_distance($_GET['lat'], $_GET['long'], $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]);
   if ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf)) {
    $nsf = $distis;
    $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = $alat;
    $glong = $along;
 //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n";
   }
  }
 }
 if ($glat != 0.0 || $glong != 0.0) {
   if (isset($_GET['spawn'])) {
     if ($murl == "") $murl=$_GET['spawn'];
     $murl.=",[" . round($glat, 4) . "," . round($glong, 4) . ",~Nearest" . $prefix . "%20on%20GlobalAirportDatabase%20" . round($nsf / 1000.0) . "km%20to%20" . str_replace("'","`",$name) . "~]";
   } 
   $proposed = str_replace("</script>", "\n parent.document.getElementById('myiframe').src=parent.document.getElementById('myiframe').src + ',[" . round($glat, 4) . "," . round($glong, 4) . ",~Nearest" . $prefix . "%20on%20GlobalAirportDatabase%20" . round($nsf / 1000.0) . "km%20to%20" . str_replace("'","`",$name) . "~]';   \n" . "</script>", $proposed);
   $prefix = (str_replace("%20Airport", "", $prefix) . "-");
   $mindist = $nsf;
   $nsf = -9.0;
   $name = "";
   $glat = 0.0;
   $glong = 0.0;
   $distis = 0.0;
 }
 }
}

 if ($murl != "") {
 header("Location: " . $murl);
 } else {
 echo lastlook($proposed);
 }
} else if (isset($_GET['plot']) && 1 == 2) {
 if (isset($_GET['port'])) {
 $adb = @file_get_contents("GlobalAirportDatabase/ports.geojson");
 $cols = explode("]}}", $adb);
 for ($j=0; $j<$num; $j++) {
 for ($i=0; $i<(-1 + sizeof($cols)); $i++) {
   $distis = great_circle_distance($_GET['lat'], $_GET['long'], explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0], explode(',', explode(':[', $cols[$i])[1])[0]);
   if ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf)) {
    $nsf = $distis;
    $name = explode('"', explode(',"name":"', $cols[$i])[1])[0]; //$cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0];
    $glong = explode(',', explode(':[', $cols[$i])[1])[0];
    $proposed = str_replace("</script>", "\n parent.document.getElementById('mya').title='" . $glat . "," . $glong . "'; parent.document.getElementById('mya').click();   \n" . "</script>", $proposed);
   }
   echo lastlook($proposed);
 }
 }
 } else {
 $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt");
 $cols = explode(":", "0000 " . $adb);
 for ($i=0; $i<sizeof($cols); $i+=13) {
  if (sizeof($cols) >= 12) {
   $distis = pre_great_circle_distance($_GET['lat'], $_GET['long'], $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]);
   if ($distis >= 0.0 && ($nsf < 0.0 || $distis < $nsf)) {
    //$nsf = $distis;
    $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = $alat;
    $glong = $along;
    $proposed = str_replace("</script>", "\n parent.document.getElementById('mya').title='" . $glat . "," . $glong . "'; parent.document.getElementById('mya').click();   \n" . "</script>", $proposed);
   }
   echo lastlook($proposed);
  }
 }
 }
} else if (isset($_GET['sofar']) && 1 == 1) {
 $sih="";
 $fnum=0;
 if (isset($_GET['port'])) {
 $adb = @file_get_contents("GlobalAirportDatabase/ports.geojson");
 $cols = explode("]}}", $adb);
 //for ($j=0; $j<$num; $j++) {
 for ($i=0; $i<(-1 + sizeof($cols)); $i++) {
  //if (sizeof($cols) >= 12) {
   $distis = great_circle_distance($_GET['lat'], $_GET['long'], explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0], explode(',', explode(':[', $cols[$i])[1])[0]);
   if (1 == 1 || ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf))) {
    $nsf = $distis;
    $name = explode('"', explode(',"name":"', $cols[$i])[1])[0]; //$cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = explode(']', explode(',', explode(':[', $cols[$i])[1])[1])[0];
    $glong = explode(',', explode(':[', $cols[$i])[1])[0];
 //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n";
    if ($alat != 0.0 || $along != 0.0) {
      $fnum++;
      if ($fnum == 2) $sih=str_replace("Found this ...", "Found these ...", $sih);
      if ($sih == "") $sih="<option value=>Found this ...</option>";
      $sih .= '<option value="' . $alat . ';' . $along . ';' . str_replace("'","`",$cols[$i + 3]) . '">' . str_replace("'","`",$name) . ' (' . $alat . ',' . $along . ')</option>';
    }
   }
  //}
 } 
 } else {
 
 $adb = @file_get_contents("GlobalAirportDatabase/GlobalAirportDatabase.txt");
 $cols = explode(":", "0000 " . $adb);
 //for ($j=0; $j<$num; $j++) {
 for ($i=0; $i<sizeof($cols); $i+=13) {
  if (sizeof($cols) >= 12) {
   $distis = pre_great_circle_nodistance(0.0, 0.0, $cols[$i + 5], $cols[$i + 6], $cols[$i + 7], $cols[$i + 8], $cols[$i + 9], $cols[$i + 10], $cols[$i + 11], $cols[$i + 12], $cols[$i + 0]);
   if (1 == 1 || ($distis >= 0.0 && $distis > $mindist && ($nsf < 0.0 || $distis < $nsf))) {
    $nsf = $distis;
    $name = $cols[$i + 1] . "/" . $cols[$i + 2] . "/" . $cols[$i + 3] . "/" . $cols[$i + 4];
    $glat = $alat;
    $glong = $along;
 //echo $name . " " , $glat . " " . $glong . " " . $nsf . "\n";
    if ($alat != 0.0 || $along != 0.0) {
    if (strpos(("/" . strtoupper($name)), "/" . strtoupper(urldecode($_GET['sofar']))) !== false) {
      $fnum++;
      if ($fnum == 2) $sih=str_replace("Found this ...", "Found these ...", $sih);
      if ($sih == "") $sih="<option value=>Found this ...</option>";
      $sih .= '<option value="' . $alat . ';' . $along . ';' . str_replace("'","`",$cols[$i + 3]) . '">' . str_replace("'","`",$name) . ' (' . $alat . ',' . $along . ')</option>';
    } else if (strpos(("" . strtoupper($name)), strtoupper(urldecode($_GET['sofar']))) !== false && strlen(urldecode($_GET['sofar'])) >= 4) {
      $fnum++;
      if ($fnum == 2) $sih=str_replace("Found this ...", "Found these ...", $sih);
      if ($sih == "") $sih="<option value=>Found this ...</option>";
      $sih .= '<option value="' . $alat . ';' . $along . ';' . str_replace("'","`",$cols[$i + 3]) . '">' . str_replace("'","`",$name) . ' (' . $alat . ',' . $along . ')</option>';
    }
    }
   }
  }
 }
 
 
 }
 //}
 echo "<!doctype html><html><head><script type='text/javascript'>  if (parent.document.getElementById('mya')) { if (parent.document.getElementById('diswi')) {  parent.document.getElementById('siswi').innerHTML='" . $sih . "';   } }  </script></head><body></body></html>";
} else if (5 == 5) {
 echo "<!doctype html><html><head><script type='text/javascript'> " . "\n var iss=' " . $cprefix . $wprefix . "<input title=\"Place name or latitude;longitude;name\" onblur=\"' + \" if (this.value.indexOf(';') != -1) {  parent.document.getElementById('siswi').innerHTML+='<option value=' + String.fromCharCode(34) + '' + String.fromCharCode(34) + '>Please select last value below ...</option><option value=' + String.fromCharCode(34) + this.value + String.fromCharCode(34) + '>' + this.value + '</option>';  parent.document.getElementById('siswi').value=''; if (1 == 2) { parent.document.getElementById('siswi').value=this.value; }   } else if (this.value != '') { parent.document.getElementById('mypiframe').src='intair.php?sofar=' + encodeURIComponent(this.value.replace('Where?','')); } \" + '\" type=text onclick=this.value=\"\" id=iswi value=" . $wiprefix . "></input><select id=siswi onchange=\"document.getElementById(' + \"'myiframe'\" + ').style.opacity=0.5;  document.getElementById(' + \"'myiframe'\" + ').onclick=' + \"function() { this.style.opacity=1.0; } \" + ';   document.getElementById(' + \"'iswi'\" + ').value=this.value;   var lls=this.value.split(' + \"';'\" + '); var ourp=document.getElementById(' + \"'iprefix'\" + ').value; var newp=ourp;  newp=newp.replace(' + \"'0000.0'\" + ',lls[0]);   newp=newp.replace(' + \"'0000.0'\" + ',lls[1]);   newp=newp.replace(' + \"'=%20'\" + ',' + \"'=' + lls[2]);     document.getElementById(\" + \"'iprefix'\" + ').value=newp;    window.open(newp,' + \"'_blank','top=20,left=20,width=950,height=850'\" + \"); newp=newp.replace('welcometonation','world'); \" + '   document.getElementById(' + \"'iiswi'\" + ').src=newp;       document.getElementById(' + \"'iiswi'\" + ').style.display=' + \"'block'\" + '; \"></select><div id=diswi><input type=hidden id=iprefix value=" . $gprefix . "></input><iframe id=iiswi style=z-index:5;display:none;width:850px;height:850px; src=></iframe></div> " . $csuffix . "';  if (parent.document.getElementById('mya')) {  if (!parent.document.getElementById('diswi')) {     parent.document.getElementById('mya').innerHTML='';   var hones=parent.document.getElementsByTagName('h1');  if (hones.length != 0) {  if (hones[0].innerHTML.indexOf('" . $cprefix . $csuffix . "') != -1) {  hones[0].innerHTML=hones[0].innerHTML.replace('" . $anticprefix . "','').replace('" . $cprefix . $csuffix . "',iss.replace('xq',encodeURIComponent(this.value)));   } } } } \n " . $promptclobber . " \n </script></head><body></body></html>";
}

?>
