document ready(function() { initTimer();function initTimer(){ var myTimer=0;$("#form").on('keydown', function() { if(myTimer) { clearTimeout(myTimer);} myTimer=setTimeout(function() { checkForm();}, 200);});} function checkForm(){ $('#form').validate({ errorPlacement:function(error, element) { error.insertBefore(element);}, rules:{ gid:{ required:true }, username:{ required:true, minlength:4, maxlength:48, remote:{ url:"system/plugins/signup/js/check-username.php", type:"post" } }, email:{ required:true, email:true, maxlength:128, remote:{ url:"system/plugins/signup/js/check-emailBooking.php", type:"post" } }, password1:{ required:true, minlength:4, maxlength:48 }, password2:{ required:true, minlength:4, maxlength:48, equalTo:"#password1" }, checkTerms:{ required:true }, firstname:{ required:true }, lastname:{ required:true, minlength:2 }, street:{ required:true }, zipcode:{ required:true, number:true, minlength:2, maxlength:10 }, city:{ required:true, minlength:2 }, country:{ required:true, minlength:2 }, newUsername:{ minlength:4, maxlength:48, remote:{ url:"system/plugins/signup/js/check-username.php", type:"post" } }, newEmail:{ email:true, maxlength:128, remote:{ url:"system/plugins/signup/js/check-emailChange.php", type:"post" } }, newPassword1:{ minlength:4, maxlength:48 }, newPassword2:{ minlength:4, maxlength:48, equalTo:"#newPassword1" }, newFirstname:{ minlength:2 }, newLastname:{ minlength:2 }, newStreet:{ minlength:2 }, newZipcode:{ minlength:2, maxlength:10 }, newCity:{ minlength:2 }, newCountry:{ minlength:2 }, newUrl:{ minlength:5 }, newTwitter:{ url:true, minlength:2 }, newFacebook:{ url:true, minlength:2 } }, messages:{ username:{ remote:"Please select another username. " }, email:{ remote:"Have you received an invitation? If not, you are not allowed to signup / login here. " }, firstname:{ remote:"Please enter your name. " }, zipcode:{ number:"Please enter a valid zip code. " }, password2:{ equalTo:"Passwords do not match. " }, newEmail:{ remote:"Please use another email address. " }, newPassword2:{ equalTo:"Passwords do not match. " }, newUsername:{ equalTo:"Please select another username " } } });} $('#1_hidden').hide();$('#2_hidden').hide();$('#3_hidden').hide();$('#4_hidden').hide();$('#5_hidden').hide();$('#gid').change(function(){ if($('#gid').val()=='0') { $('#0_hidden').fadeIn();} else { $('#0_hidden').hide();$('#1_hidden').hide();$('#2_hidden').hide();$('#3_hidden').hide();$('#4_hidden').hide();$('#5_hidden').hide();} if($('#gid').val()=='5') { $('#5_hidden').fadeIn();} if($('#gid').val()=='4') { $('#4_hidden').fadeIn();} if($('#gid').val()=='3') { $('#3_hidden').fadeIn();} if($('#gid').val()=='2') { $('#2_hidden').fadeIn();} if($('#gid').val()=='1') { $('#1_hidden').fadeIn();} });})