
var MAPSENABLED=false;
$(function(){
pageload();
functionalPageLoad();
var rolejq=$("form[name='nav_form'] input[name='role']");
if ( rolejq.length > 0 )
{
if ( rolejq.attr('value').toLowerCase() == 'tradecustomer' )
{
$("#t-lhs, #t-breadcrumbs, .bookExperiences, #bookNow, #sectionTripAdvisor").remove();
$("#t-centre").css("float","left");
}
}
$(".inlinelinks ul.tertiaryLinks").each(function(){
$(this).find("li:not(:last) a").after("&nbsp;- ");
});
var h2s=$("#sectionAirport .articleSection h2");
if ( h2s.length > 1 )
{
h2s.addClass("twisty");
}
});
$(function() {
var count = 0;
$("tr#climate-chart-temp td").not(".title").each(function (i) {;
count++;
var iCellTemp = $(this).html();
var sCellTemp = Math.abs((iCellTemp *2)) + "px";
var sInnerHTML = '<div class=\"bar\" style=\"height:'+sCellTemp+'\">&nbsp;</div>';
if (iCellTemp <= 0){
$("tr#climate-chart-neg-temp td:eq("+count+")").html(sInnerHTML).css("line-height",sCellTemp);
$("tr#climate-chart-neg-temp td:eq("+count+") div").removeClass("bar").addClass("neg-bar");
} else {
$(this).html(iCellTemp + sInnerHTML);
}
});
});
$(function() {
var twisties=$("h2.twisty");
if (twisties.length > 0)
{
var isarticle = $("#sectionAirport").length > 0;
var COLLAPSIBLES = isarticle ? ">:not(.twistywrapper)" : ".column,.fullwidth";
var SECTION = isarticle ? ".articleSection" : ".section";
var COLLAPSEDONLOAD = isarticle ? "h2.twisty" : "h2.twisty:not(:first)";
twisties.wrap ( '<div class="twistywrapper"></div>' );
twisties.each ( function() {
var t=$(this).text();
$(this).html("<a href='#'></a><div class='plusminus'><a href='#'>Show</a></div><div class='clearBoth'></div>").find("a:first").each ( function() {
$(this).text(t);
});
$(this).find("a,.plusminus").click( function () {
var section=$(this).parents(SECTION);
var plusminus=section.find(".plusminus");
if ( section.is(".expanded") ) {
section.removeClass("expanded");
section.addClass("collapsed");
section.find(COLLAPSIBLES).hide("fast");
plusminus.find("a").text("Show");
} else {
section.removeClass("collapsed");
section.addClass("expanded");
section.find(COLLAPSIBLES).show("fast");
plusminus.find("a").text("Hide");
}
return false;
});
});
$(".tab").each (function(){
if ( !isarticle ) {
$(this).find("h2.twisty:first").parents(SECTION).removeClass("expanded");
}
$(this).find(COLLAPSEDONLOAD).parents(SECTION).addClass("expanded");
});
twisties.find("a:first").click();
}
});
$(function(){
if ( $('#sectionTabs li a').length > 1 )
{
$('.accessableAnchor').addClass('hidden');
$('#sectionTabs li:first').addClass('selected');
$('.tab').addClass('hidden');
$('.tab:first').removeClass('hidden');
$('#sectionTabs li a').click(clickTab);
showTab("sectionOverview");
if ( $("#sectionAirport .articleSection").length > 0 )
{
showAirportTab();
}
for ( var i=0; i < 4; i++ )
{
showTab("tab"+i+"Anchor");
}
}
if ( MAPSENABLED )
{
$("#sectionMap .sectionBody .articleSection.first").append("<div id=\"legend\"></div><div id=\"navContainer\"><div id=\"nav\"><div id=\"navSideR\" class=\"navPart navSide\"><a title=\"Next\" id=\"next\" class=\"mover\" href=\"javascript:nextClick();\">&gt;</a></div><div id=\"pagesNav\" class=\"navPart\"></div><div id=\"navSideL\" class=\"navPart navSide\"><a title=\"Previous\" id=\"prev\" class=\"mover\" href=\"javascript:prevClick();\">&lt;</a></div></div></div><div id=\"msMap\" style=\"position:relative; width:530px; height:400px;\"></div>");
$("#sectionMap .sectionBody").append('<div id="maplegal"><ul><li class="first"><a href="http://tou.live.com/en-gb" target="_blank" title="Microsoft MapPoint Terms of Use">Microsoft MapPoint Terms of Use</a></li><li><a href="http://privacy.microsoft.com/en-gb" target="_blank" title="Privacy Statement">Privacy Statement</a></li></ul></div>');
}
if ($("#loadClimateContainer").length > 0 ){
showTab("sectionWeather");
}
$("#tabbedContent .tab").find(".articleSection:first:not(.first)").addClass("first");
$("#tabbedContent .tab:first .sectionHeader").prepend($("#bookNow")).append('<div class="clearBoth"></div>').addClass("hasLayoutFix");
if ($("#articleIntroText").length > 0 ){
$("#sectionOverview .articleSection.first").prepend($("#articleIntroText"));
$("#articleIntroText").show();
}
if ($("#articleSuffixText").length > 0 ){
$("#sectionOverview .articleSection:last").append($("#articleSuffixText"));
$("#articleSuffixText").show();
}
if ($(".baDestinationContentImage").length > 0){
$("#sectionOverview .articleSection.first p").prepend($(".baDestinationContentImage"));
}
var tabAnchor = location.href.match(/#.*/);
if ( tabAnchor )
{
tabAnchor=(''+tabAnchor).replace(/Anchor$/,"");
var tabhead = $('#sectionTabs li:visible a[href="' + tabAnchor + '"],#sectionTabs li:visible a[href="' + tabAnchor + 'Anchor"]');
if ( tabhead.length > 0 )
{
tabhead.click();
tabhead[0].scrollIntoView();
}
}
});
function clickTab() {
$("#social-bookmarks").dialog("close");
$("a#show-bookmarks.openDialog").click();
var tab=''+this.href.match(/#.*/);
tab=tab.replace(/Anchor$/,"");
$(tab).removeClass('hidden');
$('.tab:not('+tab+')').addClass('hidden');
$('#sectionTabs li.selected').removeClass('selected');
$(this.parentNode).addClass('selected');
if (MAPSENABLED && (tab=="#sectionMap"))
{
if (typeof(loadMap)=="function")
{
if ( myPointsOfInterest && myAirports ) {
if ( myPointsOfInterest.length + myAirports.length > 9 ) {
$("#navContainer").show();
}
}
maponchangevieweventattached=false;
loadMap();
}
}
if (MAPSENABLED && (tab !="#sectionMap") && map)
{
map.HideInfoBox();
}
$(tab).find(".statisticPods dl:not(.fixedheight)").each(function(){
var dts=$(this).find("dt"), dds=$(this).find("dd");
if (dts.length == dds.length)
{
for(var i = 0; i < dts.length; i++)
{
var a=$(dts[i]).height(),b=$(dds[i]).height();
if ( a > b )
{
$(dds[i]).height(a);
}
else if ( b > a )
{
$(dts[i]).height(b);
}
}
}
$(this).addClass('fixedheight');
})
return false;
}
function max3(a,b,c)
{
return a>b?(a>c?a:c):(b>c?b:c);
}
function showTab(tabid)
{
$('#sectionTabs li:has(a[href="#' + tabid + '"],a[href="#' + tabid + 'Anchor"])').css("display","inline");
}
function showMapTab()
{
if ( MAPSENABLED )
{
showTab("sectionMap");
}
}
function showWeatherTab()
{
$("#currentWeather .statisticPods").hide();
showTab("sectionWeather");
$("#sectionWeather .fullWidthStatisticPod").addClass("hasLayoutFix");
changeSingleToMultiple();
}
function showWeatherTabCallback(responseText, textStatus, XMLHttpRequest)
{
showWeatherTab();
}
function showAirportTab()
{
showTab("sectionAirport");
$("#sectionAirport .fullWidthStatisticPod").addClass("hasLayoutFix");
}
function changeMultipleToSingle()
{
if ( $("#sectionTabs li:visible").length < 2 )
{
$("#tabbedContent.multiple").removeClass("multiple").addClass("single");
}
}
function changeSingleToMultiple()
{
$("#tabbedContent.single").removeClass("single").addClass("multiple");
}
$(function(){
if ( $("#t-intro-fragment img").height() >= 150 )
{
$(".specialoffer").css("display","inline");
}
});
$(function(){
var jqc = $("form[name='nav_form'] input[name='country']"), country = '';
if ( jqc.length > 0 ) { country = jqc[0].value; }
var cc="chosenCountry="+country+"&clearSess";
$("a[href^='http://www.baholidays.com/']").each(function(){
var s=this.href;
if (s.match(/&clearSess/i)) { s=s.replace(/&clearSess/gi,""); }
if (s.match(/chosenCountry=/i))
{
s=s.replace(/chosenCountry=GB/gi,cc);
}
else
{
if ( s.indexOf("?")>-1 )
{
s+="&"+cc;
}
else
{
s+="?"+cc;
}
}
this.href=s;
});
});
$(function(){
$("#tabbedContent").after($("#sectionTripAdvisor"));
});
$(function(){
try{
if (typeof destinationCityCode != "undefined"){
$("#to").attr("value",destinationCityCode);
$("#flightsOnly").click(function() {
$("#to").attr("value",destinationCityCode);
});
$("#hotelPackage").click(function() {
setDPDestination('flighthotel',destinationCityCode);
});
$("#carPackage").click(function() {
setDPDestination('flightcar',destinationCityCode);
});
$("#hotelGO").click(function() {
setDPDestination('hotel',destinationCityCode);
});
$("#carGO").click(function() {
setDPDestination('car',destinationCityCode);
});
$("#expGO").click(function() {
setDPDestination('experience',destinationCityCode);
});
}
}
catch(err){
}
});