HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers68/resortouddorpduin.nl/wwwroot/public/js/ouddorp.js
$(document).ready(function() {
    /**
     * Initialise photosliders
     */
    spamCheck();
    investHeader();


    $(".anders").keypress(function () {
        $('.checkanders').prop('checked', true);
    });

    var $player = $('.player');
    $player.slider({loop: 3000});

    $('#next').bind('click', function () {
        $player.data('slider').next();
    });

    $('#prev').bind('click', function () {
        $player.data('slider').prev();
    });

    $(window).resize(function () {
        if($('.player').length) {
            $player.data('slider').adjust();
        }
        investHeader();

        if($('.news .article').count != 0 ){
            $('.news .build').height($('.news .article').height());
        }
    });
    $( window ).scroll(function() {
        //investHeader();
    });

    var max = 8;


    $('.bouw .selector svg #duinvallei, .bouw .selector .backup-nav .duinvallei').click(function(){
        clickBuildSelector('duinvallei');
        $('.header-image .content-image img').attr('src', '/public/images/static/bouw/bouwpagina-header_vallei.jpg');
        $('.header-image .home-wave img').attr('src', '/public/images/static/bouw/bouwbord_nl.png');
    });

    $('.bouw .selector svg #duinzone, .bouw .selector .backup-nav .duinzone').click(function(){
        clickBuildSelector('duinzone');
        $('.header-image .content-image img').attr('src', '/public/images/static/bouw/bouwpagina-header_zone.jpg');
        $('.header-image .home-wave img').attr('src', '/public/images/static/bouw/bouwbord_nl.png');
    });

    $('.bouw .selector svg #voorziening, .bouw .selector .backup-nav .voorziening').click(function(){
        clickBuildSelector('voorziening');
        $('.header-image .content-image img').attr('src', '/public/images/static/bouw/bouwpagina-header_voor.jpg');
        $('.header-image .home-wave img').attr('src', '/public/images/static/bouw/bouwbord_nl-2.png');
    });
    var tempClass = 'st1';
    $('svg #duinzone #duinzone_path, svg #duinvallei #duinvallei_path, svg #voorziening #voorziening_path').hover(
        function(){
            tempClass = $(this).attr('class');
            $(this).attr('class', 'map-hover '+tempClass);
        },
        function () {
            $(this).attr('class', tempClass);
    });

    function clickBuildSelector(clicked){
        $('svg #duinzone #duinzone_text, svg #duinvallei #duinvallei_text, svg #voorziening #voorziening_text').attr('class', 'st3 st4 st5');
        $('svg #duinzone #duinzone_path, svg #duinvallei #duinvallei_path, svg #voorziening #voorziening_path').attr('class', 'st1');
        $('.slider-duinvallei, .slider-duinzone, .slider-voorziening').hide();

        $('.slider-'+clicked).show();
        tempClass = 'st12';
        $('svg #'+clicked+' #'+clicked+'_text').attr('class', 'st13 st4 st5');
        $('svg #'+clicked+' #'+clicked+'_path').attr('class', 'st12');

        max = 8;
        showBuildImages();
    }

    if($('.news .article').count != 0 ){
        $('.news .build').height($('.news .article').height());
    }

    $('.ridderstee .close-pop-up').click(function(){
        $('.ridderstee').hide();
    });


    if($('.bouw .slideshowimg').length>0){
        showBuildImages();
    }

    $('.loadMoreBuildings').click(function(){
       max += 8;
        showBuildImages();
    });

    function showBuildImages(){

        $photoBlocks = ['slider-duinzone', 'slider-duinvallei', 'slider-voorziening'];
        $.each($photoBlocks, function (index, slider) {
            $tempCounter = 0;
            $('.bouw .'+slider+' .slideshowimg').each(function(){
                $tempCounter++;
                if($tempCounter > max){
                    $(this).hide();
                }
                else{
                    $(this).show();
                }
            });

            if(max >= $('.bouw .'+slider+' .slideshowimg').length){
                $('.'+slider+' .loadMoreBuildings').hide();
            }
        });

    }

    var newsMax = 6;

    if($('.newsoverview .newsitem').length>0){
        showNewsitems();
    }

    $('.loadMoreNews').click(function(){
        newsMax += 6;
        showNewsitems();
    });

    function showNewsitems(){
        $tempCounter = 0;

        $('.newsoverview .newsitem').each(function(){
            $tempCounter++;
            if($tempCounter > newsMax){
                $(this).hide();
            }
            else{
                $(this).show();
            }
        });

        if(newsMax >= $('.newsoverview .newsitem').length){
            $('.loadMoreNews').hide();
        }

    }

    // Text field
    var $textField = $('input[type=text], textarea');

    if (!isIphone()) {
        // Set focus when click on placeholder
        $textField.siblings('.placeholder').click(function () {
            $(this).siblings('input').focus();
            $(this).siblings('textarea').focus();
        });

        // Check starting values
        $textField.each(function () {
            if ($(this).val() != '') {
                $(this).parent().children('.placeholder').html('');
            }
        });

        // On focus
        $textField.focus(function () {
                // Focus
                $(this).parent().addClass('focus');
            }
        ).keydown(function () {
                // Empty placeholder
                $(this).parent().children('.placeholder').html('');
            }
        );
        $textField.blur(
            function () {
                // Blur
                $(this).parent().removeClass('focus');

                // Restore placeholder if field is empty
                var label = $(this).attr('data-label');
                if ($(this).val() == "") {
                    $(this).parent().children('.placeholder').html(label);
                }
            }
        );
    }
    else {
        $textField.parent().children('.placeholder').html('');
    }


    // mobile nav


    $("#responsive_nav").click(function () {
        $(".nav").toggleClass("show");
        $(this).toggleClass("active");
    })

    //image home
    // var newheight = $(".home .header-image").height();
    // if (newheight != 0)
    // {
    //     $(".home-wave img").height(newheight+'px');
    //     $(".home-wave img").css("max-height",newheight+'px');
    // }

    // forms
    $('.algemenevoorwaarden input[type=checkbox]').click(function () {
        if ($(this).is(':checked') == true) {
            $('input[type="submit"]').removeAttr("disabled");
        }
        else {
            $('input[type="submit"]').attr("disabled","disabled");
        }
    });

    // fancybox slideshow
    $(".slideshowimg").fancybox();


    // overview map

    $( ".legenda_item" ).mouseover(function() {
        $(".legenda_item").removeClass("active");

        $('.hover-state #plattegrond_'+$(this).attr('id')).show();
        $('#plattegrond_img').css('visibility', 'hidden');
        $(this).addClass("active");
    });
    $( ".legenda_item" ).mouseout(function() {
        $(".legenda_item").removeClass("active");
        $('.hover-state #plattegrond_'+$(this).attr('id')).hide();
        $('#plattegrond_img').css('visibility', 'visible');
    });

// cookies for contact
/*
    var cookiename = setcookiename();

    if (!$.cookie(cookiename)) {
        $.cookie(cookiename, "", {path: '/' });

    }

    checkcookie();



    // Delete or add cookie after change checkboxes


    $('#change_informatiewinkel input[type=checkbox]').click(function () {

        var cookiename = setcookiename();

        if ($(this).is(':checked') == true) {
            var CurrentSelection = $.cookie(cookiename);
            $.cookie(cookiename, CurrentSelection + $(this).val() + '; ', {path: '/' });

            checkcookie();

        } else {
            var CurrentSelection = $.cookie(cookiename);
            CurrentSelection = CurrentSelection.replace($(this).val() + '; ', "");
            $.cookie(cookiename, CurrentSelection, {path: '/' });

            checkcookie();
        }

    });




    $('#toevoegen').click(function () {
        var cookiename = setcookiename();

        $(this).toggleClass("active");
        var value = $("#woningtitle").html();
        if ($(this).hasClass("active")) {
            var CurrentSelection = $.cookie(cookiename);
            CurrentSelection = CurrentSelection.replace(value + '; ', "");
            $.cookie(cookiename, CurrentSelection, {path: '/' });

            checkcookie();
        }
        else {
            var CurrentSelection = $.cookie(cookiename);
            $.cookie(cookiename, CurrentSelection + value + '; ', {path: '/' });

            checkcookie();
        }
    });*/

    window.setTimeout(function() {
        investHeader();
    }, 1500);

    $('.invest-reasons .reasons-block ul li').click(function(){
       $('.invest-reasons .reasons-block ul li.active').removeClass('active');
        $(this).addClass('active');
        $('.invest-reasons .text-holder .active').removeClass('active');
        $('.invest-reasons .text-holder #'+$(this).attr('id')+'-text').addClass('active');

        var maxHeightInvest = $('.text-holder .active').height();

        $('.text-holder>div').each(function(){
           if(maxHeightInvest < $(this).height()){
               maxHeightInvest = $(this).height();
           }
        });

        $('.text-holder').height(maxHeightInvest);
        $('.text-holder .active').height(maxHeightInvest);
        $('.text-holder .image-container').height((maxHeightInvest - 100));

        window.setTimeout(function() {
            investHeader();
        }, 200);


        if($(window).width()<=800){
            $('html,body').animate({
                scrollTop: $('#'+$(this).attr('id')+'-text').offset().top - 20
            }, 500);
        }
    });

});

