//Function to remove leading and trailing spaces from fields function trim(tmpString){ //Replaces leading spaces while (tmpString.charAt(0) == " ") { tmpString = tmpString.substring(1, tmpString.length) } //Removes trailing spaces while (tmpString.charAt(tmpString.length - 1) == " ") { tmpString = tmpString.substring(0, tmpString.length - 1) } //Returns string return tmpString; } //Function to validate dates function dateChecker(date) { var validDate = true; //Tests to make sure the string is exactly 10 characters long if (date.length != 10) validDate = false; //Extracts month, day, year, and slashes from string month = date.substring(0, 2); firstSlash = date.substring(2, 3); day = date.substring(3, 5); secondSlash = date.substring(5, 6); year = date.substring(6, 10); //Tests month, day, year, and slashes if (month < 1 | month > 12) validDate = false; if (firstSlash != "/") validDate = false; if (day < 1 | day > 31) validDate = false; if (secondSlash != "/") validDate = false; if (year < 0 | year > 2999) validDate = false; //Checks to make sure that April, June, Sept, or November 31st isn't entered if ((month == 4 | month == 6 | month == 9 | month == 11) & (day == 31)) validDate = false; //Tests February if (month == 2) { var g = parseInt(year/4) if (isNaN(g)) validDate = false; if (day > 29) validDate = false; if (day == 29 & ((year/4) != g)) validDate = false; } //Returns true or false return validDate; } //Function to compare two dates function compareDates(date1, date2){ var validDates = true; //Extracts month, day, and year from strings var month1 = date1.substring(0, 2); var day1 = date1.substring(3, 5); var year1 = date1.substring(6, 10); var month2 = date2.substring(0, 2); var day2 = date2.substring(3, 5); var year2 = date2.substring(6, 10); firstDate = new Date(); secDate = new Date(); firstDate.setDate(day1); firstDate.setMonth(month1 - 1); firstDate.setYear(year1); secDate.setDate(day2); secDate.setMonth(month2 - 1); secDate.setYear(year2); if (firstDate.getTime() >= secDate.getTime()) { validDates = false; } //Returns true or false return validDates; } //Function to set cookie function setCookie(name, value) { document.cookie = name + "=" + escape(value); } //Function to get cookie function getCookie(name) { var search = name + "="; //Determines if any cookies exist if (document.cookie.length > 0) { var offset = document.cookie.indexOf(search); //Ensures requested cookie exists if (offset != -1) { //Sets offset to beginning of the value offset += search.length; //Sets index of the beginning of the value end = document.cookie.indexOf(";", offset) //If requested cookie is the only cookie if (end == -1) { end = document.cookie.length; } return unescape(document.cookie.substring(offset, end)); //Requested cookie doesn't exist } else { return "error"; } //No cookies exist } else { return "error" } } //Function to write URL for Cancel button function writeCancel() { var cameFrom = getCookie("url"); if (cameFrom == "error") { return "/admin"; } else { return cameFrom; } } //Function to changes location for Resumes By Date Submitted view in ACP function changeLocation() { setLocation(); var i = 0; //Loops through radio button to determine which option is checked for (i = 0; i < 2; i++) { if (document.forms[0].tLocation[i].checked) { break; } } //Changes location for user location.href = document.forms[0].tLocation[i].value } //Function to set default location for user for Resumes by Date Submitted view in ACP function setLocation(){ cookieName = "resumeLocation" //if (document.forms[0].tSave.checked) { var i = 0; //Loops through radio button to determine which option is checked for (i = 0; i < 2; i++) { if (document.forms[0].tLocation[i].checked) { break; } } //Writes cookie cookieExpire = new Date(2008, 0, 1); cookieValue = escape(document.forms[0].tLocation[i].value); document.cookie = cookieName + "=" + cookieValue + "; expires=" + cookieExpire.toGMTString(); //} else { //Deletes cookie //alert("Delete cookie"); //cookieExpire = new Date(2001, 0, 1); //cookieValue = ""; //document.cookie = cookieName + "=" + cookieValue + "; expires=" + cookieExpire.toGMTString(); //} //Refreshes page to ensure correct link is displayed in left navigation location.href = location.href } //Function to get default location for user for Resumes by Date Submitted view in ACP function getLocation() { var location = getCookie("resumeLocation"); if (location == "error" | location == "") { return "vwResumesByDateSubmitted?OpenForm"; } else { return location; } } //Function function setSave() { currentLocation = location.href.toLowerCase(); cookieLocation = getLocation().toLowerCase(); if(currentLocation.indexOf(cookieLocation) > -1) { document.forms[0].tSave.checked = true; } else { document.forms[0].tSave.checked = false; } }