// =========================================================================
// Go to sleep mode when the Page tab is inactivated
// var muted_state_before_blur;// CJS mute while focus lost
var is_hidden = false;
$(document).on('visibilitychange', function (e) {
console.log("visibilitychange: ", document.visibilityState );
if( document.visibilityState == "hidden" ){
is_hidden = true;
// console.log("# BLUR");
// muted_state_before_blur = CJSound.muted;
// CJSound.muted = true;
}else{
is_hidden = false;
// console.log("# FOCUS");
// CJSound.muted = muted_state_before_blur;
}
});
// =========================================================================