function validateFileExtension(n,t){var n=$(".lbl-error"),i=new RegExp("([a-zA-Z0-9s_\\.-:])+(.png|.jpg)$");return i.test(t.toLowerCase())?!0:(n.text("Please select a file of type .png or .jpg."),!1)}function validateFileSize(n,t){return t>2?(n.text("Please select a file size less than 2MB"),!1):!0}function detectIE(){var n=window.navigator.userAgent,i=n.indexOf("MSIE "),u,r,t;return i>0?parseInt(n.substring(i+5,n.indexOf(".",i)),10):(u=n.indexOf("Trident/"),u>0)?(r=n.indexOf("rv:"),parseInt(n.substring(r+3,n.indexOf(".",r)),10)):(t=n.indexOf("Edge/"),t>0)?parseInt(n.substring(t+5,n.indexOf(".",t)),10):!1}$.validator.setDefaults({highlight:function(n){$(n).closest(".form-group").addClass("has-error")},unhighlight:function(n){$(n).closest(".form-group").removeClass("has-error")},errorElement:"span",errorClass:"help-block",errorPlacement:function(n,t){t.parent(".input-group").length?n.insertAfter(t.parent()):n.insertAfter(t)}});$(function(){$("#file-input").change(function(){var r=detectIE(),i;if(r!=9){var n=this.value,u=this.files[0].size/1048576,t=$(".lbl-error"),f=validateFileSize(t,u);f&&(i=validateFileExtension(t,n),i&&($("#fileName").val(n),$("#uploadImageForm").submit()))}})})