/*-------------------- BASICOS --------------------*/
if(complementoPath == undefined)complementoPath="";
d=document;
IE=d.all?true:false;
function $(id){return d.getElementById(id)}
function submitForm(form){form.submit();}
var enviado=false;
var _retorno=false;
function $request( name ){
	var regexS = "[\?&]"+name+"=([^&#]*)";
	var regex = new RegExp ( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null ){
		return"";
	}else{
		return results[1];
	}
}

//Variaveis
var dirPops="/pops/";//Diretorio de onde será carregada a página de pops das materias
var txt;//armazena a pagina de complemento
var txtpops;//armazena a pagina de pops
var galeria_materia=false;//AREA MULTIMIDIA

//Monta e corrige a url completa (ex: http://www.site.com.br/diretorio/arquivo.html)
var urlSite=location.href.toString();
while(urlSite.indexOf("//")!=-1){ 
  urlSite=urlSite.replace("//","/") 
} 
urlSite=urlSite.replace("http:/","http://")

function linkPage(){
  var url=window.location.toString();
  while(url.indexOf("//")>1){url=url.replace(/\/\//g,"/")}
  return url.replace("http:/","http://");
}

//Monta o dominio considerando o ambiente (producao ou homolog)
var nomeSiteHomolog = "";
if (window.location.href.indexOf('publicador') >-1){
	var nomeSiteHomolog = "/"+canalPaiHomolog+"/"+complementoPath+pathEspecial;
}else{
	var nomeSiteHomolog = "/"+complementoPath+pathEspecial;
}

var pathPadrao = "http://"+location.host+nomeSiteHomolog;

//corrige indexOf emm Arrays no ie
if(!Array.indexOf){Array.prototype.indexOf = function(obj){for(var i=0; i<this.length; i++)if(this[i]==obj){return i};return -1;}}

function comboCanais(){
  var html='<div class="combo_canais">'+getOptCnsHTML()+'</div>';
  document.write(html)
}

//Pops
function openTermoDeUso(){window.open('http://paginas.comentarios.ig.com.br/xsl/termo.html', 'Termodeuso', 'toolbar=0,location=0,directories=0,status=yes,menubar=0,scrollbars=no,resizable=0,width=401,height=351,top=100,left=150')}

//Ferramentas da materia
function ferramentas_da_materia(){ 
  var ferramentas_da_materia='<ul id="tools" class="tools">'+
        '<li><li><a href="javascript:share(1)" title="Compartilhar" class="share">Compartilhar</a></li>'+
		'<li><a href="javascript:window.print()" title="Imprimir" class="print">Imprimir</a></li>'+
		'<li><a href="#enviar_materia" name="enviar_materia" onclick="wPop(enviar_materia);" title="Enviar por e-mail" class="sendemail">Enviar por e-mail</a></li>'+
		'<li><a href="#corrigir_noticia" name="corrigir_noticia" onclick="wPop(corrigir_noticia);" title="Corrigir" class="rephrase nobdd">Corrigir</a></li>'+	
		'</ul>';
	document.write(ferramentas_da_materia);
	
  add=new Array(
  	'javascript:blogThis()" title="Adicionar ao Blig" class="blig">Blig',
  	'http://blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=_URL_&amp;Title=_TITLE_" title="Adicionar ao BlinkList" class="blinklist">BlinkList',
  	'http://www.blogblogs.com.br/my/gadgets/fave?url=_URL_&amp;title=_TITLE_" title="Adicionar ao BlogBlogs" class="blogblogs">BlogBlogs',
  	'http://del.icio.us/post?url=_URL_&amp;title=_TITLE_" title="Adicionar ao del.icio.us" class="delicious">del.icio.us',
  	'http://digg.com/submit?phase=2&amp;url=_URL_&amp;title=_TITLE_" title="Adicionar ao Digg" class="digg">Digg',
  	'http://furl.net/storeIt.jsp?u=_URL_&amp;t=_TITLE_" title="Adicionar ao Furl" class="furl">Furl',
  	'http://google.com/bookmarks/mark?op=edit&amp;bkmk=_URL_&amp;title=_TITLE_" title="Adicionar ao Google Bookmarks" class="googlebookmarks">Google Bookmarks',
  	'http://www.linkk.com.br/submit.php?url=_URL_&amp;title=_TITLE_" title="Adicionar ao Linkk" class="linkk">Linkk',
  	'http://ma.gnolia.com/bookmarklet/add?url=_URL_&amp;title=_TITLE_" title="Adicionar ao ma.gnolia" class="magnolia">ma.gnolia',
  	'http://www.netscape.com/submit/?U=_URL_&amp;T=_TITLE_" title="Adicionar ao Netscape" class="netscape">Netscape',
  	'http://newsvine.com/_wine/save?u=_URL_&amp;h=_TITLE_" title="Adicionar ao Newsvine" class="newsvine">Newsvine',
  	'http://reddit.com/submit?url=_URL_&amp;title=_TITLE_" title="Adicionar ao reddit" class="reddit">reddit',
  	'http://stumbleupon.com/submit?url=_URL_&amp;title=_TITLE_" title="Adicionar ao StumbleUpon" class="stumbleupon">StumbleUpon',
  	'http://tailrank.com/share/?link_href=_URL_&amp;title=_TITLE_" title="Adicionar ao Tailrank" class="tailrank">Tailrank',
  	'http://technorati.com/faves?add=_URL_" title="Adicionar ao Technorati" class="technorati">Technorati',
  	'http://favorites.live.com/quickadd.aspx?marklet=1&amp;mkt=en-us&amp;url=_URL_&amp;title=_TITLE_&amp;top=1" title="Adicionar ao Windows Live" class="windowslive">Windows Live',
  	'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=_URL_&amp;t=___TITLE__" title="Adicionar ao Yahoo! My Web" class="yahoomyweb">Yahoo! My Web'
  )
  
  var form_blig='<form name="bligThis" target="BliG" method="POST" action="http://blig.ig.com.br/pop_blig.php" style="display:none">'+
  	  				'<input type="hidden" name="titulo" value="'+testeRemoveHTMLTags("brtpTitulo")+testeRemoveHTMLTags("brtpTituloGaleria")+'" />'+
  	  				'<input type="hidden" name="olho" value="'+testeRemoveHTMLTags("brtpOlho")+'" />'+
  	  				'<input type="hidden" name="texto" value="'+testeRemoveHTMLTags("brtpTexto")+'" />'+
  	  				'<input type="hidden" name="url" value="'+location.href+'" />'+
    				'</form>';
  document.write(form_blig);
  
  comp='<ul id="share-1" class="share">'
    for(x=0;x<add.length;x++)comp+='<li><a href="'+add[x]+'</a></li>'
    comp=comp.replace(/_URL_/ig,location.href)
    comp=comp.replace(/_TITLE_/ig,encodeURIComponent(document.title))
  document.write(comp+'</ul>')
}

//Compartilhe
function share(id){
	var share=document.getElementById('share-'+id)
	if(share.style.display=='block')
		share.style.display='none'
	else
		share.style.display='block'
}

function blogThis(){
	window.open("about:blank","BliG","menubar=0,resizable=0,width=350,height=250");
	document.bligThis.submit();
}

function removeHTMLTags(codigo){
 		var strInputCode = codigo;
 	 	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 		 	return (p1 == "lt")? "<" : ">";
 		});
 		var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
		return strTagStrippedText;
}

