")[0],
rsrc = /url\(["']?(.*?)["']?\)/,
watched = [],
positions = {
top: 0,
left: 0,
bottom: 1,
right: 1,
center: .5
};
// feature detection
if ("backgroundSize" in div.style && !$.debugBGS) { return; }
$.cssHooks.backgroundSize = {
set: function (elem, value) {
var firstTime = !$.data(elem, "bgsImg"),
pos,
$wrapper, $img;
$.data(elem, "bgsValue", value);
if (firstTime) {
// add this element to the 'watched' list so that it's updated on resize
watched.push(elem);
$.refreshBackgroundDimensions(elem, true);
// create wrapper and img
$wrapper = $("
").css({
position: "absolute",
zIndex: -1,
top: 0,
right: 0,
left: 0,
bottom: 0,
overflow: "hidden"
});
$img = $("
").css({
position: "absolute"
}).appendTo($wrapper),
$wrapper.prependTo(elem);
$.data(elem, "bgsImg", $img[0]);
pos = (
// Firefox, Chrome (for debug)
$.css(elem, "backgroundPosition") ||
// IE8
$.css(elem, "backgroundPositionX") + " " + $.css(elem, "backgroundPositionY")
).split(" ");
// Only compatible with 1 or 2 percentage or keyword values,
// Not yet compatible with length values and 4 values.
$.data(elem, "bgsPos", [
positions[pos[0]] || parseFloat(pos[0]) / 100,
positions[pos[1]] || parseFloat(pos[1]) / 100
]);
// This is the part where we mess with the existing DOM
// to make sure that the background image is correctly zIndexed
$.css(elem, "zIndex") == "auto" && (elem.style.zIndex = 0);
$.css(elem, "position") == "static" && (elem.style.position = "relative");
$.refreshBackgroundImage(elem);
} else {
$.refreshBackground(elem);
}
},
get: function (elem) {
return $.data(elem, "bgsValue") || "";
}
};
// The background should refresh automatically when changing the background-image
$.cssHooks.backgroundImage = {
set: function (elem, value) {
// if the element has a backgroundSize, refresh its background
return $.data(elem, "bgsImg") ?
$.refreshBackgroundImage(elem, value) :
// otherwise set the background-image normally
value;
}
};
$.refreshBackgroundDimensions = function (elem, noBgRefresh) {
var $elem = $(elem),
currDim = {
width: $elem.innerWidth(),
height: $elem.innerHeight()
},
prevDim = $.data(elem, "bgsDim"),
changed = !prevDim ||
currDim.width != prevDim.width ||
currDim.height != prevDim.height;
$.data(elem, "bgsDim", currDim);
if (changed && !noBgRefresh) {
$.refreshBackground(elem);
}
};
$.refreshBackgroundImage = function (elem, value) {
var img = $.data(elem, "bgsImg"),
currSrc = (rsrc.exec(value || $.css(elem, "backgroundImage")) || [])[1],
prevSrc = img && img.src,
changed = currSrc != prevSrc,
imgWidth, imgHeight;
if (changed) {
img.style.height = img.style.width = "auto";
img.onload = function () {
var dim = {
width: img.width,
height: img.height
};
// ignore onload on the proxy image
if (dim.width == 1 && dim.height == 1) { return; }
$.data(elem, "bgsImgDim", dim);
$.data(elem, "bgsConstrain", false);
$.refreshBackground(elem);
img.style.visibility = "visible";
img.onload = null;
};
img.style.visibility = "hidden";
img.src = currSrc;
if (img.readyState || img.complete) {
img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";
img.src = currSrc;
}
elem.style.backgroundImage = "none";
}
};
$.refreshBackground = function (elem) {
var value = $.data(elem, "bgsValue"),
elemDim = $.data(elem, "bgsDim"),
imgDim = $.data(elem, "bgsImgDim"),
$img = $($.data(elem, "bgsImg")),
pos = $.data(elem, "bgsPos"),
prevConstrain = $.data(elem, "bgsConstrain"),
currConstrain,
elemRatio = elemDim.width / elemDim.height,
imgRatio = imgDim.width / imgDim.height,
delta;
if (value == "contain") {
if (imgRatio > elemRatio) {
$.data(elem, "bgsConstrain", (currConstrain = "width"));
delta = Math.floor((elemDim.height - elemDim.width / imgRatio) * pos[1]);
$img.css({
top: delta
});
// when switchin from height to with constraint,
// make sure to release contraint on height and reset left
if (currConstrain != prevConstrain) {
$img.css({
width: "100%",
height: "auto",
left: 0
});
}
} else {
$.data(elem, "bgsConstrain", (currConstrain = "height"));
delta = Math.floor((elemDim.width - elemDim.height * imgRatio) * pos[0]);
$img.css({
left: delta
});
if (currConstrain != prevConstrain) {
$img.css({
height: "100%",
width: "auto",
top: 0
});
}
}
} else if (value == "cover") {
if (imgRatio > elemRatio) {
$.data(elem, "bgsConstrain", (currConstrain = "height"));
delta = Math.floor((elemDim.height * imgRatio - elemDim.width) * pos[0]);
$img.css({
left: -delta
});
if (currConstrain != prevConstrain) {
$img.css({
height: "100%",
width: "auto",
top: 0
});
}
} else {
$.data(elem, "bgsConstrain", (currConstrain = "width"));
delta = Math.floor((elemDim.width / imgRatio - elemDim.height) * pos[1]);
$img.css({
top: -delta
});
if (currConstrain != prevConstrain) {
$img.css({
width: "100%",
height: "auto",
left: 0
});
}
}
}
}
// Built-in throttledresize
var $event = $.event,
$special,
dummy = { _: 0 },
frame = 0,
wasResized, animRunning;
$special = $event.special.throttledresize = {
setup: function () {
$(this).on("resize", $special.handler);
},
teardown: function () {
$(this).off("resize", $special.handler);
},
handler: function (event, execAsap) {
// Save the context
var context = this,
args = arguments;
wasResized = true;
if (!animRunning) {
$(dummy).animate(dummy, {
duration: Infinity, step: function () {
frame++;
if (frame > $special.threshold && wasResized || execAsap) {
// set correct event type
event.type = "throttledresize";
$event.dispatch.apply(context, args);
wasResized = false;
frame = 0;
}
if (frame > 9) {
$(dummy).stop();
animRunning = false;
frame = 0;
}
}
});
animRunning = true;
}
},
threshold: 1
};
// All backgrounds should refresh automatically when the window is resized
$(window).on("throttledresize", function () {
$(watched).each(function () {
$.refreshBackgroundDimensions(this);
});
});
})($, window, document, Math);
$.fn.zInput = function () {
var $inputs = this.find(":radio,:checkbox");
$inputs.hide();
var inputNames = [];
$inputs.map(function () {
inputNames.push($(this).attr('name'));
});
inputNames = $.unique(inputNames);
$.each(inputNames, function (index, value) {
var $element = $("input[name='" + value + "']");
var elementType = $element.attr("type");
$element.wrapAll('
');
if (elementType == "radio") {
$element.wrap(function () { return '
' + $(this).attr("title") + '
' });
}
if (elementType == "checkbox") {
$element.wrap(function () { return '
' + $(this).attr("title") + '
' });
}
});
var $zRadio = $(".zInput").not(".zCheckbox");
var $zCheckbox = $(".zCheckbox");
$zRadio.click(function () {
$theClickedButton = $(this);
//move up the DOM to the .zRadioWrapper and then select children. Remove .zSelected from all .zRadio
$theClickedButton.parent().children().removeClass("zSelected");
$theClickedButton.parent().children().removeClass("zUnselected");
//move up the DOM to the .zRadioWrapper and then select children. Remove .zSelected from all .zRadio
$theClickedButton.parent().children().addClass("zUnselected");
$theClickedButton.removeClass("zUnselected");
$theClickedButton.addClass("zSelected");
$theClickedButton.find(":radio").prop("checked", true).change();
});
$zCheckbox.click(function () {
$theClickedButton = $(this);
//move up the DOM to the .zRadioWrapper and then select children. Remove .zSelected from all .zRadio
$theClickedButton.toggleClass("zSelected");
$theClickedButton.find(':checkbox').each(function () { this.checked = !this.checked; $(this).change() });
});
}
//geocode functions
function GetPropertyFromGeocode(geocode, property) {
if (geocode && geocode.address_components) {
for (var i=0; i < geocode.address_components.length; i++) {
var address = geocode.address_components[i];
if ($.inArray(property,address.types) >= 0)
return address.long_name;
}
}
return "";
}
var geocoder;
var currentSelectedGeocode;
var hasSelectedLocation;
var city;
var ludacrisAreaCodes
function setSearchLatLng(lat, lng) {
$('#Lat').val(lat);
$('#Lng').val(lng);
}
function initializeGeocode() {
geocoder = new google.maps.Geocoder();
var input = (document.getElementById('st'));
var ukBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(62.509149, -11.711426),
new google.maps.LatLng(48.8567, 2.3508)
);
var options = {
types: ['(regions)'],
bounds: ukBounds,
componentRestrictions: { country: 'gb' }
};
//getting first suggestion on enter
//var searchBox = new google.maps.places.SearchBox(input, options);
var autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.setFields(['address_components', 'geometry', 'icon', 'name']);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
$("#Lat").val("");
$("#Lng").val("");
var place = autocomplete.getPlace();
console.log(place);
if (!place.geometry) {
//alert('no place geometry');
//selectFirstResult();
}
currentSelectedGeocode = place;
if (place.geometry.location) {
OnGeocodeSelected(place,false);
}
//infowindow.setContent('
' + place.name + '' + address);
//infowindow.open(map, marker);
});
$("#iyaform").submit(function () {
//$('#iya-ani').css({ "display": "block" });
if ($(".pac-container").is(":visible"))
return selectFirstResult();
return true;
});
function selectFirstResult() {
//infowindow.close();
$(".pac-container").hide();
var firstResult = $(".pac-container .pac-item:first .pac-item-query").text();
//alert(" 1) [" + firstResult + "]");
$("#st").val(firstResult);
setTimeout(function() {
geocoder.geocode({ 'address': firstResult }, function (results, callback) {
if (status == google.maps.GeocoderStatus.OK) {
OnGeocodeSelected(geocode,false);
callback({ Status: "OK", Latitude: lat, Longitude: lng });
} else {
//alert('Geocode was not successful for the following reason: ' + status);
return false;
}
return true;
});
}, 2000);
}
}
function OnGeocodeSelected(geocode, setSearchTerm)
{
currentSelectedGeocode = geocode;
setSearchLatLng(geocode.geometry.location.lat(), geocode.geometry.location.lng());
//fix for api not restricting properly
//locality
//postal_town
//administrative_area_level_2
//postal_code_prefix
//postal_code
city = null;
city = GetPropertyFromGeocode(geocode, "locality");
if (!city)
{
city = GetPropertyFromGeocode(geocode, "postal_town");
if (!city)
{
city = GetPropertyFromGeocode(geocode, "administrative_area_level_2");
}
}
ludacrisAreaCodes = null;
ludacrisAreaCodes = GetPropertyFromGeocode(geocode, "postal_code_prefix");
if(!ludacrisAreaCodes)
{
ludacrisAreaCodes = GetPropertyFromGeocode(geocode, "postal_code");
}
if (setSearchTerm) {
var searchTerm = (city) ? city : ludacrisAreaCodes;
$("#st").val(searchTerm);
}
}
(function ($) {
$.fn.extend({
thefaModal: function (options) {
var defaults = { top: 100, overlay: 0.5, closeButton: null, modal_id: '#thefa-popover' };
var overlay = $("
");
if ($('#thefa_overlay').length == 0) { $("#content-text").prepend(overlay); }
options = $.extend(defaults, options);
return this.each(function () {
var o = options;
var modal_id = o.modal_id;
$("#thefa_overlay").click(function () { close_modal(modal_id) });
$(document).on('click', o.closeButton, function (e) { e.preventDefault(); close_modal(modal_id) });
var modal_height = $(modal_id).outerHeight();
var modal_width = $(modal_id).outerWidth();
$("#thefa_overlay").css({ "display": "block", opacity: 0 });
$("#thefa_overlay").fadeTo(1000, o.overlay);
$(modal_id).css({ "display": "block", "position": "fixed", "opacity": 0, "z-index": 11000, "left": 50 + "%", "margin-left": -(modal_width / 2) + "px", "top": o.top + "px" });
$(modal_id).fadeTo(1000, 1);
});
function close_modal(modal_id) {
$("#thefa_overlay").fadeOut(1000);
//$('#popover-content2').empty();
$(modal_id).css({ "display": "none" });
}
}
})
})(jQuery);
$.fn.scrollTo = function (target, options, callback) {
if (typeof options == 'function' && arguments.length == 2) { callback = options; options = target; }
var settings = $.extend({
scrollTarget: target,
offsetTop: 50,
duration: 500,
easing: 'swing'
}, options);
return this.each(function () {
var scrollPane = $(this);
var scrollTarget = (typeof settings.scrollTarget == "number") ? settings.scrollTarget : $(settings.scrollTarget);
var scrollY = (typeof scrollTarget == "number") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);
scrollPane.animate({ scrollTop: scrollY }, parseInt(settings.duration), settings.easing, function () {
if (typeof callback == 'function') { callback.call(this); }
});
});
}
$(document).ready(function () {
$('#tabs').prepend('
');
initializeGeocode();
//$('.findAClubSelect').selectbox();
//$(".iya-filter").zInput();
$('.iya-type-minor-logo').css({ backgroundSize: "contain" });
var IsMobile = false;
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) { IsMobile = true; }
//console.log(IsMobile);
if (($('.results').length == 0) && (IsMobile == false)) {
h = $(window).height() - 108; hpx = h + 'px'; m = (h / 2) - 82; mpx = m + 'px';
$('.iya .formRow.iya-campaign').css({ 'height': hpx });
$('.iya .inyourarea h2.iya-header').css({ 'padding-top': mpx });
// arrow code
} else if(($('.results').length == 0) && (IsMobile == true))
{
//height is window - mobile menu height (49) 34, 45, 51
h = $(window).height() - 49; hpx = h + 'px'; m = (h / 2) - 30; mpx = m + 'px';
$('.iya .formRow.iya-campaign').css({ 'height': hpx });
$('.iya .inyourarea h2.iya-header').css({ 'padding-top': mpx });
//$(divToResize).css('height', $(container).innerHeight());
}
$('.extra-detail-activate').click(function (e) {
console.log('Working!');
e.preventDefault();
$(this).closest('.iya-session').children('.session-popunder-container').toggleClass('open');
if ($('.session-popunder-container').hasClass('open')) {
$(this).addClass('icons-button-minus');
$(this).removeClass('icons-button-plus');
} else {
$(this).addClass('icons-button-plus');
$(this).removeClass('icons-button-minus');
}
});
// highlight selected options
$('.sbOptions li a').click(function (e) {
selection = $(this).attr('rel');
$('.sbOptions li').removeAttr('style');
$('.sbOptions li a').removeAttr('style');
$(this).parent().css({ 'background-color': '#00813e'});
$(this).css({'color': '#ffffff !important' });
});
if ($('#filterStartDate').val() != "" || $('#filterEndDate').val() != "") {
$('.iya-date-clear').css({ "display": "block" });
} else if ($('#filterStartDate').val() == "" && $('#filterEndDate').val() == "") {
$('.iya-date-clear').css({ "display": "none" });
}
$('li span.cleardate-btn').click(function (e) {
$('#filterFrom').val('');
$('#filterTo').val('');
$('#filterStartDate').val('');
$('#filterEndDate').val('');
$('#iyafilters').submit();
});
// minor result formatting
$('li.detail-container.icons-result-footballer').each(function () {
if ($(this).html().trim() == "") {
$(this).css({'display':'none'});
}
});
if ($('li .icons-result-footballer').html() == "") {
}
$('.filter-dropdown').change(function (event) {
if ($(this).attr('id') == 'p_Gender' || $(this).attr('id') == 'gender') {
// do nothing
} else {
$('#iya-ani').css({ "display": "block" });
$('#iyafilters').submit();
}
});
if (!IsMobile) {//when desktop
$('input[type="date"]').prop('type', 'text');
}
if (/iPhone|iPad|iPod/i.test(navigator.userAgent) && IsMobile) {// when mobile IOS
//$('input[type="date"]').prop('type', 'text');
$('#filterFrom').attr('value', '');
$('#filterTo').attr('value', '');
}
if (/Android|webOS|BlackBerry/i.test(navigator.userAgent) && IsMobile) {// when mobile and not IOS
$('#filterFrom').attr('value', '');
$('#filterTo').attr('value', '');
}
// re trigger the styled radio and chackboxes if already checked
var $radioBtns = $('.iya-filter input:checked[name="Parameters.Gender"], .iya-filter input:checked[name="p.Distance"]');
if ($radioBtns) {
//move up the DOM to the .zRadioWrapper and then select children. Remove .zSelected from all .zRadio
$radioBtns.closest('.zInputWrapper').children().removeClass("zSelected");
$radioBtns.closest('.zInputWrapper').children().removeClass("zUnselected");
//move up the DOM to the .zRadioWrapper and then select children. Remove .zSelected from all .zRadio
$radioBtns.closest('.zInputWrapper').children().addClass("zUnselected");
$radioBtns.closest('.zInput').removeClass("zUnselected");
$radioBtns.closest('.zInput').addClass("zSelected");
}
$('#iyaform').submit(function (event) {
//$('#iya-ani').css({ "display": "block" });
//get a geocode from what the user has typed
//geocoder.geocode({ 'latLng': latlng }, function (results, status) {
//});
//var autocomplete = new google.maps.places.Autocomplete(input);
if(!currentSelectedGeocode)
{
//todo
//$('#st').trigger('geocode');
//while(!currentSelectedGeocode)
//{
// //wait until the ajax service returns to procede
//}
}
var searchTerm = (city) ? city: ludacrisAreaCodes;
$('#sd').val(searchTerm);
//replace spaces with -
var re = new RegExp(' ', 'g');
city = city.replace(re, '-');
var searchString = ludacrisAreaCodes + (ludacrisAreaCodes ? '-' : '') + city;
//searchString = searchString ?? "resultse";
$(this).get(0).setAttribute('action', '/play-football/' + searchString);
});
//ios font fixes
/*
if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
$('select, input, .iya h2, h3, .iya .container-12 .column-4 .button, .iya-detail-header, .iya-detail, .session-details ul li, .session-popunder h5').css({ 'font-size': '4em' });
$('.iya-detail-header').css({ 'line-height': '1.5em' });
$('.iya .container-12 .column-4 .button').css({ 'left': '45%' });
$('.iya-clubs-txt').css({ 'font-size': '100%' });
$('.adaptive-wrapper .adaptive-stage .adaptive-footer').css({ 'zoom': '1' });
//
//alert('ios7');
}
*/
//var o = oResults.responseText;
//var oData = $("
").html(o).find(toFind);
var modalTop = 0;
//$("html, body").animate({ scrollTop: 0 }, "slow");
//$('#popover-content2').append(oData);
// iya-keycodes-anchor
$('.iya-keycodes-anchor').click(function (e) {
popover_content = $('.iya-keycodes').attr('rel');
var oData = $('#'+popover_content).html();
$('#popover-content2').empty();
if (IsMobile) {
$('#thefa-popover').css({ 'width': '90%', 'min-height': '90%' });
} else {
$('#thefa-popover').css({ 'width': '200px', 'min-height': '72px' });
}
$('#popover-content2').html(oData);
$(this).thefaModal({ top: modalTop, closeButton: ".modal_close", modal_id: '#thefa-popover' });
});
$('.iya-mobile-filterby').click(function (e) {
$('.iya-filter').toggleClass("showfilter");
/*
popover_content = $(this).attr('rel');
var oData = $('.iya-filter').html();
$('#popover-content2').empty();
if (IsMobile) {
$('#thefa-popover').css({ 'width': '90%', 'min-height': '90%' });
} else {
$('#thefa-popover').css({ 'width': '200px', 'min-height': '72px' });
}
$('#popover-content2').html(oData);
$(this).thefaModal({ top: modalTop, closeButton: ".modal_close", modal_id: '#thefa-popover' });
*/
});
$('.iya-filter ul a').click(function (e) {
//e.preventDefault();
$('#iya-ani').css({ "display": "block" });
});
$('#useMyLocation').click(function (e) {
e.preventDefault();
if (navigator && navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
setSearchLatLng(position.coords.latitude, position.coords.longitude);
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
OnGeocodeSelected(results[0], true);
} else {
alert('No results found');
}
} else {
alert('Geocoder failed due to: ' + status);
}
});
},
function (positionNotFound)
{ alert('Please turn on Location Services'); }
);
}
else {
alert('Not allowed');
}
});
setTimeout(function () {
$('input, textarea, a, select').removeAttr("tabindex");
$("a.topnavSignin, #nav-form, nav.adaptive-navigation a, select#p_Gender, input#st, a#useMyLocation, a.pw-button, .grid_2 > a, .iya-filter > a").each(function (i) {
$(this).attr('tabindex', i + 1);
$('.skip').attr('tabindex', -1);
});
$('a.pw-button').keydown(function (e) {
if (e.keyCode == 13) {
txt = $(this).find('.pw-button-type-looknative__txt').html();
_tibtn = $(this).find('.pw-button-type-looknative');
$(_tibtn).trigger('click');
}
})
}, 3000);
//geocode setup
//$("input, textarea, a, select").each(function (i) { //, , .iya-filter #iyaform select, .grid_2 a
//$(".adaptive-navigation a").each(function (i) {
// $(this).attr('tabindex', i + 1);
//});
});
$(document).ready(function () {
$('#all-towns-btn').click(function (e) {
e.preventDefault();
$('#all-towns').show();
$('#popular-towns').hide();
});
var form = $('#divContactSseFootball').html();
$('.iya-results .btnShowContactClubForm').click(function (event) {
event.preventDefault();
var teamID = $(this).data('teamid')
var team = $(this).closest('li');
team.siblings().find('.pf-club-enquiry-form').remove();
team.siblings().find('.btnShowContactClubForm').removeClass('close');
team.siblings().find('.iya-book-btn').text('Contact');
if ($('.grid_2.teams .pf-club-enquiry-form').length) {
$('.grid_2.teams .pf-club-enquiry-form.club-form').remove();
$('.iya-type-details .iya-book-btn').removeClass('disabled');
team.siblings().find('.iya-book-btn').text('Close');
}
$(this).toggleClass('close');
if ($(this).hasClass('close')) {
$('#divContactSseFootball').empty();
team.append(form);
$('.iya-results .pf-club-enquiry-form').show();
$('.iya-results .pf-club-enquiry-form .TeamId').val(teamID);
$(this).find('.iya-book-btn').text('Close');
} else {
$('#divContactSseFootball').append(form);
$('.iya-results .pf-club-enquiry-form').hide();
team.find('.pf-club-enquiry-form').remove();
$(this).find('.iya-book-btn').text('Contact');
}
//$('.iya-book-btn').addClass('disabled');
//$(".pf-club-enquiry--error").hide();
//$(".pf-club-enquiry--complete").hide();
//if ($(".pf-club-enquiry--form").is(":hidden")) {
// $(".pf-club-enquiry--form").show();
//}
//if ($(".pf-club-enquiry--submit").is(":hidden")) {
// $(".pf-club-enquiry--submit").show();
//}
//if ($(".pf-club-enquiry").is(":hidden")) {
// $(".pf-club-enquiry").slideDown("slow");
//}
});
$('.iya-type-details .btnShowContactClubForm').click(function (event) {
event.preventDefault();
var closeButton = '';
if ($('.iya-results .pf-club-enquiry-form').length) {
$('.iya-results .pf-club-enquiry-form').remove();
$('.iya-results .btnShowContactClubForm').removeClass('close');
$('.iya-results .btnShowContactClubForm .iya-book-btn').text('Contact');
}
if ($('.grid_2.teams .pf-club-enquiry-form.club-form').length) {
return false;
}
$('.grid_2.teams').prepend(form);
$('.grid_2.teams .pf-club-enquiry-form').show().addClass('club-form');
$(closeButton).prependTo(".grid_2.teams .pf-club-enquiry-form");
$('.iya-type-details .iya-book-btn').addClass('disabled');
});
$(document).on('click', '.pf-club-enquiry-form--header .close-button', function () {
$('.pf-club-enquiry-form.club-form').remove();
$('.iya-type-details .iya-book-btn').removeClass('disabled');
});
// Configure/customize these variables.
var showChar = 186; // How many characters are shown by default
var ellipsestext = "...";
var readMore = "Read more";
var readLess = "Read less";
$('.club-information__text').each(function () {
var content = $(this).html();
if (content.length > showChar) {
//console.log(content.length);
//console.log(showChar);
var shortText = content.substr(0, showChar);
var longText = content.substr(showChar, content.length - showChar);
var html = shortText + '
' + ellipsestext + '' + longText + '' + readMore + '';
$(this).html(html);
}
});
$(".morelink").click(function () {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(readMore);
} else {
$(this).addClass("less");
$(this).html(readLess);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
$(document).on('click', '#btnContactClubFootball', function () {
event.preventDefault();
var element = $(this);
var action = element.attr("href");
//alert($(".googleRecaptha").val());
$.ajax({
type: "POST",
url: action,
dataType: "json",
data: {
'FaDwCentreId': $(".contactFaDwCentreId").val(),
'FirstName': $(".contactFirstName").val(),
'LastName': $(".contactLastName").val(),
'Email': $(".contactEmail").val(),
'Message': $(".contactMessage").val(),
'ContactNo': $(".contactContactNo").val(),
'gRecaptha': $(".googleRecaptha").val()
},
cache: false,
success: function (data) {
if (!data.ErrorMessage) {
$(".pf-club-enquiry-fields").slideUp("slow");
$(".pf-club-enquiry-form--submit").slideUp("slow");
$(".pf-club-enquiry-form--error").slideUp("slow");
$(".pf-club-enquiry-form--complete").slideDown("slow");
$(".contactFirstName").val("");
$(".contactLastName").val("");
$(".contactEmail").val("");
$(".contactMessage").val("");
$(".contactContactNo").val("");
}
else {
$(".errorMessageLabel").text(data.ErrorMessage);
$(".pf-club-enquiry-form--error").slideDown("slow");
}
},
error: function (e) {
$(".errorMessageLabel").text(e.ErrorMessage);
$(".pf-club-enquiry-form--form").slideUp("slow");
$(".pf-club-enquiry-form--error").slideDown("slow");
}
});
});
});