$(document).ready(function(){
  $("input, textarea").example(function() {
    return $(this).attr('title');
  });  

  tooltip();

  $('#more_activities').live('click', function(){
    var $this = $(this);
    var page = $this.attr('href').substr(1);
    profile_links_more(page);
    return false;
  });

  fancy_place_photos();
  initJGrowl();
  
    
    $('#video-upload-button').click(function(){
      $('#upload-video').modal();
      return false;
    });
    
    $('#comment-photo-submit').click(function(){
      $('#picture-select').uploadifyUpload();
      return false;
    });
    
    $('#photo-upload-button').click(function(){
      $('#upload-photo').modal();
      return false;
    });
    
    $('#upload-form').submit(function(){
      var query = new Object();
      var arr = $('#upload-form').serializeArray();
      for(var i=0; i<arr.length; i++){
        query[arr[i].name]=encodeURIComponent(arr[i].value);
      }
      $('#video-select').uploadifySettings('scriptData', query);
      $('#video-select').uploadifyUpload();
      return false;
    });
    
  $('#upload-cancel').live('click', upload_cancel);
  
  $('#profile-links').tabs(".thumbnail-details.comments", {'effect': 'ajax', 'current': 'active', 'initialIndex': -1, 'onClick': function(){
    fancy_place_photos();
    this.getCurrentTab().parent().addClass("active").siblings().removeClass('active');
  }}).history();
  
  $('input, textarea').live('click', function(){
    if($(this).text() == "Click here to write a comment"){
      $(this).text("");
    }
  });
  
  $('.comment-reply').live('click',function(event){
    event.preventDefault();
    $(this).parent().siblings('.comment-reply-form').show();
    return false;
  });
});
