$(document).ready(function() {   
           
    // Slider stuff
    $("#slider").easySlider({container: 'slider', prevId: 'prevBtn', prevText: 'Previous Image', nextId: 'nextBtn', nextText: 'Next Image', linky: 'myphotos'});
    $("#vidslider").easySlider({container: 'vidslider', prevId: 'vidPrevBtn', prevText: 'Previous Video', nextId: 'vidNextBtn', nextText: 'Next Video', counter: 'vidslidercounter', linky: 'myvideos'}); 
    
    // Subcomments 
    $(".subcomments_container").hide(); 
    
    $(".commentexpand").click(function() {
      $("#subcomments_container_" + this.id).slideDown();     
    });
    
    $(".commentcollapse").click(function() {
      $("#subcomments_container_" + this.id).slideUp();     
    });
    
    $(".addcommentbutton").click(function() {
      if($("input#addcomment_" + this.id).val() == ''){
          Boxy.alert("<p>Please enter a comment</p>", null, {title: 'There was a problem submitting your request'});
          return false;
      }
      else{
          var thisId = this.id;
          $.post("../../data/docomment.php?type=sub_comments&item="+this.id, {comment: $("#addcomment_" + this.id).val(), posted: '1'}, function(data){
              $("#subcomments_comments_" + thisId).html(data);
              // Increase comment count
              var ComTotal = $(".commenttotal_" + thisId).attr("id");
              ComTotal++;
              $(".commenttotal_" + thisId).html(ComTotal);       
              $("input#addcomment_" + thisId).val('')
          });
      }
         
    });
    
     
});

