function ValidateDetails(obj,args){if($('input[data-impo]').filter(function(){return $.trim($(this).val())==""}).length){alr('Please Fill in all areas marked with Asterisk');args.IsValid=false;return}if(!/^(?=[a-zA-Z0-9._]{2,20}$)(?!.*[_.]{2})[^_.].*[^_.]$/.test($('input[id*=U_Name]').val())){alr('Username is invalid');args.IsValid=false;return}if(!$.trim($('input[id*=P_Word]').val()).length>=4){alr('Passwords must be greater than 4 characters');args.IsValid=false;return}if($('input[id*=Email]').first().val().toLowerCase()!==$('input[id*=Email]').last().val().toLowerCase()){alr('Emails do not Match');args.IsValid=false;return}if($('input[id*=P_Word]').first().val()!=$('input[id*=P_Word]').last().val()){alr('Passwords do not Match');args.IsValid=false;return}var fUpload=$('input[type=file][data-upload]');if(fUpload.length&&fUpload.prop("files").length===0){alr('Please upload a photo');args.IsValid=false;return}var f=$('#_ch,#isvalid');if(f.length&&!f.filter(':checked').length){alr('You have to agree with the Terms and Conditions!');args.IsValid=false;return}args.IsValid=true}function alr(q){alertify.alert('Alert',q).set('resizable',false)}$(document).on('keydown','input[type=text],input[type=email],input[type=password]',function(e){if(e.keyCode===13){e.preventDefault()}});$(document).on("change",'input[type=file][data-upload]',function(){var s=$(this),limit=parseInt(s.attr('data-sz'))||3,file=this.files[0];if(file&&file.size>limit*1024*1024){s.val("");alr("File size exceeds the allowed limit of "+limit+"MB.");return}var allowedExtensions=/(\.jpg|\.jpeg|\.png)$/i,fileName=file.name,fileExtension=fileName.substr(fileName.lastIndexOf('.')).toLowerCase();if(!allowedExtensions.exec(fileExtension)){s.val("");alr("File type is not allowed. Only jpg, jpeg, and png files are allowed.");return}});