
function urlrewrite(idname, protocolType)
{
var protocol = document.nav_form.protocol.value;;
if(protocolType=="https") protocol = protocolType;
var lurl=protocol+"://"+document.nav_form.hostname.value;
var audience
if (document.nav_form.audience != null)
{
audience = document.nav_form.audience.value;
}
else
{
audience = "travel";
}
if ( audience !=null && audience>"" ) {lurl+="/"+audience;}
if ( idname !=null && idname>"" ) {lurl+="/"+idname.toLowerCase();}
var logintype = document.nav_form.logintype.value;
if ( logintype !=null && logintype>"" ) {lurl+="/"+logintype;}
var langadded = false;
var lang = document.nav_form.language.value;
if ( lang!=null && lang>"" ){
var underscore = lang.indexOf("_");
if (underscore != -1){
lang = lang.substring(0, underscore);
}
langadded = true;
lurl+="/"+lang +"_";
}
var country = document.nav_form.country.value;
if ( country!=null && country>"" ){
if (langadded == false){
lurl+="/";
}
lurl +=country;
}
var cv = document.nav_form.scheme.value;
if ( cv!=null && cv>"" ) lurl+="/"+cv;
if (document.nav_form.urlsessparams!=null){
var sessParams=document.nav_form.urlsessparams.value.split(",");
for (var i=0;i<sessParams.length;i++){
var name=sessParams[i];
value=eval("document.nav_form."+name+".value");
lurl+="/"+name+"-"+value;
}
}
if (arguments.length > 2)
{
var urlextension=arguments[2];
lurl+="/"+urlextension;
}
return lurl;
}
function newloc(pageid)
{
var newLocation;
if (arguments.length==1)
{
newLocation=urlrewrite(pageid);
}
else if (arguments.length==2)
{
var urlextension=arguments[1];
newLocation=urlrewrite(pageid,null,urlextension);
}
else if (arguments.length==3)
{
var urlprotocol=arguments[1];
var urlextension=arguments[2];
newLocation=urlrewrite(pageid,urlprotocol,urlextension);
}
document.location=newLocation;
}
function ukushome(){
newloc('HOME');
}
function secureLink(url){
window.location.href="https://" + window.location.host + url;
}
function openNewWindow(url) {
externalWin = window.open(url, 'extWindow', 'width=600,height=550,top=100,left=50,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,status=yes,location=yes')
externalWin.focus();
}
function clearloginform(){
var form = document.loginform;
var mmbform = document.mmbform
if (form) {
if (form.membershipNumber)
{
var dc = getBACookie('BA_LOGON_PERSIST_COOKIE');
if(dc!=null)
form.membershipNumber.value=dc;
else
form.membershipNumber.value = "";
}
if (form.password) form.password.value = "";
}
if (mmbform) {
if (mmbform.lastname) mmbform.lastname.value = "";
if (mmbform.bookingRef) mmbform.bookingRef.value = "";
}
}
function askBAPopup(url) {
if (url.charAt(0)!="/") {
url = "/AskBA.servlet?eId=112002&p_search_text="+url;
}
url=(url==null)?'':url;
url+="&audience=travel";
popupWin = window.open (url,"AskBA", "width=620,height=400,toolbar=yes,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=50,left=100");
popupWin.focus();
}
function popUpScrolling(url,w,h){
if (typeof w=='undefined' || w==''){w='450'}
if (typeof h=='undefined' || h==''){h='350'}
var ifSecCharge = new RegExp("seccharge","i");
if (ifSecCharge.test(url))
{
w=620;
h=450;
}
window.name = "BA_Main";
var toolbar = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h;
var myPopup = window.open(url,"BA_Popup",toolbar);
myPopup.focus();
}
function popUpNonScrolling(url,w,h)
{
if (typeof w=='undefined' || w==''){w='450'}
if (typeof h=='undefined' || h==''){h='350'}
var ifSecCharge = new RegExp("seccharge","i");
if (ifSecCharge.test(url))
{
w=620;
h=450;
}
window.name = "BA_Main";
var toolbar = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width="+w+",height="+h;
var myPopup = window.open(url,"BA_Popup",toolbar);
myPopup.focus();
}
function popUpFullNavigation(url,w,h)
{
if (typeof w=='undefined' || w==''){w='450'}
if (typeof h=='undefined' || h==''){h='350'}
window.name = "BA_Main";
var options = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="+w+",height="+h;
var myPopup =window.open(url,"BA_Popup",options);
myPopup.focus();
}
function showcookie(){
if (typeof heading_link=="undefined"){
document.write('<span>&nbsp;</span>');
}
else {
var output='<span class="maintextintro" style="text-decoration:none; color:#666666;">'+heading_link;
if (typeof subheading_link!="undefined")
{
output=output+' <img src="/cms/global/images/icons/icon_grey_triangle.gif" width="8" height="8" alt="" border="0" /> '+subheading_link+'&nbsp;<img src="/cms/global/images/icons/icon_grey_triangle.gif" width="8" height="8" alt="" border="0" /> ' + selected_pos_text +'</span><br /><br />';
}
else {
output=output+' <img src="/cms/global/images/icons/icon_grey_triangle.gif" width="8" height="8" alt="" border="0" /> ' + selected_pos_text + '</span><br /><br />';
}
document.write(output);
}
}
function showheader(){
if (document.nav_form.audience.value=="trade"){
document.write('<img src=\"/cms/global/images/titles/title_tradeonline.gif\" width=\"400\" height=\"30\" alt=\"Travel Trade Online\" border=\"0\" />');
}
else if (document.nav_form.pageid.value=="GLOBAL"){
document.write('<img src=\"/cms/global/images/titles/title_welcometoba.gif\" width=\"400\" height=\"30\" alt=\"Welcome to ba.com\" border=\"0\" />');
} else {
document.write('<img src=\"/cms/global/images/titles/title_ba.gif\" width=\"400\" height=\"30\" alt=\"ba.com\" border=\"0\" />');
}
}
function getcountry()
{
return window.document.nav_form.country.value.toUpperCase();
}
function selectbaholscountry()
{
document.location = "http://www.baholidays.com/home.jsp?chosenCountry=" + getcountry();
}
function openNewBahWindow(url,option) {
var bahcountry = getcountry();
var adref1 = "&ADREF=BA_";
var adref2 = "_LHN";
if (bahcountry != null && bahcountry != "")
{
url = url + bahcountry + adref1 + bahcountry + adref2;
if (option != "")
{
url = url + "_" + option;
}
}
else
{
url += "GB";
}
externalWin = window.open(url, 'extWindow', 'width=600,height=550,top=100,left=50,toolbar=yes,scrollbars=yes,resizable=yes,menubar=yes,status=yes,location=yes')
externalWin.focus();
}
function appendParameters(pgurl)
{
if(window.location.search != "")
{
pgurl = pgurl + window.location.search;
}
window.location.href = pgurl ;
}
function selectctc()
{
var pageid = "CTCLIST";
var aboutcountry = "About_Country=" + window.document.nav_form.country.value.toUpperCase();
newloc(pageid,aboutcountry);
}
function clickButton(text,linkurl,tabbingOrder)
{
var taborderAttr = "";
if (tabbingOrder){taborderAttr = ' tabindex="' + tabbingOrder + '"'};
divChoice = (document.all && document.getElementById && !document.body.uniqueID) ? "vsubmit3" : "vsubmit";
document.write('<div class='+divChoice+'>');
document.write('<div class="vsubmit2">');
document.write('<a style="color:#FFFFFF; text-decoration:none;" title="'+text+'" href="'+linkurl+'" '+taborderAttr+' >'+text+"&nbsp;");
document.write('<img src="/cms/global/images/icons/icon_white_triangle.gif" border="0" width="15" alt="'+text+'"></a></div></div>');
}
function clickSecondaryButton(text,linkurl)
{
divChoice = (document.all && document.getElementById && !document.body.uniqueID) ? "vsecondarysubmit3" : "vsecondarysubmit";
document.write('<div class='+divChoice+'>');
document.write('<div class="vsecondarysubmit2">');
document.write('<a style="color:#FFFFFF; text-decoration:none;" title="'+text+'" href="'+linkurl+'">'+text+"&nbsp;");
document.write('<img src="/cms/global/images/icons/icon_white_triangle.gif" border="0" width="15" alt="'+text+'"></a></div></div>');
}
function tertiaryButton(text, linkurl)
{
document.write('<span style="float:right"><a style="text-decoration:none" href="'+linkurl+'" title="'+text+'">'+text+ '&nbsp;</a><img src="/cms/global/images/icons/icon_blue_triangle.gif" width="12" alt="'+text+ '"></span>');
}
function clickApplicationButton(text,linkurl)
{
document.write('<div class="gbutton"><a style="color:#FFFFFF; text-decoration:none;" href="'+linkurl+'" title="'+text+'">'+text+'</a></div>');
}
function getQueryValue(fieldname)
{	querylhnav=this.location.href;
querylhnav=querylhnav.substring((querylhnav.indexOf('?')) + 1);
string_arr=querylhnav.split('&');
for (i=0; i< string_arr.length; i++)
{
if ((string_arr[i].indexOf(fieldname)>-1) && (this.location.href.indexOf('?') > 0))
{
string_arr[i]=string_arr[i].substring((string_arr[i].indexOf('=')) + 1);
queryfound=true;
return string_arr[i];
}
}
string_arr[i]="not found";
return (string_arr[i]);
}
function writeVerneNav(){}
function writeCountryOptions(chosen) {
doc.write("<select name=\"countrycode\" class=\"country\">");
doc.write("<option value=\"\">Pick your country</option>");
doc.write("<option value=\"GB\">United Kingdom</option>");
doc.write("<option value=\"US\">United States</option>");
doc.write("<option value=\"\">-</option>");
for (i=0; i<=numCtries; i++) {
var cv = arr[i];
var code = cv.substring(0,2);
var country = cv.substring(3, cv.length);
if (chosen==code) sel = " selected=\"selected\""; else sel = "";
doc.write("<option value=\"" + code + "\"" + sel + ">" + country + "</option>");
}
doc.write("</select>");
}
function legacyWriteFunctionalCountryOptions(chosen) {
for (i=0; i<=numCtries; i++) {
var cv = arr[i];
var code = cv.substring(0,2);
var country = cv.substring(3, cv.length);
if (chosen==code) sel = " selected=\"selected\""; else sel = "";
doc.write("<option value=\"" + code + "\"" + sel + ">" + country + "</option>");
}
}
function writeFunctionalCountryOptions(chosen,selectId) {
if (typeof selectId == 'undefined' || selectId == '' || selectId == null)
{
legacyWriteFunctionalCountryOptions(chosen);
}
else
{
var sel = getIdElement(selectId);
for (i=0; i < arr.length; i++ )
{
var cv = arr[i];
var opt = document.createElement("OPTION");
sel.appendChild(opt);
opt.value = cv.substring(0,2);
opt.text = cv.substring(3, cv.length);
if(opt.value == chosen)
{
opt.selected = true;
}
}
}
}
function writeCurrentCountry(chosen) {
if (chosen == "") return("Pick your country");
for (i=0; i<arr.length; i++) {
var cv = arr[i];
var code = cv.substring(0,2);
var country = cv.substring(3, cv.length);
if (chosen==code)
{
return(country);
break;
}
}
}
function writeCountryDropdown(chosen) {
var sel = "";
for (i=0; i<arr.length; i++) {
var cv = arr[i];
var code = cv.substring(0,2);
var country = cv.substring(3, cv.length);
if (chosen==code) sel = " selected=\"selected\""; else sel = "";
document.write("<option value=\"" + code + "\"" + sel + ">" + country + "</option>");
}
}
function searchba()
{
var url = "/travel/askbainter?p_search_text=";
var searchtext = document.askba.askbatext.value;
if (document.nav_form){
var aud = document.nav_form.audience.value;
if (aud == "trade"){
url = "/trade/askbainter?p_search_text=";
}
}
if (searchtext != "")
{
searchtext = escape(searchtext);
document.location = url + searchtext;
}
}
function writeSearchDiv()
{
if (browser_family=="ns6") document.writeln('<div style="position:absolute; top: 121px; left:0px; width:160px">');
else document.writeln('<div style="position:absolute; top: 110px; left:0px; width:160px">');
}
function dispCountryDrop() {
var DivRef = document.getElementById('countrydrop');
if (iframewrite==true) var IfrRef=document.getElementById('DivShim');
if (navigator.appName=="Netscape")
{
if (DivRef.style.display=="none")
{
DivRef.style.top="122px";
DivRef.style.display="block";
}
else if (DivRef.style.display=="block")
{
DivRef.style.display="none";
}
}
else
{
if (document.getElementById("countrydrop").style.display=="none")
{
DivRef.style.display="block";
if (iframewrite==true)
{	IfrRef.style.width=DivRef.offsetWidth;
IfrRef.style.height=DivRef.offsetHeight;
IfrRef.style.top=DivRef.style.top;
IfrRef.style.left=DivRef.style.left;
IfrRef.style.zIndex=DivRef.style.zIndex - 1;
IfrRef.style.display="block";
document.country2.countrycode.focus();
}
}
else
{
DivRef.style.display="none";
if (iframewrite==true) IfrRef.style.display="none";
}
}
}
function writeIframe()	{
if (iframewrite==true) document.write('<iframe id="DivShim" src="/cms/s.gif" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; display:none;"></iframe>');
}
function doButton(text)
{
divMacChoice = (document.all && document.getElementById && !document.body.uniqueID) ? "vsubmit3" : "vsubmit";
document.write('<div class='+divMacChoice+' style="float:right">');
document.write('<div class="vsubmit2">');
document.write('<a style="color:#FFFFFF; text-decoration:none;" href="javascript:document.country2.submit()">'+text+"&nbsp;");
document.write('<img src="/cms/global/images/icons/icon_white_triangle.gif" border="0" width="15" alt="arrow"></a></div></div>');
}
function showbox(elmnt)
{
if (elmnt == "execlogin")
{
getElm("mmblogin").style.display="none";
getElm("execlogin").style.display="block";
}
else
{
getElm("execlogin").style.display="none";
getElm("mmblogin").style.display="block";
}
}
function showlogoutbox(elmnt)
{
if (elmnt == "execlogout")
{
getElm("mmblogin").style.display="none";
getElm("execlogout").style.display="block";
}
else
{
getElm("execlogout").style.display="none";
getElm("mmblogin").style.display="block";
}
}
function init() {
}
function setNavHighlight()
{
try
{
if(document.nav_form)
{
var navPageid = "/" + document.nav_form.pageid.value.toLowerCase() + "/";
var navHostname = document.nav_form.hostname.value.toLowerCase();
switch ( navPageid )
{
case "/mymile/" : navPageid = "/viewaccount/"; break;
case "/ctclist/" : navPageid = ":selectctc()"; navHostname = "javascript"; break;
}
var isMemberHome = (navPageid == "/memberhome/");
var navObj = getIdElement("t-section-nav-fragment");
if(navObj)
{
var navObjA = navObj.getElementsByTagName("a");
for (var i = 0; i < navObjA.length; i++)
{
navObjHref = navObjA[i].getAttribute("href").toLowerCase();
if ( isMemberHome )
{
navObjHref = navObjHref.replace("/echome/","/memberhome/");
navObjHref = navObjHref.replace("/smehome/","/memberhome/");
}
if (
(
(navObjHref.charAt(0)=="/")
||
(navObjHref.indexOf(navHostname) != -1)
)
&&
(navObjHref.indexOf(navPageid) != -1)
)
{
navObjA[i].className = "selected";
break;
}
}
}
}
}
catch(e)
{
}
}
function getCookie(name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while(i < clen) {
var j = i + alen;
if(document.cookie.substring(i, j) == arg) {
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) {
break;
}
}
return null;
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
function getBACookie (name) {
return getCookie(name);
}
function getBACookieVal (offset) {
return getCookieVal(offset);
}
function showHomeWelcomeMessage(numMess, idParam) {
var showWelcome=Math.floor((numMess.length-1 - 1 + 1) * Math.random() + 1);
if (idParam=='welcomeMess')
{
var welcomeMessage='<p class="first">'+numMess[showWelcome][0]+'</p>';
if (numMess[showWelcome][1]!="")
welcomeMessage=welcomeMessage+'<p class="second">'+numMess[showWelcome][1]+'</p>';
if (numMess[showWelcome][2]!="")
welcomeMessage=welcomeMessage+'<p class="third">'+numMess[showWelcome][2]+'</p>';
document.getElementById(idParam).innerHTML=welcomeMessage;
}
if (idParam=='welcomeImg')
{
getIdElement(idParam).src=numMess[showWelcome][0];
getIdElement(idParam).alt=numMess[showWelcome][1];
getIdElement(idParam).width=numMess[showWelcome][2];
getIdElement(idParam).height=numMess[showWelcome][3];
}
}
