var playing = false;

$(document).ready(function ()
{
  $('#slideshow')
    .cycle(
    {
      fx: 'scrollHorz',
      timeout: 6000,
      speed: 1500,
      pager: '#pager',
      pagerAnchorBuilder: function (index, element) { return '<a href="#">&bull;</a>'; }
    })
    .delegate('li', 'click', function ()
    {
      $('#slideshow').cycle('pause');
      $(this).children('.video').fadeIn();
    })
    .delegate('a.close', 'click', function ()
    {
      $('#slideshow').cycle('resume');
      $(this).parent().fadeOut();
      return false;
    });
});

function popup(url, windowname)
{
  var width = 495;
  var height = 405;
  var left = (screen.width - width) / 2;
  var top = (screen.height - height) / 2;
  var params = 'width=' + width + ', height=' + height;
  params += ', top=' + top + ', left=' + left;
  params += ', directories=no';
  params += ', location=no';
  params += ', menubar=no';
  params += ', resizable=no';
  params += ', scrollbars=no';
  params += ', status=no';
  params += ', toolbar=no';
  newwin = window.open(url, '_blank', params);
  if (window.focus) { newwin.focus() }
  return false;
}
