$(document).ready(function () {
	$("input#customfieldname").search();

});



function addFormField() {

	var fieldname = $("#customfieldname").val();

	var id = $("#id").value;

	$("td.comment").append("<p id='row" + id + "' class='customfield'><label for='txt" + id + "'>" + fieldname + "</label><textarea name='txt[" + fieldname + "]' class='comments' id='txt" + id + "'></textarea>&nbsp;&nbsp<a href='js/contact.js.html#' onClick='removeFormField(\"#row" + id + "\"); return false;'>Remove</a></p>");

	

	$('#row' + id).highlightFade({

		speed:1000

	});

	

	id = (id - 1) + 2;

	$("#id").value = id;

}



function removeFormField(id) {

	$(id).remove();

}



$.fn.search = function() {

	return this.focus(function() {

		if( this.value == 'enter field name' ) {

			this.value = "";

		}

	}).blur(function() {

		if( !this.value.length ) {

			this.value = 'enter field name';

		}

	});

};