//This function checks a string for whitespace characters. //Returns true if a string contains only whitespace characters. function checkblank(w) { for (var i = 0; i < w.length; i++) { var y = w.charAt(i); if ((y != ' ') && (y != '\n') && (y != '\t')) return false; } return true; } //Verifies that option values are selected from required drop-down boxes. function checkfornone(s) { var optvalue = ""; for(var i = 0; i < s.options.length; i++) if (s.options[i].selected) { optvalue = (s.options[i].value); } if ((optvalue == "none") || (optvalue == "")) return true; else return false; } //Checks for a valid country - state combination. Returns false for an //invalid combination. function checkstcntry(s, c) { var state_text = ""; var cntry_value = ""; var cntrylen; var len_text; var stcntry = ""; var position; for(var i = 0; i < s.options.length; i++) if (s.options[i].selected) { state_text = (s.options[i].text); } for(var j = 0; j < c.options.length; j++) if (c.options[j].selected) { cntry_value = (c.options[j].value); if (cntry_value != "none") { cntrylen = cntry_value.length - 1; cntry_value = cntry_value.slice(0, cntrylen); } } if (state_text != "") { len_text = state_text.length - 1; position = state_text.lastIndexOf('-'); stcntry = state_text.slice(position + 2); } if ((stcntry != "") && (cntry_value != "none") && (stcntry != cntry_value) && (position != -1)) return true; else return false; } //Verifies that the state option value is selected for a country //where state is required (statereq = 1). function getstatereq(s, c) { var cntry_value = ""; var newcntry_value = ""; var state_value = ""; var cntrylen; var statereq = ""; //Get the last character from the selected country, which indicates //if the state is required or not (1 or 0, respectively). for(var i = 0; i < c.options.length; i++) if (c.options[i].selected) { cntry_value = (c.options[i].value); cntrylen = cntry_value.length - 1; statereq = cntry_value.charAt(cntrylen); } for(var j = 0; j < s.options.length; j++) if (s.options[j].selected) { state_value = (s.options[j].value); } if (statereq == "1" && state_value == "none") return true; else return false; } //Takes out the last character from the selected country value before //submiting the form. function formatcntry(c) { var cntry_value = ""; var newcntry_value = ""; var cntrylen; for(var i = 0; i < c.options.length; i++) if (c.options[i].selected) { cntry_value = (c.options[i].value); cntrylen = cntry_value.length - 1; newcntry_value = cntry_value.slice(0, cntrylen); c.options[i].value = newcntry_value; } } /* // we use users email address as their userid. gotta set the value // of the hidden input to make this happen function initLogid(form) { var hidden = form.shlogid; var text = form.saemail1; hidden.value = text.value; } */ function checkUserName(username) { var errMsg = "User Name can only contain letters, numbers, '@', '.', '_', and '-'\n"; var validChars = "0123456789abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ@._-"; for (var i = 0; i < username.length; i++) { var c = username.charAt(i); if (validChars.indexOf(c) == -1) return errMsg; } return ""; } /* This function is currently just keeping the jobs email addresses from being spam-ed */ function linkemail( toWhom ) { try { var at="@"; var subject="venturajobs"; var domain="patagonia.com"; var emailLink=""; if( toWhom == "RENO") { subject="renojobs"; }else if( toWhom == "RETAIL") { subject="retailjobs"; } emailLink= "mailto:" + subject + at + domain; return emailLink; } catch( e ) { HandleError( "linkemail", e, M_strGFileName ); } }