﻿function incPlayCount(id) {
    var data = "";
    data = addData("postId", id, data);
    $.ajax({
        type: "POST",
        url: "/music/services/TsService.svc/IncPlayCount",
        data: '{ ' + data + '}',
        contentType: "application/json; charset=utf-8",
        processData: true,
        beforeSend: function () {
        },
        dataType: "json",
        success: function (json) {
        },
        error: function (xhr) {
        }
    });
    _gaq.push(['_trackEvent', 'Song', 'Play', id]);
}
function addData(key, value, data) {
    if (!data) {
        data = "";
        if (value) {
            data += '"' + key + '":"' + value + '"';
        }
    }
    else {
        if (value) {
            data += ',';
            data += '"' + key + '":"' + value + '"';
        }
    }
    return data;
}


function qs(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}
