function authenticateUser(formName){ if(checkLoginDetails(formName)){ var ajaxVar = new ajaxVars(); ajaxVar.vars['action'] = "runFunction"; ajaxVar.vars['func'] = 'checkUserDetails'; ajaxVar.vars['userName'] = document.getElementById('userEmail').value; ajaxVar.vars['password'] = document.getElementById('userPassword').value; ajaxVar.gotoFunction = 'checkAuthentication'; ajaxVar.AjaxPostSQL(); } return false; } function checkAuthentication(dataArr,fnVars){ if(dataArr > 0){ location.href = "/home/home.html"; return true; }else{ divObj = document.getElementById('errorMess'); divObj.style.visiblity = 'visible'; divObj.innerHTML = "Authentication failed"; return false; } } function checkLoginDetails(formName){ var objVar = new getVars(); objVar.fieldN[0] = "userEmail"; objVar.fieldV[0] = "Company"; objVar.fieldT[0] = "text"; objVar.fieldI[0] = "userEmail"; objVar.fieldN[1] = "userPassword"; objVar.fieldV[1] = "Password"; objVar.fieldT[1] = "text"; objVar.fieldI[1] = "userPassword"; return checkEmpty(formName , objVar); }