
	function tframe() {
		this.height;
		this.width;
		this.Body = document.getElementsByTagName("body").item(0);
		this.overlay = document.createElement("div");
		this.overlay.setAttribute('id','overlay');
		this.overlay.style.display = 'none';
		this.overlay.onclick = this.hide;
		this.overlay.className = "overlay";
		this.Body.appendChild(this.overlay);
		this.msgid=0;
		this.dmsg = document.createElement("div");
		this.dmsg.setAttribute('id','dmsg');
		this.dmsg.style.display = 'none';
		this.dmsg.className = "frmmsg";
		this.Body.appendChild(this.dmsg);
		this.lng = "ESP";
		this.aurl = "http://www.institutoalcon.com/";
	}

	tframe.prototype.addmsg=function(w,h,id) {
		this.msgid=id;
		this.width=w;
		this.height=h;

		var smsg;

		switch(id) {
			case 1:
				tf.dmsg.innerHTML = "loading ...";
				var iax  = new iajax(this.aurl + "condpreins.aspx");
				iax.call(Condiciones,"");
				break;
			case 2:
				var iax  = new iajax(this.aurl + "preinsmsg1.htm");
				iax.call(CBMensajePreins,"");
				break;
			case 10:	//Question
				var iax  = new iajax(this.aurl + "question.asp?LNG="+this.lng);
				iax.call(CBQuestion,"");
				break;
			case 20:	//Curso antibioticoterapia.
				var iax  = new iajax(this.aurl + "cursoantibiotico.htm");
				iax.call(CBcursoantibiotic,"");
				break
		}

		//this.dmsg.innerHTML = smsg;
	}

	tframe.prototype.show=function() {
		this.setsize();
		if (this.msgid>0) {
			this.dmsg.style.display = 'inline';
		}
		this.overlay.style.display = 'inline';

		window.onresize = this.setsize;
		document.onkeydown = this.disabletab;
		this.dmsg.focus();
	}

	tframe.prototype.hide=function() {
		if (tf.overlay) {
			tf.overlay.style.display = 'none';

			if (tf.msgid>0) {
				tf.dmsg.innerHTML = '';
				tf.dmsg.style.display = 'none';
			}

			window.onresize = '';
			document.onkeydown = '';
		}
	}

	tframe.prototype.setsize=function() {
		var arrayPageSize = tf.getmetrics();
		tf.overlay.style.height=arrayPageSize[1];

		if (tf.msgid>0) {
			var l = (arrayPageSize[2]/2) - (tf.width/2);
			tf.dmsg.style.top = 100;
			tf.dmsg.style.left = l;
			tf.dmsg.style.height = tf.height;
			tf.dmsg.style.width = tf.width;
		}
	}

	tframe.prototype.disabletab=function(evt) {
		var kc = (evt) ?  evt.which: event.keyCode; 

		if(kc == 9) {
			return false;
		}
	}

	tframe.prototype.getmetrics=function() {
		var xScroll, yScroll;

		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else {
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}

		var windowWidth, windowHeight;

		if (self.innerHeight) {
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	


		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}

		if(xScroll < windowWidth){
			pageWidth = xScroll;
		} else {
			pageWidth = windowWidth;
		}

		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
		return arrayPageSize;
	}

