$(function() {
	// login form
	$('#member-login').click( function() {
		var link = $(this).addClass('active'),
				formWrap = $('#login-form-wrap').show();
				$('#login-form-wrap input#login').focus().select();
		$(document).click( function(e) {
			if( $(e.target).parents().filter('#login-form-wrap').length > 0 ) return;
			formWrap.hide();
			link.removeClass('active');
		});
		return false;
	});
	
	// fix any input type="image" with pngs for IE 6 before pngFix() breaks them
	if($.browser.msie && $.browser.version=="6.0") {
		var $els = $('input.signin, input.signup, input.sendemail, input.sendpassword');
		$els.each(function() {
			var $this = $(this),
			    src = $this.attr('src'),
			    newV = '.gif';
			if( $this.hasClass('signin') && $this.closest('#login-wrap').length != 0 ) {
				newV = '-dark' + newV;
			} 
			$this.attr( 'src', src.replace('.png', newV) );
		});
	}
	
	$(document).pngFix();
});
