/**
 * Gets all text and password input
 * Stores values in a associative array (using name)
 *
 * onfocus removes default text
 * onblur reinstates defauly text if empty
 *
 * now does the same for textareas
 */

var value_array = new Array();

$(document).ready(function() {
	$("input:text, input:password").each(function() { value_array[$(this).attr('name')] = $(this).attr('value'); });

	$("input:text, input:password").focus(function() {
		if($(this).val() == value_array[$(this).attr('name')])
		{
			$(this).val('');
		}
	});
	
	$("input:text, input:password").blur(function() {
		if($(this).val() == '')
		{
			$(this).val(value_array[$(this).attr('name')]);
		}
	});
	
	$("textarea").each(function() { value_array[$(this).attr('name')] = $(this).html(); });
	
	$("textarea").focus(function() {
		if($(this).val() == value_array[$(this).attr('name')])
		{
			$(this).html('');
		}
	});
	
	$("textarea").blur(function() {
		if($(this).val() == '')
		{
			$(this).html(value_array[$(this).attr('name')]);
		}
	});
});