﻿var playing = new Array();

function PlayAudio(pAudio, id) {
    try {
        for (i = 0; i < playing.length; i++) {
            if (playing[i] == pAudio) {
                $f(pAudio).stop();
                playing[i] = '';
                return;
            }
        }
        playing[playing.length] = pAudio;
        $f(pAudio).play();
        UpdatePlayCount(id);
    } catch (e) { alert(e.message); }
}



function UpdatePlayCount(id) {
    try {
        $.ajax(
                        {
                            url: "/Services/ServiceMSDigitalDaily.svc/IncrementArticleViewCount",
                            data: '{ "iArticleID" : ' + id + '}',
                            type: "POST",
                            contentType: "application/json; charset=utf-8",
                            timeout: 10000,
                            dataType: "json",
                            async: false
                        }
                    );
    } catch (e) { }
    return false;
}