
var Homepage = Anon.Structure.$extend({

  __init__ : function($_selectors) {
  
    this.$super($_selectors);
    this.buildThumbnails();
    this.defineEvents();
  },
  
  buildThumbnails : function() {
  },

  defineEvents : function() {
  
    var $self = this;
    $(this.NAVIGATION).bind({
      'scrollLeft'  : function(e) {
        $self.thumbs.slideThumbnailsRight();
      },
      'scrollRight' : function(e) {
        $self.thumbs.slideThumbnailsLeft();
      },
      'resize' : function(e) {
      }
    });
  
  }



});

$(document).ready(function(){


$('body').mousemove( function(e) {       
        	$('a.bd_nav').css('position', 'fixed');
        	$('a.bd_nav').css('top', ((e.pageY)-20) + 'px'); 
});



   var that = this;
    $(window).bind('hashchange', function() {
   // this.SLIDES.jumpToSlide(window.location.hash.replace("/", ""));
    
    var videoId = window.location.hash.replace("/", "");
    var videoIdNoHash = videoId.replace("#", "");
    
    if(videoIdNoHash == 'prev')
    {
      
      var pos = $('#bd_homepage').offset().left;
      console.log(pos);
      if(pos < 0) {    
        $('#bd_homepage').slide(600, 0, (pos*-1), '+=');
      }

    }
    if(videoIdNoHash == 'next')
    {
      var pos = $('#bd_homepage').offset().left,
          tmb = $('#bd_homepage').width(),
          win = $(window).width(),
          dif = tmb - win;
              
      if(pos >= 0) {
      
          $('#bd_homepage').slide(600, -dif, dif, '-=');
      
      }
  
    }
    
    

    });  

  var homepage = new Homepage({
    'logo'      : '#hd_logo',
    'nav'       : '#hd_nav', 
    'sub_nav'   : '#hd_sub_nav',
    'bd_nav'    : '.bd_nav',
    'bd'        : '#bd',
    'container' : '#bd_slides',
    'search'    : '#hd_search',
    'holder'    : '.clip_list',
    'thumb'     : '.clip',
    'home'      : '#bd_homepage'
  });

});
