function JSF(f) {
	this.f = f;
	this.createForm();
}

JSF.prototype.createForm = function() {
	if(this.f == undefined) {
		this.f = document.createElement("form"); 
		this.f.method = "post";
		document.body.appendChild(this.f);
	} 
}

JSF.prototype.createField = function(n,v) {
	if(this.f.elements[n])
		this.deleteField(this.f.elements[n]);
	
	var a = document.createElement("input");
	a.type = "hidden";
	a.name = n;
	a.value = v;
	this.f.appendChild(a); 
}

JSF.prototype.submitForm = function(debug) {
	if(debug == undefined || debug === true)
		this.f.submit();
	else if(debug === false) {
		var output = '';
		for(i = 0; i < this.f.elements.length; i++)
			output += i+") "+this.f.elements[i].name+": "+this.f.elements[i].value+"\n";
		alert(output);
	}	
}

JSF.prototype.deleteField = function(e) {
	if(e)
		this.f.removeChild(e);	
}
