function VerificaCapa()
{
     ckHome = readCookie("LNCHOME");

	 var temHome = true;

	 if ((ckHome != null) || (ckHome != ""))
	 {
		 switch (ckHome)
		 {
		 case 'RJ':
			document.location.href = 'default-rj.stm';
			break;
		 case 'SP':
			document.location.href = 'default-sp.stm';
			break;
		 case 'MG':
			document.location.href = 'default-rj.stm';
			break;
		 case 'NE':
			document.location.href = 'default-rj.stm';
			break;
		 case 'SUL':
			document.location.href = 'default-rj.stm';
			break
		 default:
			//document.location.href = 'default-rj.stm';
			temHome = false;
		 }
	 }
	 
	 if (temHome == false)
	 {
	 
		 ckEstado = readCookie("LNCUF");
		 if(ckEstado != null)
		 {
		   if(ckEstado == 'SP')
		   {
			 document.location.href = 'default-sp.stm';     
		   }
		   else
		   {
			 if(ckEstado == 'MG')
			 {
			   document.location.href = 'default-rj.stm';     
			 }
			 else
			 {
				if((ckEstado == 'RS') ||(ckEstado == 'PR') || (ckEstado == 'SC'))
				{
				  document.location.href = 'default-rj.stm';
				}
				else
				{
					if((ckEstado == 'MA') ||(ckEstado == 'PI') || (ckEstado == 'CE') || (ckEstado == 'RN') || (ckEstado == 'PB') || (ckEstado == 'PE') || (ckEstado == 'AL') || (ckEstado == 'SE') || (ckEstado == 'BA') || (ckEstado == 'AC') || (ckEstado == 'RO') || (ckEstado == 'AM') || (ckEstado == 'RR') || (ckEstado == 'AP') || (ckEstado == 'PA'))
					{
					  document.location.href = 'default-rj.stm';
					}
					else
					{
					  document.location.href = 'default-rj.stm';               
					} 
				}     
			 }     
		   }
		 }	 
		 else{
		   document.location.href = 'default-rj.stm';
		 }
	 }
}

var ckSiglaTime
function ObtemTime(){
	ckSiglaTime = readCookie("LNCTMSIGLA");
}




function NavegaNoticias2(sentido)
{
	valorinicial = document.frmNoticasC2.valorinicial.value
	ul = document.getElementById("NoticiasC2Naveg")
	//qtd = ul.children.length / 4
	qtd = (ul.getElementsByTagName("LI").length + 1) / 4
	tamanho = (parseInt(qtd) * - 133) + 133
	//tamanho = (parseInt(qtd) * -138) + 138

	//anterior
	if(parseInt(sentido)==1)
	{
		
		if(parseInt(valorinicial) < 0)
		{
			novovalor = parseInt(valorinicial) + 133
			//novovalor = parseInt(valorinicial) + 142
			ul.style.top = novovalor + "px"
			document.frmNoticasC2.valorinicial.value = novovalor
		}
				
	}
	//proximo
	else	
	{
		if(parseInt(valorinicial) > tamanho)
		{
			//novovalor = parseInt(valorinicial) - 142
			novovalor = parseInt(valorinicial) - 133
			ul.style.top =  novovalor + "px"
			document.frmNoticasC2.valorinicial.value = novovalor
		}	
		
	}
	
}	

/*function NavegaFotos(sentido)	
{
	valorinicial = document.frmFotos.valorinicial.value
	fotos =	document.frmFotos.arrayFotos.value;
	legendas =	document.frmFotos.arrayLegenda.value;
	creditos =	document.frmFotos.arrayCredito.value;	
	
	arrayFotos = fotos.split("|");
	arrayLegendas = legendas.split("|");
	arrayCredito = creditos.split("|");
	
	imagem = document.getElementById("TagImagemFotos")
	legenda = document.getElementById("TagLegendaFotos")

	//primeira
	if(parseInt(sentido)==0)
	{
		imagem.src = arrayFotos[0]
		imagem.alt = arrayCredito[0]
		legenda.innerHTML = arrayLegendas[0]
		document.frmFotos.valorinicial.value = 0
	}
	else
		//anterior
		if(parseInt(sentido)==1)
		{
			//if(parseInt(valorinicial)!= 0)
			//{
				pos = (arrayFotos.length + parseInt(valorinicial) - 1) % arrayFotos.length
				imagem.src = arrayFotos[pos]
				imagem.alt = arrayCredito[pos]
				legenda.innerHTML = arrayLegendas[pos]
				document.frmFotos.valorinicial.value = pos
			//}	
		}
		//proximo
		else
		{
			//if(parseInt(valorinicial) < (arrayFotos.length - 1))
			//{
				pos = (arrayFotos.length + parseInt(valorinicial) + 1) % arrayFotos.length
				imagem.src = arrayFotos[pos]
				imagem.alt = arrayCredito[pos]
				legenda.innerHTML = arrayLegendas[pos]
				document.frmFotos.valorinicial.value = pos
			//}
		}	
}	*/

