$(document).ready(function() {

$('#box').css('margin-top', -$('#box').height()/2);
$('#box').height()/2; /* Hack for IE 6 */
																	  
/* Email page */
$('#emailPage').click(function() {
	toggleSelect();
	$('#wrapper').css('filter', 'alpha(opacity=50)').fadeIn();
	var box = $('#box');
	box.css('margin-top', -box.height()/2).slideDown();
	return false;
});

$('#box .close').click(function() {
	toggleSelect();
	$('#wrapper').fadeOut();
	$(this).parent().slideUp();
	return false;
});

$('#wrapper').click(function(event) {
	if(event.target == this) {
		$('#box .close').trigger('click');
	}
});

/* Fix for IE 6 */
function toggleSelect() {
	if($.browser.version == 6.0) {
		var selects = $('select');
		if(selects.filter(':visible').length > 0) {
			selects.css('display', 'none');
		} else {
			selects.css('display', 'block');
		}
	}
}
/* Fix for IE 6 */

/* Print page */
$('#printPage').click(function() {
	window.print();							   
});

});