﻿//Script for Image Preview Before Upload

$(document).ready(function () {
    $("#downList").hide();
    $("#downListBtn").click(function () {
        $("#downList").slideToggle("slow");
        $("#downListBtn").toggleClass("dropDownNavselect");
    });
    $("#wraper").click(function () {
        $("#downList").slideUp("slow");
        $("#downListBtn").removeClass("dropDownNavselect");
    });
});
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) { 
            $('#ContentPlaceHolder1_blahs')
            .attr('src', e.target.result)
            .width(146)
            .height(146);
};

        reader.readAsDataURL(input.files[0]);
}
}


//Numbers only
function validateNumbers(evt) {
    var theEvent = evt || window.event;
    var key = theEvent.keyCode || theEvent.which;
    key = String.fromCharCode(key);
    var regex = /[0-9]|[\t]|[\b]/;
    var keypressed = evt.keyCode;
    if (keypressed == 37 || keypressed == 39) {
        theEvent.returnValue = true;
}
else {
        if (!regex.test(key)) {
            theEvent.returnValue = false;
            if (theEvent.preventDefault) theEvent.preventDefault();
}
}
}
//--Picture Validation

 function CheckFile() {
        alert("No Image uploaded. Please upload an Image file.");
    }
function CheckExt() {
    alert("Wrong file selected. Please select the correct .jpg Image file.");
}
function CheckSize() {
    alert("Uploaded Image is too large. Maximum 20Kb image is allowed.");
}

    $((function () {
        $("#add_inst_btn").click(function () {
            $("#overlay").show(fast);
        });
    }));

//Masking
//$(function() {
//    $("#ContactNo").mask('(0000)0000000');
//});