$(document).ready(function() {

	$('input,textarea').each(function(){
		if( $(this).attr('title') !== '' && $(this).val() == '')
		{
			$(this).val($(this).attr('title'));
		}
	});
	
	$('input,textarea').live('focusin',function(){
		$(this).addClass('active');
		if( $(this).val() == $(this).attr('title'))
		{
			$(this).val('');
		}
	});

	$('input,textarea').live('focusout',function(){
		$(this).removeClass('active');
		
		if( $(this).val() == '')
		{
			$(this).val($(this).attr('title'));
		}
	});
	
	if(navigator.userAgent.toLowerCase().indexOf("chrome") >= 0)
	{
		$('input:-webkit-autofill').each(function(){
			var text = $(this).val();
			var name = $(this).attr('name');
			$(this).after(this.outerHTML).remove();
			$('input[name=' + name + ']').val(text);
		});
	};
	
});