function testeRemoveHTMLTags(codigo){//caso nao exista o elemento procurado, deixa o parametro em branco
		if($(codigo) == null)
			return " ";
 		try{
			return removeHTMLTags($(codigo).innerHTML);
		}
		catch(e){
			return " ";
		}
}

//Titulo dos blocos que não são editáveis
function Titulo_NR(){document.write("Notícias Relacionadas")}

// Função para validar o envio de email
function validaForm(){
	dform = document.formEnvie;
	document.formEnvie.urlpagina.value = location.protocol+"//"+location.host+location.pathname;
  //var str = "?enviado=true&retorno="+popLoad;
  var str = "?enviado=true&retorno="+popLoad;
  var url = location.href.toString();
  document.formEnvie.urlretorno.value = location.href.toString().indexOf("retorno")>-1?url:url.split("#")[0]+str+"#"+url.split("#")[1];
	//document.formEnvie.urlretorno.value = 'about:blank';

  //validar nome  
  if (dform.nome.value == "" || /^\s+$/.test(dform.nome.value)){
		alert("O campo nome deve ser preenchido!");
		dform.nome.focus();
		return false;
	}
	//validar user
	if (dform.email.value == "" || /^\s+$/.test(dform.email.value)){
		alert("O campo e-mail deve ser preenchido!");
		dform.email.focus();
		return false;
	}
	//validar senha
	if (dform.nome_destinatario.value == "" || /^\s+$/.test(dform.nome_destinatario.value)){
		alert("O campo nome do destinatário deve ser preenchido!");
		dform.nome_destinatario.focus();
		return false;
	}
	//validar email
	if (dform.email_destinatario.value == "" || /^\s+$/.test(dform.email_destinatario.value)){
		alert("O campo e-mail do destinatário deve ser preenchido!");
		dform.email_destinatario.focus();
		return false;
	}
	//validar comentarios
	if (Trim(dform.comentarios.value) == "" || Trim(dform.comentarios.value) == " " || /^\s+$/.test(dform.comentarios.value) || Trim(dform.comentarios.value.toLowerCase()) == "insira aqui seu comentário"){
		alert("O campo comentário deve ser preenchido!");
		dform.comentarios.focus();
		return false;
	}
	//validar email(verificao de endereco eletronico)
  var regexp= new RegExp("^[a-z0-9_\-]+(\\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$");
  if(!regexp.test(dform.email.value)){
    alert("O campo e-mail deve ser um endereço eletrônico!");
		dform.email.focus();
		return false;
	}
	
	//validar email2(verificao de endereco eletronico)
  if(!regexp.test(dform.email_destinatario.value)){
    alert("O campo e-mail do destinatário deve ser um endereço eletrônico!");
		dform.email_destinatario.focus();
		return false;
	}
	
  document.formEnvie.submit();
  enviado=true;
  retorno();
	return true;
}
/*-------------------- BASICOS --------------------*/


