var basearpt = 547;
var basearptname = 'Norwich (NWI)';
var strdropdown_rr = '';
var strdropdown = '';
var availableDates = [];
var availableDates_ret = [];
var seleti;
var rtoarpts, $rtoarpts;
var fromarpts, $fromarpts;
var toarpts, $toarpts;
if (typeof adtspecialmessages != "undefined") {
var lastminutemsg = adtspecialmessages.lastminutemsg;
}
else{
var lastminutemsg = 'For last minute reservations please call us';
}
function available(date) {
var today = new Date();
var td = today.getDate() + "-" + (today.getMonth()+1) + "-" + today.getFullYear();
var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
var tm = tomorrow.getDate() + "-" + (tomorrow.getMonth()+1) + "-" + tomorrow.getFullYear();
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if (jQuery.inArray(dmy, availableDates) != -1) {
return [true, "eva","Available"];
} else {
natooltip = jQuery('.ADT-SW-WIDGET-PLACEHOLDER_1').attr("natooltip");
if(dmy==td || dmy==tm)
{
return [false,"eva",lastminutemsg];
}
else{
return [false,"eva",natooltip];
}
}
}
function available_ret(date) {
var today = new Date();
var td = today.getDate() + "-" + (today.getMonth()+1) + "-" + today.getFullYear();
var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
var tm = tomorrow.getDate() + "-" + (tomorrow.getMonth()+1) + "-" + tomorrow.getFullYear();
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if (jQuery.inArray(dmy, availableDates_ret) != -1) {
return [true, "eva","Available"];
} else {
natooltip = jQuery('.ADT-SW-WIDGET-PLACEHOLDER_1').attr("natooltip");
if(dmy==td || dmy==tm)
{
return [false,"eva",lastminutemsg];
}
else{
return [false,"eva",natooltip];
}
}
}
function adddpclass(input, inst)
{
jQuery('#ui-datepicker-div').addClass("adtdpclass");
}
function getDate( element ) {
var date;
try {
date = jQuery.datepicker.parseDate( 'dd/mm/yy', element.value );
} catch( error ) {
date = null;
}
return date;
}
function getDatefrom_A( element ) {
var date;
try {
date = jQuery.datepicker.parseDate( 'dd-mm-yy', element );
} catch( error ) {
date = null;
}
return date;
}
function populateavldates_on(departingform,goingto, instance, widgetid)
{
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker( "destroy" );
}
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val('');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).val('');
jQuery.ajax({
type: 'GET',
url: 'https://sw.airportdirecttravel.com/swwork/ajaxloaddate_sand.php',
data: {act:'loaddatedp1',routetype:'onward', departingform:departingform, goingto:goingto},
success: function(result){
//jQuery('#ui-datepicker-div').remove();
console.log(1);
var obj = jQuery.parseJSON(jQuery.trim(result));
availableDates = obj;
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker({ beforeShow: adddpclass, beforeShowDay: available , dateFormat: 'dd/mm/yy', minDate:getDatefrom_A(obj[0]),
onSelect: function(dateText, inst) { populateavldates_ret(toarpts.getValue(),fromarpts.getValue(), jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val(),instance, widgetid); }
});
}
});
}
function populateavldates_on_next(departingform,goingto, instance, widgetid)
{
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker( "destroy" );
}
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val('');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).val('');
jQuery.ajax({
type: 'GET',
url: 'https://sw.airportdirecttravel.com/swwork/ajaxloaddate_sand.php',
data: {act:'loaddatedp1',routetype:'onward', departingform:departingform, goingto:goingto},
success: function(result){
//jQuery('#ui-datepicker-div').remove();
console.log(11);
var obj = jQuery.parseJSON(jQuery.trim(result));
availableDates = obj;
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker({ beforeShow: adddpclass, beforeShowDay: available , dateFormat: 'dd/mm/yy', minDate:getDatefrom_A(obj[0]),
onSelect: function(dateText, inst) { populateavldates_ret(rtoarpts.getValue(),fromarpts.getValue(), jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val(),instance, widgetid); }
});
}
});
}
function populateavldates_ret(departingform,goingto, ondate, instance, widgetid)
{
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
jQuery.ajax({
type: 'GET',
url: 'https://sw.airportdirecttravel.com/swwork/ajaxloaddate_sand.php',
data: {act:'loaddatedp1', routetype:'return', departingform:departingform, goingto:goingto , ondate:ondate},
success: function(result){
//jQuery('#ui-datepicker-div').remove();
var obj = jQuery.parseJSON(jQuery.trim(result));
availableDates_ret = obj;
console.log(66666666666666666);
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker({ beforeShow: adddpclass, beforeShowDay: available_ret , dateFormat: 'dd/mm/yy' , minDate:getDate(document.getElementById("ADT-BookDateLeaving-FH"+widgetid )) });
}
});
}
function populateavldates_on_stan(departingform,goingto, instance, widgetid)
{
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker( "destroy" );
}
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val('');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).val('');
jQuery.ajax({
type: 'GET',
url: 'https://sw.airportdirecttravel.com/swwork/ajaxloaddate_sand.php',
data: {act:'loaddatedp1',routetype:'onward', departingform:departingform, goingto:goingto},
success: function(result){
//jQuery('#ui-datepicker-div').remove();
console.log(111);
var obj = jQuery.parseJSON(jQuery.trim(result));
availableDates = obj;
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker({ beforeShow: adddpclass, beforeShowDay: available , dateFormat: 'dd/mm/yy', minDate:getDatefrom_A(obj[0]),
onSelect: function(dateText, inst) { populateavldates_ret(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#ADT-BookDestinationAirport-F'+widgetid).val(),jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#ADT-BookLeaving-FH'+widgetid).val(), jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val(), instance, widgetid); }
});
}
});
}
function populateavldates_on_stan_next(departingform,goingto, instance, widgetid)
{
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker( "destroy" );
}
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val('');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).val('');
jQuery.ajax({
type: 'GET',
url: 'https://sw.airportdirecttravel.com/swwork/ajaxloaddate_sand.php',
data: {act:'loaddatedp1',routetype:'onward', departingform:departingform, goingto:goingto},
success: function(result){
//jQuery('#ui-datepicker-div').remove();
console.log(1111);
var obj = jQuery.parseJSON(jQuery.trim(result));
availableDates = obj;
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker({ beforeShow: adddpclass, beforeShowDay: available , dateFormat: 'dd/mm/yy', minDate:getDatefrom_A(obj[0]),
onSelect: function(dateText, inst) { populateavldates_ret(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#ADT-BookDestinationAirport-F_2'+widgetid).val(),jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#ADT-BookLeaving-FH'+widgetid).val(), jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).val(), instance, widgetid); }
});
}
});
}
function activeinactive(toactivate, instance, widgetid,shhid)
{
if (typeof toarpts != "undefined") {toarpts.clear();}
if (typeof rtoarpts != "undefined") {rtoarpts.clear();}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#ADT-Form'+widgetid).trigger('reset');
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateReturning-FH"+widgetid ).datepicker( "destroy" );
}
if(jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).hasClass('hasDatepicker'))
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find( "#ADT-BookDateLeaving-FH"+widgetid ).datepicker( "destroy" );
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flight_hotel').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flight_only').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.hotel_only').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flight_hotel_tab'+widgetid).removeClass('active');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flight_only_tab'+widgetid).removeClass('active');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.hotel_only_tab'+widgetid).removeClass('active');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.'+toactivate+'_tab'+widgetid).addClass('active');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('#mode'+widgetid).val(toactivate);
if (shhid=="flt")
{
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.rlt').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flt').show();
}
else
{
console.log(shhid);
//jQuery('.rlt').css("display","block");
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.rlt').show();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.flt').hide();
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.'+toactivate).show();
console.log(toactivate);
if('flight_only'==toactivate){
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.room2').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.room3').hide();
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.chroom1').hide();
}
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').removeClass('cls_flight_tab');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').removeClass('cls_holidays_tab');
jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').removeClass('cls_hotels_tab');
if(toactivate=="flight_only"){jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').addClass('cls_flight_tab');jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.childages').hide();}
if(toactivate=="flight_hotel"){jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').addClass('cls_holidays_tab');jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.childages').hide();}
if(toactivate=="hotel_only"){jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.tabcontent').addClass('cls_hotels_tab');jQuery('.ADT-SW-WIDGET-PLACEHOLDER_'+instance).find('.childages').hide();}
}
(function () {
var jQuery;
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.12.4') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src",
"https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js");
if (script_tag.readyState) {
script_tag.onreadystatechange = function () {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
} else {
script_tag.onload = scriptLoadHandler;
}
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
} else {
jQuery = window.jQuery;
main();
}
function scriptLoadHandler() {
// Restore $ and window.jQuery to their previous values and store the
// new jQuery in our local jQuery variable
jQuery = window.jQuery.noConflict();
main();
}
function main() {
jQuery(document).ready(function($) {
var css_link = $("", { rel: "stylesheet", type: "text/css", href: "https://sw.airportdirecttravel.com/swwork/css/script.css"});
css_link.appendTo('head');
jQuery.getScript('https://code.jquery.com/ui/1.12.1/jquery-ui.js');
var css_selectize = $("", {rel: "stylesheet", type: "text/css", href: "https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/css/selectize.default.min.css"});
css_selectize.appendTo('head');
seleti = jQuery.getScript('https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/js/standalone/selectize.min.js');
});
}
})();