/* onError */ function handle_error() { //window.alert('HELP!!!!!! THERE\'S AN ERROR!!!!!!!!!!!!!!!!!!!'); } window.onError = handle_error; /* validate sign up forms, check for bad characters only */ function validate(f) { /* iterate through the form elements to get the name & values, validate accordingly. Do not accept hidden form variables, or variables without names */ for(a = 0; a < f.length; a++) { if(f.elements[a].name != '' && f.elements[a].type != 'hidden'){ // validate this form element //window.alert("value = " + f.elements[a].name); if(checker(f.elements[a].value, f.elements[a].name)){f.elements[a].focus();return false;} } } return true; } /* Ensure multiple choice answers and correct answer are provided if question has been entered */ function validateQuestion(f) { if(f.elements['question'].value != "") { var answer = f.elements['multiple_choice_text[]']; var len = answer.length; var bool = 0; for(i=0; i|]/) != -1){ // no quotes allowed window.alert(field + " contains a forbidden character!\nPlease remove and resubmit form.\nCharacters forbidden are: \" | <> {} ^ ][ \\"); return true; } }else{ if(str.search(/[\\\]\[\^{}<>|]/) != -1){ // quotes allowed window.alert(field + " contains a forbidden character!\nPlease remove and resubmit form.\nCharacters forbidden are: | <> {} ^ ][ \\"); return true; } } } /* Check password if 2 passwords match */ function create_password(password1, password2) { if( (password1.value != password2.value) || (password1.value.length < 6) ) { window.alert("Passwords do not match.\nIt should be at least 6 characters long."); return false; } return true; } /* specific to Energy NewsData user accounts, at least 1 contact info must be displayed */ function check_END_display(f) { //window.alert("hello"); if(!f.company_email_display.checked && !f.company_fax_display.checked && !f.company_url_display.checked && !f.company_phone_display.checked) { window.alert('At least one form of contact info must be displayed.\n(phone, email, fax, or url)'); return false; } return true; } /* specific to Energy NewsData posting a job, at least 1 contact info must be displayed */ function check_END_display_job(f) { //window.alert("hello"); if(f.job_contact_email.value=='' && f.job_contact_fax.value=='' && f.job_contact_url.value=='' && f.job_contact_phone.value=='') { window.alert('At least one form of contact info must be displayed.\n(phone, email, fax, or url)'); return false; } if(f.job_contact_email.value != "") // validate the email { if(parse_email(f.job_contact_email.value)){ f.job_contact_email.focus(); return false; } } return true; } // function that sets the default values of the 'refine your search results' search form at bottom of search_results.php function setSearchParameters(state, company_type, job_category) { //window.alert(state + " " + company_type + " " + job_category); state_element = document.getElementById('state'); for(var i=0;i