  $(function() {

    $("input[type='text'], input[type='password'], textarea").each(function(){
      $(this).attr('def_val', $(this).val());
      if ($(this).attr('def_val') !== undefined)
      {
        $(this).val($(this).attr('def_val')).focus(function(){
          if($(this).val()==$(this).attr('def_val')){
            $(this).val('');
          }
        }).blur(function(){
          if($(this).val()==''){
            $(this).val($(this).attr('def_val'));
          }
        });
      }
    })

    $("form.rate_movie img").hover(function(){
    rate_val = $(this).attr('alt');
    //alert(rate_val);
    $(this).parent().parent().children('a').each(function(){
      //alert($(this).children('img').attr('alt') + " <= " + rate_val);
      if ($(this).children('img').attr('alt') <= rate_val)
        $(this).children('img').attr('src', $(this).children('img').attr('src').replace('star_w','star_g'));
    });
  }, function(){
    $(this).parent().parent().children('a').each(function(){
      $(this).children('img').attr('src', $(this).children('img').attr('src').replace('star_g','star_w'));
    });
    
    });
    
  });

  function vote(id, option)
  {
    $.ajax({
      url: "glosuj,"+option,
      cache: false,
      success: function(html){
        document.getElementById("voted"+id).innerHTML = html;
      }
    });
  }