﻿function formatText(index, panel) {
    return index + "";
}


var map = new function() {
    this.onmouseover = function(object) {
        document.getElementById('tooltip' + object).style.display = 'block';
    }

    this.onmouseout = function(object) {
        document.getElementById('tooltip' + object).style.display = 'none';
    }

}



var formfunctions = new function() {
    this.onfocus = function(Element) {
        if (Element.value.length == 0 || Element.value == Element.title || Element.title == "") {
            Element.title = Element.value;
            Element.alt = Element.value;
            Element.value = "";
        }
    }

    this.onblur = function(Element) {
        if (Element.value.length == 0 || Element.value == Element.title) {
            Element.value = Element.title
            Element.alt = ""
            Element.title = ""
        }
    }


    this.Paging = function(currentPage, newPage) {
        var isK = false;
        var questionCount = eval("document.Test.question" + currentPage + ".length")
        var option;


        for (i = 0; i < questionCount; i++) {
            option = eval("document.Test.question" + currentPage + "[" + i + "].checked")

            if (option) { isK = true };
        }
        if (isK) {
            document.getElementById('page' + currentPage).style.display = 'none';
            document.getElementById('page' + newPage).style.display = 'block';
        }
        else {
            alert('vraag niet ingevuld');
        }
    }

    this.submit = function(selectedform, questionCount) {
        var isK = 0;
        for (i = 1; i <= questionCount; i++) {
            var answerCount = eval("document.Test.question" + i + ".length")
            var givenAnswers = 0;
            for (j = 0; j < answerCount; j++) {
                option = eval("document.Test.question" + i + "[" + j + "].checked")
                if (option) { givenAnswers += 1 };
            }

            if (givenAnswers > 0) {isK += 1 }

        }
        
        
        
        
        if (isK == questionCount) {
            eval('document.getElementB' + selectedform + '.submit();')
        }
        else {
            alert('vraag niet ingevuld');
        }





    }

    this.formsubmit = function(selectedform) {
        if (Validate(selectedform)) { eval('document.getElementById(\'' + selectedform + '\').submit();') }
    }


    this.formsearchsubmit = function(selectedform) {

        if (eval('document.' + selectedform + '.searchvalue.value.length') == 0) {
            eval('document.' + selectedform + '.searchvalue.style.backgroundColor = "#FFAF95"')
            eval('document.' + selectedform + '.searchvalue.focus()')
            alert("Geef minimaal één letter op.")
        }
        else {
            eval('document.' + selectedform + '.submit();')
        }

    }



}



function ShowHideFaq(object) {
    var objectDisplayOption = document.getElementById(object.id + 'description')
    var objectDisplayController = document.getElementById(object.id + 'controller')
    if (objectDisplayOption.style.display == '' || objectDisplayOption.style.display != 'block') {
        objectDisplayOption.style.display = 'block'
        objectDisplayController.className = 'image active'

    }
    else {
        objectDisplayOption.style.display = 'none'
        objectDisplayController.className = 'image'

    }
}



function showhide(object) {
    var objectDisplayOption = document.getElementById(object)
    var objectDisplayController = document.getElementById(object + 'title')



    if (objectDisplayOption.style.display == '' || objectDisplayOption.style.display != 'block') {
        objectDisplayOption.style.display = 'block'
        objectDisplayController.className = 'titel active'

    }
    else {
        objectDisplayOption.style.display = 'none'
        objectDisplayController.className = 'titel'

    }


}


function selectPage(object) {



    if (object.options[object.selectedIndex].value != 0) {
        window.location.href = object.options[object.selectedIndex].value
    }
    else {
        return false;
    }
}



function showpopup(parentdiv) {
    document.getElementById('popup' + parentdiv).style.display = 'block'
}

function hidepopup(parentdiv) {
    document.getElementById('popup' + parentdiv).style.display = 'none'
}




jQuery(document).ready(function() {

    jQuery("#datepicker").datepicker({ dateFormat: 'dd-mm-yy',  minDate: '0d', firstDay: 1  })
    jQuery("#datepickerbirthdate").datepicker({ dateFormat: 'dd-mm-yy', changeYear: true, changeMonth: true, minDate: new Date(1900, 1 - 1, 1), maxDate: new Date()});



    jQuery('#sundaysale').mouseover(function() {
        if (jQuery('#sundaysale').css('top') == "-51px") {
            jQuery('#sundaysale').animate({ top: "32px" }, 200);
        }
    });



    jQuery('#sundaysale').mouseout(function() {
        if (jQuery('#sundaysale').css('top') == "32px") {
            jQuery('#sundaysale').animate({ top: "-51px" }, 200);
        }
    });



    jQuery(function() {



        jQuery('.anythingSlider').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 3000,                    // How long between slide transitions in AutoPlay mode
            startStopped: false,            // If autoPlay is on, this can force it to start stopped
            animationTime: 600,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
            pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
            startText: "Go",             // Start text
            stopText: "Stop",               // Stop text
            navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
        });

        jQuery("#slide-jump").click(function() {
            jQuery('.anythingSlider').anythingSlider(6);
        });

        jQuery('.anythingSliderActie').anythingSlider({
            easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
            autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
            delay: 3000,                    // How long between slide transitions in AutoPlay mode
            startStopped: false,            // If autoPlay is on, this can force it to start stopped
            animationTime: 600,             // How long the slide transition takes
            hashTags: true,                 // Should links change the hashtag in the URL?
            buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
            pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
            startText: "Go",             // Start text
            stopText: "Stop",               // Stop text
            navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
        });


    });





});


