function showLoading(){ document.getElementById('divLoading').style.display = 'block'; } function hideLoading(){ document.getElementById('divLoading').style.display = 'none'; } function openDialog(url){ window.open(url, "_blank", "top=100, left=200,height=500, width=700, titlebar=0, menubar=0, location=0, status=0, toolbar=0, scrollbars=1"); } function nextField(e,f){ if(e.keyCode==13){ document.getElementById(f).focus(); } } function showStatus(m){ if(m!=""){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "showStatus", message: m }), success: function(responseText, responseStatus) { jQuery("#divStatus").html(responseText); document.getElementById('divStatus').style.display = 'block'; setTimeout(function(){ hideStatus(); }, 3000); } }); } } function hideStatus(){ document.getElementById('divStatus').style.display = 'none'; } function login(){ if(document.getElementById("username").value==""){ jQuery("#status").html("Please fill in your Username."); }else if(document.getElementById("password").value==""){ jQuery("#status").html("Please fill in your Password."); }else{ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "login", username: jQuery('#username').val(), password: jQuery('#password').val() }), success: function(responseText, responseStatus) { if(responseText=="invalid"){ jQuery("#status").html('Sorry. Username and Password do not match.'); }else if(responseText=="expire"){ expire(); }else if(responseText=="suspend" || responseText=="archive"){ suspend(); }else if(responseText=="inactive"){ jQuery("#status").html('Sorry. Username is inactive.'); }else if(responseText=="migrate"){ jQuery("#status").html('Sorry. Your account is in maintenance progress. Please login after 1 hour.'); }else{ window.location = responseText; } } }); } } function login3(){ if(document.getElementById("username").value==""){ jQuery("#status").html("Please fill in your Username."); }else if(document.getElementById("password").value==""){ jQuery("#status").html("Please fill in your Password."); }else{ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "login3", username: jQuery('#username').val(), password: jQuery('#password').val() }), success: function(responseText, responseStatus) { if(responseText=="invalid"){ jQuery("#status").html('Sorry. Username and Password do not match.'); }else if(responseText=="expire"){ expire(); }else if(responseText=="suspend" || responseText=="archive"){ suspend(); }else if(responseText=="inactive"){ jQuery("#status").html('Sorry. Username is inactive.'); }else{ window.location = responseText; } } }); } } function logout(){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "logout" }), success: function(responseText, responseStatus) { window.location = webpath; } }); } function verifyLogin(){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "verifyLogin" }), success: function(responseText, responseStatus) { if(responseText=='fail'){ alert('Login session expired. Or your account has been accessed elsewhere.'); window.location = webpath; } } }); } function forgetPassForm(){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "forgetPassForm" }), success: function(responseText, responseStatus) { jQuery("#divContent").html(responseText); } }); } function forgetPassSearch(){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "forgetPassSearch", phone: jQuery('#phone').val() }), success: function(responseText, responseStatus) { jQuery("#status").html(responseText); } }); } function forgetPassLink(id){ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "forgetPassLink", phone: jQuery('#phone').val(), resetuser_id: id }), success: function(responseText, responseStatus) { jQuery("#divContent").html(responseText); } }); } function forgetPass(){ if(document.getElementById("newpass").value==""){ jQuery("#status").html("Please fill in your new password."); }else if(document.getElementById("conpass").value==""){ jQuery("#status").html("Please confirm your new password."); }else if(document.getElementById("conpass").value!=document.getElementById("newpass").value){ jQuery("#status").html("Both new passwords do not match."); }else{ jQuery.ajax({ type: "POST", dataType: "html", url: webpath + "ajax.common.php", data: ({ pageaction: "forgetPass", token: jQuery('#token').val(), newpass: jQuery('#newpass').val() }), success: function(responseText, responseStatus) { jQuery("#divForm").html(responseText); } }); } }