/*-------------------- COMPLEMENTOS AJAX --------------------*/
var secao={
url:[
"/noticias/",
"/noticia_visual/",
"/melhor_do_ano/"
],

nome:[
"Notícias",
"Notícia Visual",
"O Melhor do Ano"
],

complemento:[
"/noticias/complemento/",
"/noticia_visual/complemento/",
"/noticia_visual/complemento/"
]
};

for(_x=0;_x<secao.url.length;_x++){
	if(urlSite.indexOf(secao.url[_x])>-1){
	  secaoNome=secao.nome[_x];
	  secaoComplemento=secao.complemento[_x];
	}
}

function _xStart(){
  if(secaoComplemento!=null)_xCopy(pathPadrao+secaoComplemento);//CARREGA OS COMPLEMENTOS;
  _xPops(pathPadrao+dirPops);//CARREGA OS POP-UPS;
}

function getHTTPObject(){if(window.XMLHttpRequest){return new XMLHttpRequest();} else if(window.ActiveXObject){var prefs = ["MSXML2", "Microsoft", "MSXML", "MSXML3"];for(var i = 0; i < prefs.length; i++){try{return new ActiveXObject(prefs[i] + ".XMLHTTP");} catch(e){}}}}

function rx($u){return new RegExp("<"+$u+">(.*)</"+$u+">")}

function _xCopy($path) {
    _objg = new getHTTPObject();
    _n = parseInt(Math.random()*1000000);
    _objg.open('GET', $path+"?" + _n, true);
    _objg.onreadystatechange = function() {
        if(_objg.readyState == 4) {
            if(_objg.status == '200') txt= _objg.responseText.replace(/[\r\n]/g, " ");
        }else{
			sleep(500);
		}
    };	
    _objg.setRequestHeader('Content-type', 'text/html; charset=ISO-8859-1');
    _objg.send(null);
}

