function doit(the_id) {
 flowplayer(
    'player',
    {
      src: "http://gallery.icecube.wisc.edu/web/lib/flowplayer.swf",
      //wmode: "transparent",
      provider: "pseudostreaming",
      debug: true,
      onLoad: function() {
        this.toggleFullScreen();

      }
    },
    {
      clip: {
        url: $("#"+the_id).attr('href'),
        scaling: 'orig'
      },
      plugins: {
        pseudostreaming: {
          url: "http://gallery.icecube.wisc.edu/web/lib/flowplayer.pseudostreaming.swf"
        },
        controls: {
          //autoHide: 'always',
          hideDelay: 2000
        }
      } 
    }
  )
}
KEY_SCROLL = true;
function page_scroll(cmd) {
  if (cmd == 'disable')  {
    document.body.onmousewheel = function() { return false; }
    KEY_SCROLL = false;
  } else if (cmd == 'enable') {
    document.body.onmousewheel = null;
    KEY_SCROLL = true;
  }
}

var ar=new Array(33,34,35,36,37,38,39,40);

$(document).keydown(function(e){
   var key = e.which;
    if(key == 27) {
      $("#player-cnt").fadeOut();
      page_scroll('enable');
      $("#mask").fadeOut();
      return false;
    }

    if(!KEY_SCROLL && $.inArray(key,ar)) {
        e.preventDefault();
        return false;
    }

    return true;
});

$(document).ready(function(){
    if ($.prettyPhoto == undefined) { return }
    $("a[rel^='prettyPhoto']").prettyPhoto({
      theme: 'dark_rounded',
      showTitle: true,
      
    });
    $("a.fp-video").click(function(e) {
      e.preventDefault();
      $("#player-cnt").css({'top': $(document).scrollTop() + 200});
      $("#player").css({'width': '672px', 'height': '567px;'});
      $("#mask,#player-cnt").fadeIn();
      //$("#player-cnt").fadeIn();
      page_scroll('disable');
      $("#player-close").click(function(e) {
        e.preventDefault();
        $("#player-cnt,#mask").fadeOut();
        page_scroll('enable');
      });
      doit(this.id);
    });

});