function NavegaFotos(sentido)	
{
	valorinicial = document.frmFotos.valorinicial.value
	fotos =	document.frmFotos.arrayFotos.value;
	legendas =	document.frmFotos.arrayLegenda.value;
	alts = document.frmFotos.arrayAlts.value;
	
	arrayFotos = fotos.split("|");
	arrayLegendas = legendas.split("|");
	arrayAlts = alts.split("|");

	imagem = document.getElementById("TagImagemFotos")
	legenda = document.getElementById("TagLegendaFotos")

	//primeira
	if(parseInt(sentido)==0)
	{
		imagem.src = arrayFotos[0]
		imagem.alt = arrayAlts[0];
		legenda.innerHTML = arrayLegendas[0]
		document.frmFotos.valorinicial.value = 0
	}
	else
		//anterior
		if(parseInt(sentido)==1)
		{
			if(parseInt(valorinicial)!= 0)
			{
				pos = parseInt(valorinicial) - 1
				imagem.src = arrayFotos[pos]
				imagem.alt = arrayAlts[pos];
				legenda.innerHTML = arrayLegendas[pos]
				document.frmFotos.valorinicial.value = pos
			}	
		}
		//proximo
		else
		{
			if(parseInt(valorinicial) < (arrayFotos.length - 1))
			{
				pos = parseInt(valorinicial) + 1
				imagem.src = arrayFotos[pos]
				imagem.alt = arrayAlts[pos];
				legenda.innerHTML = arrayLegendas[pos]
				document.frmFotos.valorinicial.value = pos
			}
		}	
}

function NavegaLanceClic(estado)
{
	if(estado=='SP')
	{
		document.getElementById("ed_RJ").style.display = 'none';
		document.getElementById("ed_MG").style.display = 'none';
		document.getElementById("ed_SP").style.display = 'block';
	}
	if(estado=='MG')
	{
		document.getElementById("ed_RJ").style.display = 'none';
		document.getElementById("ed_SP").style.display = 'none';
		document.getElementById("ed_MG").style.display = 'block';
	}
	if(estado=='RJ')
	{
		document.getElementById("ed_RJ").style.display = 'Block';
		document.getElementById("ed_MG").style.display = 'none';
		document.getElementById("ed_SP").style.display = 'none';
	}
	
}	

function AbrePopup(url) 
  {    
  window.open(url,'LancePopupGaleria','width=330,height=350,toolbars=no')   
  }

function AbreEnquete(url) 
  {    
  window.open(url,'LancePopupEnquete','width=800,height=600,toolbars=no,scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes,titlebar=yes,toolbar=yes')   
  }
  
function treal_novo_velho(){
window.open('http://temporeal.lancenet.com.br/treal/temporeal.htm','lancetreal','width=795,height=560')
}

