$(function(){

    _get_videos();
    _get_bcb_cotacoes();
    _get_rss();

	//$(".ui-tabs-nav-item:first").addClass("ui-tabs-selected");
	//$(".ui-tabs-panel:first").removeClass("ui-tabs-hide");
	//$("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 11000, true);


	$(".v-img").hover(function() {
		var ref = $(this).attr("ref");
		$("#"+ref).css("display","block");
	},
    function(){
        var ref = $(this).attr("ref");
		$("#"+ref).css("display","none");
    });
    $('.cat').hover(function(){
        $('.categorias').css('display' , 'block');
    });
    $('.openGoTo').hover(function(){
       $('.order').css('display' , 'block');
    },function(){
        $('.order').css('display', 'none');
        $('.categorias').css('display' , 'none');
    });
    $("#live, #chat").click(function(){
        window.open("/newaovivo", "player", "width=510 , height=490", "status=no" , "location=no" , "toolbar=no" , "scrollbars=no" , "directories=no")
    });
    $("#pedido").click(function(){
        window.open("/pedido",'', "width=380 , height=270", "status=no" , "location=no" , "toolbar=no" , "scrollbars=no" , "directories=no")
    });

	$(".header").toggle(function(){
		var ref = $(this).attr("ref");
		$("#"+ref).slideUp("fast");
		$("."+ref).css("backgroundPosition","0 -12px");
	},
	function(){
		var ref = $(this).attr("ref");
		$("#"+ref).slideDown("fast");
		$("."+ref).css("backgroundPosition","0 0");
	});

	$('.pedir').toggle(function(){
		$('#pedir').slideDown('fast');
	}, function(){
		$('#pedir').slideUp('fast');
	});
        $('#popRadio').click(function(){
            window.open("/newaovivo", "player", "width=510 , height=490", "status=no" , "location=no" , "toolbar=no" , "scrollbars=no" , "directories=no")
        });
        $('#close').click(function(){
            $("#popupRadio").css("display" , "none")
        });
   function _get_bcb_cotacoes()
   {
       $.post("acmanager", {action:'cotacoes_getBCB'},
       function(r)
       {
           if(r!='error'){
               $("#cotacoesBCB").html(r);
           } else {
               $("#cotacoesBCB").html("<p class='dft_11' style='padding: 10px;'>Falha! Tentando Novamente</p>");
               _get_bcb_cotacoes();
           }
       });
   }

   function _get_rss()
   {
       $.post("acmanager", {action:'rss_get'},
       function(r)
       {
           if(r!='error'){
               $("#rssg").html(r);
           } else {
               $("#rssg").html("<p class='dft_11' style='padding: 10px;'>Falha! Tentando novamente</p>");
               _get_rss();
           }
       });
   }

   function _get_videos()
   {
       $.post("acmanager", {action:'videos_get'},
       function(r)
       {
           if(r!='error'){
               $("#rssv").html(r);
           } else {
               $("#rssv").html("<p class='dft_11' style='padding: 10px;'>Falha! Tentando novamente</p>");
               _get_rss();
           }
       });
   }

});

