__urliG = document.location.toString();

//if(__urliG.indexOf("www.ig.com.br") == -1) {
//	location.href = "http://www.ig.com.br/";
//}

function trocaInput() {
	document.getElementById("layerInputLogin").innerHTML = "<input type=\"password\" name=\"password\" id=\"bl2_txtsenha\" onkeypress=\"if(event.keyCode == 13) validaManda();\" class=\"bcbrn w113 bd0 pt2 pl4 fv fwB cz1 f10 h20 bdb1 bdt1\">";
	setTimeout("setFocus()", 1);
}
	
function setFocus() {
	login.password.focus();
}

function addhomesite(oForm, tipoHome) {
    if(document.all) {
        oForm.style.behavior="url(#default#homepage)";
        oForm.setHomePage("http://www.ig.com.br/" + tipoHome);
        return false;
    }
}

function abreJanela(url) {
	window.open(url);
}

function setActionAkwan(f) {
	loc = "";
	
	if(f.target.value == 1) loc="http://farejador-1.ig.com.br/farejador/search?q=site%3Aig.com.br+" + escape(f.query.value) + "&orig=ig_xml_br_noig_search_home";
	else if(f.target.value == 2) loc="http://ultimosegundo.ig.com.br/busca/busca.shtml?origem=HOMEIG&query="+(f.query.value)+"&orig=ig_xml_br_noticias_search_home";
	else if(f.target.value == 3) loc="http://ig.katatudo.com.br/educacao/query.php?query=" + escape(f.query.value) + "&orig=ig_xml_br_escolar_search_home";
	else if(f.target.value == 4) loc="http://igshopping.ig.com.br/busca.asp?palavra="+escape(f.query.value);
	else loc="http://farejador-1.ig.com.br/farejador/search?q=" + escape(f.query.value) + "&orig=ig_xml_br_web_search_home&pg=1";
	
	ck(30041, 811, loc, '2');
}

function alocaBanAbs(divBan,esqPos){
 tblNome = document.getElementById('tbl_reftop');
 tdEsq  = (pegaXAbs(tblNome));
 tdEsq  = (tdEsq + esqPos);
 document.getElementById(divBan).style.left = tdEsq;
 document.getElementById(divBan).style.right = '-15px';
 document.getElementById(divBan).style.marginRight = '15px';
}

function alocaBanAbsTop(divBan,topPos,objRef){
 objNam = document.getElementById(objRef);
 objTop  = (pegaYAbs(objNam));
 objTop  = (objTop + topPos);
 document.getElementById(divBan).style.top = objTop;
}
 
 
function pegaXAbs(elt) {
 return parseInt(elt.x) ? elt.x : pegaPosAbs(elt,"Left");
}/* retorna o left absoluto */


function pegaYAbs(elt) { 
 return parseInt(elt.y) ? elt.y : pegaPosAbs(elt,"Top"); 
}/* retorna o top absoluto */

function pegaPosAbs(elt,posicao) {
 iPos = 0;
 while (elt != null) {
  iPos += elt["offset" + posicao];
  elt = elt.offsetParent;
 }
 return iPos;
}/* funcao chamada para adquirir top ou left absoluto */

//insira os divs absolutos aqui (div id + distancia left)
function aTodosBanrs(){
 alocaBanAbs('absCTopban',0);  //top banner
 alocaBanAbs('absCAnunc',728); //top anuncie 
 alocaBanAbs('abs3selos',661); //3 selos
 alocaBanAbs('absIfrUSEG',320);//iframe useg
 
 alocaBanAbsTop('absIfrUSEG',0,'divCorpo');
 alocaBanAbsTop('abs3selos',0,'divCorpo');
}

window.onresize = function(){
 window.setTimeout("aTodosBanrs()", 10);
}/* arruma tempo de execucao do imac */

