$(document).ready(function(){

  var cHeight = parseInt($(".container").css("height"));
  if( cHeight > 265) {
    
    var href = window.location.href; //URL
    var hash = href.indexOf('#'); //Position of Hash
    var height = href.substring(hash + 2, href.length - 1); //Value for anchor

    var anchor = height;
    
    //Calculate where scroll bar should be
    var numItems = $(".container ul > li").size();
    var numContacts = $(".container > section").size();

    var count;
    if(numItems > 0)
      count = numItems;
    else
      count = numContacts;
       
        
    var step = 120 / count; 
    var bar = step * (anchor/30);
  
    //Paragraph Height
    var pHeight = $(".container p").css("height");
  
    //Cap max/min height for positioning
    if(height + pHeight < 260) anchor = 0;
    if(height > (cHeight - 260)) anchor = (cHeight - 260);
    
    $('.container').attr("style", "overflow:visible; height:auto; width:180px; padding-right:5px; position:absolute; top: -" + anchor + "px;");
    $('.jScrollPaneDrag').attr("style", "width: 10px; height: 147.532px; top: " + bar + "px; ");
    
  }
});

