// Configuration Variables Signup = {}; // Set this to false to turn off signup. Signup.doSignUp = false; Signup.proxyScript = '/signup/proxy.php'; Signup.signupHTML = '/signup/signupform.php'; Signup.yornForm = '/signup/yornform.php'; Signup.categoryURL = 'http://jobs.retirementjobs.com/careers/jobsearch/results?' + 'searchType=advanced&country=United+States&' + 'sortBy=relevance&pageSize=20&view=Expanded&categories='; // Don't edit below this point unless // you know what you're doing. Signup.polling = false; Signup.request = null; Signup.catsearch = null; Signup.signupForm = function() { if(!Signup.polling) { DialogBox.close(); waitBox(); if(!Signup.request) { Signup.request = getRequestObject(); } Signup.request.open('GET', Signup.signupHTML + "?q=" + Math.random(), true); Signup.request.send(null); Signup.polling = true; } if(!Signup.request) { return; } if(Signup.request.readyState != 4) { window.setTimeout('Signup.signupForm()', 500); return; } var text = Signup.request.responseText; Signup.request = null; Signup.polling = false; DialogBox.close(); dialogBox(500, 350, "Free Account Sign-up", text, 'Signup.continueSearch()', 'fname'); } Signup.viewAccount = function(url) { DialogBox.close(); window.location.href = url; } Signup.signupRequest = function(data) { if(!Signup.polling) { var url = Signup.proxyScript + '?' + data; waitBox(); if(!Signup.request) { Signup.request = getRequestObject(); } Signup.request.open('GET', url, true); Signup.request.send(null); Signup.polling = true; } if(!Signup.request) { return; } if(Signup.request.readyState != 4) { window.setTimeout('Signup.signupRequest(null)', 500); return; } text = Signup.request.responseText; Signup.request = null; Signup.polling = false; DialogBox.close(); dialogBox(325, 175, "Thank You", text, 'Signup.continueSearch()', null); } Signup.continueSearch = function() { DialogBox.close(); waitBox(); Signup.submitSearchForm(); } Signup.submitSearchForm = function() { if(Signup.catsearch) { document.location.href = Signup.catsearch; } else { document.advJobsearchForm.submit(); } } Signup.fnameChecked = function() { DialogBox.close(); document.signup.FirstName.focus(); } Signup.lnameChecked = function() { DialogBox.close(); document.signup.LastName.focus(); } Signup.emailChecked = function() { DialogBox.close(); document.signup.Email.focus(); } Signup.passChecked = function() { document.signup.Pass.value = ''; document.signup.ConfirmPass.value = ''; document.signup.Pass.focus(); DialogBox.close(); } Signup.confirmChecked = function() { document.signup.ConfirmPass.value = ''; DialogBox.close(); } Signup.zipChecked = function() { document.signup.Zip.value = ''; document.signup.Zip.focus(); DialogBox.close(); } Signup.checkSignup = function() { if(!document.signup.FirstName.value) { alertBox("You need to enter your first name.", 'Signup.fnameChecked()', 'Missing First Name'); return; } if(!document.signup.LastName.value) { alertBox("You need to enter your last name.", 'Signup.lnameChecked()', 'Missing Last Name'); return; } if(!document.signup.Email.value) { alertBox("You need to enter your email address.", 'Signup.emailChecked()', 'Missing Email Address'); return; } if(!validEmail(document.signup.Email.value)) { var message = "You need to enter a valid email address like you@yourwork.com. " + "Please try again."; document.signup.Email.value = ''; alertBox(message, 'Signup.emailChecked()', 'Invalid Email'); return; } if(!document.signup.Pass.value) { alertBox("You need to enter a password.", 'Signup.passChecked()', 'Missing Password'); return; } if(document.signup.Pass.value.length < 6) { alertBox("Your password must be at least 6 characters long.", 'Signup.passChecked()', 'Password Too Short'); return; } if(!document.signup.ConfirmPass.value) { alertBox("You need to confirm your password.", 'Signup.confirmChecked()', 'Missing Password Confirmation'); return; } if(document.signup.Pass.value != document.signup.ConfirmPass.value) { alertBox("The two passwords you entered don't match.", 'Signup.passChecked()', 'Missmatched Passwords'); return; } if(!document.signup.Zip.value) { alertBox("You need to enter your zip code.", 'Signup.zipChecked()', 'Missing Zip Code'); return; } if(!document.signup.Zip.value.match(/^[0-9][0-9][0-9][0-9][0-9]$/)) { alertBox("Your zip code should just be five digits.", 'Signup.zipChecked()', 'Invalid Zip Code'); return; } var fname = document.signup.FirstName.value; var lname = document.signup.LastName.value; var email = document.signup.Email.value; var pass = document.signup.Pass.value; var pass2 = document.signup.ConfirmPass.value; var zip = document.signup.Zip.value; fname = capitalize(fname.toLowerCase()); lname = capitalize(lname.toLowerCase()); email = email.toLowerCase(); var data = ""; data += "&FirstName=" + fname; data += "&LastName=" + lname; data += "&Email=" + email; data += "&Pass=" + pass; data += "&ConfirmPass=" + pass2; data += "&Zip=" + zip; DialogBox.close(); Signup.signupRequest(data); } Signup.signupYorN = function() { if(!Signup.polling) { try { if(!Signup.request) { Signup.request = getRequestObject(); } Signup.request.open('GET', Signup.yornForm + "?q=" + Math.random(), true); Signup.request.send(null); } catch(e) { Signup.submitSearchForm(); } waitBox(); Signup.polling = true; } if(!Signup.request) { return; } if(Signup.request.readyState != 4) { window.setTimeout('Signup.signupYorN()', 500); return; } var text = Signup.request.responseText; Signup.request = null; Signup.polling = false; DialogBox.close(); dialogBox(450, 400, "Free Account Sign-up", text, 'Signup.continueSearch()', 'fname'); } Signup.submitSearch = function(category) { //Signup.submitSearchForm(); //return; if(document.advJobsearchForm.zip.value) { var val = document.advJobsearchForm.zip.value; if(val.length != 5) { alert("Zip code must be 5 digits."); return; } if(!val.match(/^[0-9]+$/)) { alert("Zip code must be 5 digits."); return; } document.advJobsearchForm['radius'].value = 40; } else { document.advJobsearchForm['radius'].value = 0; } if(category) { Signup.catsearch = Signup.categoryURL + category + '&rj_signup=true'; } if(!Signup.doSignUp) { Signup.submitSearchForm(); return; } if(!testRequestObject('index.html')) { Signup.submitSearchForm(); return; } if(!readCookie('rj_signup')) { createCookie('rj_signup', 'true', 1); Signup.signupYorN(); return; } Signup.submitSearchForm(); }