function set_button(o,s) {
    $(o).children('a:first').toggleClass('on');
}

function set_url(x, target) {
    if(target != undefined && target != '') {
        window.open(x, target);
    }
    else
        location = x;
}

function sw(o) {
    var spanClicked = $(o).next('span');
    spanClicked.slideToggle();
    $('.faq_item > h3 + span').not(spanClicked).slideUp();
}

function checkForEnter (event) {
    if (event.keyCode == 13) {
        //Enter
        return true;
    }
    return false;
}

function submitLogin() {
    if($.trim($('#email').val()) != '' && $.trim($('#password').val()) != '')
        $('#login').submit();

    return false;
}

function SelectCountry() {
    var selectedCountry = $('#landSelect option:selected').val();
    switch (selectedCountry) {
        case 'NL':
            $('#postcodeChars').show();
            $('#postcodeNumbers').attr('maxlength', 4);
            break;
        case 'DE' :
            $('#postcodeChars').hide();
            $('#postcodeNumbers').attr('maxlength', 5);
            break;
        default:
            $('#postcodeChars').hide();
            $('#postcodeNumbers').attr('maxlength', 4);
            break;
    }
}

$(document).ready(function() {
    PopupEventHandlers();
});

function PopupEventHandlers() {
    $('div.infoBlock').hide();
    $('span.infoButton').bind('mouseenter', function(){
        $(this).next('div.infoBlock').fadeIn(200);
    });
    $('span.infoButton').bind('mouseleave', function(){
        $(this).next('div.infoBlock').fadeOut(200);
    });
    $('span.infoButton').bind('mouseenter mousemove', function(e){
        $(this).next('div.infoBlock').css('marginLeft', 16 + e.pageX - $(this).parent('td').offset().left);
        $(this).next('div.infoBlock').css('marginTop', -12 + e.pageY - $(this).parent('td').offset().top);
    });
}
