
function fechar(id){
    $("#"+id).css({ "display":"none" })
}

$(document).ready(function(){  

    $('a#modal').modal();
    
    $(".popup").click(
        function (){
          href = $(this).attr("href")
          window.open(href,"popup","status=yes,scrollbars=no,width=760,height=600")
          return false
        }
    )
    
    $(".joguinho").click(
        function (){
          href = $(this).attr("href")
          window.open(href,"popup","status=yes,scrollbars=yes,width=760,height=580")
          return false
        }
    )
    
    $('#lsFotos').cycle({ 
        fx:     'turnDown', 
        speed:  'fast', 
        timeout: 0, 
        next:   '#next', 
        prev:   '#prev' 
    });
    
    $("a.wallpaper").click(
        function (){
            var radio_selec = $(":checked").val()
            var img = $(this).attr("id")
            location.href = ROOT+"wallpaper.php?rs="+radio_selec+"&w="+img
            return false;
        }
    );
    $("input, textarea, select").focus(
        function () {
            $(this).css({ "border-color":"#C8262C"})
        }
    );
    
    $("input, textarea, select").blur(
        function () {
            $(this).css({"border-color":"#fff" })
        }
    );
    
    $("#cadastro input[type=text], #cadastro textarea, #cadastro select").focus(
        function () {
            $(this).css({ "border-color":"#C8262C", "background":"#eee"})
        }
    );
    
    $("#cadastro input[type=text], #cadastro textarea, #cadastro select").blur(
        function () {
            $(this).css({"border-color":"#AD1278", "background":"#fff" })
        }
    );
    
    $("a.comentar").click(
        function (){
            $("#form_comentar").toggle("slow");
            $("#canal_comentarios").scrollTo({top:"+=400px"}, 800); 
            return false;
        }
    );
    
    $("ul.fdSecao li img").fadeTo("slow", 0.6);
    
    $("ul.fdSecao li img").hover(function(){
        $(this).fadeTo("slow", 1.0)
    },function(){
        $(this).fadeTo("slow", 0.6)
    });
    
    if (typeof document.body.style.maxHeight == "undefined") {
        var extencao = "gif"
    }else{
        var extencao = "png"
    }
    $("ul#lsVideos li").hover(function(){
        liclasse = $(this).attr("class")
        link = $(this).find("a").attr("href")
        title = $(this).find("a").attr("title")
        img = $(this).find("img")
        
        if(liclasse == "tudo-e-possivel"){
            img.fadeTo("slow", 0.5)
            $(this).append("<span class=\"liVideos\"><a href='"+link+"' title='"+title+"'><img src=\""+ROOT+"imagens/tudoepossivel."+extencao+"\" /></a></span>")
        }
        if(liclasse == "making-of"){
            img.fadeTo("slow", 0.5)
            $(this).append("<span class=\"liVideos\"><a href='"+link+"' title='"+title+"'><img src=\""+ROOT+"imagens/mkoff."+extencao+"\" /></a></span>")
        }
        if(liclasse == "retro"){
            img.fadeTo("slow", 0.5)
            $(this).append("<span class=\"liVideos\"><a href='"+link+"' title='"+title+"'><img src=\""+ROOT+"imagens/retro."+extencao+"\" /></a></span>")
        }
    },function(){
        img.fadeTo("slow", 1);
        var span = $(".liVideos")
        span.remove()
    });
    
    $("form#form_pesquisa").hover(function(){
        $(this).css("background-color", "#083741")
    },function(){
        var pon = $("#fPesquisa").attr("class")
        if(pon != "hidden pOn"){
            $(this).css("background-color", "transparent")
        }
    });
    $("form#form_pesquisa").click(function(){
        $("#fPesquisa").css("display", "block", "background-color", "#083741")
        $("#fPesquisa").addClass("pOn")
    });
    
    $("#lsEnsaio.lista ul li").hover(function(){
        $("#lsEnsaio.lista ul li h2").hide()
        htm = $(this).html()
        $(this).html("<h2 class=\"ensaioTL\">"+$(this).attr("title")+"</h2>"+htm)        
    },function(){
        $(this).html(htm)
        $("#lsEnsaio.lista ul li h2").hide()
    })
    
    $("#thumb a.esconde").toggle(function(){
        $("#thumb img#pic").animate({width: "0", height: "151px"}, 500 )
        $("#thumb a.esconde").html('<img src="'+ROOT+'imagens/proximo.gif" />')
        return false
    },function(){
        $("#thumb img#pic").animate({width: "187px", height: "151px"}, 500 )
        $("#thumb a.esconde").html('<img src="'+ROOT+'imagens/anterior.gif" />')
        return false
    });

});
