 ( function () {
 
 
 // alarm event handler
        navigator.mozSetMessageHandler('alarm',AlarmActivityHandler);
 var ring = new Audio();
 ring.loop = true;
		ring.src = "ring.mp3";
 var dateu = document.getElementById('useralarmd').value; 
 
var dd = new Date(dateu);
// Alarm API
    
     var   addAlarm = document.querySelector("#open-clock");
        
    if (addAlarm) {
        addAlarm.onclick = function () {
            var alarm =navigator.mozAlarms.add(dd, "honorTimezone", {
                "optionalData" : "I am data"
            });

            alarm.onsuccess = function () {
                alert('reussit');
				
            };

            alarm.onerror = function () { 
                alert('erreur');
            };

           
           
		}
    }

 
 function AlarmActivityHandler(mozAlarm) {
    ring.play();
}

var pickAnything = document.querySelector("#open-any");
    if (pickAnything) {
        pickAnything.onclick = function () {
             var pickAny = new MozActivity({
                 name: "pick"
             });

            pickAny.onsuccess = function () {
               
				document.getElementById("muzika").src = window.URL.createObjectURL(this.result.blob);
                
            };

            pickAny.onerror = function () {
                Alert("Eurreur fichier audio non importée");
            };
        };
    }    
})();

