// carregar post

var navegador = navigator.userAgent.toLowerCase(); //Cria e atribui à variável global 'navegador' (em caracteres minúsculos) o nome e a versão do navegador
var xmlhttp; //Cria uma variável global chamada 'xmlhttp'

//Função que inicia o objeto XMLHttpRequest
function objetoXML() {
	if (navegador.indexOf('msie') != -1) { //Internet Explorer
		var controle = (navegador.indexOf('msie 5') != -1) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; //Operador ternário que adiciona o objeto padrão do seu navegador (caso for o IE) à variável 'controle'
		try {
			xmlhttp = new ActiveXObject(controle); //Inicia o objeto no IE
		} catch (e) { }
	} else { //Firefox, Safari, Mozilla
		xmlhttp = new XMLHttpRequest(); //Inicia o objeto no Firefox, Safari, Mozilla
	}
}

//Função que envia o formulário
function enviarForm(url, campos, destino) {
	var elemento = document.getElementById(destino); //Atribui à variável 'elemento' o elemento que irá receber a página postada
	objetoXML(); //Executa a função objetoXML()
	if (!xmlhttp) { //Se o objeto de 'xmlhttp' não estiver true
		elemento.innerHTML = 'Impossível iniciar o objeto XMLHttpRequest.'; //Insere no 'elemento' o texto atribuído
		return;
	} else { //Senão
		elemento.innerHTML = '<img src="img/ajax-loader.gif" width="16" height="16" align="left" hspace="4" /> Carregando...'; //Insere no 'elemento' o texto atribuído
	}
	xmlhttp.onreadystatechange = function () {
    	if (xmlhttp.readyState == 4 || xmlhttp.readyState == 0) { //Se a requisição estiver completada
    		if (xmlhttp.status == 200) { //Se o status da requisição estiver OK
    			elemento.innerHTML = xmlhttp.responseText; //Insere no 'elemento' a página postada
    		} else { //Senão
    			elemento.innerHMTL = 'Página não encontrada!'; //Insere no 'elemento' o texto atribuído
    		}
    	}
	}
	xmlhttp.open('POST', url+'?'+campos, true); //Abre a página que receberá os campos do formulário
	xmlhttp.send(campos); //Envia o formulário com dados da variável 'campos' (passado por parâmetro)
}


// fim carregar post

// valida campos

function validaCampos(){
	if (document.form_busca.busca.value==""){
		alert("Por favor, digite uma palavra para iniciar a busca!");
		document.form_busca.busca.focus();		
		return false;
	}	
	if (document.form_busca.busca.value=="Digite aqui o que procura"){
		alert("Por favor, digite uma palavra para iniciar a busca!");
		document.form_busca.busca.focus();		
		return false;
	}	
	return true;

}
function enviar(){

	if (validaCampos()){
		document.form_busca.submit();		
	}
}

// fim valida campos

// ajax carregar

try{
xmlhttp = new XMLHttpRequest();
}
catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E){
xmlhttp = false;
}
}
}
div_base = "";
function abre(arquivo,metodo,div){
div_base = div;
xmlhttp.open(metodo,arquivo, true);
xmlhttp.onreadystatechange=conteudo
xmlhttp.send(arquivo)
}
function conteudo() {
nova_div = div_base;
document.getElementById(nova_div).innerHTML='<img src="img/ajax-loader.gif" width="16" height="16" align="left" hspace="4" />Carregando...'
if (xmlhttp.readyState==4){
document.getElementById(nova_div).innerHTML=xmlhttp.responseText
}
}

// fim ajax carregar

// escreve flash

function escreve_flash(nome,largura,altura){

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+ 
' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"'+
' width="'+largura+'" height="'+altura+'" id="'+nome+'" align="middle">');

document.write('<param name="allowScriptAccess" value="sameDomain" />');

document.write('<param name="movie" value="'+nome+'.swf" />');

document.write('<param name="quality" value="high" />');

document.write('<param name="wmode" value="transparent" />');

document.write('<param name="bgcolor" value="#ffffff" />');

document.write('<embed src="'+nome+'.swf" quality="high"'+
' width="'+largura+'" height="'+altura+'" wmode="transparent" name="'+nome+'" align="middle"'+
' allowScriptAccess="sameDomain" type="application/x-shockwave-flash"'+
' pluginspage="http://www.macromedia.com/go/getflashplayer" />');

document.write('</object>');

}

// fim escreve flash

// favoritos