function mudBtnsBus($pos){
 for($i=0; $i<=2; $i++){
  document.getElementById('bl2_btn'+$i).className = 'h21 w97 mt01 bg10 bgnR';
  document.getElementById('bl2img'+$i).src = 'http://image.ig.com.br/homev8/bl2/lbloff'+$i+'.gif';
 }

 document.getElementById('bl2_btn'+$pos).className = 'h21 w97 mt01 bg9 bgnR';		
 document.getElementById('bl2img'+$pos).src = 'http://image.ig.com.br/homev8/bl2/lblon'+$pos+'.gif';
 
 if($pos == 0) {
  document.f.target.value = 1;
 } else if($pos == 1) {
  document.f.target.value = 0;
 } else if($pos == 2) {
  document.f.target.value = 4;
 }
 
 if (document.f.query.value != ""){
 	setActionAkwan(document.f);
 }
 
}

//redirecionamento canais shopping
function shopping(url){
 window.open(url);
}

var regiao = document.location.search.replace(/^\?/,"");
if ((typeof regiao == "undefined") || (regiao == "")){regiao = "brasil";}
function carregaAba(link) {
    caixaAnterior = parent.caixaAnterior;
    
    if(caixaAnterior != '') {
        parent.document.getElementById(caixaAnterior).style.display = 'none';
    }

   	if(link.indexOf("esporte") != -1) {
       	parent.document.getElementById('bEspor').style.display = 'block';
       	parent.caixaAnterior = 'bEspor';
   	} else if(link.indexOf("mundo") != -1) {
       	parent.document.getElementById("bAparente_mundo").style.display = "";
       	parent.caixaAnterior = 'bAparente_mundo';
   	} else if(link.indexOf("brasil") != -1 && link.indexOf("capa_") == -1) {
       	parent.document.getElementById("bAparente_brasil").style.display = "";
       	parent.caixaAnterior = 'bAparente_brasil';
   	} else if(link.indexOf("cultura") != -1) {
       	parent.document.getElementById("bAparente_cultura").style.display = "";
       	parent.caixaAnterior = 'bAparente_cultura';
   	} else if(link.indexOf("babado") != -1) {
       	parent.document.getElementById("bAparente_babado").style.display = "";
       	parent.caixaAnterior = 'bAparente_babado';
   	} else {
       	parent.document.getElementById('bAparente').style.display = 'block';
       	parent.caixaAnterior = 'bAparente';
    }

	location.href = link + "?" + regiao;
} /* carregaAba */

//verifica se email ig.com.br ou superig.com.br
function validaManda() {
	var destino = document.login.username.value;

	if(destino.indexOf("superig.com.br") != -1) {
		document.login.action = 'http://auth.superig.com.br/central/authorganizer';
//		document.login.action = ck(30041, 812, 'http://auth.superig.com.br/central/authorganizer', '4');
	} else {
		if(destino.indexOf("@ig.com.br") != -1) {
			destino = destino.substring(0, destino.indexOf("@ig.com.br"));
		}
		document.login.username.value = destino;
		document.login.action = 'http://webmail.ig.com.br/inmail/chklogin.pl';
//		document.login.action = ck(30041, 812, 'http://webmail.ig.com.br/inmail/chklogin.pl', '4');
	}
	document.login.submit();
}

//Abri painel iGeconomia
function painel(){
Popup_Painel = ck(30038, 781, 'http://ultimosegundo.ig.com.br/paginas/igeconomia/painel.html', '3');
Popup_Painel.focus();
}

document.write('<scr'+'ipt language="javascript" src="http://image.ig.com.br/homev8/js/contaclique.js"></scr'+'ipt>');

function acessoVerifica() {
	_urlHome = (location.href).split("?");
	
	var urlFlashBox = "";
	var objFlash = "";
	
	if (_urlHome[1] == "acesso") {
		urlFlashBox = "http://image.ig.com.br/homev8/flash/box_hp_usuario.swf";
	} else {
		urlFlashBox = "http://image.ig.com.br/homev8/flash/box_hp.swf";
	}
	
	objFlash += "<object id='objFlashBox' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='130' height='85'>";
	objFlash += "	<param name='movie' value='" + urlFlashBox + "'>";
	objFlash += "	<param name='wmode' value='transparent'>";
	objFlash += "	<embed id='objFlashBox2' src='" + urlFlashBox + "' wmode='transparent' quality='high' width='130' height='85' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>";
	objFlash += "</object>";
	
	document.write(objFlash);
}
