$(document).ready(function() { $(".close_overlay").click(function() { $(".overlay").fadeOut("fast"); $(".overlay_container").fadeOut("fast"); }); $("#del_resend_verification").click(function() { $("#unDelete").submit(); }); $("#resend_verification").click(function() { $("#resendVerification").submit(); }); $("#resend_password").click(function() { $("#resend_pw").submit(); }); $(".forgot_pw").click(function() { $(".overlay").fadeIn("fast"); $("#forgot_pw").fadeIn("fast"); $("#fpw_email").val($("#loginemail").val()); }); $("#fpw_try_again").click(function() { $(".fpw_no_email").hide(); $(".fpw_email_form").show(); }); $("#login_submit").click(function() { $("#loginForm").submit(); }); $("#reg_submit").click(function() { document.location.href = "register.php"; }); $(".signin_box").css( { "left": (($(".overlay").width()-$(".signin_box").width())/2)+"px" }); $("#close_signin_box").click(function() { $(".signin_box").fadeOut("fast"); $(".overlay").fadeOut("fast"); }); $("#add_new_city_link").click(function() { $("#new_city_form").show(); $("#add_new_city").val(1); $("#choose_city").hide(); }); $("#choose_existing_city").click(function() { $("#new_city_form").hide(); $("#add_new_city").val(0); $("#choose_city").show(); }); $("#new_country").change(function(){ populateStates(); if ($(this).val() == 12 || $(this).val() == 71) { $("#new_state").show(); } else { $("#new_state").hide(); } }); $("#regForm").submit(function(){ /* $("#err_email_exists").hide(); var errors = Array(); var submitThis = true; if(document.regForm.email.value != "") { $.ajax({ type: "POST", url: "/assets/ajax/check_reg.php", async: false, data: "email="+$("#email").val()+"&a=check_email_exists", success: function(msg){ //alert (msg); switch (msg) { case "exists": $("#err_email_exists").show(); //setTimeout($("#err_email_exists").slideUp(),500); submitThis = false; break; case "available": submitThis = true; break; } } }); } if (submitThis == true) { if ($("#password").val() != $("#password2").val()) { errors.push("• Passwords to not match"); } if ($("#password").val() == "") { errors.push("• You must enter a password"); } if ($("#email").val() == "") { errors.push("• You must enter an email address"); } if(document.regForm.email.value.indexOf("@") < 0 || document.regForm.email.value.lastIndexOf(".") < document.regForm.email.value.indexOf("@") ) errors.push("• You must enter a valid email address"); if ($("#displayname").val() == "") { errors.push("• You must enter a screen name"); } if ($("#add_new_city").val() == 0 && ($("#city_id").val() == "" || isNaN($("#city_id").val()))) { errors.push("• You must choose a home city."); } if ($("#add_new_city").val() == 1 && ($("#new_country").val() == "" || isNaN($("#new_country").val()) || $("#new_city").val() == "")) { errors.push("• You must choose a home country and enter a city name."); } if(errors.length > 0){ var errorString = errors.join("\n"); alert("Please correct the following errors to proceed:\n"+errorString); return false; } else return true; } else { return false; } */ }); $("#loginForm").submit(function() { //alert($("#loginemail").val()); //saveUserInfo(); $("#err_no_user").hide(); $("#err_not_active").hide(); $("#err_deleted").hide(); $(".signin_options_box").hide(); var submitThis = true; if ($("#loginemail").val() != "" && $("#loginpassword").val() != "") { $.ajax({ type: "POST", url: "/assets/ajax/check_reg.php", async: false, data: "email="+$("#loginemail").val()+"&password="+$("#loginpassword").val()+"&a=check_user_status", success: function(msg){ //alert (msg); switch (msg) { case "no_user": $("#err_no_user").show(); $(".signin_options_box").slideDown("fast"); submitThis = false; break; case "active": submitThis = true; break; case "not_active": $(".overlay").fadeIn("fast"); $("#err_not_active").fadeIn("fast"); $("#vemail").val($("#loginemail").val()); $("#vpassword").val($("#loginpassword").val()); submitThis = false; break; case "deleted": $(".overlay").fadeIn("fast"); $("#err_deleted").fadeIn("fast"); $("#demail").val($("#loginemail").val()); $("#dpassword").val($("#loginpassword").val()); submitThis = false; break; } } }); return submitThis; } else { alert ("You must enter an email address!"); return false; } }); $("#resendVerification").submit(function() { $.ajax({ type: "POST", url: "/assets/ajax/check_reg.php", async: false, data: "email="+$("#vemail").val()+"&password="+$("#vpassword").val()+"&a=resend_verification", success: function(msg){ //alert (msg); switch (msg) { case "sent": $(".vsent").show(); $("#err_not_active .reg_error_container").hide(); break; } } }); return false; }); $("#unDelete").submit(function() { $.ajax({ type: "POST", url: "/assets/ajax/check_reg.php", async: false, data: "email="+$("#demail").val()+"&a=resend_verification", success: function(msg){ //alert (msg); switch (msg) { case "sent": $(".dsent").show(); $("#err_deleted .reg_error_container").hide(); break; } } }); return false; }); $("#resend_pw").submit(function() { $.ajax({ type: "POST", url: "/assets/ajax/check_reg.php", async: false, data: "email="+$("#fpw_email").val()+"&a=resend_password", success: function(msg){ //alert (msg); switch (msg) { case "sent": $(".fpw_sent").show(); $("#forgot_pw .reg_error_container").hide(); break; case "no_user": $(".fpw_no_email").show(); $("#forgot_pw .reg_error_container").hide(); break; default: $(".overlay").fadeOut("fast"); $(".overlay_container").fadeOut("fast"); $(".fpw_sent").hide(); $(".fpw_no_email").hide(); $("#forgot_pw .reg_error_container").show(); } } }); return false; }); });