var speed = 300;

function fieldFocus()
{
	if ($(this).val() == 'Your name'
		|| $(this).val() == 'Your email address'
		|| $(this).val() == 'Your website URL'
		|| $(this).val() == 'Type your subject here'
		|| $(this).val() == 'Type your message here'
		)
	{
		$(this).animate({
		    color: '#ffffff'
		}, speed, function() { $(this).val(''); $(this).css('color', '#000000'); });
	}

	if ($(this).val() != 'Your name'
		|| $(this).val() != 'Your email address'
		|| $(this).val() != 'Your website URL'
		|| $(this).val() != 'Type your subject here'
		|| $(this).val() != 'Type your message here'
		)
	{
		$(this).animate({
		    color: '#000000'
		}, speed);
	}
}

function fieldBlur()
{
	if ($(this).val() == 'Your name'
		|| $(this).val() == 'Your email address'
		|| $(this).val() == 'Your website URL'
		|| $(this).val() == 'Type your subject here'
		|| $(this).val() == 'Type your message here')
	{
		$(this).stop();
		$(this).css('color', '#ffffff');
	}
	
	if ($(this).val() != '')
	{
		$(this).animate({
		    color: '#aaaaaa'
		}, speed);
	}

	if ($(this).val() == '')
	{
		$(this).stop();
		$(this).css('color', '#ffffff');
		
		if ($(this).attr('id') == 'contact_name') { $(this).val('Your name'); }
		if ($(this).attr('id') == 'contact_email') { $(this).val('Your email address'); }
		if ($(this).attr('id') == 'contact_website') { $(this).val('Your website URL'); }
		if ($(this).attr('id') == 'contact_subject') { $(this).val('Type your subject here'); }
		if ($(this).attr('id') == 'contact_message') { $(this).val('Type your message here'); }
		
		$(this).animate({
		    color: '#aaaaaa'
		}, speed);
	}
}

$(document).ready(function() 
{
	$('.contact-form').focus(fieldFocus);
	$('.contact-form').blur(fieldBlur);
});

