var old_state="";
var paused=false;

// http://www.schillmania.com/projects/soundmanager2/

function pauseSound()
{
    paused=true;
	soundManager.pause('mySound');
}

function resumeSound()
{
    paused=false;
	soundManager.resume('mySound');
}


function pauseMusic()
{
	document.getElementById('on').style.color='#555555';
	document.getElementById('off').style.color='#aaaaaa';
	if (parent) parent.pauseSound();
    else pauseSound();
}
function resumeMusic()
{
	document.getElementById('off').style.color='#555555';
	document.getElementById('on').style.color='#aaaaaa';
	if (parent) parent.resumeSound();
    else resumeSound();
}
function checkSound()
{
    var x=document.getElementById("soundNavi");
    if (!x) return;
    if (parent.sound) {
        x.style.display="block";
        if (parent.sound.paused!='1') {
            document.getElementById('on').style.color='#aaaaaa';
            document.getElementById('off').style.color='#555555';
        } else {
            document.getElementById('on').style.color='#555555';
            document.getElementById('off').style.color='#aaaaaa';
        }
        parent.document.title=document.title;
    } else {
        x.style.display="none";
        window.setTimeout("checkSound()", 500);
    }
}

function pauseSound4Movie()
{
    old_state="";
    var x=document.getElementById("soundNavi");
    x.style.display="none";
    if (parent.sound) {
        if (parent.sound.paused!='1') {
                old_state="played";
                parent.pauseSound();
        } else {
                old_state="paused";
        }
    }
}

function resumeSound4Movie()
{
    var x=document.getElementById("soundNavi");
    x.style.display="block";
    if (parent.sound) {
        if (old_state=="played") {
            parent.resumeSound();
        }
   }
}
