soundManager.url = WEB_ROOT+'/js/sm2/swf';
soundManager.flashVersion = 9; // optional: shiny features (default = 8)
soundManager.useFlashBlock = false; // optionally, enable when you're ready to dive in
soundManager.useHTML5Audio = true;
soundManager.debugMode = false;
soundManager.consoleOnly = true;

var mouseClicks;

var clickPositions = [150,3250,9250];


soundManager.onready(function(oStatus) {
  // check if SM2 successfully loaded..
  if (oStatus.success) {
    // SM2 has loaded - now you can create and play sounds!
    mouseClicks = soundManager.createSound({
      id: 'aSound',
      url: WEB_ROOT + "/audio/sfx/mouseClicks.mp3",
      volume: 80
      // onload: [ event handler function object ],
      // other options here..
    });
    mouseClicks.load();
  } else {
    // (Optional) Hrmm, SM2 could not start. Show an error, etc.?
    alert("sm2 error")
  }
});


$(function(){			
	$(document).mousemove(function(e){
		//var margin = ($(document).width()-$('#bd').width())/2;
		var targetPictureNumber = Math.round(((e.pageX*72)/$(document).width()));
		
		//var currentPictureNumber = $('#logo').attr('src').split(/\./);
		
      $('#logo').attr("src", "/new/img/3dLogo/ddubLogo3D."+targetPictureNumber+".jpg");		
      
   }); 
      
   $("#play-pause").button({
   		text: false,
   		icons: {
   			primary: 'ui-icon-play'
   		}
   });
   $(".click").mouseover(function(){
   			if(mouseClicks.playState == 1){
   				mouseClicks.stop();
   			}
				mouseClicks.play({position: clickPositions[Math.floor(Math.random()*clickPositions.length)]});
				mouseClicks.onposition(mouseClicks.position + 1000, function(){
					mouseClicks.stop();
				});

   });
   
});
