<?php
  $acc = array (
  'AD' => strtolower('Andorra'),
  'AE' => strtolower('United Arab Emirates'),
  'AF' => strtolower('Afghanistan'),
  'AG' => strtolower('Antigua and Barbuda'),
  'AI' => strtolower('Anguilla'),
  'AL' => strtolower('Albania'),
  'AM' => strtolower('Armenia'),
  'AN' => strtolower('Netherlands Antilles'),
  'AO' => strtolower('Angola'),
  'AQ' => strtolower('Antarctica'),
  'AR' => strtolower('Argentina'),
  'AS' => strtolower('American Samoa'),
  'AT' => strtolower('Austria'),
  'AU' => strtolower('Australia'),
  'AW' => strtolower('Aruba'),
  'AX' => strtolower('Åland Islands'),
  'AZ' => strtolower('Azerbaijan'),
  'BA' => strtolower('Bosnia and Herzegovina'),
  'BB' => strtolower('Barbados'),
  'BD' => strtolower('Bangladesh'),
  'BE' => strtolower('Belgium'),
  'BF' => strtolower('Burkina Faso'),
  'BG' => strtolower('Bulgaria'),
  'BH' => strtolower('Bahrain'),
  'BI' => strtolower('Burundi'),
  'BJ' => strtolower('Benin'),
  'BL' => strtolower('Saint Barthélemy'),
  'BM' => strtolower('Bermuda'),
  'BN' => strtolower('Brunei'),
  'BO' => strtolower('Bolivia'),
  'BQ' => strtolower('British Antarctic Territory'),
  'BR' => strtolower('Brazil'),
  'BS' => strtolower('Bahamas'),
  'BT' => strtolower('Bhutan'),
  'BV' => strtolower('Bouvet Island'),
  'BW' => strtolower('Botswana'),
  'BY' => strtolower('Belarus'),
  'BZ' => strtolower('Belize'),
  'CA' => strtolower('Canada'),
  'CC' => strtolower('Cocos [Keeling] Islands'),
  'CD' => strtolower('Congo - Kinshasa'),
  'CF' => strtolower('Central African Republic'),
  'CG' => strtolower('Congo - Brazzaville'),
  'CH' => strtolower('Switzerland'),
  'CI' => strtolower('Côte d’Ivoire'),
  'CK' => strtolower('Cook Islands'),
  'CL' => strtolower('Chile'),
  'CM' => strtolower('Cameroon'),
  'CN' => strtolower('China'),
  'CO' => strtolower('Colombia'),
  'CR' => strtolower('Costa Rica'),
  'CS' => strtolower('Serbia and Montenegro'),
  'CT' => strtolower('Canton and Enderbury Islands'),
  'CU' => strtolower('Cuba'),
  'CV' => strtolower('Cape Verde'),
  'CX' => strtolower('Christmas Island'),
  'CY' => strtolower('Cyprus'),
  'CZ' => strtolower('Czech Republic'),
  'DD' => strtolower('East Germany'),
  'DE' => strtolower('Germany'),
  'DJ' => strtolower('Djibouti'),
  'DK' => strtolower('Denmark'),
  'DM' => strtolower('Dominica'),
  'DO' => strtolower('Dominican Republic'),
  'DZ' => strtolower('Algeria'),
  'EC' => strtolower('Ecuador'),
  'EE' => strtolower('Estonia'),
  'EG' => strtolower('Egypt'),
  'EH' => strtolower('Western Sahara'),
  'ER' => strtolower('Eritrea'),
  'ES' => strtolower('Spain'),
  'ET' => strtolower('Ethiopia'),
  'FI' => strtolower('Finland'),
  'FJ' => strtolower('Fiji'),
  'FK' => strtolower('Falkland Islands'),
  'FM' => strtolower('Micronesia'),
  'FO' => strtolower('Faroe Islands'),
  'FQ' => strtolower('French Southern and Antarctic Territories'),
  'FR' => strtolower('France'),
  'FX' => strtolower('Metropolitan France'),
  'GA' => strtolower('Gabon'),
  'GB' => strtolower('United Kingdom'),
  'GD' => strtolower('Grenada'),
  'GE' => strtolower('Georgia'),
  'GF' => strtolower('French Guiana'),
  'GG' => strtolower('Guernsey'),
  'GH' => strtolower('Ghana'),
  'GI' => strtolower('Gibraltar'),
  'GL' => strtolower('Greenland'),
  'GM' => strtolower('Gambia'),
  'GN' => strtolower('Guinea'),
  'GP' => strtolower('Guadeloupe'),
  'GQ' => strtolower('Equatorial Guinea'),
  'GR' => strtolower('Greece'),
  'GS' => strtolower('South Georgia and the South Sandwich Islands'),
  'GT' => strtolower('Guatemala'),
  'GU' => strtolower('Guam'),
  'GW' => strtolower('Guinea-Bissau'),
  'GY' => strtolower('Guyana'),
  'HK' => strtolower('Hong Kong SAR China'),
  'HM' => strtolower('Heard Island and McDonald Islands'),
  'HN' => strtolower('Honduras'),
  'HR' => strtolower('Croatia'),
  'HT' => strtolower('Haiti'),
  'HU' => strtolower('Hungary'),
  'ID' => strtolower('Indonesia'),
  'IE' => strtolower('Ireland'),
  'IL' => strtolower('Israel'),
  'IM' => strtolower('Isle of Man'),
  'IN' => strtolower('India'),
  'IO' => strtolower('British Indian Ocean Territory'),
  'IQ' => strtolower('Iraq'),
  'IR' => strtolower('Iran'),
  'IS' => strtolower('Iceland'),
  'IT' => strtolower('Italy'),
  'JE' => strtolower('Jersey'),
  'JM' => strtolower('Jamaica'),
  'JO' => strtolower('Jordan'),
  'JP' => strtolower('Japan'),
  'JT' => strtolower('Johnston Island'),
  'KE' => strtolower('Kenya'),
  'KG' => strtolower('Kyrgyzstan'),
  'KH' => strtolower('Cambodia'),
  'KI' => strtolower('Kiribati'),
  'KM' => strtolower('Comoros'),
  'KN' => strtolower('Saint Kitts and Nevis'),
  'KP' => strtolower('North Korea'),
  'KR' => strtolower('South Korea'),
  'KW' => strtolower('Kuwait'),
  'KY' => strtolower('Cayman Islands'),
  'KZ' => strtolower('Kazakhstan'),
  'LA' => strtolower('Laos'),
  'LB' => strtolower('Lebanon'),
  'LC' => strtolower('Saint Lucia'),
  'LI' => strtolower('Liechtenstein'),
  'LK' => strtolower('Sri Lanka'),
  'LR' => strtolower('Liberia'),
  'LS' => strtolower('Lesotho'),
  'LT' => strtolower('Lithuania'),
  'LU' => strtolower('Luxembourg'),
  'LV' => strtolower('Latvia'),
  'LY' => strtolower('Libya'),
  'MA' => strtolower('Morocco'),
  'MC' => strtolower('Monaco'),
  'MD' => strtolower('Moldova'),
  'ME' => strtolower('Montenegro'),
  'MF' => strtolower('Saint Martin'),
  'MG' => strtolower('Madagascar'),
  'MH' => strtolower('Marshall Islands'),
  'MI' => strtolower('Midway Islands'),
  'MK' => strtolower('Macedonia'),
  'ML' => strtolower('Mali'),
  'MM' => strtolower('Myanmar [Burma]'),
  'MN' => strtolower('Mongolia'),
  'MO' => strtolower('Macau SAR China'),
  'MP' => strtolower('Northern Mariana Islands'),
  'MQ' => strtolower('Martinique'),
  'MR' => strtolower('Mauritania'),
  'MS' => strtolower('Montserrat'),
  'MT' => strtolower('Malta'),
  'MU' => strtolower('Mauritius'),
  'MV' => strtolower('Maldives'),
  'MW' => strtolower('Malawi'),
  'MX' => strtolower('Mexico'),
  'MY' => strtolower('Malaysia'),
  'MZ' => strtolower('Mozambique'),
  'NA' => strtolower('Namibia'),
  'NC' => strtolower('New Caledonia'),
  'NE' => strtolower('Niger'),
  'NF' => strtolower('Norfolk Island'),
  'NG' => strtolower('Nigeria'),
  'NI' => strtolower('Nicaragua'),
  'NL' => strtolower('Netherlands'),
  'NO' => strtolower('Norway'),
  'NP' => strtolower('Nepal'),
  'NQ' => strtolower('Dronning Maud Land'),
  'NR' => strtolower('Nauru'),
  'NT' => strtolower('Neutral Zone'),
  'NU' => strtolower('Niue'),
  'NZ' => strtolower('New Zealand'),
  'OM' => strtolower('Oman'),
  'PA' => strtolower('Panama'),
  'PC' => strtolower('Pacific Islands Trust Territory'),
  'PE' => strtolower('Peru'),
  'PF' => strtolower('French Polynesia'),
  'PG' => strtolower('Papua New Guinea'),
  'PH' => strtolower('Philippines'),
  'PK' => strtolower('Pakistan'),
  'PL' => strtolower('Poland'),
  'PM' => strtolower('Saint Pierre and Miquelon'),
  'PN' => strtolower('Pitcairn Islands'),
  'PR' => strtolower('Puerto Rico'),
  'PS' => strtolower('Palestinian Territories'),
  'PT' => strtolower('Portugal'),
  'PU' => strtolower('U.S. Miscellaneous Pacific Islands'),
  'PW' => strtolower('Palau'),
  'PY' => strtolower('Paraguay'),
  'PZ' => strtolower('Panama Canal Zone'),
  'QA' => strtolower('Qatar'),
  'RE' => strtolower('Réunion'),
  'RO' => strtolower('Romania'),
  'RS' => strtolower('Serbia'),
  'RU' => strtolower('Russia'),
  'RW' => strtolower('Rwanda'),
  'SA' => strtolower('Saudi Arabia'),
  'SB' => strtolower('Solomon Islands'),
  'SC' => strtolower('Seychelles'),
  'SD' => strtolower('Sudan'),
  'SE' => strtolower('Sweden'),
  'SG' => strtolower('Singapore'),
  'SH' => strtolower('Saint Helena'),
  'SI' => strtolower('Slovenia'),
  'SJ' => strtolower('Svalbard and Jan Mayen'),
  'SK' => strtolower('Slovakia'),
  'SL' => strtolower('Sierra Leone'),
  'SM' => strtolower('San Marino'),
  'SN' => strtolower('Senegal'),
  'SO' => strtolower('Somalia'),
  'SR' => strtolower('Suriname'),
  'ST' => strtolower('São Tomé and Príncipe'),
  'SU' => strtolower('Union of Soviet Socialist Republics'),
  'SV' => strtolower('El Salvador'),
  'SY' => strtolower('Syria'),
  'SZ' => strtolower('Swaziland'),
  'TC' => strtolower('Turks and Caicos Islands'),
  'TD' => strtolower('Chad'),
  'TF' => strtolower('French Southern Territories'),
  'TG' => strtolower('Togo'),
  'TH' => strtolower('Thailand'),
  'TJ' => strtolower('Tajikistan'),
  'TK' => strtolower('Tokelau'),
  'TL' => strtolower('Timor-Leste'),
  'TM' => strtolower('Turkmenistan'),
  'TN' => strtolower('Tunisia'),
  'TO' => strtolower('Tonga'),
  'TR' => strtolower('Turkey'),
  'TT' => strtolower('Trinidad and Tobago'),
  'TV' => strtolower('Tuvalu'),
  'TW' => strtolower('Taiwan'),
  'TZ' => strtolower('Tanzania'),
  'UA' => strtolower('Ukraine'),
  'UG' => strtolower('Uganda'),
  'UM' => strtolower('U.S. Minor Outlying Islands'),
  'US' => strtolower('United States'),
  'UY' => strtolower('Uruguay'),
  'UZ' => strtolower('Uzbekistan'),
  'VA' => strtolower('Vatican City'),
  'VC' => strtolower('Saint Vincent and the Grenadines'),
  'VD' => strtolower('North Vietnam'),
  'VE' => strtolower('Venezuela'),
  'VG' => strtolower('British Virgin Islands'),
  'VI' => strtolower('U.S. Virgin Islands'),
  'VN' => strtolower('Vietnam'),
  'VU' => strtolower('Vanuatu'),
  'WF' => strtolower('Wallis and Futuna'),
  'WK' => strtolower('Wake Island'),
  'WS' => strtolower('Samoa'),
  'YD' => strtolower("People's Democratic Republic of Yemen"),
  'YE' => strtolower('Yemen'),
  'YT' => strtolower('Mayotte'),
  'ZA' => strtolower('South Africa'),
  'ZM' => strtolower('Zambia'),
  'ZW' => strtolower('Zimbabwe'),
  'ZZ' => strtolower('Unknown or Invalid Region'),
);
  $ans = "";
  $place = "";
  $country = "";
  $sqs = "";
  $cr = "";
  $cc = "";
  if (isset($_GET['CityName']) && isset($_GET['CountryName'])) {
    $place = $_GET['CityName'];
    $country = $_GET['CountryName'];
    $sqs = $_SERVER['QUERY_STRING'];
    if (1 == 1) {
      if ($country == '') {
      echo '<!doctype html><html><head><scr' . 'ipt type="text/javascript"> function weatherfor() { var citycountry="' . $place . ' weather"; window.open("https://www.google.com.au/search?q=" + encodeURIComponent(citycountry) + "&client=firefox-a&rls=org.mozilla:en-US:official&source=lnms&sa=X&ei=de-XUrCELIXSkwXL9ICIDg&ved=0CAgQ_AUoAA&biw=1243&bih=609&dpr=1#q=" + encodeURIComponent(citycountry) + "+weather", "_blank", "top=200,height=200,width=400,height=400");   } </sc' . 'ript></head><body onload=" weatherfor(); "></body></html>';
      } else {
      echo '<!doctype html><html><head><scr' . 'ipt type="text/javascript"> function weatherfor() { var citycountry="' . $place . "," . $country . ' weather"; window.open("https://www.google.com.au/search?q=" + encodeURIComponent(citycountry) + "&client=firefox-a&rls=org.mozilla:en-US:official&source=lnms&sa=X&ei=de-XUrCELIXSkwXL9ICIDg&ved=0CAgQ_AUoAA&biw=1243&bih=609&dpr=1#q=" + encodeURIComponent(citycountry) + "+weather", "_blank", "top=200,height=200,width=400,height=400");   } </sc' . 'ript></head><body onload=" weatherfor(); "></body></html>';
      }
      exit;
    }
  } else if (isset($_GET['place']) && isset($_GET['country'])) {
    $cr = "\n";
    $place = $_GET['place'];
    $country = $_GET['country'];
    $sqs = "CityName=" . $place . "&CountryName=" . $country;
    if (1 == 1) {
      if ($country == '') {
      echo '<!doctype html><html><head><scr' . 'ipt type="text/javascript"> function weatherfor() { var citycountry="' . $place . ' weather"; window.open("https://www.google.com.au/search?q=" + encodeURIComponent(citycountry) + "&client=firefox-a&rls=org.mozilla:en-US:official&source=lnms&sa=X&ei=de-XUrCELIXSkwXL9ICIDg&ved=0CAgQ_AUoAA&biw=1243&bih=609&dpr=1#q=" + encodeURIComponent(citycountry) + "+weather", "_blank", "top=200,height=200,width=400,height=400");   } </sc' . 'ript></head><body onload=" weatherfor(); "></body></html>';
      } else {
      echo '<!doctype html><html><head><scr' . 'ipt type="text/javascript"> function weatherfor() { var citycountry="' . $place . "," . $country . ' weather"; window.open("https://www.google.com.au/search?q=" + encodeURIComponent(citycountry) + "&client=firefox-a&rls=org.mozilla:en-US:official&source=lnms&sa=X&ei=de-XUrCELIXSkwXL9ICIDg&ved=0CAgQ_AUoAA&biw=1243&bih=609&dpr=1#q=" + encodeURIComponent(citycountry) + "+weather", "_blank", "top=200,height=200,width=400,height=400");   } </sc' . 'ript></head><body onload=" weatherfor(); "></body></html>';
      }
      exit;
    }
  }
  $cc = array_search(strtolower($country), $acc); 
  $nexturl = "./get_weather.php?" . $sqs;
  if ($sqs != "") {
    //exec("curl " . "http://www.webservicex.net/globalweather.asmx/GetWeather?" . $_SERVER['QUERY_STRING'] . " > " . dirname(__FILE__) . "/weather.xml");
    //$ans = file_get_contents(dirname(__FILE__) . "/weather.xml");
    //echo $ans;
    if (1 == 1) {
    //file_put_contents("xxx.xxx", "http://openweathermap.org/find?" . str_replace("CityName=","q=",str_replace("&CountryName=",",",$sqs)));
    //$ans="";
    //http://www.worldweatheronline.com/CHITTAGONG-weather/BD.ASPX
    if (isset($_GET['State'])) {
     $ans = file_get_contents(str_replace(" ","-","http://www.worldweatheronline.com/" . str_replace("CityName=","",str_replace("&CountryName=","-weather/" . str_replace("*", "", str_replace("*/", "", str_replace(" ", "-", ("*" . $_GET['State'] . "/")))) . strtoupper($cc) . ".aspx?junk=",$sqs))));
    } else {
     $ans = file_get_contents(str_replace(" ","-","http://www.worldweatheronline.com/" . str_replace("CityName=","",str_replace("&CountryName=","-weather/" . strtoupper($cc) . ".aspx?junk=",$sqs))));
    }
    //$ans = "http://www.worldweatheronline.com/" . str_replace("CityName=","",str_replace("&CountryName=","-weather/" . strtoupper($cc) . ".aspx?junk=",$sqs));

    $poszero = strpos($ans, "Unexpected Error");
    $pos1 = strpos($ans, "<h3>Latest Weather Observations</h3>");
    if ($pos1 !== false) {
      $ans1 = substr($ans, $pos1);
      $pos2 = strpos($ans1, "</ul>");
      if ($pos2 !== false) {
       $ans = str_replace("</li>", "</td>", str_replace("<li", "<td",  str_replace("</ul>", "</td></tr></table></div>", str_replace("<ul", "<div style='overflow-x:scroll'><table><tr><td", str_replace(">Latest Weather", ">" . $place . ", " . $country . " Latest <a target=_blank title='Weather via ... World Weather Online ... thanks' href='http://www.worldweatheronline.com/'>Weather</a>", substr($ans1, 0, ($pos2 + 4)))))));
      }
    } else if ($poszero !== false) {
      file_put_contents(dirname(__FILE__) . "/get_the_weather.html", "<html><head><" . "script> function ask(inb) { var nurl=prompt('Enter your State/Territory Name (in full) associated with " . $place . ", " . $country . "',''); location.href=inb + '&State=' + nurl.replace(' ', '-');  } </script></head><body onload=\" ask('" . $nexturl . "'); \"><body></html>");
      header("Location: ./get_the_weather.html");
      exit();
    }
    } else {
    $ans = file_get_contents("http://www.webservicex.net/globalweather.asmx/GetWeather?" . $sqs);
    $ans2 = str_replace('<' . '/string>','',str_replace('<string xmlns="http://www.webserviceX.NET"><' . '?xml version="1.0" encoding="utf-16"?>','',str_replace("&lt;","<",str_replace("&gt;",">",$ans))));
    $ans = str_replace('<' . '?xml version="1.0" encoding="utf-8"?>','',str_replace('<' . 'Status>Success</Status>','',$ans2));
    $ans2 = str_replace('<' . 'CurrentWeather>','',str_replace('</' . 'CurrentWeather>','',$ans));
    $ans = str_replace('<' . 'CurrentWeather>','',str_replace('</' . 'CurrentWeather>','',$ans2));
    $ans2 = str_replace('</Time>','',str_replace('</Wind>','',str_replace('</SkyConditions>','',str_replace('</Visibility>','',str_replace('</DewPoint>','',str_replace('</RelativeHumidity>','',str_replace('</Temperature>','',str_replace('</Pressure>','',str_replace('</Location>','',$ans)))))))));
        for ($jj=0; $jj<15; $jj++) {
          $ans = str_replace(">",": ",str_replace("<",$cr,$ans2));
          $ans2 = $ans;
        }
    }
    echo str_replace("\n","<br>",$ans);
    exit(0);
  }
