
    function popitup(url,largura,altura,nome) {
        newwindow=window.open(url,nome,'height='+altura+',width='+largura);
        if (window.focus) {
            newwindow.focus()
        }
        return false;
    }


    function mudaCor(cor)
    {

        var corFinal = 'verde';
        if (cor=='verde' || cor=='rosa' || cor=='amarelo' || cor=='laranja' || cor=='roxo')
        {
            corFinal = cor;
        }


        $.cookie("bg_color", null);
        $.cookie("bg_color", corFinal, {path: '/'});

/*
        var link = $("<link>");
        link.attr({
            type: 'text/css',
            rel: 'stylesheet',
            href: '/w/estilo_'+corFinal+'.css'
        });
        $("head").append( link );
        */

var fileref=document.createElement("link")
  fileref.setAttribute("rel", "stylesheet")
  fileref.setAttribute("type", "text/css")
  fileref.setAttribute("href", '/w/estilo_'+corFinal+'.css')

 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref)


    }


  //  mudaCor($.cookie("bg_color"));





    $(document).ready(function(){

        $('.slideshow').cycle({
            fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        });




        $('.autoLink').click(
        function () {
            if (window.parent)
                window.parent.location = $('a:first',this).attr('href');
                else
            window.location = $('a:first',this).attr('href');

        });



        $('.baseFull').hover(
        function () {
            //$(this).stop().animate({backgroundColor:'#BFD72F',color:'white'}, 500);
            $(this).stop().animate({"":'none',color:'red'},0);


        }, function () {
            $(this).stop().animate({"":'url(/w/img/fade_soft.png)',color:'black'},0);

        });




        $('.homeNotH').hover(
        function () {
            //$(this).stop().animate({backgroundColor:'#BFD72F',color:'white'}, 500);
            $(this).stop().animate({"background-color":'#BFD72F',color:'black'},0);


        }, function () {
            $(this).stop().animate({"background-color":'white',color:'black'},0);

        });


        $('.sepLinhas').hover(
        function () {
            $(this).stop().animate({backgroundColor:'#666',color:'white'}, 500);
        }, function () {
            $(this).stop().animate({backgroundColor:'white',color:'black'}, 500);
        });


        $('#top_webcam').hover(
        function () {
            $(this).attr('src','/w/img/webcam-on.png');
        }, function () {
            $(this).attr('src','/w/img/webcam.png');
        });

        $('#top_emissao').hover(
        function () {
            $(this).attr('src','/w/img/emissao-on.png');
        }, function () {
            $(this).attr('src','/w/img/emissao.png');
        });
        
        $('#top_rss').hover(
        function () {
            $(this).attr('src','/w/img/rss-on.png');
        }, function () {
            $(this).attr('src','/w/img/rss.png');
        });        

        $('#top_twitter').hover(
        function () {
            $(this).attr('src','/w/img/twitter-on.png');
        }, function () {
            $(this).attr('src','/w/img/twitter.png');
        });

        $('#top_facebook').hover(
        function () {
            $(this).attr('src','/w/img/facebook-on.png');
        }, function () {
            $(this).attr('src','/w/img/facebook.png');
        });


        $('.homePubMeioBanner').hover(
        function () {
            $(this).stop().animate({backgroundColor:'black',color:'white'}, 500);
        }, function () {
            $(this).stop().animate({backgroundColor:'red'}, 1000);
        });



        $('.destqueLat').cycle({
            fx: 'fade',
            pause: true
        });



    });




function bookmark(address,sitename) {
  if (window.sidebar) {
    window.sidebar.addPanel(sitename, address,"");
  } else if( document.all ) {
    window.external.AddFavorite(address, sitename);
  } else if( window.opera && window.print ) {
    return true;
  }
  return false;
}



function updateHp()
{
    $.getJSON('/services/noar', function(data) {

        if (data.estado == 'sucesso')
        {

            artista = data.resposta.agoraArtista;
            musica = data.resposta.agoraMusica;

            artista = artista.substr(0,23);
            musica = musica.substr(0,30);

            if ($('#noarMusicaArtista').html()+$('#noarMusicaTitulo').html() != artista+musica)
            {
                $('#noarMusicaArtista').html(artista);
                $('#noarMusicaTitulo').html(musica);
            }
            
            
        }

        setTimeout('updateHp()', 10000);

    });
}