/*
function checkcookie() {

    var cookiename = setcookiename();



    $('#change_informatiewinkel input[type=checkbox]').prop('checked', false);

    // check values and select checkboxes

    var CurrentSelection = $.cookie(cookiename);

    var value = $("#woningtitle").html();
    if(CurrentSelection.indexOf(value) > -1) {

        $('#toevoegen').removeClass("active");

    }
    else {
        $('#toevoegen').addClass("active");
    }

    CurrentSelection = CurrentSelection.substring(0, CurrentSelection.length - 2);

    CurrentSelection = CurrentSelection.split("; ");
    if (CurrentSelection != '') {
        if (CurrentSelection.length >= 1) {
            $(".informatiewinkel").css("display","block");
            $(".informatiewinkel span").html(CurrentSelection.length);
        }
    }
    else {
        $(".informatiewinkel").css("display","none");
    }
    for(var i = 0; i < CurrentSelection.length; i++)
    {

        $('input[value="'+CurrentSelection[i]+'"]').prop('checked', true);

    }

}


function deletecookie() {

    var cookiename = setcookiename();

    $.cookie(cookiename, "", {path: '/' });
    checkcookie();
}


//set cookie name per lang

function setcookiename() {
    var cookiename;
    if(window.location.href.indexOf("/de/") > -1) {
        cookiename = "ResortOuddorpDuinDE";
    }
    else {
        cookiename = "ResortOuddorpDuinNL";
    }
    return cookiename;
}*/

