jQuery(document).ready(function()
{
	var nextId = 0;
	jQuery(".cleardefault").each(function(i, v)
	{
		v = jQuery(v);

		// Get the ID or create an ID if not present
		var id = v.attr("id");
		if (id == "" || typeof(id) == "undefined")
		{
			id = "cleardefault" + (nextId++);
			v.attr("id", id);
		}

		var defaultValue = v.attr("value");

		// Clear the default
		v.focus(function()
		{
			if (this.value == defaultValue)
				this.value = "";
		});

		// Put default in there again if the field is empty
		v.blur(function()
		{
			if (this.value == "")
				this.value = defaultValue;
		});
	});
});
