I'm having some problems regarding cross-browser compatibility. I've implemented a jquery lightbox that works fine with all browsers except IE7 and IE8. To describe the bug the lightbox opens and then closes. The entire page then gets masked. The event.preventDefault and the event.returnValue = false simply aren't working: I've attached the code below. This is my first post to this site so forgive me if you need to post the code between specific tags.

$(document).ready(function() {

	$('a.login-window').click(function(event) {
        //Getting the variable's value from a link 
		var loginBox = $(this).attr('href');

		//Fade in the Popup
		//Set the center alignment padding + border see css style
		var popMargTop = ($(loginBox).height() + 240) / 2; 
		var popMargLeft = ($(loginBox).width() + 240) / 2; 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		// Add the mask to body
		$('body').append('<div id="mask"></div>');
  		event.preventDefault ? event.preventDefault() : event.returnValue = false;  

// here is the anchor:

<a href="#login-box" class="login-window">Click here</a>
Can anyone help me?