(function() {
    $(function() {
        setTimeout(function() {
            jsReady = true;
        }, 200);
        $(".voice-js").live("click",function(eve) {
            playVoice2(this, $(this).data('rel'));
            eve.preventDefault();
        });
        $("#results h2 .voice-js").live("mouseover", function(eve) {
            playVoice2(this, $(this).data('rel'));
            eve.preventDefault();
        });
        $(".humanvoice-js").live("click", function(eve) {
            playVoice($(this).data('rel'));
            eve.preventDefault();
        });
    });
    var playVoice = function(path) {
        stopVoice();
        if (swfReady) {
            $('#simplayer').siblings('.close').click();
            document.getElementById('dictVoice').playVoice(path);
        }
    };
    var playVoice2 = function(uri, query) {
        var path = "http://dict.youdao.com/dictvoice?audio=" + query;
        playVoice(path);
    };
})();
var swfReady = false;
var jsReady = false;
function setSWFIsReady() {
    swfReady = true;
}
function isContainerReady() {
    return jsReady;
}
function stopVoice() {
    if (swfReady) document.getElementById('dictVoice').stopVoice();
}

