jQuery(document).ready(function () {
	
	jQuery('#header ul ul').css({'display':'none'});
	jQuery('#header ul ul a').fadeTo("slow", 0);
	
	jQuery('#header ul li').hover(
	      function () {
	        jQuery(this).addClass('hover').children('ul').slideDown('slow',function(){ 
			  jQuery(this).children('li').children('a').fadeTo(100, 1);
			});
	      }, 
	      function () {
			jQuery(this).addClass('hover').children('ul').children('li').children('a').fadeTo(100, 0,function(){ 
			  jQuery(this).parent('li').parent('ul').slideUp('slow');
			});
	      }
	    );
	
		//show buttons for javascript users
		jQuery('.gallery .buttons').show();
		
		//show overlay and set opacity to 0
		jQuery('.gallery .overlay').css({'opacity':'0','filter':'alpha(opacity=0)'}).show();

		//hide play button
		jQuery('.gallery .buttons .play').hide();

		//get image sources array
		jQuery('div.gallery .container img').each(function() {
		    imgSources.push(jQuery(this).attr('src'));
		});

		t=setTimeout("nextImage()",pauseTime);

		jQuery('a.pause').click( function() {
			pause();
			jQuery('.gallery .buttons .pause').hide();
			jQuery('.gallery .buttons .play').show();
			return(false);
		});

		jQuery('a.play').click( function() {
			play();
			jQuery('.gallery .buttons .play').hide();
			jQuery('.gallery .buttons .pause').show();
			return(false);
		});
		
		jQuery('a.rewind').click( function() {
			previousImage();
			return(false);
		});
		
		jQuery('a.forward').click( function() {
			nextImage();
			return(false);
		});
});
