Working with checkboxes in jQuery.

$(document).ready(function() {

  $loginForm = $('#login-form');
  var url = $loginForm.attr('action');

  $('#secure').change(function() {
    url = $loginForm.attr('action');

    if ($(this).is(':checked')) {
      $loginForm.attr('action', url.replace('http', 'https'));
      Cookie.set('ssl', 1, { expires: 30 });
    } else {
      $loginForm.attr('action', url.replace('https', 'http'));
      Cookie.set('ssl', 0, { expires: 30 });
    }
  });

});