jQuery.fn.extend({
	ieHover: function() {
		if($.browser.msie) { 
			$(this).hover(
				function(){ $(this).addClass("hover"); },
				function(){ $(this).removeClass("hover"); }
			);
		}
		return this;
	}
});

$().ready( function() { 

	$('button, h3, #footer').ieHover();
	
	$('#enter div.theForm').hide();
	
	$('#enter h3').bind ( 'click', showThis );	
	$('body').bind ( 'click', closeOther );
	
	function showThis () {
			$(this).unbind('click', showThis);
			$(this).addClass('hover');
			closeOther();
			
			$formDiv = $(this).parent();
			$formDiv.addClass('open');
			$theForm = $('div.theForm', $formDiv);
			$theForm.animate( { height: 'show' }, 200 );
			$('input', $formDiv).eq(0).focus();
			
			$('#enter div.theForm').not($theForm).animate( { height: 'hide' }, 200 );
			$('#enter h3').not($(this)).removeClass('hover').ieHover();
	}
	
	function closeOther() {
		$('#enter .open h3').bind('click', showThis ).removeClass('hover');
		$('#enter .open div.theForm').animate({height: 'hide'}, 200);
		$('#enter input').each(function() { 
			$(this).get(0).blur();
		});
	}
	
	$('#enter').click( function (event) {
		event.stopPropagation();
	});	
	
	today = new Date().getFullYear();
	$('.copyyears').text('2000-' + today);
});