function treal_novo_velho2(){
	VerificaDominioParceiro();
    if (dominioparceiro){
      window.open('http://msn.temporeal.lancenet.com.br/treal/temporeal.htm','lancetreal','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	}else{
	  window.open('http://temporeal.lancenet.com.br/treal/temporeal.htm','lancetreal','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	}
}

function treal_novo(){
	VerificaDominioParceiro();
	
	var w = screen.availWidth
	var h = screen.availHeight

    if (dominioparceiro){
      window.open('http://msn.temporeal.lancenet.com.br/treal/temporeal.htm','lancetreal','top=0,left=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,height=' + h + ',width=' + w);
	}else{
	  window.open('http://temporeal.lancenet.com.br/treal/temporeal.htm','lancetreal','top=0,left=0,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,height=' + h + ',width=' + w);
	}
}

function treal_geral(codigo){
	VerificaDominioParceiro();

    if (dominioparceiro){
      window.open('http://msn.temporeal.lancenet.com.br/treal/esportes/tr_' + codigo + '.stm');
	}else{
	  window.open('http://temporeal.lancenet.com.br/treal/esportes/tr_' + codigo + '.stm');
	}
}

function ObtemData()
{
		var strData, strMonth, strDay, strYear;
		
		dataAtual = new Date();

		strDay = '' + dataAtual.getDate ();
		
		if (strDay.length == 1)
		
			strDay = '0' + strDay;
		
		month = dataAtual.getMonth() + 1;
		
		strMonth = '' + month;
		
		if (strMonth.length == 1)
		
			strMonth = '0' + strMonth;
		
		strYear = '' + dataAtual.getFullYear ();
		
		strData = strYear.substring(2, 4) + '-' + strMonth + '-' + strDay;

		return(strData);
}	

function NavegaNoticiasDia(strData)
{
	
	ano = (strData.split('-'))[0];

	if (parseInt(ano) <= 7)
	{
		strData = '';
	}

	if (strData != '')
		document.location.href = '/noticias/' + strData + '/';
	else
		document.location.href = '/noticias/' + ObtemData() + '/';
}

function NavegaTodasNoticias()
{
	//Para as internas
	var url = (document.location.href).toLowerCase();

	

	var dest = "";



	if (url.indexOf("noticias") == -1) //capa principal

	{

		dest = 'noticias/' + ObtemData() + '/';

	}else{ //integra de notícia

		dest = '../../noticias/' + ObtemData() + '/';

	}



	document.location.href = dest;

}

function NavegaTodasNoticiasPequim()
{
	//Para as internas
	document.location.href = '/especiais/pequim-2008/noticias/' + ObtemData() + '/';
}

function EnvieParaUmAmigo(link)
{
	window.open('http://www.lancenet.com.br/envie/envieparaumamigo.asp?link=' + link,'Envie','width=400,height=340')
}

function VerificaCapaAlteracao()
{
     ckHome = readCookie("LNCHOME");

	 if (ckHome != null)
	 {
		 document.getElementById("home").value = ckHome;
	 }
	 else{
	 
		 ckEstado = readCookie("LNCUF");
		 if(ckEstado != null)
		 {
		   if(ckEstado == 'SP')
		   {
			 document.getElementById("home").value = 'SP';     
		   }
		   else
		   {
			 if(ckEstado == 'MG')
			 {
			   document.getElementById("home").value= 'MG';     
			 }
			 else
			 {
				if((ckEstado == 'RS') ||(ckEstado == 'PR') || (ckEstado == 'SC'))
				{
				  document.getElementById("home").value= 'SUL';
				}
				else
				{
					if((ckEstado == 'MA') ||(ckEstado == 'PI') || (ckEstado == 'CE') || (ckEstado == 'RN') || (ckEstado == 'PB') || (ckEstado == 'PE') || (ckEstado == 'AL') || (ckEstado == 'SE') || (ckEstado == 'BA') || (ckEstado == 'AC') || (ckEstado == 'RO') || (ckEstado == 'AM') || (ckEstado == 'RR') || (ckEstado == 'AP') || (ckEstado == 'PA'))
					{
					  document.getElementById("home").value = 'NE';
					}
					else
					{
					  document.getElementById("home").value = 'RJ';               
					} 
				}     
			 }     
		   }
		 }	 
		 else{
		   document.getElementById("home").value = 'RJ';
		 }
	 }
}

function fechaBlog()
{
	document.getElementById("divBlog").style.display = "none";
}

function mostraBlog()
{
	document.getElementById("divBlog").style.display = "block";
}

function AbreRadio(v,t,c)
{
	link = "v=" + URLencode(v) + "&t=" + URLencode(t) + "&c=" + URLencode(c)
	
	if (dominioparceiro)
	{
		url = "http://msn.radiolance.com.br/RadioL/tabid/89/Default.aspx?";
	} else {
		url = "http://www.radiolance.com.br/RadioL/tabid/89/Default.aspx?";
	}
	
	window.open(url + link);

}

function URLencode(sStr) {
    return escape(sStr).
             replace(/\+/g, '%2B').
                replace(/\"/g,'%22').
                   replace(/\'/g, '%27').
                     replace(/\//g,'%2F');
  }


