$(function(){
        /*FIM DE INSCRIC*/
      $('#submission').click(function(){

          $(".caixa_fim_inscricao2").load("/msg_fim");
          var the_end2 = $('.caixa_fim_inscricao2').overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});

          the_end2.load();

      return false;
      });

       /*newsletter*/
       $("#bt_ok").mouseover(function(){
            $(this).css('background-position', '0px -275px');
        });
       $("#bt_ok").mouseout(function(){
            $(this).css('background-position', '0px -228px');
        });

       $("#bt_pro_pass").mouseover(function(){
            $(this).css('background-position', '0px -275px');
        });
       $("#bt_pro_pass").mouseout(function(){
            $(this).css('background-position', '0px -228px');
        });
       /*login*/
       var login = $("#caixa_login").overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});
       $("#tr_login").live('click',function(){
           $("#caixa_login").load("/exposes/construct/1");
           login.load();
       });
       var friend =  $("#caixa_login").overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});
       $("#tr_send_friend").live('click',function(){
           $("#caixa_login").load("/exposes/construct/2");
          friend.load();
       });
       var voto =  $("#caixa_login").overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});
         $("#tr_send_voto").live('click',function(){
            $("#caixa_login").load($("#tr_send_voto").attr("rel"));
            voto.load();
            return false;
         });

       var forgot = $(".caixa_forgot").overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});
         $("#tr_forgot").live('click',function(){
            forgot.load();
         });

       /*drop menus*/
      
      
      $("div#menu_contest").mouseover(function(){
                $("a#contest").css('background-position','0px -454px');
		$(this).stop().animate({height:'210px'}, 400);
      });
      
      $("div#menu_contest").mouseout(function(){
                $("a#contest").css('background-position','0px -410px');
		$(this).stop().animate({height:'50px'}, 400);
	});



        $("div#menu_themes").mouseover(function(){
                $("a#themes").css('background-position','-172px -454px');
		$(this).stop().animate({height:'285px'}, 400);
        });

        $("div#menu_themes").mouseout(function(){
                $("a#themes").css('background-position','-172px -410px');
		$(this).stop().animate({height:'50px'}, 400);
	});

        $("div#menu_movies").mouseover(function(){
                $("a#movies").css('background-position','-705px -454px');
		$(this).stop().animate({height:'170px'}, 400);
        });

        $("div#menu_movies").mouseout(function(){
                $("a#movies").css('background-position','-705px -410px');
		$(this).stop().animate({height:'50px'}, 400);
	});

       $("a.over_tema_movies").mouseover(function(){
           $i = $('a.over_tema_movies').index(this);
           $("a.over_tema_movies h3").eq($i).css("color","#09d9ff");
           $("a.over_tema_movies p").eq($i).css("color","#09d9ff");
       });
       $("a.over_tema_movies").mouseout(function(){
           $i = $('a.over_tema_movies').index(this);
           $("a.over_tema_movies h3").eq($i).css("color","#989898");
           $("a.over_tema_movies p").eq($i).css("color","#989898");
       });
      
        /*hover dos movies*/
        $(".frames div").mouseover(function(){
            $i = $(".frames div").index(this);
            $(".frames div").eq($i).css("background-image","url(/client/imgs/bgs/over_thumb_seleccionada_2.png)");
        });
        $(".frames div").mouseout(function(){
            $i = $(".frames div").index(this);
            $(".frames div").eq($i).css("background-image","none");
        });

        $(".listMyMovies div").mouseover(function(){
            $i = $(".listMyMovies div").index(this);
            $(".listMyMovies div").eq($i).css("background-image","url(/client/imgs/bgs/over_thumb_seleccionada_2.png)");
        });
        $(".listMyMovies div").mouseout(function(){
            $i = $(".listMyMovies div").index(this);
            $(".listMyMovies div").eq($i).css("background-image","none");
        });

        $("a#ok_forgot").click(function(){
           $("#form_forgot").submit();
        });

        /*JURI*/

        $(".editProfile").click(function(){
           i = $(".editProfile").index(this);
           j = $("#txtAux").val();
           if (j != "x")
               {
                   $("div.baixo").eq(j).slideUp("slow");
                   $(".editProfile").eq(j).slideDown("slow");
               }
           $("div.baixo").eq(i).slideDown("slow");
           $(".editProfile").eq(i).hide();
           $("#txtAux").val(i);
        });

        /*SHARE PROMO*/
        $("a#promoEmbed").click(function(){
           $(".caixaEmbed").slideToggle("slow");
        });
       $('#selEmbedPromo').click(function(){
          $(".caixaEmbed textarea").click();
       });
        $(".caixaEmbed textarea").click(function(){
            this.select();
        });

       var promo = $("#caixa_login").overlay({expose:"#000000", closeOnClick: true, top: "25%",oneInstance: false, speed:"fast", api:"true"});
       $("#sendPromo").live('click',function(){
          $("#caixa_login").load("/exposes/construct/4");
          promo.load();
       });

       $(".caixaEmbed").parents().click(function(){
           if ($(".caixaEmbed").show())
               {
                   $(".caixaEmbed").hide();
               }
       });
       $('.caixaEmbed').click(function(event){
         event.stopPropagation();
       });
    
});