function addFav(){
    var url      = "http://www.jornalesportivo.com";
    var title    = "Jornal Esportivo :: O melhor do esporte em Goiás";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

// fim favoritos

// mudar fonte

var tam = 11;

function mudaFonte(tipo,elemento){
	if (tipo=="mais") {
		if(tam<16) tam+=2;
	} else {
		if(tam>11) tam-=2;
	}
	document.getElementById('mudaFonte').style.fontSize = tam+'px';
}

// fim mudar fonte

// enquete outros

function mostrar() {
nForm = document.forms['enquete'];
    if(nForm.elements['opcao'].checked = true) {
		nForm.elements['opcao'].className= "opcao";
		parent.document.getElementById("outros").style.display = "block"; 
		
    } 
}
function mostrar2() {
nForm = document.forms['enquete'];
    if(nForm.elements['opcao'].checked = true) {
		nForm.elements['opcao'].className= "opcao";
		parent.document.getElementById("outros").style.display = "none";
		nForm.elements['outros'].value= "";
    } 
}

// Popup
function fecharPopup(){
document.getElementById('popup').style.display = 'none';
}

function abrirPopup(){
document.getElementById('popup').style.display = 'block';
setTimeout ("fecharPopup()", 15000);
}
// Popup

// painel rotativo notícias

carrossel={id:null,to:0,direcao:"x",callback:null,rodando:0,elementClone:[],elementMove:[],init:function(){this.write()},write:function(){if(typeof setAndAnimate=="undefined"){document.write('<script src="js/setandanimate.js"><\/script>')}document.write("<style>			ul.carrosselFim {margin:0;}			ul.carrosselFim li.cloneOrigem,			ul.carrosselComeco li.clonado {display:none;}		</style>")},mover:function(){var b=0,a=0,d;if(this.rodando==0){this.rodando=1;if(typeof(arguments[0])=="object"&&arguments[0].length>=1){arguments=arguments[0]}this.to=arguments[0]["to"];this.id=arguments[0]["id"];this.direcao=typeof arguments[0]["direcao"]!="undefined"?arguments[0]["direcao"]:"x";this.callback=typeof arguments[0]["callback"]!="undefined"?arguments[0]["callback"]:null;if(this.elementClone.length>0){this.deletarClone()}else{document.getElementById(this.id).style[this.direcao=="x"?"marginLeft":"marginTop"]=0}d=document.getElementById(this.id).getElementsByTagName("li").length;document.getElementById(this.id).style[this.direcao=="x"?"width":"height"]=(document.getElementById(this.id).getElementsByTagName("li")[0][this.direcao=="x"?"offsetWidth":"offsetHeight"]*d)+"px";for(var c=0;c<((this.to<0)?this.to*-1:this.to);c++){this.elementMove[this.elementMove.length]=document.getElementById(this.id).getElementsByTagName("li")[((this.to>0)?c:d-c-1)];this.elementMove[this.elementMove.length-1].className="cloneOrigem";b+=this.elementMove[this.elementMove.length-1].offsetWidth;a+=this.elementMove[this.elementMove.length-1].offsetHeight;this.elementClone[this.elementClone.length]=this.elementMove[this.elementMove.length-1].cloneNode(true);this.elementClone[this.elementClone.length-1].className="clonado"}if(this.to>0){for(var c=0;c<((this.to<0)?this.to*-1:this.to);c++){document.getElementById(this.id).appendChild(this.elementClone[c])}}else{if(this.to<0){document.getElementById(this.id).className="carrosselComeco";for(var c=0;c<((this.to<0)?this.to*-1:this.to);c++){document.getElementById(this.id).insertBefore(this.elementClone[c],document.getElementById(this.id).getElementsByTagName("li")[0])}document.getElementById(this.id).style[this.direcao=="x"?"marginLeft":"marginTop"]=((this.direcao=="x"?b:a)*-1)+"px";document.getElementById(this.id).className=""}}var e=this;setAndAnimate.change({objName:this.id+"Animate",propriedade:[document.getElementById(this.id).style,this.direcao=="x"?"marginLeft":"marginTop","px"],inicio:document.getElementById(this.id).style[this.direcao=="x"?"marginLeft":"marginTop"],fim:((this.to>0)?(this.direcao=="x"?b:a)*-1:0),callback:function(){document.getElementById(carrossel.id).className="carrosselFim";if(e.direcao=="x"){document.getElementById(carrossel.id).style.marginLeft=0}else{if(e.direcao=="y"){document.getElementById(carrossel.id).style.marginTop=0}}setTimeout(function(){carrossel.deletarClone();document.getElementById(carrossel.id).className="";carrossel.rodando=0;if(e.callback!=null){e.callback()}},200)},velocidade:0.85})}},deletarClone:function(){for(var a=0;a<((this.to<0)?this.to*-1:this.to);a++){this.elementMove[a].parentNode.removeChild(this.elementMove[a])}this.elementClone=[];this.elementMove=[]}};carrossel.init();carrossel.getRodando = function(){return this.rodando;}


// troca fundo menu
function trocaConteudoMainBox(qual){
for (i=1;i<=4;i++){
document.getElementById('mainBoxImg'+i).className = "videos-mais2";
}
document.getElementById('mainBoxImg'+qual).className = "videos-mais";
conteudoMainBox = qual;
}
// troca fundo menu

function esconder() {
document.getElementById('campeonato-capa').style.display = "none";
}
function aparecer() {
document.getElementById('campeonato-capa').style.display = "";
}


function escondertime(time) {
document.getElementById('time'+time).style.display = "none";
}
function aparecertime(time) {
document.getElementById('time'+time).style.display = "";
}

function mostrardetalhejogos(id) {
document.getElementById('mostrar-detalhe'+id).style.display = "";
}
function esconderdetalhejogos(id) {
document.getElementById('mostrar-detalhe'+id).style.display = "none";
}



