/**
 * Init JS
 */
$(document).ready(function() {
    // Search action
    $('button.search').click(performSearch);
    
    // Mailto replacement
    $('a.email').attr('href', 'mailto:ivdburg@gmail.com');
});

/**
 * Perform search call
 * 
 * @param string fieldID The ID of the input field
 */
function performSearch(e)
{
    if (e) {
        e.preventDefault();
    }
    var $button = $(this);
    var $field = $('#' + $button.attr('rel'));
    if ($field.length) {
        var value = escape($field.val());
        if (typeof(value) == 'string' && value) {
            window.location = jsVars.relDir + 'search/' + value;
        }
    }
}
