

	




function mute() {
  $("audio") //loop for each item
  .each(function(i) {
	  if (this.muted == false){
	  this.muted = true;
  	  } else if (this.muted == true) {
	  this.muted = false;	  
      }
  });	
}

$('#mute').show(); 


//Cookie features are controlled in initialize.js

$("#mute").click(function () {
$("#mute > p").toggle();
var x = getCookie('sound_muted');
if(x == 'true')
{
setCookie('sound_muted','false',7);
}
else
{
setCookie('sound_muted','true',7);
}
mute();
});

if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
     		var increment = 0;
  $("img") //loop for each item
  .each(function(i) {
	if (increment > 4){
		increment = 0;	
	}  
    if (i != 0) {  //only clone if there are more than one 'img' items
       //tried alternate technique
       //var $cloneme =   $('<audio id="hover-' + increment + '" preload="auto"><source src="/themes/grid-panel/sound/mouseover' + increment + '.ogg"></source><source src="/themes/grid-panel/sound/mouseover' + increment + '.mp3"></source></audio>')  //item to clone 
       //$cloneme  //item to clone 
       
      $("#hover-" + increment)  //item to clone     
        .clone(true)
        .attr("id", "beep-" + i)  //new name of object
        .appendTo($(this).parent()); 
    }
    $(this).data("instance", i);  //save the integer for loop
    increment=Math.floor(Math.random()*3);  //change increment
  })
  .mouseenter(function() {
if ($.browser.msie ) {
  if ($.browser.version >= 9){
	    $("#beep-" + $(this).data("instance"))[0].play();  
  }
} else if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
    $("#beep-" + $(this).data("instance"))[0].play();
}
  });
$("#hover-1").attr("id", "beep-0"); //rename first object to match naming convention

  $('img').click(function() {
	  var thissound=document.getElementById('click-1');
if ($.browser.msie ) {
  if ($.browser.version >= 9){
	      thissound.play();  
  }
} else if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
      thissound.play();
}
  });
  
}
  
  
