
function abreNoticia(posicaoNotiEmpr)
{
    var urlNoticia = document.getElementById('urlNoticia['+posicaoNotiEmpr+']').innerHTML;

    //alert(urlNoticia);
    window.location.href = urlNoticia;
}


function limpaNoticia()
{
    var qtdNoticias = document.getElementById('qtdNoticias').value;

    for(var i=0; i< qtdNoticias; i++)
    {
        document.getElementById('urlFotoNotiEmpr['+i+']').style.display ='none';

        document.getElementById('noticia['+i+']').className = 'semDestaNoticia';
    }
}

function alternaNoticia(posicaoNotiEmpr, evento, tipo)
{
    var urlFotoNotiEmpr = document.getElementById('urlFotoNotiEmpr['+posicaoNotiEmpr+']');


    if(tipo)
    {
        if(t){
            clearTimeout(t);
        }

        if(evento.type =='mouseover')
        {
            limpaNoticia();
            document.getElementById('noticia['+posicaoNotiEmpr+']').className = 'destaNoticia';

            urlFotoNotiEmpr.style.display = 'block';
        }
        else
        {
            document.getElementById('noticia['+posicaoNotiEmpr+']').className = 'semDestaNoticia';
            t=setTimeout("alternaNoticia(0, null, false);", 1);
        }
    }
    else
    {
        limpaNoticia();
        document.getElementById('noticia['+posicaoNotiEmpr+']').className = 'destaNoticia';

        urlFotoNotiEmpr.style.display = 'block';

        var qtdNoticias = document.getElementById('qtdNoticias').value;

        if(qtdNoticias==3){
            if(posicaoNotiEmpr==0)
            {
                t=  setTimeout("alternaNoticia(1, null, false);", 5000);
            }

            if(posicaoNotiEmpr==1)
            {
                t= setTimeout("alternaNoticia(2, null, false);", 5000);
            }

            if(posicaoNotiEmpr==2)
            {
                t= setTimeout("alternaNoticia(0, null, false);", 5000);
            }
        } else if(qtdNoticias==2){
            if(posicaoNotiEmpr==0)
            {
                t=  setTimeout("alternaNoticia(1, null, false);", 5000);
            }

            if(posicaoNotiEmpr==1)
            {
                t= setTimeout("alternaNoticia(0, null, false);", 5000);
            }
        }
    }
}