?>
<html>
<head>
<?php
echo '<title>Get the Weather via Global Weather ... http://www.webservicex.net/ ... thanks</title>';
?>

<script type="text/javascript">

window.onload = initAll;
var myxhr = false, breal=0;
var cityName, countryName, urlis;


function createXMLData(incity, incountry) {
 var outxml = '<' + '?' + 'xml version="1.0" encoding="utf-8"' + '?' + '>';
 outxml = outxml + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
 outxml = outxml + '  <soap:Body>';
 outxml = outxml + '    <GetWeather xmlns="http://www.webserviceX.NET">';
 outxml = outxml + '      <CityName>' + incity + '</CityName>';
 outxml = outxml + '      <CountryName>' + incountry + '</CountryName>';
 outxml = outxml + '    </GetWeather>';
 outxml = outxml + '  </soap:Body>';
 outxml = outxml + '</soap:Envelope>';
 return outxml;
}

function initAll() {
    
  if (window.XMLHttpRequest) {
        myxhr = new window.XMLHttpRequest;
    }
    else {
  try {
    myxhr = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
    try {
      myxhr = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (failed) {
      myxhr = false;
    }
  }
    }

  if (myxhr) {
        //console.log("prehere");
    cityName = document.getElementById("CityName").value;
    countryName = document.getElementById("CountryName").value;
    var xml = createXMLData(cityName, countryName);
    
    myxhr.onreadystatechange = readGlobalWeatherXml;
    //myxhr.open("GET", "http://www.webservicex.net/globalweather.asmx/GetWeather?CityName=" + cityName + "&CountryName=" + countryName, true);
    myxhr.open("GET", "./get_weather.php?CityName=" + cityName + "&CountryName=" + countryName, true);
   //myxhr.open("POST","http://www.webservicex.net/globalweather.asmx/GetWeather",true);
if (1 == 2) {
	// Set request headers for message to send. Depends on the web service
	myxhr.setRequestHeader('Man', 'POST /globalweather.asmx HTTP/1.1');
	myxhr.setRequestHeader('Content-Type', 'text/xml');
	myxhr.setRequestHeader('Content-Length', xml.length);
	myxhr.setRequestHeader('SOAPAction', 'http://www.webserviceX.NET/GetCitiesByCountry');
    alert(xml);
    
    myxhr.send(xml);
}

    myxhr.send(null);
  
  } else {
    alert("Not able to create XMLHttpRequest ... sadly.");
  }
}

function readGlobalWeatherXml() {
  var wstuff;
  if (myxhr.readyState == 4 && breal == 1) {
    console.log("myxhr.status=" + myxhr.status);
    if (myxhr.status == 200) {
      console.log("here");
      if (myxhr.responseXML) {
        console.log("here1");
        var myAllLinks = myxhr.responseXML.getElementsByTagName("Location");
        
        for (var myi=0; myi<myAllLinks.length; myi++) {
          document.getElementById("Wind").innerHTML = "Wind: " +  myAllLinks[myi].getElementsByTagName("Wind")[0].firstChild;
          document.getElementById("Time").innerHTML = "Time: " +  myAllLinks[myi].getElementsByTagName("Time")[0].firstChild;
          document.getElementById("Visibility").innerHTML = "Visibility: " +  myAllLinks[myi].getElementsByTagName("Visibility")[0].firstChild;
          document.getElementById("SkyConditions").innerHTML = "Sky Conditions: " +  myAllLinks[myi].getElementsByTagName("SkyConditions")[0].firstChild;
          document.getElementById("Temperature").innerHTML = "Temperature: " +  myAllLinks[myi].getElementsByTagName("Temperature")[0].firstChild;
          document.getElementById("DewPoint").innerHTML = "Dew Point: " +  myAllLinks[myi].getElementsByTagName("DewPoint")[0].firstChild;
          document.getElementById("RelativeHumidity").innerHTML = "Relative Humidity: " +  myAllLinks[myi].getElementsByTagName("RelativeHumidity")[0].firstChild;
          document.getElementById("Pressure").innerHTML = "Pressure: " +  myAllLinks[myi].getElementsByTagName("Pressure")[0].firstChild;
  
        }
        
      } else if (myxhr.responseText) {
        console.log("here5=" + myxhr.responseText);
        var ws2, wstuff = myxhr.responseText.replace('</Time>','').replace('</Wind>','').replace('</SkyConditions>','').replace('</Visibility>','').replace('</DewPoint>','').replace('</RelativeHumidity>','').replace('</Temperature>','').replace('</Pressure>','').replace('</Location>','');
        document.getElementById("weather").style.display = 'block';
        for (var jjj=0; jjj<15; jjj++) {
          ws2 = wstuff.replace("<br>","");
          wstuff = ws2;
        }
        for (var jj=0; jj<15; jj++) {
          ws2 = wstuff.replace(">",": ").replace("<","");
          wstuff = ws2;
        }
        document.getElementById("weather").innerHTML = wstuff;
      }      
    } else {
      console.log("Problem: " + myxhr.status);
      //alert("Problem: " + myxhr.status);
    }
  }
}



</script>

</head>
<body>
<h2>Hover (or Click) for weather from GlobalWeather</h2>
                      <form target="_blank" action='http://www.webservicex.net/globalweather.asmx/GetWeather' method="POST">                      
                        
                          <table cellspacing="0" cellpadding="4" frame="box" bordercolor="#dcdcdc" rules="none" style="border-collapse: collapse;">
                          <tr>
	<td class="frmHeader" background="#dcdcdc" style="border-right: 2px solid white;">Parameter</td>
	<td class="frmHeader" background="#dcdcdc">Value</td>
</tr>

                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CityName:</td>
                            <td><input class="frmInput" type="text" size="50" id="CityName" name="CityName"></td>
                          </tr>
                        
                          <tr>
                            <td class="frmText" style="color: #000000; font-weight: normal;">CountryName:</td>
                            <td><input class="frmInput" type="text" size="50" id="CountryName" name="CountryName"></td>
                          </tr>
                        
                        <tr>
                          <td></td>
                          <td align="right"> <input onclick=' cityName = document.getElementById("CityName").value; countryName = document.getElementById("CountryName").value; urlis = "http://www.webservicex.net/globalweather.asmx/GetWeather?CityName=" + cityName + "&CountryName=" + countryName; window.open(urlis,"_blank"); ' onmouseover=" breal=1; initAll();" type="submit" value="Hover or Click (for new window)" id="submit" class="button"></td>
                        </tr>
                        </table>
                        
                        <p id="Time"></p>
                        <p id="Wind"></p>
                        <p id="Visibility"></p>
                        <p id="SkyConditions"></p>
                        <p id="Temperature"></p>
                        <p id="DewPoint"></p>
                        <p id="Pressure"></p>
                        

<br><iframe id='mygi' src='javascript:false;' style='display:none;width:100%;height:550px;'></iframe>
                    </form>
<?php
  echo '<textarea id="weather" style="display: none;"  rows="14" cols="80"> ' . $ans . '</textarea>';
?>
</body>
</html>
