function DynIFrame () {
	this.id;
	this.name;
	this.contentContainer;
	this.iframeContainer;
	this.cssStyleSheets = [];
	this.iframeObj;
	this.iframeDoc;
	this.initHTML;
	this.cssClassName;
}

DynIFrame.BLANK_CONTENT_SRC = baseurl + "/_images/spacer.gif";
DynIFrame.WIDTH_MODIFICATOR_MSIE = 233;
DynIFrame.WIDTH_MODIFICATOR_FFOX = 253;
DynIFrame.HEIGHT_MODIFICATOR = 138;


/*static integer*/ function getMaxAvailHeight() {
	if (document.all) {
		var height = document.documentElement.clientHeight - DynIFrame.HEIGHT_MODIFICATOR;
	} else {
		var height = window.innerHeight - DynIFrame.HEIGHT_MODIFICATOR;
	}
	return height;
}

/*void*/ DynIFrame.prototype.setMaxAvailWidth = function () {
	if (document.all) {
		var width = document.documentElement.clientWidth - DynIFrame.WIDTH_MODIFICATOR_MSIE;
	} else {
		var width = window.innerWidth - DynIFrame.WIDTH_MODIFICATOR_FFOX;
	}
	this.iframeObj.style.width = width  + "px";
}

/*void*/ DynIFrame.prototype.setMaxAvailHeight = function () {
	if (document.all) {
		var height = document.documentElement.clientHeight - DynIFrame.HEIGHT_MODIFICATOR;
	} else {
		var height = window.innerHeight - DynIFrame.HEIGHT_MODIFICATOR;
	}
	this.iframeObj.style.height = height + "px";
}

DynIFrame.prototype.createIFrame = function (name) {
	this.iframeObj = document.createElement('iframe');
//	this.iframeObj.src = DynIFrame.BLANK_CONTENT_SRC;
	this.iframeObj.id = name;
	this.iframeObj.name = name;
}
DynIFrame.prototype.setIFrameContainer = function (container) {
	this.iframeContainer = container;
}
DynIFrame.prototype.setInitHTML = function (initHTML) {
	this.initHTML = initHTML;
}
DynIFrame.prototype.setIFrameClassName = function (cssClassName) {
	this.cssClassName = cssClassName;
}
DynIFrame.prototype.setContentContainer = function (contentContainer) { 
	this.contentContainer = contentContainer;
}
DynIFrame.prototype.addStyleSheet = function (cssPath) {
	this.cssStyleSheets[this.cssStyleSheets.length] = cssPath;
}
DynIFrame.prototype.createNewStyleSheet = function (cssPath) {
	if (document.all) {
		this.iframeObj.contentWindow.document.createStyleSheet(cssPath);
	} else {
		var head = this.iframeObj.contentWindow.document.getElementsByTagName("head")[0];
		var style1 = this.iframeObj.contentWindow.document.createElement("link");
		style1.href = cssPath;
		style1.type = 'text/css';
		style1.rel = 'stylesheet';
		head.appendChild(style1);
	}
}
DynIFrame.prototype.disableContentContainer = function () {
	this.contentContainer.parentNode.removeChild(this.contentContainer);
//	this.contentContainer.style.display = 'none';
}
DynIFrame.prototype.setAnchorsTarget = function (target) {
	var iflinks = this.iframeDoc.links;
	for (var i = 0; i < iflinks.length; i++) {
		iflinks[i].setAttribute('target', target);
	}
}
DynIFrame.prototype.render = function (destContainer) {
	this.iframeObj.frameBorder = 0;
	this.iframeObj.className = this.cssClassName;
	this.iframeContainer.appendChild(this.iframeObj);
	this.iframeObj.contentWindow.document.open();
	this.iframeObj.contentWindow.document.write("<html><head></head><body>" + this.initHTML + "</body></html>");
	this.iframeObj.contentWindow.document.close();
	this.iframeDoc = this.iframeObj.contentWindow.document;
	for (var i = 0; i < this.cssStyleSheets.length; i++) {
		this.createNewStyleSheet(this.cssStyleSheets[i]);
	}
	if (destContainer) {
		this.iframeDoc.getElementById(destContainer).innerHTML = this.contentContainer.innerHTML;
		this.iframeDoc.body.style.margin = 0;
		this.iframeDoc.body.style.background = "#fff"
	} else {
		this.iframeDoc.body.innerHTML = this.contentContainer.innerHTML;
		this.iframeDoc.body.style.margin = 0;
		this.iframeDoc.body.style.background = "#fff"
	}
}

