$(document).ready( function() {

    $('.number').bind('keydown keyup change blur', function() {

        if ($('.calculate-maxhyp .req').val().length)
            $('.calculate-maxhyp .submit').removeClass('disabled');
        else
            $('.calculate-maxhyp .submit').addClass('disabled');

    });

    if ($('.box_type-26 input:checkbox[name$=cboxSaveIndication], .box_type-26 input:checkbox[name$=cboxSaveMaxPrice]')
	    .filter('input:checked').size() > 0) {
        $('.box_type-26 .confirmres').removeClass('disabled');
    } else {
        $('.box_type-26 .confirmres').addClass('disabled');
    }

    $('.box_type-26 input:checkbox[name$=cboxSaveIndication], .box_type-26 input:checkbox[name$=cboxSaveMaxPrice]').click(function() {
        if ($('.box_type-26 input:checkbox[name$=cboxSaveIndication], .box_type-26 input:checkbox[name$=cboxSaveMaxPrice]')
	        .filter('input:checked').size() > 0) {
            $('.box_type-26 .confirmres').removeClass('disabled');
        } else {
            $('.box_type-26 .confirmres').addClass('disabled');
        }
    });

    $('.box_type-26 .confirmres').click(function(e) {
        if ($(this).hasClass('disabled')) {
            e.preventDefault();
            e.stopImmediatePropagation();
            return false;
        }
    });

    $('input[name$=tboxL62LoginUsername], input[name$=tboxL62LoginPassword]')
		.bind('keypress', function(e) {
		    // check for ENTER
		    if (e.keyCode == 13) {
		        var submitButton = $('.wpL62 a[id$=btnLoginSubmit]');
		        if (validateLogicalForm.call(submitButton)) {
		            window.location = submitButton.attr('href');
		        }
		    }
		});

    $('input[name$=tboxL62SignUpEmailAddress], input[name$=tboxL62SignUpPassword], input[name$=tboxL62SignUpRetypePassword]')
		.bind('keypress', function(e) {
		    // check for ENTER
		    if (e.keyCode == 13) {
		        var submitButton = $('.wpL62 a[id$=btnSignUpSubmit]');
		        if (validateLogicalForm.call(submitButton) && !submitButton.hasClass('disabled')) {
		            window.location = submitButton.attr('href');
		        }
		    }
		});
		
} );