if ($("#ultrasoundgynaPage").val() == 1)
{
    var hosturl = $('#hosturl').val();
    var patientId = $('#patientId').val();
    var controllName = $("#controllName").val();
    var mcount = $("#model_count").val();

    $(".sradio").live('click', function () {
        var id = $(this).attr("data-id");
        var colName = $(this).attr("data-colName");
        var tableName = $(this).attr("data-tableName");
        var value = $(this).attr('data-val');

        var thisId = $(this).attr('id');
        if (thisId == "limitedt")
        {
            $("#limitcond").css('display', 'inline');
        }
        else if (thisId == "goodt")
        {
            $("#limitcond").css('display', 'none');
        }
        
        if (thisId == "dab")
        {
            $("#abdes").css('display', 'inline');
        }
        else if (thisId == "dfree")
        {
            $("#abdes").css('display', 'none');
        }
        
        if (thisId == "normcon")
        {
            $("#normalcon").css('display', 'inline');
            $("#abnormalcon").css('display', 'none');
        }
        else if (thisId == "abcon")
        {
            $("#abnormalcon").css('display', 'inline');
            $("#normalcon").css('display', 'none');
        }

        $.post(hosturl + '/controllers/' + controllName + '.php?ac=update', {id: id, value: value, tableName: tableName, colName: colName, patientId:patientId}, function (res)
        {
        });
    });

    $('.delMsg').live('click', function () {
        var itemid = $(this).attr('data-id');
        bootbox.dialog({
            message: "Do you want to delete this item?",
            title: "Delete confirmation",
            buttons: {
                danger: {
                    label: "Cancel",
                    className: "btn-primary"
                },
                main: {
                    label: "Delete",
                    className: "btn-danger",
                    callback: function () {
                        //do something else
                        window.location.href = hosturl + "/controllers/" + controllName + ".php?ac=delRow&id=" + itemid + "&patientid=" + patientId;
                    }
                }
            }
        }).find('.modal-content').addClass('modal-sm');
    });

    $("#doneBtn").on('click', function () {
        var id = $(this).attr('data-id');
        $.post(hosturl + '/controllers/' + controllName + '.php?ac=update', {id: id, value: 1, tableName: "ultrasoundgyna", colName: "done", patientId: patientId}, function (res)
        {
            window.location.href = hosturl + "/controllers/" + controllName + ".php?ac=index&patientid=" + patientId;
        });
    });

    $(".showPrint").live('click', function () {
        var id = $(this).attr('data-detailid');
        $.post(hosturl + '/controllers/' + controllName + '.php?ac=showprint', {id: id, patientid: patientId}, function (data)
        {
            $("#vvv").html(data);
            $.print("#vvv");
            $("#vvv").html('');
        });



    });
    $('.datepickertoday').datepicker('setDate', '+0');
    $(".datepicker").datepicker({
        todayBtn: "linked",
        // autoclose: true,
        todayHighlight: true,
        format: 'yy/mm/dd',
        isRTL: true
    });
}