
$(document).ready(function () {
    $('#menu ul li').each(function () {
        $(this).hoverIntent(function () {
            $(this).find('ul').slideDown("fast");
        },
		function () {
		    $(this).find('ul').slideUp("fast");
		});
    });
    $('.tbl_ras_informatie tr').hover(function () {
        $('.product-desc').removeClass('show');
        $('.ras_img').removeClass('show');
        $('.group_subgroup_overview .desc').addClass('hidden');
        $(this).closest('tr').toggleClass('over');
        var cur_pos = $(this).find('span').attr('id');
        var cur_desc = ".desc-" + cur_pos;
        var cur_img = ".img-" + cur_pos;
        $(cur_desc).addClass('show');
        $(cur_img).addClass('show');
    });

    $('.tbl_ras_informatie').mouseleave(function () {
        $('.product-desc').removeClass('show');
        $('.ras_img').removeClass('show');
        $('.group_subgroup_overview .desc').removeClass('hidden');
    });

    $('#select_language').change(function () {
        window.location = this.value;
    });

    $('.searchresultItem').mouseenter(function () { $(this).addClass('highlight'); });
    $('.searchresultItem').mouseleave(function () { $(this).removeClass('highlight'); });
    $('.searchresultItem').click(function () { location.href = $(this).attr('href'); });

    if ($('.slideshow')) {
        $('.slideshow img').last().css('opacity','0');
        //  initialize the slideshow when it is loaded into the page
        $('.slideshow').cycle({
            fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
            timeout: 8000, // time between 2 slides in ms
            speed: 1000 // transition speed in ms
        });
    };
});

function htmlEncode(value)
{
    return $('<div/>').text(value).html();
}

function htmlDecode(value)
{
    return $('<div/>').html(value).text();
}
