//onload username focus var loginObj = { username : null, password : null, frozen : null, authorized : null } images: new Asset.images([ '../img/nav_agentLocator_alt.png', '../img/nav_contact_alt.png', '../img/nav_home_alt.png', '../img/nav_products_alt.png', '../img/nav_relatedLinks_alt.png', '../img/header_agentsOnly_alt.png', '../img/logout_inquire_alt.png', '../img/logout_quote_alt.png' ]) var Functions = { login: function() { $('input_agentUsername').focus(); loginObj.username = $('input_agentUsername').value; loginObj.password = $('input_agentPassword').value; var jsonRequest = new Request.JSON({ url: '../../backend/login.php', onSuccess : function(obj, txt) { loginObj = obj; if (loginObj.authorized === true) { newWindow = window.location = "../../frontend/php/logout.php"; } else { (loginObj.frozen === true) ? alert('This account has failed login too many times and has been frozen. Please contact the mutual to remove account restrictions.') : alert('Incorrect username or password. Please try again.'); } } }).send(JSON.encode(loginObj)); }, openWebsite: function(x) { newWindow = window.open("http://"+x, '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=1000, height=750'); if (!newWindow) alert("Your web browser just prevented a pop-up window from opening. We recommend that you allow popus from www.iwsquotes.com. If this is not possible, hold down the 'Ctrl' key and click again."); }, quoting: function() { window.location = 'https://www.iwsquotes.com/forreston/index.php'; }, inquire: function() { window.location = '../../frontend/php/imtPassthrough.php'; }, sendQuery: function() { var submitQuery = {}; submitQuery.firstName = $name('firstName').value; submitQuery.lastName = $name('lastName').value; submitQuery.address = $name('address').value; submitQuery.city = $name('city').value; submitQuery.state = $name('state').value; submitQuery.primaryPhone = $name('primaryPhone').value; submitQuery.secondaryPhone = $name('secondaryPhone').value; submitQuery.email = $name('email').value; submitQuery.questionsOrComments = $name('questionsOrComments').value; var req = new Request.JSON({ url: '../../backend/submitQuery.php', onSuccess: function(obj, txt) { alert('Your information has been submitted. Please wait for a response.'); } }).send(JSON.encode(submitQuery)); } };