﻿function gadgetTecto() {
	this.cod = 0;
	this.direcao = "H";
	this.capasVisiveis = 3;
	this.maximoCapas = 0;
	this.tipoConteudo = "C";
	this.textoFiltro = "";
	this.corFundo = "FFF";
	this.corFrente = "444";
}

gadgetTecto.prototype.abreGadget = function(host) {
	if (typeof (host) == "undefined") var host = "www.tecto.com.br";

	var qs = this.cod + "?";
	qs += "&dr=" + this.direcao;
	qs += "&nc=" + this.capasVisiveis;
	qs += "&tc=" + this.tipoConteudo;
	if (this.textoFiltro != "") qs += "&f=" + encodeURIComponent(this.textoFiltro);
	if (this.maximoCapas > 0) qs += "&nxc=" + this.maximoCapas;
	qs += "&bc=" + this.corFundo;
	qs += "&fc=" + this.corFrente;

	var wid;
	var hgt;

	if (this.direcao == "V") {
		wid = 147;
		hgt = (150 * this.capasVisiveis) + 68;
		hgt = (hgt > 246 ? hgt + 20 : hgt) + 20;
	} else {
		wid = (117 * this.capasVisiveis) + 30;
		wid = (wid > 147 ? wid + 20 : wid) + 20;
		hgt = 200;
	}

	var srcHost = "&sh=" + encodeURIComponent(document.location.hostname);

	document.write('<iframe src="http://' + host + '/Gadget/' + qs + srcHost + '" width="' + wid + '" height="' + hgt + '" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe>');
}

var gTecto = new gadgetTecto();