function submitAtEnter(event){ if (event.keyCode == 13) { validate(); } } function pageloading() { var docHeight = $(document).height(); var docWidth = $(window).width(); $('#forbackgroud').css({'width':docWidth,'height':docHeight}); $('#forbackgroud').css('display','inline'); var winH = $(window).height(); var winW = $(window).width(); $('#dialog').css('top', winH/2-$('#dialog').height()/2); $('#dialog').css('left', winW/2-$('#dialog').width()/2); $('#dialog').fadeIn("slow"); setTimeout('document.images["dwindow"].src = "/Images/wait24trans.gif"', 200); } function trim(inputString) { // Removes leading and trailing spaces from the passed string. Also // removes consecutive spaces and replaces it with one space. var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings } return retValue; // Return the trimmed string back to the user } // Ends the "trim" function function validate(){ if((document.loginBox.userName.value==null)||(document.loginBox.userName.value=="")){ alert("Please enter your username."); } else if((document.loginBox.password.value==null)||(document.loginBox.password.value=="")){ alert("Please enter your password."); }else{ if((document.loginBox.userName.value!=null)&&(document.loginBox.userName.value!="")){ document.loginBox.userName.value = trim(document.loginBox.userName.value); } if((document.loginBox.password.value!=null)&&(document.loginBox.password.value!="")){ document.loginBox.password.value = trim(document.loginBox.password.value); } pageloading(); loginCall(); } } function loginCall(){ $('.lockedOut').fadeOut('slow'); $('.failed').fadeOut('slow'); $('.noAccess').fadeOut('slow'); var inputs = $("#login :input"); var uid = document.loginBox.userName.value; $('.loading').show(); $.ajax({ url: "/Services/user/validation", type: "POST", data: inputs, async: true, cache: false, dataType: "json", success: function(resp){ if(resp.result=="Success"){ document.loginBox.loginToken.value = resp.secArea+","+resp.secToken; document.loginBox.userInfo.value = resp.fName+","+resp.lName+","+resp.email+","+resp.phone+","+resp.mobile+","+resp.carrierId+","+resp.userType+","+resp.outsiteAccess+","+uid; document.loginBox.action="ConfirmLogin.jsp"; document.loginBox.submit(); }else if(resp.result=="Failure - Account is Locked"){ document.loginBox.userName.value=""; document.loginBox.password.value=""; $('#dialog').fadeOut("slow"); $('#forbackgroud').fadeOut("slow"); $('.lockedOut').fadeIn('slow'); }else if(resp.result=="Failure - No access"){ document.loginBox.userName.value=""; document.loginBox.password.value=""; $('#dialog').fadeOut("slow"); $('#forbackgroud').fadeOut("slow"); $('.noAccess').fadeIn('slow'); }else { document.loginBox.userName.value = ""; document.loginBox.password.value = ""; $('#dialog').fadeOut("slow"); $('#forbackgroud').fadeOut("slow"); $('.failed').fadeIn('slow'); //alert("Login failed. \nPlease verify your username and password are correct and try again."); } }, error: function(x,y,z) { alert(x+'\n'+y+'\n'+z); } }); }
My CITGO Store




Please Wait ...

Please wait...