$(document).ready(function(){
  if ($('.this_is_extras').length > 0) {
      window.setTimeout(function(){
          getPlayer().selectVideo(2,1);
      }, 5000);
  }
  if ($('.this_is_highlights').length > 0) {
      window.setTimeout(function(){
          getPlayer().selectVideo(1,1);
      }, 5000);
  }
  if ($('.this_is_yours').length > 0) {
      window.setTimeout(function(){
          getPlayer().selectVideo(3,1);
      }, 5000);
  }
  if ($('#searchdiv').length > 0) {
      $('#searchdiv').jqm({modal:true, overlay: 50, trigger: 'input#searchsubmit'});
      $('#searchdiv').jqmAddClose('#searchdiv');
  }
  if($('.slideshow').length > 0) {
      if(typeof(gallery) != 'undefined'){
          gallery.init();
      }
  }
  if ($('ul#snaps_slideshow li.current img')) {
      if(typeof(gallery) != 'undefined'){
          gallery.vertCenter( $('ul#snaps_slideshow li.current img') );
      }
  }
  
  if (($('#snaps_archives').length > 0) && (typeof(ALL_PHOTOS) != 'undefined')){
      photoArchivesInit()
  }
  if ($('#logo').length > 0) {
      var url = "/index.html";  // must keep in var named "url" like this for URL-munging code
      // Compare to "/index.html", "/", and ""
      if (url != window.location.pathname &&
          url.substring(0, url.length - 10) != window.location.pathname &&
          url.substring(0, url.length - 11) != window.location.pathname)
          $('#logo').addClass('not-home');
  }
  if ($('#videos').length > 0){
      setUpVideo();
      setupiVideoRatings();
  }
  
  // home poll code
  if($('#home_poll_wrapper_top').length > 0){
    if (typeof(setupPoll) != 'undefined')
      setupPoll();
  }
});
