//routine to get field TAF & METAR and area wx.
//Angela Slaney 9/5/2006



function getLocals() {
var mybars="titlebar=yes,toolbar=yes,location=yes, scrollbars=yes";
var string1=document.frm1.textfield.value;
var string2=document.frm1.textfield2.value;
var string3=document.frm1.textfield3.value;
try{
if (check(string1,string2)==0){
     
      throw error();
      }
}
catch (errorObject){
   alert("You need either need an ICAO identifier 4 characters long\r\ne.g. New York/JFK is KJFK\r\nor start and destination airfields entered in the table top page.");
   return;
   }


var url = "http://activitae.com/cgi-bin/xmlForm_1.pl?stationString=" + string1 + "+" + string2 + "+" + string3 + "&form=1&debug=0&mostrecent=0&form=1&debug=0&hours=1.33&alternates=1&phoneContacts=1&sunsetTimes=1";

//&mostrecent=0&form=1&debug=0&hours=1.33

try{
newWin = window.open(url,"YAWS",mybars);
newWin.focus(); 
} catch(errorObject){
   //alert(errorObject.description);
   alert("A 'Weather Page' has been prevented\r\nfrom loading. It is still available\r\nto you by switching off your pop-up blocker\r\n and re-clinking the link.");

}

}

function getArea() {
var mybars="titlebar=yes,toolbar=yes,location=yes, scrollbars=yes";
var string1=document.frm1.textfield.value;
var string2=document.frm1.textfield2.value;

try{
if (check(string1,string2)==0){
     
      throw error();
      }
}
catch (errorObject){
   alert("You need an ICAO identifier 4 characters long\r\ne.g. New York/JFK is KJFK");
   return;
   }

   url="http://activitae.com/cgi-bin/getLocation.pl?string1="+string1+"&string2="+string2;

//alert(url);
try{
newWin = window.open(url,"YAWS",mybars);
newWin.focus();  
} catch(errorObject){
   //alert(errorObject.description);
   alert("A 'Weather Page' has been prevented\r\nfrom loading. It is still available\r\nto you by switching off your pop-up blocker\r\n and re-clinking the link.");
}
}
function getNotam() {
var mybars="titlebar=yes,toolbar=yes,location=yes, scrollbars=yes";
var string1=document.frm1.textfield.value;
var string2=document.frm1.textfield2.value;
var string3=document.frm1.textfield3.value;

//   url="https://www.notams.faa.gov/geo/flightPath.html?icao_id="+string1+"&icao_id="+string2+"&icao_id="+string3+"&radius=20&options=A&options=C&options=&flight_path=View+NOTAMs";

url="https://www.notams.faa.gov/dinsQueryWeb/flightPathSearchMapAction.do?geoFlightPathIcao1="+string1+"&geoFlightPathIcao2="+string2+"&geoFlightPathIcao3="+string3+"&geoFlightPathIcao4=&geoFlightPathIcao5=&geoFlightPathbuffer=20&geoFlightPathOptionsAR=A&flight_path=View+NOTAMs";

//alert(url);
try{
newWin = window.open(url,"YAWS",mybars);
newWin.focus();  
} catch(errorObject){
   //alert(errorObject.description);
   alert("A 'NOTAM Page' has been prevented\r\nfrom loading. It is still available\r\nto you by switching off your pop-up blocker\r\n and re-clinking the link.");
}
}
function check(string1,string2){
if((string1.length!=4)||(string2.length!=4)){
 
   return 0;
}else {
   return 1;}
}

