
function zwInlineForm(formId, location, fixedHeight) {
	this._previousHtml;
	
	this._locationElem = document.getElementById(location);
	this._frameElem;
	this._formHtml;
	this._formId = formId; 
	if (fixedHeight) {
		this._formHeight = fixedHeight;
	} else 
		this._formHeight = parseInt(this._locationElem.offsetHeight);
	this._formWidth = parseInt(this._locationElem.offsetWidth);

	zwInlineForm.prototype.divId = zw_divId;
	zwInlineForm.prototype.frameId = zw_frameId;
	zwInlineForm.prototype.showForm = zw_showForm;
	zwInlineForm.prototype.hideForm = zw_hideForm;
	
	this._formHtml = "<div id='" + this.divId() + "'>";
	this._formHtml += "<iframe src='' style='width:100%;height:100%;background-color:transparent;' scrolling='auto' frameborder='0' allowtransparency='true' id='" + this.frameId() + "' name='" + this.frameId() + "' width='100%' height='100%'></iframe>";
	this._formHtml += "</div>";
	
}

function zw_showForm(formContent) {
	this._previousHtml = this._locationElem.innerHTML;
	this._locationElem.innerHTML = this._formHtml;
	this._frameElem = document.getElementById(this.frameId());
	this._frameElem.style.height = this._formHeight + "px";
	this._frameElem.style.width = this._formWidth + "px";
	this._frameElem.contentWindow.document.clear();
	this._frameElem.contentWindow.document.write(formContent);
	this._frameElem.contentWindow.document.close();	
}

function zw_hideForm() {
	this._locationElem.innerHTML = this._previousHtml;
}

function zw_divId() {
	return 'div_' + this._formId;
}
function zw_frameId() {
	return 'frame_' + this._formId;
}
