﻿
/*** file: default.aspx ***/
// begin script voor zoekvak linkerkolom
$(document).ready(function () {

    if (window.location.search.substring(1) == 'Lezers') {
        $('#ctl00_cphKolomLinks_txtZoekLinks').val('lezer');
        $('#ctl00_cphKolomLinks_txtZoekLinks').focus(function () {
            if ($(this).val() == 'lezer') {
                this.value = '';
            }
            $(this).removeClass('reageerboxNietActief').addClass('reageerboxActief');
        });
        $('#ctl00_cphKolomLinks_txtZoekLinks').blur(function () {
            if ($(this).val() == '') {
                $(this).removeClass('reageerboxActief').addClass('reageerboxNietActief');
                this.value = 'lezer';
            }
        });
    }
    else {
        $('#ctl00_cphKolomLinks_txtZoekLinks').val('auteur');
        $('#ctl00_cphKolomLinks_txtZoekLinks').focus(function () {
            if ($(this).val() == 'auteur') {
                this.value = '';
            }
            $(this).removeClass('reageerboxNietActief').addClass('reageerboxActief');
        });
        $('#ctl00_cphKolomLinks_txtZoekLinks').blur(function () {
            if ($(this).val() == '') {
                $(this).removeClass('reageerboxActief').addClass('reageerboxNietActief');
                this.value = 'auteur';
            }
        });
    }
    
    // zorgen dat de zoekfunctie wordt uitgevoerd bij enter-toets
    $('#ctl00_cphKolomLinks_txtZoekLinks').keypress(function (event) {
        if (event.keyCode == '13') {
            zoekenLinks();
        }
    });

});

function zoekenLinks() {
        var type = (window.location.search.substring(1) == 'Lezers' ? 'Lezer' : 'Auteur')
        if (document.getElementById("ctl00_cphKolomLinks_txtZoekLinks").value.toString().length > 0 && document.getElementById("ctl00_cphKolomLinks_txtZoekLinks").value != 'titel/auteur') {
            //document.forms["aspnetForm"].action = "Default.aspx?Zoek=" + document.getElementById("ctl00_cphKolomLinks_txtZoekLinks").value + "&Type=" + type;
            //document.forms["aspnetForm"].__VIEWSTATE.name = 'NOVIEWSTATE';
            //document.forms["aspnetForm"].submit();
            window.location = "Default.aspx?Zoek=" + document.getElementById("ctl00_cphKolomLinks_txtZoekLinks").value + "&Type=" + type;
        }
        else {
            alert("Gelieve een zoekterm op te geven");
        }
    }


/*** file: topbanner.ascx ***/
// begin script voor zoekvak topbanner
    $(document).ready(function() {
        $('#txtZoekTop').focus(function() {
            if ($(this).val() == 'zoek') {
                this.value = '';
            }
            $(this).removeClass('reageerboxNietActief').addClass('reageerboxActief');
        });
        $('#txtZoekTop').blur(function() {
            if ($(this).val() == '') {
                $(this).removeClass('reageerboxActief').addClass('reageerboxNietActief');
                this.value = 'zoek';
            }
        });
    });

/*** file: links/genres.ascx ***/
    // grijs weghalen uit kader
    $(document).ready(function() {
        if ($('#kaderlinks #lijstgenres').length != 0)
        {
            $('#kaderlinks').removeClass('kaderlinksgrijs')
        }
    });


    function queryString(param) {
        qs = window.location.search.substring(1);
        arr = qs.split("&");
        for (i = 0; i < arr.length; i++) {
            ft = arr[i].split("=");
            if (ft[0] == param) {
                return ft[1];
            }
        }
    }

