DomBuilder.apply(window);
/*
		document.onclick = function() {
			times++;
			document.body.appendChild(
				DIV({ id : "el_" + times, 'onclick' : 'alert("sdsdsd")'}, 
					STRONG({ 'class' : 'test' },"Lovely"), " nodes! #" + times,
					INPUT({type : 'text', name : 'test'})
				)
			);
		}
*/
function addCommentForm() {
	var nameL      = LABEL({},"Your Name:");
	var name       = INPUT({type : 'text', name : 'user'});
	var commentL   = LABEL({},"Your Feedback:");
	var comment    = TEXTAREA({'id':'comment'},"");
	var sendButton = INPUT({'type' : 'button', 'value' : 'Send Comment', 'class' : 'sendButton'});
	var form = FORM(nameL,name,commentL,comment,sendButton);

	$("div#copy").append(form);
}

$(document).ready(function(){

	$("form input#send").click(function() { 
		myuser = $("form input#user").val();
		mycomment = $("form textarea#comment").val();
		myemail = $("form input#email").val();
		$.post("/feedback.php",{name:myuser,comment:mycomment,email:myemail},function(data){
			$("div#error").html("<br/>" + data);
			if (data.substr(0,5) != "Error") {
				$("div#error").css("color","green");
				$("form").hide();
			}
			else {
				$("div#error").css("color","red");
			}
		});
	});

});
