function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode;
    if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}

function CloseLoadingpopup() {
    $('#dvTestLoadingmsg').hide();
    $('.hls-bg').hide();
}

var reader = new FileReader();
var filename = '';

function OpenFileUpload() {
    $('#flUpload').click();
}

function readURL(input) {
    if (input.files && input.files[0]) {
        reader.readAsDataURL(input.files[0]);
        filename = input.files[0].name;
        ajaxFileUpload();
    }
}

function ajaxFileUpload() {
    $("#loading").ajaxStart(function () {
        $(this).show();
    }).ajaxComplete(function () {
        $(this).hide();
    });
    $.ajaxFileUpload({
        url: '../../../UserControls/MultiFileUpload/common-file-upload.ashx',
        secureuri: false,
        fileElementId: 'flUpload',
        dataType: 'text',
        contentType: "application/json; charset=utf-8",
        data: { name: 'logan', id: 'id', hdn: '2' },
        success: function (response, status) {
            if (response == "-007") {
                alert('Cannot upload file as the used space exceeds allocated space')
                return
            }
            if (response == "-008") {
                alert('Invalid Extention')
                return
            }
            if (response == "-009") {
                alert('Cannot include / or .. in a filename')
                return;
            }
            window.setTimeout(function () {
                CloseLoadingpopup();
                $("#ctl00_CP_AlertTabContainer_SMSDeatil_lblUploadSuccessMsg").text("Uploaded Successfully");
            }, 100);
        },
        error: function (response, status, e) {
            window.setTimeout(function () {
                CloseLoadingpopup();
            }, 100);
        }
    })
    return false;
}