click() function in Firefox problem

click() function in Firefox problem

I am using the following code to hide a form when the window is clicked anywhere, except on the form area itself:

$(document).click(function(){
      $('#contactForm').fadeOut(1000);
});
 
$('#contactForm').click(function(event){
      event.stopPropagation();
})

In chrome everything works smoothly, however in Firefox whenever I right-click anywhere on the page (including on the form), the event click is triggerred and the function fadeOut() is executed. Anyone have any ideas?

Kind regards,
Orestis