function isIphone()
{
    //return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) );
    return ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)));
}

function spamCheck()
{
    var $form = $('form.spam_check');
    if($form.size()){
        $('<input type="hidden" />').attr({ name: 'secret_code', id: 'secret_code', value: 'spam_check_komma' }).appendTo($form);
    }
}

function investHeader(){
    if($('.invest-page .header-image').length >= 1){
        $('.invest-page .header-image').height($('.invest-page .header-image .invest').height() + 60);
        // if($('.invest-page .header-image .content-image').height() < $('.invest-page .header-image').height()){
        //     $('.invest-page .header-image').height($('.invest-page .header-image .content-image').height());
        // }
    }
    if($('.reasons-block ul li').length >= 1){
        $('.reasons-block ul li').height($('.reasons-block ul li').width()*0.75);
    }
    if($('.text-holder').length >= 1){
        $('.text-holder').height('auto');
        $('.text-holder .active').height('auto');
        $('.text-holder .image-container').height('auto');

        var maxHeightInvest = $('.text-holder .active').height();

        $('.text-holder>div').each(function(){
            if(maxHeightInvest < $(this).height()){
                maxHeightInvest = $(this).height();
            }
        });

        $('.text-holder').height(maxHeightInvest);
        $('.text-holder .active').height(maxHeightInvest);
        $('.text-holder .image-container').height((maxHeightInvest - 100));
    }
}