  $(document).ready(function(){
	mainMenu();
	$("#audienceDropDowns").css("display", "none");
	$(".audienceLink").click(function () {
      $("#audienceDropDowns").slideToggle("slow");
	});
	$("#newsEventsLinksDropDowns").css("display", "none");
	$("#newsEventsLinks").click(function () {
      $("#newsEventsLinksDropDowns").slideToggle("slow");
	});

// begin slideshow

  // Clone all slides to the end to create a seamless wrap
  var nNumberOfClones = $('.slide').size();
  for (var n = 0; n < nNumberOfClones; ++n) {
	$($('.slide')[n]).clone().appendTo('#slidesContainer');
  }
  // randomize start - set to 0 if desired to start at beginning
  var currentPosition = 0;//Math.floor(Math.random() * nNumberOfClones);
  var slides = $('.slide');
  var numberOfSlides = slides.length;
  var animationSpeed = 1500;
  var pauseTime = 5000;
  var nMarginLeft = 0;
  var nTotalWidth = 0;

  // Remove scrollbar in JS
  $('#slidesContainer').css('overflow', 'hidden');
  
  // Wrap all .slides with #slideInner div
  slides
    .wrapAll('<div id="slideInner"></div>')
    // Float left to display horizontally, readjust .slides width
	.css({
      'float' : 'left',
    })
	// get the total width
	.each(function(){
		nTotalWidth += parseInt($(this).attr("width"));		   
	});

  // Set #slideInner width equal to total width of all slides
  $('#slideInner').css('width', nTotalWidth);
  
  // use setTimeout to animate slide
  timer = setInterval(doSlide, pauseTime);

  //hide things
  $('.hide').css('display', 'none');
  // lightbox video code
  $("a[rel^='prettyPhoto']").prettyPhoto({animationSpeed:'fast',slideshow:10000,default_width:960,default_height:563,hideflash:true,show_title:false,theme:'dark_rounded'});

  // doSlide: does the slideshow and manages controls
  function doSlide(){
    // Determine new position
	var nMoveBy = $(slides.get(currentPosition)).attr('width');
	if ($(slides.get(currentPosition)).attr('width') === undefined) {
		nMoveBy = slideWidth;
	}
	nMarginLeft -= (parseInt(nMoveBy) + 6);
	currentPosition++;
	//$(slides.get(currentPosition)).css('width',$(slides.get(currentPosition)).attr('width'));
    // Move slideInner using margin-left
    $('#slideInner').animate({
      'marginLeft' : nMarginLeft //slideWidth*(-currentPosition)
	},{
	  duration : animationSpeed,
	  complete : function(){
	  if (currentPosition == numberOfSlides-nNumberOfClones){
		currentPosition = 0;
		$('#slideInner').css('marginLeft',0);
		nMarginLeft = 0; // added
	  }
    }});
  }      
  });
Cufon.replace('#audienceLinks li', {hover:true});
Cufon.replace('.audienceDropDown ul li a');

