var iFlightPlanner_isSignedIn = false;
function iFlightPlanner_goToAirport()
{
var el;
var code;
var myQualifier = "";
el = document.getElementById("iFlightPlanner_airport");
if (el)
{
code = el.value;
if (code.length > 2)
window.open("https://www.iflightplanner.com/" + (iFlightPlanner_isSignedIn ? myQualifier : "") + "Airports/" + code.toUpperCase() + "?MPA=","iFlightPlannerWindow");
else
alert("Please enter an airport code of either 3 or 4 characters (i.e. KDTW, Y70, JFK, etc.)");
}
}
function iFlightPlanner_goToRoute()
{
var el;
var rt;
el = document.getElementById("iFlightPlanner_route");
if (el)
{
rt = el.value;
if (rt.length > 1)
window.open("https://www.iflightplanner.com/AviationCharts/?MPA=&L=" + rt.toUpperCase().replace(/[^.A-Z0-9 ]/g,"").replace(/[\s]+/g," ").replace(/ /g,"-"),"iFlightPlannerWindow");
else
alert("Please enter a route containing a sequence of one or more airport or navaid identifiers. Example: KARB SVM MBS WHIPP BORIN KTVC");
}
}
function iFlightPlanner_signIn(affiliateCode)
{
document.location = "https://www.iFlightPlanner.com/W/SignIn.aspx?MPA=" + affiliateCode + "&ReturnUrl=" + escape(document.location.href);
}
function iFlightPlanner_signOut()
{
var iframe, userInfo, anonymousInfo;
//get elements
iframe = document.getElementById("iFlightPlanner_iFrame");
userInfo = document.getElementById("iFlightPlanner_userInfo");
anonymousInfo = document.getElementById("iFlightPlanner_anonymousInfo");
//sign out and hide user fields
if (iframe)
{
iframe.src = "https://www.iFlightPlanner.com/Shared/Contacts/SignOut.aspx"
userInfo.style.display = "none";
anonymousInfo.style.display = "block";
iFlightPlanner_isSignedIn = false;
}
}
function iFlightPlanner_writeWidget()
{
var widgetTemplate;
var el;
//get element
el = document.getElementById("iFlightPlanner_widget");
if (el)
{
//variables (from designer)
widgetTemplate = "