﻿$(document).ready(function() {

    // Builds the tooltips
    $('a.tooltip').each(function() {
        $(this).qtip(
        {
            content: { url: '/App_Handlers/Tooltip.ashx?id=' + $(this).attr('id'),
                style: { name: 'dark' }
            },
            position: { target: 'mouse', adjust: { x: 10, y: 10} },
            style: { background: '#F4F4F4', width: 300, padding: 10, border: { width: 10, radius: 10, color: '#FFF'} },
            show: { effect: { length: 100} }
        });
    });

    // Set form focus
    $("#ctl00$txtSearch").focus();
    $("form input").keypress(function(e) {
        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
            $('button[type=submit] .default').click();
            return true;
        }
    });

    // Watermark
    $("#ctl00_txtSearch").Watermark("Zoeken...", "#AAA");

    // Autocomplete
    $("#ctl00_txtSearch").autocomplete('/App_Handlers/Autocomplete.ashx');

    // Hover a row in <tbody>
    $("table.results tr").hover(
    function() {
        // This gets executed on mouse-over
        $(this).addClass('highlight');
    },
    function() {
        // This is the callback, so it gets executed on mouse-out
        $(this).removeClass('highlight');
    }
    );

});