var audioTagSupport = !!(document.createElement('audio').canPlayType);

// Need to check the canPlayType first or an exception
// will be thrown for those browsers that don't support it      

var myAudio = document.createElement('audio'); 

if (myAudio.canPlayType) {
  
   // Currently canPlayType(type) returns: "", "maybe" or "probably" 

   var canPlayMp3 = !!myAudio.canPlayType && "" != myAudio.canPlayType('audio/mpeg');
   var canPlayOgg = !!myAudio.canPlayType && "" != myAudio.canPlayType('audio/ogg; codecs="vorbis"');
   if ( canPlayMp3 )
   {
		myAudio.setAttribute( "src" , "slide.mp3" );
   } else if ( canPlayOgg ) {
		myAudio.setAttribute( "src" , "slide.ogg" );
   }
   myAudio.load();
}
		jQuery(document).ready(function($) {
			var last = "";
			$("a[rel^='prettyPhoto']").prettyPhoto();
			$(".gallery1 a[rel^='prettyPhoto']").prettyPhoto();
			$(".gallery2 a[rel^='prettyPhoto']").prettyPhoto();
			$(".gallery3 a[rel^='prettyPhoto']").prettyPhoto();
			$("#front a[rel^='prettyPhoto']").prettyPhoto();
			$("#front").click( function() {
				document.getElementById('pp_full_res').focus();
			} );
			$(".scroll").click(function(event){
				event.preventDefault();
				myAudio.play();
				$('#content').animate(
					{ scrollTop: $('#content').scrollTop()+$(this.hash).offset().top-108 } , 500
				);
				if ( last!="" )
				{
					last.childNodes[0].src = last.childNodes[0].alt + ".png";
					last.style.border="";
					last.style.color="";
				}
				last = event.currentTarget;
				last.style.border="2px solid #fff";
				last.style.color="#fff";
			});
			$(".scroll").mouseover( function(event) {
				event.preventDefault();
				event.currentTarget.childNodes[0].src = event.currentTarget.childNodes[0].alt + "_hover.png";
			});
			$(".scroll").mouseout( function(event) {
				if ( last!="" && event.currentTarget.childNodes[0]==last.childNodes[0] )
					return;
				event.preventDefault();
				event.currentTarget.childNodes[0].src = event.currentTarget.childNodes[0].alt + ".png";
			});
			$("#base").click();
});
