$(function () {
    $('a.reveal').click(function () {
        $(this.hash).slideDown();
        return false;
    });
	

   $("div.voteSwap input").keypress(function (e) {  
       if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
            return false;  
       } 
   });  

    // fieldset narrows down the selector
    $('fieldset div.voteSwap').each(function () {
        var select = $('span.selectEntrant', this);
        var input = $('span.suggestEntrant', this);
        var label = $('label', this);
        
        select.find('a').click(function () {
            select.hide();
            input.css('display', 'inline');
            label.attr('for', input.find('input').trigger('focus').attr('id'));            
            return false;
        });
        input.find('a').click(function () {
            input.hide();
            select.css('display', 'inline');
            label.attr('for', select.find('select').trigger('focus').attr('id'));            
            return false;
        });
    });
});
