$(document).ready(function () { $(".mod-nav-main a.disable").unbind("click"); $(".mod-nav-main-mobile a.disable").unbind("click"); $(".mod-nav-main-mobile a.disable").click(function () { if ($(this).hasClass("disable")) { return false; } }); $('.slicknav_menu .golfparks').find('li').each(function () { if ($(this).find('ul').children().children().length == 0) { $(this).find('.slicknav_arrow').remove(); } }); $(".mod-nav-main .columns p.title").last().addClass("last"); $(".span_3_of_4.content-page .row.portrait").each(function () { $(this).find('.teaser').first().addClass("first"); $(this).find('.teaser').each(function (i, e) { if (i % 3 == 0) $(e).addClass('first'); }); }); $(".content-page .row.portrait").each(function () { $(this).find('.teaser').css("margin-top", "0"); }); $(".row.landscape").each(function () { $(this).find('.span_2_of_4').first().addClass("first"); }); $('.btnSearch').click(function () { if ($('.sb-search-input').val() != "") { window.location.href = $('#hfSearchUrl').val() + "?q=" + encodeURIComponent($('.sb-search-input').val()); } return false; }); $('.slicknav_menu .btnSearch').click(function () { if ($('.slicknav_menu .sb-search-input').val() != "") { window.location.href = $('#hfSearchUrl').val() + "?q=" + encodeURIComponent($('.slicknav_menu .sb-search-input').val()); } return false; }); $('.slicknav_menu .sb-search-input').keypress(function (e) { if (e.keyCode == 13) { window.location.href = $('#hfSearchUrl').val() + "?q=" + encodeURIComponent($('.slicknav_menu .sb-search-input').val()); } }); $('#ddFilterArea').change(function () { window.location.href = generateSearchUrl(); }); $('#contentSearch').keypress(function (e) { if (e.keyCode == 13) { window.location.href = generateSearchUrl(); } }); if (getParameterByName("f") != "") { $("#ddFilterArea").val(getParameterByName("f")); } $("#ddFilterArea").select2({ showSearchInput: false, placeholder: $('#hfChooseArea').val(), allowClear: true, minimumResultsForSearch: -1 }); $(".mod.mod-course-filter").find("input[type=radio]").each(function () { if ($('#hfCourseTypInput').val() == $(this).attr("filter")) { $(this).attr("checked", "checked"); $(this).parent().next().addClass("checked"); $(".mod.mod-course-list").each(function () { if ($(this).attr("filter") != $('#hfCourseTypInput').val()) { $(this).hide(); } }); } if ($('#hfGolfparkInput').val() == $(this).attr("filter")) { $(this).attr("checked", "checked"); $(this).parent().next().addClass("checked"); } }); $(".box .radiobox").each(function () { var i = $(this).find(".default-check").text(); $(this).find("input").each(function () { if ($(this).attr("filter") == i) { $(this).attr("checked", "checked"); $(this).parent().next().addClass("checked"); } }); }); if ($('#hfPrognoseText').val() != "") { $('.mod-weather .hpw_subtitle').text($('#hfPrognoseText').val()); } /* bug fix for ie 9 page editor after inserting new module */ if ($('body').hasClass("isPageEditor")) { $('.l-page').attr('style', 'width: 1280px !important;'); $('.l-body').attr('style', 'width: 1280px !important;'); //$('head').append(""); } /* QUICKLINKS */ if ($('#hfCurrentGolfpark').val() != "") { /* teetime */ if (dropdownContains('#teetime-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTeetime = $('#teetime-locationsource').prev().find('a').find('span').first(); selBoxTeetime.text($('#hfCurrentGolfpark').val()); selBoxTeetime.parent().removeClass("select2-default"); setCurrentVal('#teetime-locationsource'); } if (dropdownContains('#mobile-teetime-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTeetimeMobile = $('#mobile-teetime-locationsource').prev().find('a').find('span').first(); selBoxTeetimeMobile.text($('#hfCurrentGolfpark').val()); selBoxTeetimeMobile.parent().removeClass("select2-default"); setCurrentVal('#mobile-teetime-locationsource'); } /* teetime end */ /* tournaments */ if (dropdownContains('#tournament-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournament = $('#tournament-locationsource').prev().find('a').find('span').first(); selBoxTournament.text($('#hfCurrentGolfpark').val()); selBoxTournament.parent().removeClass("select2-default"); setCurrentVal('#tournament-locationsource'); } if (dropdownContains('#mobile-tournament-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournamentMobile = $('#mobile-tournament-locationsource').prev().find('a').find('span').first(); selBoxTournamentMobile.text($('#hfCurrentGolfpark').val()); selBoxTournamentMobile.parent().removeClass("select2-default"); setCurrentVal('#mobile-tournament-locationsource'); } /* tournaments end */ /* courses */ if (dropdownContains('#courses-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournament = $('#courses-locationsource').prev().find('a').find('span').first(); selBoxTournament.text($('#hfCurrentGolfpark').val()); selBoxTournament.parent().removeClass("select2-default"); setCurrentVal('#courses-locationsource'); } if (dropdownContains('#mobile-courses-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournamentMobile = $('#mobile-courses-locationsource').prev().find('a').find('span').first(); selBoxTournamentMobile.text($('#hfCurrentGolfpark').val()); selBoxTournamentMobile.parent().removeClass("select2-default"); setCurrentVal('#mobile-courses-locationsource'); } /* courses end */ /* pro */ if (dropdownContains('#pro-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournament = $('#pro-locationsource').prev().find('a').find('span').first(); selBoxTournament.text($('#hfCurrentGolfpark').val()); selBoxTournament.parent().removeClass("select2-default"); setCurrentVal('#pro-locationsource'); } if (dropdownContains('#mobile-pro-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournamentMobile = $('#mobile-pro-locationsource').prev().find('a').find('span').first(); selBoxTournamentMobile.text($('#hfCurrentGolfpark').val()); selBoxTournamentMobile.parent().removeClass("select2-default"); setCurrentVal('#mobile-pro-locationsource'); } /* pro end */ /* bcoach */ if (dropdownContains('#bcoach-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournament = $('#bcoach-locationsource').prev().find('a').find('span').first(); selBoxTournament.text($('#hfCurrentGolfpark').val()); selBoxTournament.parent().removeClass("select2-default"); setCurrentVal('#bcoach-locationsource'); } if (dropdownContains('#mobile-bcoach-locationsource', $('#hfCurrentGolfpark').val())) { var selBoxTournamentMobile = $('#mobile-bcoach-locationsource').prev().find('a').find('span').first(); selBoxTournamentMobile.text($('#hfCurrentGolfpark').val()); selBoxTournamentMobile.parent().removeClass("select2-default"); setCurrentVal('#mobile-bcoach-locationsource'); } /* bcoach end */ if (getParameterByName("mobile") == "1" || WURFL.form_factor != "Tablet" && WURFL.is_mobile) { handleQuickLinkMobileChange(null); loadProMobile(); loadBCoachMobile(); } else { loadPro(); loadBCoach(); handleQuickLinkChange(null); } } $('#teetime-date').val($('#hfCurrentDate').val()); $('#pro-date').val($('#hfCurrentDate').val()); $('#bcoach-date').val($('#hfCurrentDate').val()); $('.mobile-date').val($('#hfCurrentDate').val()); $('.btn-green.teetime').click(function () { var date = $('#teetime-date').val(); var link = getTeetimeLink() + "?code=" + $('#teetime-placesource').val() + "&startdate=" + date; var returnValue = $('#teetime-placesource').val() != "" && date != ""; if (returnValue) { var checkLink = getTeetimeLink(); var currentHost = window.location.host; var getTheHostName = getHostname(getTeetimeLink()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('.btn-green.pro').click(function () { var date = $('#pro-date').val(); var link = getProLink() + "?code=" + $('#pro-names').val() + "&startdate=" + date; var returnValue = $('#pro-names').val() != "" && date != ""; if (returnValue) { var checkLink = getProLink(); var getTheHostName = getHostname(getProLink()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('.btn-green.coach').click(function () { var date = $('#bcoach-date').val(); var link = getCoachLink() + "?code=" + $('#bcoach-names').val() + "&startdate=" + date; var returnValue = $('#bcoach-names').val() != "" && date != ""; if (returnValue) { var checkLink = getCoachLink(); var getTheHostName = getHostname(getCoachLink()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('.btn-green.tournament').click(function () { var clubId = getTournamentClubId(); var link = getTournamentLink(); var getTheHostName = getHostname(getTournamentLink()); if (location.hostname == getTheHostName) { if (link.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (link.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } }); $('.btn-green.tournament-mobile').click(function () { var clubId = getTournamentClubIdMobile(); var link = getTournamentLinkMobile(); var getTheHostName = getHostname(getTournamentLinkMobile()); if (location.hostname == getTheHostName) { if (link.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (link.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } }); $('.btn-green.courses').click(function () { var link = getCoursesLink(); var getTheHostName = getHostname(getCoursesLink()); if (location.hostname == getTheHostName) { if (link.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (link.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } }); $('.btn-green.courses-mobile').click(function () { var link = getCoursesLinkMobile(); var getTheHostName = getHostname(getCoursesLinkMobile()); if (location.hostname == getTheHostName) { if (link.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (link.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } }); $('.btn-green.teetime-mobile').click(function () { var date = $('.mobile-date').val(); var link = getTeetimeMobileLink() + "?code=" + $('#mobile-teetime-placesource').val() + "&startdate=" + date + "&mobile=1"; var returnValue = $('#mobile-teetime-placesource').val() != "" && date != ""; if (returnValue) { var checkLink = getTeetimeMobileLink(); var getTheHostName = getHostname(getTeetimeMobileLink()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('.btn-green.mobile-pro').click(function () { var date = $('.mobile-date.pro').val(); var link = getProMobileLink() + "?code=" + $('#mobile-pro-names').val() + "&startdate=" + date + "&mobile=1"; var returnValue = $('#mobile-pro-names').val() != "" && date != ""; if (returnValue) { var checkLink = getProMobileLink(); var getTheHostName = getHostname(getProMobileLink()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('.btn-green.mobile-coach').click(function () { var date = $('.mobile-date.coach').val(); var link = getCoachLinkMobile() + "?code=" + $('#mobile-bcoach-names').val() + "&startdate=" + date + "&mobile=1"; var returnValue = $('#mobile-bcoach-names').val() != "" && date != ""; if (returnValue) { var checkLink = getCoachLinkMobile(); var getTheHostName = getHostname(getCoachLinkMobile()); if (location.hostname == getTheHostName) { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.open(link, "_blank"); } else { window.location.href = link; } } else { if (checkLink.indexOf("golfparks/golfpark") > -1) { window.location.href = link; } else { window.open(link, "_blank"); } } } else { return false; } }); $('#pro-locationsource').change(function () { $('#pro-names').empty(); $.ajax({ url: "/Frontend/Layouts/Ajax/QuickLinks/GetProsByGolfpark.aspx", type: 'POST', dataType: 'json', data: { "GolfparkID": $(this)[0][$(this).val()].id }, success: function (data) { if (data.Success) { var result = ""; for (var i = 0; i < data.Pros.length; i++) { result += ""; } $('#pro-names').append(result); } else { $('#pro-names').append(""); } } }); }); $('#mobile-pro-locationsource').change(function () { $('#mobile-pro-names').empty(); $.ajax({ url: "/Frontend/Layouts/Ajax/QuickLinks/GetProsByGolfpark.aspx", type: 'POST', dataType: 'json', data: { "GolfparkID": $(this)[0][$(this).val()].id }, success: function (data) { if (data.Success) { var result = ""; for (var i = 0; i < data.Pros.length; i++) { result += ""; } $('#mobile-pro-names').append(result); } else { $('#mobile-pro-names').append(""); } } }); }); $('#bcoach-locationsource').change(function () { $('#bcoach-names').empty(); $.ajax({ url: "/Frontend/Layouts/Ajax/QuickLinks/GetCoachesByGolfpark.aspx", type: 'POST', dataType: 'json', data: { "GolfparkID": $(this)[0][$(this).val()].id }, success: function (data) { if (data.Success) { var result = ""; for (var i = 0; i < data.Pros.length; i++) { result += ""; } $('#bcoach-names').append(result); } else { $('#bcoach-names').append(""); } } }); }); $('#mobile-bcoach-locationsource').change(function () { $('#mobile-bcoach-names').empty(); $.ajax({ url: "/Frontend/Layouts/Ajax/QuickLinks/GetCoachesByGolfpark.aspx", type: 'POST', dataType: 'json', data: { "GolfparkID": $(this)[0][$(this).val()].id }, success: function (data) { if (data.Success) { var result = ""; for (var i = 0; i < data.Pros.length; i++) { result += ""; } $('#mobile-bcoach-names').append(result); } else { $('#mobile-bcoach-names').append(""); } } }); }); /* QUICKLINKS END */ /* COURSE FILTER */ if (getParameterByName("cat") != "") { var cat = getParameterByName("cat"); var result = 0; $('#mobile-coursefilter-cat').find('option').each(function (i) { if (cat == $(this).attr("filter")) { result = parseInt($(this).val()); } }); var dd = $('#mobile-coursefilter-cat').prev().find('a').find('span').first(); $('#mobile-coursefilter-cat').val(result); dd.text($($('#mobile-coursefilter-cat').find('option')[result + 1]).text()); dd.parent().removeClass("select2-default"); } else { var dd = $('#mobile-coursefilter-cat').prev().find('a').find('span').first(); $('#mobile-coursefilter-cat').val(0); dd.text($($('#mobile-coursefilter-cat').find('option')[1]).text()); dd.parent().removeClass("select2-default"); } if (getParameterByName("golfpark") != "") { var park = getParameterByName("golfpark"); var result = 0; $('#mobile-coursefilter-park').find('option').each(function (i) { if (park == $(this).data("golfpark")) { result = parseInt($(this).val()); } }); var dd = $('#mobile-coursefilter-park').prev().find('a').find('span').first(); $('#mobile-coursefilter-park').val(result); dd.text($($('#mobile-coursefilter-park').find('option')[result + 1]).text()); dd.parent().removeClass("select2-default"); } $('#mobile-coursefilter-park').change(function () { var courseFilter = getCourseFilter($(this)); $.ajax({ url: "/Frontend/Layouts/Ajax/CourseSearch/GetCourses.aspx", type: 'POST', dataType: 'json', data: { "Golfpark": courseFilter }, success: function (data) { if (data.Success) { var html = generateCourseHtml(data); $('.course.col.span_3_of_4 #courses').append(html); $('#mobile-coursefilter-cat').change(); } } }); }); $('#mobile-coursefilter-cat').change(function () { var type = getCourseFilter($(this)); if ($(".mod.mod-course-list[filter='" + type + "']").length > 0) { $('.course.col.span_3_of_4 #courses').show(); $('.course.col.span_3_of_4 #noCoursesFound').hide(); $('.course.col.span_3_of_4 #noMatrixFound').hide(); $(".mod.mod-course-list").each(function () { if ($(this).attr("filter") != type) { $(this).hide(); } else { $(this).show(); } }); } else { $('.course.col.span_3_of_4 #courses').hide(); $('.course.col.span_3_of_4 #noCoursesFound').hide(); $('.course.col.span_3_of_4 #noMatrixFound').show(); } }); /* COURSE FILTER END */ // tabs golfbahnen imagemap in content $('#golfbahnenimagemap area', $(this)).unbind().on('click', function () { $('.mod-content #nav .is-open').removeClass('is-open').hide(); $('.mod-content #nav').find('.active').removeClass('active'); $('.mod-content #nav li a[title=' + $(this).attr('alt') + ']').addClass('active'); $('.mod-content #nav li a[title=' + $(this).attr('alt') + ']').next('section').toggleClass('is-open').toggle(); return false; }); }); function isIE() { var ua = window.navigator.userAgent; var msie = ua.indexOf("MSIE "); return msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./); } /* COURSE FILTER */ function handlechange(radio, filter) { if (filter == "type") { var i = $(radio).attr("filter"); if ($(".mod.mod-course-list[filter='" + i + "']").length > 0) { $('.course.col.span_3_of_4 #courses').show(); $('.course.col.span_3_of_4 #noCoursesFound').hide(); $('.course.col.span_3_of_4 #noMatrixFound').hide(); $(".mod.mod-course-list").each(function () { if ($(this).attr("filter") != i) { $(this).hide(); } else { $(this).show(); } }); } else { $('.course.col.span_3_of_4 #courses').hide(); $('.course.col.span_3_of_4 #noCoursesFound').hide(); $('.course.col.span_3_of_4 #noMatrixFound').show(); } } else if (filter == "golfpark") { $.ajax({ url: "/Frontend/Layouts/Ajax/CourseSearch/GetCourses.aspx", type: 'POST', dataType: 'json', data: { "Golfpark": $(radio).attr("filter") }, success: function (data) { if (data.Success) { var html = generateCourseHtml(data); $('.course.col.span_3_of_4 #courses').append(html); handlechange($('.cat input:checked'), "type"); } } }); } } function generateCourseHtml(data) { $('.course.col.span_3_of_4 #courses').empty(); $('.course.col.span_3_of_4 #courses').show(); $('.course.col.span_3_of_4 #noCoursesFound').hide(); $('.course.col.span_3_of_4 #noMatrixFound').hide(); if (data.Results.length > 0) { var html = ""; for (var i = 0; i < data.Results.length; i++) { var e = data.Results[i]; html += "