function Wasp_Form( id ) {
	this.id = id;
	this.onSubmitOK = ""
	this.onSubmitFailure = ""
}

Wasp_Form.prototype.isValid = function() {
	if ( this.id ) {
		return true;
	}
	return false;
}

Wasp_Form.prototype.isModified = function() {
	var form = document.getElementById( this.id );
	var opt, elem;
	for ( var x=0; x<form.elements.length; x++ ) {
		elem = form.elements(x);
		if ( elem.type == 'select-one' ) {
			if ( !elem.options(elem.selectedIndex).defaultSelected ) {
				return true;
			}			
		}
		else if ( elem.type == 'checkbox' ) {
			if ( elem.defaultChecked != elem.checked ) {
				return true;
			}	
		}
		else if ( elem.type == 'textarea' ) {
			// always re-submit a textarea			
			return true;	
		}
		else {
			if ( elem.defaultValue != elem.value ) {
				return true;
			}
		}
	}
	return false;
}

Wasp_Form.prototype.submit = function( submitOK, submitFailure ) {
	form = document.getElementById( this.id );
		
	if ( this.onSubmitOK ) {
		form.elements('submitOK').value = this.onSubmitOK;
	}
	if ( this.onSubmitFailure ) {
		form.elements('submitFailure').value = this.onSubmitFailure;
	}
	form.submit();
}