function Torpedao(o){
	this.id     = o.id;
	this.canal  = o.canal || 'noticias';
	this.top    = '100';
	this.left   = (window.screen.width/2)-360;
	this.height = document.body.offsetHeight;
	//div inicio
	this.div  = '<div id="torpedao_janela" style="width:720px; height:520px; background-image:url(/plugins/torpedao/bg.png);';
	this.div += 'background-repeat:no-repeat; position:absolute; top:'+this.top+'px; left:'+this.left+'px; z-index:99; display:none">';
	//botao fechar
	this.div += '<div style="width:30px; height:33px; float:right">';
	this.div += '<a href="javascript:'+this.id+'.fecha()"><img src="/plugins/torpedao/fechar.png" border="0"/></a>';
	this.div += '</div>';
	//iframe
	this.div += '<div style="float:right;width:203px; height:445px; margin-top:35px; background-color:#EEEEEE; padding:5px;">';
	this.div += '<iframe id="iFrameTopedao"  frameBorder="no" scrolling="no" src="/plugins/torpedao/" width="203px" height="445px"></iframe>';
	this.div += '</div>';
	//opcoes
	this.div += '<div style="float:right; width:210px; height:20px; margin-top:160px;">';
	this.div += '<div id="torpedao_canal" style="margin-bottom:10px;font-family:Verdana, Geneva, sans-serif; font-size:12px;"></div>';
	this.div += '<div id="torpedao_opcoes"></div>';
	this.div += '</div>';
	//botoes
	this.div += '<div style="float:left; margin-top:285px; margin-left:50px;">';
	this.div += '<a href="javascript:'+this.id+'.opcoes(\'noticias\')"><img src="/plugins/torpedao/bt_noticias.png" border="0" /></a>';
	this.div += '<a href="javascript:'+this.id+'.opcoes(\'esportes\')"><img src="/plugins/torpedao/bt_esportes.png" border="0" style="margin-left:15px;" /></a>';
	this.div += '<a href="javascript:'+this.id+'.opcoes(\'entretenimento\')"><img src="/plugins/torpedao/bt_entretenimento.png" border="0" style="margin-left:15px;" /></a>';
	this.div += '</div>';
	this.div += '</div>';
	//div fim
	//bg
	this.bg = '<div id="torpedao_bg" style="display:none; position: absolute; top: 0px; left: 0px; width: 100%; background-color: #000000; filter:alpha(opacity=30);	-moz-opacity: 0.3; opacity: 0.3; z-index: 0;"></div>';
	
	document.write(this.div);
	document.write(this.bg);
		
	this.obj = function(id){ return document.getElementById(id); }
	
	this.abre = function(c){
		if(c) this.canal = c;
		this.obj('iFrameTopedao').src = '/plugins/torpedao/';
		if(Ext.isIE){ var iH = document.documentElement.clientHeight; } else { var iH = window.innerHeight; }
		this.top = (((iH/2)+document.body.parentNode.scrollTop)-266);
		this.obj('torpedao_janela').style.top = this.top+'px';
		this.obj('torpedao_janela').style.display = '';
		this.opcoes(this.canal);
		this.obj('torpedao_bg').style.display = '';
		this.obj('torpedao_bg').style.height = document.body.offsetHeight+'px';
	}
	
	this.descricaoCanal = function(c){
		var d = '';
		switch(c){
			case 'noticias' : d = '<b style="color:#b30000">Not&iacute;cias</b>'; break;
			case 'esportes' : d = '<b style="color:#81ad00">Esportes</b>'; break;
			case 'entretenimento' : d = '<b style="color:#ff7800">Entretenimento</b>'; break;
		}
		return d;
	}
		
	this.opcoes = function(o){
		this.obj('torpedao_canal').innerHTML = this.descricaoCanal(o);
		this.obj('torpedao_opcoes').innerHTML = '<img src="/lib/2us/img/loading_peq.gif" />';
		new xmlTemplate({xml:'/plugins/torpedao/'+o+'.xml',xsl:'/plugins/torpedao/opcoes.xsl',div:'torpedao_opcoes'});
	}
		
	this.JoSoares = function(s){
		var com_acento = 'áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ';
		var sem_acento = 'aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC';
		var nova='';
		for(var i=0;i<s.length;i++) {
			if (com_acento.search(s.substr(i,1))>=0) {
				nova+=sem_acento.substr(com_acento.search(s.substr(i,1)),1);
			}else{
				nova+=s.substr(i,1);
			}
		}
		return nova;
	}
		
	this.iframe = function(titulo,descricao,prefix,idow,idcom,guid,imagem){
		do{ imagem = imagem.replace('*','\\'); } while ( eval(imagem.indexOf('*'))>0 );
		if (Ext.isIE) {
			titulo=this.JoSoares(decodeURI(titulo));
			descricao=this.JoSoares(decodeURI(descricao));
	    }else{
			titulo=encodeURI(titulo);
			descricao=encodeURI(descricao);
		}
		var cod = 'http://www.torpedao.com.br/web/widgethome.aspx?type=Vertical&pos=LogoLeft&img=&bg=EEEEEE&clrbdr=none&clrfont=393939&font=Verdana%2c+Arial%2c+Helvetica%2c+sans-serif&ttl='+titulo+'&desc='+descricao+'&idow='+idow+'&idcom='+idcom+'&guid='+guid+'&prefix='+prefix+'&imgdefault='+imagem;
		this.obj('iFrameTopedao').src = cod;
	}
	
	this.fecha = function(){
		this.obj('torpedao_janela').style.display = 'none';
		this.obj('torpedao_bg').style.display = 'none';
	}
			
}