(function($) {
	$(document).ready(function() {
		$('form#login input#emailAddress').focus(function() {
			if ( $(this).val() == 'email address' ) {
				$(this).val('');
			}
		});
		
		$('form#login input#emailAddress').blur(function() {
			if ( $(this).val() == '' ) { 
				$(this).val('email address');
			}
		});
		
		$('form#login input#fakePassword').focus(function() {
			if ( $(this).val() == 'password' ) {
				$(this).val('');
				$(this).hide(0, function() { $('form#login input#password').val('').show().focus(); });
			}
		});
		
		$('form#login input#password').blur(function() {
			if ( $(this).val() == '' ) { 
				$(this).val('password');
				$(this).hide(0, function() { $('form#login input#fakePassword').val('password').show(); });
			}
		});
		
		$('form#login input').keypress(function(e) {
			if ( e.keyCode == 13 ) { 
				$('form#login').submit();
			}
		}); 
		
		$('div#content div#image a').click(function() {
			$(this).parent().removeAttr('class').addClass( $(this).attr('class') );
			return false;
		});
		
		setInterval( 'changeImage()', 5000 );
	});
})(jQuery);

function changeImage() {
	(function($) {
		var currentClass = $('div#content div#image').attr('class');
		
		if ( currentClass == 'redeemIt' ) { currentClass = 'getOffer'; $('div#content div#image').removeAttr('class').addClass( currentClass ); return; }
		
		var nextClass = $('div#content div#image a.' + currentClass).next('a').attr('class');
		
		$('div#content div#image').removeAttr('class').addClass( nextClass );
	})(jQuery);
}