function sleep(milliseconds) {
	var start = new Date().getTime();
	for (var i = 0; i < 1e7; i++) {
		if ((new Date().getTime() - start) > milliseconds){
			break;
		}
	}
}


function _xPops($path) {
    _objPops = new getHTTPObject();
    _n = parseInt(Math.random()*1000000);
    _objPops.open('GET', $path+"?" + _n, true);
    _objPops.onreadystatechange = function() {
        if(_objPops.readyState == 4) {
            if(_objPops.status == '200') txtpops= _objPops.responseText.replace(/\r\n/g, "");
        }
    };
    _objPops.setRequestHeader('Content-type', 'text/html; charset=ISO-8859-1');
    _objPops.send(null);
}


var area={//areas que vem por ajax;
  menu:"menu_site",
  ultimasCanal:"ultimas_canal",
  sobreCanal:"sobre_canal",
  ultimasGalerias:"ultimas_galerias",
  vejaMais:"veja_mais",
  rodape:"rodape_site",
  logoTopo: 'logo_topo'
}

function menu_lateral(){
  var $u=area.menu;
//  $("x_"+$u).innerHTML=rx($u).exec(txt)[1];
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

function ultimasCanal(){
  var $u=area.ultimasCanal;
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

function sobreCanal(){
  var $u=area.sobreCanal;
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

function ultimasGalerias(){
  var $u=area.ultimasGalerias;
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

function vejaMais(){
  var $u=area.vejaMais;
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

//Monta o rodapé
function footer(){
  var $u=area.rodape;
  window.setTimeout(function(){$("x_"+$u).innerHTML=rx($u).exec(txt)[1];},1000);
}

function printLogoTopo(){
	var $u=area.logoTopo;
 	$("x_"+$u).innerHTML=rx($u).exec(txt)[1];
}

_xStart();


// POPS
var pop={
  enviar_materia:"enviar_materia",
  corrigir_noticia:"corrigir_noticia"
}

var ret=false;

function wPop(fn,ret){
  if($("window").style.display=="block"){
      $("window").style.display='none';
      $("window").innerHTML="<!--//-->";
    }else{
      html="<div id='layer'><!--//--></div>"+
            "<div id='fade'><!--//--></div>";
      $("window").innerHTML=html;
      $("window").style.display='block';
      $("fade").style.height=document.body.scrollHeight+"px";
      $("layer").style.top=150+(window.pageYOffset||document.body.scrollTop)+"px";
      fn(ret);
    }
}

function rPop(fn,ret){
      html="<div id='layer'><!--//--></div>"+
            "<div id='fade'><!--//--></div>";
      $("window").innerHTML=html;
      $("window").style.display='block';
      $("fade").style.height=document.body.scrollHeight+"px";
      $("layer").style.top=150+(window.pageYOffset||document.body.scrollTop)+"px";
      fn(ret);
}


function retorno(){
  if($request('enviado')=='true' || enviado==true){
    if($request('retorno')!=null){wPop(eval($request('retorno')),true)}
	if(_retorno==true){
		if (/enviar_materia/.test(location.href))func='enviar_materia';
		if (/corrigir_noticia/.test(location.href))func='corrigir_noticia';
		wPop(eval(func),true);
	}
  }
  document.title=document.title.replace(/\#enviar_materia/g,'');
  document.title=document.title.replace(/\#corrigir_noticia/g,'');
}

var popLoad;

function enviar_materia(retorno){
var $u=pop.enviar_materia;
  popLoad=$u;
  if(document.all){
  $("layer").style.top=($("tools").offsetTop+375)+"px";
  $("layer").style.left=($("tools").offsetLeft+200)+"px";
  }
  else
  {
  $("layer").style.top=$("tools").offsetTop+"px";
  $("layer").style.left=$("tools").offsetLeft+"px";
  }
  $("layer").innerHTML=rx($u).exec(txtpops)[1];
  if(retorno){
    $('envio').style.display="none";
    $('enviar_materia').style.display="block";
    }
	else{_retorno=true;}
}

function re_enviar_materia(retorno){
	enviar_materia(retorno);
}

function corrigir_noticia(retorno){
var $u=pop.corrigir_noticia;
  popLoad=$u;
  if(document.all){
  $("layer").style.top=($("tools").offsetTop + 375)+"px";
  $("layer").style.left=($("tools").offsetLeft + 200)+"px";
  }
  else
  {
  $("layer").style.top=$("tools").offsetTop+"px";
  $("layer").style.left=$("tools").offsetLeft+"px";
  }
  $("layer").innerHTML=rx($u).exec(txtpops)[1];
  if(retorno){
    $($u+"_envie").style.display="none";
    $($u+"_sucesso").style.display="block";
    }
	else{_retorno=true;}
}

/*-------------------- COMPLEMENTOS AJAX --------------------*/


/*-------------------- AREA MULTIMIDIA --------------------*/
function multimidia(cat){
	//var arr_tela=["galeria","video","audio"];
	var arr_tela=["galeria","video"];
	var bTemGaleria = false;
	var bTemVideo = false;

	for(x=0;x<arr_tela.length;x++){
  	    if(Trim($('mm_'+arr_tela[x]).innerHTML) == ""){
			$('mm_'+arr_tela[x]).style.display="none";
		}else{
			$('mm_'+arr_tela[x]).style.display="block";
			if(arr_tela[x]=="galeria"){
				if($('link_veja_mais_galeria') != null){
					$('link_veja_mais_galeria').innerHTML="Mais galerias de fotos";
					$('link_veja_mais_galeria').title="Mais galerias";
					$('link_veja_mais_galeria').href= "http://"+location.host+"/"+complementoPath+pathEspecial+pathGalerias+empGalerias;
				}
				bTemGaleria = true;
			}else{
				if($('link_veja_mais_video') != null){
					$('link_veja_mais_video').innerHTML="Mais vídeos";
					$('link_veja_mais_video').title="Mais vídeos";
					$('link_veja_mais_video').href="http://tvig.ig.com.br/";
				}
				if($('brtpurlvideo') != null && Trim($('brtpurlvideo').href) != ""){
					var source = $('brtpurlvideo').href.replace("http://","").split("/")[1];
					source = "http://tvig.ig.com.br/swf/playerFlash.swf?media=http://tvig.ig.com.br/Templates/RequestUrlPlayer.aspx?id="+source+"&isEmbed=true";
					
					$('divvideo').innerHTML = '<object type="application/x-shockwave-flash" data="'+source+'" width="302" height="255">\n'+
												'	<param name="movie" value="'+source+'" />\n'+
												'	<param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" />\n'+
												'	<param name="quality" value="best" /><param name="bgcolor" value="#FFF" />\n'+
												'	<param name="salign" value="TL" />\n'+
												'	<param name="FlashVars" value="playerMode=embedded" />\n'+
												'</object>\n';
												
					$('embedvideo').value =	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="uploader" width="480" height="390" align="middle">'+
												'<param name="allowScriptAccess" value="always" />'+
												'<param name="movie" value="'+source+'" />'+
												'<param name="bgcolor" value="#333333" />'+
												'<param name="quality" value="high" />'+
												'<param name="allowFullScreen" value="true" />'+
												'<embed src="http://tvig.ig.com.br/swf/playerFlash.swf?media=http://tvig.ig.com.br/Templates/RequestUrlPlayer.aspx?id=79661&isEmbed=true"  quality="high" bgcolor="#333333" width="480" height="390" align="middle"  name="uploader" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ></embed>'+
												'</object>';
					bTemVideo = true;
				}
			}
		}
	}
	if(bTemVideo == false && bTemGaleria == false && $('brtpmateriarelacionadas') != null){
		$('publi_absolute').style.marginTop = '29px';
	}else if(bTemGaleria == false && bTemVideo == true && $('link_veja_mais_video') != null){
		$('brtpVideo').className = 'multimidia_video multimidia_video_mg';
	}
}
function _ContadorGaleria(){
	if($("statusgaleria") != null){
		$("statusgaleria").innerHTML = (_indslisho+1)+" de "+_codimgcrps.length;
		$('statusgaleria').style.display="block";
	}
}

/*-------------------- AREA MULTIMIDIA --------------------*/

/*---COMENTÁRIOS---*/

function titulo_comentarios(){      
  var form='<h4>'+
    					'<span>Comente</span>'+
    					'<a href="javascript:openTermoDeUso();" title="Termos de uso">Termos de uso</a>'+
    					'<br class="clear" />'+
    				'</h2><br />';
  document.write(form);
}

function checaComentario() {
//  if (window.location.href.indexOf('publicador') != 7) {
  if ($('brtpComentarios')){
  
   	var iframes = document.getElementsByTagName("iframe");
  	for (var i=0; i < iframes.length; i++) {
  	    if (iframes[i].name=="comente")
  	        var iframeComenteSrc = iframes[i].src;
  	}
  	var splitedSrc = iframeComenteSrc.split('/');
  	var comentid = splitedSrc[splitedSrc.length-1].split('.')[0];
  	//document.getElementById("comentid").value = comentid;
    //$('brtpComentarios').scrolling="yes";
    //ct=$('brtpComentarios').parentNode;
    //code=ct.innerHTML.replace("auto","no");
    //ct.innerHTML=code;
    }else{$("display_comentarios").style.display="none"}
//  }
}
/*---COMENTÁRIOS---*/

/*-------------------- PUBLICIDADE --------------------*/
//Define as peças de cada área
function pub(idi){
  switch (idi){
    case '01':
      OAS_AD('Top2');break;
    case '02':
      OAS_AD("Right1");break;
    case '03':
      OAS_AD('x09');break;
    case '04':
      OAS_AD('Middle');break;
    case '05':
      OAS_AD('x07');break;
    case '06':
      OAS_AD('x15');break;
    case '07':
      OAS_AD('Frame1');break;
    case '08':
      OAS_AD('Position1');break;
    case '09':
      OAS_AD('x05');break;
  }
}

//Inicia as peças
function OPEC_START(){
  //OAS_page = 'noticia';
  url=window.location.toString();
  if(url.indexOf("/veja_mais/galerias")>1 || url.indexOf("/veja_mais/noticias")>1){
    OAS_page = "listas";
  }
  OAS_VARS(OAS_page);
  OAS_START();
}

//Publicidade AFC - Google
function AFCVertical(){
	vAFC='<script type="text\/javascript" language="JavaScript" xml:space="preserve">'
            +'<!--'
                +'\ngoogle_ad_client = '+   afc_v[0]
                +'\ngoogle_ad_channel = '+  afc_v[1]
                +'\ngoogle_ad_width = '+    afc_v[2]
                +'\ngoogle_ad_height = '+   afc_v[3]
                +'\ngoogle_ad_format = '+   afc_v[4]
                +'\ngoogle_ad_type = '+     afc_v[5]
                +'\ngoogle_language = '+    afc_v[6]
                +'\ngoogle_color_bg = '+    afc_v[7]
                +'\ngoogle_color_text = '+  afc_v[8]
                +'\ngoogle_color_link = '+  afc_v[9]
                +'\ngoogle_color_line = '+  afc_v[10]
                +'\ngoogle_color_url = '+   afc_v[11]
                +'\ngoogle_color_border ='+ afc_v[12]
                +'\ngoogle_language = '+    afc_v[13]
                +'\ngoogle_encoding = '+    afc_v[14]
                +'\ngoogle_safe = '+        afc_v[15]
            +'// -->'
            +'</script>'
            +'<script type="text/javascript" language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><!--//--></script>';
	document.write(vAFC);
}

function AFCHorizontal(){
	vAFC='<script type="text\/javascript" language="JavaScript" xml:space="preserve">'
            +'<!--'
                +'\ngoogle_ad_client = '+   afc_h[0]
                +'\ngoogle_ad_channel = '+  afc_h[1]
                +'\ngoogle_ad_width = '+    afc_h[2]
                +'\ngoogle_ad_height = '+   afc_h[3]
                +'\ngoogle_ad_format = '+   afc_h[4]
                +'\ngoogle_ad_type = '+     afc_h[5]
                +'\ngoogle_language = '+    afc_h[6]
                +'\ngoogle_color_bg = '+    afc_h[7]
                +'\ngoogle_color_text = '+  afc_h[8]
                +'\ngoogle_color_link = '+  afc_h[9]
                +'\ngoogle_color_line = '+  afc_h[10]
                +'\ngoogle_color_url = '+   afc_h[11]
                +'\ngoogle_color_border = '+afc_h[12]
                +'\ngoogle_language = '+    afc_h[13]
                +'\ngoogle_encoding = '+    afc_h[14]
                +'\ngoogle_safe = '+        afc_h[15]
                +'\ngoogle_skip = '+        afc_h[16]
            +'// -->'
            +'</script>'
            +'<script type="text/javascript" language="JavaScript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><!--//--></script>';
	document.write(vAFC);
}
/*-------------------- PUBLICIDADE --------------------*/


/*-------------------- IMAGEM DA MATERIA --------------------*/

//remover crédito vazio
function removeEmptyCredit(){
	var allCreditElements = document.getElementsByTagName('p');
	for (var x = 0; x < allCreditElements.length; x++){
		elementCredit = allCreditElements[x];
		if(elementCredit.className == 'credit'){
			if(elementCredit.innerHTML == '' || elementCredit.innerHTML == '&nbsp;'){
				elementCredit.style.display = 'none';
			}
		}
	}
}

/*-------------------- DISPARA FUNÇÕES --------------------*/
function head_init(){
  OPEC_START();
}

window.onload=init;
function init(){
	retorno();
}

function materiasRelacionadas(){
	if($('brtpmateriarelacionadas')){
		$('brtpmateriarelacionadas').style.display="";
		for(x=1;x<=3;x++){
			if($('brtpmatreltitulo0'+[x])!= null && $('brtpmatreltitulo0'+[x]).innerHTML.length > 45){
				$('brtpmatrellink0'+[x]).title=$('brtpmatreltitulo0'+[x]).innerHTML;
				$('brtpmatreltitulo0'+[x]).innerHTML=$('brtpmatreltitulo0'+[x]).innerHTML.substr(0,42)+"...";
			}
			if($('brtpmatrelolho0'+[x]) != null && $('brtpmatrelolho0'+[x]).innerHTML.length > 70){
				$('brtpmatrellink0'+[x]).title=$('brtpmatrelolho0'+[x]).innerHTML;
				$('brtpmatrelolho0'+[x]).innerHTML=$('brtpmatrelolho0'+[x]).innerHTML.substr(0,67)+"...";
			}
		}
	}
}

aplicarOpacidade=function(){
	IdElementoSobreposto="pop_igCelular";
	var setPositionTimeOut;
	displayaplicarOpacidade=false;
	addOnresizeWindow=false;
	this.hide=function(){
		clearTimeout(setPositionTimeOut);
		$('IdOpacidade').style.display='none';
		$(IdElementoSobreposto).style.display='none';
		displayaplicarOpacidade=false;
	}
	this.appendaplicarOpacidade=function(){
		if(!$('IdOpacidade')){
			ElementoComOpacidade=document.createElement('div');
			ElementoComOpacidade.id="IdOpacidade";
			ElementoComOpacidade.onclick=function(){aplicarOpacidade.hide()};
			ElementoComOpacidade.style.position="absolute";
			ElementoComOpacidade.style.top=0;
			ElementoComOpacidade.style.left=0;
			ElementoComOpacidade.style.width="100%";
			ElementoComOpacidade.style.height="100%";
			ElementoComOpacidade.style.zIndex=1000;
			ElementoComOpacidade.style.backgroundColor="#000";
			ElementoComOpacidade.style.opacity=0.45;
			ElementoComOpacidade.style.filter="alpha(opacity=45)";
			ElementoComOpacidade.style.MozOpacity=0.45;
			document.getElementsByTagName('body')[0].childNodes[0].parentNode.insertBefore(ElementoComOpacidade,document.getElementsByTagName('body')[0].childNodes[0]);
			divContainer=document.createElement("div");
			divContainer.id="pop_igCelular"
			divContainer.style.position="absolute";
			divContainer.style.backgroundColor="#fff";
			divContainer.style.top=0;
			divContainer.style.left=0;
			divContainer.style.width="415px";
			divContainer.style.height="460px";
			divContainer.style.zIndex=1001;
			divContainer.text="oioi";
			document.getElementsByTagName('body')[0].childNodes[0].parentNode.insertBefore(divContainer,document.getElementsByTagName('body')[0].childNodes[0]);
		}
	}
	aplicarOpacidadeToZero=function(){
		$('IdOpacidade').style.width=0;
		$('IdOpacidade').style.height=0;
	}
	this.show=function(){
		this.appendaplicarOpacidade();
		displayaplicarOpacidade=true;
		if(navigator.userAgent.indexOf('MSIE')>=0 && addOnresizeWindow==false){
			window.attachEvent("onresize",
				function(){
					if(displayaplicarOpacidade==true){
						aplicarOpacidadeToZero();
					}
				}
			)
			addOnresizeWindow=true;
		}
		this.setPosition(0);
		$('IdOpacidade').style.display='block';
		HE=$(IdElementoSobreposto);
		HE.style.display='block';
		HE.style.position='absolute';
		HE.style.top=HE.style.left=0;
		HE.style.zIndex=1001;
		codeElementoSobreposto='<a href="javascript:aplicarOpacidade.hide();">fechar [x]</a>'+
		'<iframe src="http://portalig2.yavox.com/assinatura_web2/celular_carnaval_ig.php" width="415" height="460" frameborder="0" scrolling="no"><!-- // --></iframe>';
		$("pop_igCelular").innerHTML=codeElementoSobreposto;
		this.setPosition(1);
	} 
	this.setPosition=function(){
		IO=$('IdOpacidade');
		if(navigator.appVersion.indexOf("MSIE")>=0){
			IO.style.height=Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)+"px";
			if(document.documentElement.clientWidth>0){
				IO.style.width=document.documentElement.scrollWidth+"px";
			}else if(document.body.offsetWidth!=document.body.scrollWidth){
				IO.style.width=document.body.scrollWidth+"px";
			}else{
				IO.style.width=document.body.clientWidth+"px";
			}
		}else{
			IO.style.height=Math.max(document.body.clientHeight,document.documentElement.clientHeight,document.getElementsByTagName('html')[0].offsetHeight)+"px";
			IO.style.width=document.documentElement.clientWidth+document.documentElement.scrollLeft+document.body.scrollLeft+"px";
		}
		$(IdElementoSobreposto).style.top=$(IdElementoSobreposto).style.left='50%';
		scrollXOld=window.pageXOffset || ((document.body && document.body.scrollLeft?document.body.scrollLeft:false) || (document.documentElement && document.documentElement.scrollLeft?document.documentElement.scrollLeft:false)) || 0;
		scrollYOld=window.pageYOffset || ((document.body && document.body.scrollTop?document.body.scrollTop:false) || (document.documentElement && document.documentElement.scrollTop?document.documentElement.scrollTop:false)) || 0;
		$(IdElementoSobreposto).style.marginLeft=(($(IdElementoSobreposto).offsetWidth/2)*-1+scrollXOld)+"px";
		$(IdElementoSobreposto).style.marginTop=(($(IdElementoSobreposto).offsetHeight/2)*-1+scrollYOld)+"px";
		if(arguments[0]==1) setPositionTimeOut=setTimeout(function(){aplicarOpacidade.setPosition(1);},20);
	}
}
aplicarOpacidade=new aplicarOpacidade();
