$(function(){
  /************Script para substituição imagem / descrição ****************/
   $('.imagem-galeria').hover(function() {

     $(this).stop().animate({ marginTop: -205 + 'px'}, 200);

   }, function() {

     $(this).stop().animate({marginTop: -100 + 'px'}, 200);

   });
 
	 /************Música ****************/		

    // Inputs com Alt
    $( ".withAlt" ).each( function(){
        $( this ).val( $( this ).attr( "alt" ) );
    }).bind( "focus", function(){
        if( $( this ).val() == $( this ).attr( "alt" ) ){
            $( this ).val( "" );
        }
    }).bind( "blur", function(){
        if( $( this ).val() == "" ){
            $( this ).val( $( this ).attr( "alt" ) );
        }
    });
   // Inputs com Alt
   
   // Validação de Form
   $( "#postar" ).bind( "click", function(){
       formValido = true;
       $( $( this ).parent() ).find( "input" ).each( function(){
           if( $( this ).val() == $( this ).attr( "alt" ) ){
               formValido = false;
               $( this ).css({ "border" : "1px solid #F00", "color" : "#F00" });
           }else{
               $( this ).css({ "border" : "1px solid #CCC", "color" : "#CCC" });
           }
       }).parent().find( "select" ).each( function(){
           if( $( this ).val() == "" ){
               formValido = false;
               $( this ).css({ "border" : "1px solid #F00", "color" : "#F00" });
           }else{
               $( this ).css({ "border" : "1px solid #CCC", "color" : "#CCC" });
           }
       });
       if( formValido ){
           $( $( this ).parent() ).submit();
       }
   });
   // Validação de Form
});
